CS-Notes/docs/_style/prism-master/examples/prism-nasm.html

74 lines
2.4 KiB
HTML
Raw Normal View History

2018-12-19 14:09:39 +08:00
<h2>Comments</h2>
<pre><code>; This is a comment</code></pre>
<h2>Labels</h2>
<pre><code>label1: ; a non-local label
.local: ; this is really label1.local
..@foo: ; this is a special symbol
label2: ; another non-local label
.local: ; this is really label2.local
</code></pre>
<h2>Registers</h2>
<pre><code>st0
st1
ax
rax
zmm4</code></pre>
<h2>Strings</h2>
<pre><code>
mov eax,'abcd'
db 'hello' ; string constant
db 'h','e','l','l','o' ; equivalent character constants
dd 'ninechars' ; doubleword string constant
dd 'nine','char','s' ; becomes three doublewords
db 'ninechars',0,0,0 ; and really looks like this
db `\u263a` ; UTF-8 smiley face
db `\xe2\x98\xba` ; UTF-8 smiley face
db 0E2h, 098h, 0BAh ; UTF-8 smiley face
</code></pre>
<h2>Numbers</h2>
<pre><code>mov ax,200 ; decimal
mov ax,0200 ; still decimal
mov ax,0200d ; explicitly decimal
mov ax,0d200 ; also decimal
mov ax,0c8h ; hex
mov ax,$0c8 ; hex again: the 0 is required
mov ax,0xc8 ; hex yet again
mov ax,0hc8 ; still hex
mov ax,310q ; octal
mov ax,310o ; octal again
mov ax,0o310 ; octal yet again
mov ax,0q310 ; octal yet again
mov ax,11001000b ; binary
db -0.2 ; "Quarter precision"
dw -0.5 ; IEEE 754r/SSE5 half precision
dd 1.2 ; an easy one
dd 0x1p+2 ; 1.0x2^2 = 4.0
dq 0x1p+32 ; 1.0x2^32 = 4 294 967 296.0
dq 1.e10 ; 10 000 000 000.0
dq 1.e+10 ; synonymous with 1.e10
dq 1.e-10 ; 0.000 000 000 1
dt 3.141592653589793238462 ; pi
do 1.e+4000 ; IEEE 754r quad precision
</code></pre>
<h2>Known failures</h2>
<p>There are certain edge cases where Prism will fail.
There are always such cases in every regex-based syntax highlighter.
However, Prism dares to be open and honest about them.
If a failure is listed here, it doesnt mean it will never be fixed. This is more of a “known bugs” list, just with a certain type of bug.
</p>
<h3>Numbers with underscores</h3>
<pre><code>mov ax,1100_1000b
mov ax,1100_1000y
mov ax,0b1100_1000
mov ax,0y1100_1000
dd 1.222_222_222</code></pre>