Added support for \n, \t and \\ in the string printing function

This commit is contained in:
2025-11-01 12:38:02 +00:00
parent 015d4d1fce
commit 7906c48a2e
8 changed files with 125 additions and 85 deletions

View File

@@ -6,21 +6,31 @@
; memory address 2: |s|n|a|k|e|0|
; ^
; SI => lodsb loads value stored at SI to AX and then increments SI if DF is 0
; Additionaly, if the di string ends and the relevant character in si contains a space, it will still return
; the strings as being equal, this is to allow for command line arquments
os_compare_strings:
cld
.compare:
mov al, 0
scasb
je .di_ended
dec di
lodsb
scasb ; Compare di to si
jne .unequal ; If they are not equal, jump to .unequal
cmp al, 0 ; Check if string is finished
je .equal ; If it has, return true
jmp .compare ; Finally, repeat
.unequal:
mov cl, 0 ; Change to 0 if unquality is proven
ret
.di_ended:
lodsb
cmp al, 20h ; 20h = space
je .equal
cmp al, 0
je .equal
jmp .unequal
.equal:
mov cl, 1
ret
@@ -32,13 +42,13 @@ os_compare_strings:
os_string_length:
push si
xor cl,cl ; Clear the al register
.loop
.loop:
lodsb
cmp al, 0
je .finish
inc cl
jmp .loop
.finish
.finish:
pop si
ret
@@ -78,7 +88,7 @@ os_format_fat_filename:
; Convert a string to all upper/lower case
; INPUT: si pointing to a string
; OUPUT: the same string in memory will now be capitalised/decapitalised
os_upper_case:
os_upper_case: ; to upper case
pusha
mov di, si
.loop:
@@ -98,7 +108,7 @@ os_upper_case:
popa
ret
os_lower_case:
os_lower_case: ; to lower case
pusha
mov di, si
.loop: