-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MEGA65: allow OPL work on slow-dev space, too #380
Note, currently I don't know why the slow device space is used for OPL why not the native I/O space, or the MEGA65 specific OPL regs at $FE000xx which is intended for that very purpose! btoschi on Discord has great success to make OPL working on MEGA65 but requires this access mode, so this quick hack is intended to serve that holy purpose :)
- Loading branch information
Showing
2 changed files
with
16 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
/* A work-in-progess MEGA65 (Commodore 65 clone origins) emulator | ||
Part of the Xemu project, please visit: https://github.com/lgblgblgb/xemu | ||
Copyright (C)2016-2023 LGB (Gábor Lénárt) <[email protected]> | ||
Copyright (C)2016-2024 LGB (Gábor Lénárt) <[email protected]> | ||
This program is free software; you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
|
@@ -19,6 +19,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ | |
#include "xemu/emutools.h" | ||
#include "cart.h" | ||
#include "xemu/emutools_files.h" | ||
#include "audio65.h" | ||
|
||
static Uint8 cart_mem[0x10000]; | ||
static int loaded = 0; | ||
|
@@ -35,13 +36,25 @@ Uint8 cart_read_byte ( unsigned int addr ) | |
Uint8 data = 0xFF; | ||
if (addr < sizeof(cart_mem)) | ||
data = cart_mem[addr]; | ||
DEBUGPRINT("CART: reading byte ($%02X) at $%X" NL, data, addr + 0x4000000); | ||
if (loaded && addr != 0x3FFDF60) // see the comment about OPL at cart_write_byte() | ||
DEBUGPRINT("CART: reading byte ($%02X) at $%X" NL, data, addr + 0x4000000); | ||
return data; | ||
} | ||
|
||
|
||
void cart_write_byte ( unsigned int addr, Uint8 data ) | ||
{ | ||
if (!loaded) { | ||
// a hack OPL to be able to work in the "slow device area" [if no cartridge is loaded] | ||
static Uint8 opl_reg_sel = 0; | ||
if (addr == 0x3FFDF40) { | ||
opl_reg_sel = data; | ||
return; | ||
} else if (addr == 0x3FFDF50) { | ||
audio65_opl3_write(opl_reg_sel, data); | ||
return; | ||
} | ||
} | ||
DEBUGPRINT("CART: writing byte ($%02X) at $%X" NL, data, addr + 0x4000000); | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
/* A work-in-progess MEGA65 (Commodore 65 clone origins) emulator | ||
Part of the Xemu project, please visit: https://github.com/lgblgblgb/xemu | ||
Copyright (C)2016-2023 LGB (Gábor Lénárt) <[email protected]> | ||
Copyright (C)2016-2024 LGB (Gábor Lénárt) <[email protected]> | ||
This program is free software; you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
|
4c0a711
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also pls see MEGA65/mega65-core#232