Some minor improvements

This commit is contained in:
2023-12-26 20:46:02 +01:00
parent af987dea5a
commit 39f7dba229
5 changed files with 36 additions and 10 deletions
BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 34 KiB

+8 -1
View File
@@ -68,7 +68,14 @@ start:
mov bl, byte [driveNumber] mov bl, byte [driveNumber]
; Far jump to the kernel ; Setup video mode
mov ax, 0x0003
int 0x10
mov ah, 0x0b
mov bx, 0x0001
int 0x10
; Far jump to the kernel (never returns)
jmp KERNEL_LOC:0x0000 jmp KERNEL_LOC:0x0000
readFail: readFail:
+6 -3
View File
@@ -2,7 +2,7 @@
launch: launch:
pusha pusha
call resetTextMode call clearText
mov di, 0x0e60 ; Offset in vidmem (2nd to last line) mov di, 0x0e60 ; Offset in vidmem (2nd to last line)
mov si, statusBarMsg mov si, statusBarMsg
@@ -36,7 +36,7 @@ getHexCh:
mov [hexByte], al mov [hexByte], al
jmp getHexCh jmp getHexCh
.putByte: .putByte:
cmp di, hexCode+256 cmp di, hexCode+256
jge getHexCh ; Max length reached jge getHexCh ; Max length reached
rol byte [hexByte], 4 rol byte [hexByte], 4
or byte [hexByte], al or byte [hexByte], al
@@ -60,6 +60,9 @@ getHexCh:
call print call print
jmp getHexCh jmp getHexCh
.runInput: .runInput:
mov si, runMsg
call print
pusha pusha
call hexCode ; Call the code call hexCode ; Call the code
popa popa
@@ -101,12 +104,12 @@ return:
jmp 0x2000:0x0000 jmp 0x2000:0x0000
; - Includes - ; - Includes -
%include "./src/lib/screen.asm"
%include "./src/lib/print.asm" %include "./src/lib/print.asm"
; ------------ ; ------------
statusBarMsg: db " -- HEX -- ", 0 statusBarMsg: db " -- HEX -- ", 0
controlsMsg: db "'$' to execute code; '!' to quit", 0 controlsMsg: db "'$' to execute code; '!' to quit", 0
runMsg: db ENDL, ENDL, 0
ranMsg: db ENDL, ENDL, " - Finished Execution - ", ENDL, 0 ranMsg: db ENDL, ENDL, " - Finished Execution - ", ENDL, 0
backChars: db 8,8,8,' ',8,8,0 backChars: db 8,8,8,' ',8,8,0
+4 -3
View File
@@ -9,6 +9,7 @@ start:
xor bx, bx xor bx, bx
call resetTextMode call resetTextMode
call clearText
; Print start message ; Print start message
mov si, startMsg mov si, startMsg
@@ -84,7 +85,7 @@ runCommand:
mov di, clearCmd mov di, clearCmd
call .cmp call .cmp
je clearScreen je clear
mov di, exitCmd mov di, exitCmd
call .cmp call .cmp
@@ -239,8 +240,8 @@ help:
; ;
; Clears the screen ; Clears the screen
; ;
clearScreen: clear:
call resetTextMode call clearText
jmp input jmp input
; ;
+18 -3
View File
@@ -78,11 +78,26 @@ printHexByte:
hexString: db "0x0000", 0 hexString: db "0x0000", 0
; ;
; Clears the screen ; Clears the screen in text mode
; Assumes VGA text 3 - 80x25, 16 color
; ;
clear: clearText:
pusha pusha
; TODO: Make this function push es
mov ax, 0x0b800
mov es, ax
xor di, di ; es:di - b800:0000
mov al, ' ' ; Fill with spaces
mov ah, 0x17 ; White on blue
mov cx, 80*25
rep stosw
mov ah, 2
xor dx, dx ; Set cursor to 0,0
int 0x10
pop es
popa popa
ret ret