From a8384bbebec14d24d892e86bd3f6a53916c75d8e Mon Sep 17 00:00:00 2001 From: jespergravgaard Date: Mon, 27 Apr 2020 00:20:53 +0200 Subject: [PATCH] Fixed CIA problems. --- src/test/kc/irq-hardware-clobber.c | 2 +- src/test/kc/irq-hardware-stack.c | 2 +- src/test/kc/irq-hardware.c | 2 +- src/test/kc/irq-kernel.c | 2 +- src/test/kc/irq-local-var-overlap-problem.c | 2 +- src/test/kc/irq-raster.c | 2 +- src/test/kc/irq-volatile-bool-problem.c | 2 +- src/test/ref/cia-timer-cyclecount.asm | 4 ++-- src/test/ref/cia-timer-cyclecount.log | 12 ++++++------ src/test/ref/examples/rotate/rotate.asm | 4 ++-- src/test/ref/examples/rotate/rotate.log | 14 +++++++------- 11 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/test/kc/irq-hardware-clobber.c b/src/test/kc/irq-hardware-clobber.c index 1d31ee524..04bfe37e4 100644 --- a/src/test/kc/irq-hardware-clobber.c +++ b/src/test/kc/irq-hardware-clobber.c @@ -35,7 +35,7 @@ void main() { *PROCPORT_DDR = PROCPORT_DDR_MEMORY_MASK; *PROCPORT = PROCPORT_RAM_IO; // Disable CIA 1 Timer IRQ - CIA1->INTERRUPT = CIA_INTERRUPT_CLEAR; + *CIA1_INTERRUPT = CIA_INTERRUPT_CLEAR; // Set raster line to $100 *VIC_CONTROL |=$80; *RASTER = $00; diff --git a/src/test/kc/irq-hardware-stack.c b/src/test/kc/irq-hardware-stack.c index 0de6c64e5..29e48f90f 100644 --- a/src/test/kc/irq-hardware-stack.c +++ b/src/test/kc/irq-hardware-stack.c @@ -35,7 +35,7 @@ void main() { *PROCPORT_DDR = PROCPORT_DDR_MEMORY_MASK; *PROCPORT = PROCPORT_RAM_IO; // Disable CIA 1 Timer IRQ - CIA1->INTERRUPT = CIA_INTERRUPT_CLEAR; + *CIA1_INTERRUPT = CIA_INTERRUPT_CLEAR; // Set raster line to $100 *VIC_CONTROL |=$80; *RASTER = $00; diff --git a/src/test/kc/irq-hardware.c b/src/test/kc/irq-hardware.c index 4eea68a34..f01489aab 100644 --- a/src/test/kc/irq-hardware.c +++ b/src/test/kc/irq-hardware.c @@ -35,7 +35,7 @@ void main() { *PROCPORT_DDR = PROCPORT_DDR_MEMORY_MASK; *PROCPORT = PROCPORT_RAM_IO; // Disable CIA 1 Timer IRQ - CIA1->INTERRUPT = CIA_INTERRUPT_CLEAR; + *CIA1_INTERRUPT = CIA_INTERRUPT_CLEAR; // Set raster line to $100 *VIC_CONTROL |=$80; *RASTER = $00; diff --git a/src/test/kc/irq-kernel.c b/src/test/kc/irq-kernel.c index cd8c61a27..f65f4aca2 100644 --- a/src/test/kc/irq-kernel.c +++ b/src/test/kc/irq-kernel.c @@ -19,7 +19,7 @@ const byte CIA_INTERRUPT_CLEAR = $7f; void main() { asm { sei } // Disable CIA 1 Timer IRQ - CIA1->INTERRUPT = CIA_INTERRUPT_CLEAR; + *CIA1_INTERRUPT = CIA_INTERRUPT_CLEAR; // Set raster line to $100 *VIC_CONTROL |=$80; *RASTER = $00; diff --git a/src/test/kc/irq-local-var-overlap-problem.c b/src/test/kc/irq-local-var-overlap-problem.c index c392861bd..df81a9efe 100644 --- a/src/test/kc/irq-local-var-overlap-problem.c +++ b/src/test/kc/irq-local-var-overlap-problem.c @@ -16,7 +16,7 @@ const byte CIA_INTERRUPT_CLEAR = $7f; void main() { asm { sei } // Disable CIA 1 Timer IRQ - CIA1->INTERRUPT = CIA_INTERRUPT_CLEAR; + *CIA1_INTERRUPT = CIA_INTERRUPT_CLEAR; // Set raster line to $0fd *VIC_CONTROL &=$7f; *RASTER = $fd; diff --git a/src/test/kc/irq-raster.c b/src/test/kc/irq-raster.c index 685d8692e..9c3f7930f 100644 --- a/src/test/kc/irq-raster.c +++ b/src/test/kc/irq-raster.c @@ -19,7 +19,7 @@ const byte CIA_INTERRUPT_CLEAR = $7f; void main() { asm { sei } // Disable CIA 1 Timer IRQ - CIA1->INTERRUPT = CIA_INTERRUPT_CLEAR; + *CIA1_INTERRUPT = CIA_INTERRUPT_CLEAR; // Set raster line to $100 *VIC_CONTROL |=$80; *RASTER = $00; diff --git a/src/test/kc/irq-volatile-bool-problem.c b/src/test/kc/irq-volatile-bool-problem.c index cc8d3e1ea..113956331 100644 --- a/src/test/kc/irq-volatile-bool-problem.c +++ b/src/test/kc/irq-volatile-bool-problem.c @@ -16,7 +16,7 @@ const byte CIA_INTERRUPT_CLEAR = $7f; void main() { asm { sei } // Disable CIA 1 Timer IRQ - CIA1->INTERRUPT = CIA_INTERRUPT_CLEAR; + *CIA1_INTERRUPT = CIA_INTERRUPT_CLEAR; // Set raster line to $0fd *VIC_CONTROL &=$7f; *RASTER = $fd; diff --git a/src/test/ref/cia-timer-cyclecount.asm b/src/test/ref/cia-timer-cyclecount.asm index 7c22c2991..e7435c665 100644 --- a/src/test/ref/cia-timer-cyclecount.asm +++ b/src/test/ref/cia-timer-cyclecount.asm @@ -4,6 +4,8 @@ .pc = $80d "Program" // The CIA#2: Serial bus, RS-232, VIC memory bank .label CIA2 = $dd00 + // CIA#2 timer A&B as one single 32-bit value + .label CIA2_TIMER_AB = $dd04 // Timer Control - Start/stop timer (0:stop, 1: start) .const CIA_TIMER_CONTROL_START = 1 // Timer B Control - Timer counts (00:system cycles, 01: CNT pulses, 10: timer A underflow, 11: time A underflow while CNT is high) @@ -11,8 +13,6 @@ // Clock cycles used to start & read the cycle clock by calling clock_start() and clock() once. Can be subtracted when calculating the number of cycles used by a routine. // To make precise cycle measurements interrupts and the display must be disabled so neither steals any cycles from the code. .const CLOCKS_PER_INIT = $12 - // CIA#2 timer A&B as one single 32-bit value - .label CIA2_TIMER_AB = $dd04 .label SCREEN = $400 .const OFFSET_STRUCT_MOS6526_CIA_TIMER_A_CONTROL = $e .const OFFSET_STRUCT_MOS6526_CIA_TIMER_B_CONTROL = $f diff --git a/src/test/ref/cia-timer-cyclecount.log b/src/test/ref/cia-timer-cyclecount.log index 3ad9b5cf7..947375904 100644 --- a/src/test/ref/cia-timer-cyclecount.log +++ b/src/test/ref/cia-timer-cyclecount.log @@ -616,6 +616,8 @@ Target platform is c64basic / MOS6502X // Global Constants & labels // The CIA#2: Serial bus, RS-232, VIC memory bank .label CIA2 = $dd00 + // CIA#2 timer A&B as one single 32-bit value + .label CIA2_TIMER_AB = $dd04 // Timer Control - Start/stop timer (0:stop, 1: start) .const CIA_TIMER_CONTROL_START = 1 // Timer B Control - Timer counts (00:system cycles, 01: CNT pulses, 10: timer A underflow, 11: time A underflow while CNT is high) @@ -623,8 +625,6 @@ Target platform is c64basic / MOS6502X // Clock cycles used to start & read the cycle clock by calling clock_start() and clock() once. Can be subtracted when calculating the number of cycles used by a routine. // To make precise cycle measurements interrupts and the display must be disabled so neither steals any cycles from the code. .const CLOCKS_PER_INIT = $12 - // CIA#2 timer A&B as one single 32-bit value - .label CIA2_TIMER_AB = $dd04 .label SCREEN = $400 .const OFFSET_STRUCT_MOS6526_CIA_TIMER_A_CONTROL = $e .const OFFSET_STRUCT_MOS6526_CIA_TIMER_B_CONTROL = $f @@ -1041,6 +1041,8 @@ ASSEMBLER BEFORE OPTIMIZATION // Global Constants & labels // The CIA#2: Serial bus, RS-232, VIC memory bank .label CIA2 = $dd00 + // CIA#2 timer A&B as one single 32-bit value + .label CIA2_TIMER_AB = $dd04 // Timer Control - Start/stop timer (0:stop, 1: start) .const CIA_TIMER_CONTROL_START = 1 // Timer B Control - Timer counts (00:system cycles, 01: CNT pulses, 10: timer A underflow, 11: time A underflow while CNT is high) @@ -1048,8 +1050,6 @@ ASSEMBLER BEFORE OPTIMIZATION // Clock cycles used to start & read the cycle clock by calling clock_start() and clock() once. Can be subtracted when calculating the number of cycles used by a routine. // To make precise cycle measurements interrupts and the display must be disabled so neither steals any cycles from the code. .const CLOCKS_PER_INIT = $12 - // CIA#2 timer A&B as one single 32-bit value - .label CIA2_TIMER_AB = $dd04 .label SCREEN = $400 .const OFFSET_STRUCT_MOS6526_CIA_TIMER_A_CONTROL = $e .const OFFSET_STRUCT_MOS6526_CIA_TIMER_B_CONTROL = $f @@ -1486,6 +1486,8 @@ Score: 869 // Global Constants & labels // The CIA#2: Serial bus, RS-232, VIC memory bank .label CIA2 = $dd00 + // CIA#2 timer A&B as one single 32-bit value + .label CIA2_TIMER_AB = $dd04 // Timer Control - Start/stop timer (0:stop, 1: start) .const CIA_TIMER_CONTROL_START = 1 // Timer B Control - Timer counts (00:system cycles, 01: CNT pulses, 10: timer A underflow, 11: time A underflow while CNT is high) @@ -1493,8 +1495,6 @@ Score: 869 // Clock cycles used to start & read the cycle clock by calling clock_start() and clock() once. Can be subtracted when calculating the number of cycles used by a routine. // To make precise cycle measurements interrupts and the display must be disabled so neither steals any cycles from the code. .const CLOCKS_PER_INIT = $12 - // CIA#2 timer A&B as one single 32-bit value - .label CIA2_TIMER_AB = $dd04 .label SCREEN = $400 .const OFFSET_STRUCT_MOS6526_CIA_TIMER_A_CONTROL = $e .const OFFSET_STRUCT_MOS6526_CIA_TIMER_B_CONTROL = $f diff --git a/src/test/ref/examples/rotate/rotate.asm b/src/test/ref/examples/rotate/rotate.asm index 5b6c9f0d1..51500e665 100644 --- a/src/test/ref/examples/rotate/rotate.asm +++ b/src/test/ref/examples/rotate/rotate.asm @@ -11,6 +11,8 @@ .label SPRITES_COLS = $d027 // The CIA#2: Serial bus, RS-232, VIC memory bank .label CIA2 = $dd00 + // CIA#2 timer A&B as one single 32-bit value + .label CIA2_TIMER_AB = $dd04 // Timer Control - Start/stop timer (0:stop, 1: start) .const CIA_TIMER_CONTROL_START = 1 // Timer B Control - Timer counts (00:system cycles, 01: CNT pulses, 10: timer A underflow, 11: time A underflow while CNT is high) @@ -20,8 +22,6 @@ // Clock cycles used to start & read the cycle clock by calling clock_start() and clock() once. Can be subtracted when calculating the number of cycles used by a routine. // To make precise cycle measurements interrupts and the display must be disabled so neither steals any cycles from the code. .const CLOCKS_PER_INIT = $12 - // CIA#2 timer A&B as one single 32-bit value - .label CIA2_TIMER_AB = $dd04 .const OFFSET_STRUCT_MOS6526_CIA_TIMER_A_CONTROL = $e .const OFFSET_STRUCT_MOS6526_CIA_TIMER_B_CONTROL = $f .label SCREEN = $400 diff --git a/src/test/ref/examples/rotate/rotate.log b/src/test/ref/examples/rotate/rotate.log index 283145aff..b216fd58f 100644 --- a/src/test/ref/examples/rotate/rotate.log +++ b/src/test/ref/examples/rotate/rotate.log @@ -1135,11 +1135,11 @@ Simplifying constant pointer cast (byte*) 53269 Simplifying constant pointer cast (byte*) 53280 Simplifying constant pointer cast (byte*) 53287 Simplifying constant pointer cast (struct MOS6526_CIA*) 56576 +Simplifying constant pointer cast (dword*) 56580 Simplifying constant pointer cast (byte*) 253 Simplifying constant pointer cast (byte*) 254 Simplifying constant pointer cast (byte*) 255 Simplifying constant pointer cast (signed byte*) 253 -Simplifying constant pointer cast (dword*) 56580 Simplifying constant pointer cast (byte*) 1024 Simplifying constant integer cast $40 Simplifying constant pointer cast (byte*) 12288 @@ -2265,6 +2265,8 @@ Target platform is c64basic / MOS6502X .label SPRITES_COLS = $d027 // The CIA#2: Serial bus, RS-232, VIC memory bank .label CIA2 = $dd00 + // CIA#2 timer A&B as one single 32-bit value + .label CIA2_TIMER_AB = $dd04 // Timer Control - Start/stop timer (0:stop, 1: start) .const CIA_TIMER_CONTROL_START = 1 // Timer B Control - Timer counts (00:system cycles, 01: CNT pulses, 10: timer A underflow, 11: time A underflow while CNT is high) @@ -2274,8 +2276,6 @@ Target platform is c64basic / MOS6502X // Clock cycles used to start & read the cycle clock by calling clock_start() and clock() once. Can be subtracted when calculating the number of cycles used by a routine. // To make precise cycle measurements interrupts and the display must be disabled so neither steals any cycles from the code. .const CLOCKS_PER_INIT = $12 - // CIA#2 timer A&B as one single 32-bit value - .label CIA2_TIMER_AB = $dd04 .const OFFSET_STRUCT_MOS6526_CIA_TIMER_A_CONTROL = $e .const OFFSET_STRUCT_MOS6526_CIA_TIMER_B_CONTROL = $f .label SCREEN = $400 @@ -3732,6 +3732,8 @@ ASSEMBLER BEFORE OPTIMIZATION .label SPRITES_COLS = $d027 // The CIA#2: Serial bus, RS-232, VIC memory bank .label CIA2 = $dd00 + // CIA#2 timer A&B as one single 32-bit value + .label CIA2_TIMER_AB = $dd04 // Timer Control - Start/stop timer (0:stop, 1: start) .const CIA_TIMER_CONTROL_START = 1 // Timer B Control - Timer counts (00:system cycles, 01: CNT pulses, 10: timer A underflow, 11: time A underflow while CNT is high) @@ -3741,8 +3743,6 @@ ASSEMBLER BEFORE OPTIMIZATION // Clock cycles used to start & read the cycle clock by calling clock_start() and clock() once. Can be subtracted when calculating the number of cycles used by a routine. // To make precise cycle measurements interrupts and the display must be disabled so neither steals any cycles from the code. .const CLOCKS_PER_INIT = $12 - // CIA#2 timer A&B as one single 32-bit value - .label CIA2_TIMER_AB = $dd04 .const OFFSET_STRUCT_MOS6526_CIA_TIMER_A_CONTROL = $e .const OFFSET_STRUCT_MOS6526_CIA_TIMER_B_CONTROL = $f .label SCREEN = $400 @@ -5146,6 +5146,8 @@ Score: 30994 .label SPRITES_COLS = $d027 // The CIA#2: Serial bus, RS-232, VIC memory bank .label CIA2 = $dd00 + // CIA#2 timer A&B as one single 32-bit value + .label CIA2_TIMER_AB = $dd04 // Timer Control - Start/stop timer (0:stop, 1: start) .const CIA_TIMER_CONTROL_START = 1 // Timer B Control - Timer counts (00:system cycles, 01: CNT pulses, 10: timer A underflow, 11: time A underflow while CNT is high) @@ -5155,8 +5157,6 @@ Score: 30994 // Clock cycles used to start & read the cycle clock by calling clock_start() and clock() once. Can be subtracted when calculating the number of cycles used by a routine. // To make precise cycle measurements interrupts and the display must be disabled so neither steals any cycles from the code. .const CLOCKS_PER_INIT = $12 - // CIA#2 timer A&B as one single 32-bit value - .label CIA2_TIMER_AB = $dd04 .const OFFSET_STRUCT_MOS6526_CIA_TIMER_A_CONTROL = $e .const OFFSET_STRUCT_MOS6526_CIA_TIMER_B_CONTROL = $f .label SCREEN = $400