c64: modify IRQ to start program instead of type SYS string
This commit is contained in:
parent
e8faee01f3
commit
3eb942e926
|
@ -247,9 +247,9 @@ void make_floors() {
|
|||
} while (ladder_in_gap(lev->ladder1, lev->gap) ||
|
||||
ladder_in_gap(lev->ladder2, lev->gap));
|
||||
if (i > 0) {
|
||||
lev->objtype = rndint(1,3);
|
||||
lev->objtype = rndint(0,3);
|
||||
do {
|
||||
lev->objpos = rndint(2,COLS-7);
|
||||
lev->objpos = rndint(5,COLS-7);
|
||||
} while (ladder_in_gap(lev->objpos, lev->gap));
|
||||
}
|
||||
lev->ypos = y;
|
||||
|
|
|
@ -572,8 +572,6 @@ import { TrapCondition } from "../common/devices";
|
|||
export class C64_WASMMachine extends BaseWASMMachine implements Machine {
|
||||
|
||||
prgstart : number;
|
||||
initstring : string;
|
||||
initindex : number;
|
||||
joymask0 = 0;
|
||||
|
||||
reset() {
|
||||
|
@ -584,27 +582,29 @@ export class C64_WASMMachine extends BaseWASMMachine implements Machine {
|
|||
this.prgstart = this.romarr[0] + (this.romarr[1]<<8); // TODO: get starting address
|
||||
if (this.prgstart == 0x801) this.prgstart = 0x80d;
|
||||
}
|
||||
// set init string
|
||||
if (this.prgstart) {
|
||||
this.initstring = "\r\r\r\r\r\r\r\r\r\r\rSYS " + this.prgstart + "\r";
|
||||
this.initindex = 0;
|
||||
}
|
||||
// clear keyboard
|
||||
for (var ch=0; ch<128; ch++) {
|
||||
this.setKeyInput(ch, 0, KeyFlags.KeyUp);
|
||||
}
|
||||
if (this.prgstart) {
|
||||
// advance BIOS
|
||||
super.advanceFrameClock(null, 180000);
|
||||
// set IRQ routine @ 0x314
|
||||
var old0x314 = this.read(0x314) + this.read(0x315) * 256;
|
||||
this.write(0x314, 0x0d);
|
||||
this.write(0x315, 0x08);
|
||||
// wait until IRQ fires
|
||||
for (var i=0; i<50000 && this.getPC() != this.prgstart; i++) {
|
||||
this.exports.machine_tick(this.sys);
|
||||
}
|
||||
// reset 0x314 to old value
|
||||
this.write(0x314, old0x314 & 0xff);
|
||||
this.write(0x315, old0x314 >> 8);
|
||||
}
|
||||
}
|
||||
advanceFrame(trap: TrapCondition) : number {
|
||||
this.typeInitString(); // type init string into console (TODO: doesnt work during debug)
|
||||
return super.advanceFrameClock(trap, 19656+295); // TODO: can we sync with VSYNC?
|
||||
}
|
||||
typeInitString() {
|
||||
if (this.initstring) {
|
||||
var ch = this.initstring.charCodeAt(this.initindex >> 1);
|
||||
this.setKeyInput(ch, 0, (this.initindex&1) ? KeyFlags.KeyUp : KeyFlags.KeyDown);
|
||||
if (++this.initindex >= this.initstring.length*2) this.initstring = null;
|
||||
}
|
||||
}
|
||||
getCPUState() {
|
||||
this.exports.machine_save_cpu_state(this.sys, this.cpustateptr);
|
||||
var s = this.cpustatearr;
|
||||
|
|
Loading…
Reference in New Issue