jmpneardword[0] jmpfardword[0] movbx,ax; general register to general register mov[char],al; general register to memory movdl,32; immediate value to general register movcr3,ebx; general register to control register xchgax,bx; swap two general registers xchgal,[char]; swap register with memory pushax; store general register pushes; store segment register pushw[bx]; store memory push1000h; store immediate value imulax,[si],10; memory by immediate value to register btax,15; test bit in register btsword[bx],15; test and set bit in memory bswapedx; swap bytes in register jmp100h; direct near jump jmp0FFFFh:0; direct far jump jmpax; indirect near jump jmppword[ebx]; indirect far jump movsbyte[di],[si]; transfer byte movsword[es:di],[ss:si]; transfer word movsd; transfer double word cmpxchg8b[bx]; compare and exchange 8 bytes movq2dqxmm0,mm1; move from MMX register to SSE register movdq2qmm0,xmm1; move from SSE register to MMX register enter2048,0; enter and allocate 2048 bytes on stack mov[rip+3],sil ; manual RIP-relative addressing blendvpsxmm3,xmm7,xmm0; blend according to mask vgatherqpsxmm0,[xmm2],xmm3; gather two floats vgatherqpsxmm0,[ymm2+64],xmm3; gather four floats vfmsub231psymm1,ymm2,ymm3; multiply and subtract vfnmadd132sdxmm0,xmm5,[ebx]; multiply, negate and add vpermil2psymm0,ymm3,ymm7,ymm2,0; permute from two sources vscatterdps[eax+xmm1]{k1},xmm0; scatter four floats vscatterdpd[ymm3*8]{k3},zmm0; scatter eight doubles dd sum x=1 x= x+2 sum= x if count>0 movcx,count repmovsb endif if count &~ count mod4 movcx,count/4 repmovsd elseif count>4 movcx,count/4 repmovsd movcx,count mod4 repmovsb else movcx,count repmovsb endif repeat8 movbyte[bx],% incbx endrepeat s= x/2 repeat100 if x/s = s break endif s=(s+x/s)/2 endrepeat repeat$-$$ load a byte from $$+%-1 storebyte a xor c at $$+%-1 endrepeat GDTRdp? virtualat GDTR GDT_limitdw? GDT_addressdd? endvirtual virtualat0 file'a.txt':10h,1 load char from 0 endvirtual virtualat0 as 'asc' times256db%-1 endvirtual virtualat0 : db'0123456789ABCDEF' endvirtual load a byte from hex_digits:10 bits=16 display'Current offset is 0x' repeat bits/4 d='0'+$shr(bits-%*4)and0Fh if d >'9' d= d +'A'-'9'-1 endif display d endrepeat display13,10 if~defined alpha endif if~defined alpha |defined endif include'macros.inc' d equ dword NULL equ d 0 d equ edx d equ d,eax b equ byte w equ word d equ dword p equ pword f equ fword q equ qword t equ tword x equ dqword y equ qqword incl fix include macro tst {testal,0xFF} macro stos0 { xoral,al stosb } macro align value {rb(value-1)-($+value-1)mod value } macro mov op1,op2 { if op1 in <ds,es,fs,gs,ss>& op2 in <cs,ds,es,fs,gs,ss> push op2 pop op1 else mov op1,op2 endif } macro stoschar [char] { moval,char stosb } macro movstr { local move lodsb stosb testal,al jnz move } macro strtbl name,[string] { common label name dword forward local label dd label forward labeldb string,0 } push3 push2 push1 call foo macro invoke proc,[arg] {common stdcall [proc],arg } macro jif op1,cond,op2,label { cmp op1,op2 j#cond label } macro label name { label name if~used name display`name #" is defined but not used.",13,10 endif } macro message arg { if arg eqtype "" local str jmp strdb arg,0Dh,0Ah,24h movdx,str else movdx,arg endif movah,9 int21h } macro ext instr { macro instr op1,op2,op3 \{ if op3 eq instr op1,op2 else instr op1,op2 instr op2,op3 endif \} } ext add ext sub macro tmacro [params] { common macro params { } MACRO fix tmacro ENDM fix } MACRO stoschar char moval,char stosb ENDM postpone { code_size=$ } struc point x,y { .xdw x .ydw y } strucdb[data] { common . db data .size=$-. } rept5{inal,dx} rept3 counter { byte#counter db counter } match+,+{include'first.inc'} match+,-{include'second.inc'} match a b,1+2+3{db a } V fix { macro empty V V fix } V list equ macro append item { match any, list \{list equ list,item \} match, list \{list equ item \} } define a b+4 define b 3 rept1 result:a*b+2{define c result } rept8 n:0{pxor xmm#n,xmm#n } irps reg,albxecx {xor reg,reg } if0 a=1 b equ 2 endif dd b extrn exit extrn'__imp__MessageBoxA@16' as MessageBox:dword extrn'printf' as _printf printf=PLT _printf tester?=0 space.x=1 space.y=2 space.color.r=0 space.color.g=0 space.color.b=0 namespace space x=1 y=2 .r=0 .g=0 .b=0 endnamespace .child=1 ..other=0 .child=2 ..another=..other label character:byte label char:1 byte?=1; 8 bits word?=2; 16 bits dword?=4; 32 bits fword?=6; 48 bits pword?=6; 48 bits qword?=8; 64 bits tbyte?=10; 80 bits tword?=10; 80 bits dqword?=16; 128 bits xword?=16; 128 bits qqword?=32; 256 bits yword?=32; 256 bits dqqword?=64; 512 bits zword?=64; 512 bits element A linpoly= A + A +3 vterm= linpoly scale 1* linpoly element 1; vterm = 2 * A db4 dup 90h; generate 4 bytes db2 dup ('abc',10); generate 8 bytes macro measured name,string local top namedb string name.length= top - name endmacro measured hello,'Hello!'; hello.length = 6 A equ 1 A equ 2 drop A drop A data1dw1 buffer1rb10h; zeroed and present in the output org400h datadw2 buffer2rb20h; not in the output section1000h data3dw3 buffer3rb30h; not in the output virtualat0 : db'0123456789ABCDEF' endvirtual load a:byte from hex_digits:10; a = 'A' db"Text" key=7Bh repeat$-$$ load a :byte from $$+%-1 store a xor key :byte at $$+%-1 endrepeat load char :byte from const:0 if$>10000h err'segment too large' endif calminstruction please? cmd& match=do?=not? cmd, cmd jyes done assemble cmd endcalminstruction please do not display 'Bye!' macro jmpi target if target-($+2)<80h& target-($+2)>=-80h db0EBh db target-($+1) else db0E9h dw target-($+2) endif endmacro macro EX? first,second match(=SP?), first match=HL?, second db0E3h elsematch=IX?, second db0DDh,0E3h elsematch=IY?, second db0FDh,0E3h else err"incorrect second argument" endmatch elsematch=AF?, first match=AF'?, second db08h else err"incorrect second argument" endmatch elsematch=DE?, first match=HL?, second db0EBh else err"incorrect second argument" endmatch else err"incorrect first argument" endmatch endmacro EX(SP),HL macro INC? argument match[:r:], argument db100b+ r shl3 elsematch(=HL?), argument db34h elsematch(=IX?+d), argument db0DDh,34h,d elsematch(=IY?+d), argument db0FDh,34h,d else err"incorrect argument" endmatch endmacro INC(IX+2) element IY? element L?: register +101b macro CALL? arguments& local cc,nn match condition =, target, arguments cc= condition - CC nn= target db0C4h+ cc shl3 else nn= arguments db0CDh endmatch dw nn endmacro