mirror of
https://github.com/pevans/erc-c.git
synced 2024-12-21 08:30:55 +00:00
Change objstore structure to contain all peripheral ROM
This commit is contained in:
parent
3c46a41351
commit
0e0244162f
@ -4,8 +4,30 @@
|
||||
#include "apple2.h"
|
||||
#include "vm_segment.h"
|
||||
|
||||
#define APPLE2_DISK2_ROM_OFFSET 0xC600
|
||||
#define APPLE2_DISK2_ROM_SIZE 0x100
|
||||
/*
|
||||
* Given a slot number (1-7), this will return the memory page address
|
||||
* for the site of the ROM that is associated for the peripheral that
|
||||
* would be connected there.
|
||||
*/
|
||||
#define APPLE2_PERIPHERAL_SLOT(n) \
|
||||
(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).
|
||||
*/
|
||||
#define APPLE2_PERIPHERAL_SIZE 0x700
|
||||
|
||||
/*
|
||||
* Peripheral ROM can only occupy a single page in memory.
|
||||
*/
|
||||
#define APPLE2_PERIPHERAL_PAGE 0x100
|
||||
|
||||
/*
|
||||
* System ROM requires a full 16k; part of it is copied into several
|
||||
* pages beginning at $C800, and much more go into $D000 - $FFFF.
|
||||
*/
|
||||
#define APPLE2_SYSROM_SIZE 0x4000
|
||||
|
||||
/*
|
||||
* The size of our block of ROM is 12k
|
||||
@ -26,7 +48,7 @@
|
||||
extern vm_8bit apple2_mem_read_bank(vm_segment *, size_t, void *);
|
||||
extern void apple2_mem_write_bank(vm_segment *, size_t, vm_8bit, void *);
|
||||
extern void apple2_mem_map(apple2 *);
|
||||
extern int apple2_mem_init_disk2_rom(apple2 *);
|
||||
extern int apple2_mem_init_peripheral_rom(apple2 *);
|
||||
extern int apple2_mem_init_sys_rom(apple2 *);
|
||||
|
||||
#endif
|
||||
|
@ -8,8 +8,8 @@
|
||||
|
||||
typedef struct {
|
||||
char header[4];
|
||||
vm_8bit apple2_disk2_rom[APPLE2_DISK2_ROM_SIZE];
|
||||
vm_8bit apple2_sys_rom[0x4000];
|
||||
vm_8bit apple2_peripheral_rom[APPLE2_PERIPHERAL_SIZE];
|
||||
vm_8bit apple2_sys_rom[APPLE2_SYSROM_SIZE];
|
||||
vm_8bit apple2_sysfont[APPLE2_SYSFONT_SIZE];
|
||||
} objstore;
|
||||
|
||||
@ -20,7 +20,7 @@ extern void objstore_clear();
|
||||
#define OBJSTORE_DECL(x) \
|
||||
const vm_8bit *objstore_##x()
|
||||
|
||||
OBJSTORE_DECL(apple2_disk2_rom);
|
||||
OBJSTORE_DECL(apple2_peripheral_rom);
|
||||
OBJSTORE_DECL(apple2_sys_rom);
|
||||
OBJSTORE_DECL(apple2_sysfont);
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -96,34 +96,19 @@ apple2_mem_map(apple2 *mach)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Since we can't write into ROM normally, we need a separate function
|
||||
* we can call which will do the writing for us.
|
||||
*/
|
||||
int
|
||||
apple2_mem_init_disk2_rom(apple2 *mach)
|
||||
apple2_mem_init_peripheral_rom(apple2 *mach)
|
||||
{
|
||||
int err;
|
||||
const vm_8bit *diskrom;
|
||||
|
||||
diskrom = objstore_apple2_disk2_rom();
|
||||
|
||||
// Copy into the first peripheral page for disk ROM.
|
||||
err = vm_segment_copy_buf(mach->memory, diskrom,
|
||||
APPLE2_DISK2_ROM_OFFSET, 0,
|
||||
APPLE2_DISK2_ROM_SIZE);
|
||||
// Let's copy beginning at the 1-slot offset in memory, but going
|
||||
// all the way as far as the length of all peripheral ROM in memory.
|
||||
err = vm_segment_copy_buf(mach->memory,
|
||||
objstore_apple2_peripheral_rom(),
|
||||
APPLE2_PERIPHERAL_SLOT(1), 0,
|
||||
APPLE2_PERIPHERAL_SIZE);
|
||||
if (err != OK) {
|
||||
log_critical("Could not copy apple2 disk2 rom");
|
||||
return ERR_BADFILE;
|
||||
}
|
||||
|
||||
// This second copy will copy into the next slot over, which is
|
||||
// essentially the second disk drive. It's all the same ROM.
|
||||
err = vm_segment_copy_buf(mach->memory, diskrom,
|
||||
APPLE2_DISK2_ROM_OFFSET + 0x100, 0,
|
||||
APPLE2_DISK2_ROM_SIZE);
|
||||
if (err != OK) {
|
||||
log_critical("Could not copy apple2 disk2 rom");
|
||||
log_critical("Could not copy apple2 peripheral rom");
|
||||
return ERR_BADFILE;
|
||||
}
|
||||
|
||||
|
@ -93,6 +93,6 @@ objstore_ready()
|
||||
* screwing up my indent, to be honest. But C will ignore the
|
||||
* semicolons, so all is well.
|
||||
*/
|
||||
OBJSTORE_DEFN(apple2_peripheral_rom); // ignore docblock
|
||||
OBJSTORE_DEFN(apple2_sys_rom); // ignore docblock
|
||||
OBJSTORE_DEFN(apple2_disk2_rom); // ignore docblock
|
||||
OBJSTORE_DEFN(apple2_sysfont); // ignore docblock
|
||||
|
Loading…
Reference in New Issue
Block a user