I'm trying to get my OS to display what drive it is booting from at startup. In my boot routine I have this:
; display what drive we're booting from
MOV SI,booton
CALL putstr
MOV SI,[bsBootDrv]
CALL putstr
booton is: booton DB 'BOOTING ON: ',0
[bsBootDrv] is defined at the start like this: bsBootDrv DB 0
putstr is my routine for printing SI to screen.
When I boot my os it gives me this:
BOOTING ON: n(upside-down U)BOOT:
(then it sits there reading the floppy)
it should look like this:
BOOTING ON: 0
BOOT: GOOD
(procedes to load kernel)
It worked before I put in this "booting on:" bit in. Does anyone know how I could fix this?
displaying boot drive?
RE:displaying boot drive?
I think you have this horribly confused, your code as it is at present will correctly display the string 'BOOTING ON: ' as it does, but it then tries to display the string pointed to by the value in bsBootDrv which a) is not what you want and b) is not fully defined as you have only specified a byte, the actual pointer used will depend on the byte following also but you have not defined that here, either way you will get the wrong thing, what you want to do of course is display the value not the sring pointed to
RE:displaying boot drive?
haha....ever have one of those days? Remember, this brilliant little mistake came after four hours of driver programing. Very sorry.
Has anyone else tried to do this kind of thing? Any tips? Thanks.
Has anyone else tried to do this kind of thing? Any tips? Thanks.
RE:displaying boot drive?
It's not difficult... you've probably already got the code in place.
Your putstr method, no doubt, loops one character at a time, continually outputting until it hits a null.
All you need to do is isolate this character code, copy it, and call it putchar
Then, of course, you want to add '0' to bootDrv so that it is actually transformed into the ascii equivalent.. 0 becomes '0' and 1 becomes '1', and call putchar.
The problem comes, of course, if you want to take care of HDs, as well... which are referenced as 128 and 129... putchar obviously wont work for this, and you'll have to write as putint method, I suppose (which is basically a bunch of sucessive divides by multiples of 10).
Cheers,
Jeff
Your putstr method, no doubt, loops one character at a time, continually outputting until it hits a null.
All you need to do is isolate this character code, copy it, and call it putchar
Then, of course, you want to add '0' to bootDrv so that it is actually transformed into the ascii equivalent.. 0 becomes '0' and 1 becomes '1', and call putchar.
The problem comes, of course, if you want to take care of HDs, as well... which are referenced as 128 and 129... putchar obviously wont work for this, and you'll have to write as putint method, I suppose (which is basically a bunch of sucessive divides by multiples of 10).
Cheers,
Jeff