From 205ce4eb6c5fe08f9b263f40e73717481146b1d2 Mon Sep 17 00:00:00 2001 From: Jesper Gravgaard Date: Mon, 14 Dec 2020 13:33:10 +0100 Subject: [PATCH] Added 6522 VIA#1 and VIA#1 to CX16. #581 --- src/main/kc/include/cx16.h | 21 +++++++++++++++++++++ src/test/ref/examples/cx16/rasterbars.log | 2 ++ 2 files changed, 23 insertions(+) diff --git a/src/main/kc/include/cx16.h b/src/main/kc/include/cx16.h index 325e376c4..76436de25 100644 --- a/src/main/kc/include/cx16.h +++ b/src/main/kc/include/cx16.h @@ -3,6 +3,27 @@ // https://github.com/commanderx16/x16-docs/blob/master/Commander%20X16%20Programmer's%20Reference%20Guide.md #include +#include + +// The VIA#1: ROM/RAM Bank Control +// Port A Bits 0-7 RAM bank +// Port B Bits 0-2 ROM bank +// Port B Bits 3-7 [TBD] +struct MOS6522_VIA * const VIA1 = 0x9160; +// The VIA#2: Keyboard/Joy/Mouse +// Port A Bit 0 KBD PS/2 DAT +// Port A Bit 1 KBD PS/2 CLK +// Port A Bit 2 [TBD] +// Port A Bit 3 JOY1/2 LATCH +// Port A Bit 4 JOY1 DATA +// Port A Bit 5 JOY1/2 CLK +// Port A Bit 6 JOY2 DATA +// Port A Bit 7 [TBD] +// Port B Bit 0 MOUSE PS/2 DAT +// Port B Bit 1 MOUSE PS/2 CLK +// Port B Bits 2-7 [TBD] +// NOTE: The pin assignment of the NES/SNES controller is likely to change. +struct MOS6522_VIA * const VIA2 = 0x9070; // Interrupt Vectors // https://github.com/commanderx16/x16-emulator/wiki/(ASM-Programming)-Interrupts-and-interrupt-handling diff --git a/src/test/ref/examples/cx16/rasterbars.log b/src/test/ref/examples/cx16/rasterbars.log index a2ce765ad..419d39954 100644 --- a/src/test/ref/examples/cx16/rasterbars.log +++ b/src/test/ref/examples/cx16/rasterbars.log @@ -394,11 +394,13 @@ Potential registers zp[1]:6 [ cnt ] : zp[1]:6 , REGISTER UPLIFT SCOPES Uplift Scope [irq_zero] 353.5: zp[1]:3 [ irq_zero::i#2 irq_zero::i#1 ] 29.33: zp[1]:2 [ irq_zero::l#2 irq_zero::l#1 ] Uplift Scope [] 0.71: zp[1]:6 [ cnt ] 0.59: zp[1]:4 [ hstart ] 0.44: zp[1]:5 [ hstop ] +Uplift Scope [MOS6522_VIA] Uplift Scope [main] Uplift Scope [__start] Uplifting [irq_zero] best 2323 combination reg byte a [ irq_zero::i#2 irq_zero::i#1 ] reg byte x [ irq_zero::l#2 irq_zero::l#1 ] Uplifting [] best 2323 combination zp[1]:6 [ cnt ] zp[1]:4 [ hstart ] zp[1]:5 [ hstop ] +Uplifting [MOS6522_VIA] best 2323 combination Uplifting [main] best 2323 combination Uplifting [__start] best 2323 combination Attempting to uplift remaining variables inzp[1]:6 [ cnt ]