From 064fc9f2c7aa01de92cac4cf3681e634f4a42bf1 Mon Sep 17 00:00:00 2001 From: "E. Almqvist" Date: Tue, 12 Jan 2021 20:28:06 +0100 Subject: [PATCH] Print sr --- src/bootloader.asm | 17 +++++------------ src/elib/io.asm | 27 ++++++++++++++++++++++++++- 2 files changed, 31 insertions(+), 13 deletions(-) diff --git a/src/bootloader.asm b/src/bootloader.asm index f374456..2ee71fb 100644 --- a/src/bootloader.asm +++ b/src/bootloader.asm @@ -1,26 +1,19 @@ %include "equ/BIOS.asm" %include "equ/ASCII.asm" +; eLIB +%include "elib/io.asm" + mov ah, BIOS_MODE_TELETYPE ; enter teletype mode (BIOS) mov al, ASCII_LINEBREAK ; linebreak int BIOS_INT -; Print "eOS" -mov al, "e" -int BIOS_INT +test db "eOS", ASCII_CARRIAGE_RETURN, ASCII_LINEBREAK -mov al, "O" -int BIOS_INT - -mov al, "S" -int BIOS_INT -mov al, ASCII_CARRIAGE_RETURN -int BIOS_INT +; Print "eOS" -mov al, ASCII_LINEBREAK ; linebreak -int BIOS_INT ; ALPHABET PRINT TEST mov al, 64 ; one less than A since we are printing in a loop and it increments before sys interupt diff --git a/src/elib/io.asm b/src/elib/io.asm index 49b94f2..5607c03 100644 --- a/src/elib/io.asm +++ b/src/elib/io.asm @@ -1,2 +1,27 @@ ; eLibrary -; Input/Output sr +; Input/Output subroutines + +; String structure +; ASCII Offset = 8 bits +; Array of the char bytes, ending with 0 (ASCII_END) + +eLIB_STR_OFFSET equ 8 ; 8 bits + +print: ; Subroutine to print strings (from stack) + ; Input: RCX, takes pointer to string from stack + pop rcx + + ; rcx now holds the starting point (address) + + printLoop: + ; Print the char + mov al, [rcx] ; dereference address to get value + cmp al, ASCII_END ; check if ASCII end + je printExit ; if reached the end then return + + int BIOS_INT ; system interupt (print string) + add rcx, eLIB_STR_OFFSET ; increase with offset + jmp printLoop ; loop for next char + + printExit: + ret