No Keyboard after Switch from VESA to CGA on real PC
Posted: Sat Oct 25, 2008 3:00 pm
Hello everyone,
I developed a VESA-driver for our os-project in our university.
My last problem with it is that when I switch from VESA back to CGA and try to type on our console, I can't. Well that only goes for the real PC (which has got an Athlon-CPU, but I had the same problem on a PIII-machine). When testing it in BOCHS I can type anything I want after being back in CGA.
One of the guesses was that interrupts might not be served after the switch anymore, but that is at least not true for the watch/timer which is still sending interrupts and shows that it is doing so.
I also thought that I messed up something while calling the VESA-Functions by INT 0x10 but we also have a VGA-driver which goes back to CGA-Mode with the same routine as the VESA-driver (by calling the appropriate BIOS-function through INT 0x10). After coming back from VGA the keyboard works fine.
Maybe it is something with my code that enables VESA (this all happens in real mode, otherwise the OS is in protected mode):
any ideas? I appreciate any hints or ideas you might have!
Best,
joegy
I developed a VESA-driver for our os-project in our university.
My last problem with it is that when I switch from VESA back to CGA and try to type on our console, I can't. Well that only goes for the real PC (which has got an Athlon-CPU, but I had the same problem on a PIII-machine). When testing it in BOCHS I can type anything I want after being back in CGA.
One of the guesses was that interrupts might not be served after the switch anymore, but that is at least not true for the watch/timer which is still sending interrupts and shows that it is doing so.
I also thought that I messed up something while calling the VESA-Functions by INT 0x10 but we also have a VGA-driver which goes back to CGA-Mode with the same routine as the VESA-driver (by calling the appropriate BIOS-function through INT 0x10). After coming back from VGA the keyboard works fine.
Maybe it is something with my code that enables VESA (this all happens in real mode, otherwise the OS is in protected mode):
Code: Select all
enablevesa:
mov ax,0x700 ;put VBE-struct to 0x7000
mov es,ax
mov di,0x0
mov eax,'VBE2' ;tell VESA-BIOS that we want VBE 2 rather than VBE 1
mov [es:di],eax
mov ax,0x4F00 ;Function to get VBE Controller Information
int 0x10
cmp al,0x4F ;is Function supported?
jne continue_cga
cmp ah,0x00 ;successful?
jne continue_cga
mov ax,0x800 ;position for VBE Mode Information struct
mov es,ax
mov ax,0x4F01 ;function call for VBE Mode Information
mov cx,[0x8200] ;getting VBE Mode number (I put it there in my C++ code)
mov di,0x0
int 0x10
cmp al,0x4F
jne continue_cga
cmp ah,0x00
jne continue_cga
;Set desired modes
mov ax,0x4F02 ;loading VBE mode-setting-function
mov bx,[0x8200] ;getting VBE Mode number
or bx,0x4000 ;enable linear Buffering
int 0x10 ;go for it
jmp activate_pm
Best,
joegy