Warning, /frameworks/syntax-highlighting/autotests/input/highlight.asm-fasm is written in an unsupported language. File is not indexed.
0001 jmp near dword [0] 0002 jmp far dword [0] 0003 0004 mov bx,ax ; general register to general register 0005 mov [char],al ; general register to memory 0006 mov dl,32 ; immediate value to general register 0007 mov cr3,ebx ; general register to control register 0008 0009 xchg ax,bx ; swap two general registers 0010 xchg al,[char] ; swap register with memory 0011 0012 push ax ; store general register 0013 push es ; store segment register 0014 pushw [bx] ; store memory 0015 push 1000h ; store immediate value 0016 0017 imul ax,[si],10 ; memory by immediate value to register 0018 0019 bt ax,15 ; test bit in register 0020 bts word [bx],15 ; test and set bit in memory 0021 0022 bswap edx ; swap bytes in register 0023 0024 jmp 100h ; direct near jump 0025 jmp 0FFFFh:0 ; direct far jump 0026 jmp ax ; indirect near jump 0027 jmp pword [ebx] ; indirect far jump 0028 0029 movs byte [di],[si] ; transfer byte 0030 movs word [es:di],[ss:si] ; transfer word 0031 movsd ; transfer double word 0032 0033 cmpxchg8b [bx] ; compare and exchange 8 bytes 0034 0035 movq2dq xmm0,mm1 ; move from MMX register to SSE register 0036 movdq2q mm0,xmm1 ; move from SSE register to MMX register 0037 0038 enter 2048,0 ; enter and allocate 2048 bytes on stack 0039 0040 mov [rip+3],sil ; manual RIP-relative addressing 0041 0042 blendvps xmm3,xmm7,xmm0 ; blend according to mask 0043 vgatherqps xmm0,[xmm2],xmm3 ; gather two floats 0044 vgatherqps xmm0,[ymm2+64],xmm3 ; gather four floats 0045 vfmsub231ps ymm1,ymm2,ymm3 ; multiply and subtract 0046 vfnmadd132sd xmm0,xmm5,[ebx] ; multiply, negate and add 0047 vpermil2ps ymm0,ymm3,ymm7,ymm2,0 ; permute from two sources 0048 0049 vscatterdps [eax+xmm1]{k1},xmm0 ; scatter four floats 0050 vscatterdpd [ymm3*8]{k3},zmm0 ; scatter eight doubles 0051 0052 dd sum 0053 x = 1 0054 x = x+2 0055 sum = x 0056 0057 0058 if count>0 0059 mov cx,count 0060 rep movsb 0061 end if 0062 0063 0064 if count & ~ count mod 4 0065 mov cx,count/4 0066 rep movsd 0067 else if count>4 0068 mov cx,count/4 0069 rep movsd 0070 mov cx,count mod 4 0071 rep movsb 0072 else 0073 mov cx,count 0074 rep movsb 0075 end if 0076 0077 repeat 8 0078 mov byte [bx],% 0079 inc bx 0080 end repeat 0081 0082 0083 s = x/2 0084 repeat 100 0085 if x/s = s 0086 break 0087 end if 0088 s = (s+x/s)/2 0089 end repeat 0090 0091 repeat $-$$ 0092 load a byte from $$+%-1 0093 store byte a xor c at $$+%-1 0094 end repeat 0095 0096 GDTR dp ? 0097 virtual at GDTR 0098 GDT_limit dw ? 0099 GDT_address dd ? 0100 end virtual 0101 0102 virtual at 0 0103 file 'a.txt':10h,1 0104 load char from 0 0105 end virtual 0106 0107 virtual at 0 as 'asc' 0108 times 256 db %-1 0109 end virtual 0110 0111 virtual at 0 0112 hex_digits:: 0113 db '0123456789ABCDEF' 0114 end virtual 0115 load a byte from hex_digits:10 0116 0117 bits = 16 0118 display 'Current offset is 0x' 0119 repeat bits/4 0120 d = '0' + $ shr (bits-%*4) and 0Fh 0121 if d > '9' 0122 d = d + 'A'-'9'-1 0123 end if 0124 display d 0125 end repeat 0126 display 13,10 0127 0128 if ~ defined alpha 0129 alpha: 0130 end if 0131 0132 if ~ defined alpha | defined @f 0133 alpha: 0134 @@: 0135 end if 0136 0137 include 'macros.inc' 0138 0139 d equ dword 0140 NULL equ d 0 0141 d equ edx 0142 0143 d equ d,eax 0144 0145 b equ byte 0146 w equ word 0147 d equ dword 0148 p equ pword 0149 f equ fword 0150 q equ qword 0151 t equ tword 0152 x equ dqword 0153 y equ qqword 0154 0155 incl fix include 0156 0157 macro tst {test al,0xFF} 0158 0159 macro stos0 0160 { 0161 xor al,al 0162 stosb 0163 } 0164 0165 macro align value { rb (value-1)-($+value-1) mod value } 0166 0167 macro mov op1,op2 0168 { 0169 if op1 in <ds,es,fs,gs,ss> & op2 in <cs,ds,es,fs,gs,ss> 0170 push op2 0171 pop op1 0172 else 0173 mov op1,op2 0174 end if 0175 } 0176 0177 macro stoschar [char] 0178 { 0179 mov al,char 0180 stosb 0181 } 0182 0183 macro movstr 0184 { 0185 local move 0186 move: 0187 lodsb 0188 stosb 0189 test al,al 0190 jnz move 0191 } 0192 0193 macro strtbl name,[string] 0194 { 0195 common 0196 label name dword 0197 forward 0198 local label 0199 dd label 0200 forward 0201 label db string,0 0202 } 0203 0204 push 3 0205 push 2 0206 push 1 0207 call foo 0208 0209 macro invoke proc,[arg] 0210 { common stdcall [proc],arg } 0211 0212 macro jif op1,cond,op2,label 0213 { 0214 cmp op1,op2 0215 j#cond label 0216 } 0217 0218 macro label name 0219 { 0220 label name 0221 if ~ used name 0222 display `name # " is defined but not used.",13,10 0223 end if 0224 } 0225 0226 macro message arg 0227 { 0228 if arg eqtype "" 0229 local str 0230 jmp @f 0231 str db arg,0Dh,0Ah,24h 0232 @@: 0233 mov dx,str 0234 else 0235 mov dx,arg 0236 end if 0237 mov ah,9 0238 int 21h 0239 } 0240 0241 macro ext instr 0242 { 0243 macro instr op1,op2,op3 0244 \{ 0245 if op3 eq 0246 instr op1,op2 0247 else 0248 instr op1,op2 0249 instr op2,op3 0250 end if 0251 \} 0252 } 0253 0254 ext add 0255 ext sub 0256 0257 0258 macro tmacro [params] 0259 { 0260 common macro params { 0261 } 0262 MACRO fix tmacro 0263 ENDM fix } 0264 0265 0266 MACRO stoschar char 0267 mov al,char 0268 stosb 0269 ENDM 0270 0271 postpone 0272 { 0273 code_size = $ 0274 } 0275 0276 struc point x,y 0277 { 0278 .x dw x 0279 .y dw y 0280 } 0281 0282 struc db [data] 0283 { 0284 common 0285 . db data 0286 .size = $ - . 0287 } 0288 0289 rept 5 { in al,dx } 0290 0291 rept 3 counter 0292 { 0293 byte#counter db counter 0294 } 0295 0296 match +,+ { include 'first.inc' } 0297 match +,- { include 'second.inc' } 0298 match a b, 1+2+3 { db a } 0299 0300 V fix { 0301 macro empty 0302 V 0303 V fix } 0304 V 0305 0306 0307 list equ 0308 0309 macro append item 0310 { 0311 match any, list \{ list equ list,item \} 0312 match , list \{ list equ item \} 0313 } 0314 0315 define a b+4 0316 define b 3 0317 rept 1 result:a*b+2 { define c result } 0318 0319 rept 8 n:0 { pxor xmm#n,xmm#n } 0320 0321 0322 irps reg, al bx ecx 0323 { xor reg,reg } 0324 0325 0326 if 0 0327 a = 1 0328 b equ 2 0329 end if 0330 dd b 0331 0332 0333 extrn exit 0334 extrn '__imp__MessageBoxA@16' as MessageBox:dword 0335 0336 extrn 'printf' as _printf 0337 printf = PLT _printf 0338 0339 tester? = 0 0340 0341 space: 0342 space.x = 1 0343 space.y = 2 0344 space.color: 0345 space.color.r = 0 0346 space.color.g = 0 0347 space.color.b = 0 0348 0349 space: 0350 namespace space 0351 x = 1 0352 y = 2 0353 color: 0354 .r = 0 0355 .g = 0 0356 .b = 0 0357 end namespace 0358 0359 0360 first: 0361 .child = 1 0362 ..other = 0 0363 second: 0364 .child = 2 0365 ..another = ..other 0366 0367 0368 label character:byte 0369 label char:1 0370 0371 byte? = 1 ; 8 bits 0372 word? = 2 ; 16 bits 0373 dword? = 4 ; 32 bits 0374 fword? = 6 ; 48 bits 0375 pword? = 6 ; 48 bits 0376 qword? = 8 ; 64 bits 0377 tbyte? = 10 ; 80 bits 0378 tword? = 10 ; 80 bits 0379 dqword? = 16 ; 128 bits 0380 xword? = 16 ; 128 bits 0381 qqword? = 32 ; 256 bits 0382 yword? = 32 ; 256 bits 0383 dqqword? = 64 ; 512 bits 0384 zword? = 64 ; 512 bits 0385 0386 element A 0387 linpoly = A + A + 3 0388 vterm = linpoly scale 1 * linpoly element 1 ; vterm = 2 * A 0389 0390 db 4 dup 90h ; generate 4 bytes 0391 db 2 dup ('abc',10) ; generate 8 bytes 0392 0393 macro measured name,string 0394 local top 0395 name db string 0396 top: name.length = top - name 0397 end macro 0398 0399 measured hello, 'Hello!' ; hello.length = 6 0400 0401 A equ 1 0402 A equ 2 0403 0404 drop A 0405 drop A 0406 0407 data1 dw 1 0408 buffer1 rb 10h ; zeroed and present in the output 0409 0410 org 400h 0411 data dw 2 0412 buffer2 rb 20h ; not in the output 0413 0414 section 1000h 0415 data3 dw 3 0416 buffer3 rb 30h ; not in the output 0417 0418 virtual at 0 0419 hex_digits:: 0420 db '0123456789ABCDEF' 0421 end virtual 0422 load a:byte from hex_digits:10 ; a = 'A' 0423 0424 db "Text" 0425 key = 7Bh 0426 repeat $-$$ 0427 load a : byte from $$+%-1 0428 store a xor key : byte at $$+%-1 0429 end repeat 0430 0431 load char : byte from const:0 0432 0433 if $>10000h 0434 err 'segment too large' 0435 end if 0436 calminstruction please? cmd& 0437 match =do? =not? cmd, cmd 0438 jyes done 0439 assemble cmd 0440 done: 0441 end calminstruction 0442 0443 please do not display 'Bye!' 0444 0445 macro jmpi target 0446 if target-($+2) < 80h & target-($+2) >= -80h 0447 db 0EBh 0448 db target-($+1) 0449 else 0450 db 0E9h 0451 dw target-($+2) 0452 end if 0453 end macro 0454 0455 macro EX? first,second 0456 match (=SP?), first 0457 match =HL?, second 0458 db 0E3h 0459 else match =IX?, second 0460 db 0DDh,0E3h 0461 else match =IY?, second 0462 db 0FDh,0E3h 0463 else 0464 err "incorrect second argument" 0465 end match 0466 else match =AF?, first 0467 match =AF'?, second 0468 db 08h 0469 else 0470 err "incorrect second argument" 0471 end match 0472 else match =DE?, first 0473 match =HL?, second 0474 db 0EBh 0475 else 0476 err "incorrect second argument" 0477 end match 0478 else 0479 err "incorrect first argument" 0480 end match 0481 end macro 0482 0483 EX (SP),HL 0484 0485 macro INC? argument 0486 match [:r:], argument 0487 db 100b + r shl 3 0488 else match (=HL?), argument 0489 db 34h 0490 else match (=IX?+d), argument 0491 db 0DDh,34h,d 0492 else match (=IY?+d), argument 0493 db 0FDh,34h,d 0494 else 0495 err "incorrect argument" 0496 end match 0497 end macro 0498 0499 INC (IX+2) 0500 0501 element IY? 0502 0503 element L? : register + 101b 0504 0505 macro CALL? arguments& 0506 local cc,nn 0507 match condition =, target, arguments 0508 cc = condition - CC 0509 nn = target 0510 db 0C4h + cc shl 3 0511 else 0512 nn = arguments 0513 db 0CDh 0514 end match 0515 dw nn 0516 end macro