Page 1 of 1

Writing directly to video mem after starting pmode

Posted: Sun Feb 23, 2003 4:18 am
by tom1000000
Hello,
I have got to the stage where I can load a file off disk, and jump to it in pmode.

Currently, it only prints the first character. When I tried to make it print 2 characters the program refuses to print the second char.

Is there a reason for this?

Here is my code to setup pmode and write the chars to screen:

; Already setup A20, printed intro msg etc
;------------------
;
; Mask all interrupts, and jump to pmode linear address 00050020h
cli
lgdt [cs:gdtInfo] ; Load GDT
mov   ecx, CR0 ; Switch to protected mode
or   cl, 1
mov   CR0, ecx

mov   ax, kernelData-gdtTable ; Selector for 4Gb data seg
mov   ds, ax ; Extend limit for ds
mov   es, ax ; etc....
mov   fs, ax
mov    gs, ax

jmp dword (kernelCode-gdtTable):00050020h
; Real Mode RIP

;************************************
; Second file, loaded at linear address 50000h

BITS 32
ORG 00050000h

times 32 db 0 ; Reserve first 32 bytes

; On entry EIP = 00050020h

; Print a ! - this works fine
; VIDEO_MEMORY = (char *)0xB8000;
; position (23,78)
mov ebx, 0B8EFCh ; = (0B8000h + (23*80+78)*2)
mov eax, '~' + (0E1h<<8) ; Second byte is color byte
mov [ebx], ax ; Only 16 bits

; Try and poke another char at (22,77) NOT APPEARING?
mov ebx, 0B8E5Ah ; = (0B8000h + (22*80+77)*2)
mov eax, '<' + (0E1h<<8) ; Second byte is color byte
mov [ebx], ax ; Only 16 bits


; Die
jmp $

Re:Writing directly to video mem after starting pmode

Posted: Sun Feb 23, 2003 4:50 am
by tom1000000
OOOPS!

Sorry. Stupid me was using the wrong filename with the nasm command. So it never got updated.

Problem fixed.

Another stupid question:


How do you get bochs to printout the full CPU state (all the registers etc) when the OS crashes?

At the moment BOCHS just exits back to the dos prompt for me.

Re:Writing directly to video mem after starting pmode

Posted: Sun Feb 23, 2003 6:56 am
by Whatever5k
bochsout.txt has it

Re:Writing directly to video mem after starting pmode

Posted: Mon Feb 24, 2003 11:16 pm
by tom1000000
Thanks