commit f0aebcf4f7222faa4b54012cd42fa5495cdd098f
parent 37ac774138eceb6c7f25bc7866728d018256ac96
Author: Gerd Beuster <gerd@frombelow.net>
Date: Fri, 4 Dec 2020 12:45:32 +0100
VIA added
Diffstat:
5 files changed, 87 insertions(+), 4 deletions(-)
diff --git a/hw/bus_logic/BUS_LOGIC.PLD b/hw/bus_logic/BUS_LOGIC.PLD
@@ -50,7 +50,7 @@ o0 = (!i0 # !i1 # !i2);
o2 = (!i0 # !i1 # i2 # !i3 # !i4 # !i5);
-/* TBA (1k)
+/* VIA (1k)
Address range: 0xd800 - 0xdbff
Bit pattern: 0b110110..........
*/
diff --git a/roms/boot/boot.asm b/roms/boot/boot.asm
@@ -163,9 +163,9 @@ transmit_block:
acia_base = $dc00
.endif
acia_data_reg = acia_base
- acia_status_reg = acia_base + 1
- acia_cmd_reg = acia_base + 2
- acia_ctrl_reg = acia_base + 3
+ acia_status_reg = acia_base + $1
+ acia_cmd_reg = acia_base + $2
+ acia_ctrl_reg = acia_base + $3
.endn
;;; init_acia
@@ -190,6 +190,33 @@ init_acia:
rts
.bend
+.namespace export
+.if SYMON
+ via_start = $8000
+.else
+ via_start = $d800
+.endif
+ via_irb = via_start
+ via_orb = via_start
+ via_ira = via_start+$1
+ via_ora = via_start+$1
+ via_ddrb = via_start+$2
+ via_ddra = via_start+$3
+ via_t1cl = via_start+$4
+ via_t1ch = via_start+$5
+ via_t1ll = via_start+$6
+ via_t1lh = via_start+$7
+ via_t2cl = via_start+$8
+ via_t2ch = via_start+$9
+ via_sr = via_start+$10
+ via_acr = via_start+$11
+ via_pcr = via_start+$12
+ via_ifr = via_start+$13
+ via_ier = via_start+$14
+ via_ira2 = via_start+$15
+ via_ora2 = via_start+$15
+.endn
+
;;; ----------------------------------------------------------
;;; STANDARD LIBRARY FUNCTIONS
;;;
diff --git a/sw/stack_test/stack_test.asm b/sw/stack_test/stack_test.asm
@@ -14,6 +14,7 @@
init:
cld
jsr init_acia
+ jsr getc
jmp stack_test
stack_test:
.block
diff --git a/sw/via_test/Makefile b/sw/via_test/Makefile
@@ -0,0 +1,3 @@
+TARGET=via_test
+
+include ../Makefile.common
diff --git a/sw/via_test/via_test.asm b/sw/via_test/via_test.asm
@@ -0,0 +1,52 @@
+;;; Connect LEDs to the 65C22 and enjoy some blinkenlights
+.if SYMON
+ .include "boot_symon.l"
+.else
+ .include "boot.l"
+.endif
+ .include "boot_macros.inc"
+
+ * = $300
+ .dsection code
+ .cerror * > $8000, "RAM exhausted"
+
+ .section code
+init:
+ .block
+ cld
+ jsr init_acia
+ jsr getc
+ PRINTSNL "VIA Test"
+ ;; Configure all ports of A as input
+ lda #$00
+ sta via_ddra
+ ;; Configure all ports of B as output
+ lda #$ff
+ sta via_ddrb
+loop: jsr read_and_write_via
+ jmp loop
+ .bend
+
+read_and_write_via:
+ .block
+ inc via_orb
+ PRINTS "IRA: "
+ lda via_ira
+ jsr puth
+ lda #" "
+ jsr putc
+ PRINTS "IRB: "
+ lda via_irb
+ jsr puth
+ PRINTNL
+ ldx #$00
+ ldy #$00
+delay:
+ dey
+ bne delay
+ dex
+ bne delay
+ rts
+ .bend
+
+ .send code