From 8bb20973397c9992c99191a1f943c5c0d9b32534 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Wed, 5 Sep 2018 22:17:28 +0100 Subject: [PATCH] rc2014: move CTC The CF card is partial decode so shadows 0x90 as well as 0x10. Use 0x88 instead --- Kernel/platform-rc2014/kernel.def | 8 ++++---- Kernel/platform-rc2014/rc2014.s | 30 ++++++++++++++++++------------ 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/Kernel/platform-rc2014/kernel.def b/Kernel/platform-rc2014/kernel.def index 5371e15a..881eece1 100644 --- a/Kernel/platform-rc2014/kernel.def +++ b/Kernel/platform-rc2014/kernel.def @@ -23,10 +23,10 @@ VFD_C .EQU 0 ; control register VFD_D .EQU 1 ; data register ; Z80 CTC ports -CTC_CH0 .equ 0x90 ; CTC channel 0 and interrupt vector -CTC_CH1 .equ 0x91 ; CTC channel 1 (periodic interrupts) -CTC_CH2 .equ 0x92 ; CTC channel 2 -CTC_CH3 .equ 0x93 ; CTC channel 3 +CTC_CH0 .equ 0x88 ; CTC channel 0 and interrupt vector +CTC_CH1 .equ 0x89 ; CTC channel 1 (periodic interrupts) +CTC_CH2 .equ 0x8A ; CTC channel 2 +CTC_CH3 .equ 0x8B ; CTC channel 3 ; 37C65 FDC ports FDC_CCR .equ 0x48 ; Configuration Control Register (W/O) diff --git a/Kernel/platform-rc2014/rc2014.s b/Kernel/platform-rc2014/rc2014.s index 5c3fc30f..29178ff6 100644 --- a/Kernel/platform-rc2014/rc2014.s +++ b/Kernel/platform-rc2014/rc2014.s @@ -189,18 +189,24 @@ init_partial_uart: ; --------------------------------------------------------------------- ; Initialize CTC - ; Only supported for SIO, since CTC must operate in IM2. - ; If you don't have a CTC probably nothing bad will happen, other than - ; your floppy not working. - -; ld a,#0x57 ; counter mode, disable interrupts -; out (CTC_CH0),a ; set CH0 mode -; ld a,#0 ; time constant = 256 -; out (CTC_CH0),a ; set CH0 time constant -; ld a,#0xC7 ; counter mode, enable interrupts -; out (CTC_CH1),a ; set CH1 mode -; ld a,#180 ; time constant = 180 -; out (CTC_CH1),a ; set CH1 time constant + ; + ; We must initialize all channels of the CTC. The documentation + ; states that the initial CTC state is undefined and we don't want + ; random interrupt surprises + ; --------------------------------------------------------------------- + + ld a,#0x57 ; counter mode, disable interrupts + out (CTC_CH0),a ; set CH0 mode + ld a,#0 ; time constant = 256 + out (CTC_CH0),a ; set CH0 time constant + ld a,#0x57 ; counter mode, FIXME C7 enable interrupts + out (CTC_CH1),a ; set CH1 mode + ld a,#180 ; time constant = 180 + out (CTC_CH1),a ; set CH1 time constant + ld a,#0x57 ; counter mode, disable interrupts + out (CTC_CH2),a ; set CH2 mode + ld a,#0x57 ; counter mode, disable interrupts + out (CTC_CH3),a ; set CH3 mode ; Done CTC Stuff ; --------------------------------------------------------------------- -- 2.34.1