EuroAssembler Index Manual Download Source Macros


Sitemap Links Forum Tests Projects

Test t9563: ELF object module for 32bit Windows links COFF modules


Source & expected listing t9563.htm.lst
| | EUROASM AUTOSEGMENT=ON,CPU=386,DUMPWIDTH=25 |7439353633 |%test %SET t9563 | |;; | |;; Create the first auxilliary COFF module "%test.WB.obj". | |%test.WB PROGRAM FORMAT=COFF,MODEL=FLAT,WIDTH=32 |[.text] ::::Section changed. |00000000: |Write.W32:: PROC ; Display ASCIIZ string pointed to by ESI using Windows. | | IMPORT GetStdHandle:,WriteFile: ; Declare imported Windows kernel functions. |00000000:6AF5 | PUSH -11 ; %1 Identifier of standard output STD_OUTPUT_HANDLE. |00000002:E8(00000000) | CALL GetStdHandle: ; Stdcall the imported Windows function with 1 argument. |00000007:89C3 | MOV EBX,EAX ; Save the returned StdOutput handle to EBX. |00000009:89F7 | MOV EDI,ESI ; Use EDI to find the end of input string. |0000000B:31C9 | XOR ECX,ECX ; Clear ECX to keep the size of input string. |0000000D:31C0 | XOR EAX,EAX ; Clear AL, the searched NUL character. |0000000F:F7D1 | NOT ECX ; Assume unlimited possible string size. |00000011:F2AE | REPNE SCASB ; Find the zero terminator. |00000013:F7D1 | NOT ECX ; Get string size to ECX. |00000015:52 | PUSH EDX ; Alloc temporary DWORD memory variable on stack. |00000016:89E2 | MOV EDX,ESP ; Get address of this DWORD to EDX. |00000018:50 | PUSH EAX ; %5 No overlap of WriteFile. |00000019:52 | PUSH EDX ; %4 Memory variable for number of bytes. |0000001A:51 | PUSH ECX ; %3 String size. |0000001B:56 | PUSH ESI ; %2 String address. |0000001C:53 | PUSH EBX ; %1 Standard output file handle. |0000001D:E8(00000000) | CALL WriteFile: ; Stdcall the imported function with 5 arguments. |00000022:5A | POP EDX ; Free and discard the temporary DWORD on stack. |00000023:C3 | RET ; Return to caller. |00000024: | ENDPROC Write.W32: | |;; |00000024: |Beep.W32:: PROC ; Play a sound in 32bit Windows. |00000024:BE[00000000] | MOV ESI,=B"Beeping..." ; Define a literal string in [.rodata]. |00000029:E8D2FFFFFF | CALL Write.W32:: ; Display the notification "Beeping...". | | IMPORT Beep: ; Declare imported Windows kernel function. |0000002E:68C8000000 | PUSH 200 ; %2 Sound duration [ms]. |00000033:68B8010000 | PUSH 440 ; %1 Sound frequency [Hz]. |00000038:E8(00000000) | CALL Beep: ; Stdcall the imported function with 2 arguments. |0000003D:6890010000 | PUSH 400 ; %2 Sound duration [ms]. |00000042:684B020000 | PUSH 587 ; %1 Sound frequency [Hz]. |00000047:E8(00000000) | CALL Beep: ; Stdcall the imported function with 2 arguments. |0000004C:C3 | RET ; Return to caller. |0000004D: | ENDPROC Beep.W32: |[@LT1] ====ListLiterals in section [@LT1]. |00000000:42656570696E~~=B"Beeping..." | |ENDPROGRAM %test.WB | **** ListMap "t9563.WB.obj",model=FLAT,groups=0,segments=3,entry=,stack= | [.text],FA=0000008Ch,RVA=00000000h,size=0000004Dh=77,width=32,align=0010h,purpose=CODE | [.rodata],FA=0000010Ch,RVA=00000000h,size=0000000Bh=11,width=32,align=0010h,purpose=RODATA+LITERAL | [.drectve],FA=00000117h,RVA=00000000h,size=00000034h=52,width=0,align=1,purpose=DRECTVE | **** ListGlobals "t9563.WB.obj",Global=0,Public=2,Extern=0,eXport=0,Import=3 | Beep,[Beep]:00000000h,scope='I',lib="kernel32.dll" | Beep.W32,[.text]:00000024h,scope='P' | GetStdHandle,[GetStdHandle]:00000000h,scope='I',lib="kernel32.dll" | Write.W32,[.text]:00000000h,scope='P' | WriteFile,[WriteFile]:00000000h,scope='I',lib="kernel32.dll" | |;; | |;; Create the second auxilliary COFF module "%test.EX.obj". | |%test.EX PROGRAM FORMAT=COFF,MODEL=FLAT,WIDTH=32 |[.text] ::::Section changed. |00000000: |Exit.W32:: PROC ; Display the message "End" and terminate the program. |00000000:BE[00000000] | MOV ESI,.M: ; Address in segment [.bss] for the message. |00000005:C706456E6400 | MOVD [ESI+0],"End" ; Dynamically define the message "End". |0000000B:C746030D0A0000| MOVD [ESI+3],0x0A0D ; CR+LF. |00000012:E8(00000000) | CALL Write.W32:: ; Display the notification "End". | | IMPORT ExitProcess: ; Use imported Windows kernel function. |00000017:6A00 | PUSH 0 ; %1 Terminate with errorlevel 0. |00000019:E9(00000000) | JMP ExitProcess: ; Use imported function with 1 argument. |[.bss] ::::Section changed. |00000000:..............|.M: DB 7*BYTE ; Reserve space for ASCIIZ string "End" in segment [.bss]. |[.text] ::::Section changed. |0000001E: | ENDPROC Exit.W32: | |ENDPROGRAM %test.EX | **** ListMap "t9563.EX.obj",model=FLAT,groups=0,segments=3,entry=,stack= | [.text],FA=0000008Ch,RVA=00000000h,size=0000001Eh=30,width=32,align=0010h,purpose=CODE | [.bss],FA=00000000h,RVA=00000000h,size=00000007h=7,width=32,align=0010h,purpose=BSS | [.drectve],FA=000000C8h,RVA=00000000h,size=00000014h=20,width=0,align=1,purpose=DRECTVE | **** ListGlobals "t9563.EX.obj",Global=0,Public=1,Extern=1,eXport=0,Import=1 | Exit.W32,[.text]:00000000h,scope='P' | ExitProcess,[ExitProcess]:00000000h,scope='I',lib="kernel32.dll" | Write.W32,[Write.W32]:00000000h,scope='E' | |;; | |;; Create the main ELF module from two auxilliary COFF modules. | |%test PROGRAM FORMAT=ELF,MODEL=FLAT,WIDTH=32 | | LINK %test.WB.obj, %test.EX.obj |[.data] ::::Section changed. |00000000:333262697420~~|Msg:: DB '%^WIDTH[]bit %^MODEL %^FORMAT program "%^OUTFILE".',13,10,0 | | ENDPROGRAM %test |# I0560 Linking COFF module ".\t9563.WB.obj". |# I0563 Accepting link directive '/IMPORT:GetStdHandle'. |# I0563 Accepting link directive '/IMPORT:WriteFile'. |# I0563 Accepting link directive '/IMPORT:Beep'. |# I0560 Linking COFF module ".\t9563.EX.obj". |# I0563 Accepting link directive '/IMPORT:ExitProcess'. | **** ListMap "t9563.o",model=FLAT,groups=0,segments=10,entry=,stack= | [],FA=00000000h,RVA=00000000h,size=00000000h=0,width=0,align=0,purpose= | [.symtab],FA=000001D0h,RVA=00000000h,size=00000140h=320,width=0,align=0010h,purpose=SYMBOLS | [.rel.text],FA=00000310h,RVA=00000000h,size=00000038h=56,width=0,align=8,purpose=RELOC | [.drectve],FA=00000348h,RVA=00000000h,size=00000064h=100,width=0,align=4,purpose=DRECTVE | [.strtab],FA=000003ACh,RVA=00000000h,size=000000A4h=164,width=0,align=1,purpose=STRINGS | [.shstrtab],FA=00000450h,RVA=00000000h,size=00000047h=71,width=0,align=1,purpose=STRINGS | [.text],FA=000004A0h,RVA=00000000h,size=0000006Eh=110,width=32,align=0010h,purpose=CODE | [.rodata],FA=00000510h,RVA=00000000h,size=0000000Bh=11,width=32,align=0010h,purpose=RODATA | [.data],FA=00000520h,RVA=00000000h,size=00000024h=36,width=32,align=0010h,purpose=DATA | [.bss],FA=00000550h,RVA=00000000h,size=00000007h=7,width=32,align=0010h,purpose=BSS | **** ListGlobals "t9563.o",Global=0,Public=4,Extern=0,eXport=0,Import=4 | Beep,[Beep]:00000000h,scope='I',lib="kernel32.dll" | Beep.W32,[.text]:00000024h,scope='P' | Exit.W32,[.text]:00000050h,scope='P' | ExitProcess,[ExitProcess]:00000000h,scope='I',lib="kernel32.dll" | GetStdHandle,[GetStdHandle]:00000000h,scope='I',lib="kernel32.dll" | Msg,[.data]:00000000h,scope='P' | Write.W32,[.text]:00000000h,scope='P' | WriteFile,[WriteFile]:00000000h,scope='I',lib="kernel32.dll"
Expected messages t9563.out
I0180 Assembling source file "t9563.htm". I0270 Assembling source "t9563". I0310 Assembling source pass 1. I0330 Assembling source pass 2 - final. I0470 Assembling program "t9563.WB". "t9563.htm"{45} I0510 Assembling program pass 1. "t9563.htm"{45} I0510 Assembling program pass 2. "t9563.htm"{45} I0530 Assembling program pass 3 - final. "t9563.htm"{45} I0660 32bit FLAT COFF file "t9563.WB.obj" created, size=654. "t9563.htm"{84} I0650 Program "t9563.WB" assembled in 3 passes with errorlevel 0. "t9563.htm"{84} I0470 Assembling program "t9563.EX". "t9563.htm"{97} I0510 Assembling program pass 1. "t9563.htm"{97} I0510 Assembling program pass 2. "t9563.htm"{97} I0530 Assembling program pass 3 - final. "t9563.htm"{97} I0660 32bit FLAT COFF file "t9563.EX.obj" created, size=473. "t9563.htm"{111} I0650 Program "t9563.EX" assembled in 3 passes with errorlevel 0. "t9563.htm"{111} I0470 Assembling program "t9563". "t9563.htm"{122} I0510 Assembling program pass 1. "t9563.htm"{122} I0510 Assembling program pass 2. "t9563.htm"{122} I0530 Assembling program pass 3 - final. "t9563.htm"{122} I0560 Linking COFF module ".\t9563.WB.obj". "t9563.htm"{126} I0563 Accepting link directive '/IMPORT:GetStdHandle'. "t9563.htm"{126} I0563 Accepting link directive '/IMPORT:WriteFile'. "t9563.htm"{126} I0563 Accepting link directive '/IMPORT:Beep'. "t9563.htm"{126} I0560 Linking COFF module ".\t9563.EX.obj". "t9563.htm"{126} I0563 Accepting link directive '/IMPORT:ExitProcess'. "t9563.htm"{126} I0660 32bit FLAT ELF file "t9563.o" created, size=1348. "t9563.htm"{126} I0650 Program "t9563" assembled in 3 passes with errorlevel 0. "t9563.htm"{126} I0750 Source "t9563" (278 lines) assembled in 2 passes with errorlevel 0. I0860 Listing file "t9563.htm.lst" created, size=8510. I0990 EuroAssembler terminated with errorlevel 0.
Expected output file t9563. o
0000: 7F 45 4C 46 01 01 01 00 00 00 00 00 00 00 00 00  ¤ELF···°°°°°°°°°
0010: 01 00 03 00 01 00 00 00 00 00 00 00 00 00 00 00  ·°·°·°°°°°°°°°°°
0020: 38 00 00 00 00 00 00 00 34 00 20 00 00 00 28 00  8°°°°°°°4°¯°°°(°
0030: 0A 00 05 00 00 00 00 00 00 00 00 00 00 00 00 00  ¬°·°°°°°°°°°°°°°
0040: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  °°°°°°°°°°°°°°°°
0050: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  °°°°°°°°°°°°°°°°
0060: 01 00 00 00 02 00 00 00 00 00 00 00 00 00 00 00  ·°°°·°°°°°°°°°°°
0070: D0 01 00 00 40 01 00 00 04 00 00 00 0C 00 00 00  ¤·°°@·°°·°°°·°°°
0080: 10 00 00 00 10 00 00 00 09 00 00 00 09 00 00 00  ·°°°·°°°·°°°·°°°
0090: 02 00 00 00 00 00 00 00 10 03 00 00 38 00 00 00  ·°°°°°°°··°°8°°°
00A0: 01 00 00 00 06 00 00 00 08 00 00 00 08 00 00 00  ·°°°·°°°·°°°·°°°
00B0: 13 00 00 00 07 00 00 00 00 00 00 00 00 00 00 00  ·°°°·°°°°°°°°°°°
00C0: 48 03 00 00 64 00 00 00 00 00 00 00 00 00 00 00  H·°°d°°°°°°°°°°°
00D0: 04 00 00 00 00 00 00 00 1C 00 00 00 03 00 00 00  ·°°°°°°°·°°°·°°°
00E0: 00 00 00 00 00 00 00 00 AC 03 00 00 A4 00 00 00  °°°°°°°°¤·°°¤°°°
00F0: 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00  °°°°°°°°·°°°°°°°
0100: 24 00 00 00 03 00 00 00 00 00 00 00 00 00 00 00  $°°°·°°°°°°°°°°°
0110: 50 04 00 00 47 00 00 00 00 00 00 00 00 00 00 00  P·°°G°°°°°°°°°°°
0120: 01 00 00 00 00 00 00 00 2E 00 00 00 01 00 00 00  ·°°°°°°°.°°°·°°°
0130: 06 00 00 00 00 00 00 00 A0 04 00 00 6E 00 00 00  ·°°°°°°°¤·°°n°°°
0140: 00 00 00 00 00 00 00 00 10 00 00 00 00 00 00 00  °°°°°°°°·°°°°°°°
0150: 34 00 00 00 01 00 00 00 02 00 00 00 00 00 00 00  4°°°·°°°·°°°°°°°
0160: 10 05 00 00 0B 00 00 00 00 00 00 00 00 00 00 00  ··°°·°°°°°°°°°°°
0170: 10 00 00 00 00 00 00 00 3C 00 00 00 01 00 00 00  ·°°°°°°°<°°°·°°°
0180: 03 00 00 00 00 00 00 00 20 05 00 00 24 00 00 00  ·°°°°°°°¯·°°$°°°
0190: 00 00 00 00 00 00 00 00 10 00 00 00 00 00 00 00  °°°°°°°°·°°°°°°°
01A0: 42 00 00 00 08 00 00 00 03 00 00 00 00 00 00 00  B°°°·°°°·°°°°°°°
01B0: 50 05 00 00 07 00 00 00 00 00 00 00 00 00 00 00  P·°°·°°°°°°°°°°°
01C0: 10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ·°°°°°°°°°°°°°°°
01D0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  °°°°°°°°°°°°°°°°
01E0: 01 00 00 00 00 00 00 00 00 00 00 00 04 00 F1 FF  ·°°°°°°°°°°°·°¤¤
01F0: 0B 00 00 00 00 00 00 00 00 00 00 00 03 00 09 00  ·°°°°°°°°°°°·°·°
0200: 10 00 00 00 00 00 00 00 00 00 00 00 03 00 08 00  ·°°°°°°°°°°°·°·°
0210: 16 00 00 00 00 00 00 00 00 00 00 00 03 00 03 00  ·°°°°°°°°°°°·°·°
0220: 1F 00 00 00 00 00 00 00 00 00 00 00 03 00 07 00  ·°°°°°°°°°°°·°·°
0230: 27 00 00 00 00 00 00 00 00 00 00 00 03 00 04 00  '°°°°°°°°°°°·°·°
0240: 2F 00 00 00 00 00 00 00 00 00 00 00 03 00 01 00  /°°°°°°°°°°°·°·°
0250: 37 00 00 00 00 00 00 00 00 00 00 00 03 00 06 00  7°°°°°°°°°°°·°·°
0260: 3D 00 00 00 00 00 00 00 00 00 00 00 01 00 07 00  =°°°°°°°°°°°·°·°
0270: 4C 00 00 00 00 00 00 00 00 00 00 00 00 00 07 00  L°°°°°°°°°°°°°·°
0280: 51 00 00 00 00 00 00 00 00 00 00 00 01 00 09 00  Q°°°°°°°°°°°·°·°
0290: 5C 00 00 00 00 00 00 00 00 00 00 00 10 00 00 00  \°°°°°°°°°°°·°°°
02A0: 61 00 00 00 24 00 00 00 00 00 00 00 12 00 06 00  a°°°$°°°°°°°·°·°
02B0: 6A 00 00 00 50 00 00 00 00 00 00 00 12 00 06 00  j°°°P°°°°°°°·°·°
02C0: 73 00 00 00 00 00 00 00 00 00 00 00 10 00 00 00  s°°°°°°°°°°°·°°°
02D0: 7F 00 00 00 00 00 00 00 00 00 00 00 10 00 00 00  ¤°°°°°°°°°°°·°°°
02E0: 8C 00 00 00 00 00 00 00 24 00 00 00 11 00 08 00  ¤°°°°°°°$°°°·°·°
02F0: 90 00 00 00 00 00 00 00 00 00 00 00 12 00 06 00  ¤°°°°°°°°°°°·°·°
0300: 9A 00 00 00 00 00 00 00 00 00 00 00 10 00 00 00  ¤°°°°°°°°°°°·°°°
0310: 03 00 00 00 02 10 00 00 1E 00 00 00 02 13 00 00  ·°°°··°°·°°°··°°
0320: 25 00 00 00 01 05 00 00 39 00 00 00 02 0C 00 00  %°°°··°°9°°°··°°
0330: 48 00 00 00 02 0C 00 00 51 00 00 00 01 02 00 00  H°°°··°°Q°°°··°°
0340: 6A 00 00 00 02 0F 00 00 0D 00 00 00 48 00 00 00  j°°°··°°·°°°H°°°
0350: EA 00 00 00 45 75 72 6F 41 73 73 65 6D 62 6C 65  ¤°°°EuroAssemble
0360: 72 00 00 00 20 2F 49 4D 50 4F 52 54 3A 42 65 65  r°°°¯/IMPORT:Bee
0370: 70 20 2F 49 4D 50 4F 52 54 3A 47 65 74 53 74 64  p¯/IMPORT:GetStd
0380: 48 61 6E 64 6C 65 20 2F 49 4D 50 4F 52 54 3A 57  Handle¯/IMPORT:W
0390: 72 69 74 65 46 69 6C 65 20 2F 49 4D 50 4F 52 54  riteFile¯/IMPORT
03A0: 3A 45 78 69 74 50 72 6F 63 65 73 73 00 74 39 35  :ExitProcess°t95
03B0: 36 33 2E 68 74 6D 00 2E 62 73 73 00 2E 64 61 74  63.htm°.bss°.dat
03C0: 61 00 2E 64 72 65 63 74 76 65 00 2E 72 6F 64 61  a°.drectve°.roda
03D0: 74 61 00 2E 73 74 72 74 61 62 00 2E 73 79 6D 74  ta°.strtab°.symt
03E0: 61 62 00 2E 74 65 78 74 00 3D 42 22 42 65 65 70  ab°.text°=B"Beep
03F0: 69 6E 67 2E 2E 2E 22 00 40 4C 54 31 00 45 78 69  ing..."°@LT1°Exi
0400: 74 2E 57 33 32 2E 4D 00 42 65 65 70 00 42 65 65  t.W32.M°Beep°Bee
0410: 70 2E 57 33 32 00 45 78 69 74 2E 57 33 32 00 45  p.W32°Exit.W32°E
0420: 78 69 74 50 72 6F 63 65 73 73 00 47 65 74 53 74  xitProcess°GetSt
0430: 64 48 61 6E 64 6C 65 00 4D 73 67 00 57 72 69 74  dHandle°Msg°Writ
0440: 65 2E 57 33 32 00 57 72 69 74 65 46 69 6C 65 00  e.W32°WriteFile°
0450: 00 2E 73 79 6D 74 61 62 00 2E 72 65 6C 2E 74 65  °.symtab°.rel.te
0460: 78 74 00 2E 64 72 65 63 74 76 65 00 2E 73 74 72  xt°.drectve°.str
0470: 74 61 62 00 2E 73 68 73 74 72 74 61 62 00 2E 74  tab°.shstrtab°.t
0480: 65 78 74 00 2E 72 6F 64 61 74 61 00 2E 64 61 74  ext°.rodata°.dat
0490: 61 00 2E 62 73 73 00 00 00 00 00 00 00 00 00 00  a°.bss°°°°°°°°°°
04A0: 6A F5 E8 FC FF FF FF 89 C3 89 F7 31 C9 31 C0 F7  j¤¤¤¤¤¤¤¤¤¤1¤1¤¤
04B0: D1 F2 AE F7 D1 52 89 E2 50 52 51 56 53 E8 FC FF  ¤¤¤¤¤R¤¤PRQVS¤¤¤
04C0: FF FF 5A C3 BE 00 00 00 00 E8 D2 FF FF FF 68 C8  ¤¤Z¤¤°°°°¤¤¤¤¤h¤
04D0: 00 00 00 68 B8 01 00 00 E8 FC FF FF FF 68 90 01  °°°h¤·°°¤¤¤¤¤h¤·
04E0: 00 00 68 4B 02 00 00 E8 FC FF FF FF C3 90 90 90  °°hK·°°¤¤¤¤¤¤¤¤¤
04F0: BE 00 00 00 00 C7 06 45 6E 64 00 C7 46 03 0D 0A  ¤°°°°¤·End°¤F··¬
0500: 00 00 E8 99 FF FF FF 6A 00 E9 FC FF FF FF 00 00  °°¤¤¤¤¤j°¤¤¤¤¤°°
0510: 42 65 65 70 69 6E 67 2E 2E 2E 00 00 00 00 00 00  Beeping...°°°°°°
0520: 33 32 62 69 74 20 46 4C 41 54 20 45 4C 46 20 70  32bit¯FLAT¯ELF¯p
0530: 72 6F 67 72 61 6D 20 22 74 39 35 36 33 2E 6F 22  rogram¯"t9563.o"
0540: 2E 0D 0A 00                                      .·¬°

▲Back to the top▲