mirror of
https://github.com/pevans/erc-c.git
synced 2024-12-21 23:29:16 +00:00
Reorganize ROM storage
This commit is contained in:
parent
6cbcf0f9ab
commit
ac39349344
BIN
data/peripheral.rom
Normal file
BIN
data/peripheral.rom
Normal file
Binary file not shown.
BIN
data/zeropad1k.rom
Normal file
BIN
data/zeropad1k.rom
Normal file
Binary file not shown.
@ -23,10 +23,13 @@
|
|||||||
(0xC000 + (n << 8))
|
(0xC000 + (n << 8))
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This is the size of any peripheral's ROM that we can hold in memory
|
* This is the total size of the ROM we hold devoted to peripherals. It
|
||||||
* (which is any page from $C100 - $C700).
|
* is meant to be mapped directly to the entire $C000..$CFFF space; it's
|
||||||
|
* zero-padded for the $C0 page, and is also zero-padded in $C8..$CF;
|
||||||
|
* the latter being reserved for expansion peripheral ROM usage, and the
|
||||||
|
* former for the I/O soft switches that the Apple II has.
|
||||||
*/
|
*/
|
||||||
#define APPLE2_PERIPHERAL_SIZE 0x700
|
#define APPLE2_PERIPHERAL_SIZE 0x1000
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Peripheral ROM can only occupy a single page in memory.
|
* Peripheral ROM can only occupy a single page in memory.
|
||||||
@ -40,9 +43,10 @@
|
|||||||
#define APPLE2_SYSROM_SIZE 0x4000
|
#define APPLE2_SYSROM_SIZE 0x4000
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The size of our block of ROM is 12k
|
* The size of our block of ROM is 20k; 16k for internal ROM, 4k to
|
||||||
|
* contain all of the peripheral ROM above.
|
||||||
*/
|
*/
|
||||||
#define APPLE2_ROM_SIZE 0x3000
|
#define APPLE2_ROM_SIZE 0x5000
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* At the highest point (with the IIe extended 80 column text card), you
|
* At the highest point (with the IIe extended 80 column text card), you
|
||||||
|
@ -8,8 +8,8 @@
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char header[4];
|
char header[4];
|
||||||
vm_8bit apple2_peripheral_rom[APPLE2_PERIPHERAL_SIZE];
|
|
||||||
vm_8bit apple2_sys_rom[APPLE2_SYSROM_SIZE];
|
vm_8bit apple2_sys_rom[APPLE2_SYSROM_SIZE];
|
||||||
|
vm_8bit apple2_peripheral_rom[APPLE2_PERIPHERAL_SIZE];
|
||||||
vm_8bit apple2_sysfont[APPLE2_SYSFONT_SIZE];
|
vm_8bit apple2_sysfont[APPLE2_SYSFONT_SIZE];
|
||||||
} objstore;
|
} objstore;
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -67,25 +67,23 @@ apple2_mem_init_sys_rom(apple2 *mach)
|
|||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
const vm_8bit *sysrom;
|
const vm_8bit *sysrom;
|
||||||
|
const vm_8bit *prom;
|
||||||
|
|
||||||
sysrom = objstore_apple2_sys_rom();
|
sysrom = objstore_apple2_sys_rom();
|
||||||
|
prom = objstore_apple2_peripheral_rom();
|
||||||
|
|
||||||
// The first two kilobytes of system rom are copied into memory
|
err = vm_segment_copy_buf(mach->rom, sysrom,
|
||||||
// beginning at $C800 (which is just after all of the peripheral ROM
|
0, 0, APPLE2_SYSROM_SIZE);
|
||||||
// locations).
|
|
||||||
err = vm_segment_copy_buf(mach->main, sysrom,
|
|
||||||
0xC800, 0x800, 0x800);
|
|
||||||
if (err != OK) {
|
if (err != OK) {
|
||||||
log_critical("Could not copy apple2 system rom");
|
log_critical("Could not copy apple2 system rom");
|
||||||
return ERR_BADFILE;
|
return ERR_BADFILE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// The last 12k of sysrom (which is APPLE2_ROM_SIZE) are copied into
|
err = vm_segment_copy_buf(mach->rom, prom,
|
||||||
// the rom segment.
|
APPLE2_SYSROM_SIZE, 0,
|
||||||
err = vm_segment_copy_buf(mach->rom, sysrom,
|
APPLE2_PERIPHERAL_SIZE);
|
||||||
0, 0x1000, APPLE2_ROM_SIZE);
|
|
||||||
if (err != OK) {
|
if (err != OK) {
|
||||||
log_critical("Could not copy apple2 system rom");
|
log_critical("Could not copy apple2 peripheral rom");
|
||||||
return ERR_BADFILE;
|
return ERR_BADFILE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
40
src/apple2.pc.c
Normal file
40
src/apple2.pc.c
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
/*
|
||||||
|
* apple2.pc.c
|
||||||
|
*
|
||||||
|
* No, not "personal computer"; pc as in "peripheral card". The code
|
||||||
|
* here is all about support for peripherals in general, excusing
|
||||||
|
* support written for specific peripherals such as disk drives
|
||||||
|
* (apple2.dd.c).
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "apple2.h"
|
||||||
|
#include "vm_segment.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Map all of the peripheral ROM space (and peripheral expansion ROM
|
||||||
|
* space) to our read and write mappers for that. For reference, normal
|
||||||
|
* peripheral ROM space is $C100..$C7FF, and expansion ROM is
|
||||||
|
* $C800..$CFFF.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
apple2_pc_map(apple2 *mach, vm_segment *seg)
|
||||||
|
{
|
||||||
|
size_t addr;
|
||||||
|
|
||||||
|
for (addr = 0xC100; addr < 0xD000; addr++) {
|
||||||
|
vm_segment_read_map(seg, addr, apple2_pc_read);
|
||||||
|
vm_segment_write_map(seg, addr, apple2_pc_write);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SEGMENT_READER(apple2_pc_read)
|
||||||
|
{
|
||||||
|
apple2 *mach = (apple2 *)_mach;
|
||||||
|
|
||||||
|
if (mach->memory_mode & MEMORY_EXPROM) {
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mach->memory_mode & MEMORY_SLOTCXROM) {
|
||||||
|
segment = mach->rom;
|
||||||
|
}
|
||||||
|
}
|
@ -13,23 +13,14 @@ data = 'hope'
|
|||||||
|
|
||||||
# These must be appended in the exact order indicated by the struct definition
|
# These must be appended in the exact order indicated by the struct definition
|
||||||
# in objstore.h
|
# in objstore.h
|
||||||
data += file_data('./data/print.rom') # $C100
|
data += file_data('./data/apple2.rom') # Internal ROM ($C000..$FFFF)
|
||||||
data += file_data('./data/serial.rom') # $C200
|
data += file_data('./data/peripheral.rom') # $C000..$CFFF
|
||||||
data += file_data('./data/zeropad0x100.rom') # $C300
|
|
||||||
data += file_data('./data/zeropad0x100.rom') # $C400
|
|
||||||
data += file_data('./data/zeropad0x100.rom') # $C500
|
|
||||||
data += file_data('./data/disk2.rom') # $C600
|
|
||||||
data += file_data('./data/disk2.rom') # $C700
|
|
||||||
data += file_data('./data/apple2.rom') # $D000
|
|
||||||
data += file_data('./fonts/apple2-system.bmp')
|
data += file_data('./fonts/apple2-system.bmp')
|
||||||
|
|
||||||
# Let's not keep calling len(data) since we know it won't change over our
|
# Let's not keep calling len(data) since we know it won't change over our
|
||||||
# iterations
|
# iterations
|
||||||
data_len = len(data)
|
data_len = len(data)
|
||||||
|
|
||||||
print data_len
|
|
||||||
exit(0)
|
|
||||||
|
|
||||||
# This just defines the variable name for the store data
|
# This just defines the variable name for the store data
|
||||||
sys.stdout.write("static unsigned char store_data[] =\n")
|
sys.stdout.write("static unsigned char store_data[] =\n")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user