anchor.diff:                              mi <- 0
                               ExecuteOneRetry()
                   else
  -                    Fetch1Real |> ignore
  +                    Fetch1Real() |> ignore
               )
   
           let Fetch2 () =
  -            if rdy then
  -                opcode2 <- ReadMemoryPcIncrement()
  +            ReadMemoryPcIncrement <| fun value -> opcode2 <- value
   
           let Fetch3 () =
  -            if rdy then
  -                opcode3 <- ReadMemoryPcIncrement()
  +            ReadMemoryPcIncrement <| fun value -> opcode3 <- value
   
           let PushPch () =
  -            pc >>> 8 |> WriteMemoryS
  -            DecrementS()
  +            Push (GetPch()) ignore
   
           let PushPcl () =
  -            WriteMemoryS pc
  -            DecrementS()
  +            Push (GetPcl()) ignore
  +
  +        let PushPInterrupt newB newEa =
  +            b <- newB
  +            Push (GetP()) <| (fun value ->
  +                i <- true
  +                ea <- newEa)
   
           let PushPBrk () =
  -            b <- true
  -            GetP() |> WriteMemoryS
  -            i <- true
  -            ea <- brkVector
  +            PushPInterrupt true brkVector
   
           let PushPIrq () =
  -            b <- false
  -            GetP() |> WriteMemoryS
  -            i <- true
  -            ea <- irqVector
  +            PushPInterrupt false irqVector
               
           let PushPNmi () =
  -            b <- false
  -            GetP() |> WriteMemoryS
  -            i <- true
  -            ea <- nmiVector
  +            PushPInterrupt false nmiVector
   
           let PushPReset () =
  -            ea <- resetVector
  -            DecrementS()
  -            i <- true
  +            PushPInterrupt false resetVector
   
           let PushDummy () =
  -            DecrementS()
  +            IfReady <| s <- (s - 1) &&& 0xFF
   
           let FetchPclVector () =
  -            if rdy then
  +            IfReady <| (
                   if nmi && ((ea = brkVector && b) || (ea = irqVector && (not b))) then
                       nmi <- false
                       ea <- nmiVector
  -                aluTemp <- ReadMemory ea
  -            rdy
  +                aluTemp <- ReadMemoryInternal ea)
               
           let FetchPchVector () =
  -            if rdy then
  -                aluTemp <- aluTemp ||| (ReadMemory(ea) <<< 8)
  -                pc <- aluTemp
  -            rdy
  +            IfReady <| (
  +                aluTemp <- aluTemp ||| (ReadMemoryInternal(ea) <<< 8)
  +                pc <- aluTemp)
   
           let ImpIny () =
  -            if rdy then
  -                FetchDummy()
  +            FetchDummy <| (
                   y <- y + 1
  -                NZ y
  -            rdy
  +                NZ y)
   
           let ImpDey () =
  -            if rdy then
  -                FetchDummy()
  +            FetchDummy <| (
                   y <- y - 1
  -                NZ y
  -            rdy
  +                NZ y)
               
           let ImpInx () =
  -            if rdy then
  -                FetchDummy()
  +            FetchDummy <| (
                   x <- x + 1
  -                NZ x
  -            rdy
  +                NZ x)
   
           let ImpDex () =
  -            if rdy then
  -                FetchDummy()
  +            FetchDummy <| (
                   x <- x - 1
  -                NZ x
  -            rdy
  +                NZ x)
   
           let ImpTsx () =
  -            if rdy then
  -                FetchDummy()
  +            FetchDummy <| (
                   x <- s
  -                NZ x
  -            rdy
  +                NZ x)
   
           let ImpTxs () =
  -            if rdy then
  -                FetchDummy()
  -                s <- x
  -            rdy
  +            FetchDummy <| (
  +                s <- x)
   
           let ImpTax () =
  -            if rdy then
  -                FetchDummy()
  +            FetchDummy <| (
                   x <- a
  -                NZ x
  -            rdy
  +                NZ x)
   
           let ImpTay () =
  -            if rdy then
  -                FetchDummy()
  +            FetchDummy <| (
                   y <- a
  -                NZ y
  -            rdy
  +                NZ x)
               
           let ImpTya () =
  -            if rdy then
  -                FetchDummy()
  +            FetchDummy <| (
                   a <- y
  -                NZ a
  -            rdy
  +                NZ a)
           
           let ImpTxa () =
  -            if rdy then
  -                FetchDummy()
  +            FetchDummy <| (
                   a <- x
  -                NZ a
  -            rdy
  -
  -        let ImpSei () =
  -            if rdy then
  -                FetchDummy()
  -                iFlagPending <- true
  -            rdy
  -
  -        let ImpCli () =
  -            if rdy then
  -                FetchDummy()
  -                iFlagPending <- false
  -            rdy
  -
  -        let ImpSec () =
  -            if rdy then
  -                FetchDummy()
  -                c <- true
  -            rdy
  -
  -        let ImpClc () =
  -            if rdy then
  -                FetchDummy()
  -                c <- false
  -            rdy
  +                NZ a)
  +
  +        let ImpSei () = FetchDummy <| iFlagPending <- true
  +        let ImpCli () = FetchDummy <| iFlagPending <- false
  +        let ImpSec () = FetchDummy <| c <- true
  +        let ImpClc () = FetchDummy <| c <- false
  +        let ImpClv () = FetchDummy <| v <- false
   
           let ImpSed () =
  -            if rdy then
  -                FetchDummy()
  +            FetchDummy <| (
                   d <- true
  -                isDecimalMode <- config.HasDecimalMode
  -            rdy
  +                isDecimalMode <- config.HasDecimalMode)
   
           let ImpCld () =
  -            if rdy then
  -                FetchDummy()
  +            FetchDummy <| (
                   d <- false
  -                isDecimalMode <- false
  -            rdy
  -
  -        let ImpClv () =
  -            if rdy then
  -                FetchDummy()
  -                v <- false
  -            rdy
  -
  -        let AbsWrite value =
  -            (opcode3 <<< 8) ||| opcode2 |> WriteMemory value |> ignore
  -            true
  -
  -        let AbsWriteSta () =
  -            AbsWrite a
  -
  -        let AbsWriteStx () =
  -            AbsWrite x
  -            
  -        let AbsWriteSty () =
  -            AbsWrite y
  -
  -        let AbsWriteSax () =
  -            AbsWrite (x &&& a)
  -
  -        let ZpWrite value =
  -            value |> WriteMemory opcode2 |> ignore
  -            true
  -
  -        let ZpWriteSta () =
  -            ZpWrite a
  -
  -        let ZpWriteStx () =
  -            ZpWrite x
  -
  -        let ZpWriteSty () =
  -            ZpWrite y
  -
  -        let ZpWriteSax () =
  -            ZpWrite (x &&& a)
  +                isDecimalMode <- false)
  +
  +        let AbsWrite value = WriteMemory ((opcode3 <<< 8) ||| opcode2) value
  +        let AbsWriteSta () = AbsWrite a
  +        let AbsWriteStx () = AbsWrite x
  +        let AbsWriteSty () = AbsWrite y
  +        let AbsWriteSax () = AbsWrite (x &&& a)
  +
  +        let ZpWrite value = WriteMemory opcode2 value
  +        let ZpWriteSta () = ZpWrite a
  +        let ZpWriteStx () = ZpWrite x
  +        let ZpWriteSty () = ZpWrite y
  +        let ZpWriteSax () = ZpWrite (x &&& a)
   
           let IndIdxStage3 () =
  -            if rdy then
  -                ea <- ReadMemory opcode2
  -            rdy
  +            ReadMemory opcode2 (fun mem ->
  +                ea <- mem)
   
           let IndIdxStage4 () =
  -            if rdy then
  +            IfReady <| (
                   aluTemp <- ea + y
  -                ea <- (((opcode2 + 1) &&& 0xFF) <<< 8) ||| (aluTemp &&& 0xFF) |> ReadMemory
  -            rdy
  +                ea <- (((opcode2 + 1) &&& 0xFF) <<< 8) ||| (aluTemp &&& 0xFF) |> ReadMemoryInternal)
   
           let IndIdxWriteStage5 () =
  -            if rdy then
  -                ReadMemory ea |> ignore
  -                ea <- ea + (aluTemp &&& 0xFF00)
  -            rdy
  +            IfReady <| (
  +                ReadMemoryInternal ea |> ignore
  +                ea <- ea + (aluTemp &&& 0xFF00))
   
           let IndIdxReadStage5 () =
  -            if rdy then
  +            IfReady <| (
                   if aluTemp >= 0x100 then
                       mi <- mi + 1
  -                    ExecuteOneRetry |> ignore
  +                    ExecuteOneRetry()
                   else
  -                    ReadMemory ea |> ignore
  -                    ea <- (ea + 0x100) &&& 0xFFFF
  -            rdy
  +                    ReadMemoryInternal ea |> ignore
  +                    ea <- (ea + 0x100) &&& 0xFFFF)
   
           let IndIdxRmwStage5 () =
  -            if rdy then
  +            IfReady <| (
                   if aluTemp >= 0x100 then
                       ea <- (ea + 0x100) &&& 0xFFFF
  -                ReadMemory ea |> ignore
  -            rdy
  -
  -        let IndIdxWriteStage6 value =
  -            value |> WriteMemory ea |> ignore
  -            true
  -
  -        let IndIdxWriteStage6Sta () =
  -            IndIdxWriteStage6 a
  -
  -        let IndIdxWriteStage6Sha () =
  -            IndIdxWriteStage6 (a &&& x &&& 7)
  -
  -        let IndIdxReadStage6 operation =
  -            IfReady <| (ReadMemory ea |> operation)
  -
  -        let IndIdxReadStage6Lda () =
  -            IndIdxReadStage6 <| Lda
  -
  -        let IndIdxReadStage6Cmp () =
  -            IndIdxReadStage6 <| Cmp a
  -
  -        let IndIdxReadStage6And () =
  -            IndIdxReadStage6 <| And
  -
  -        let IndIdxReadStage6Eor () =
  -            IndIdxReadStage6 <| Eor
  -
  -        let IndIdxReadStage6Lax () =
  -            IndIdxReadStage6 <| Lax
  -
  -        let IndIdxReadStage6Adc () =
  -            IndIdxReadStage6 <| Adc
  -
  -        let IndIdxReadStage6Sbc () =
  -            IndIdxReadStage6 <| Sbc
  -
  -        let IndIdxReadStage6Ora () =
  -            IndIdxReadStage6 <| Ora
  -
  -        let IndIdxRmwStage6 () =
  -            IfReady <| (aluTemp <- ReadMemory ea)
  -
  -        let IndIdxRmwStage7 operation =
  -            aluTemp |> WriteMemory ea |> operation |> ignore
  -            true
  -
  -        let IndIdxRmwStage7Slo () =
  -            IndIdxRmwStage7 <| Slo
  -
  -        let IndIdxRmwStage7Sre () =
  -            IndIdxRmwStage7 <| Sre
  -
  -        let IndIdxRmwStage7Rra () =
  -            IndIdxRmwStage7 <| Rra
  -
  -        let IndIdxRmwStage7Isc () =
  -            IndIdxRmwStage7 <| Isc
  -
  -        let IndIdxRmwStage7Dcp () =
  -            IndIdxRmwStage7 <| Dcp
  -
  -        let IndIdxRmwStage7Rla () =
  -            IndIdxRmwStage7 <| Rla
  -
  -        let IndIdxRmwStage8 () =
  -            aluTemp |> WriteMemory ea |> ignore
  -            true
  +                ReadMemoryInternal ea |> ignore)
  +
  +        let IndIdxWriteStage6 value = WriteMemory ea value ignore
  +        let IndIdxWriteStage6Sta () = IndIdxWriteStage6 a
  +        let IndIdxWriteStage6Sha () = IndIdxWriteStage6 (a &&& x &&& 7)
  +
  +        let IndIdxReadStage6 operation = ReadMemory ea operation
  +        let IndIdxReadStage6Lda () = IndIdxReadStage6 <| Lda
  +        let IndIdxReadStage6Cmp () = IndIdxReadStage6 <| Cmp a
  +        let IndIdxReadStage6And () = IndIdxReadStage6 <| And
  +        let IndIdxReadStage6Eor () = IndIdxReadStage6 <| Eor
  +        let IndIdxReadStage6Lax () = IndIdxReadStage6 <| Lax
  +        let IndIdxReadStage6Adc () = IndIdxReadStage6 <| Adc
  +        let IndIdxReadStage6Sbc () = IndIdxReadStage6 <| Sbc
  +        let IndIdxReadStage6Ora () = IndIdxReadStage6 <| Ora
  +
  +        let IndIdxRmwStage6 () = ReadMemory ea (fun mem -> aluTemp <- mem)
  +
  +        let IndIdxRmwStage7 operation = WriteMemory ea aluTemp operation
  +        let IndIdxRmwStage7Slo () = IndIdxRmwStage7 <| Slo
  +        let IndIdxRmwStage7Sre () = IndIdxRmwStage7 <| Sre
  +        let IndIdxRmwStage7Rra () = IndIdxRmwStage7 <| Rra
  +        let IndIdxRmwStage7Isc () = IndIdxRmwStage7 <| Isc
  +        let IndIdxRmwStage7Dcp () = IndIdxRmwStage7 <| Dcp
  +        let IndIdxRmwStage7Rla () = IndIdxRmwStage7 <| Rla
  +
  +        let IndIdxRmwStage8 () = WriteMemory ea aluTemp ignore
   
           let RelBranchStage2 branchTaken =
  -            if rdy then
  -                opcode2 <- ReadMemoryPcIncrement()
  +            ReadMemoryPcIncrement (fun mem ->
  +                opcode2 <- mem
                   if branchTaken then
                       opcode <- vopRelativeStuff
  -                    mi <- -1
  -            rdy
  +                    mi <- -1)
               
  -        let RelBranchStage2Bvs () =
  -            RelBranchStage2 v
  -
  -        let RelBranchStage2Bvc () =
  -            RelBranchStage2 (not v)
  -
  -        let RelBranchStage2Bmi () =
  -            RelBranchStage2 n
  -
  -        let RelBranchStage2Bpl () =
  -            RelBranchStage2 (not n)
  -
  -        let RelBranchStage2Bcs () =
  -            RelBranchStage2 c
  -
  -        let RelBranchStage2Bcc () =
  -            RelBranchStage2 (not c)
  -
  -        let RelBranchStage2Beq () =
  -            RelBranchStage2 z
  -
  -        let RelBranchStage2Bne () =
  -            RelBranchStage2 (not z)
  +        let RelBranchStage2Bvs () = RelBranchStage2 v
  +        let RelBranchStage2Bvc () = RelBranchStage2 (not v)
  +        let RelBranchStage2Bmi () = RelBranchStage2 n
  +        let RelBranchStage2Bpl () = RelBranchStage2 (not n)
  +        let RelBranchStage2Bcs () = RelBranchStage2 c
  +        let RelBranchStage2Bcc () = RelBranchStage2 (not c)
  +        let RelBranchStage2Beq () = RelBranchStage2 z
  +        let RelBranchStage2Bne () = RelBranchStage2 (not z)
   
           let RelBranchStage3 () =
  -            if rdy then
  -                FetchDummy()
  +            FetchDummy <| (
                   aluTemp <- (pc &&& 0xFF) + opcode2
                   pc <- (pc &&& 0xFF00) ||| (aluTemp &&& 0xFF)
                   if aluTemp >= 0x100 then
  
positive.code:         // ----- uOPS -----
  
  
          let FetchDummy () =
              ReadMemory pc |> ignore
  
          let Fetch1Real () =
              IfReady <| (
                  branchIrqHack <- false
                  opcode <- ReadMemoryPcIncrement()
                  pc <- pc + 1
                  mi <- -1)
  
          let Fetch1 () =
              IfReady <| (
  
negative.code:             // 105 (VOP_IRQ)
              [| Uop.FetchDummy; Uop.FetchDummy; Uop.PushPch; Uop.PushPcl; Uop.PushPIrq; Uop.FetchPclVector; Uop.FetchPchVector; Uop.EndSuppressInterrupt |];
              // 106 (VOP_RESET)
              [| Uop.FetchDummy; Uop.FetchDummy; Uop.FetchDummy; Uop.PushDummy; Uop.PushDummy; Uop.PushPReset; Uop.FetchPclVector; Uop.FetchPchVector; Uop.EndSuppressInterrupt |];
              // 107 (VOP_Fetch1_NoInterrupt)
              [| Uop.Fetch1Real |];
          |]
  