Add KIM-1 functions to write to the 7-segment LED display and get

keypresses from the keypad.
Includes sample program illustrating how to use them.
Tested on real KIM-1 hardware.
This commit is contained in:
Jeff Tranter
2023-03-29 18:40:10 -04:00
parent d69117c0c1
commit 3a5fbd34da
5 changed files with 108 additions and 0 deletions

18
libsrc/kim1/getkey.s Normal file
View File

@@ -0,0 +1,18 @@
;
; int __fastcall__ getkey();
;
.include "kim1.inc"
.import popa
.export _getkey
.proc _getkey
jsr KEYIN ; Open up keyboard channel
jsr GETKEY ; Get key code
ldx #0 ; MSB of return value is zero
rts
.endproc

21
libsrc/kim1/scandisplay.s Normal file
View File

@@ -0,0 +1,21 @@
;
; void __fastcall__ scandisplay(unsigned char left, unsigned char middle, unsigned char right);
;
.include "kim1.inc"
.import popa
.export _scandisplay
.proc _scandisplay
sta $F9 ; Rightmost display data
jsr popa
sta $FA ; Middle display data
jsr popa
sta $FB ; Leftmost display data
jsr SCANDS
rts
.endproc