Writing directly to video mem after starting pmode

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
tom1000000

Writing directly to video mem after starting pmode

Post 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 $
tom1000000

Re:Writing directly to video mem after starting pmode

Post 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.
Whatever5k

Re:Writing directly to video mem after starting pmode

Post by Whatever5k »

bochsout.txt has it
tom1000000

Re:Writing directly to video mem after starting pmode

Post by tom1000000 »

Thanks
Post Reply