Skip to content

Commit

Permalink
Added IM register also to zesarux.
Browse files Browse the repository at this point in the history
  • Loading branch information
maziac committed Feb 29, 2020
1 parent 8237190 commit 678ccdd
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
25 changes: 19 additions & 6 deletions src/remotes/zesarux/zesaruxregisters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export class ZesaruxRegisters extends Z80Registers {
protected de2Index: number;
protected iIndex: number;
protected rIndex: number;
protected imIndex: number;


/**
Expand All @@ -55,7 +56,8 @@ export class ZesaruxRegisters extends Z80Registers {
this.hl2Index = -1;
this.de2Index = -1;
this.iIndex = -1;
this.rIndex = -1;
this.rIndex=-1;
this.imIndex=-1;
}


Expand Down Expand Up @@ -196,12 +198,23 @@ export class ZesaruxRegisters extends Z80Registers {
}

public parseR(data: string): number {
if(this.rIndex < 0) {
this.rIndex = data.indexOf('R=');
assert(this.rIndex >= 0);
this.rIndex += 2;
if (this.rIndex<0) {
this.rIndex=data.indexOf('R=');
assert(this.rIndex>=0);
this.rIndex+=2;
}
const res = parseInt(data.substr(this.rIndex,2),16);
const res=parseInt(data.substr(this.rIndex, 2), 16);
return res;
}

public parseIM(data: string): number {
if (this.imIndex<0) {
this.imIndex=data.indexOf('IM');
assert(this.imIndex>=0);
this.imIndex+=2;
}
const char=data.codePointAt(this.imIndex) as number;
const res: number=char-48;
return res;
}
}
3 changes: 1 addition & 2 deletions src/remotes/zxsimulator/z80cpu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ export class Z80Cpu extends Z80js {
IM 1: Jumps to address &0038
IM 2: Uses an interrupt vector table, indexed by value on data bus.
*/
self.im=2; // ZX Spectrum
//this.remaingInterruptTstates=2;
self.im=0; // Just as after interrupt.
}


Expand Down

0 comments on commit 678ccdd

Please sign in to comment.