Skip to content

Commit

Permalink
Add Prophet64 support
Browse files Browse the repository at this point in the history
  • Loading branch information
KimJorgensen committed Apr 24, 2021
1 parent 9e20022 commit 3036389
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ The following cartridge types are currently supported:
* Super Snapshot v5
* Comal-80
* EasyFlash
* Prophet64
* Freeze Frame
* Freeze Machine
* RGCD, Hucky
Expand Down
4 changes: 4 additions & 0 deletions firmware/cartridges/cartridge.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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;
Expand Down
57 changes: 57 additions & 0 deletions firmware/cartridges/prophet64.c
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit 3036389

Please sign in to comment.