1
0
mirror of https://github.com/pevans/erc-c.git synced 2024-12-21 23:29:16 +00:00

Add set_memory function

This commit is contained in:
Peter Evans 2018-01-06 21:37:15 -06:00
parent 62af6ef606
commit 8ad1311536
2 changed files with 16 additions and 0 deletions

View File

@ -135,6 +135,7 @@ extern void apple2_release_key(apple2 *);
extern void apple2_reset(apple2 *); extern void apple2_reset(apple2 *);
extern void apple2_run_loop(apple2 *); extern void apple2_run_loop(apple2 *);
extern void apple2_set_color(apple2 *, int); extern void apple2_set_color(apple2 *, int);
extern void apple2_set_memory(apple2 *, int);
extern void apple2_set_video(apple2 *, int); extern void apple2_set_video(apple2 *, int);
#endif #endif

View File

@ -119,6 +119,10 @@ apple2_create(int width, int height)
// We default to lo-res mode. // We default to lo-res mode.
apple2_set_video(mach, VIDEO_LORES); apple2_set_video(mach, VIDEO_LORES);
// By default we should have ROM be the addressable last 12k of
// memory.
apple2_set_memory(mach, MEMORY_BANK_ROM);
// Let's install our bitmap font. // Let's install our bitmap font.
mach->sysfont = vm_bitfont_create(mach->screen, mach->sysfont = vm_bitfont_create(mach->screen,
objstore_apple2_sysfont(), objstore_apple2_sysfont(),
@ -134,6 +138,15 @@ apple2_create(int width, int height)
return mach; return mach;
} }
/*
* Change the memory mode of the apple2 to a given mode.
*/
void
apple2_set_memory(apple2 *mach, int mode)
{
mach->memory_mode = mode;
}
/* /*
* Return true if we are in a state that the apple2 would consider * Return true if we are in a state that the apple2 would consider
* double resolution. (In practice, this refers to horizontal screen * double resolution. (In practice, this refers to horizontal screen
@ -202,6 +215,8 @@ apple2_reset(apple2 *mach)
mach->cpu->P = MOS_INTERRUPT; mach->cpu->P = MOS_INTERRUPT;
mach->cpu->PC = vm_segment_get16(mach->memory, 0xFFFC); mach->cpu->PC = vm_segment_get16(mach->memory, 0xFFFC);
mach->cpu->S = 0; mach->cpu->S = 0;
log_critical("At end of reset, PC = 0x%x", mach->cpu->PC);
} }
/* /*