From a3b999593f381a4b0da537d3160014753db4d428 Mon Sep 17 00:00:00 2001 From: iximeow Date: Mon, 28 Sep 2015 21:58:14 -0700 Subject: vga graphics for return, newln, short, and int --- src/output/vga_character.c | 23 ++++++++++++++++++++++- src/output/vga_character.h | 7 ++++--- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/src/output/vga_character.c b/src/output/vga_character.c index bd59a97..78b75f2 100644 --- a/src/output/vga_character.c +++ b/src/output/vga_character.c @@ -28,8 +28,22 @@ void vga_graphics_byte_hex(char value) { vga_graphics_write(HEX_CHARS[low]); } +void vga_graphics_short_hex(short value) { + char low = value & 0xff; + char high = (value & 0xff00) >> 8; + vga_graphics_byte_hex(high); + vga_graphics_byte_hex(low); +} + +void vga_graphics_int_hex(int value) { + short low = value & 0xffff; + short high = (value & 0xffff0000) >> 16; + vga_graphics_short_hex(high); + vga_graphics_short_hex(low); +} + void vga_graphics_write_at_offset(char value, short offset) { - __asm__( + __asm__ volatile ( "mov %0, %%al \n" "mov %1, %%di \n" "mov %%al, %%gs:(%%di) \n" @@ -47,3 +61,10 @@ void vga_graphics_clear() { } CURSOR_LOC = 0; } + +void vga_graphics_newln() { + CURSOR_LOC += 80 * 2; +} +void vga_graphics_return() { + CURSOR_LOC = CURSOR_LOC - (CURSOR_LOC % 160); +} diff --git a/src/output/vga_character.h b/src/output/vga_character.h index 0d067f3..ca60573 100644 --- a/src/output/vga_character.h +++ b/src/output/vga_character.h @@ -7,10 +7,11 @@ void vga_graphics_write_with_attr(char, char); void vga_graphics_write_str(char*); void vga_graphics_byte_hex(char); -//void vga_graphics_short_hex(short); -//void vga_graphics_int_hex(int); -//void vga_graphics_long_hex(long); +void vga_graphics_short_hex(short); +void vga_graphics_int_hex(int); void vga_graphics_clear(void); +void vga_graphics_return(void); +void vga_graphics_newln(void); #endif -- cgit v1.1