Sep 26, 2004 #1 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.
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.
Sep 26, 2004 #2 qbasicking Programmer Aug 19, 2001 628 US 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. Upvote 0 Downvote
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.
Sep 26, 2004 Thread starter #3 xlav Technical User Oct 23, 2003 223 JM Both examples give error 'undefined sybol: msg' when code is assembled. -x Upvote 0 Downvote
Sep 26, 2004 Thread starter #4 xlav Technical User Oct 23, 2003 223 JM With MOV ax,[message] and LEA ax,message code assembles. When link get error-> 'fatal error LNK1190: invalid fixup found, type 0x0001'. -x Upvote 0 Downvote
With MOV ax,[message] and LEA ax,message code assembles. When link get error-> 'fatal error LNK1190: invalid fixup found, type 0x0001'. -x
Sep 26, 2004 #5 mseth Programmer Aug 2, 2003 154 US Did you "initialize" your data segment? Upvote 0 Downvote
Sep 27, 2004 Thread starter #6 xlav Technical User Oct 23, 2003 223 JM The preceding code is, .model small .stack .data message db "Hello world","$" .code _main proc LEA ax, msg mov ds, ax Upvote 0 Downvote
The preceding code is, .model small .stack .data message db "Hello world","$" .code _main proc LEA ax, msg mov ds, ax
Sep 28, 2004 #7 mseth Programmer Aug 2, 2003 154 US 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. Upvote 0 Downvote
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.
Sep 28, 2004 Thread starter #8 xlav Technical User Oct 23, 2003 223 JM Replaced msg with message, code assembles. When link get error; test2.obj : fatal error LNK1190: invalid fixup found, type 0x0001 Upvote 0 Downvote
Replaced msg with message, code assembles. When link get error; test2.obj : fatal error LNK1190: invalid fixup found, type 0x0001
Sep 30, 2004 #9 mseth Programmer Aug 2, 2003 154 US You need to "initialize" the data segment, something like this: http://employees.oneonta.edu/higgindm/asm1a.html Code: mov ax,data mov ds,ax mov dx,OFFSET message Upvote 0 Downvote
You need to "initialize" the data segment, something like this: http://employees.oneonta.edu/higgindm/asm1a.html Code: mov ax,data mov ds,ax mov dx,OFFSET message
Oct 3, 2004 Thread starter #10 xlav Technical User Oct 23, 2003 223 JM 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 Upvote 0 Downvote
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