EuroAssembler Index Manual Download Source Macros


Sitemap Links Forum Tests Projects

Test t8808: COFF object module for 32bit Windows links LIBOMF library


Source & expected listing t8808.htm.lst
| | EUROASM AUTOSEGMENT=ON,CPU=386,DUMPWIDTH=25 |7438383038 |%test %SET t8808 | |;; | |;; Create the first auxilliary OMF module "%test.WB.obj". | |%test.WB PROGRAM FORMAT=OMF,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 "t8808.WB.obj",model=FLAT,groups=0,segments=2,entry=,stack= | [.text],FA=0000011Ah,RVA=00000000h,size=0000004Dh=77,width=32,align=0010h,purpose=CODE | [.rodata],FA=00000188h,RVA=00000000h,size=0000000Bh=11,width=32,align=0010h,purpose=RODATA+LITERAL | **** ListGlobals "t8808.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 OMF module "%test.EX.obj". | |%test.EX PROGRAM FORMAT=OMF,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 "t8808.EX.obj",model=FLAT,groups=0,segments=2,entry=,stack= | [.text],FA=000000AFh,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 | **** ListGlobals "t8808.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 auxilliary LIBOMF library from two OMF modules. | |%test PROGRAM FORMAT=LIBOMF,MODEL=FLAT,WIDTH=32 | | LINK %test.WB.obj, %test.EX.obj | | ENDPROGRAM %test |# I0560 Linking OMF module ".\t8808.WB.obj". |# I0560 Linking OMF module ".\t8808.EX.obj". | **** ListMap "t8808.lib",model=FLAT,groups=0,segments=0,entry=,stack= | **** ListGlobals "t8808.lib",Global=0,Public=0,Extern=0,eXport=0,Import=0 | |;; | |;; Create the main COFF object module from LIBOMF library. | |%test PROGRAM FORMAT=COFF,MODEL=FLAT,WIDTH=32 | | GLOBAL Write.W32, Beep.W32, Exit.W32 | | LINK %test.lib |[.data] ::::Section changed. |00000000:333262697420~~|Msg:: DB '%^WIDTH[]bit %^MODEL %^FORMAT program "%^OUTFILE".',13,10,0 | | ENDPROGRAM %test |# I0561 Linking LIBOMF library ".\t8808.lib". | **** ListMap "t8808.obj",model=FLAT,groups=0,segments=5,entry=,stack= | [.text],FA=000000DCh,RVA=00000000h,size=0000006Eh=110,width=32,align=0010h,purpose=CODE | [.rodata],FA=00000190h,RVA=00000000h,size=0000000Bh=11,width=32,align=0010h,purpose=RODATA | [.data],FA=0000019Bh,RVA=00000000h,size=00000027h=39,width=32,align=0010h,purpose=DATA | [.bss],FA=00000000h,RVA=00000000h,size=00000007h=7,width=32,align=0010h,purpose=BSS | [.drectve],FA=000001C2h,RVA=00000000h,size=00000048h=72,width=0,align=1,purpose=DRECTVE | **** ListGlobals "t8808.obj",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 t8808.out
I0180 Assembling source file "t8808.htm". I0270 Assembling source "t8808". I0310 Assembling source pass 1. I0330 Assembling source pass 2 - final. I0470 Assembling program "t8808.WB". "t8808.htm"{45} I0510 Assembling program pass 1. "t8808.htm"{45} I0510 Assembling program pass 2. "t8808.htm"{45} I0530 Assembling program pass 3 - final. "t8808.htm"{45} I0660 32bit FLAT OMF file "t8808.WB.obj" created, size=417. "t8808.htm"{84} I0650 Program "t8808.WB" assembled in 3 passes with errorlevel 0. "t8808.htm"{84} I0470 Assembling program "t8808.EX". "t8808.htm"{96} I0510 Assembling program pass 1. "t8808.htm"{96} I0510 Assembling program pass 2. "t8808.htm"{96} I0530 Assembling program pass 3 - final. "t8808.htm"{96} I0660 32bit FLAT OMF file "t8808.EX.obj" created, size=235. "t8808.htm"{110} I0650 Program "t8808.EX" assembled in 3 passes with errorlevel 0. "t8808.htm"{110} I0470 Assembling program "t8808". "t8808.htm"{120} I0510 Assembling program pass 1. "t8808.htm"{120} I0530 Assembling program pass 2 - final. "t8808.htm"{120} I0560 Linking OMF module ".\t8808.WB.obj". "t8808.htm"{122} I0560 Linking OMF module ".\t8808.EX.obj". "t8808.htm"{122} I0660 32bit FLAT LIBOMF file "t8808.lib" created, size=2048. "t8808.htm"{122} I0650 Program "t8808" assembled in 2 passes with errorlevel 0. "t8808.htm"{122} I0470 Assembling program "t8808". "t8808.htm"{129} I0510 Assembling program pass 1. "t8808.htm"{129} I0510 Assembling program pass 2. "t8808.htm"{129} I0530 Assembling program pass 3 - final. "t8808.htm"{129} I0561 Linking LIBOMF library ".\t8808.lib". "t8808.htm"{134} I0660 32bit FLAT COFF file "t8808.obj" created, size=931. "t8808.htm"{134} I0650 Program "t8808" assembled in 3 passes with errorlevel 0. "t8808.htm"{134} I0750 Source "t8808" (252 lines) assembled in 2 passes with errorlevel 0. I0860 Listing file "t8808.htm.lst" created, size=8159. I0990 EuroAssembler terminated with errorlevel 0.
Expected output file t8808. obj
0000: 4C 01 05 00 00 00 00 00 0A 02 00 00 14 00 00 00  L··°°°°°¬·°°·°°°
0010: 00 00 00 01 2E 74 65 78 74 00 00 00 00 00 00 00  °°°·.text°°°°°°°
0020: 00 00 00 00 6E 00 00 00 DC 00 00 00 4A 01 00 00  °°°°n°°°¤°°°J·°°
0030: 00 00 00 00 07 00 00 00 20 00 50 60 2E 72 6F 64  °°°°·°°°¯°P`.rod
0040: 61 74 61 00 00 00 00 00 00 00 00 00 0B 00 00 00  ata°°°°°°°°°·°°°
0050: 90 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ¤·°°°°°°°°°°°°°°
0060: 40 00 50 40 2E 64 61 74 61 00 00 00 00 00 00 00  @°P@.data°°°°°°°
0070: 00 00 00 00 27 00 00 00 9B 01 00 00 00 00 00 00  °°°°'°°°¤·°°°°°°
0080: 00 00 00 00 00 00 00 00 40 00 50 C0 2E 62 73 73  °°°°°°°°@°P¤.bss
0090: 00 00 00 00 00 00 00 00 00 00 00 00 07 00 00 00  °°°°°°°°°°°°·°°°
00A0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  °°°°°°°°°°°°°°°°
00B0: 80 00 50 C0 2E 64 72 65 63 74 76 65 00 00 00 00  ¤°P¤.drectve°°°°
00C0: 00 00 00 00 48 00 00 00 C2 01 00 00 00 00 00 00  °°°°H°°°¤·°°°°°°
00D0: 00 00 00 00 00 00 00 00 00 0A 10 02 6A F5 E8 00  °°°°°°°°°¬··j¤¤°
00E0: 00 00 00 89 C3 89 F7 31 C9 31 C0 F7 D1 F2 AE F7  °°°¤¤¤¤1¤1¤¤¤¤¤¤
00F0: D1 52 89 E2 50 52 51 56 53 E8 00 00 00 00 5A C3  ¤R¤¤PRQVS¤°°°°Z¤
0100: BE 00 00 00 00 E8 D2 FF FF FF 68 C8 00 00 00 68  ¤°°°°¤¤¤¤¤h¤°°°h
0110: B8 01 00 00 E8 00 00 00 00 68 90 01 00 00 68 4B  ¤·°°¤°°°°h¤·°°hK
0120: 02 00 00 E8 00 00 00 00 C3 90 90 90 BE 00 00 00  ·°°¤°°°°¤¤¤¤¤°°°
0130: 00 C7 06 45 6E 64 00 C7 46 03 0D 0A 00 00 E8 99  °¤·End°¤F··¬°°¤¤
0140: FF FF FF 6A 00 E9 00 00 00 00 03 00 00 00 10 00  ¤¤¤j°¤°°°°·°°°·°
0150: 00 00 14 00 1E 00 00 00 13 00 00 00 14 00 25 00  °°·°·°°°·°°°·°%°
0160: 00 00 08 00 00 00 06 00 39 00 00 00 0C 00 00 00  °°·°°°·°9°°°·°°°
0170: 14 00 48 00 00 00 0C 00 00 00 14 00 51 00 00 00  ·°H°°°·°°°·°Q°°°
0180: 02 00 00 00 06 00 6A 00 00 00 0F 00 00 00 14 00  ·°°°·°j°°°·°°°·°
0190: 42 65 65 70 69 6E 67 2E 2E 2E 00 33 32 62 69 74  Beeping...°32bit
01A0: 20 46 4C 41 54 20 43 4F 46 46 20 70 72 6F 67 72  ¯FLAT¯COFF¯progr
01B0: 61 6D 20 22 74 38 38 30 38 2E 6F 62 6A 22 2E 0D  am¯"t8808.obj".·
01C0: 0A 00 20 2F 49 4D 50 4F 52 54 3A 47 65 74 53 74  ¬°¯/IMPORT:GetSt
01D0: 64 48 61 6E 64 6C 65 20 2F 49 4D 50 4F 52 54 3A  dHandle¯/IMPORT:
01E0: 57 72 69 74 65 46 69 6C 65 20 2F 49 4D 50 4F 52  WriteFile¯/IMPOR
01F0: 54 3A 42 65 65 70 20 2F 49 4D 50 4F 52 54 3A 45  T:Beep¯/IMPORT:E
0200: 78 69 74 50 72 6F 63 65 73 73 2E 66 69 6C 65 00  xitProcess.file°
0210: 00 00 00 00 00 00 FE FF 00 00 67 01 74 38 38 30  °°°°°°¤¤°°g·t880
0220: 38 2E 68 74 6D 00 00 00 00 00 00 00 00 00 2E 62  8.htm°°°°°°°°°.b
0230: 73 73 00 00 00 00 00 00 00 00 04 00 00 00 03 01  ss°°°°°°°°·°°°··
0240: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  °°°°°°°°°°°°°°°°
0250: 00 00 2E 64 61 74 61 00 00 00 00 00 00 00 03 00  °°.data°°°°°°°·°
0260: 00 00 03 01 27 00 00 00 00 00 00 00 00 00 00 00  °°··'°°°°°°°°°°°
0270: 00 00 00 00 00 00 2E 64 72 65 63 74 76 65 00 00  °°°°°°.drectve°°
0280: 00 00 05 00 00 00 03 01 48 00 00 00 00 00 00 00  °°·°°°··H°°°°°°°
0290: 00 00 00 00 00 00 00 00 00 00 2E 72 6F 64 61 74  °°°°°°°°°°.rodat
02A0: 61 00 00 00 00 00 02 00 00 00 03 01 0B 00 00 00  a°°°°°·°°°···°°°
02B0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 2E 74  °°°°°°°°°°°°°°.t
02C0: 65 78 74 00 00 00 00 00 00 00 01 00 00 00 03 01  ext°°°°°°°·°°°··
02D0: 6E 00 00 00 07 00 00 00 00 00 00 00 00 00 00 00  n°°°·°°°°°°°°°°°
02E0: 00 00 42 65 65 70 00 00 00 00 00 00 00 00 00 00  °°Beep°°°°°°°°°°
02F0: 01 01 02 00 42 65 65 70 2E 57 33 32 24 00 00 00  ···°Beep.W32$°°°
0300: 01 00 00 00 02 00 45 78 69 74 2E 57 33 32 50 00  ·°°°·°Exit.W32P°
0310: 00 00 01 00 00 00 02 00 00 00 00 00 04 00 00 00  °°·°°°·°°°°°·°°°
0320: 00 00 00 00 00 00 01 01 02 00 00 00 00 00 10 00  °°°°°°···°°°°°·°
0330: 00 00 00 00 00 00 00 00 01 01 02 00 4D 73 67 00  °°°°°°°°···°Msg°
0340: 00 00 00 00 00 00 00 00 03 00 0C 00 02 00 00 00  °°°°°°°°·°·°·°°°
0350: 00 00 1D 00 00 00 00 00 00 00 01 00 00 00 02 00  °°·°°°°°°°·°°°·°
0360: 00 00 00 00 27 00 00 00 00 00 00 00 00 00 01 01  °°°°'°°°°°°°°°··
0370: 02 00 31 00 00 00 45 78 69 74 50 72 6F 63 65 73  ·°1°°°ExitProces
0380: 73 00 47 65 74 53 74 64 48 61 6E 64 6C 65 00 57  s°GetStdHandle°W
0390: 72 69 74 65 2E 57 33 32 00 57 72 69 74 65 46 69  rite.W32°WriteFi
03A0: 6C 65 00                                         le°

▲Back to the top▲