From 303638912544d5d2cc88e29e510836dda7218435 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kim=20J=C3=B8rgensen?= Date: Sat, 24 Apr 2021 12:16:06 +0200 Subject: [PATCH] Add Prophet64 support --- README.md | 1 + firmware/cartridges/cartridge.c | 4 +++ firmware/cartridges/prophet64.c | 57 +++++++++++++++++++++++++++++++++ 3 files changed, 62 insertions(+) create mode 100644 firmware/cartridges/prophet64.c diff --git a/README.md b/README.md index 6e63e3c..d6bcf32 100644 --- a/README.md +++ b/README.md @@ -40,6 +40,7 @@ The following cartridge types are currently supported: * Super Snapshot v5 * Comal-80 * EasyFlash +* Prophet64 * Freeze Frame * Freeze Machine * RGCD, Hucky diff --git a/firmware/cartridges/cartridge.c b/firmware/cartridges/cartridge.c index b7c63d8..1f85a76 100644 --- a/firmware/cartridges/cartridge.c +++ b/firmware/cartridges/cartridge.c @@ -35,6 +35,7 @@ #include "super_snapshot_5.c" #include "comal80.c" #include "easyflash.c" +#include "prophet64.c" #include "freeze_machine.c" #include "rgcd.c" @@ -96,6 +97,9 @@ static void (*crt_get_handler(uint32_t cartridge_type, bool vic_support)) (void) return ef_sdio_handler; } + case CRT_PROPHET64: + return prophet64_handler; + case CRT_FREEZE_FRAME: case CRT_FREEZE_MACHINE: return fm_handler; diff --git a/firmware/cartridges/prophet64.c b/firmware/cartridges/prophet64.c new file mode 100644 index 0000000..b66001f --- /dev/null +++ b/firmware/cartridges/prophet64.c @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2019-2021 Kim Jørgensen + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + */ + +/************************************************* +* C64 bus read callback +*************************************************/ +static inline bool prophet64_read_handler(uint32_t control, uint32_t addr) +{ + if (!(control & C64_ROML)) + { + c64_data_write(crt_ptr[addr & 0x1fff]); + return true; + } + + return false; +} + +/************************************************* +* C64 bus write callback +*************************************************/ +static inline void prophet64_write_handler(uint32_t control, uint32_t addr, uint32_t data) +{ + if (!(control & C64_IO2)) + { + crt_ptr = crt_banks[data & 0x1f]; + + if (data & 0x20) + { + // Disable cartridge + c64_crt_control(STATUS_LED_OFF|CRT_PORT_NONE); + } + else + { + // Enable cartridge + c64_crt_control(STATUS_LED_ON|CRT_PORT_8K); + } + } +} + +C64_BUS_HANDLER(prophet64)