.model tiny
.code
org 100h
start:
call Display_Hi
mov ah,4c00h
int 21h
Display_Hi PROC
mov dx,OFFSET HI
mov ah,9
int 21h
ret
Display_Hi ENDP
HI DB "Hello World$"
end start
I definitely can't compile it.
Hi,
Try doing this
.model tiny
.stack
assume cs:_TEXT, ds:_TEXT, ss:_TEXT
_TEXT SEGMENT
org 100h
start:
call Display_Hi
mov ah,4c00h
int 21h
Display_Hi PROC
mov dx,OFFSET HI
mov ah,9
int 21h
ret
Display_Hi ENDP
_TEXT ends
end start
I haven't tested it but that should work
Thomas Antony
Assuming you are usings MASM, it should be returning an error message that identifies the problem:
Assembling: test.asm
test.asm(6) : error A2070: invalid instruction operands
The instruction on line 6 is:
mov ah,4c00h
Which is trying to move a 16-bit constant into an 8-bit register.
Thanks, I didn't noted about that mistake I did and thanks Thomas too; I will learn it by both ways.
Hi Thomas,
Your code displays me an error.
.asm(8) : error A2070: invalid instruction operands
.asm(12) : error A2006: undefined symbol : HI
My sample code
actually I use ax instead of ah, and it worked.
Sorry,
Yeas you should use ax and you should also define the string HI right after Display_Hi ENDP like this
Display_Hi ENDP
HI DB "Hello World$"
Thomas Antony :U
Xor Stance,
Your application is a COM file, you can terminate it also with int 20h
Thanks,
.model tiny
.stack
assume cs:_TEXT, ds:_TEXT, ss:_TEXT
_TEXT SEGMENT
org 100h
start:
call Display_Hi
mov ah,4c00h
int 21h
Display_Hi PROC
mov dx,OFFSET HI
mov ah,9
int 21h
ret
Display_Hi ENDP
HI DB "Hello World$"
_TEXT SEGMENT ends
end start
Still displays me an error.
.asm(8) : error A2070: invalid instruction operands
.asm(18) : error A2008: syntax error : ends
Hi,
Okay, Here is the code from my first 16-bit MASM prog :P . Change it according to what you want!!
.model tiny
.stack
assume cs:_TEXT, ds:_TEXT, ss:_TEXT
_TEXT SEGMENT
org 0h
entry:
mov ax,cs
mov dx,ax
mov dx,OFFSET Hello
mov ah,09h
int 21h
mov ax,4C00h
int 21h
ret
Hello db "Hello World",13,10,"$"
_TEXT ends
end entry
Compile using the ml.exe from MASM32 package using ml /c yourfilename.asm
Link it using the 16-bit linker.
Thomas Antony :U
Thanks Thomas, that works.