Code clean
This commit is contained in:
parent
c9274fac4d
commit
72e4bee080
@ -2,7 +2,7 @@
|
||||
; @author Daniele Verducci
|
||||
|
||||
; config (IO port 0)
|
||||
DATA_REG: EQU IO_0
|
||||
TERM_DATA_REG: EQU IO_0
|
||||
|
||||
; variables
|
||||
TERM_VAR_SPACE: EQU DRV_VAR_SPACE + 128
|
||||
@ -16,20 +16,20 @@ Term_print:
|
||||
ld a, (bc) ; bc is the pointer to passed string's first char
|
||||
cp 0 ; compare A content with 0 (subtract 0 from value and set zero flag Z if result is 0)
|
||||
ret z ; if prev compare is true (Z flag set), string is finished, return
|
||||
out (DATA_REG),a ; output char
|
||||
out (TERM_DATA_REG),a ; output char
|
||||
inc bc ; increment bc to move to next char
|
||||
jp Term_print
|
||||
|
||||
; Writes a single character
|
||||
; @param A Value of character to print
|
||||
Term_printc:
|
||||
out (DATA_REG),a
|
||||
out (TERM_DATA_REG),a
|
||||
ret
|
||||
|
||||
; Reads a single character
|
||||
; @return A The read character
|
||||
Term_readc:
|
||||
in a, (DATA_REG) ; reads a character
|
||||
in a, (TERM_DATA_REG) ; reads a character
|
||||
add a, 0
|
||||
jp z, Term_readc ; if char is 0 (NULL), ignores it and waits for another character
|
||||
ret ; if not NULL, returns it in the a register
|
||||
@ -38,7 +38,7 @@ Term_readc:
|
||||
; @return BC The pointer to a null-terminated read string
|
||||
Term_readline:
|
||||
ld bc, incoming_string ; this array will contain read string
|
||||
in a, (DATA_REG) ; reads a character
|
||||
in a, (TERM_DATA_REG) ; reads a character
|
||||
; if char is 0 (ascii NULL), ignore it
|
||||
add a, 0
|
||||
jp z, Term_readline ; if 0 (= ascii NULL), ignores it and waits for another character
|
||||
|
@ -2,7 +2,7 @@
|
||||
; @author Daniele Verducci
|
||||
|
||||
; Duration in cpu cycles / 55 (change these values based on CPU frequency)
|
||||
TIME_DUR_SECOND: EQU (2545)
|
||||
TIME_DUR_SECOND: EQU 2545
|
||||
TIME_DUR_MILLIS: EQU 3
|
||||
|
||||
; Wait bc * 55 states
|
||||
|
Loading…
x
Reference in New Issue
Block a user