1
0
mirror of https://github.com/pevans/erc-c.git synced 2024-07-24 01:29:00 +00:00

Reorganize ROM storage

This commit is contained in:
Peter Evans 2018-01-15 17:10:27 -06:00
parent 6cbcf0f9ab
commit ac39349344
9 changed files with 2337 additions and 2160 deletions

BIN
data/peripheral.rom Normal file

Binary file not shown.

BIN
data/zeropad1k.rom Normal file

Binary file not shown.

View File

@ -23,10 +23,13 @@
(0xC000 + (n << 8))
/*
* This is the size of any peripheral's ROM that we can hold in memory
* (which is any page from $C100 - $C700).
* This is the total size of the ROM we hold devoted to peripherals. It
* 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.
@ -40,9 +43,10 @@
#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

View File

@ -8,8 +8,8 @@
typedef struct {
char header[4];
vm_8bit apple2_peripheral_rom[APPLE2_PERIPHERAL_SIZE];
vm_8bit apple2_sys_rom[APPLE2_SYSROM_SIZE];
vm_8bit apple2_peripheral_rom[APPLE2_PERIPHERAL_SIZE];
vm_8bit apple2_sysfont[APPLE2_SYSFONT_SIZE];
} objstore;

File diff suppressed because it is too large Load Diff

View File

@ -67,25 +67,23 @@ apple2_mem_init_sys_rom(apple2 *mach)
{
int err;
const vm_8bit *sysrom;
const vm_8bit *prom;
sysrom = objstore_apple2_sys_rom();
prom = objstore_apple2_peripheral_rom();
// The first two kilobytes of system rom are copied into memory
// beginning at $C800 (which is just after all of the peripheral ROM
// locations).
err = vm_segment_copy_buf(mach->main, sysrom,
0xC800, 0x800, 0x800);
err = vm_segment_copy_buf(mach->rom, sysrom,
0, 0, APPLE2_SYSROM_SIZE);
if (err != OK) {
log_critical("Could not copy apple2 system rom");
return ERR_BADFILE;
}
// The last 12k of sysrom (which is APPLE2_ROM_SIZE) are copied into
// the rom segment.
err = vm_segment_copy_buf(mach->rom, sysrom,
0, 0x1000, APPLE2_ROM_SIZE);
err = vm_segment_copy_buf(mach->rom, prom,
APPLE2_SYSROM_SIZE, 0,
APPLE2_PERIPHERAL_SIZE);
if (err != OK) {
log_critical("Could not copy apple2 system rom");
log_critical("Could not copy apple2 peripheral rom");
return ERR_BADFILE;
}

40
src/apple2.pc.c Normal file
View 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;
}
}

View File

@ -13,23 +13,14 @@ data = 'hope'
# These must be appended in the exact order indicated by the struct definition
# in objstore.h
data += file_data('./data/print.rom') # $C100
data += file_data('./data/serial.rom') # $C200
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('./data/apple2.rom') # Internal ROM ($C000..$FFFF)
data += file_data('./data/peripheral.rom') # $C000..$CFFF
data += file_data('./fonts/apple2-system.bmp')
# Let's not keep calling len(data) since we know it won't change over our
# iterations
data_len = len(data)
print data_len
exit(0)
# This just defines the variable name for the store data
sys.stdout.write("static unsigned char store_data[] =\n")