Newlines and no cursor

This commit is contained in:
Robbe Van Herck 2019-12-30 14:45:55 +01:00
parent bc3165eeb8
commit af4b198341
No known key found for this signature in database
GPG key ID: A66F76F7B81BD784
3 changed files with 14 additions and 9 deletions

View file

@ -142,6 +142,13 @@ ret
.start: .start:
; disable vga cursor
mov ah, 0x01
mov ch, 0b00100000
mov cl, 0b00000000
int 0x10
; reset disk system ; reset disk system
mov ah, 0x00 mov ah, 0x00
mov dl, DISK_ID mov dl, DISK_ID

View file

@ -1,9 +0,0 @@
[bits 32]
mov byte [ds:0B8000h], 0h ; Move the ASCII-code of 'P' into first video memory
mov byte [ds:0B8001h], 0h ; Assign a color code
.loop:
inc byte [ds:0B8000h]
inc byte [ds:0B8001h]
jmp .loop

View file

@ -85,6 +85,12 @@ void terminal_putentryat(char c, uint8_t color, size_t x, size_t y)
void terminal_putchar(char c) void terminal_putchar(char c)
{ {
if (c == '\n') {
terminal_column = 0;
terminal_row++;
return;
}
terminal_putentryat(c, terminal_color, terminal_column, terminal_row); terminal_putentryat(c, terminal_color, terminal_column, terminal_row);
if (++terminal_column == VGA_WIDTH) { if (++terminal_column == VGA_WIDTH) {
terminal_column = 0; terminal_column = 0;
@ -115,4 +121,5 @@ void kernel_main(void)
terminal_writestring("kernel"); terminal_writestring("kernel");
terminal_setcolor(vga_entry_color(VGA_COLOR_LIGHT_GREY, VGA_COLOR_BLACK)); terminal_setcolor(vga_entry_color(VGA_COLOR_LIGHT_GREY, VGA_COLOR_BLACK));
terminal_writestring(" World!\n"); terminal_writestring(" World!\n");
terminal_writestring("Newlines!");
} }