Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion automaton/bootsector.asm
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ call scan ; print former row
call pass ; update to latter row
call copy ; fill former with latter
call sleep
call print_last_char ; Prints last character in line
jmp main

sleep:
Expand Down Expand Up @@ -97,14 +98,15 @@ cell:

scan:
mov di, former
mov si, former + 80
mov si, former + 79 ; 79 and not 80 to emit last character just after sleep and not in this procedure.
.loop:
mov al, [di]
call ascii
call emit
inc di
cmp di, si
jb .loop
mov [last_char], al ; Last character stored in last_char byte variable
ret

ascii:
Expand All @@ -117,6 +119,8 @@ ascii:
.done:
ret

print_last_char:
mov al, [last_char] ; copying from last_char if print_last_char was called instead of emit
emit:
mov ah, 0x0e ; write char in teletype mode
; al = char
Expand Down Expand Up @@ -145,6 +149,7 @@ db 0, 1, 0, 0, 0, 0, 1, 0, 0, 0
db 0
latter:
times 80 db 0
last_char db 0

; pad with zeros until magic number
times 510 - ($ - $$) db 0
Expand Down