Skip to content
This repository was archived by the owner on Dec 18, 2025. It is now read-only.

Commit 8dd0506

Browse files
authored
Merge pull request #219
Ross
2 parents bf34287 + 10fc0dd commit 8dd0506

3 files changed

Lines changed: 112 additions & 2 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ The following cartridge types are currently supported:
4242
* Magic Desk, Domark, HES Australia
4343
* Super Snapshot v5
4444
* Comal-80
45+
* Ross
4546
* EasyFlash
4647
* Prophet64
4748
* Freeze Frame

firmware/cartridges/cartridge.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2019-2023 Kim Jørgensen
2+
* Copyright (c) 2019-2025 Kim Jørgensen
33
*
44
* This software is provided 'as-is', without any express or implied
55
* warranty. In no event will the authors be held liable for any damages
@@ -44,6 +44,7 @@ static u32 freezer_state;
4444
#include "magic_desk.c"
4545
#include "super_snapshot_5.c"
4646
#include "comal80.c"
47+
#include "ross.c"
4748
#include "easyflash.c"
4849
#include "easyflash_3.c"
4950
#include "prophet64.c"
@@ -107,8 +108,10 @@ static void (*crt_get_handler(u32 cartridge_type, bool vic_support)) (void)
107108

108109
case CRT_COMAL_80:
109110
return comal80_handler;
110-
#endif
111111

112+
case CRT_ROSS:
113+
return ross_handler;
114+
#endif
112115
case CRT_OCEAN_TYPE_1:
113116
case CRT_EASYFLASH:
114117
if (cartridge_type != CRT_EASYFLASH || vic_support)
@@ -181,6 +184,10 @@ static void crt_init(DAT_CRT_HEADER *crt_header)
181184
comal80_init();
182185
break;
183186

187+
case CRT_ROSS:
188+
ross_init(crt_header);
189+
break;
190+
184191
case CRT_EASYFLASH:
185192
ef_init();
186193
break;

firmware/cartridges/ross.c

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
/*
2+
* Copyright (c) 2019-2025 Kim Jørgensen and Sven Oliver (SvOlli) Moll
3+
* Copyright (c) 2024 Vladan Nikolic
4+
*
5+
* This software is provided 'as-is', without any express or implied
6+
* warranty. In no event will the authors be held liable for any damages
7+
* arising from the use of this software.
8+
*
9+
* Permission is granted to anyone to use this software for any purpose,
10+
* including commercial applications, and to alter it and redistribute it
11+
* freely, subject to the following restrictions:
12+
*
13+
* 1. The origin of this software must not be misrepresented; you must not
14+
* claim that you wrote the original software. If you use this software
15+
* in a product, an acknowledgment in the product documentation would be
16+
* appreciated but is not required.
17+
* 2. Altered source versions must be plainly marked as such, and must not be
18+
* misrepresented as being the original software.
19+
* 3. This notice may not be removed or altered from any source distribution.
20+
*/
21+
22+
/*
23+
* The Ross cartridge supports 16 kb, 32 kb, and 64 kb ROM
24+
*
25+
* Any read or write to $DE00-$DEFF will switch banks
26+
* Any read or write to $DF00-$DFFF turns ROM off
27+
*
28+
* See https://github.com/msolajic/EX-YU_64K_C64_CART for more details
29+
*/
30+
31+
static u32 ross_bank;
32+
33+
/*************************************************
34+
* C64 bus read callback
35+
*************************************************/
36+
FORCE_INLINE bool ross_read_handler(u32 control, u32 addr)
37+
{
38+
if ((control & (C64_ROML|C64_ROMH)) != (C64_ROML|C64_ROMH))
39+
{
40+
C64_DATA_WRITE(crt_ptr[addr & 0x3fff]);
41+
return true;
42+
}
43+
44+
if (!(control & C64_IO1))
45+
{
46+
// Any read to IO1: Switch bank
47+
crt_ptr = crt_banks[ross_bank & 0x03];
48+
ross_bank >>= 2;
49+
return false;
50+
}
51+
52+
if (!(control & C64_IO2))
53+
{
54+
// Any read to IO2: Disable ROM
55+
C64_CRT_CONTROL(STATUS_LED_OFF|CRT_PORT_NONE);
56+
return false;
57+
}
58+
59+
return false;
60+
}
61+
62+
/*************************************************
63+
* C64 bus write callback
64+
*************************************************/
65+
FORCE_INLINE void ross_write_handler(u32 control, u32 addr, u32 data)
66+
{
67+
if (!(control & C64_IO1))
68+
{
69+
// Any write to IO1: Switch bank
70+
crt_ptr = crt_banks[ross_bank & 0x03];
71+
ross_bank >>= 2;
72+
return;
73+
}
74+
75+
if (!(control & C64_IO2))
76+
{
77+
// Any write to IO2: Disable ROM
78+
C64_CRT_CONTROL(STATUS_LED_OFF|CRT_PORT_NONE);
79+
return;
80+
}
81+
}
82+
83+
static void ross_init(DAT_CRT_HEADER *crt_header)
84+
{
85+
if (crt_header->banks <= 1)
86+
{
87+
// 16 kb cartridge - no bank switching
88+
ross_bank = 0;
89+
}
90+
else if (crt_header->banks == 2)
91+
{
92+
// 32 kb cartridge - 2 banks
93+
ross_bank = (1 << 4) | (0 << 2) | (1 << 0);
94+
}
95+
else
96+
{
97+
// 64 kb cartridge - 4 banks
98+
ross_bank = (3 << 4) | (2 << 2) | (1 << 0);
99+
}
100+
}
101+
102+
C64_BUS_HANDLER(ross)

0 commit comments

Comments
 (0)