EuroAssembler Index Manual Download Source Macros


Sitemap Links Forum Tests Projects

Test t8850: COFF object module for 64bit Windows


Source & expected listing t8850.htm.lst
| | EUROASM AUTOSEGMENT=ON,CPU=X64,DUMPWIDTH=25 |7438383530 |%test %SET t8850 | |;; | |%test PROGRAM FORMAT=COFF,WIDTH=64,MODEL=FLAT,ICONFILE= |[.text] ::::Section changed. |00000000: |Write.W64:: PROC ; Write ASCIIZ string DS:RSI in 64bit Windows. | | IMPORT GetStdHandle:,WriteFile: ; Declare imported Windows kernel functions. |00000000:4889E5 | MOV RBP,RSP ; Save (perhaps unaligned) stack pointer. |00000003:4883E4F0 | AND RSP,-16 ; OWORD alignment downwards. |00000007:4883EC30 | SUB RSP,5*8+8 ; Allocate shadow space on stack for max 5 arguments. |0000000B:48C7C1F5FFFFFF| MOV RCX,-11 ; %1 Identifier of standard output STD_OUTPUT_HANDLE. |00000012:E8(00000000) | CALL GetStdHandle: ; Fastcall the imported Windows function with 1 argument. |00000017:4889C3 | MOV RBX,RAX ; Temporary save the returned StdOutput handle to RBX. |0000001A:4889F7 | MOV RDI,RSI ; Use RDI to find the end of input string. |0000001D:31C9 | XOR ECX,ECX ; Clear RCX to keep the size of input string. |0000001F:31C0 | XOR EAX,EAX ; Clear AL, the searched terminating character. |00000021:48F7D1 | NOT RCX ; Assume unlimited possible string size. |00000024:F2AE | REPNE SCASB ; Find the zero terminator. |00000026:48F7D1 | NOT RCX ; Get string size to RCX. |00000029:4889442420 | MOV [RSP+20h],RAX ; %5 Overlapped I/O is not used. |0000002E:4C8D4C2418 | LEA R9,[RSP+18h] ; %4 Local variable for the number of written bytes uses shadowed R9. |00000033:4989C8 | MOV R8,RCX ; %3 String size. |00000036:4889F2 | MOV RDX,RSI ; %2 String address. |00000039:4889D9 | MOV RCX,RBX ; %1 Standard output file handle. |0000003C:E8(00000000) | CALL WriteFile: ; Fastcall the imported function with 5 arguments. |00000041:4889EC | MOV RSP,RBP ; Restore the stack. |00000044:C3 | RET ; Return to caller. |00000045: |ENDPROC Write.W64: | |;; |00000045: |Beep.W64:: PROC ; Play a sound in 64bit Windows. |00000045:488D35(000000~| LEA RSI,[=B"Beeping..."] ; Define a literal string in [.rodata]. |0000004C:E8AFFFFFFF | CALL Write.W64:: ; Display the notification "Beeping...". | | IMPORT Beep: ; Declare imported Windows kernel function. |00000051:4889E5 | MOV RBP,RSP ; Save (perhaps unaligned) stack pointer. |00000054:4883E4F0 | AND RSP,-16 ; OWORD alignment downwards. |00000058:4883EC20 | SUB RSP,4*8 ; Allocate shadow space on stack. |0000005C:BAC8000000 | MOV RDX,200 ; %2 Sound duration [ms]. |00000061:B9B8010000 | MOV RCX,440 ; %1 Sound frequency [Hz]. |00000066:E8(00000000) | CALL Beep: ; Fastcall the imported function with 2 arguments. |0000006B:BA90010000 | MOV RDX,400 ; %2 Sound duration [ms]. |00000070:B94B020000 | MOV RCX,587 ; %1 Sound frequency [Hz]. |00000075:E8(00000000) | CALL Beep: ; Fastcall the imported function with 2 arguments. |0000007A:4889EC | MOV RSP,RBP ; Restore the stack. |0000007D:C3 | RET ; Return to caller. |0000007E: |ENDPROC Beep.W64: | |;; |0000007E: |Exit.W64:: PROC ; Terminate program in 64bit Windows. |0000007E:488D35(000000~| LEA RSI,[.M:] ; Address in segment [.bss] for the message. |00000085:C706456E6400 | MOVD [RSI+0],"End" ; Dynamically define the message "End". |0000008B:C746030D0A0000| MOVD [RSI+3],0x0A0D ; CR+LF. |00000092:E869FFFFFF | CALL Write.W64:: ; Display the notification "End". | | IMPORT ExitProcess ; Declare imported Windows kernel function. |00000097:4883E4F0 | AND RSP,-16 ; OWORD alignment downwards. |0000009B:4883EC20 | SUB RSP,4*8 ; Allocate shadow space on stack. |0000009F:31C9 | XOR ECX,ECX ; %1 Terminate with errorlevel 0. |000000A1:E9(00000000) | JMP ExitProcess: ; Use imported function with 1 argument. No return. |[.bss] ::::Section changed. |00000000:..............|.M: DB 7*BYTE ; Reserve space for ASCIIZ string "End" in segment [.bss]. |[.text] ::::Section changed. |000000A6: |ENDPROC Exit.W64: | |;; |[.data] ::::Section changed. |00000000:363462697420~~|Msg:: DB '%^WIDTH[]bit %^MODEL %^FORMAT program "%^OUTFILE".',13,10,0 |[@LT1] ====ListLiterals in section [@LT1]. |00000000:42656570696E~~=B"Beeping..." | |ENDPROGRAM %test | **** ListMap "t8850.obj",model=FLAT,groups=0,segments=5,entry=,stack= | [.text],FA=000000DCh,RVA=00000000h,size=000000A6h=166,width=64,align=0010h,purpose=CODE | [.rodata],FA=000001C8h,RVA=00000000h,size=0000000Bh=11,width=64,align=0010h,purpose=RODATA+LITERAL | [.data],FA=000001D3h,RVA=00000000h,size=00000027h=39,width=64,align=0010h,purpose=DATA | [.bss],FA=00000000h,RVA=00000000h,size=00000007h=7,width=64,align=0010h,purpose=BSS | [.drectve],FA=000001FAh,RVA=00000000h,size=00000048h=72,width=0,align=1,purpose=DRECTVE | **** ListGlobals "t8850.obj",Global=0,Public=4,Extern=0,eXport=0,Import=4 | Beep,[Beep]:00000000h,scope='I',lib="kernel32.dll" | Beep.W64,[.text]:00000045h,scope='P' | Exit.W64,[.text]:0000007Eh,scope='P' | ExitProcess,[ExitProcess]:00000000h,scope='I',lib="kernel32.dll" | GetStdHandle,[GetStdHandle]:00000000h,scope='I',lib="kernel32.dll" | Msg,[.data]:00000000h,scope='P' | Write.W64,[.text]:00000000h,scope='P' | WriteFile,[WriteFile]:00000000h,scope='I',lib="kernel32.dll"
Expected messages t8850.out
I0180 Assembling source file "t8850.htm". I0270 Assembling source "t8850". I0310 Assembling source pass 1. I0330 Assembling source pass 2 - final. I0470 Assembling program "t8850". "t8850.htm"{44} I0510 Assembling program pass 1. "t8850.htm"{44} I0510 Assembling program pass 2. "t8850.htm"{44} I0530 Assembling program pass 3 - final. "t8850.htm"{44} I0660 64bit FLAT COFF file "t8850.obj" created, size=1067. "t8850.htm"{106} I0650 Program "t8850" assembled in 3 passes with errorlevel 0. "t8850.htm"{106} I0750 Source "t8850" (211 lines) assembled in 2 passes with errorlevel 0. I0860 Listing file "t8850.htm.lst" created, size=6373. I0990 EuroAssembler terminated with errorlevel 0.
Expected output file t8850. obj
0000: 64 86 05 00 00 00 00 00 42 02 00 00 17 00 00 00  d¤·°°°°°B·°°·°°°
0010: 00 00 20 00 2E 74 65 78 74 00 00 00 00 00 00 00  °°¯°.text°°°°°°°
0020: 00 00 00 00 A6 00 00 00 DC 00 00 00 82 01 00 00  °°°°¤°°°¤°°°¤·°°
0030: 00 00 00 00 07 00 00 00 20 00 50 60 2E 72 6F 64  °°°°·°°°¯°P`.rod
0040: 61 74 61 00 00 00 00 00 00 00 00 00 0B 00 00 00  ata°°°°°°°°°·°°°
0050: C8 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ¤·°°°°°°°°°°°°°°
0060: 40 00 50 40 2E 64 61 74 61 00 00 00 00 00 00 00  @°P@.data°°°°°°°
0070: 00 00 00 00 27 00 00 00 D3 01 00 00 00 00 00 00  °°°°'°°°¤·°°°°°°
0080: 00 00 00 00 00 00 00 00 40 00 50 C0 2E 62 73 73  °°°°°°°°@°P¤.bss
0090: 00 00 00 00 00 00 00 00 00 00 00 00 07 00 00 00  °°°°°°°°°°°°·°°°
00A0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  °°°°°°°°°°°°°°°°
00B0: 80 00 50 C0 2E 64 72 65 63 74 76 65 00 00 00 00  ¤°P¤.drectve°°°°
00C0: 00 00 00 00 48 00 00 00 FA 01 00 00 00 00 00 00  °°°°H°°°¤·°°°°°°
00D0: 00 00 00 00 00 00 00 00 00 0A 10 02 48 89 E5 48  °°°°°°°°°¬··H¤¤H
00E0: 83 E4 F0 48 83 EC 30 48 C7 C1 F5 FF FF FF E8 00  ¤¤¤H¤¤0H¤¤¤¤¤¤¤°
00F0: 00 00 00 48 89 C3 48 89 F7 31 C9 31 C0 48 F7 D1  °°°H¤¤H¤¤1¤1¤H¤¤
0100: F2 AE 48 F7 D1 48 89 44 24 20 4C 8D 4C 24 18 49  ¤¤H¤¤H¤D$¯L¤L$·I
0110: 89 C8 48 89 F2 48 89 D9 E8 00 00 00 00 48 89 EC  ¤¤H¤¤H¤¤¤°°°°H¤¤
0120: C3 48 8D 35 00 00 00 00 E8 AF FF FF FF 48 89 E5  ¤H¤5°°°°¤¤¤¤¤H¤¤
0130: 48 83 E4 F0 48 83 EC 20 BA C8 00 00 00 B9 B8 01  H¤¤¤H¤¤¯¤¤°°°¤¤·
0140: 00 00 E8 00 00 00 00 BA 90 01 00 00 B9 4B 02 00  °°¤°°°°¤¤·°°¤K·°
0150: 00 E8 00 00 00 00 48 89 EC C3 48 8D 35 00 00 00  °¤°°°°H¤¤¤H¤5°°°
0160: 00 C7 06 45 6E 64 00 C7 46 03 0D 0A 00 00 E8 69  °¤·End°¤F··¬°°¤i
0170: FF FF FF 48 83 E4 F0 48 83 EC 20 31 C9 E9 00 00  ¤¤¤H¤¤¤H¤¤¯1¤¤°°
0180: 00 00 13 00 00 00 13 00 00 00 04 00 3D 00 00 00  °°·°°°·°°°·°=°°°
0190: 16 00 00 00 04 00 48 00 00 00 08 00 00 00 04 00  ·°°°·°H°°°·°°°·°
01A0: 67 00 00 00 0F 00 00 00 04 00 76 00 00 00 0F 00  g°°°·°°°·°v°°°·°
01B0: 00 00 04 00 81 00 00 00 02 00 00 00 04 00 A2 00  °°·°¤°°°·°°°·°¤°
01C0: 00 00 12 00 00 00 04 00 42 65 65 70 69 6E 67 2E  °°·°°°·°Beeping.
01D0: 2E 2E 00 36 34 62 69 74 20 46 4C 41 54 20 43 4F  ..°64bit¯FLAT¯CO
01E0: 46 46 20 70 72 6F 67 72 61 6D 20 22 74 38 38 35  FF¯program¯"t885
01F0: 30 2E 6F 62 6A 22 2E 0D 0A 00 20 2F 49 4D 50 4F  0.obj".·¬°¯/IMPO
0200: 52 54 3A 47 65 74 53 74 64 48 61 6E 64 6C 65 20  RT:GetStdHandle¯
0210: 2F 49 4D 50 4F 52 54 3A 57 72 69 74 65 46 69 6C  /IMPORT:WriteFil
0220: 65 20 2F 49 4D 50 4F 52 54 3A 42 65 65 70 20 2F  e¯/IMPORT:Beep¯/
0230: 49 4D 50 4F 52 54 3A 45 78 69 74 50 72 6F 63 65  IMPORT:ExitProce
0240: 73 73 2E 66 69 6C 65 00 00 00 00 00 00 00 FE FF  ss.file°°°°°°°¤¤
0250: 00 00 67 01 74 38 38 35 30 2E 68 74 6D 00 00 00  °°g·t8850.htm°°°
0260: 00 00 00 00 00 00 2E 62 73 73 00 00 00 00 00 00  °°°°°°.bss°°°°°°
0270: 00 00 04 00 00 00 03 01 07 00 00 00 00 00 00 00  °°·°°°···°°°°°°°
0280: 00 00 00 00 00 00 00 00 00 00 2E 64 61 74 61 00  °°°°°°°°°°.data°
0290: 00 00 00 00 00 00 03 00 00 00 03 01 27 00 00 00  °°°°°°·°°°··'°°°
02A0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 2E 64  °°°°°°°°°°°°°°.d
02B0: 72 65 63 74 76 65 00 00 00 00 05 00 00 00 03 01  rectve°°°°·°°°··
02C0: 48 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  H°°°°°°°°°°°°°°°
02D0: 00 00 2E 72 6F 64 61 74 61 00 00 00 00 00 02 00  °°.rodata°°°°°·°
02E0: 00 00 03 01 0B 00 00 00 00 00 00 00 00 00 00 00  °°···°°°°°°°°°°°
02F0: 00 00 00 00 00 00 2E 74 65 78 74 00 00 00 00 00  °°°°°°.text°°°°°
0300: 00 00 01 00 00 00 03 01 A6 00 00 00 07 00 00 00  °°·°°°··¤°°°·°°°
0310: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 04 00  °°°°°°°°°°°°°°·°
0320: 00 00 00 00 00 00 02 00 0C 00 03 00 40 4C 54 31  °°°°°°·°·°·°@LT1
0330: 00 00 00 00 00 00 00 00 02 00 01 01 03 00 00 00  °°°°°°°°·°···°°°
0340: 00 00 13 00 00 00 00 00 00 00 04 00 0C 00 03 00  °°·°°°°°°°·°·°·°
0350: 42 65 65 70 00 00 00 00 00 00 00 00 00 00 01 01  Beep°°°°°°°°°°··
0360: 02 00 42 65 65 70 2E 57 36 34 45 00 00 00 01 00  ·°Beep.W64E°°°·°
0370: 01 02 02 00 45 78 69 74 2E 57 36 34 7E 00 00 00  ···°Exit.W64~°°°
0380: 01 00 01 02 02 00 00 00 00 00 1E 00 00 00 00 00  ·°···°°°°°·°°°°°
0390: 00 00 00 00 01 01 02 00 00 00 00 00 2A 00 00 00  °°°°···°°°°°*°°°
03A0: 00 00 00 00 00 00 01 01 02 00 4D 73 67 00 00 00  °°°°°°···°Msg°°°
03B0: 00 00 00 00 00 00 03 00 0C 00 02 00 00 00 00 00  °°°°°°·°·°·°°°°°
03C0: 37 00 00 00 00 00 00 00 01 00 01 02 02 00 00 00  7°°°°°°°·°···°°°
03D0: 00 00 41 00 00 00 00 00 00 00 00 00 01 01 02 00  °°A°°°°°°°°°···°
03E0: 4B 00 00 00 3D 42 22 42 65 65 70 69 6E 67 2E 2E  K°°°=B"Beeping..
03F0: 2E 22 00 45 78 69 74 2E 57 36 34 2E 4D 00 45 78  ."°Exit.W64.M°Ex
0400: 69 74 50 72 6F 63 65 73 73 00 47 65 74 53 74 64  itProcess°GetStd
0410: 48 61 6E 64 6C 65 00 57 72 69 74 65 2E 57 36 34  Handle°Write.W64
0420: 00 57 72 69 74 65 46 69 6C 65 00                 °WriteFile°

▲Back to the top▲