irq() {
		// If interrupts are allowed
		if (this.GetFlag(FLAGS6502.I) === 0) {
			// Push the program counter to the stack. It's 16-bits dont
			// forget so that takes two pushes
			this.write(0x0100 + this.stkp, (this.pc >> 8) & 0x00FF);
			this.stkp--;
			this.write(0x0100 + this.stkp, this.pc & 0x00FF);
			this.stkp--;

			// Then Push the status register to the stack
			this.SetFlag(B, 0);
			this.SetFlag(U, 1);
			this.SetFlag(I, 1);
			this.write(0x0100 + this.stkp, this.status);
			this.stkp--;

			// Read new program counter location from fixed address
			this.addr_abs = 0xFFFE;
			let lo = this.read(this.addr_abs + 0);
			let hi = this.read(this.addr_abs + 1);
			this.pc = (hi << 8) | lo;

			// IRQs take time
			this.cycles = 7;
		}
	}
// set to the program counter.
set to the program counter.
set to the program counter .
irq() {
		if (this.GetFlag(FLAGS6502.I) === 0) {
			this.write(0x0100 + this.stkp, (this.pc >> 8) & 0x00FF);
			this.stkp--;
			this.write(0x0100 + this.stkp, this.pc & 0x00FF);
			this.stkp--;
			this.SetFlag(B, 0);
			this.SetFlag(U, 1);
			this.SetFlag(I, 1);
			this.write(0x0100 + this.stkp, this.status);
			this.stkp--;
			this.addr_abs = 0xFFFE;
			let lo = this.read(this.addr_abs + 0);
			let hi = this.read(this.addr_abs + 1);
			this.pc = (hi << 8) | lo;
			this.cycles = 7;
		}
	}
irq ( ) { if ( this . GetFlag ( FLAGS6502 . I ) === 0 ) { this . write ( 0x0100 + this . stkp , ( this . pc >> 8 ) & 0x00FF ) ; this . stkp -- ; this . write ( 0x0100 + this . stkp , this . pc & 0x00FF ) ; this . stkp -- ; this . SetFlag ( B , 0 ) ; this . SetFlag ( U , 1 ) ; this . SetFlag ( I , 1 ) ; this . write ( 0x0100 + this . stkp , this . status ) ; this . stkp -- ; this . addr_abs = 0xFFFE ; let lo = this . read ( this . addr_abs + 0 ) ; let hi = this . read ( this . addr_abs + 1 ) ; this . pc = ( hi << 8 ) | lo ; this . cycles = 7 ; } }
set to the program counter.
set to the program counter .
// If interrupts are allowed // Push the program counter to the stack. It's 16-bits dont // forget so that takes two pushes // Then Push the status register to the stack // Read new program counter location from fixed address // IRQs take time