EuroAssembler Index Manual Download Source Macros


Sitemap Links Forum Tests Projects

Test t2520: Sections and segments in SMALL memory model


Description
Sample program with multiple sections.
Tested procedures
PseudopcDISPLAY   SssOrderSections   SssLinkSections  
Source & expected listing t2520.htm.lst
| | EUROASM LIST=ON,DUMP=ON,DUMPWIDTH=24 | |t2520 PROGRAM FORMAT=BIN,MODEL=SMALL,WIDTH=16,LISTGLOBALS=OFF,LISTLITERALS=ON,LISTMAP=ON | |;; SMALL memory model creates default OWORD-aligned segments | |;; [CODE] addressed by group [CGROUP] assumed in CS, and segments | |;; [RODATA], [DATA], [BSS] addressed by group [DGROUP] assumed in DS. |[CODE] |[CODE] SEGMENT PURPOSE=CODE,ALIGN=4 ; Redeclare code segment [CODE] together with its section [CODE]. It'll be linked at FA=0000h. |0000:B8{0000} | MOV AX,PARA# DGROUP |0003:8ED8 | MOV DS,AX |[PROCEDURES] |[PROCEDURES] ; Declare code section [PROCEDURES] in segment [CODE] linked at FA=0010h. |[DATA] |[DATA] SEGMENT PURPOSE=DATA+LITERALS ; Declare data segment [DATA] together with its section [DATA] linked at FA=0030h (OWORD aligned). |0000:11112222 | SomeData DW 0x1111,0x2222 ; Emit two WORDs to the section [DATA]. |[PROCEDURES] |[PROCEDURES] ; Switch to already declared code section [PROCEDURES]. FA=0014h (DWORD aligned). |0000: |SomeProc PROC ; Emit some code to the section [PROCEDURES]. FA=0014h. |0000:8B16[0000] | MOV DX,[SomeData] |0004:E9(0000) | JMP =I "RET" ; Using the code literal silently creates section [@RT0] in segment [CODE], linked at FA=0028h. |0007: | ENDP SomeProc |[TABLES] |[TABLES] ; Declare a new code section in the current segment, which is [CODE], |0000: | ; because the previous section [PROCEDURES] belongs to the segment [CODE]. FA=0024h (DWORD aligned). |0000:[0000][0700] | SomeTable DW SomeProc, OtherProc ; Emit some data to the section [TABLES] at FA=0020h. |[UNUSED] |[UNUSED] ; This code section is intentionally not used, so it will be omitted in linking. |[PROCEDURES] |[PROCEDURES] ; Switch to already declared code section [PROCEDURES]. |0007: |OtherProc PROC ; Emit some more code to the section [PROCEDURES] at FA=001Bh. |0007:A1[0400] | MOV AX,[OtherData] |000A:BB[0000] | MOV BX,SomeTable |000D:C3 | RET |000E: | ENDP OtherProc |[CODE] |[CODE] ; Switch to the code section [CODE]. FA=0005h. |0005:BA[0000] | MOV DX,SomeText |0008:B409 | MOV AH,9 |000A:CD21 | INT 21h |000C:BA[0000] | MOV DX,=B"End.$" ; Using literal data silently creates section [@LT1] in segment [DATA], linked at FA=0036h. |000F:CD21 | INT 21h |0011:C3 | RET |[DATA] |[DATA] ; Switch to the data section [DATA]. FA=0034h. |0004:3333 |OtherData DW 0x3333 |[STRINGS] |[STRINGS] ; Declare new data section [STRINGS] in segment [DATA], linked at FA=0040h (OWORD aligned). |0000:44656D6F2E0D0A24 |SomeText DB "Demo.",13,10,'$' | | %DISPLAY Segments ; Display group, segments and sections at assembly time. |# D1250 **** %DISPLAY Groups, Segments, Sections |# D1260 [CGROUP],group [CODE],src="t2520.htm"{58} |# D1270 [CODE],purpose=CODE,width=16,align=4,combine=PUBLIC,class="",src="t2520.htm"{62} |# D1280 [CODE],address=00000000h,size=00000012h=18,align=4,ref=Y,src="t2520.htm"{62} |# D1280 [PROCEDURES],address=00000000h,size=0000000Eh=14,align=4,ref=N,src="t2520.htm"{65} |# D1280 [@RT0],address=00000000h,size=00000001h=1,align=1,ref=Y,src="t2520.htm"{71} |# D1280 [TABLES],address=00000000h,size=00000004h=4,align=4,ref=Y,src="t2520.htm"{73} |# D1280 [UNUSED],address=00000000h,size=00000000h=0,align=4,ref=N,src="t2520.htm"{76} |# D1260 [DGROUP],group [DATA],src="t2520.htm"{58} |# D1270 [DATA],purpose=DATA+LITERAL,width=16,align=16,combine=PUBLIC,class="",src="t2520.htm"{66} |# D1280 [DATA],address=00000000h,size=00000006h=6,align=16,ref=Y,src="t2520.htm"{66} |# D1280 [@LT1],address=00000000h,size=00000006h=6,align=1,ref=Y,src="t2520.htm"{87} |# D1280 [STRINGS],address=00000000h,size=00000008h=8,align=16,ref=Y,src="t2520.htm"{92} |# D1790 **** End of %DISPLAY |[@LT1] ====ListLiterals in section [@LT1]. |0000:456E642E2400 =B"End.$" |[@RT0] ====ListLiterals in section [@RT0]. |0000:C3 =I "RET" | | ENDPROGRAM t2520 ; Terminate the program. | **** ListMap "t2520.bin",model=SMALL,groups=2,segments=2,entry=,stack= | [CGROUP],FA=00000000h,VA=00000000h,size=00000029h=41,group [CODE] | [CODE],FA=00000000h,VA=00000000h,size=00000029h=41,width=16,align=4,purpose=CODE+LITERAL | [DGROUP],FA=00000030h,VA=00000030h,size=00000018h=24,group [DATA] | [DATA],FA=00000030h,VA=00000030h,size=00000018h=24,width=16,align=0010h,purpose=DATA+RODATA+LITERAL
Expected messages t2520.out
I0180 Assembling source file "t2520.htm". I0270 Assembling source "t2520". I0310 Assembling source pass 1. D1250 **** %DISPLAY Groups, Segments, Sections "t2520.htm"{94} D1260 [COMGROUP],group [CODE] [RODATA] [DATA] [BSS] [STACK],src= "t2520.htm"{94} D1270 [CODE],purpose=CODE,width=16,align=16,combine=PUBLIC,class="",src= "t2520.htm"{94} D1280 [CODE],address=00000000h,size=00000000h=0,align=16,ref=N,src= "t2520.htm"{94} D1270 [RODATA],purpose=RODATA,width=16,align=16,combine=PUBLIC,class="",src= "t2520.htm"{94} D1280 [RODATA],address=00000000h,size=00000000h=0,align=16,ref=N,src= "t2520.htm"{94} D1270 [DATA],purpose=DATA,width=16,align=16,combine=PUBLIC,class="",src= "t2520.htm"{94} D1280 [DATA],address=00000000h,size=00000000h=0,align=16,ref=N,src= "t2520.htm"{94} D1270 [BSS],purpose=BSS,width=16,align=16,combine=PUBLIC,class="",src= "t2520.htm"{94} D1280 [BSS],address=00000000h,size=00000000h=0,align=16,ref=N,src= "t2520.htm"{94} D1270 [STACK],purpose=STACK,width=16,align=16,combine=PUBLIC,class="",src= "t2520.htm"{94} D1280 [STACK],address=00000000h,size=00000000h=0,align=16,ref=N,src= "t2520.htm"{94} D1790 **** End of %DISPLAY "t2520.htm"{94} I0330 Assembling source pass 2 - final. I0470 Assembling program "t2520". "t2520.htm"{58} I0510 Assembling program pass 1. "t2520.htm"{58} D1250 **** %DISPLAY Groups, Segments, Sections "t2520.htm"{94} D1260 [CGROUP],group [CODE],src="t2520.htm"{58} "t2520.htm"{94} D1270 [CODE],purpose=CODE+LITERAL,width=16,align=4,combine=PUBLIC,class="",src="t2520.htm"{62} "t2520.htm"{94} D1280 [CODE],address=00000000h,size=00000012h=18,align=4,ref=Y,src="t2520.htm"{62} "t2520.htm"{94} D1280 [PROCEDURES],address=00000000h,size=0000000Eh=14,align=4,ref=N,src="t2520.htm"{65} "t2520.htm"{94} D1280 [@RT0],address=00000000h,size=00000001h=1,align=1,ref=Y,src="t2520.htm"{71} "t2520.htm"{94} D1280 [TABLES],address=00000000h,size=00000004h=4,align=4,ref=Y,src="t2520.htm"{73} "t2520.htm"{94} D1280 [UNUSED],address=00000000h,size=00000000h=0,align=4,ref=N,src="t2520.htm"{76} "t2520.htm"{94} D1260 [DGROUP],group [RODATA] [DATA] [BSS],src="t2520.htm"{58} "t2520.htm"{94} D1270 [RODATA],purpose=RODATA,width=16,align=16,combine=PUBLIC,class="",src="t2520.htm"{58} "t2520.htm"{94} D1280 [RODATA],address=00000000h,size=00000000h=0,align=16,ref=N,src="t2520.htm"{58} "t2520.htm"{94} D1270 [DATA],purpose=DATA+LITERAL,width=16,align=16,combine=PUBLIC,class="",src="t2520.htm"{66} "t2520.htm"{94} D1280 [DATA],address=00000000h,size=00000006h=6,align=16,ref=Y,src="t2520.htm"{66} "t2520.htm"{94} D1280 [@LT1],address=00000000h,size=00000006h=6,align=1,ref=Y,src="t2520.htm"{87} "t2520.htm"{94} D1280 [STRINGS],address=00000000h,size=00000008h=8,align=16,ref=Y,src="t2520.htm"{92} "t2520.htm"{94} D1270 [BSS],purpose=BSS,width=16,align=16,combine=PUBLIC,class="",src="t2520.htm"{58} "t2520.htm"{94} D1280 [BSS],address=00000000h,size=00000000h=0,align=16,ref=N,src="t2520.htm"{58} "t2520.htm"{94} D1260 [SGROUP],group [STACK],src="t2520.htm"{58} "t2520.htm"{94} D1270 [STACK],purpose=STACK,width=16,align=16,combine=PUBLIC,class="",src="t2520.htm"{58} "t2520.htm"{94} D1280 [STACK],address=00000000h,size=00000000h=0,align=16,ref=N,src="t2520.htm"{58} "t2520.htm"{94} D1790 **** End of %DISPLAY "t2520.htm"{94} I0510 Assembling program pass 2. "t2520.htm"{58} D1250 **** %DISPLAY Groups, Segments, Sections "t2520.htm"{94} D1260 [CGROUP],group [CODE],src="t2520.htm"{58} "t2520.htm"{94} D1270 [CODE],purpose=CODE,width=16,align=4,combine=PUBLIC,class="",src="t2520.htm"{62} "t2520.htm"{94} D1280 [CODE],address=00000000h,size=00000012h=18,align=4,ref=Y,src="t2520.htm"{62} "t2520.htm"{94} D1280 [PROCEDURES],address=00000000h,size=0000000Eh=14,align=4,ref=N,src="t2520.htm"{65} "t2520.htm"{94} D1280 [@RT0],address=00000000h,size=00000001h=1,align=1,ref=Y,src="t2520.htm"{71} "t2520.htm"{94} D1280 [TABLES],address=00000000h,size=00000004h=4,align=4,ref=Y,src="t2520.htm"{73} "t2520.htm"{94} D1280 [UNUSED],address=00000000h,size=00000000h=0,align=4,ref=N,src="t2520.htm"{76} "t2520.htm"{94} D1260 [DGROUP],group [RODATA] [DATA] [BSS],src="t2520.htm"{58} "t2520.htm"{94} D1270 [RODATA],purpose=RODATA,width=16,align=16,combine=PUBLIC,class="",src="t2520.htm"{58} "t2520.htm"{94} D1280 [RODATA],address=00000000h,size=00000000h=0,align=16,ref=N,src="t2520.htm"{58} "t2520.htm"{94} D1270 [DATA],purpose=DATA+LITERAL,width=16,align=16,combine=PUBLIC,class="",src="t2520.htm"{66} "t2520.htm"{94} D1280 [DATA],address=00000000h,size=00000006h=6,align=16,ref=Y,src="t2520.htm"{66} "t2520.htm"{94} D1280 [@LT1],address=00000000h,size=00000006h=6,align=1,ref=Y,src="t2520.htm"{87} "t2520.htm"{94} D1280 [STRINGS],address=00000000h,size=00000008h=8,align=16,ref=Y,src="t2520.htm"{92} "t2520.htm"{94} D1270 [BSS],purpose=BSS,width=16,align=16,combine=PUBLIC,class="",src="t2520.htm"{58} "t2520.htm"{94} D1280 [BSS],address=00000000h,size=00000000h=0,align=16,ref=N,src="t2520.htm"{58} "t2520.htm"{94} D1260 [SGROUP],group [STACK],src="t2520.htm"{58} "t2520.htm"{94} D1270 [STACK],purpose=STACK,width=16,align=16,combine=PUBLIC,class="",src="t2520.htm"{58} "t2520.htm"{94} D1280 [STACK],address=00000000h,size=00000000h=0,align=16,ref=N,src="t2520.htm"{58} "t2520.htm"{94} D1790 **** End of %DISPLAY "t2520.htm"{94} I0530 Assembling program pass 3 - final. "t2520.htm"{58} D1250 **** %DISPLAY Groups, Segments, Sections "t2520.htm"{94} D1260 [CGROUP],group [CODE],src="t2520.htm"{58} "t2520.htm"{94} D1270 [CODE],purpose=CODE,width=16,align=4,combine=PUBLIC,class="",src="t2520.htm"{62} "t2520.htm"{94} D1280 [CODE],address=00000000h,size=00000012h=18,align=4,ref=Y,src="t2520.htm"{62} "t2520.htm"{94} D1280 [PROCEDURES],address=00000000h,size=0000000Eh=14,align=4,ref=N,src="t2520.htm"{65} "t2520.htm"{94} D1280 [@RT0],address=00000000h,size=00000001h=1,align=1,ref=Y,src="t2520.htm"{71} "t2520.htm"{94} D1280 [TABLES],address=00000000h,size=00000004h=4,align=4,ref=Y,src="t2520.htm"{73} "t2520.htm"{94} D1280 [UNUSED],address=00000000h,size=00000000h=0,align=4,ref=N,src="t2520.htm"{76} "t2520.htm"{94} D1260 [DGROUP],group [DATA],src="t2520.htm"{58} "t2520.htm"{94} D1270 [DATA],purpose=DATA+LITERAL,width=16,align=16,combine=PUBLIC,class="",src="t2520.htm"{66} "t2520.htm"{94} D1280 [DATA],address=00000000h,size=00000006h=6,align=16,ref=Y,src="t2520.htm"{66} "t2520.htm"{94} D1280 [@LT1],address=00000000h,size=00000006h=6,align=1,ref=Y,src="t2520.htm"{87} "t2520.htm"{94} D1280 [STRINGS],address=00000000h,size=00000008h=8,align=16,ref=Y,src="t2520.htm"{92} "t2520.htm"{94} D1790 **** End of %DISPLAY "t2520.htm"{94} I0660 16bit SMALL BIN file "t2520.bin" created, size=72. "t2520.htm"{113} I0650 Program "t2520" assembled in 3 passes with errorlevel 1. "t2520.htm"{113} I0750 Source "t2520" (215 lines) assembled in 2 passes with errorlevel 1. I0860 Listing file "t2520.htm.lst" created, size=5333. I0990 EuroAssembler terminated with errorlevel 1.
Expected output file t2520. bin
0000: B8 03 00 8E D8 BA 10 00 B4 09 CD 21 BA 06 00 CD  ¤·°¤¤¤·°¤·¤!¤·°¤
0010: 21 C3 90 90 8B 16 00 00 E9 0D 00 A1 04 00 BB 24  !¤¤¤¤·°°¤·°¤·°¤$
0020: 00 C3 90 90 14 00 1B 00 C3 00 00 00 00 00 00 00  °¤¤¤·°·°¤°°°°°°°
0030: 11 11 22 22 33 33 45 6E 64 2E 24 00 00 00 00 00  ··""33End.$°°°°°
0040: 44 65 6D 6F 2E 0D 0A 24                          Demo.·¬$

▲Back to the top▲