1
0
mirror of https://github.com/pevans/erc-c.git synced 2025-03-10 22:30:23 +00:00

Copy vm_8bit buffer into rom/memory directly

This commit is contained in:
Peter Evans 2018-01-03 21:10:46 -06:00
parent 90d6c637c5
commit 7182608473

View File

@ -4,6 +4,7 @@
#include "apple2.h" #include "apple2.h"
#include "apple2.mem.h" #include "apple2.mem.h"
#include "objstore.h"
/* /*
* Return a byte of memory from a bank-switchable address. This may be * Return a byte of memory from a bank-switchable address. This may be
@ -102,20 +103,13 @@ apple2_mem_map(apple2 *mach)
int int
apple2_mem_init_disk2_rom(apple2 *mach) apple2_mem_init_disk2_rom(apple2 *mach)
{ {
FILE *stream;
int err; int err;
stream = fopen("./disk2.rom", "r"); err = vm_segment_copy_buf(mach->memory, objstore_apple2_disk2_rom(),
if (stream == NULL) { APPLE2_DISK2_ROM_OFFSET, 0,
log_critical("Could not read disk2.rom"); APPLE2_DISK2_ROM_SIZE);
return ERR_BADFILE;
}
err = vm_segment_fread(mach->memory, stream,
APPLE2_DISK2_ROM_OFFSET, APPLE2_DISK2_ROM_SIZE);
if (err != OK) { if (err != OK) {
fclose(stream); log_critical("Could not acquire apple2 disk2 rom");
log_critical("Could not read disk2.rom");
return ERR_BADFILE; return ERR_BADFILE;
} }
@ -125,19 +119,12 @@ apple2_mem_init_disk2_rom(apple2 *mach)
int int
apple2_mem_init_sys_rom(apple2 *mach) apple2_mem_init_sys_rom(apple2 *mach)
{ {
FILE *stream;
int err; int err;
stream = fopen("./apple2.rom", "r"); err = vm_segment_copy_buf(mach->rom, objstore_apple2_sys_rom(),
if (stream == NULL) { 0, 0, APPLE2_ROM_SIZE);
log_critical("Could not read apple2.rom");
return ERR_BADFILE;
}
err = vm_segment_fread(mach->rom, stream, 0, APPLE2_ROM_SIZE);
if (err != OK) { if (err != OK) {
fclose(stream); log_critical("Could not acquire apple2 system rom");
log_critical("Could not read apple2.rom");
return ERR_BADFILE; return ERR_BADFILE;
} }