I have no problems writing text in PM, but it would be nice if the bootloader could write something.. The bootloader displays something, but just a buncha whack characters, not the ones I want and have written in the bootmesg (see code).. Im using this code:
[BITS 16]
[ORG 0x7C00]
jmp start
print_mesg :
mov ah,0x13
mov al,0x00
mov bx,0x0007
mov cx,0x20
mov dx,0x0000
int 0x10
ret
start:
mov bp,bootmesg
call print_mesg
...
bootmesg db "OS boot sector loading ......"
times 510-($-$$....
Displaying text
Re:Displaying text
start your code like this
start at "0x0000:0x7C00" or "0x07C0:0x0000"
different bioses start at the same physical but
possibly different logical addresses. after start, make
sure that the CS = 0x0000 and IP = 0x7C00 by a
far jump to start. after that make DS = 0x0000 or
you are NOT going to access "bootmesg" but something
else.
your problem is that you assume ( incorrectly ) that
ds is initialized to 0x0000, however, it may not be.
you should do it yourself.
remember there is no guarantee that the bios willjmp 0x0000:Start
Start:
cli
mov ax,cs ; Load CS DS ES SS
mov ds,ax
mov es,ax
mov ss,ax
mov sp,0xFFF8 ; Load IP SI DI SP BP
xor bp,bp
sti
start at "0x0000:0x7C00" or "0x07C0:0x0000"
different bioses start at the same physical but
possibly different logical addresses. after start, make
sure that the CS = 0x0000 and IP = 0x7C00 by a
far jump to start. after that make DS = 0x0000 or
you are NOT going to access "bootmesg" but something
else.
your problem is that you assume ( incorrectly ) that
ds is initialized to 0x0000, however, it may not be.
you should do it yourself.
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Displaying text
i'm confused by the fact you're talking about "displaying text in PM" and then use INT 10h to do so ...
Are you in real or protected mode atm ?
Are you in real or protected mode atm ?
Re:Displaying text
Gordon wrote: I have no problems writing text in PM, but it would be nice if the bootloader could write something.. The bootloader displays something, but just a buncha whack characters, not the ones I want and have written in the bootmesg (see code).. Im using this code:
[BITS 16]
[ORG 0x7C00]
jmp start
print_mesg :
mov ah,0x13
mov al,0x00
mov bx,0x0007
mov cx,0x20
mov dx,0x0000
int 0x10
ret??????
start:
mov bp,bootmesg
call print_mesg
...
bootmesg db "OS boot sector loading ......"
times???510-($-$$....
Code: Select all
[BITS 16]
[ORG 0x7C00]
jmp start
print_mesg :
mov ah,0x13
mov al,0x00
mov bx,0x0007
mov cx,0x20
xor dx,dx
int 0x10
ret
start:
xor ax,ax
mov es,ax
mov ds,ax
mov bp,bootmesg
call print_mesg
...
bootmesg db "OS boot sector loading ......"
times 510-($-$$....
Code: Select all
[BITS 16]
[ORG 0x7C00]
jmp start
write:
cld
write_loop:
lodsb
or al,al
jz write_end
mov ah,0eh
mov bx,0700h
int 10h
jmp write_loop
write_end:
ret
start:
xor ax,ax
mov es,ax
mov ds,ax
mov si,bootmesg
call write
...
bootmesg db "OS boot sector loading ......"
I think it's real mode, since in his code a string is stating: "OS boot sector loading ......"i'm confused by the fact you're talking about "displaying text in PM" and then use INT 10h to do so ...
Are you in real or protected mode atm ?