Bona Fide OS Development http://forums.osdever.net/ |
|
[SOLVED] Setting es:bp http://forums.osdever.net/viewtopic.php?f=5&t=69 |
Page 1 of 2 |
Author: | AndyEsser [ Wed Nov 04, 2009 3:09 pm ] |
Post subject: | [SOLVED] Setting es:bp |
Hi guys, I'm going back and changing some of my previous boot code and things to make them better. Now back when I started I would output status messages to the screen like this: Loading 2nd Stage Bootloader [ Ok ] Now to do this I was manually loading each character into memory and calling Int 0x10 / AH = 0x09. This worked fine but was horrendously rubbish. What I want to do is use Int 0x10 / AH = 0x13, having loaded a pointer to a string into ES:BP. This is what I have so far: mov cx, #21 mov bh, #0x0 mov bl, #0x1f mov bp, #mymsg mov ah, #0x13 mov al, #%00000001 int 0x10. The message part mymsg: .byte 13,10 .ascii "Welcome To PandoraOS" Now this works....sort of. It displays in the correct colour etc, but it displays the wrong characters, it's obviously pointing to some random place in memory. I'm using as86 and can't find a good example. I'm being stupid, please correct me. Cheers, |
Author: | Kieran [ Thu Nov 05, 2009 4:20 am ] |
Post subject: | Re: Setting es:bp |
I always remember using MOV SI, String |
Author: | AndyEsser [ Thu Nov 05, 2009 1:51 pm ] |
Post subject: | Re: Setting es:bp |
Nope, no joy. I think I'm missing something obvious. Cheers, |
Author: | smeezekitty [ Sat Nov 07, 2009 2:46 am ] |
Post subject: | Re: Setting es:bp |
you did not load ES fixed: Code: mov ax,cs ;here is where you went wrong mov es,ax mov cx, #21 mov bh, #0x0 mov bl, #0x1f mov bp, #mymsg mov ah, #0x13 mov al, #%00000001 int 0x10. |
Author: | AndyEsser [ Sat Nov 07, 2009 3:05 pm ] |
Post subject: | Re: Setting es:bp |
Sadly I'm still no closer. I've tried with snippets of other people's code for printing strings etc and still nothing. I'll post my entire assembly program and see whether someone can show me what i'm doing wrong. I'm assembling with as86 boot.asm -o bootloader.o ld86 -d bootloader.o -o bootloader Code: entry start start: mov ah, #0x02 xor bh, bh int 0x10 mov ax, cs mov es, ax mov cx, #21 mov bx, #0x001f mov ax, #0x1301 mov bp, #mymsg int 0x10 mymsg: .ascii "Welcome to PandoraOS" .byte 0 |
Author: | smeezekitty [ Sat Nov 07, 2009 7:40 pm ] |
Post subject: | Re: Setting es:bp |
what if you replace Code: .ascii "Welcome to PandoraOS" .byte 0 with Code: db 'Welcome to PandoraOS' db 0 i just dont trust the assembler |
Author: | AndyEsser [ Sun Nov 08, 2009 6:21 am ] |
Post subject: | Re: Setting es:bp |
I get an error "Junk after operands" and it's pointing to the W after the '. It doesn't happen on the db 0 line though. Should I use a different assembler? NASM or something? |
Author: | Love4Boobies [ Mon Nov 09, 2009 1:17 am ] |
Post subject: | Re: Setting es:bp |
The deal is that both ES and DS must be zeroed out (xor ax, ax / mov es, eax / mov ds, eax <-- alternatively, use "ax" instead of "eax" if you're generating code for 16-bit machines and can't get a size override prefix). Another common problem is that people know better how programs like notepad work rather than how the video card does. You need to point to the string itself "13h 10h" is not by any means a new line sequence. If you want a new line you need to get the current cursor position, clear the column, increment the row and set the cursor again. Cheers, Bogdan |
Author: | AndyEsser [ Mon Nov 09, 2009 11:13 am ] |
Post subject: | Re: Setting es:bp |
Hi mate, Thanks for the suggestions. I've done that, but still no joy. Just random characters displayed. Grr. This is getting frustrating now. I was a little dubious about the 13, 10 and I've now replaced it with a 0 so that the string is 'null-terminated' for later use. Any other suggestions? |
Author: | AndyEsser [ Sat Nov 14, 2009 12:19 pm ] |
Post subject: | Re: Setting es:bp |
In case anyone was wandering, I've still not solved this problem. Open to any suggestions. Cheers, |
Page 1 of 2 | All times are UTC - 6 hours [ DST ] |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |