initial work towards burst IEC protocol support

This commit is contained in:
FeralChild64 committed 2019-12-30 20:28:52 +01:00
1 parent 99afae45c6
commit f05ddef5fd
20 files changed
+280 -68

No files matched your search

+2 -9
View File
@@ -110,8 +110,6 @@ IOINIT:
lda #$3F
sta CIA2_DDRA // $DD02
// XXX detect TOD clock, see https://codebase64.org/doku.php?id=base:efficient_tod_initialisation
// XXX how to initialize these timers???
// stx CIA1_CRB // $DC0F
// stx CIA2_CRA // $DD0E
@@ -123,13 +121,8 @@ IOINIT:
ldx #%00000111 // XXX adapt this to IEC idle state, JMP at the end won't be needed
stx CIA2_PRA // $DD00
//
ldy #<16421
ldx #>16421
sty CIA1_TIMALO // $DC04
stx CIA1_TIMAHI // $DC05
// Put something sane in the IRQ timer
jsr setup_irq_timer
// Enable timer A to run continuously (http://codebase64.org/doku.php?id=base:timerinterrupts)
ldx #$11
+27 -31
View File
@@ -23,43 +23,39 @@ setup_pal_ntsc:
setup_pal:
// Set timer interval to ~1/60th of a second
// (This value was calculated by running a custom IRQ handler on a C64
// with original KERNAL, and writing the values of $DC04/5 to the screen
// in the IRQ handler to see roughly what value the timers must be set to)
// ldy #<16380
// ldx #>16380
// PAL C64 (https://codebase64.org/doku.php?id=base:cpu_clocking),
// is clocked at 0.985248 MHz, so that 1/60s is 16421 ($4025) CPU cycles
ldy #<16421
ldx #>16421
lda #$01
skip_2_bytes_trash_nvz
// FALLTROUGH
setup_ntsc:
lda #$00
// FALLTROUGH
setup_pal_ntsc_end:
sty CIA1_TIMALO // $DC04
stx CIA1_TIMAHI // $DC05
sta TVSFLG
// FALLTROUGH
setup_irq_timer: // entry point needed by UP9600 and CIA1 burst mod support
// Sets up IRQ timer in CIA1 to ~1/60th of a second,
// depending on the detected video system
// Retrieve video system (0 - NTSC, 1 - PAL), assume PAL for unknown values
ldx TVSFLG
beq !+
ldx #$01
!:
// Setup interval for timer A in CIA1
lda irq_timing_lo, x
sta CIA1_TIMALO // $DC04
lda irq_timing_hi, x
sta CIA1_TIMAHI // $DC05
rts
setup_ntsc:
// Set timer interval to ~1/60th of a second
// NTSC C64 (https://codebase64.org/doku.php?id=base:cpu_clocking),
// is clocked at 1.022727 MHz, so that 1/60s is 17045 ($4295) CPU cycles
ldy #<17045
ldx #>17045
lda #$00
beq setup_pal_ntsc_end // branch always