kernel/term.68k

36 lines
905 B
Plaintext
Raw Normal View History

2024-03-19 09:23:45 -05:00
include cards.i
section .text,text
; Initializes the terminal card driver
public term_init
term_init:
move.b #$3, d0 ; Get the pointer to the terminal card
jsr find_first_card
move.l a0, term_io_base ; Save the pointer for later use
rts
; Prints the string pointed to by a0
public term_print
term_print:
move.l term_io_base, a1
term_print_loop:
move.b (a0)+, d0 ; Get the next character of the string
cmpi.b #0, d0 ; If NULL, end of string; return
beq.b term_print_done
move.b d0, (a1) ; Send the character to the terminal
bra.b term_print
term_print_done:
rts
; Prints the string pointed to by a0 followed by a newline
public term_println
term_println:
bsr.b term_print
; take advantage of the known register state after term_print and
; write the newline w/o loading the address from memory
move.b #$A, (a1)
rts
section .bss,bss
term_io_base:
ds.b 4