git @ Cat's Eye Technologies ZOWIE / 82ebf26
Fix bug where step was not retrieving updated pc from updated state. Chris Pressey 5 months ago
1 changed file(s) with 3 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
3535 nth (x:xs) n = nth xs (n-1)
3636
3737 step :: State -> IO (Maybe State)
38 step state@State{ pc=pc, prog=prog } =
39 case nth prog pc of
38 step state =
39 case nth (prog state) (pc state) of
4040 Just instr -> do
41 --putStrLn ("@" ++ (show pc) ++ " " ++ (show instr))
4241 state' <- applyInstr state instr
43 return $ Just state'{ pc=pc+1 }
42 return $ Just state'{ pc=(pc state')+1 }
4443 Nothing ->
4544 return Nothing
4645