A new option, ARNITECH_CONTROLLER, on in the mc64 configuration only. IOINIT starts timer A with CIA #1's TOD on 50 Hz, the mc64's mains, and if the Arnitech controller's signature "ARNI" is at $DE80, latches its clock and copies its real time into the TOD, hours first and tenths last, flipping bit 7 of an hour of 12 first, since the CIA flips it back when 12 is written. Without the signature the TOD is left alone. The Arnitech jump table at $FF00: "ARNI", version $01, two entries, and JMPs from $FF06: $FF06 finds the first Card slot holding a Card of the type in A (carry clear, the slot in A, its Card window's low byte in X; carry set if none or no controller), $FF09 sets the TOD as IOINIT does. $FF48-$FF80 stay clear. The code is in new files under src/kernal/arnitech; other configurations build as before.
59 lines
1.3 KiB
ArmAsm
59 lines
1.3 KiB
ArmAsm
;; #LAYOUT# STD * #TAKE
|
|
;; #LAYOUT# * * #IGNORE
|
|
|
|
;
|
|
; CIA1's TOD from the Arnitech controller's real time (mc64 only, arnitech's ADR 0023)
|
|
;
|
|
; The controller lays its time out as the TOD reads it, so the copy goes hours first, which stops
|
|
; the TOD, and tenths last, which starts it. The CIA flips the PM bit when an hour of 12 is
|
|
; written (VICE does so too), so an hour of 12 has bit 7 flipped first.
|
|
;
|
|
|
|
!ifdef CONFIG_ARNITECH_CONTROLLER {
|
|
|
|
;
|
|
; ARNI_SETTOD, $FF09: see ff00.arnitech_jumptable.s
|
|
;
|
|
|
|
arnitech_set_tod:
|
|
|
|
lda CIA1_CRA
|
|
ora #$80 ; TOD on 50 Hz, the mc64's mains
|
|
sta CIA1_CRA
|
|
|
|
; FALLTHROUGH
|
|
|
|
;
|
|
; The copy alone, for IOINIT, which has set CRA already.
|
|
; Out: carry clear if set, carry set if no controller answers. A and X are not kept, Y is.
|
|
;
|
|
|
|
arnitech_tod_from_clock:
|
|
|
|
jsr arnitech_check_signature
|
|
bcs @2
|
|
|
|
lda ARNITECH_CLOCK_LATCH ; copies the clock into $DE91-$DE9E
|
|
|
|
ldx ARNITECH_CLOCK_HRS
|
|
txa
|
|
and #$7F
|
|
cmp #$12
|
|
bne @1
|
|
txa
|
|
eor #$80 ; the CIA flips it back
|
|
tax
|
|
@1:
|
|
stx CIA1_TODHRS ; stops the TOD
|
|
lda ARNITECH_CLOCK_MIN
|
|
sta CIA1_TODMIN
|
|
lda ARNITECH_CLOCK_SEC
|
|
sta CIA1_TODSEC
|
|
lda ARNITECH_CLOCK_TEN
|
|
sta CIA1_TODTEN ; starts it
|
|
|
|
clc
|
|
@2:
|
|
rts
|
|
}
|