EuroAssembler Index Manual Download Source Macros


Sitemap Links Forum Tests Projects

Test t9800: ELFX program for 32bit Linux


Source & expected listing t9800.htm.lst
| | EUROASM AUTOSEGMENT=ON,CPU=386,DUMPWIDTH=28 |7439383030 |%test %SET t9800 | |;; | |%test PROGRAM FORMAT=ELFX,MODEL=FLAT,WIDTH=32,ENTRY=Start: |[.text] ::::Section changed. |00000000: |Write.L32:: PROC ; Display ASCIIZ string pointed to by ESI using 32bit Linux. |00000000:31C9 | XOR ECX,ECX ; Clear ECX to keep the size of input string. |00000002:31C0 | XOR EAX,EAX ; Clear AL, the searched terminating character |00000004:89F7 | MOV EDI,ESI ; String address. |00000006:F7D1 | NOT ECX ; Assume unlimited possible string size. |00000008:F2AE | REPNE SCASB ; Find the zero terminator. |0000000A:F7D1 | NOT ECX ; Get string size to RCX. |0000000C:B804000000 | MOV EAX,4 ; Kernel service sys_write. |00000011:BB01000000 | MOV EBX,1 ; %1 I/O handle STDOUT_FILENO. |00000016:89CA | MOV EDX,ECX ; %3 String size. |00000018:89F1 | MOV ECX,ESI ; %2 String address. |0000001A:CD80 | INT 0x80 ; Invoke kernel. |0000001C:C3 | RET ; Return to caller. EAX,EBX,ECX,EDX,ESI,EDI are clobbered. |0000001D: | ENDPROC Write.L32: | |;; |0000001D: |Beep.L32:: PROC ; Display message "Beeping.." and play a sound using 32bit Linux. |0000001D:8D35[00000000] | LEA ESI,[=B"Beeping..."] ; Define a literal string in [.rodata]. |00000023:E8D8FFFFFF | CALL Write.L32:: ; Display the notification "Beeping...". |00000028:8D35[00000000] | LEA ESI,[=W(0x0007)] ; Define ASCIIZ string with BEL character in [.rodata]. |0000002E:E8CDFFFFFF | CALL Write.L32:: ; Play the beep sound. |00000033:C3 | RET ; Return to caller. RAX,RCX,RDX,RSI,RDI,R11 are clobbered. |00000034: | ENDPROC Beep.L32: | |;; |00000034: |Exit.L32:: PROC ; Display message "End", terminate the program. |00000034:8D35[00000000] | LEA ESI,[.M:] ; String "End" will be defined in segment [.bss] at ESI. |0000003A:C706456E6400 | MOVD [ESI+0],"End" ; Dynamically define the message "End". |00000040:C746030A000000 | MOVD [ESI+3],0x0A ; LF+NUL. |00000047:E8B4FFFFFF | CALL Write.L32:: ; Display the notification "End". |0000004C:31DB | XOR EBX,EBX ; %1 Errorlevel=0. |0000004E:B801000000 | MOV EAX,1 ; Kernel service sys_exit. |00000053:CD80 | INT 0x80 ; Invoke kernel. No return to caller. |[.bss] ::::Section changed. |00000000:.............. |.M:DB 7*BYTE ; Reserve space for ASCIIZ string "End" in [.bss]. |[.text] ::::Section changed. |00000055: | ENDPROC Exit.L32: | |;; |00000055:90 |Start:NOP ; Entry point of the executable program. |00000056:BE[00000000] | MOV ESI,Msg: ; Address of the initial message in section [.data]. |0000005B:E8A0FFFFFF | CALL Write.L32:: ; Display the message. |00000060:E8B8FFFFFF | CALL Beep.L32:: ; Play a beep sound. |00000065:E8CAFFFFFF | CALL Exit.L32:: ; Terminate the program. |[.data] ::::Section changed. |00000000:333262697420464C~|Msg:DB '%^WIDTH[]bit %^MODEL %^FORMAT program "%^OUTFILE".',10,0 |[@LT2] ====ListLiterals in section [@LT2]. |00000000:0700 =W(0x0007) |[@LT1] ====ListLiterals in section [@LT1]. |00000000:42656570696E672E~=B"Beeping..." | |ENDPROGRAM %test | **** ListMap "t9800.x",model=FLAT,groups=4,segments=8,entry=Start:,stack= | [LOAD.HDR],FA=00000000h,VA=00400000h,size=000003DDh=989,group [.symtab] [.strtab] [.shstrtab] | [],FA=00000000h,VA=00000000h,size=00000000h=0,width=0,align=0,purpose= | [.symtab],FA=00000200h,VA=00400200h,size=00000120h=288,width=0,align=0010h,purpose=SYMBOLS | [.strtab],FA=00000320h,VA=00400320h,size=00000089h=137,width=0,align=1,purpose=STRINGS | [.shstrtab],FA=000003A9h,VA=004003A9h,size=00000034h=52,width=0,align=1,purpose=STRINGS | [LOAD.CODE],FA=000003E0h,VA=004013E0h,size=0000006Ah=106,group [.text] | [.text],FA=000003E0h,VA=004013E0h,size=0000006Ah=106,width=32,align=0010h,purpose=CODE | [LOAD.RODATA],FA=00000450h,VA=00402450h,size=0000000Dh=13,group [.rodata] | [.rodata],FA=00000450h,VA=00402450h,size=0000000Dh=13,width=32,align=0010h,purpose=RODATA+LITERAL | [LOAD.DATA],FA=00000460h,VA=00403460h,size=00000037h=55,group [.data] [.bss] | [.data],FA=00000460h,VA=00403460h,size=00000024h=36,width=32,align=0010h,purpose=DATA | [.bss],FA=00000490h,VA=00403490h,size=00000007h=7,width=32,align=0010h,purpose=BSS | **** ListGlobals "t9800.x",Global=0,Public=4,Extern=0,eXport=0,Import=0 | Beep.L32,[.text]:0000001Dh,VA=004013FDh,scope='P' | Exit.L32,[.text]:00000034h,VA=00401414h,scope='P' | Start,[.text]:00000055h,VA=00401435h,scope='P' | Write.L32,[.text]:00000000h,VA=004013E0h,scope='P'
Expected messages t9800.out
I0180 Assembling source file "t9800.htm". I0270 Assembling source "t9800". I0310 Assembling source pass 1. I0330 Assembling source pass 2 - final. I0470 Assembling program "t9800". "t9800.htm"{44} I0510 Assembling program pass 1. "t9800.htm"{44} I0510 Assembling program pass 2. "t9800.htm"{44} I0530 Assembling program pass 3 - final. "t9800.htm"{44} I0660 32bit FLAT ELFX file "t9800.x" created, size=1156. "t9800.htm"{93} I0650 Program "t9800" assembled in 3 passes with errorlevel 0. "t9800.htm"{93} I0750 Source "t9800" (207 lines) assembled in 2 passes with errorlevel 0. I0860 Listing file "t9800.htm.lst" created, size=5626. I0990 EuroAssembler terminated with errorlevel 0.
Expected output file t9800. x
0000: 7F 45 4C 46 01 01 01 00 00 00 00 00 00 00 00 00  ¤ELF···°°°°°°°°°
0010: 02 00 03 00 01 00 00 00 35 14 40 00 40 00 00 00  ·°·°·°°°5·@°@°°°
0020: C0 00 00 00 00 00 00 00 34 00 20 00 04 00 28 00  ¤°°°°°°°4°¯°·°(°
0030: 08 00 03 00 00 00 00 00 00 00 00 00 00 00 00 00  ·°·°°°°°°°°°°°°°
0040: 01 00 00 00 00 00 00 00 00 00 40 00 00 00 40 00  ·°°°°°°°°°@°°°@°
0050: DD 03 00 00 DD 03 00 00 04 00 00 00 00 10 00 00  ¤·°°¤·°°·°°°°·°°
0060: 01 00 00 00 E0 03 00 00 E0 13 40 00 E0 13 40 00  ·°°°¤·°°¤·@°¤·@°
0070: 6A 00 00 00 6A 00 00 00 05 00 00 00 00 10 00 00  j°°°j°°°·°°°°·°°
0080: 01 00 00 00 50 04 00 00 50 24 40 00 50 24 40 00  ·°°°P·°°P$@°P$@°
0090: 0D 00 00 00 0D 00 00 00 04 00 00 00 00 10 00 00  ·°°°·°°°·°°°°·°°
00A0: 01 00 00 00 60 04 00 00 60 34 40 00 60 34 40 00  ·°°°`·°°`4@°`4@°
00B0: 37 00 00 00 37 00 00 00 06 00 00 00 00 10 00 00  7°°°7°°°·°°°°·°°
00C0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  °°°°°°°°°°°°°°°°
00D0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  °°°°°°°°°°°°°°°°
00E0: 00 00 00 00 00 00 00 00 01 00 00 00 02 00 00 00  °°°°°°°°·°°°·°°°
00F0: 00 00 00 00 00 02 40 00 00 02 00 00 20 01 00 00  °°°°°·@°°·°°¯·°°
0100: 02 00 00 00 0E 00 00 00 10 00 00 00 10 00 00 00  ·°°°·°°°·°°°·°°°
0110: 09 00 00 00 03 00 00 00 00 00 00 00 20 03 40 00  ·°°°·°°°°°°°¯·@°
0120: 20 03 00 00 89 00 00 00 00 00 00 00 00 00 00 00  ¯·°°¤°°°°°°°°°°°
0130: 01 00 00 00 00 00 00 00 11 00 00 00 03 00 00 00  ·°°°°°°°·°°°·°°°
0140: 00 00 00 00 A9 03 40 00 A9 03 00 00 34 00 00 00  °°°°¤·@°¤·°°4°°°
0150: 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00  °°°°°°°°·°°°°°°°
0160: 1B 00 00 00 01 00 00 00 06 00 00 00 E0 13 40 00  ·°°°·°°°·°°°¤·@°
0170: E0 03 00 00 6A 00 00 00 00 00 00 00 00 00 00 00  ¤·°°j°°°°°°°°°°°
0180: 10 00 00 00 00 00 00 00 21 00 00 00 01 00 00 00  ·°°°°°°°!°°°·°°°
0190: 02 00 00 00 50 24 40 00 50 04 00 00 0D 00 00 00  ·°°°P$@°P·°°·°°°
01A0: 00 00 00 00 00 00 00 00 10 00 00 00 00 00 00 00  °°°°°°°°·°°°°°°°
01B0: 29 00 00 00 01 00 00 00 03 00 00 00 60 34 40 00  )°°°·°°°·°°°`4@°
01C0: 60 04 00 00 24 00 00 00 00 00 00 00 00 00 00 00  `·°°$°°°°°°°°°°°
01D0: 10 00 00 00 00 00 00 00 2F 00 00 00 08 00 00 00  ·°°°°°°°/°°°·°°°
01E0: 03 00 00 00 90 34 40 00 90 04 00 00 07 00 00 00  ·°°°¤4@°¤·°°·°°°
01F0: 00 00 00 00 00 00 00 00 10 00 00 00 00 00 00 00  °°°°°°°°·°°°°°°°
0200: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  °°°°°°°°°°°°°°°°
0210: 01 00 00 00 00 00 00 00 00 00 00 00 04 00 F1 FF  ·°°°°°°°°°°°·°¤¤
0220: 0B 00 00 00 90 34 40 00 00 00 00 00 03 00 07 00  ·°°°¤4@°°°°°·°·°
0230: 10 00 00 00 60 34 40 00 00 00 00 00 03 00 06 00  ·°°°`4@°°°°°·°·°
0240: 16 00 00 00 50 24 40 00 00 00 00 00 03 00 05 00  ·°°°P$@°°°°°·°·°
0250: 1E 00 00 00 20 03 40 00 00 00 00 00 03 00 02 00  ·°°°¯·@°°°°°·°·°
0260: 26 00 00 00 00 02 40 00 00 00 00 00 03 00 01 00  &°°°°·@°°°°°·°·°
0270: 2E 00 00 00 E0 13 40 00 00 00 00 00 03 00 04 00  .°°°¤·@°°°°°·°·°
0280: 34 00 00 00 52 24 40 00 0B 00 00 00 01 00 05 00  4°°°R$@°·°°°·°·°
0290: 43 00 00 00 50 24 40 00 02 00 00 00 01 00 05 00  C°°°P$@°·°°°·°·°
02A0: 4E 00 00 00 52 24 40 00 00 00 00 00 00 00 05 00  N°°°R$@°°°°°°°·°
02B0: 53 00 00 00 50 24 40 00 00 00 00 00 00 00 05 00  S°°°P$@°°°°°°°·°
02C0: 58 00 00 00 90 34 40 00 07 00 00 00 01 00 07 00  X°°°¤4@°·°°°·°·°
02D0: 63 00 00 00 60 34 40 00 24 00 00 00 01 00 06 00  c°°°`4@°$°°°·°·°
02E0: 67 00 00 00 FD 13 40 00 17 00 00 00 12 00 04 00  g°°°¤·@°·°°°·°·°
02F0: 70 00 00 00 14 14 40 00 21 00 00 00 12 00 04 00  p°°°··@°!°°°·°·°
0300: 79 00 00 00 35 14 40 00 01 00 00 00 12 00 04 00  y°°°5·@°·°°°·°·°
0310: 7F 00 00 00 E0 13 40 00 1D 00 00 00 12 00 04 00  ¤°°°¤·@°·°°°·°·°
0320: 00 74 39 38 30 30 2E 68 74 6D 00 2E 62 73 73 00  °t9800.htm°.bss°
0330: 2E 64 61 74 61 00 2E 72 6F 64 61 74 61 00 2E 73  .data°.rodata°.s
0340: 74 72 74 61 62 00 2E 73 79 6D 74 61 62 00 2E 74  trtab°.symtab°.t
0350: 65 78 74 00 3D 42 22 42 65 65 70 69 6E 67 2E 2E  ext°=B"Beeping..
0360: 2E 22 00 3D 57 28 30 78 30 30 30 37 29 00 40 4C  ."°=W(0x0007)°@L
0370: 54 31 00 40 4C 54 32 00 45 78 69 74 2E 4C 33 32  T1°@LT2°Exit.L32
0380: 2E 4D 00 4D 73 67 00 42 65 65 70 2E 4C 33 32 00  .M°Msg°Beep.L32°
0390: 45 78 69 74 2E 4C 33 32 00 53 74 61 72 74 00 57  Exit.L32°Start°W
03A0: 72 69 74 65 2E 4C 33 32 00 00 2E 73 79 6D 74 61  rite.L32°°.symta
03B0: 62 00 2E 73 74 72 74 61 62 00 2E 73 68 73 74 72  b°.strtab°.shstr
03C0: 74 61 62 00 2E 74 65 78 74 00 2E 72 6F 64 61 74  tab°.text°.rodat
03D0: 61 00 2E 64 61 74 61 00 2E 62 73 73 00 00 00 00  a°.data°.bss°°°°
03E0: 31 C9 31 C0 89 F7 F7 D1 F2 AE F7 D1 B8 04 00 00  1¤1¤¤¤¤¤¤¤¤¤¤·°°
03F0: 00 BB 01 00 00 00 89 CA 89 F1 CD 80 C3 8D 35 52  °¤·°°°¤¤¤¤¤¤¤¤5R
0400: 24 40 00 E8 D8 FF FF FF 8D 35 50 24 40 00 E8 CD  $@°¤¤¤¤¤¤5P$@°¤¤
0410: FF FF FF C3 8D 35 90 34 40 00 C7 06 45 6E 64 00  ¤¤¤¤¤5¤4@°¤·End°
0420: C7 46 03 0A 00 00 00 E8 B4 FF FF FF 31 DB B8 01  ¤F·¬°°°¤¤¤¤¤1¤¤·
0430: 00 00 00 CD 80 90 BE 60 34 40 00 E8 A0 FF FF FF  °°°¤¤¤¤`4@°¤¤¤¤¤
0440: E8 B8 FF FF FF E8 CA FF FF FF 00 00 00 00 00 00  ¤¤¤¤¤¤¤¤¤¤°°°°°°
0450: 07 00 42 65 65 70 69 6E 67 2E 2E 2E 00 00 00 00  ·°Beeping...°°°°
0460: 33 32 62 69 74 20 46 4C 41 54 20 45 4C 46 58 20  32bit¯FLAT¯ELFX¯
0470: 70 72 6F 67 72 61 6D 20 22 74 39 38 30 30 2E 78  program¯"t9800.x
0480: 22 2E 0A 00                                      ".¬°

▲Back to the top▲