News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

procedure help!

Started by Xor Stance, January 16, 2005, 05:39:23 AM

Previous topic - Next topic

Xor Stance

.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.

thomasantony

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
There are 10 types of people in the world. Those who understand binary and those who don't.


Programmer's Directory. Submit for free

MichaelW

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.
eschew obfuscation

Xor Stance

Thanks, I didn't noted about that mistake I did and thanks Thomas too; I will learn it by both ways.

Xor Stance

#4
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.

thomasantony

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
There are 10 types of people in the world. Those who understand binary and those who don't.


Programmer's Directory. Submit for free

Vortex

Xor Stance,

Your application is a COM file, you can terminate it also with int 20h

Xor Stance

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

thomasantony

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
There are 10 types of people in the world. Those who understand binary and those who don't.


Programmer's Directory. Submit for free

Xor Stance

Thanks Thomas, that works.