EuroAssembler Index Manual Download Source Macros


Sitemap Links Forum Tests Projects

Test t8300: MZ program for 16bit DOS


Source & expected listing t8300.htm.lst
| | EUROASM AUTOSEGMENT=ON,CPU=086,DUMPWIDTH=24 | |t8300 PROGRAM FORMAT=MZ,WIDTH=16,MODEL=SMALL,ENTRY=Start | |;; |[CODE] ::::Section changed. |0000: |Write.D16:: PROC ; Display ASCIIZ string pointed to by DS:SI using DOS. |0000:B402 | MOV AH,02h ; DOS service Write character form DL to standard output. |0002:FC | CLD ; Direction forward. |0003:AC |.1:LODSB ; Load a character from string to AL, increment SI. |0004:3C00 | CMP AL,0 ; Test if zero-terminator reached. |0006:7406 | JE .9: ; Exit the procedure if AL=0. |0008:88C2 | MOV DL,AL |000A:CD21 | INT 21h ; Otherwise display the character AL and advance screen cursor. |000C:EBF5 | JMP .1: ; Repeat with following characters. |000E:C3 |.9:RET ; AX,DL,SI are clobbered. |000F: | ENDP Write.D16:: | |;; |000F: |Beep.D16:: PROC ; Display message "Beeping.." and play a sound using DOS. |000F:BE[0000] | MOV SI,=B"Beeping..." ; Define a literal string in [RODATA]. |0012:E8EBFF | CALL Write.D16:: ; Display the notification "Beeping...". |0015:BE[0000] | MOV SI,=W(0x0007) ; Define ASCIIZ string with BEL character in [RODATA]. |0018:E8E5FF | CALL Write.D16:: ; Play the beep sound. |001B:C3 | RET ; AX,DL,SI are clobbered. |001C: | ENDP Beep.D16:: | |;; |001C: |Exit.D16:: PROC ; Display message "End", terminate the program and return to DOS. |001C:BE[0000] | MOV SI,.M: ; String "End" will be defined in segment [BSS] at DS:SI. |001F:C704456E | MOVW [SI+0],"En" ; Dynamically initialize the notification string. |0023:C744026420 | MOVW [SI+2],"d " ; Assume DS=PARA# [BSS]. |0028:C744040D0A | MOVW [SI+4],0x0A0D ; CR+LF. |002D:C6440600 | MOVB [SI+6],0 ; Zero-terminate the string. |0031:E8CCFF | CALL Write.D16:: ; Display the notification "End". |0034:B44C | MOV AH,4Ch ; DOS service Terminate program. |0036:CD21 | INT 21h |[BSS] ::::Section changed. |0000:.............. |.M:DB 7*BYTE ; Reserve space for ASCIIZ string "End" in [BSS] segment. |[CODE] ::::Section changed. |0038: | ENDP Exit.D16:: | |;; |0038:90 |Start:NOP ; Entry point of the executable program. |0039:BE[0000] | MOV SI,Msg |003C:B8{0000} | MOV AX,PARA# Msg |003F:8ED8 | MOV DS,AX ; Let DS address segments [DATA],[RODATA],[BSS]. |0041:E8BCFF | CALL Write.D16:: |0044:E8C8FF | CALL Beep.D16:: |0047:E8D2FF | CALL Exit.D16:: |[DATA] ::::Section changed. |0000:313662697420534D~|Msg:DB '%^WIDTH[]bit %^MODEL %^FORMAT program "%^OUTFILE".',13,10,0 |[@LT2] ====ListLiterals in section [@LT2]. |0000:0700 =W(0x0007) |[@LT1] ====ListLiterals in section [@LT1]. |0000:42656570696E672E~=B"Beeping..." | | ENDPROGRAM t8300 | **** ListMap "t8300.exe",model=SMALL,groups=3,segments=5,entry=Start,stack=[SGROUP]:00002000h | [CGROUP],FA=00000060h,RVA=00000000h,size=0000004Ah=74,group [CODE] | [CODE],FA=00000060h,RVA=00000000h,size=0000004Ah=74,width=16,align=0010h,purpose=CODE | [DGROUP],FA=000000B0h,RVA=00000050h,size=00000047h=71,group [RODATA] [DATA] [BSS] | [RODATA],FA=000000B0h,RVA=00000050h,size=0000000Dh=13,width=16,align=0010h,purpose=RODATA+LITERAL | [DATA],FA=000000C0h,RVA=00000060h,size=00000026h=38,width=16,align=0010h,purpose=DATA | [BSS],FA=000000F0h,RVA=00000090h,size=00000007h=7,width=16,align=0010h,purpose=BSS | [SGROUP],FA=000000F0h,RVA=000000A0h,size=00002000h=8192,group [STACK] | [STACK],FA=000000F0h,RVA=000000A0h,size=00002000h=8192,width=16,align=0010h,purpose=STACK | **** ListGlobals "t8300.exe",Global=0,Public=4,Extern=0,eXport=0,Import=0 | Beep.D16,[CGROUP]:0000000Fh,RVA=0000000Fh,scope='P' | Exit.D16,[CGROUP]:0000001Ch,RVA=0000001Ch,scope='P' | Start,[CGROUP]:00000038h,RVA=00000038h,scope='P' | Write.D16,[CGROUP]:00000000h,RVA=00000000h,scope='P'
Expected messages t8300.out
I0180 Assembling source file "t8300.htm". I0270 Assembling source "t8300". I0310 Assembling source pass 1. I0330 Assembling source pass 2 - final. I0470 Assembling program "t8300". "t8300.htm"{42} I0510 Assembling program pass 1. "t8300.htm"{42} I0510 Assembling program pass 2. "t8300.htm"{42} I0530 Assembling program pass 3 - final. "t8300.htm"{42} I0660 16bit SMALL MZ file "t8300.exe" created, size=230. "t8300.htm"{92} I0650 Program "t8300" assembled in 3 passes with errorlevel 0. "t8300.htm"{92} I0750 Source "t8300" (144 lines) assembled in 2 passes with errorlevel 0. I0860 Listing file "t8300.htm.lst" created, size=4760. I0990 EuroAssembler terminated with errorlevel 0.
Expected output file t8300. exe
0000: 4D 5A E6 00 01 00 01 00 06 00 02 02 FF FF 0A 00  MZ¤°·°·°·°··¤¤¬°
0010: 00 20 04 82 38 00 00 00 40 00 00 00 00 00 00 00  °¯·¤8°°°@°°°°°°°
0020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  °°°°°°°°°°°°°°°°
0030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  °°°°°°°°°°°°°°°°
0040: 3D 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: B4 02 FC AC 3C 00 74 06 88 C2 CD 21 EB F5 C3 BE  ¤·¤¤<°t·¤¤¤!¤¤¤¤
0070: 02 00 E8 EB FF BE 00 00 E8 E5 FF C3 BE 40 00 C7  ·°¤¤¤¤°°¤¤¤¤¤@°¤
0080: 04 45 6E C7 44 02 64 20 C7 44 04 0D 0A C6 44 06  ·En¤D·d¯¤D··¬¤D·
0090: 00 E8 CC FF B4 4C CD 21 90 BE 10 00 B8 05 00 8E  °¤¤¤¤L¤!¤¤·°¤·°¤
00A0: D8 E8 BC FF E8 C8 FF E8 D2 FF 00 00 00 00 00 00  ¤¤¤¤¤¤¤¤¤¤°°°°°°
00B0: 07 00 42 65 65 70 69 6E 67 2E 2E 2E 00 00 00 00  ·°Beeping...°°°°
00C0: 31 36 62 69 74 20 53 4D 41 4C 4C 20 4D 5A 20 70  16bit¯SMALL¯MZ¯p
00D0: 72 6F 67 72 61 6D 20 22 74 38 33 30 30 2E 65 78  rogram¯"t8300.ex
00E0: 65 22 2E 0D 0A 00                                e".·¬°

▲Back to the top▲