git @ Cat's Eye Technologies SixtyPical / c7861d3
`trash` indicates a value is no longer considered meaningful. Chris Pressey 3 years ago
8 changed file(s) with 70 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
99 * Initialized `word` memory locations.
1010 * Can `copy` a literal word to a word table.
1111 * Subtract word (constant or memory location) from word memory location.
12 * `trash` instruction explicitly indicates a value is no longer considered meaningful.
1213 * Fixed bug which was preventing `if` branches to diverge in what they initialized,
1314 if it was already initialized when going into the `if`.
1415 * Fixed a bug which was making it crash when trying to analyze `repeat forever` loops.
7373 * `byte table` and `word table` of sizes other than 256
7474 * initialized `byte table` memory locations
7575 * always analyze before executing or compiling, unless told not to
76 * `trash` instruction.
7776 * `interrupt` routines -- to indicate that "the supervisor" has stored values on the stack, so we can trash them.
7877 * error messages that include the line number of the source code
7978 * have `copy` instruction able to copy a byte to a user-def mem loc, etc.
430430 self.assert_affected_within('trashes', type_.trashes, current_type.trashes)
431431
432432 self.has_encountered_goto = True
433 elif opcode == 'trash':
434 context.set_unmeaningful(instr.dest)
433435 else:
434436 raise NotImplementedError(opcode)
469469 self.emitter.emit(STA(Absolute(Offset(dest_label, 1))))
470470 else:
471471 raise NotImplementedError(src.type)
472 elif opcode == 'trash':
473 pass
472474 else:
473475 raise NotImplementedError(opcode)
304304 self.scanner.expect("off")
305305 block = self.block()
306306 return Instr(opcode='with-sei', dest=None, src=None, block=block)
307 elif self.scanner.consume("trash"):
308 dest = self.locexpr()
309 return Instr(opcode='trash', src=None, dest=dest)
307310 else:
308311 raise ValueError('bad opcode "%s"' % self.scanner.token)
10871087 | ld x, a
10881088 | }
10891089 ? UnmeaningfulReadError: a in main
1090
1091 ### trash ###
1092
1093 Trash does nothing except indicate that we do not care about the value anymore.
1094
1095 | routine foo
1096 | inputs a
1097 | outputs x
1098 | trashes a, z, n
1099 | {
1100 | st a, x
1101 | ld a, 0
1102 | trash a
1103 | }
1104 = ok
1105
1106 | routine foo
1107 | inputs a
1108 | outputs a, x
1109 | trashes z, n
1110 | {
1111 | st a, x
1112 | ld a, 0
1113 | trash a
1114 | }
1115 ? UnmeaningfulOutputError: a in foo
1116
1117 | routine foo
1118 | inputs a
1119 | outputs x
1120 | trashes a, z, n
1121 | {
1122 | st a, x
1123 | trash a
1124 | st a, x
1125 | }
1126 ? UnmeaningfulReadError: a in foo
10901127
10911128 ### if ###
10921129
10721072 = $083B LDA ($FE),Y
10731073 = $083D STA $1041
10741074 = $0840 RTS
1075
1076 ### Trash
1077
1078 Trash does nothing except indicate that we do not care about the value anymore.
1079
1080 | routine main
1081 | inputs a
1082 | outputs x
1083 | trashes a, z, n
1084 | {
1085 | ld x, a
1086 | ld a, 0
1087 | trash a
1088 | }
1089 = $080D TAX
1090 = $080E LDA #$00
1091 = $0810 RTS
6767 | outputs a
6868 | trashes x
6969 | @ 65487
70 = ok
71
72 Trash.
73
74 | routine main {
75 | trash a
76 | trash n
77 | }
7078 = ok
7179
7280 If with not