flat assembler
Message board for the users of flat assembler.

Index > OS Construction > help with bootloader addressing

Author
Thread Post new topic Reply to topic
sirin



Joined: 13 Nov 2005
Posts: 2
sirin
hello, im sorry for making question about the same basic things. anyway, i've done a simple bootloader who loads the 2nd sector from the floppy(int 0x13), puts it at some address and jumps to it. Now, the problem im having is that if i choose to place the code and jmp to it at for example at 500h:000h and the src of that code look something like this for example:

Code:
org 0x500
section .text
mov ax,0x500
mov dx,ax
[bla bla]
 
foo db 'yo!',0
    


if i want to print foo to the screen using lodsb in a loop the only way i can do is moving foo-$$ to si .
is this the right way to do it?. I mean, it works but if the ds is diferent from 0000 (which is something a lot of examples takes advantage of, i know) is there a better way to do it?
sorry if its way to dumb to ask, but as i said all the examples jump to 0x000:xxxxx so the address of that string is pretty obvious. With my example foo will have the value 5xx and lodsb will try to get 500:5xx which is wrong since i want 500:0xx.

thanks!
Post 13 Nov 2005, 02:48
View user's profile Send private message Reply with quote
FlashBurn



Joined: 06 Jan 2005
Posts: 87
FlashBurn
You have to use "org 0" or don´t use it. For you print function, post the code, but a loop with "lodsb" is ok!
Post 13 Nov 2005, 13:57
View user's profile Send private message Reply with quote
sirin



Joined: 13 Nov 2005
Posts: 2
sirin
FlashBurn wrote:
You have to use "org 0" or don´t use it. For you print function, post the code, but a loop with "lodsb" is ok!


thanks! org 0 and mov dx,0x500 makes it work without the $$ `trick'.
Post 13 Nov 2005, 18:29
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.