initial work towards burst IEC protocol support
This commit is contained in:
1 parent
99afae45c6
commit
f05ddef5fd
20 files changed
+280
-68
No files matched your search
@@ -109,10 +109,6 @@ Adds support for the IEEC bus - for serial printers, disk drives, etc.
|
|||||||
|
|
||||||
Needs over 1000 bytes in KERNAL segment. If unsure - enable.
|
Needs over 1000 bytes in KERNAL segment. If unsure - enable.
|
||||||
|
|
||||||
### `CONFIG_IEC_BLANK_SCREEN`
|
|
||||||
|
|
||||||
Causes screen blanking during some IEC operations (currently only JiffyDOS file loading) to increase the data transfer performance.
|
|
||||||
|
|
||||||
### `CONFIG_IEC_DOLPHINDOS`
|
### `CONFIG_IEC_DOLPHINDOS`
|
||||||
|
|
||||||
Adds support for DolphinDOS fast protocol to the IEC bus, using UserPort cable.
|
Adds support for DolphinDOS fast protocol to the IEC bus, using UserPort cable.
|
||||||
@@ -131,6 +127,10 @@ Adds support for JiffyDOS fast protocol to the IEC bus.
|
|||||||
|
|
||||||
Needs about 430 bytes in KERNAL segment. If unsure - enable.
|
Needs about 430 bytes in KERNAL segment. If unsure - enable.
|
||||||
|
|
||||||
|
### `CONFIG_IEC_JIFFYDOS_BLANK`
|
||||||
|
|
||||||
|
Causes screen blanking during iffyDOS file loading to increase performance.
|
||||||
|
|
||||||
### `CONFIG_TAPE_NORMAL`
|
### `CONFIG_TAPE_NORMAL`
|
||||||
|
|
||||||
Adds a minimal normal (standard Commodore format) tape support - just LOAD command.
|
Adds a minimal normal (standard Commodore format) tape support - just LOAD command.
|
||||||
|
|||||||
@@ -45,16 +45,19 @@
|
|||||||
// I/O devices
|
// I/O devices
|
||||||
|
|
||||||
#define CONFIG_IEC
|
#define CONFIG_IEC
|
||||||
#define CONFIG_IEC_BLANK_SCREEN
|
#define CONFIG_IEC_DOLPHINDOS
|
||||||
#define CONFIG_IEC_DOLPHINDOS // not finished yet, but LOAD works
|
|
||||||
#define CONFIG_IEC_DOLPHINDOS_FAST
|
#define CONFIG_IEC_DOLPHINDOS_FAST
|
||||||
#define CONFIG_IEC_JIFFYDOS
|
#define CONFIG_IEC_JIFFYDOS
|
||||||
|
#define CONFIG_IEC_JIFFYDOS_BLANK
|
||||||
|
// #define CONFIG_IEC_BURST_CIA1 // please keep disabled for now
|
||||||
|
// #define CONFIG_IEC_BURST_CIA2 // please keep disabled for now
|
||||||
|
// #define CONFIG_IEC_BURST_SOFT // please keep disabled for now
|
||||||
|
|
||||||
#define CONFIG_TAPE_NORMAL
|
#define CONFIG_TAPE_NORMAL
|
||||||
#define CONFIG_TAPE_TURBO
|
#define CONFIG_TAPE_TURBO
|
||||||
|
|
||||||
// #define CONFIG_RS232_UP2400 // please keep disabled for now
|
// #define CONFIG_RS232_UP2400 // please keep disabled for now
|
||||||
// #define CONFIG_RS232_UP9600 // please keep disabled for now
|
// #define CONFIG_RS232_UP9600 // please keep disabled for now
|
||||||
|
|
||||||
|
|
||||||
// Multiple SID support
|
// Multiple SID support
|
||||||
|
|||||||
@@ -42,10 +42,10 @@
|
|||||||
// I/O devices
|
// I/O devices
|
||||||
|
|
||||||
#define CONFIG_IEC
|
#define CONFIG_IEC
|
||||||
#define CONFIG_IEC_BLANK_SCREEN
|
|
||||||
#define CONFIG_IEC_DOLPHINDOS
|
#define CONFIG_IEC_DOLPHINDOS
|
||||||
#define CONFIG_IEC_DOLPHINDOS_FAST
|
#define CONFIG_IEC_DOLPHINDOS_FAST
|
||||||
#define CONFIG_IEC_JIFFYDOS
|
#define CONFIG_IEC_JIFFYDOS
|
||||||
|
#define CONFIG_IEC_JIFFYDOS_BLANK
|
||||||
|
|
||||||
#define CONFIG_TAPE_NORMAL
|
#define CONFIG_TAPE_NORMAL
|
||||||
#define CONFIG_TAPE_TURBO
|
#define CONFIG_TAPE_TURBO
|
||||||
|
|||||||
@@ -42,10 +42,10 @@
|
|||||||
// I/O devices
|
// I/O devices
|
||||||
|
|
||||||
#define CONFIG_IEC
|
#define CONFIG_IEC
|
||||||
#define CONFIG_IEC_BLANK_SCREEN
|
|
||||||
// #define CONFIG_IEC_DOLPHINDOS
|
// #define CONFIG_IEC_DOLPHINDOS
|
||||||
// #define CONFIG_IEC_DOLPHINDOS_FAST
|
// #define CONFIG_IEC_DOLPHINDOS_FAST
|
||||||
#define CONFIG_IEC_JIFFYDOS
|
#define CONFIG_IEC_JIFFYDOS
|
||||||
|
#define CONFIG_IEC_JIFFYDOS_BLANK
|
||||||
|
|
||||||
// #define CONFIG_TAPE_NORMAL
|
// #define CONFIG_TAPE_NORMAL
|
||||||
// #define CONFIG_TAPE_TURBO
|
// #define CONFIG_TAPE_TURBO
|
||||||
|
|||||||
@@ -42,10 +42,10 @@
|
|||||||
// I/O devices
|
// I/O devices
|
||||||
|
|
||||||
#define CONFIG_IEC
|
#define CONFIG_IEC
|
||||||
// #define CONFIG_IEC_BLANK_SCREEN
|
|
||||||
#define CONFIG_IEC_DOLPHINDOS
|
#define CONFIG_IEC_DOLPHINDOS
|
||||||
// #define CONFIG_IEC_DOLPHINDOS_FAST
|
// #define CONFIG_IEC_DOLPHINDOS_FAST
|
||||||
#define CONFIG_IEC_JIFFYDOS
|
#define CONFIG_IEC_JIFFYDOS
|
||||||
|
// #define CONFIG_IEC_JIFFYDOS_BLANK
|
||||||
|
|
||||||
// #define CONFIG_TAPE_NORMAL
|
// #define CONFIG_TAPE_NORMAL
|
||||||
#define CONFIG_TAPE_TURBO
|
#define CONFIG_TAPE_TURBO
|
||||||
|
|||||||
@@ -42,10 +42,10 @@
|
|||||||
// I/O devices
|
// I/O devices
|
||||||
|
|
||||||
#define CONFIG_IEC
|
#define CONFIG_IEC
|
||||||
#define CONFIG_IEC_BLANK_SCREEN
|
|
||||||
#define CONFIG_IEC_DOLPHINDOS
|
#define CONFIG_IEC_DOLPHINDOS
|
||||||
#define CONFIG_IEC_DOLPHINDOS_FAST
|
#define CONFIG_IEC_DOLPHINDOS_FAST
|
||||||
#define CONFIG_IEC_JIFFYDOS
|
#define CONFIG_IEC_JIFFYDOS
|
||||||
|
#define CONFIG_IEC_JIFFYDOS_BLANK
|
||||||
|
|
||||||
#define CONFIG_TAPE_NORMAL
|
#define CONFIG_TAPE_NORMAL
|
||||||
#define CONFIG_TAPE_TURBO
|
#define CONFIG_TAPE_TURBO
|
||||||
|
|||||||
@@ -112,10 +112,15 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Check that I/O configuration is correct
|
|
||||||
|
// Check that IEC configuration is correct
|
||||||
{
|
{
|
||||||
#if CONFIG_RS232_UP9600 && (CONFIG_TAPE_NORMAL || CONFIG_TAPE_TURBO)
|
#if CONFIG_IEC_JIFFYDOS && !CONFIG_IEC
|
||||||
.error "CONFIG_RS232_UP9600 is not compatible with CONFIG_TAPE_*"
|
.error "CONFIG_IEC_JIFFYDOS requires CONFIG_IEC"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if CONFIG_IEC_JIFFYDOS_BLANK && !CONFIG_IEC_JIFFYDOS
|
||||||
|
.error "CONFIG_IEC_JIFFYDOS_BLANK requires CONFIG_IEC_JIFFYDOS"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if CONFIG_IEC_DOLPHINDOS && !CONFIG_IEC
|
#if CONFIG_IEC_DOLPHINDOS && !CONFIG_IEC
|
||||||
@@ -126,8 +131,35 @@
|
|||||||
.error "CONFIG_IEC_DOLPHINDOS_FAST requires CONFIG_IEC_DOLPHINDOS"
|
.error "CONFIG_IEC_DOLPHINDOS_FAST requires CONFIG_IEC_DOLPHINDOS"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if CONFIG_IEC_JIFFYDOS && !CONFIG_IEC
|
#if (CONFIG_IEC_BURST_CIA1 || CONFIG_IEC_BURST_CIA1 || CONFIG_IEC_BURST_SOFT) && !CONFIG_IEC
|
||||||
.error "CONFIG_IEC_JIFFYDOS requires CONFIG_IEC"
|
.error "CONFIG_IEC_BURST_* requires CONFIG_IEC"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if CONFIG_IEC_BURST_SOFT && !CONFIG_MB_MEGA_65
|
||||||
|
.error "CONFIG_IEC_BURST_SOFT requires CONFIG_MB_MEGA_65"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
.var selected_iec_burst = 0;
|
||||||
|
|
||||||
|
#if CONFIG_IEC_BURST_CIA1
|
||||||
|
.eval selected_iec_burst++
|
||||||
|
#endif
|
||||||
|
#if CONFIG_IEC_BURST_CIA2
|
||||||
|
.eval selected_iec_burst++
|
||||||
|
#endif
|
||||||
|
#if CONFIG_IEC_BURST_SOFT
|
||||||
|
.eval selected_iec_burst++
|
||||||
|
#endif
|
||||||
|
|
||||||
|
.if (selected_iec_burst > 1) .error "Please select at most one CONFIG_IEC_BURST_* option"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Check that RS-232 configuration is correct
|
||||||
|
{
|
||||||
|
#if CONFIG_RS232_UP9600 && (CONFIG_TAPE_NORMAL || CONFIG_TAPE_TURBO)
|
||||||
|
.error "CONFIG_RS232_UP9600 is not compatible with CONFIG_TAPE_*"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
.var selected_rs232 = 0;
|
.var selected_rs232 = 0;
|
||||||
@@ -143,6 +175,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Check that startup banner configuration is correct
|
// Check that startup banner configuration is correct
|
||||||
{
|
{
|
||||||
.var selected = 0;
|
.var selected = 0;
|
||||||
@@ -322,13 +355,22 @@
|
|||||||
|
|
||||||
#if CONFIG_IEC
|
#if CONFIG_IEC
|
||||||
.var iec_features_str = "IEC"
|
.var iec_features_str = "IEC"
|
||||||
|
#if CONFIG_IEC_BURST_CIA1
|
||||||
|
.eval iec_features_str = iec_features_str + " BURST1"
|
||||||
|
#endif
|
||||||
|
#if CONFIG_IEC_BURST_CIA2
|
||||||
|
.eval iec_features_str = iec_features_str + " BURST2"
|
||||||
|
#endif
|
||||||
|
#if CONFIG_IEC_BURST_SOFT
|
||||||
|
.eval iec_features_str = iec_features_str + " BURST"
|
||||||
|
#endif
|
||||||
#if CONFIG_IEC_DOLPHINDOS
|
#if CONFIG_IEC_DOLPHINDOS
|
||||||
.eval iec_features_str = iec_features_str + " DOLPHIN"
|
.eval iec_features_str = iec_features_str + " DOLPHIN"
|
||||||
#endif
|
#endif
|
||||||
#if CONFIG_IEC_JIFFYDOS
|
#if CONFIG_IEC_JIFFYDOS
|
||||||
.eval iec_features_str = iec_features_str + " JIFFY"
|
.eval iec_features_str = iec_features_str + " JIFFY"
|
||||||
#endif
|
#endif
|
||||||
#if !CONFIG_IEC_DOLPHINDOS && !CONFIG_IEC_JIFFYDOS
|
#if !CONFIG_IEC_BURST_CIA1 && !CONFIG_IEC_BURST_CIA2 && !CONFIG_IEC_BURST_SOFT && !CONFIG_IEC_DOLPHINDOS && !CONFIG_IEC_JIFFYDOS
|
||||||
.eval iec_features_str = iec_features_str + " NORMAL"
|
.eval iec_features_str = iec_features_str + " NORMAL"
|
||||||
#endif
|
#endif
|
||||||
.eval features_str = ADD_FEATURE(features_str, iec_features_str)
|
.eval features_str = ADD_FEATURE(features_str, iec_features_str)
|
||||||
|
|||||||
@@ -103,7 +103,7 @@
|
|||||||
.label PTR1 = $9E // -- NOT IMPLEMENTED --
|
.label PTR1 = $9E // -- NOT IMPLEMENTED --
|
||||||
.label PTR2 = $9F // -- NOT IMPLEMENTED --
|
.label PTR2 = $9F // -- NOT IMPLEMENTED --
|
||||||
.label TIME = $A0 // $A0-$A2 jiffy clock
|
.label TIME = $A0 // $A0-$A2 jiffy clock
|
||||||
#if !CONFIG_IEC_JIFFYDOS && !CONFIG_IEC_DOLPHINDOS
|
#if !CONFIG_IEC_JIFFYDOS && !CONFIG_IEC_DOLPHINDOS && !CONFIG_IEC_BURST_CIA1 && !CONFIG_IEC_BURST_CIA2 && !CONFIG_IEC_BURST_SOFT
|
||||||
.label TSFCNT = $A3 // temporary variable for tape and IEC, [!] our usage differs
|
.label TSFCNT = $A3 // temporary variable for tape and IEC, [!] our usage differs
|
||||||
#else
|
#else
|
||||||
.label IECPROTO = $A3 // -- WIP -- [!] 0 = normal, 1 = JiffyDOS, >= $80 for unknown
|
.label IECPROTO = $A3 // -- WIP -- [!] 0 = normal, 1 = JiffyDOS, >= $80 for unknown
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
|
||||||
|
//
|
||||||
|
// Values for IRQ generation timer - original idea was:
|
||||||
|
//
|
||||||
|
// (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
|
||||||
|
|
||||||
|
// Current values selected on the following assumptions:
|
||||||
|
//
|
||||||
|
// 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
|
||||||
|
//
|
||||||
|
// 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
|
||||||
|
|
||||||
|
|
||||||
|
irq_timing_hi: // high bytes
|
||||||
|
|
||||||
|
.byte >17045 // NTSC
|
||||||
|
.byte >16421 // PAL
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
|
||||||
|
//
|
||||||
|
// Values for IRQ generation timer - original idea was:
|
||||||
|
//
|
||||||
|
// (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
|
||||||
|
|
||||||
|
// Current values selected on the following assumptions:
|
||||||
|
//
|
||||||
|
// 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
|
||||||
|
//
|
||||||
|
// 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
|
||||||
|
|
||||||
|
|
||||||
|
irq_timing_lo: // low bytes
|
||||||
|
|
||||||
|
.byte <17045 // NTSC
|
||||||
|
.byte <16421 // PAL
|
||||||
@@ -17,13 +17,19 @@ iec_cmd_open: // similar to TKSA, but without turnaround
|
|||||||
!:
|
!:
|
||||||
ora #$F0
|
ora #$F0
|
||||||
|
|
||||||
#if CONFIG_IEC_DOLPHINDOS
|
#if CONFIG_IEC_DOLPHINDOS || CONFIG_IEC_BURST_CIA1 || CONFIG_IEC_BURST_CIA2 || CONFIG_IEC_BURST_SOFT
|
||||||
|
|
||||||
sta TBTCNT
|
sta TBTCNT
|
||||||
jsr iec_tx_command
|
jsr iec_tx_command
|
||||||
bcs !+ // branch if error
|
bcs !+ // branch if error
|
||||||
|
|
||||||
|
#if CONFIG_IEC_DOLPHINDOS
|
||||||
jsr dolphindos_detect
|
jsr dolphindos_detect
|
||||||
|
#endif
|
||||||
|
#if CONFIG_IEC_BURST_CIA1 || CONFIG_IEC_BURST_CIA2 || CONFIG_IEC_BURST_SOFT
|
||||||
|
jsr burst_detect
|
||||||
|
#endif
|
||||||
|
|
||||||
jmp iec_tx_command_finalize
|
jmp iec_tx_command_finalize
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Common routines for multiple IEC fact protocols
|
// Common EAL update routine
|
||||||
//
|
//
|
||||||
|
|
||||||
|
|
||||||
@@ -63,9 +63,10 @@ load_iec:
|
|||||||
bcs load_iec_error
|
bcs load_iec_error
|
||||||
|
|
||||||
#if CONFIG_IEC_DOLPHINDOS
|
#if CONFIG_IEC_DOLPHINDOS
|
||||||
|
|
||||||
jsr dolphindos_detect
|
jsr dolphindos_detect
|
||||||
|
#endif
|
||||||
|
#if CONFIG_IEC_BURST_CIA1 || CONFIG_IEC_BURST_CIA2 || CONFIG_IEC_BURST_SOFT
|
||||||
|
jsr burst_detect
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// We are currently talker, so do the IEC turn around so that we
|
// We are currently talker, so do the IEC turn around so that we
|
||||||
|
|||||||
@@ -45,9 +45,10 @@ save_iec:
|
|||||||
bcs save_iec_dev_not_found
|
bcs save_iec_dev_not_found
|
||||||
|
|
||||||
#if CONFIG_IEC_DOLPHINDOS
|
#if CONFIG_IEC_DOLPHINDOS
|
||||||
|
|
||||||
jsr dolphindos_detect
|
jsr dolphindos_detect
|
||||||
|
#endif
|
||||||
|
#if CONFIG_IEC_BURST_CIA1 || CONFIG_IEC_BURST_CIA2 || CONFIG_IEC_BURST_SOFT
|
||||||
|
jsr burst_detect
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Save start address
|
// Save start address
|
||||||
|
|||||||
@@ -0,0 +1,31 @@
|
|||||||
|
|
||||||
|
//
|
||||||
|
// Helper routine for burst IEC protocol support
|
||||||
|
//
|
||||||
|
|
||||||
|
//
|
||||||
|
// Based on idea by Pasi 'Albert' Ojala
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
#if CONFIG_IEC_BURST_CIA1
|
||||||
|
|
||||||
|
|
||||||
|
burst_detect:
|
||||||
|
|
||||||
|
#if CONFIG_IEC_JIFFYDOS || CONFIG_IEC_DOLPHINDOS
|
||||||
|
|
||||||
|
lda IECPROTO
|
||||||
|
bmi !+
|
||||||
|
bne burst_detect_fail // skip if other protocol already detected
|
||||||
|
!:
|
||||||
|
#endif
|
||||||
|
|
||||||
|
panic #$FF // XXX implement this
|
||||||
|
|
||||||
|
burst_detect_fail:
|
||||||
|
|
||||||
|
rts
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
|
||||||
|
//
|
||||||
|
// Helper routine for burst IEC protocol support
|
||||||
|
//
|
||||||
|
|
||||||
|
//
|
||||||
|
// Based on idea by Pasi 'Albert' Ojala
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
#if CONFIG_IEC_BURST_CIA2
|
||||||
|
|
||||||
|
|
||||||
|
burst_detect:
|
||||||
|
|
||||||
|
#if CONFIG_IEC_JIFFYDOS || CONFIG_IEC_DOLPHINDOS
|
||||||
|
|
||||||
|
lda IECPROTO
|
||||||
|
bmi !+
|
||||||
|
bne burst_detect_fail // skip if other protocol already detected
|
||||||
|
!:
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// For extra safety, do it on disabled interupts
|
||||||
|
php
|
||||||
|
sei
|
||||||
|
|
||||||
|
// Set the clock rate to the fastest possible
|
||||||
|
ldy #$01
|
||||||
|
sty CIA2_TIMALO
|
||||||
|
dey
|
||||||
|
sty CIA2_TIMAHI
|
||||||
|
|
||||||
|
// Prepare registers for transfer
|
||||||
|
lda #$C1
|
||||||
|
sta CIA2_CRA // start timer A, serial out, TOD 50Hz
|
||||||
|
bit CIA2_ICR // clear interrupt register
|
||||||
|
|
||||||
|
// Send test byte
|
||||||
|
lda #$FF // $FF keeps DATA released, see https://www.c64-wiki.com/wiki/Fast_serial_bus_protocol
|
||||||
|
sta CIA2_SDR
|
||||||
|
|
||||||
|
// Wait until byte sent
|
||||||
|
lda #$08 // interrupt mask
|
||||||
|
!:
|
||||||
|
bit CIA2_ICR
|
||||||
|
beq !-
|
||||||
|
|
||||||
|
// Now see if we get any byte back
|
||||||
|
|
||||||
|
lda CIA2_SDR // XXX we do not need a value, we need to know if it was received
|
||||||
|
|
||||||
|
|
||||||
|
panic #$00 // XXX finish this routine
|
||||||
|
|
||||||
|
|
||||||
|
plp
|
||||||
|
|
||||||
|
// FALLTROUGH
|
||||||
|
|
||||||
|
burst_detect_fail:
|
||||||
|
|
||||||
|
rts
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
|
||||||
|
//
|
||||||
|
// Helper routine for burst IEC protocol support
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
#if CONFIG_IEC_BURST_SOFT
|
||||||
|
|
||||||
|
|
||||||
|
burst_detect:
|
||||||
|
|
||||||
|
#if CONFIG_IEC_JIFFYDOS || CONFIG_IEC_DOLPHINDOS
|
||||||
|
|
||||||
|
lda IECPROTO
|
||||||
|
bmi !+
|
||||||
|
bne burst_detect_fail // skip if other protocol already detected
|
||||||
|
!:
|
||||||
|
#endif
|
||||||
|
|
||||||
|
panic #$FF // XXX implement this
|
||||||
|
|
||||||
|
burst_detect_fail:
|
||||||
|
|
||||||
|
rts
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -20,7 +20,7 @@ jiffydos_load:
|
|||||||
// Timing is critical, do not allow interrupts
|
// Timing is critical, do not allow interrupts
|
||||||
sei
|
sei
|
||||||
|
|
||||||
#if CONFIG_IEC_BLANK_SCREEN
|
#if CONFIG_IEC_JIFFYDOS_BLANK
|
||||||
|
|
||||||
// Preserve register with screen status (blank/visibe)
|
// Preserve register with screen status (blank/visibe)
|
||||||
lda VIC_SCROLY
|
lda VIC_SCROLY
|
||||||
@@ -57,7 +57,7 @@ jiffydos_load_loop:
|
|||||||
lda CIA2_PRA
|
lda CIA2_PRA
|
||||||
and #$FF - BIT_CIA2_PRA_DAT_OUT // release
|
and #$FF - BIT_CIA2_PRA_DAT_OUT // release
|
||||||
|
|
||||||
#if CONFIG_IEC_BLANK_SCREEN
|
#if CONFIG_IEC_JIFFYDOS_BLANK
|
||||||
|
|
||||||
// It seems JiffyDOS needs some time here; waste few cycles
|
// It seems JiffyDOS needs some time here; waste few cycles
|
||||||
nop
|
nop
|
||||||
@@ -143,7 +143,7 @@ jiffydos_load_end:
|
|||||||
lda #$01
|
lda #$01
|
||||||
sta IECPROTO
|
sta IECPROTO
|
||||||
|
|
||||||
#if CONFIG_IEC_BLANK_SCREEN
|
#if CONFIG_IEC_JIFFYDOS_BLANK
|
||||||
|
|
||||||
// Restore screen state
|
// Restore screen state
|
||||||
lda TBTCNT
|
lda TBTCNT
|
||||||
|
|||||||
@@ -110,8 +110,6 @@ IOINIT:
|
|||||||
lda #$3F
|
lda #$3F
|
||||||
sta CIA2_DDRA // $DD02
|
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???
|
// XXX how to initialize these timers???
|
||||||
// stx CIA1_CRB // $DC0F
|
// stx CIA1_CRB // $DC0F
|
||||||
// stx CIA2_CRA // $DD0E
|
// 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
|
ldx #%00000111 // XXX adapt this to IEC idle state, JMP at the end won't be needed
|
||||||
stx CIA2_PRA // $DD00
|
stx CIA2_PRA // $DD00
|
||||||
|
|
||||||
//
|
// Put something sane in the IRQ timer
|
||||||
|
jsr setup_irq_timer
|
||||||
ldy #<16421
|
|
||||||
ldx #>16421
|
|
||||||
|
|
||||||
sty CIA1_TIMALO // $DC04
|
|
||||||
stx CIA1_TIMAHI // $DC05
|
|
||||||
|
|
||||||
// Enable timer A to run continuously (http://codebase64.org/doku.php?id=base:timerinterrupts)
|
// Enable timer A to run continuously (http://codebase64.org/doku.php?id=base:timerinterrupts)
|
||||||
ldx #$11
|
ldx #$11
|
||||||
|
|||||||
@@ -23,43 +23,39 @@ setup_pal_ntsc:
|
|||||||
|
|
||||||
setup_pal:
|
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
|
lda #$01
|
||||||
|
skip_2_bytes_trash_nvz
|
||||||
|
|
||||||
|
// FALLTROUGH
|
||||||
|
|
||||||
|
setup_ntsc:
|
||||||
|
|
||||||
|
lda #$00
|
||||||
|
|
||||||
// FALLTROUGH
|
// FALLTROUGH
|
||||||
|
|
||||||
setup_pal_ntsc_end:
|
setup_pal_ntsc_end:
|
||||||
|
|
||||||
sty CIA1_TIMALO // $DC04
|
|
||||||
stx CIA1_TIMAHI // $DC05
|
|
||||||
|
|
||||||
sta TVSFLG
|
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
|
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
|
|
||||||
Reference in new issue
Block a user