EuroAssembler Index Manual Download Source Macros


Sitemap Links Forum Tests Projects

Test t9850: ELFX program for 64bit Linux


Source & expected listing t9850.htm.lst
| | EUROASM AUTOSEGMENT=ON,CPU=x64,DUMPWIDTH=28 |7439383530 |%test %SET t9850 |00000000: | | |%test PROGRAM FORMAT=ELFX,MODEL=FLAT,WIDTH=64,ENTRY=Start: |[.text] ::::Section changed. |00000000: |Write.L64:: PROC ; Display ASCIIZ string pointed to by RSI using 64bit Linux. |00000000:31C9 | XOR ECX,ECX ; Clear RCX to keep the size of input string. |00000002:31C0 | XOR EAX,EAX ; Clear AL, the searched terminating character |00000004:4889F7 | MOV RDI,RSI ; %2 String address in RSI,RDI. |00000007:48F7D1 | NOT RCX ; Assume unlimited possible string size. |0000000A:F2AE | REPNE SCASB ; Find the zero terminator. |0000000C:48F7D1 | NOT RCX ; Get string size to RCX. |0000000F:B801000000 | MOV RAX,1 ; Kernel service sys_write. |00000014:BF01000000 | MOV RDI,1 ; %1 I/O handle STDOUT_FILENO. |00000019:89CA | MOV EDX,ECX ; %3 String size. |0000001B:0F05 | SYSCALL ; Invoke kernel. |0000001D:C3 | RET ; Return to caller. RAX,RCX,RDX,RSI,RDI,R11 are clobbered. |0000001E: | ENDPROC Write.L64: | |;; |0000001E: |Beep.L64:: PROC ; Display message "Beeping.." and play a sound using 64bit Linux. |0000001E:488D35(00000000) | LEA RSI,[=B"Beeping..."] ; Define a literal string in [.rodata]. |00000025:E8D6FFFFFF | CALL Write.L64:: ; Display the notification "Beeping...". |0000002A:488D35(00000000) | LEA RSI,[=W(0x0007)] ; Define ASCIIZ string with BEL character in [.rodata]. |00000031:E8CAFFFFFF | CALL Write.L64:: ; Play the beep sound. |00000036:C3 | RET ; Return to caller. RAX,RCX,RDX,RSI,RDI,R11 are clobbered. |00000037: | ENDPROC Beep.L64: | |;; |00000037: |Exit.L64:: PROC ; Display message "End", terminate the program. |00000037:488D35(00000000) | LEA RSI,[.M:] ; String "End" will be defined in segment [.bss] at RSI. |0000003E:C706456E6400 | MOVD [RSI+0],"End" ; Dynamically define the message "End". |00000044:C746030A000000 | MOVD [RSI+3],0x0A ; LF+NUL. |0000004B:E8B0FFFFFF | CALL Write.L64:: ; Display the notification "End". |00000050:31FF | XOR EDI,EDI ; %1 Errorlevel=0. |00000052:B83C000000 | MOV RAX,60 ; Kernel service sys_exit. |00000057:0F05 | SYSCALL ; 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. |00000059: | ENDPROC Exit.L64: | |;; |00000059:90 |Start: NOP ; Entry point of the program. |0000005A:488D35(00000000) | LEA RSI,[Msg:] ; Offset of the message. |00000061:E89AFFFFFF | CALL Write.L64: ; Write the ASCIIZ string RSI. |00000066:E8B3FFFFFF | CALL Beep.L64: ; Play a beep sound. |0000006B:E8C7FFFFFF | CALL Exit.L64: ; Terminate the program with errorlevel 0. |[.data] ::::Section changed. |00000000:363462697420464C~|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 "t9850.x",model=FLAT,groups=4,segments=8,entry=Start:,stack= | [LOAD.HDR],FA=00000000h,VA=00400000h,size=0000058Dh=1421,group [.symtab] [.strtab] [.shstrtab] | [],FA=00000000h,VA=00000000h,size=00000000h=0,width=0,align=0,purpose= | [.symtab],FA=00000320h,VA=00400320h,size=000001B0h=432,width=0,align=8,purpose=SYMBOLS | [.strtab],FA=000004D0h,VA=004004D0h,size=00000089h=137,width=0,align=1,purpose=STRINGS | [.shstrtab],FA=00000559h,VA=00400559h,size=00000034h=52,width=0,align=1,purpose=STRINGS | [LOAD.CODE],FA=00000590h,VA=00401590h,size=00000070h=112,group [.text] | [.text],FA=00000590h,VA=00401590h,size=00000070h=112,width=64,align=0010h,purpose=CODE | [LOAD.RODATA],FA=00000600h,VA=00402600h,size=0000000Dh=13,group [.rodata] | [.rodata],FA=00000600h,VA=00402600h,size=0000000Dh=13,width=64,align=0010h,purpose=RODATA+LITERAL | [LOAD.DATA],FA=00000610h,VA=00403610h,size=00000037h=55,group [.data] [.bss] | [.data],FA=00000610h,VA=00403610h,size=00000024h=36,width=64,align=0010h,purpose=DATA | [.bss],FA=00000640h,VA=00403640h,size=00000007h=7,width=64,align=0010h,purpose=BSS | **** ListGlobals "t9850.x",Global=0,Public=4,Extern=0,eXport=0,Import=0 | Beep.L64,[.text]:0000001Eh,VA=004015AEh,scope='P' | Exit.L64,[.text]:00000037h,VA=004015C7h,scope='P' | Start,[.text]:00000059h,VA=004015E9h,scope='P' | Write.L64,[.text]:00000000h,VA=00401590h,scope='P'
Expected messages t9850.out
I0180 Assembling source file "t9850.htm". I0270 Assembling source "t9850". I0310 Assembling source pass 1. I0330 Assembling source pass 2 - final. I0470 Assembling program "t9850". "t9850.htm"{44} I0510 Assembling program pass 1. "t9850.htm"{44} I0510 Assembling program pass 2. "t9850.htm"{44} I0530 Assembling program pass 3 - final. "t9850.htm"{44} I0660 64bit FLAT ELFX file "t9850.x" created, size=1588. "t9850.htm"{92} I0650 Program "t9850" assembled in 3 passes with errorlevel 0. "t9850.htm"{92} I0750 Source "t9850" (233 lines) assembled in 2 passes with errorlevel 0. I0860 Listing file "t9850.htm.lst" created, size=5556. I0990 EuroAssembler terminated with errorlevel 0.
Expected output file t9850. x
0000: 7F 45 4C 46 02 01 01 00 00 00 00 00 00 00 00 00  ¤ELF···°°°°°°°°°
0010: 02 00 3E 00 01 00 00 00 E9 15 40 00 00 00 00 00  ·°>°·°°°¤·@°°°°°
0020: 40 00 00 00 00 00 00 00 20 01 00 00 00 00 00 00  @°°°°°°°¯·°°°°°°
0030: 00 00 00 00 40 00 38 00 04 00 40 00 08 00 03 00  °°°°@°8°·°@°·°·°
0040: 01 00 00 00 04 00 00 00 00 00 00 00 00 00 00 00  ·°°°·°°°°°°°°°°°
0050: 00 00 40 00 00 00 00 00 00 00 40 00 00 00 00 00  °°@°°°°°°°@°°°°°
0060: 8D 05 00 00 00 00 00 00 8D 05 00 00 00 00 00 00  ¤·°°°°°°¤·°°°°°°
0070: 00 10 00 00 00 00 00 00 01 00 00 00 05 00 00 00  °·°°°°°°·°°°·°°°
0080: 90 05 00 00 00 00 00 00 90 15 40 00 00 00 00 00  ¤·°°°°°°¤·@°°°°°
0090: 90 15 40 00 00 00 00 00 70 00 00 00 00 00 00 00  ¤·@°°°°°p°°°°°°°
00A0: 70 00 00 00 00 00 00 00 00 10 00 00 00 00 00 00  p°°°°°°°°·°°°°°°
00B0: 01 00 00 00 04 00 00 00 00 06 00 00 00 00 00 00  ·°°°·°°°°·°°°°°°
00C0: 00 26 40 00 00 00 00 00 00 26 40 00 00 00 00 00  °&@°°°°°°&@°°°°°
00D0: 0D 00 00 00 00 00 00 00 0D 00 00 00 00 00 00 00  ·°°°°°°°·°°°°°°°
00E0: 00 10 00 00 00 00 00 00 01 00 00 00 06 00 00 00  °·°°°°°°·°°°·°°°
00F0: 10 06 00 00 00 00 00 00 10 36 40 00 00 00 00 00  ··°°°°°°·6@°°°°°
0100: 10 36 40 00 00 00 00 00 37 00 00 00 00 00 00 00  ·6@°°°°°7°°°°°°°
0110: 37 00 00 00 00 00 00 00 00 10 00 00 00 00 00 00  7°°°°°°°°·°°°°°°
0120: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  °°°°°°°°°°°°°°°°
0130: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  °°°°°°°°°°°°°°°°
0140: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  °°°°°°°°°°°°°°°°
0150: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  °°°°°°°°°°°°°°°°
0160: 01 00 00 00 02 00 00 00 00 00 00 00 00 00 00 00  ·°°°·°°°°°°°°°°°
0170: 20 03 40 00 00 00 00 00 20 03 00 00 00 00 00 00  ¯·@°°°°°¯·°°°°°°
0180: B0 01 00 00 00 00 00 00 02 00 00 00 0E 00 00 00  ¤·°°°°°°·°°°·°°°
0190: 08 00 00 00 00 00 00 00 18 00 00 00 00 00 00 00  ·°°°°°°°·°°°°°°°
01A0: 09 00 00 00 03 00 00 00 00 00 00 00 00 00 00 00  ·°°°·°°°°°°°°°°°
01B0: D0 04 40 00 00 00 00 00 D0 04 00 00 00 00 00 00  ¤·@°°°°°¤·°°°°°°
01C0: 89 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ¤°°°°°°°°°°°°°°°
01D0: 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ·°°°°°°°°°°°°°°°
01E0: 11 00 00 00 03 00 00 00 00 00 00 00 00 00 00 00  ·°°°·°°°°°°°°°°°
01F0: 59 05 40 00 00 00 00 00 59 05 00 00 00 00 00 00  Y·@°°°°°Y·°°°°°°
0200: 34 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  4°°°°°°°°°°°°°°°
0210: 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ·°°°°°°°°°°°°°°°
0220: 1B 00 00 00 01 00 00 00 06 00 00 00 00 00 00 00  ·°°°·°°°·°°°°°°°
0230: 90 15 40 00 00 00 00 00 90 05 00 00 00 00 00 00  ¤·@°°°°°¤·°°°°°°
0240: 70 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  p°°°°°°°°°°°°°°°
0250: 10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ·°°°°°°°°°°°°°°°
0260: 21 00 00 00 01 00 00 00 02 00 00 00 00 00 00 00  !°°°·°°°·°°°°°°°
0270: 00 26 40 00 00 00 00 00 00 06 00 00 00 00 00 00  °&@°°°°°°·°°°°°°
0280: 0D 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ·°°°°°°°°°°°°°°°
0290: 10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ·°°°°°°°°°°°°°°°
02A0: 29 00 00 00 01 00 00 00 03 00 00 00 00 00 00 00  )°°°·°°°·°°°°°°°
02B0: 10 36 40 00 00 00 00 00 10 06 00 00 00 00 00 00  ·6@°°°°°··°°°°°°
02C0: 24 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  $°°°°°°°°°°°°°°°
02D0: 10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ·°°°°°°°°°°°°°°°
02E0: 2F 00 00 00 08 00 00 00 03 00 00 00 00 00 00 00  /°°°·°°°·°°°°°°°
02F0: 40 36 40 00 00 00 00 00 40 06 00 00 00 00 00 00  @6@°°°°°@·°°°°°°
0300: 07 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ·°°°°°°°°°°°°°°°
0310: 10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ·°°°°°°°°°°°°°°°
0320: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  °°°°°°°°°°°°°°°°
0330: 00 00 00 00 00 00 00 00 01 00 00 00 04 00 F1 FF  °°°°°°°°·°°°·°¤¤
0340: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  °°°°°°°°°°°°°°°°
0350: 0B 00 00 00 03 00 07 00 40 36 40 00 00 00 00 00  ·°°°·°·°@6@°°°°°
0360: 00 00 00 00 00 00 00 00 10 00 00 00 03 00 06 00  °°°°°°°°·°°°·°·°
0370: 10 36 40 00 00 00 00 00 00 00 00 00 00 00 00 00  ·6@°°°°°°°°°°°°°
0380: 16 00 00 00 03 00 05 00 00 26 40 00 00 00 00 00  ·°°°·°·°°&@°°°°°
0390: 00 00 00 00 00 00 00 00 1E 00 00 00 03 00 02 00  °°°°°°°°·°°°·°·°
03A0: D0 04 40 00 00 00 00 00 00 00 00 00 00 00 00 00  ¤·@°°°°°°°°°°°°°
03B0: 26 00 00 00 03 00 01 00 20 03 40 00 00 00 00 00  &°°°·°·°¯·@°°°°°
03C0: 00 00 00 00 00 00 00 00 2E 00 00 00 03 00 04 00  °°°°°°°°.°°°·°·°
03D0: 90 15 40 00 00 00 00 00 00 00 00 00 00 00 00 00  ¤·@°°°°°°°°°°°°°
03E0: 34 00 00 00 01 00 05 00 02 26 40 00 00 00 00 00  4°°°·°·°·&@°°°°°
03F0: 0B 00 00 00 00 00 00 00 43 00 00 00 01 00 05 00  ·°°°°°°°C°°°·°·°
0400: 00 26 40 00 00 00 00 00 02 00 00 00 00 00 00 00  °&@°°°°°·°°°°°°°
0410: 4E 00 00 00 00 00 05 00 02 26 40 00 00 00 00 00  N°°°°°·°·&@°°°°°
0420: 00 00 00 00 00 00 00 00 53 00 00 00 00 00 05 00  °°°°°°°°S°°°°°·°
0430: 00 26 40 00 00 00 00 00 00 00 00 00 00 00 00 00  °&@°°°°°°°°°°°°°
0440: 58 00 00 00 01 00 07 00 40 36 40 00 00 00 00 00  X°°°·°·°@6@°°°°°
0450: 07 00 00 00 00 00 00 00 63 00 00 00 01 00 06 00  ·°°°°°°°c°°°·°·°
0460: 10 36 40 00 00 00 00 00 24 00 00 00 00 00 00 00  ·6@°°°°°$°°°°°°°
0470: 67 00 00 00 12 00 04 00 AE 15 40 00 00 00 00 00  g°°°·°·°¤·@°°°°°
0480: 19 00 00 00 00 00 00 00 70 00 00 00 12 00 04 00  ·°°°°°°°p°°°·°·°
0490: C7 15 40 00 00 00 00 00 22 00 00 00 00 00 00 00  ¤·@°°°°°"°°°°°°°
04A0: 79 00 00 00 12 00 04 00 E9 15 40 00 00 00 00 00  y°°°·°·°¤·@°°°°°
04B0: 01 00 00 00 00 00 00 00 7F 00 00 00 12 00 04 00  ·°°°°°°°¤°°°·°·°
04C0: 90 15 40 00 00 00 00 00 1E 00 00 00 00 00 00 00  ¤·@°°°°°·°°°°°°°
04D0: 00 74 39 38 35 30 2E 68 74 6D 00 2E 62 73 73 00  °t9850.htm°.bss°
04E0: 2E 64 61 74 61 00 2E 72 6F 64 61 74 61 00 2E 73  .data°.rodata°.s
04F0: 74 72 74 61 62 00 2E 73 79 6D 74 61 62 00 2E 74  trtab°.symtab°.t
0500: 65 78 74 00 3D 42 22 42 65 65 70 69 6E 67 2E 2E  ext°=B"Beeping..
0510: 2E 22 00 3D 57 28 30 78 30 30 30 37 29 00 40 4C  ."°=W(0x0007)°@L
0520: 54 31 00 40 4C 54 32 00 45 78 69 74 2E 4C 36 34  T1°@LT2°Exit.L64
0530: 2E 4D 00 4D 73 67 00 42 65 65 70 2E 4C 36 34 00  .M°Msg°Beep.L64°
0540: 45 78 69 74 2E 4C 36 34 00 53 74 61 72 74 00 57  Exit.L64°Start°W
0550: 72 69 74 65 2E 4C 36 34 00 00 2E 73 79 6D 74 61  rite.L64°°.symta
0560: 62 00 2E 73 74 72 74 61 62 00 2E 73 68 73 74 72  b°.strtab°.shstr
0570: 74 61 62 00 2E 74 65 78 74 00 2E 72 6F 64 61 74  tab°.text°.rodat
0580: 61 00 2E 64 61 74 61 00 2E 62 73 73 00 00 00 00  a°.data°.bss°°°°
0590: 31 C9 31 C0 48 89 F7 48 F7 D1 F2 AE 48 F7 D1 B8  1¤1¤H¤¤H¤¤¤¤H¤¤¤
05A0: 01 00 00 00 BF 01 00 00 00 89 CA 0F 05 C3 48 8D  ·°°°¤·°°°¤¤··¤H¤
05B0: 35 4D 10 00 00 E8 D6 FF FF FF 48 8D 35 3F 10 00  5M·°°¤¤¤¤¤H¤5?·°
05C0: 00 E8 CA FF FF FF C3 48 8D 35 72 20 00 00 C7 06  °¤¤¤¤¤¤H¤5r¯°°¤·
05D0: 45 6E 64 00 C7 46 03 0A 00 00 00 E8 B0 FF FF FF  End°¤F·¬°°°¤¤¤¤¤
05E0: 31 FF B8 3C 00 00 00 0F 05 90 48 8D 35 1F 20 00  1¤¤<°°°··¤H¤5·¯°
05F0: 00 E8 9A FF FF FF E8 B3 FF FF FF E8 C7 FF FF FF  °¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
0600: 07 00 42 65 65 70 69 6E 67 2E 2E 2E 00 00 00 00  ·°Beeping...°°°°
0610: 36 34 62 69 74 20 46 4C 41 54 20 45 4C 46 58 20  64bit¯FLAT¯ELFX¯
0620: 70 72 6F 67 72 61 6D 20 22 74 39 38 35 30 2E 78  program¯"t9850.x
0630: 22 2E 0A 00                                      ".¬°

▲Back to the top▲