git @ Cat's Eye Technologies SixtyPical / 563aaeb
Remove low/high byte operators until I've thought about it more. Chris Pressey 4 years ago
5 changed file(s) with 3 addition(s) and 42 deletion(s). Raw diff Collapse all Expand all
399399 Constrnt::= ["inputs" LocExprs] ["outputs" LocExprs] ["trashes" LocExprs].
400400 Routine ::= "routine" Ident<new> Constraints (Block | "@" LitWord).
401401 LocExprs::= LocExpr {"," LocExpr}.
402 LocExpr ::= Register | Flag | Literal | ("<" | ">") Ident.
402 LocExpr ::= Register | Flag | Literal | Ident.
403403 Register::= "a" | "x" | "y".
404404 Flag ::= "c" | "z" | "n" | "v".
405405 Literal ::= LitByte | LitWord.
9494
9595 height=0 = low byte, height=1 = high byte.
9696
97 NOTE: Not actually used yet. Might require more thought before it's usable.
9798 """
9899 def __init__(self, ref, height):
99100 assert isinstance(ref, Ref)
33 from sixtypical.model import (
44 TYPE_BIT, TYPE_BYTE, TYPE_BYTE_TABLE, TYPE_WORD, TYPE_WORD_TABLE,
55 RoutineType, VectorType, ExecutableType,
6 LocationRef, ConstantRef, PartRef
6 LocationRef, ConstantRef
77 )
88 from sixtypical.scanner import Scanner
99
141141 self.scanner.scan()
142142 return loc
143143 else:
144 op = None
145 if self.scanner.consume('<'):
146 op = '<'
147 elif self.scanner.consume('>'):
148 op = '>'
149144 loc = self.lookup(self.scanner.token)
150 if op == '<':
151 loc = PartRef(loc, 0)
152 elif op == '>':
153 loc = PartRef(loc, 1)
154145 self.scanner.scan()
155146 return loc
156147
434434 = y: 0
435435 = z: 0
436436
437 Load and store low byte, high byte of word.
438
439 | word foo : 511
440 |
441 | routine main {
442 | ld x, <foo
443 | ld y, >foo
444 | ld a, 2
445 | st a, <foo
446 | ld a, 1
447 | st a, >foo
448 | }
449 = a: 1
450 = c: 0
451 = foo: 258
452 = n: 0
453 = v: 0
454 = x: 255
455 = y: 1
456 = z: 0
457
458437 Indirect call.
459438
460439 | vector foo outputs x trashes z, n
163163 | }
164164 = ok
165165
166 Referencing low and high byte of a word.
167
168 | word r1
169 |
170 | routine main {
171 | ld x, <r1
172 | ld y, >r1
173 | }
174 = ok
175
176166 Can't access an undeclared memory location.
177167
178168 | routine main {