Page 1 of 1

Bootloader qx 3

Posted: Sun Sep 08, 2002 6:44 pm
by Ozguxxx
The code below is a part of bootloader that I am trying to write. Here, code has turned into pmode. Now it should write Hello to upper left corner of screen but it does not. I could not find out why. Ant ideas are welcome. Thanx in advance for any advices...
NOTE: In case you might want to know, I started with org 0x0000 and A20 is (at leaset should be) enabled at this place of code.


...
   mov cr0,eax   
   jmp SYS_CODE_SEL:do_pm + 0x7c00
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;   32-bit protected mode
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
[BITS 32]
do_pm:   mov ax,SYS_DATA_SEL
   mov ds,ax      ; not segments anymore: SELECTORS
   mov ss,ax
   nop
   mov es,ax
   mov fs,ax
   mov ax,LINEAR_SEL
   mov gs,ax
; write to text video memory starting at linear address 0xB8000
; (upper left corner of screen)

   mov byte [gs:0xB8000],'H'
   mov byte [gs:0xB8002],'e'
   mov byte [gs:0xB8004],'l'
   mov byte [gs:0xB8006],'l'
   mov byte [gs:0xB8008],'o'

Re:Bootloader qx 3

Posted: Sun Sep 08, 2002 6:56 pm
by PlayOS
Ozguxxx wrote:[BITS 32]
do_pm: mov ax,SYS_DATA_SEL
mov ds,ax ; not segments anymore: SELECTORS
mov ss,ax
nop
mov es,ax
mov fs,ax
mov ax,LINEAR_SEL
mov gs,ax
Two things, why is there a 'nop' in there, not sure if it is a problem but I have never needed it. And secondly, what does your LINEAR_SEL have as it's base address? If you want to be able to do this:

mov byte [LINEAR_SEL:0xb8000], 'A'

the the LINEAR_SEL must have a base of 0

Re:Bootloader qx 3

Posted: Sun Sep 08, 2002 7:01 pm
by PlayOS
Also, I would recommend that you change your ORG to 0x7c00 and load DS with 0 then you will not need to add 0x7c00 to your offset's. Just a thought :)