Author |
Message |
AndyEsser
Joined: Mon Oct 26, 2009 2:33 pm Posts: 38 Location: United Kingdom
|
[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,
_________________ Andy Esser neogenix Broadcast
Last edited by AndyEsser on Sat Nov 14, 2009 3:08 pm, edited 1 time in total.
|
Wed Nov 04, 2009 3:09 pm |
|
|
Kieran
Site Admin
Joined: Sat Jul 25, 2009 7:44 am Posts: 274 Location: United Kingdom
|
Re: Setting es:bp
I always remember using MOV SI, String
_________________ Thank you for reading,
Kieran C G Foot
|
Thu Nov 05, 2009 4:20 am |
|
|
AndyEsser
Joined: Mon Oct 26, 2009 2:33 pm Posts: 38 Location: United Kingdom
|
Re: Setting es:bp
Nope, no joy.
I think I'm missing something obvious.
Cheers,
_________________ Andy Esser neogenix Broadcast
|
Thu Nov 05, 2009 1:51 pm |
|
|
smeezekitty
|
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.
|
Sat Nov 07, 2009 2:46 am |
|
|
AndyEsser
Joined: Mon Oct 26, 2009 2:33 pm Posts: 38 Location: United Kingdom
|
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
_________________ Andy Esser neogenix Broadcast
|
Sat Nov 07, 2009 3:05 pm |
|
|
smeezekitty
|
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
|
Sat Nov 07, 2009 7:40 pm |
|
|
AndyEsser
Joined: Mon Oct 26, 2009 2:33 pm Posts: 38 Location: United Kingdom
|
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?
_________________ Andy Esser neogenix Broadcast
|
Sun Nov 08, 2009 6:21 am |
|
|
Love4Boobies
Joined: Sat Jul 25, 2009 11:26 am Posts: 81
|
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
|
Mon Nov 09, 2009 1:17 am |
|
|
AndyEsser
Joined: Mon Oct 26, 2009 2:33 pm Posts: 38 Location: United Kingdom
|
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?
_________________ Andy Esser neogenix Broadcast
|
Mon Nov 09, 2009 11:13 am |
|
|
AndyEsser
Joined: Mon Oct 26, 2009 2:33 pm Posts: 38 Location: United Kingdom
|
Re: Setting es:bp
In case anyone was wandering, I've still not solved this problem.
Open to any suggestions.
Cheers,
_________________ Andy Esser neogenix Broadcast
|
Sat Nov 14, 2009 12:19 pm |
|
|
Who is online |
Users browsing this forum: No registered users and 2 guests |
|
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 post attachments in this forum
|
|