From 1fc9cb8a93acf0c47051ecc832910e8337d81814 Mon Sep 17 00:00:00 2001 From: Takashi Toyoshima Date: Sat, 13 Dec 2014 03:01:38 +0900 Subject: [PATCH] Now GPIO can be accessible via Apple BASIC POKE -16240, 255 # Set all bits of GPIO0 as output ports POKE -16224, 255 # Output all one to GPIO0 POKE -16224, 0 # Output all zero to GPIO0 --- apple2.S | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/apple2.S b/apple2.S index 7199941..b5161e3 100644 --- a/apple2.S +++ b/apple2.S @@ -4,6 +4,8 @@ .thumb .thumb_func + .include "registers.inc" + .extern basic_rom .extern uart_putd .extern uart_getc @@ -284,6 +286,49 @@ cpu6502_store: // 0xc000 KBD (Last Key Pressed + 128) ldr r2, =#kbddata strb r1, [r2] + mov pc, lr +1: + cmp r0, #0x90 + bne 1f + // 0xc090 !!! GPIO0DIR + ldr r0, =#GPIO0DIR + str r1, [r0] + mov pc, lr +1: + cmp r0, #0x91 + bne 1f + // 0xc091 !!! GPIO1DIR + ldr r0, =#GPIO1DIR + str r1, [r0] + mov pc, lr +1: + cmp r0, #0x92 + bne 1f + // 0xc091 !!! GPIO2DIR + ldr r0, =#GPIO2DIR + str r1, [r0] + mov pc, lr +1: + cmp r0, #0xa0 + bne 1f + // 0xc0a0 !!! GPIO0DATA + ldr r0, =#GPIO0DATA + str r1, [r0] + mov pc, lr +1: + cmp r0, #0xa1 + bne 1f + // 0xc0a1 !!! GPIO1DATA + ldr r0, =#GPIO1DATA + str r1, [r0] + mov pc, lr +1: + cmp r0, #0xa2 + bne 1f + // 0xc0a1 !!! GPIO2DATA + ldr r0, =#GPIO2DATA + str r1, [r0] + mov pc, lr 1: mov pc, lr