[bochs] Some simple display scrolling by 16 pixels
This commit is contained in:
parent
f978a0ebc2
commit
9057eade4e
@ -202,6 +202,8 @@ start_shell() {
|
||||
kprintf("I'm going to make text shorter. This is a silly demo.\n");
|
||||
outportb(0x3D4, 0x9);
|
||||
outportb(0x3D5, 0x0E);
|
||||
} else if (!strcmp(cmd, "scroll")) {
|
||||
bochs_scroll();
|
||||
} else if (!strcmp(cmd, "vid-mode")) {
|
||||
if (tokenid < 2) {
|
||||
kprintf("Please select a graphics driver: bochs\n");
|
||||
|
@ -15,6 +15,7 @@ uint16_t bochs_current_bank = 0;
|
||||
|
||||
#define BOCHS_BANK_SIZE 16384
|
||||
#define BOCHS_VID_MEMORY ((uint32_t *)0xA0000)
|
||||
#define BOCHS_BANKS (1024 * 768 / BOCHS_BANK_SIZE)
|
||||
|
||||
void
|
||||
graphics_install_bochs() {
|
||||
@ -65,6 +66,20 @@ bochs_set_coord(
|
||||
BOCHS_VID_MEMORY[offset] = color;
|
||||
}
|
||||
|
||||
void
|
||||
bochs_scroll() {
|
||||
__asm__ __volatile__ ("cli");
|
||||
uint32_t * bank_store = malloc(sizeof(uint32_t) * BOCHS_BANK_SIZE);
|
||||
for (uint32_t i = 1; i < BOCHS_BANKS; ++i) {
|
||||
bochs_set_bank(i);
|
||||
memcpy(bank_store, BOCHS_VID_MEMORY, sizeof(uint32_t) * BOCHS_BANK_SIZE);
|
||||
bochs_set_bank(i - 1);
|
||||
memcpy(BOCHS_VID_MEMORY, bank_store, sizeof(uint32_t) * BOCHS_BANK_SIZE);
|
||||
}
|
||||
free(bank_store);
|
||||
__asm__ __volatile__ ("sti");
|
||||
}
|
||||
|
||||
void
|
||||
bochs_draw_logo() {
|
||||
fs_node_t * file = kopen("/bs.bmp",0);
|
||||
|
@ -189,5 +189,6 @@ extern void graphics_install_bochs();
|
||||
extern void bochs_set_bank(uint16_t bank);
|
||||
extern void bochs_set_coord(uint16_t x, uint16_t y, uint32_t color);
|
||||
extern void bochs_draw_logo();
|
||||
extern void bochs_scroll();
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user