Nyanix

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | LICENSE

commit c8aa59cb5c7408360e677c702fef74bea9c56a28
parent 65486dae171f646929b0b529a244d971f40c0189
Author: Dani Frisk <dani@silverskin.fi>
Date:   Fri,  9 Mar 2018 15:14:18 +0200

Cleanup, first update in a bit

Diffstat:
src/gd16table.inc | 31-------------------------------
src/main.inc | 8+-------
src/messages.inc | 1-
src/start.inc | 4++--
src/userio.inc | 105-------------------------------------------------------------------------------
5 files changed, 3 insertions(+), 146 deletions(-)

diff --git a/src/gd16table.inc b/src/gd16table.inc @@ -1,31 +0,0 @@ - -%ifndef GDT16_H -%define GDT16_H - -GDT_PTR: - dw GDT_END - GDT_PTR - 1 - dd GDT_HEAD -GDT_HEAD: - dw 0x0000 -GDT_DESC: - dw 0xFFFF - dw 0x0000 - dw 0x0092 - dw 0xCF00 -GDT_TSS_PTR: - dw GDT_END - GDT_TSS_PTR - 1 - dd GDT_TSS_HEAD -GDT_TSS_HEAD: - dw 0x0000 -GDT_TSS_DESC: - times 0x64 dw 0x00 - - -GDT_END: - -%endif - - - - - diff --git a/src/main.inc b/src/main.inc @@ -4,7 +4,7 @@ ; from here. loading GDT, IDT, enabling A20, etc... ; ;********************************************************; -%include "userio.inc" +%include "prints.inc" %include "messages.inc" ; Rest of the includes may be found from bottom of this file. @@ -24,12 +24,6 @@ main: mov si, MSG_MAIN_BOOTED call printf - ; Loading GDT - lgdt [GDT_PTR] - - - - ; We should not return, but if we do. ; we'll do it fancy .end: diff --git a/src/messages.inc b/src/messages.inc @@ -10,7 +10,6 @@ ; MSG_MAIN_BOOTED db "BOOTED THE BOARD", 0x0A, 0 -MSG_A20_ENABLED db "Enabled a20 line!", 0x0A, 0 %endif diff --git a/src/start.inc b/src/start.inc @@ -36,8 +36,8 @@ _start: call main ; We returned from main() for some reason! that's odd... - ; time to reboot and attempt to boot again... - jmp 0xFFFF:0x0000 + cli + hlt %include "main.inc" diff --git a/src/userio.inc b/src/userio.inc @@ -1,105 +0,0 @@ - -%ifndef USERIO_H -%define USERIO_H - - -; printf(); -; prints a null-terminated string to screen. -; -; @param (IN) [SI], null-terminated string to print -; @return None -printf: - push ebp - mov ebp, esp - lodsb - cmp al, 0x00 - jne .putchar - mov ax, 0xb800 - mov gs, ax - mov bx, 0x0000 - mov ax, [gs:bx] - jmp .return -.putchar: - cmp al, 0x0A - je .newline - mov ah, 0x0F - mov cx, ax - movzx ax, byte [y_axis] - mov dx, 160 - mul dx - movzx bx, byte [x_axis] - shl bx, 1 - - xor di, di - add di, ax - add di, bx - - mov ax, cx - stosw - add byte [x_axis], 1 - jmp printf -.newline: - add byte [y_axis], 1 - mov byte [x_axis], 0 - jmp printf -.return: - mov esp, ebp - pop ebp - ret - -; printh() -; prints providen bytes as hexadecimal. -; -; @param (IN) [reg16] ax bytes to print as hex -; @return None. -printh: - push ebp - mov ebp, esp - mov si, hexstart - call printf - mov di, outstr16 - mov ax, [reg16] - mov cx, 4 - - .hexloop: - rol ax, 4 - mov bx, ax - mov bx, 0x0f - mov bl, [si+bx] - mov [di], bl - inc di - dec cx - jnz .hexloop - - mov si, outstr16 - call printf - add word [y_axis], 1 - mov word [x_axis], 0 - mov esp, ebp - pop ebp - ret - -; clear(); -; clears the screen. -clear: - push ebp - mov ebp, esp - mov ax, 0x0700 - mov bh, 0x07 - mov dx, 0x184f - int 0x10 - mov esp, ebp - pop ebp - ret - -hexstart db "0x", 0x00 -y_axis db 0 -x_axis db 0 -reg16 dw 0 -outstr16 db "0000", 0 -hexstr db "0123456789ABCDEF" - - - - -%endif