EuroAssembler Index Manual Download Source Macros


Sitemap Links Forum Tests Projects

Test t7247: Compile COFF 64bit Win linking COFF 64bit Win


Description
Test creates linkable 64bit COFF file t7247.obj from linkable 64bit COFF module.
See also
LinkerCombinations  
Tested procedures
PfcoffCompile   PfcoffLoadPgm  
Source & expected listing t7247.htm.lst
| | EUROASM DEBUG=OFF,PROFILE=OFF,AUTOSEGMENT=ON,LIST=ON, \ | | DUMP=ON,DUMPWIDTH=25,DUMPALL=OFF,CPU=X64,AMD=YES | |;; | |t7247CW PROGRAM FORMAT=COFF,MODEL=FLAT,WIDTH=64, \ | | LISTMAP=ON,LISTGLOBALS=ON | | PUBLIC Write.W64 |[.text] ::::Section changed. |00000000: |Write.W64: PROC ; Write ASCIIZ string DS:RSI in 64bit Windows. | | IMPORT GetStdHandle:,WriteFile: ; Use 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:4831C9 | XOR RCX,RCX ; Use RCX to keep the size of input string. |00000020:4831C0 | XOR RAX,RAX ; Zero AL, the searched terminating character. |00000023:48F7D1 | NOT RCX ; Assume unlimited possible string size. |00000026:F2AE | REPNE SCASB ; Find the zero terminator. |00000028:48F7D1 | NOT RCX ; Get string size to RCX. |0000002B:89442420 | MOV [RSP+20h],EAX ; %5 Overlapped I/O is not used. |0000002F:4C8D4C2418 | LEA R9,[RSP+18h] ; %4 Local variable for the number of written bytes uses shadowed R9. |00000034:4989C8 | MOV R8,RCX ; %3 String size. |00000037:4889F2 | MOV RDX,RSI ; %2 String address. |0000003A:4889D9 | MOV RCX,RBX ; %1 Standard output file handle. |0000003D:E8(00000000) | CALL WriteFile: ; Fastcall the imported function with 5 arguments. |00000042:4889EC | MOV RSP,RBP ; Restore the stack. |00000045:C3 | RET ; Return to caller. |00000046: | ENDPROC Write.W64: | |ENDPROGRAM t7247CW | **** ListMap "t7247CW.obj",groups=0,segments=2,entry=,stack= | [.text],RVA=00000000h,size=00000046h=70,width=64,align=16,purpose=CODE | [.drectve],RVA=00000000h,size=00000027h=39,width=0,align=0,purpose=DRECTVE | **** ListGlobals "t7247CW.obj",Global=0,Public=1,Extern=0,eXport=0,Import=2 | GetStdHandle,[GetStdHandle]:00000000h,scope='I',lib="kernel32.dll" | Write.W64,[.text]:00000000h,scope='P' | WriteFile,[WriteFile]:00000000h,scope='I',lib="kernel32.dll" | |;; | |t7247CB PROGRAM FORMAT=COFF,MODEL=FLAT,WIDTH=64, \ | | LISTMAP=ON,LISTGLOBALS=ON | | PUBLIC Beep.W64 |[.text] ::::Section changed. |00000000: |Beep.W64: PROC ; Play a sound in 64bit Windows. | | IMPORT Beep: ; Use imported Windows kernel function. |00000000:4889E5 | MOV RBP,RSP ; Save (perhaps unaligned) stack pointer. |00000003:4883E4F0 | AND RSP,-16 ; OWORD alignment downwards. |00000007:4883EC28 | SUB RSP,4*8+8 ; Allocate shadow space on stack. |0000000B:BAC8000000 | MOV RDX,200 ; %2 Sound duration [ms]. |00000010:B9B8010000 | MOV RCX,440 ; %1 Sound frequency [Hz]. |00000015:E8(00000000) | CALL Beep: ; Fastcall the imported function with 2 arguments. |0000001A:BA90010000 | MOV RDX,400 ; %2 Sound duration [ms]. |0000001F:B94B020000 | MOV RCX,587 ; %1 Sound frequency [Hz]. |00000024:E8(00000000) | CALL Beep: ; Fastcall the imported function with 2 arguments. |00000029:4889EC | MOV RSP,RBP ; Restore the stack. |0000002C:C3 | RET ; Return to caller. |0000002D: | ENDPROC Beep.W64: | |ENDPROGRAM t7247CB | **** ListMap "t7247CB.obj",groups=0,segments=2,entry=,stack= | [.text],RVA=00000000h,size=0000002Dh=45,width=64,align=16,purpose=CODE | [.drectve],RVA=00000000h,size=0000000Dh=13,width=0,align=0,purpose=DRECTVE | **** ListGlobals "t7247CB.obj",Global=0,Public=1,Extern=0,eXport=0,Import=1 | Beep,[Beep]:00000000h,scope='I',lib="kernel32.dll" | Beep.W64,[.text]:00000000h,scope='P' | |;; | |t7247CE PROGRAM FORMAT=COFF,MODEL=FLAT,WIDTH=64, \ | | LISTMAP=ON,LISTGLOBALS=ON | | PUBLIC Exit.W64 |[.text] ::::Section changed. |00000000: |Exit.W64: PROC ; Terminate program in 64bit Windows. | | IMPORT ExitProcess ; Use imported Windows kernel function. |00000000:4883E4F0 | AND RSP,-16 ; OWORD alignment downwards. |00000004:4883EC28 | SUB RSP,4*8+8 ; Allocate shadow space on stack. |00000008:4829C9 | SUB RCX,RCX ; %1 Terminate with errorlevel 0. |0000000B:E9(00000000) | JMP ExitProcess: ; Use imported function with 1 argument. No return. |00000010: | ENDPROC Exit.W64: | |ENDPROGRAM t7247CE | **** ListMap "t7247CE.obj",groups=0,segments=2,entry=,stack= | [.text],RVA=00000000h,size=00000010h=16,width=64,align=16,purpose=CODE | [.drectve],RVA=00000000h,size=00000014h=20,width=0,align=0,purpose=DRECTVE | **** ListGlobals "t7247CE.obj",Global=0,Public=1,Extern=0,eXport=0,Import=1 | Exit.W64,[.text]:00000000h,scope='P' | ExitProcess,[ExitProcess]:00000000h,scope='I',lib="kernel32.dll" | |;; | |t7247 PROGRAM FORMAT=COFF,MODEL=FLAT,WIDTH=64, \ | | LISTMAP=ON,LISTGLOBALS=ON | | LINK t7247CW.obj, t7247CB.obj, t7247CE.obj | |ENDPROGRAM t7247 |# I0560 Linking COFF module ".\t7247CW.obj". |# I0563 Accepting link directive '/IMPORT:GetStdHandle'. |# I0563 Accepting link directive '/IMPORT:WriteFile'. |# I0560 Linking COFF module ".\t7247CB.obj". |# I0563 Accepting link directive '/IMPORT:Beep'. |# I0560 Linking COFF module ".\t7247CE.obj". |# I0563 Accepting link directive '/IMPORT:ExitProcess'. | **** ListMap "t7247.obj",groups=0,segments=2,entry=,stack= | [.text],RVA=00000000h,size=00000090h=144,width=64,align=16,purpose=CODE | [.drectve],RVA=00000000h,size=00000048h=72,width=0,align=0,purpose=DRECTVE | **** ListGlobals "t7247.obj",Global=0,Public=3,Extern=0,eXport=0,Import=4 | Beep,[Beep]:00000000h,scope='I',lib="kernel32.dll" | Beep.W64,[.text]:00000050h,scope='P' | Exit.W64,[.text]:00000080h,scope='P' | ExitProcess,[ExitProcess]:00000000h,scope='I',lib="kernel32.dll" | GetStdHandle,[GetStdHandle]:00000000h,scope='I',lib="kernel32.dll" | Write.W64,[.text]:00000000h,scope='P' | WriteFile,[WriteFile]:00000000h,scope='I',lib="kernel32.dll"
Expected messages t7247.out
I0180 Assembling source file "t7247.htm". I0270 Assembling source "t7247". I0310 Assembling source pass 1. I0330 Assembling source pass 2 - final. I0470 Assembling program "t7247CW". "t7247.htm"{62} I0510 Assembling program pass 1. "t7247.htm"{62} I0510 Assembling program pass 2. "t7247.htm"{62} I0530 Assembling program pass 3 - final. "t7247.htm"{62} I0660 64bit FLAT COFF file "t7247CW.obj" created, size=447. "t7247.htm"{89} I0650 Program "t7247CW" assembled in 3 passes with errorlevel 0. "t7247.htm"{89} I0470 Assembling program "t7247CB". "t7247.htm"{98} I0510 Assembling program pass 1. "t7247.htm"{98} I0510 Assembling program pass 2. "t7247.htm"{98} I0530 Assembling program pass 3 - final. "t7247.htm"{98} I0660 64bit FLAT COFF file "t7247CB.obj" created, size=346. "t7247.htm"{116} I0650 Program "t7247CB" assembled in 3 passes with errorlevel 0. "t7247.htm"{116} I0470 Assembling program "t7247CE". "t7247.htm"{124} I0510 Assembling program pass 1. "t7247.htm"{124} I0510 Assembling program pass 2. "t7247.htm"{124} I0530 Assembling program pass 3 - final. "t7247.htm"{124} I0660 64bit FLAT COFF file "t7247CE.obj" created, size=324. "t7247.htm"{135} I0650 Program "t7247CE" assembled in 3 passes with errorlevel 0. "t7247.htm"{135} I0470 Assembling program "t7247". "t7247.htm"{143} I0510 Assembling program pass 1. "t7247.htm"{143} I0530 Assembling program pass 2 - final. "t7247.htm"{143} I0560 Linking COFF module ".\t7247CW.obj". "t7247.htm"{146} I0563 Accepting link directive '/IMPORT:GetStdHandle'. "t7247.htm"{146} I0563 Accepting link directive '/IMPORT:WriteFile'. "t7247.htm"{146} I0560 Linking COFF module ".\t7247CB.obj". "t7247.htm"{146} I0563 Accepting link directive '/IMPORT:Beep'. "t7247.htm"{146} I0560 Linking COFF module ".\t7247CE.obj". "t7247.htm"{146} I0563 Accepting link directive '/IMPORT:ExitProcess'. "t7247.htm"{146} I0660 64bit FLAT COFF file "t7247.obj" created, size=667. "t7247.htm"{146} I0650 Program "t7247" assembled in 2 passes with errorlevel 0. "t7247.htm"{146} I0750 Source "t7247" (253 lines) assembled in 2 passes with errorlevel 0. I0860 Listing file "t7247.htm.lst" created, size=7552. I0990 EuroAssembler terminated with errorlevel 0.
Expected output file t7247. obj
0000: 64 86 02 00 00 00 00 00 6E 01 00 00 0E 00 00 00  d¤·°°°°°n·°°·°°°
0010: 00 00 20 00 2E 74 65 78 74 00 00 00 00 00 00 00  °°¯°.text°°°°°°°
0020: 00 00 00 00 90 00 00 00 64 00 00 00 F4 00 00 00  °°°°¤°°°d°°°¤°°°
0030: 00 00 00 00 05 00 00 00 20 00 50 60 2E 64 72 65  °°°°·°°°¯°P`.dre
0040: 63 74 76 65 00 00 00 00 00 00 00 00 48 00 00 00  ctve°°°°°°°°H°°°
0050: 26 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00  &·°°°°°°°°°°°°°°
0060: 00 0A 10 02 48 89 E5 48 83 E4 F0 48 83 EC 30 48  °¬··H¤¤H¤¤¤H¤¤0H
0070: C7 C1 F5 FF FF FF E8 00 00 00 00 48 89 C3 48 89  ¤¤¤¤¤¤¤°°°°H¤¤H¤
0080: F7 48 31 C9 48 31 C0 48 F7 D1 F2 AE 48 F7 D1 89  ¤H1¤H1¤H¤¤¤¤H¤¤¤
0090: 44 24 20 4C 8D 4C 24 18 49 89 C8 48 89 F2 48 89  D$¯L¤L$·I¤¤H¤¤H¤
00A0: D9 E8 00 00 00 00 48 89 EC C3 90 90 90 90 90 90  ¤¤°°°°H¤¤¤¤¤¤¤¤¤
00B0: 90 90 90 90 48 89 E5 48 83 E4 F0 48 83 EC 28 BA  ¤¤¤¤H¤¤H¤¤¤H¤¤(¤
00C0: C8 00 00 00 B9 B8 01 00 00 E8 00 00 00 00 BA 90  ¤°°°¤¤·°°¤°°°°¤¤
00D0: 01 00 00 B9 4B 02 00 00 E8 00 00 00 00 48 89 EC  ·°°¤K·°°¤°°°°H¤¤
00E0: C3 90 90 90 48 83 E4 F0 48 83 EC 28 48 29 C9 E9  ¤¤¤¤H¤¤¤H¤¤(H)¤¤
00F0: 00 00 00 00 13 00 00 00 08 00 00 00 14 00 3E 00  °°°°·°°°·°°°·°>°
0100: 00 00 09 00 00 00 14 00 66 00 00 00 0B 00 00 00  °°·°°°·°f°°°·°°°
0110: 14 00 75 00 00 00 0B 00 00 00 14 00 8C 00 00 00  ·°u°°°·°°°·°¤°°°
0120: 0D 00 00 00 14 00 20 2F 49 4D 50 4F 52 54 3A 47  ·°°°·°¯/IMPORT:G
0130: 65 74 53 74 64 48 61 6E 64 6C 65 20 2F 49 4D 50  etStdHandle¯/IMP
0140: 4F 52 54 3A 57 72 69 74 65 46 69 6C 65 20 2F 49  ORT:WriteFile¯/I
0150: 4D 50 4F 52 54 3A 42 65 65 70 20 2F 49 4D 50 4F  MPORT:Beep¯/IMPO
0160: 52 54 3A 45 78 69 74 50 72 6F 63 65 73 73 2E 73  RT:ExitProcess.s
0170: 63 61 6C 61 72 73 00 00 00 00 FF FF 00 00 03 00  calars°°°°¤¤°°·°
0180: 2E 66 69 6C 65 00 00 00 00 00 00 00 FE FF 00 00  .file°°°°°°°¤¤°°
0190: 67 01 74 37 32 34 37 2E 68 74 6D 00 00 00 00 00  g·t7247.htm°°°°°
01A0: 00 00 00 00 2E 74 65 78 74 00 00 00 00 00 00 00  °°°°.text°°°°°°°
01B0: 01 00 00 00 03 01 90 00 00 00 05 00 00 00 00 00  ·°°°··¤°°°·°°°°°
01C0: 00 00 00 00 00 00 00 00 2E 64 72 65 63 74 76 65  °°°°°°°°.drectve
01D0: 00 00 00 00 02 00 00 00 03 01 48 00 00 00 00 00  °°°°·°°°··H°°°°°
01E0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  °°°°°°°°°°°°°°°°
01F0: 04 00 00 00 00 00 00 00 01 00 01 02 02 00 00 00  ·°°°°°°°·°···°°°
0200: 00 00 0E 00 00 00 00 00 00 00 00 00 01 01 02 00  °°·°°°°°°°°°···°
0210: 00 00 00 00 1B 00 00 00 00 00 00 00 00 00 01 01  °°°°·°°°°°°°°°··
0220: 02 00 42 65 65 70 2E 57 36 34 50 00 00 00 01 00  ·°Beep.W64P°°°·°
0230: 01 02 02 00 42 65 65 70 00 00 00 00 00 00 00 00  ···°Beep°°°°°°°°
0240: 00 00 01 01 02 00 45 78 69 74 2E 57 36 34 80 00  °°···°Exit.W64¤°
0250: 00 00 01 00 01 02 02 00 00 00 00 00 25 00 00 00  °°·°···°°°°°%°°°
0260: 00 00 00 00 00 00 01 01 02 00 31 00 00 00 57 72  °°°°°°···°1°°°Wr
0270: 69 74 65 2E 57 36 34 00 47 65 74 53 74 64 48 61  ite.W64°GetStdHa
0280: 6E 64 6C 65 00 57 72 69 74 65 46 69 6C 65 00 45  ndle°WriteFile°E
0290: 78 69 74 50 72 6F 63 65 73 73 00                 xitProcess°

▲Back to the top▲