I have written the "Hello World!" code with simplified segment directives,
.MODEL small
.STACK
.DATA
msg DB 'Hello, World!', 0Dh, 0Ah, '$'
.CODE
.STARTUP
LEA DX, msg
MOV ah, 9
INT 21h
MOV ah, 4Ch
INT 21h
END
but I must have written something wrong (or miss something) when writing the same thing with standard directive. The code prints a bunch of symbols and only at the end the sentence "Hello World!". What am I missing?
myData SEGMENT
msg DB 'Hello, World!', 0Dh, 0Ah, '$'
myData ENDS
myCode SEGMENT
ASSUME DS:myData, CS:myCode, SS:myStack
LEA DX, msg
MOV ah, 9
INT 21h
MOV ah, 4Ch
INT 21h
myCode ENDS
myStack SEGMENT
myStack ENDS
END
My TASM tells "No entry point", and the garbage chars might indicate missing initialization of data segment, so let's fix both:
The "END" directive at the bottom of the code also indicates the point where the program starts to be executed. The initialization of data segment is required in TASM, EMU8086, GUI Turbo Assembler and others where "ASSUME" is not enough.