EuroAssembler Index Manual Download Source Macros


Sitemap Links Forum Tests Projects

Test t7097: Compile OMF import library linking DLL 64bit Win


Description
Test creates linkable 32bit OMF file t7097.obj from linkable 64bit DLL module.
See also
LinkerCombinations  
Tested procedures
PfomfCompile   PfdllLoadPgm  
Source & expected listing t7097.htm.lst
| | EUROASM DEBUG=OFF,PROFILE=OFF,AUTOSEGMENT=ON,LIST=ON, \ | | DUMP=ON,DUMPWIDTH=25,DUMPALL=OFF,CPU=X64,AMD=YES | |;; | |t7097L PROGRAM FORMAT=DLL,MODEL=FLAT,WIDTH=64, \ | | ICONFILE=,LISTMAP=ON,LISTGLOBALS=ON | | EXPORT Write.W64, Beep.W64, Exit.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: |00000046: |Beep.W64: PROC ; Play a sound in 64bit Windows. | | IMPORT Beep: ; Use imported Windows kernel function. |00000046:4889E5 | MOV RBP,RSP ; Save (perhaps unaligned) stack pointer. |00000049:4883E4F0 | AND RSP,-16 ; OWORD alignment downwards. |0000004D:4883EC28 | SUB RSP,4*8+8 ; Allocate shadow space on stack. |00000051:BAC8000000 | MOV RDX,200 ; %2 Sound duration [ms]. |00000056:B9B8010000 | MOV RCX,440 ; %1 Sound frequency [Hz]. |0000005B:E8(00000000) | CALL Beep: ; Fastcall the imported function with 2 arguments. |00000060:BA90010000 | MOV RDX,400 ; %2 Sound duration [ms]. |00000065:B94B020000 | MOV RCX,587 ; %1 Sound frequency [Hz]. |0000006A:E8(00000000) | CALL Beep: ; Fastcall the imported function with 2 arguments. |0000006F:4889EC | MOV RSP,RBP ; Restore the stack. |00000072:C3 | RET ; Return to caller. |00000073: | ENDPROC Beep.W64: |00000073: |Exit.W64: PROC ; Terminate program in 64bit Windows. | | IMPORT ExitProcess ; Use imported Windows kernel function. |00000073:4883E4F0 | AND RSP,-16 ; OWORD alignment downwards. |00000077:4883EC28 | SUB RSP,4*8+8 ; Allocate shadow space on stack. |0000007B:4829C9 | SUB RCX,RCX ; %1 Terminate with errorlevel 0. |0000007E:E9(00000000) | JMP ExitProcess: ; Use imported function with 1 argument. No return. |00000083: | ENDPROC Exit.W64: | |ENDPROGRAM t7097L | **** ListMap "t7097L.dll",groups=0,segments=4,entry=,stack= | [.text],VA=10001000h,size=00000083h=131,width=64,align=1000h,purpose=CODE | [.idata],VA=10002000h,size=000000D3h=211,width=64,align=8,purpose=IMPORT+IAT | [.edata],VA=10003000h,size=0000006Dh=109,width=0,align=8,purpose=EXPORT | [.reloc],VA=10004000h,size=00000010h=16,width=32,align=4,purpose=BASERELOC | **** ListGlobals "t7097L.dll",Global=0,Public=0,Extern=0,eXport=3,Import=4 | Beep,[.idata]:000000C5h,VA=100020C5h,scope='I',lib="kernel32.dll" | Beep.W64,[.text]:00000046h,VA=10001046h,scope='X' | Exit.W64,[.text]:00000073h,VA=10001073h,scope='X' | ExitProcess,[.idata]:000000CCh,VA=100020CCh,scope='I',lib="kernel32.dll" | GetStdHandle,[.idata]:000000B7h,VA=100020B7h,scope='I',lib="kernel32.dll" | Write.W64,[.text]:00000000h,VA=10001000h,scope='X' | WriteFile,[.idata]:000000BEh,VA=100020BEh,scope='I',lib="kernel32.dll" | |;; | |t7097 PROGRAM FORMAT=OMF,MODEL=SMALL,WIDTH=32, \ | | LISTMAP=ON,LISTGLOBALS=ON | | IMPORT Write.W64,Beep.W64,Exit.W64, lib=t7097L.dll | |ENDPROGRAM t7097 | **** ListMap "t7097.obj",groups=0,segments=0,entry=,stack= | **** ListGlobals "t7097.obj",Global=0,Public=0,Extern=0,eXport=0,Import=3 | Beep.W64,[Beep.W64]:00000000h,scope='I',lib="t7097L.dll" | Exit.W64,[Exit.W64]:00000000h,scope='I',lib="t7097L.dll" | Write.W64,[Write.W64]:00000000h,scope='I',lib="t7097L.dll"
Expected messages t7097.out
I0180 Assembling source file "t7097.htm". I0270 Assembling source "t7097". I0310 Assembling source pass 1. I0330 Assembling source pass 2 - final. I0470 Assembling program "t7097L". "t7097.htm"{62} I0510 Assembling program pass 1. "t7097.htm"{62} I0510 Assembling program pass 2. "t7097.htm"{62} I0530 Assembling program pass 3 - final. "t7097.htm"{62} I0660 64bit FLAT DLL file "t7097L.dll" created, size=2576. "t7097.htm"{110} I0650 Program "t7097L" assembled in 3 passes with errorlevel 0. "t7097.htm"{110} I0470 Assembling program "t7097". "t7097.htm"{125} I0510 Assembling program pass 1. "t7097.htm"{125} I0510 Assembling program pass 2. "t7097.htm"{125} I0530 Assembling program pass 3 - final. "t7097.htm"{125} I0660 32bit SMALL OMF file "t7097.obj" created, size=203. "t7097.htm"{128} I0650 Program "t7097" assembled in 3 passes with errorlevel 0. "t7097.htm"{128} I0750 Source "t7097" (175 lines) assembled in 2 passes with errorlevel 0. I0860 Listing file "t7097.htm.lst" created, size=5809. I0990 EuroAssembler terminated with errorlevel 0.
Expected output file t7097. obj
0000: 80 07 00 05 74 37 30 39 37 29 88 10 00 00 00 45  ¤·°·t7097)¤·°°°E
0010: 75 72 6F 41 73 73 65 6D 62 6C 65 72 2F 88 05 00  uroAssembler/¤·°
0020: 00 9D 37 73 2C 88 24 00 80 A0 01 00 09 57 72 69  °¤7s,¤$°¤¤·°·Wri
0030: 74 65 2E 57 36 34 0A 74 37 30 39 37 4C 2E 64 6C  te.W64¬t7097L.dl
0040: 6C 09 57 72 69 74 65 2E 57 36 34 22 88 22 00 80  l·Write.W64"¤"°¤
0050: A0 01 00 08 42 65 65 70 2E 57 36 34 0A 74 37 30  ¤·°·Beep.W64¬t70
0060: 39 37 4C 2E 64 6C 6C 08 42 65 65 70 2E 57 36 34  97L.dll·Beep.W64
0070: 44 88 22 00 80 A0 01 00 08 45 78 69 74 2E 57 36  D¤"°¤¤·°·Exit.W6
0080: 34 0A 74 37 30 39 37 4C 2E 64 6C 6C 08 45 78 69  4¬t7097L.dll·Exi
0090: 74 2E 57 36 34 08 96 02 00 00 68 8C 0C 00 09 57  t.W64·¤·°°h¤·°·W
00A0: 72 69 74 65 2E 57 36 34 00 65 8C 0B 00 08 42 65  rite.W64°e¤·°·Be
00B0: 65 70 2E 57 36 34 00 F6 8C 0B 00 08 45 78 69 74  ep.W64°¤¤·°·Exit
00C0: 2E 57 36 34 00 D8 8A 02 00 00 74                 .W64°¤¤·°°t

▲Back to the top▲