From 77b00e0812eadd7198384a023d9873bb47117dbe Mon Sep 17 00:00:00 2001 From: Dieter Baron Date: Tue, 13 Aug 2024 12:32:15 +0200 Subject: [PATCH] Improve PET support. --- share/lib/pet.s | 56 ++++++++++++++++++++++++++++++++ share/target/pet-basic-8k.target | 3 ++ share/target/pet-basic.inc | 19 +++++++++++ share/target/pet-basic.target | 18 +--------- 4 files changed, 79 insertions(+), 17 deletions(-) create mode 100644 share/target/pet-basic-8k.target create mode 100644 share/target/pet-basic.inc diff --git a/share/lib/pet.s b/share/lib/pet.s index 08d4900..e510bdf 100644 --- a/share/lib/pet.s +++ b/share/lib/pet.s @@ -3,3 +3,59 @@ .visibility public DEVICE_NUMBER = $D4 + +PIA1 = $e810 +PIA1_PRA = PIA1 + $1 +PIA1_CTRL_A = PIA1 + $2 +PIA1_PRB = PIA1 + $3 +PIA1_CTRL_B = PIA1 + $4 + +PIA2 = $e820 +PIA2_PRA = PIA1 + $1 +PIA2_CTRL_A = PIA1 + $2 +PIA2_PRB = PIA1 + $3 +PIA2_CTRL_B = PIA1 + $4 + +VIA = $e840 +VIA_PRB = VIA +VIA_PRA = VIA + $1 +VIA_DDRB = VIA + $2 +VIA_DDRA = VIA + $3 +VIA_TIMER_1 = VIA + $4 +VIA_TIMER_1_LOAD = VIA + $6 +VIA_TIMER_2 = VIA + $8 +VIA_SHIFT = VIA + $a +VIA_CONTROL_1 = VIA + $b ; LLMNNNOP + VIA_PORT_A_LATCH = $1 + VIA_PORT_B_LATCH = $2 + VIA_SHIFT_REGISTER_MASK = $7 + VIA_SHIFT_REGISTER(n) = (n << 2) & VIA_SHIFT_REGISTER_MASK + VIA_TIMER_2_MODE = $20 + VIA_TIMER_2_MODE_INTERVAL = $0 + VIA_TIMER_2_MODE_COUNT = VIA_TIMER_2_MODE + VIA_TIMER_1_MODE = $40 + VIA_TIMER_1_MODE_INTERVAL = $0 + VIA_TIMER_1_MODE_COUNT = VIA_TIMER_1_MODE + VIA_TIMER_1_PB7 = $80 +VIA_CONTROL_2 = VIA + $c ; QQQRSSST + VIA_CA1 = $01 + VIA_CA1_NEGATIVE = $0 + VIA_CA1_POSITIVE = VIA_CA1 + VIA_CA2_MASK = $7 + VIA_CA2(n) = (n << 1) & VIA_CA2_MASK + VIA_CB1 = $10 + VIA_CB1_NEGATIVE = $0 + VIA_CB1_POSITIVE = VIA_CB1 + VIA_CB2_MASK = $7 + VIA_CB2(n) = (n << 5) & VIA_CB2_MASK +VIA_INTERRUPT_REQUEST = VIA + $d + VIA_INTERRUPT_CA2 = $01 + VIA_INTERRUPT_CA1 = $02 + VIA_INTERRUPT_SHIFT = $04 + VIA_INTERRUPT_CB2 = $08 + VIA_INTERRUPT_CB1 = $10 + VIA_INTERRUPT_TIMER_2 = $20 + VIA_INTERRUPT_TIMER_1 = $40 + VIA_INTERRUPT_STATUS = $80 +VIA_INTERRUPT_MASK = VIA + $e +VIA_PRA_RAW = VIA + $f diff --git a/share/target/pet-basic-8k.target b/share/target/pet-basic-8k.target new file mode 100644 index 0000000..35d065f --- /dev/null +++ b/share/target/pet-basic-8k.target @@ -0,0 +1,3 @@ +basic_end = $1fff + +.include "pet-basic.inc" diff --git a/share/target/pet-basic.inc b/share/target/pet-basic.inc new file mode 100644 index 0000000..587dc64 --- /dev/null +++ b/share/target/pet-basic.inc @@ -0,0 +1,19 @@ +.include "pet.inc" + +; TODO: check free adddress +.section zero_page { + type: reserve_only + address [ + : $0f - $10 ; unused + : $a2 ; unused + : $b6 ; unused + : $b8 ; unused + : $ed - $f7 ; unused + : $ff ; unused + ] +} + +basic_start = $0401 +.default basic_end = $7fff + +.include "commodore-basic.inc" diff --git a/share/target/pet-basic.target b/share/target/pet-basic.target index da6922b..dc9b70a 100644 --- a/share/target/pet-basic.target +++ b/share/target/pet-basic.target @@ -1,19 +1,3 @@ -.include "pet.inc" - -; TODO: check free adddress -.section zero_page { - type: reserve_only - address [ - : $0f - $10 ; unused - : $a2 ; unused - : $b6 ; unused - : $b8 ; unused - : $ed - $f7 ; unused - : $ff ; unused - ] -} - -basic_start = $0401 basic_end = $7fff -.include "commodore-basic.inc" +.include "pet-basic.inc"