Adds colon cases

This commit is contained in:
Daniel Svitan 2025-05-07 22:56:22 +02:00
parent eab87f939c
commit 92f388bf5d

View File

@ -11,6 +11,7 @@ ACTION_LOOP equ 0x0
ACTION_CHAR equ 0x1
ACTION_BACK_TO_OPENING equ 0x2
ACTION_BACK_TO_COMMA equ 0x3
ACTION_BACK_TO_COLON equ 0x4
section .data
space db " "
@ -65,6 +66,8 @@ _start:
je case_closing
cmp al, [comma]
je case_comma
cmp al, [colon]
je case_colon
mov r15, ACTION_LOOP
jmp print_char
@ -102,6 +105,19 @@ _start:
je ln_start
jmp loop
case_colon:
mov r15, ACTION_BACK_TO_COLON
jmp print_char
case_colon_back:
mov al, [escape_next]
cmp al, 1
je loop
mov r15, ACTION_LOOP
mov al, [space]
mov byte[char], al
jmp print_char
print_char:
mov rax, SYS_WRITE
mov rbx, STDOUT
@ -113,6 +129,8 @@ _start:
je case_opening_back
cmp r15, ACTION_BACK_TO_COMMA
je case_comma_back
cmp r15, ACTION_BACK_TO_COLON
je case_colon_back
jmp loop