Bootloader qx 3
Posted: Sun Sep 08, 2002 6:44 pm
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'
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'