git @ Cat's Eye Technologies SixtyPical / 3ff96a0
Fix (bodge?) and document my worries. Cat's Eye Technologies 7 years ago
4 changed file(s) with 94 addition(s) and 6 deletion(s). Raw diff Collapse all Expand all
195195 | }
196196 ? routine 'main' does not preserve 'A'
197197
198 | reserve byte score
199 | routine update_score
200 | {
201 | ldx #4
202 | stx score
203 | }
204 | routine main {
205 | lda #4
206 | if beq {
207 | jsr update_score
208 | } else {
209 | ldx #4
210 | }
211 | sta score
212 | }
213 = main ([])
214 = A: UpdatedWith (Immediate 4)
215 = X: PoisonedWith (Immediate 4)
216 = NamedLocation Nothing "score": UpdatedWith A
217 =
218 = update_score ([])
219 = X: UpdatedWith (Immediate 4)
220 = NamedLocation Nothing "score": UpdatedWith X
221
198222 Poisoning a high byte or low byte of a word poisons the whole word.
199223
200224 | reserve word score
210234 | sta temp
211235 | }
212236 ? routine 'main' does not preserve 'NamedLocation Nothing "score"'
237
238 | assign vector cinv 788
239 | reserve vector save_cinv
240 |
241 | assign word position $fb
242 |
243 | reserve byte value
244 |
245 | routine reset_position {
246 | lda #$00
247 | sta <position
248 | lda #$04
249 | sta >position
250 | }
251 |
252 | routine our_cinv {
253 | inc value
254 | lda value
255 | ldy #0
256 | sta (position), y
257 | if beq {
258 | jsr reset_position
259 | } else {
260 | }
261 | jmp (save_cinv)
262 | }
263 |
264 | routine main {
265 | jsr reset_position
266 | sei {
267 | copy cinv save_cinv
268 | copy routine our_cinv to cinv
269 | }
270 | clc
271 | repeat bcc { }
272 | }
273 = main ([])
274 = A: PoisonedWith (Immediate 4)
275 = FlagC: UpdatedWith (Immediate 0)
276 = NamedLocation Nothing "cinv": UpdatedWith (Immediate 7)
277 = NamedLocation Nothing "position": PoisonedWith A
278 = NamedLocation Nothing "save_cinv": UpdatedWith (NamedLocation Nothing "cinv")
279 =
280 = our_cinv ([])
281 = A: PoisonedWith (Immediate 4)
282 = Y: UpdatedWith (Immediate 0)
283 = IndirectIndexed (NamedLocation (Just Word) "position") Y: UpdatedWith A
284 = NamedLocation Nothing "position": PoisonedWith A
285 = NamedLocation Nothing "value": UpdatedWith (Immediate 1)
286 =
287 = reset_position ([])
288 = A: UpdatedWith (Immediate 4)
289 = NamedLocation Nothing "position": UpdatedWith A
8686 sta (position), y
8787 jsr increment_pos
8888 jsr compare_pos
89 lda vic_border ; WHY DOES THE FOLLOWING NOT ANALUZE
9089 if beq {
9190 jsr reset_position
9291 } else {
6262 routCtx
6363 checkInstr nm (IF _ branch b1 b2) progCtx routCtx =
6464 let
65 -- This works, but I worry about it.
66 -- It doesn't work if we pass routCtx to both blocks,
67 -- because when we go to merge them, there is apparently
68 -- too much information, and we end up checking things
69 -- we don't need to check.
70 -- Leaving the second one empty results in the right amount
71 -- of information.
72 -- But what are we depriving the else block context of?
73 -- More tests are needed.
74 -- Possibly the merge needs to be redone.
6575 routCtx1 = checkBlock nm b1 progCtx routCtx
66 routCtx2 = checkBlock nm b2 progCtx routCtx
76 routCtx2 = checkBlock nm b2 progCtx Map.empty
6777 in
6878 mergeAlternateRoutCtxs nm routCtx1 routCtx2
6979 checkInstr nm (REPEAT _ branch blk) progCtx routCtx =
2525
2626 type ProgramContext = Map.Map RoutineName RoutineContext
2727
28 untypedLocation (HighByteOf (NamedLocation _ name)) =
29 NamedLocation Nothing name
30 untypedLocation (LowByteOf (NamedLocation _ name)) =
31 NamedLocation Nothing name
28 untypedLocation (HighByteOf x) =
29 untypedLocation x
30 untypedLocation (LowByteOf x) =
31 untypedLocation x
32 untypedLocation (Indexed table index) =
33 untypedLocation table
3234 untypedLocation (NamedLocation _ name) =
3335 NamedLocation Nothing name
3436 untypedLocation x = x