EuroAssembler Index Manual Download Source Macros


Sitemap Links Forum Tests Projects

Test t9150: LIBCOF library for 64bit Windows


Source & expected listing t9150.htm.lst
| | EUROASM AUTOSEGMENT=ON,CPU=X64,DUMPWIDTH=25 |7439313530 |%test %SET t9150 | |;; | |%test PROGRAM FORMAT=LIBCOF,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 "t9150.lib",model=FLAT,groups=0,segments=4,entry=,stack= | [.text],FA=000000B4h,RVA=00000000h,size=000000A6h=166,width=64,align=0010h,purpose=CODE | [.rodata],FA=000001A0h,RVA=00000000h,size=0000000Bh=11,width=64,align=0010h,purpose=RODATA+LITERAL | [.data],FA=000001ABh,RVA=00000000h,size=00000029h=41,width=64,align=0010h,purpose=DATA | [.bss],FA=00000000h,RVA=00000000h,size=00000007h=7,width=64,align=0010h,purpose=BSS | **** ListGlobals "t9150.lib",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 t9150.out
I0180 Assembling source file "t9150.htm". I0270 Assembling source "t9150". I0310 Assembling source pass 1. I0330 Assembling source pass 2 - final. I0470 Assembling program "t9150". "t9150.htm"{44} I0510 Assembling program pass 1. "t9150.htm"{44} I0510 Assembling program pass 2. "t9150.htm"{44} I0530 Assembling program pass 3 - final. "t9150.htm"{44} I0660 64bit FLAT LIBCOF file "t9150.lib" created, size=1885. "t9150.htm"{106} I0650 Program "t9150" assembled in 3 passes with errorlevel 0. "t9150.htm"{106} I0750 Source "t9150" (261 lines) assembled in 2 passes with errorlevel 0. I0860 Listing file "t9150.htm.lst" created, size=6275. I0990 EuroAssembler terminated with errorlevel 0.
Expected output file t9150. lib
0000: 21 3C 61 72 63 68 3E 0A 2F 20 20 20 20 20 20 20  !<arch>¬/¯¯¯¯¯¯¯
0010: 20 20 20 20 20 20 20 20 30 20 20 20 20 20 20 20  ¯¯¯¯¯¯¯¯0¯¯¯¯¯¯¯
0020: 20 20 20 20 30 20 20 20 20 20 30 20 20 20 20 20  ¯¯¯¯0¯¯¯¯¯0¯¯¯¯¯
0030: 31 30 30 36 36 36 20 20 31 35 30 20 20 20 20 20  100666¯¯150¯¯¯¯¯
0040: 20 20 60 0A 00 00 00 0C 00 00 01 EA 00 00 02 54  ¯¯`¬°°°·°°·¤°°·T
0050: 00 00 02 BC 00 00 03 1E 00 00 03 88 00 00 03 88  °°·¤°°··°°·¤°°·¤
0060: 00 00 03 88 00 00 03 88 00 00 03 88 00 00 03 88  °°·¤°°·¤°°·¤°°·¤
0070: 00 00 03 88 00 00 03 88 47 65 74 53 74 64 48 61  °°·¤°°·¤GetStdHa
0080: 6E 64 6C 65 00 57 72 69 74 65 46 69 6C 65 00 42  ndle°WriteFile°B
0090: 65 65 70 00 45 78 69 74 50 72 6F 63 65 73 73 00  eep°ExitProcess°
00A0: 2E 74 65 78 74 00 2E 72 6F 64 61 74 61 00 2E 64  .text°.rodata°.d
00B0: 61 74 61 00 2E 62 73 73 00 57 72 69 74 65 2E 57  ata°.bss°Write.W
00C0: 36 34 00 42 65 65 70 2E 57 36 34 00 45 78 69 74  64°Beep.W64°Exit
00D0: 2E 57 36 34 00 4D 73 67 00 0A 2F 20 20 20 20 20  .W64°Msg°¬/¯¯¯¯¯
00E0: 20 20 20 20 20 20 20 20 20 20 30 20 20 20 20 20  ¯¯¯¯¯¯¯¯¯¯0¯¯¯¯¯
00F0: 20 20 20 20 20 20 30 20 20 20 20 20 30 20 20 20  ¯¯¯¯¯¯0¯¯¯¯¯0¯¯¯
0100: 20 20 31 30 30 36 36 36 20 20 31 35 30 20 20 20  ¯¯100666¯¯150¯¯¯
0110: 20 20 20 20 60 0A 05 00 00 00 EA 01 00 00 54 02  ¯¯¯¯`¬·°°°¤·°°T·
0120: 00 00 BC 02 00 00 1E 03 00 00 88 03 00 00 0C 00  °°¤·°°··°°¤·°°·°
0130: 00 00 05 00 05 00 05 00 05 00 03 00 05 00 05 00  °°·°·°·°·°·°·°·°
0140: 04 00 01 00 05 00 05 00 02 00 2E 62 73 73 00 2E  ·°·°·°·°·°.bss°.
0150: 64 61 74 61 00 2E 72 6F 64 61 74 61 00 2E 74 65  data°.rodata°.te
0160: 78 74 00 42 65 65 70 00 42 65 65 70 2E 57 36 34  xt°Beep°Beep.W64
0170: 00 45 78 69 74 2E 57 36 34 00 45 78 69 74 50 72  °Exit.W64°ExitPr
0180: 6F 63 65 73 73 00 47 65 74 53 74 64 48 61 6E 64  ocess°GetStdHand
0190: 6C 65 00 4D 73 67 00 57 72 69 74 65 2E 57 36 34  le°Msg°Write.W64
01A0: 00 57 72 69 74 65 46 69 6C 65 00 0A 2F 2F 20 20  °WriteFile°¬//¯¯
01B0: 20 20 20 20 20 20 20 20 20 20 20 20 30 20 20 20  ¯¯¯¯¯¯¯¯¯¯¯¯0¯¯¯
01C0: 20 20 20 20 20 20 20 20 30 20 20 20 20 20 30 20  ¯¯¯¯¯¯¯¯0¯¯¯¯¯0¯
01D0: 20 20 20 20 31 30 30 36 36 36 20 20 32 20 20 20  ¯¯¯¯100666¯¯2¯¯¯
01E0: 20 20 20 20 20 20 60 0A 00 0A 47 65 74 53 74 64  ¯¯¯¯¯¯`¬°¬GetStd
01F0: 48 61 6E 64 6C 65 2F 20 20 20 30 20 20 20 20 20  Handle/¯¯¯0¯¯¯¯¯
0200: 20 20 20 20 20 20 30 20 20 20 20 20 30 20 20 20  ¯¯¯¯¯¯0¯¯¯¯¯0¯¯¯
0210: 20 20 31 30 30 36 36 36 20 20 34 36 20 20 20 20  ¯¯100666¯¯46¯¯¯¯
0220: 20 20 20 20 60 0A 00 00 FF FF 01 00 64 86 00 00  ¯¯¯¯`¬°°¤¤·°d¤°°
0230: 00 00 1A 00 00 00 00 00 04 00 47 65 74 53 74 64  °°·°°°°°·°GetStd
0240: 48 61 6E 64 6C 65 00 6B 65 72 6E 65 6C 33 32 2E  Handle°kernel32.
0250: 64 6C 6C 00 57 72 69 74 65 46 69 6C 65 2F 20 20  dll°WriteFile/¯¯
0260: 20 20 20 20 30 20 20 20 20 20 20 20 20 20 20 20  ¯¯¯¯0¯¯¯¯¯¯¯¯¯¯¯
0270: 30 20 20 20 20 20 30 20 20 20 20 20 31 30 30 36  0¯¯¯¯¯0¯¯¯¯¯1006
0280: 36 36 20 20 34 33 20 20 20 20 20 20 20 20 60 0A  66¯¯43¯¯¯¯¯¯¯¯`¬
0290: 00 00 FF FF 01 00 64 86 00 00 00 00 17 00 00 00  °°¤¤·°d¤°°°°·°°°
02A0: 00 00 04 00 57 72 69 74 65 46 69 6C 65 00 6B 65  °°·°WriteFile°ke
02B0: 72 6E 65 6C 33 32 2E 64 6C 6C 00 10 42 65 65 70  rnel32.dll°·Beep
02C0: 2F 20 20 20 20 20 20 20 20 20 20 20 30 20 20 20  /¯¯¯¯¯¯¯¯¯¯¯0¯¯¯
02D0: 20 20 20 20 20 20 20 20 30 20 20 20 20 20 30 20  ¯¯¯¯¯¯¯¯0¯¯¯¯¯0¯
02E0: 20 20 20 20 31 30 30 36 36 36 20 20 33 38 20 20  ¯¯¯¯100666¯¯38¯¯
02F0: 20 20 20 20 20 20 60 0A 00 00 FF FF 01 00 64 86  ¯¯¯¯¯¯`¬°°¤¤·°d¤
0300: 00 00 00 00 12 00 00 00 00 00 04 00 42 65 65 70  °°°°·°°°°°·°Beep
0310: 00 6B 65 72 6E 65 6C 33 32 2E 64 6C 6C 00 45 78  °kernel32.dll°Ex
0320: 69 74 50 72 6F 63 65 73 73 2F 20 20 20 20 30 20  itProcess/¯¯¯¯0¯
0330: 20 20 20 20 20 20 20 20 20 20 30 20 20 20 20 20  ¯¯¯¯¯¯¯¯¯¯0¯¯¯¯¯
0340: 30 20 20 20 20 20 31 30 30 36 36 36 20 20 34 35  0¯¯¯¯¯100666¯¯45
0350: 20 20 20 20 20 20 20 20 60 0A 00 00 FF FF 01 00  ¯¯¯¯¯¯¯¯`¬°°¤¤·°
0360: 64 86 00 00 00 00 19 00 00 00 00 00 04 00 45 78  d¤°°°°·°°°°°·°Ex
0370: 69 74 50 72 6F 63 65 73 73 00 6B 65 72 6E 65 6C  itProcess°kernel
0380: 33 32 2E 64 6C 6C 00 10 74 39 31 35 30 2F 20 20  32.dll°·t9150/¯¯
0390: 20 20 20 20 20 20 20 20 30 20 20 20 20 20 20 20  ¯¯¯¯¯¯¯¯0¯¯¯¯¯¯¯
03A0: 20 20 20 20 30 20 20 20 20 20 30 20 20 20 20 20  ¯¯¯¯0¯¯¯¯¯0¯¯¯¯¯
03B0: 31 30 30 36 36 36 20 20 39 32 31 20 20 20 20 20  100666¯¯921¯¯¯¯¯
03C0: 20 20 60 0A 64 86 04 00 00 00 00 00 D4 01 00 00  ¯¯`¬d¤·°°°°°¤·°°
03D0: 15 00 00 00 00 00 20 00 2E 74 65 78 74 00 00 00  ·°°°°°¯°.text°°°
03E0: 00 00 00 00 00 00 00 00 A6 00 00 00 B4 00 00 00  °°°°°°°°¤°°°¤°°°
03F0: 5A 01 00 00 00 00 00 00 07 00 00 00 20 00 50 60  Z·°°°°°°·°°°¯°P`
0400: 2E 72 6F 64 61 74 61 00 00 00 00 00 00 00 00 00  .rodata°°°°°°°°°
0410: 0B 00 00 00 A0 01 00 00 00 00 00 00 00 00 00 00  ·°°°¤·°°°°°°°°°°
0420: 00 00 00 00 40 00 50 40 2E 64 61 74 61 00 00 00  °°°°@°P@.data°°°
0430: 00 00 00 00 00 00 00 00 29 00 00 00 AB 01 00 00  °°°°°°°°)°°°¤·°°
0440: 00 00 00 00 00 00 00 00 00 00 00 00 40 00 50 C0  °°°°°°°°°°°°@°P¤
0450: 2E 62 73 73 00 00 00 00 00 00 00 00 00 00 00 00  .bss°°°°°°°°°°°°
0460: 07 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ·°°°°°°°°°°°°°°°
0470: 00 00 00 00 80 00 50 C0 48 89 E5 48 83 E4 F0 48  °°°°¤°P¤H¤¤H¤¤¤H
0480: 83 EC 30 48 C7 C1 F5 FF FF FF E8 00 00 00 00 48  ¤¤0H¤¤¤¤¤¤¤°°°°H
0490: 89 C3 48 89 F7 31 C9 31 C0 48 F7 D1 F2 AE 48 F7  ¤¤H¤¤1¤1¤H¤¤¤¤H¤
04A0: D1 48 89 44 24 20 4C 8D 4C 24 18 49 89 C8 48 89  ¤H¤D$¯L¤L$·I¤¤H¤
04B0: F2 48 89 D9 E8 00 00 00 00 48 89 EC C3 48 8D 35  ¤H¤¤¤°°°°H¤¤¤H¤5
04C0: 00 00 00 00 E8 AF FF FF FF 48 89 E5 48 83 E4 F0  °°°°¤¤¤¤¤H¤¤H¤¤¤
04D0: 48 83 EC 20 BA C8 00 00 00 B9 B8 01 00 00 E8 00  H¤¤¯¤¤°°°¤¤·°°¤°
04E0: 00 00 00 BA 90 01 00 00 B9 4B 02 00 00 E8 00 00  °°°¤¤·°°¤K·°°¤°°
04F0: 00 00 48 89 EC C3 48 8D 35 00 00 00 00 C7 06 45  °°H¤¤¤H¤5°°°°¤·E
0500: 6E 64 00 C7 46 03 0D 0A 00 00 E8 69 FF FF FF 48  nd°¤F··¬°°¤i¤¤¤H
0510: 83 E4 F0 48 83 EC 20 31 C9 E9 00 00 00 00 13 00  ¤¤¤H¤¤¯1¤¤°°°°·°
0520: 00 00 11 00 00 00 04 00 3D 00 00 00 14 00 00 00  °°·°°°·°=°°°·°°°
0530: 04 00 48 00 00 00 06 00 00 00 04 00 67 00 00 00  ·°H°°°·°°°·°g°°°
0540: 0D 00 00 00 04 00 76 00 00 00 0D 00 00 00 04 00  ·°°°·°v°°°·°°°·°
0550: 81 00 00 00 02 00 00 00 04 00 A2 00 00 00 10 00  ¤°°°·°°°·°¤°°°·°
0560: 00 00 04 00 42 65 65 70 69 6E 67 2E 2E 2E 00 36  °°·°Beeping...°6
0570: 34 62 69 74 20 46 4C 41 54 20 4C 49 42 43 4F 46  4bit¯FLAT¯LIBCOF
0580: 20 70 72 6F 67 72 61 6D 20 22 74 39 31 35 30 2E  ¯program¯"t9150.
0590: 6C 69 62 22 2E 0D 0A 00 2E 66 69 6C 65 00 00 00  lib".·¬°.file°°°
05A0: 00 00 00 00 FE FF 00 00 67 01 74 39 31 35 30 2E  °°°°¤¤°°g·t9150.
05B0: 68 74 6D 00 00 00 00 00 00 00 00 00 2E 62 73 73  htm°°°°°°°°°.bss
05C0: 00 00 00 00 00 00 00 00 04 00 00 00 03 01 07 00  °°°°°°°°·°°°···°
05D0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  °°°°°°°°°°°°°°°°
05E0: 2E 64 61 74 61 00 00 00 00 00 00 00 03 00 00 00  .data°°°°°°°·°°°
05F0: 03 01 29 00 00 00 00 00 00 00 00 00 00 00 00 00  ··)°°°°°°°°°°°°°
0600: 00 00 00 00 2E 72 6F 64 61 74 61 00 00 00 00 00  °°°°.rodata°°°°°
0610: 02 00 00 00 03 01 0B 00 00 00 00 00 00 00 00 00  ·°°°···°°°°°°°°°
0620: 00 00 00 00 00 00 00 00 2E 74 65 78 74 00 00 00  °°°°°°°°.text°°°
0630: 00 00 00 00 01 00 00 00 03 01 A6 00 00 00 07 00  °°°°·°°°··¤°°°·°
0640: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  °°°°°°°°°°°°°°°°
0650: 04 00 00 00 00 00 00 00 02 00 0C 00 03 00 40 4C  ·°°°°°°°·°·°·°@L
0660: 54 31 00 00 00 00 00 00 00 00 02 00 01 01 03 00  T1°°°°°°°°·°···°
0670: 00 00 00 00 13 00 00 00 00 00 00 00 04 00 0C 00  °°°°·°°°°°°°·°·°
0680: 03 00 42 65 65 70 00 00 00 00 00 00 00 00 00 00  ·°Beep°°°°°°°°°°
0690: 01 01 02 00 42 65 65 70 2E 57 36 34 45 00 00 00  ···°Beep.W64E°°°
06A0: 01 00 01 02 02 00 45 78 69 74 2E 57 36 34 7E 00  ·°···°Exit.W64~°
06B0: 00 00 01 00 01 02 02 00 00 00 00 00 1E 00 00 00  °°·°···°°°°°·°°°
06C0: 00 00 00 00 00 00 01 01 02 00 00 00 00 00 2A 00  °°°°°°···°°°°°*°
06D0: 00 00 00 00 00 00 00 00 01 01 02 00 4D 73 67 00  °°°°°°°°···°Msg°
06E0: 00 00 00 00 00 00 00 00 03 00 0C 00 02 00 00 00  °°°°°°°°·°·°·°°°
06F0: 00 00 37 00 00 00 00 00 00 00 01 00 01 02 02 00  °°7°°°°°°°·°···°
0700: 00 00 00 00 41 00 00 00 00 00 00 00 00 00 01 01  °°°°A°°°°°°°°°··
0710: 02 00 4B 00 00 00 3D 42 22 42 65 65 70 69 6E 67  ·°K°°°=B"Beeping
0720: 2E 2E 2E 22 00 45 78 69 74 2E 57 36 34 2E 4D 00  ..."°Exit.W64.M°
0730: 45 78 69 74 50 72 6F 63 65 73 73 00 47 65 74 53  ExitProcess°GetS
0740: 74 64 48 61 6E 64 6C 65 00 57 72 69 74 65 2E 57  tdHandle°Write.W
0750: 36 34 00 57 72 69 74 65 46 69 6C 65 00           64°WriteFile°

▲Back to the top▲