Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

moving a string to ax register

Status
Not open for further replies.

xlav

Technical User
Oct 23, 2003
223
JM
In main proc how do mov a string into the ax register? The string was defined as, message db "hello world","&" in the data segment.
 
It's been a while since I've used assembly but:

LEA ax, msg

ax is a 16 bit register, you can't place a string in it, just the memory address of the string. I believe that
MOV ax, [msg]
will work also.
 
Both examples give error 'undefined sybol: msg' when code is assembled.

-x
 
With MOV ax,[message] and LEA ax,message code assembles. When link get error-> 'fatal error LNK1190: invalid fixup found, type 0x0001'.

-x
 
The preceding code is,

.model small
.stack
.data
message db "Hello world","$"

.code

_main proc
LEA ax, msg
mov ds, ax

 
Well one thing is you have it declared as message and yet you are trying to do "LEA ax, msg" it doesn't know what's going on.
 
Replaced msg with message, code assembles. When link get error;

test2.obj : fatal error LNK1190: invalid fixup found, type 0x0001
 
Get error 'undefined symbol :data'.

CODE,

.model small
.stack
.data

message db "Assembly", "$"

.code

_main proc

mov ax,data
mov ds,ax
mov dx,OFFSET message
mov ah,09
lea dx,message
int 21h

mov ax,4c00h
int 21h
_main endp
end _main
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top