Skip to content

Commit

Permalink
Improve PET support.
Browse files Browse the repository at this point in the history
  • Loading branch information
dillof committed Aug 13, 2024
1 parent 44c19c5 commit 77b00e0
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 17 deletions.
56 changes: 56 additions & 0 deletions share/lib/pet.s
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 3 additions & 0 deletions share/target/pet-basic-8k.target
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
basic_end = $1fff

.include "pet-basic.inc"
19 changes: 19 additions & 0 deletions share/target/pet-basic.inc
Original file line number Diff line number Diff line change
@@ -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"
18 changes: 1 addition & 17 deletions share/target/pet-basic.target
Original file line number Diff line number Diff line change
@@ -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"

0 comments on commit 77b00e0

Please sign in to comment.