Posted by fabs on 13:43:00 05-14-2001
I wanted to try writing to video-memory directly instead of using an interrupt. Here's what I coded:
ORG 0x100
main:
mov es, [video_seg] ;Video-mem-address in es
xor di,di ;Make sure di is 0
lea si, MyString ;Load the offset of string into si
mov cx,12 ;Put the length of the string in counter-var
mov ah, 07h ; This sets black on white
cld ;Clear Direction Flag (Direction --->)
print_loop:
lodsb ;Load a byte from DS:SI into AL
stosw ;Take value from AL and save it at ES:DI
loop print_loop
RET
MyString db "Hello World!"
video_seg dw 0B800h
I get an error: Line 8: invalid combination of opcode and operands
Any help is appreciated
fabs
Posted by robost86 on 15:21:00 05-14-2001
lea si,MyStr
could be either:
mov si,MyStr
or
lea si,[MyStr]
the second operans passed to lea should be an address, not a constant value.
Posted by fabs on 23:42:00 05-14-2001
oh, thx
I thought if I pass something to lea, it automatically knows I'm talking about the address but on second thought, if I had an address stored in a variable, I could wanna pass that...
Ok, so to make my proggy work, it has to be
lea dx, [MyString]
fabs
Posted by robost86 on 15:31:00 05-15-2001
I would recommend "mov dx,MyStr", that is smaller.
Posted by fabs on 07:13:00 05-16-2001
ok, I did that anyway
fabs