diff --git a/keyboard/Makefile b/keyboard/Makefile new file mode 100644 index 00000000..2d055234 --- /dev/null +++ b/keyboard/Makefile @@ -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 + diff --git a/keyboard/hello.bas b/keyboard/hello.bas new file mode 100644 index 00000000..0c76892f --- /dev/null +++ b/keyboard/hello.bas @@ -0,0 +1,5 @@ +5 HOME +10 PRINT CHR$(4)"BRUN KEYBOARD" + + + diff --git a/keyboard/keyboard.s b/keyboard/keyboard.s new file mode 100644 index 00000000..cdfd587b --- /dev/null +++ b/keyboard/keyboard.s @@ -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 +