EuroAssembler Index Manual Download Source Macros


Sitemap Links Forum Tests Projects

Test t7253: Compile COFF 64bit Win linking LIBCOF 64bit Win


Description
Test creates linkable 64bit COFF file t7253.obj from linkable 64bit LIBCOF module.
See also
LinkerCombinations  
Tested procedures
PfcoffCompile   PflibcofLoadPgm  
Source & expected listing t7253.htm.lst
| | EUROASM DEBUG=OFF,PROFILE=OFF,AUTOSEGMENT=ON,LIST=ON, \ | | DUMP=ON,DUMPWIDTH=25,DUMPALL=OFF,CPU=X64,AMD=YES | |;; | |t7253CW 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 t7253CW | **** ListMap "t7253CW.obj",groups=0,segments=2,entry=,stack= | [.text],RVA=00000000h,size=00000046h=70,width=64,align=0010h,purpose=CODE | [.drectve],RVA=00000000h,size=00000027h=39,width=0,align=0,purpose=DRECTVE | **** ListGlobals "t7253CW.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" | |;; | |t7253CB 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 t7253CB | **** ListMap "t7253CB.obj",groups=0,segments=2,entry=,stack= | [.text],RVA=00000000h,size=0000002Dh=45,width=64,align=0010h,purpose=CODE | [.drectve],RVA=00000000h,size=0000000Dh=13,width=0,align=0,purpose=DRECTVE | **** ListGlobals "t7253CB.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' | |;; | |t7253CE 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 t7253CE | **** ListMap "t7253CE.obj",groups=0,segments=2,entry=,stack= | [.text],RVA=00000000h,size=00000010h=16,width=64,align=0010h,purpose=CODE | [.drectve],RVA=00000000h,size=00000014h=20,width=0,align=0,purpose=DRECTVE | **** ListGlobals "t7253CE.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" | |;; | |t7253C PROGRAM FORMAT=LIBCOF,MODEL=FLAT,WIDTH=64, \ | | LISTMAP=OFF,LISTGLOBALS=OFF | | LINK t7253CW.obj, t7253CB.obj, t7253CE.obj | |ENDPROGRAM t7253C |# I0560 Linking COFF module ".\t7253CW.obj". |# I0563 Accepting link directive '/IMPORT:GetStdHandle'. |# I0563 Accepting link directive '/IMPORT:WriteFile'. |# I0560 Linking COFF module ".\t7253CB.obj". |# I0563 Accepting link directive '/IMPORT:Beep'. |# I0560 Linking COFF module ".\t7253CE.obj". |# I0563 Accepting link directive '/IMPORT:ExitProcess'. | |;; | |t7253 PROGRAM FORMAT=COFF,MODEL=FLAT,WIDTH=64, \ | | LISTMAP=ON,LISTGLOBALS=ON | | GLOBAL Write.W64, Exit.W64 ; Intentionally omitted Beep.W64. | | LINK t7253C.lib | |ENDPROGRAM t7253 |# I0560 Linking LIBCOF module ".\t7253C.lib". | **** ListMap "t7253.obj",groups=0,segments=2,entry=,stack= | [.text],RVA=00000000h,size=00000090h=144,width=64,align=0010h,purpose=CODE | [.drectve],RVA=00000000h,size=00000048h=72,width=0,align=0,purpose=DRECTVE | **** ListGlobals "t7253.obj",Global=2,Public=1,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='G' | ExitProcess,[ExitProcess]:00000000h,scope='I',lib="kernel32.dll" | GetStdHandle,[GetStdHandle]:00000000h,scope='I',lib="kernel32.dll" | Write.W64,[.text]:00000000h,scope='G' | WriteFile,[WriteFile]:00000000h,scope='I',lib="kernel32.dll"
Expected messages t7253.out
I0180 Assembling source file "t7253.htm". I0270 Assembling source "t7253". I0310 Assembling source pass 1. I0330 Assembling source pass 2 - final. I0470 Assembling program "t7253CW". "t7253.htm"{62} I0510 Assembling program pass 1. "t7253.htm"{62} I0510 Assembling program pass 2. "t7253.htm"{62} I0530 Assembling program pass 3 - final. "t7253.htm"{62} I0660 64bit FLAT COFF file "t7253CW.obj" created, size=429. "t7253.htm"{89} I0650 Program "t7253CW" assembled in 3 passes with errorlevel 0. "t7253.htm"{89} I0470 Assembling program "t7253CB". "t7253.htm"{98} I0510 Assembling program pass 1. "t7253.htm"{98} I0510 Assembling program pass 2. "t7253.htm"{98} I0530 Assembling program pass 3 - final. "t7253.htm"{98} I0660 64bit FLAT COFF file "t7253CB.obj" created, size=328. "t7253.htm"{116} I0650 Program "t7253CB" assembled in 3 passes with errorlevel 0. "t7253.htm"{116} I0470 Assembling program "t7253CE". "t7253.htm"{124} I0510 Assembling program pass 1. "t7253.htm"{124} I0510 Assembling program pass 2. "t7253.htm"{124} I0530 Assembling program pass 3 - final. "t7253.htm"{124} I0660 64bit FLAT COFF file "t7253CE.obj" created, size=306. "t7253.htm"{135} I0650 Program "t7253CE" assembled in 3 passes with errorlevel 0. "t7253.htm"{135} I0470 Assembling program "t7253C". "t7253.htm"{143} I0510 Assembling program pass 1. "t7253.htm"{143} I0530 Assembling program pass 2 - final. "t7253.htm"{143} I0560 Linking COFF module ".\t7253CW.obj". "t7253.htm"{146} I0563 Accepting link directive '/IMPORT:GetStdHandle'. "t7253.htm"{146} I0563 Accepting link directive '/IMPORT:WriteFile'. "t7253.htm"{146} I0560 Linking COFF module ".\t7253CB.obj". "t7253.htm"{146} I0563 Accepting link directive '/IMPORT:Beep'. "t7253.htm"{146} I0560 Linking COFF module ".\t7253CE.obj". "t7253.htm"{146} I0563 Accepting link directive '/IMPORT:ExitProcess'. "t7253.htm"{146} I0660 64bit FLAT LIBCOF file "t7253C.lib" created, size=1764. "t7253.htm"{146} I0650 Program "t7253C" assembled in 2 passes with errorlevel 0. "t7253.htm"{146} I0470 Assembling program "t7253". "t7253.htm"{155} I0510 Assembling program pass 1. "t7253.htm"{155} I0510 Assembling program pass 2. "t7253.htm"{155} I0530 Assembling program pass 3 - final. "t7253.htm"{155} I0560 Linking LIBCOF module ".\t7253C.lib". "t7253.htm"{159} I0660 64bit FLAT COFF file "t7253.obj" created, size=649. "t7253.htm"{159} I0650 Program "t7253" assembled in 3 passes with errorlevel 0. "t7253.htm"{159} I0750 Source "t7253" (266 lines) assembled in 2 passes with errorlevel 0. I0860 Listing file "t7253.htm.lst" created, size=7966. I0990 EuroAssembler terminated with errorlevel 0.
Expected output file t7253. obj
0000: 64 86 02 00 00 00 00 00 6E 01 00 00 0D 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 06 00 00 00 04 00 3E 00  °°°°·°°°·°°°·°>°
0100: 00 00 07 00 00 00 04 00 66 00 00 00 09 00 00 00  °°·°°°·°f°°°·°°°
0110: 04 00 75 00 00 00 09 00 00 00 04 00 8C 00 00 00  ·°u°°°·°°°·°¤°°°
0120: 0B 00 00 00 04 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 66  RT:ExitProcess.f
0170: 69 6C 65 00 00 00 00 00 00 00 FE FF 00 00 67 01  ile°°°°°°°¤¤°°g·
0180: 74 37 32 35 33 2E 68 74 6D 00 00 00 00 00 00 00  t7253.htm°°°°°°°
0190: 00 00 2E 74 65 78 74 00 00 00 00 00 00 00 01 00  °°.text°°°°°°°·°
01A0: 00 00 03 01 90 00 00 00 05 00 00 00 00 00 00 00  °°··¤°°°·°°°°°°°
01B0: 00 00 00 00 00 00 2E 64 72 65 63 74 76 65 00 00  °°°°°°.drectve°°
01C0: 00 00 02 00 00 00 03 01 48 00 00 00 00 00 00 00  °°·°°°··H°°°°°°°
01D0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 04 00  °°°°°°°°°°°°°°·°
01E0: 00 00 00 00 00 00 00 00 01 01 02 00 00 00 00 00  °°°°°°°°···°°°°°
01F0: 11 00 00 00 00 00 00 00 00 00 01 01 02 00 00 00  ·°°°°°°°°°···°°°
0200: 00 00 1B 00 00 00 00 00 00 00 01 00 01 02 02 00  °°·°°°°°°°·°···°
0210: 42 65 65 70 00 00 00 00 00 00 00 00 00 00 01 01  Beep°°°°°°°°°°··
0220: 02 00 42 65 65 70 2E 57 36 34 50 00 00 00 01 00  ·°Beep.W64P°°°·°
0230: 01 02 02 00 00 00 00 00 25 00 00 00 00 00 00 00  ···°°°°°%°°°°°°°
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 31 00 00 00 47 65 74 53  °°·°···°1°°°GetS
0260: 74 64 48 61 6E 64 6C 65 00 57 72 69 74 65 46 69  tdHandle°WriteFi
0270: 6C 65 00 57 72 69 74 65 2E 57 36 34 00 45 78 69  le°Write.W64°Exi
0280: 74 50 72 6F 63 65 73 73 00                       tProcess°

▲Back to the top▲