Added Arduino terminal, moved drivers config variables to each driver asm file

This commit is contained in:
Daniele Verducci (ZenPenguin) 2020-11-22 23:01:22 +01:00
parent a5e7962eb0
commit 30ec4f2975
4 changed files with 35 additions and 15 deletions

View File

@ -0,0 +1,23 @@
; Arduino terminal driver
; @author Daniele Verducci
; config (IO port 0)
DATA_REG: EQU IO_0
; functions
; Sends string
; @param BC Pointer to a null-terminated string first character
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
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
ret

View File

@ -1,9 +1,9 @@
; HD44780 20x4 characters LCD display driver
; @author Daniele Verducci
;
; Requires declaration of following pointers:
; LCD_INSTR_REG
; LCD_DATA_REG
; LCD config (IO port 0)
LCD_INSTR_REG: EQU IO_0
LCD_DATA_REG: EQU IO_0 + 1
; constants
LCD_LINES_LEFT: DB 0x80, 0xA8, 0x94, 0xBC ;array defining lcd command codes for the first char of every line

View File

@ -23,6 +23,12 @@
; KEYB_A3_REG = 0000011
; etc...
; Keyboard config (IO port 1)
KEYB_A0_REG: EQU IO_1 + %00000001
KEYB_A1_REG: EQU IO_1 + %00000010
KEYB_A2_REG: EQU IO_1 + %00000100
KEYB_A3_REG: EQU IO_1 + %00001000
KEYB_A4_REG: EQU IO_1 + %00010000
; Reads the keyboard
; @return: a 0-terminated array of keycodes representing the pressed keys

View File

@ -35,16 +35,6 @@ IO_5: EQU 0xA0
IO_6: EQU 0xC0
IO_7: EQU 0xE0
; LCD config (IO port 0)
LCD_INSTR_REG: EQU IO_0
LCD_DATA_REG: EQU IO_0 + 1
; Keyboard config (IO port 1)
KEYB_A0_REG: EQU IO_1 + %00000001
KEYB_A1_REG: EQU IO_1 + %00000010
KEYB_A2_REG: EQU IO_1 + %00000100
KEYB_A3_REG: EQU IO_1 + %00001000
KEYB_A4_REG: EQU IO_1 + %00010000
; CONSTANTS
@ -55,8 +45,9 @@ SYSINIT_GREETING:
include 'driver_hd44780.asm'
;include 'driver_hd44780.asm'
;include 'driver_keyboard.asm'
include 'driver_arduino_terminal.asm'
; System initialization
Sysinit: