I'm writing two assembly files for DOS:
hm2.asm:
.8086
DGROUP group _DATA, STACK ; Required by MASM 3.0 and 4.0.
; MASM 4.0 doesn't support USE16 (but MASM >=5.0 does).
_TEXT segment word public 'CODE'
assume cs:_TEXT, ds:DGROUP, ss:STACK
main proc
mov ax, DGROUP ; Initialize DS.
mov ds, ax
mov ah, 9 ; DOS Function call to print a message.
mov dx, offset message
int 21h
mov ax, 4c00h ; DOS Function call to exit back to DOS.
int 21h
main endp
_TEXT ends
_DATA segment word public 'DATA'
message db "Hello, World!", 0dh, 0ah, '$'
_DATA ends
STACK segment para stack 'STACK'
db 100h dup (?)
STACK ends
end main
hm3.asm:
.8086
.model small
.stack 100h
.data
message db "Hello, World!", 0dh, 0ah, '$'
.code
main proc
mov ax, @data ; Initialize DS.
mov ds, ax
mov ah, 9 ; DOS Function call to print a message.
mov dx, offset message
int 21h
mov ax, 4c00h ; DOS Function call to exit back to DOS.
int 21h
main endp
end main
I want these to be identical when compiled by Microsoft Macro Assembler 5.00 masm.exe and then linked to an .EXE file with the corresponding link.exe . However, hm2.exe is about 256 == 100h bytes longer than hm3.exe, because it contains zero-bytes for the STACK. How do I get rid of these zero-bytes without using .model and .stack, thus being compatible with Microsoft Macro Assembler 4.00 and earlier?