Bluefox815
September 30th, 2008, 08:41 PM
(Note: You may skip to the line that says "EDIT:" because my first problem has been resolved)
I'm having troubles getting the segment of a variable in NASM because in binary format you are not allowed to use the seg keyword.
example:
mov ax, seg var
won't work.
I know I could use the keyword in an object file, but I don't know what to link the object file with. Besides, I'd rather know how to do it in binary form.
Answers to either question would be appreciated.
(What to link with (resolved); How to address segments(resolved))
(These two questions I figured out, but I have one more below)
EDIT:
I attempted outputting character by character a string (my purpose forusing seg), using my own code and someone else's code (which I know to work) and I got the same result for both, being the following string that's supposed to be "Hello"
"═ *ا" (that last character is a 'f' with a 'g' like tail at the bottom)
So my next question is why do I get random characters?
Here is my code:
hello db "Hello", 00h
mov bx, 00h
loop:
mov cx, hello
mov al, [hello+bx]
cmp bx, 05h
jge exit_prog
mov ah, 0eh
push bx
mov bx, 0000h
int 10h
pop bx
inc bx
jmp loop
exit_prog:
int 20h
I'm having troubles getting the segment of a variable in NASM because in binary format you are not allowed to use the seg keyword.
example:
mov ax, seg var
won't work.
I know I could use the keyword in an object file, but I don't know what to link the object file with. Besides, I'd rather know how to do it in binary form.
Answers to either question would be appreciated.
(What to link with (resolved); How to address segments(resolved))
(These two questions I figured out, but I have one more below)
EDIT:
I attempted outputting character by character a string (my purpose forusing seg), using my own code and someone else's code (which I know to work) and I got the same result for both, being the following string that's supposed to be "Hello"
"═ *ا" (that last character is a 'f' with a 'g' like tail at the bottom)
So my next question is why do I get random characters?
Here is my code:
hello db "Hello", 00h
mov bx, 00h
loop:
mov cx, hello
mov al, [hello+bx]
cmp bx, 05h
jge exit_prog
mov ah, 0eh
push bx
mov bx, 0000h
int 10h
pop bx
inc bx
jmp loop
exit_prog:
int 20h