mirror of
https://github.com/deater/dos33fsprogs.git
synced 2025-04-11 17:40:04 +00:00
keyboard: add some sample keyboard code
This commit is contained in:
parent
1df61f7865
commit
1a5d7a09f0
33
keyboard/Makefile
Normal file
33
keyboard/Makefile
Normal file
@ -0,0 +1,33 @@
|
||||
include ../Makefile.inc
|
||||
|
||||
DOS33 = ../utils/dos33fs-utils/dos33
|
||||
DOS33_RAW = ../utils/dos33fs-utils/dos33_raw
|
||||
TOKENIZE = ../utils/asoft_basic-utils/tokenize_asoft
|
||||
LINKER_SCRIPTS = ../linker_scripts
|
||||
EMPTY_DISK = ../empty_disk
|
||||
|
||||
all: keyboard.dsk
|
||||
|
||||
keyboard.dsk: HELLO KEYBOARD
|
||||
cp $(EMPTY_DISK)/empty.dsk keyboard.dsk
|
||||
$(DOS33) -y keyboard.dsk SAVE A HELLO
|
||||
$(DOS33) -y keyboard.dsk BSAVE -a 0xc00 KEYBOARD
|
||||
|
||||
###
|
||||
|
||||
HELLO: hello.bas
|
||||
$(TOKENIZE) < hello.bas > HELLO
|
||||
|
||||
###
|
||||
|
||||
KEYBOARD: keyboard.o
|
||||
ld65 -o KEYBOARD keyboard.o -C $(LINKER_SCRIPTS)/apple2_c00.inc
|
||||
|
||||
keyboard.o: keyboard.s
|
||||
ca65 -o keyboard.o keyboard.s -l keyboard.lst
|
||||
|
||||
###
|
||||
|
||||
clean:
|
||||
rm -f *~ *.o *.lst HELLO KEYBOARD
|
||||
|
5
keyboard/hello.bas
Normal file
5
keyboard/hello.bas
Normal file
@ -0,0 +1,5 @@
|
||||
5 HOME
|
||||
10 PRINT CHR$(4)"BRUN KEYBOARD"
|
||||
|
||||
|
||||
|
31
keyboard/keyboard.s
Normal file
31
keyboard/keyboard.s
Normal file
@ -0,0 +1,31 @@
|
||||
; HARDWARE LOCATIONS
|
||||
|
||||
KEYPRESS = $C000
|
||||
KEYRESET = $C010
|
||||
KEYSTROBE = $C010
|
||||
|
||||
; on original Apple II/II+
|
||||
; read KEYPRESS
|
||||
; if bit 7 set, means key was pressed, value in lower 7 bits
|
||||
; access KEYSTROBE to clear value and allow another keypress to happen
|
||||
; on Apple IIe
|
||||
; can read KEYSTROBE. bit 7 is "any key is down"
|
||||
|
||||
|
||||
; test keyboard
|
||||
|
||||
keyboard:
|
||||
|
||||
ldy #0
|
||||
|
||||
keyboard_loop:
|
||||
lda KEYPRESS
|
||||
bpl keyboard_loop
|
||||
|
||||
ora #$80
|
||||
sta $400,Y
|
||||
iny
|
||||
bit KEYRESET
|
||||
|
||||
jmp keyboard_loop
|
||||
|
Loading…
x
Reference in New Issue
Block a user