git @ Cat's Eye Technologies SixtyPical / b455709
Analyze bfore mitting Cat's Eye Technologies 8 years ago
3 changed file(s) with 52 addition(s) and 5 deletion(s). Raw diff Collapse all Expand all
0 assign byte table screen $0400
0 assign byte table screen $0400
11 assign byte table screen2 1274
22 assign byte table screen3 1524
33 assign byte table screen4 1774
2828 jsr reset_position
2929 jsr clear_screen
3030 sei {
31 copy vector cinv to save_cinv
31 copy cinv save_cinv
3232 copy routine our_cinv to cinv
3333 }
3434 clc
3737 ("emit", Right program) ->
3838 case checkAndTransformProgram program of
3939 Just newprog ->
40 case analyzeProgram newprog of
41 _ ->
40 case (length (show (analyzeProgram newprog)) < 9999999) of
41 True ->
4242 putStr $ emitProgram newprog
4343 (_, Left problem) -> do
4444 hPutStrLn stderr (show problem)
3030 in
3131 checkBlock instrs progCtx routCtx'
3232
33 -- -- -- -- -- -- -- -- -- -- -- --
34
3335 checkInstr (COPY src dst) progCtx routCtx =
3436 case Map.lookup src routCtx of
3537 Just (PoisonedWith _) ->
3941 checkInstr (DELTA dst val) progCtx routCtx =
4042 -- TODO check that dst is not poisoned
4143 Map.insert dst (UpdatedWith (Immediate val)) routCtx
44
45 checkInstr (ADD dst src) progCtx routCtx =
46 -- TODO check that dst is not poisoned
47 Map.insert dst (UpdatedWith src) routCtx
48 checkInstr (SUB dst src) progCtx routCtx =
49 -- TODO check that dst is not poisoned
50 Map.insert dst (UpdatedWith src) routCtx
51
52 checkInstr (AND dst src) progCtx routCtx =
53 -- TODO check that dst is not poisoned
54 Map.insert dst (UpdatedWith src) routCtx
55 checkInstr (OR dst src) progCtx routCtx =
56 -- TODO check that dst is not poisoned
57 Map.insert dst (UpdatedWith src) routCtx
58 checkInstr (XOR dst src) progCtx routCtx =
59 -- TODO check that dst is not poisoned
60 Map.insert dst (UpdatedWith src) routCtx
61
4262 checkInstr (JSR name) progCtx routCtx =
4363 let
4464 Just calledRout = lookupRoutine program name
6080 -- TODO: oooh, this one's gonna be fun too
6181 --checkBlock blk progCtx routCtx
6282 routCtx
83
84 -- TODO -- THESE ARE WEAK --
85 checkInstr (SEI blk) progCtx routCtx =
86 checkBlock blk progCtx routCtx
87 checkInstr (PUSH _ blk) progCtx routCtx =
88 checkBlock blk progCtx routCtx
89
90 checkInstr (BIT dst) progCtx routCtx =
91 -- TODO check that dst is not poisoned
92 Map.insert dst (UpdatedWith (Immediate 0)) routCtx
93
94 checkInstr (SHR dst flg) progCtx routCtx =
95 -- TODO check that dst is not poisoned
96 Map.insert dst (UpdatedWith flg) routCtx
97 checkInstr (SHL dst flg) progCtx routCtx =
98 -- TODO check that dst is not poisoned
99 Map.insert dst (UpdatedWith flg) routCtx
100
101 checkInstr (COPYROUTINE name dst) progCtx routCtx =
102 -- TODO check that dst is not poisoned
103 Map.insert dst (UpdatedWith (Immediate 7)) routCtx
104
105 checkInstr (JMPVECTOR dst) progCtx routCtx =
106 routCtx
107
63108 checkInstr NOP progCtx routCtx =
64109 routCtx
65
110
111 {-
66112 checkInstr instr _ _ = error (
67113 "Internal error: sixtypical doesn't know how to " ++
68114 "analyze '" ++ (show instr) ++ "'")
115 -}
69116
70117 --
71118 -- Utility function: