1
0
mirror of https://github.com/pevans/erc-c.git synced 2024-12-21 08:30:55 +00:00

Separate reset logic from boot function

This commit is contained in:
Peter Evans 2018-01-05 16:04:01 -06:00
parent af7dae6924
commit c6799db689

View File

@ -185,11 +185,23 @@ apple2_boot(apple2 *mach)
mos6502_dis_scan(mach->cpu, stdout, 0, mach->cpu->memory->size);
}
// Run the reset routine to get the machine ready to go.
apple2_reset(mach);
return OK;
}
/*
* This function marks out the procedures that happen when the machine
* is reset. A reset can happen at a cold boot, but it can also happen
* after the computer is already operational.
*/
void
apple2_reset(apple2 *mach)
{
mach->cpu->P = MOS_INTERRUPT;
mach->cpu->PC = (vm_16bit)vm_segment_get(mach->memory, 0xFFFC);
mach->cpu->S = 0;
return OK;
}
/*