Move cursor behaves properly and is fully implemented in this patch with no known bugs
This commit is contained in:
parent
86f2db05a0
commit
b3ef53ccab
@ -6,6 +6,7 @@
|
||||
// | 15-8 | 7-4 | 0-3
|
||||
// | Asci | FG | BG
|
||||
#include "framebuffer.h"
|
||||
#include "io.h"
|
||||
|
||||
static char* Frame_Buffer = (char*)FRAME_BUFFER_ADDR;
|
||||
//static char* Frame_Buffer_End = (char*)(FRAME_BUFFER_ADDR + AREA);
|
||||
@ -26,10 +27,20 @@ void clear_fb() {
|
||||
}
|
||||
}
|
||||
|
||||
void fb_move_cursor(unsigned short position) {
|
||||
out_buffer(FB_CMD, FB_HIGH_CMD);
|
||||
out_buffer(FB_DATA, ((position >> 8) & 0x00ff) );
|
||||
out_buffer(FB_CMD, FB_LOW_CMD);
|
||||
out_buffer(FB_DATA, position & 0x00ff);
|
||||
}
|
||||
/* generic test func for this module */
|
||||
void test_fb() {
|
||||
clear_fb();
|
||||
write_cell_fb(FRAME_CELL(0), 'a', Green, White);
|
||||
write_cell_fb(FRAME_CELL(1), 'b', Green, White);
|
||||
write_cell_fb(FRAME_CELL(2), 'c', Green, White);
|
||||
write_cell_fb(FRAME_CELL(3), 'c', Green, White);
|
||||
write_cell_fb(FRAME_CELL(4), 'c', Green, White);
|
||||
write_cell_fb(FRAME_CELL(5), 'c', Green, White);
|
||||
fb_move_cursor(5);
|
||||
}
|
||||
|
@ -1,9 +1,19 @@
|
||||
#include "stl/string.h"
|
||||
#include "io.h"
|
||||
|
||||
#define COLUMNS 80
|
||||
#define ROWS 25
|
||||
#define AREA ( COLUMNS * ROWS )
|
||||
|
||||
// frame buffer port commansd
|
||||
#define FB_CMD 0x3d4
|
||||
#define FB_DATA 0x3d5
|
||||
|
||||
#define FB_HIGH_CMD 14
|
||||
#define FB_LOW_CMD 15
|
||||
|
||||
void fb_move_cursor(unsigned short position);
|
||||
|
||||
// address of our frame buffer
|
||||
#define FRAME_BUFFER_ADDR 0x000B8000
|
||||
|
||||
|
7
io.asm
Normal file
7
io.asm
Normal file
@ -0,0 +1,7 @@
|
||||
global out_buffer
|
||||
|
||||
out_buffer:
|
||||
mov al, [esp+8]
|
||||
mov dx, [esp+4]
|
||||
out dx, al
|
||||
ret
|
6
io.h
Normal file
6
io.h
Normal file
@ -0,0 +1,6 @@
|
||||
#ifndef INCLUDE_IO_H
|
||||
#define INCLUDE_IO_H
|
||||
|
||||
void out_buffer(unsigned short port, unsigned char data);
|
||||
|
||||
#endif
|
16
loader.asm
16
loader.asm
@ -20,22 +20,6 @@ align 4
|
||||
dd CHECKSUM
|
||||
|
||||
loader:
|
||||
mov al, 14
|
||||
mov dx, 0x3d4
|
||||
out dx, al ; 14 tells the framebuffer to expect the highest 8 bits of the position
|
||||
|
||||
mov al, 0
|
||||
mov dx, 0x3d5
|
||||
out dx, al ; sending the highest 8 bits of 0x0050
|
||||
|
||||
mov al, 15
|
||||
mov dx, 0x3d4
|
||||
out dx, al ; 15 tells the framebuffer to expect the lowest 8 bits of the position
|
||||
|
||||
mov al, 0
|
||||
mov dx, 0x3d5
|
||||
out dx, al ; sending the lowest 8 bits of 0x0050
|
||||
|
||||
call test_fb
|
||||
|
||||
.loop:
|
||||
|
Loading…
Reference in New Issue
Block a user