mirror of
https://git.stationery.faith/corn/corn.git
synced 2024-11-21 18:32:20 +00:00
check for bochs
This commit is contained in:
parent
7e62c50138
commit
019de3cb22
1 changed files with 10 additions and 6 deletions
|
@ -2,6 +2,7 @@
|
|||
#include <memory.h>
|
||||
#include <serial.h>
|
||||
#include <stdint.h>
|
||||
#include <panic.h>
|
||||
|
||||
#include "bindings.h"
|
||||
|
||||
|
@ -34,11 +35,11 @@ static uint16_t read(uint16_t value) {
|
|||
return inw(DATA);
|
||||
}
|
||||
|
||||
int is_available(void) {
|
||||
return (read(INDEX_ID) >= 0xB0C4);
|
||||
static int is_available(void) {
|
||||
return (read(INDEX_ID) == 0xB0C5);
|
||||
}
|
||||
|
||||
void set_mode(uint16_t width, uint16_t height, uint16_t bit_depth, int lfb, int clear) {
|
||||
static void set_mode(uint16_t width, uint16_t height, uint16_t bit_depth, int lfb, int clear) {
|
||||
write(INDEX_ENABLE, DATA_DISP_DISABLE);
|
||||
write(INDEX_XRES, width);
|
||||
write(INDEX_YRES, height);
|
||||
|
@ -48,13 +49,16 @@ void set_mode(uint16_t width, uint16_t height, uint16_t bit_depth, int lfb, int
|
|||
(clear ? 0 : DATA_NO_CLEAR_MEM));
|
||||
}
|
||||
|
||||
void set_bank(uint16_t bank) {
|
||||
write(INDEX_BANK, bank);
|
||||
}
|
||||
//static void set_bank(uint16_t bank) {
|
||||
// write(INDEX_BANK, bank);
|
||||
//}
|
||||
|
||||
int fb_init(uint16_t width, uint16_t height) {
|
||||
|
||||
set_mode(width, height, 32, true, true);
|
||||
|
||||
if (!is_available())
|
||||
panic("bochs framebuffer not avaliable");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue