[bochs] Some simple display scrolling by 16 pixels

This commit is contained in:
Kevin Lange 2011-03-26 14:15:24 -05:00
parent f978a0ebc2
commit 9057eade4e
3 changed files with 18 additions and 0 deletions

View File

@ -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");

View File

@ -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);

View File

@ -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