mirror of
https://github.com/michaelcmartin/Ophis.git
synced 2024-10-09 06:55:28 +00:00
Extend .advance to allow a filler expression.
This commit is contained in:
parent
e58d5ccaac
commit
eae4ea7dcd
@ -94,8 +94,13 @@ def pragmaOrg(ppt, line, result):
|
||||
def pragmaAdvance(ppt, line, result):
|
||||
"Outputs filler until reaching the target PC"
|
||||
newPC = FE.parse_expr(line)
|
||||
if str(line.lookahead(0)) == ",":
|
||||
line.pop()
|
||||
fillexpr = FE.parse_expr(line)
|
||||
else:
|
||||
fillexpr = IR.ConstantExpr(0)
|
||||
line.expect("EOL")
|
||||
result.append(IR.Node(ppt, "Advance", newPC))
|
||||
result.append(IR.Node(ppt, "Advance", newPC, fillexpr))
|
||||
|
||||
def pragmaCheckpc(ppt, line, result):
|
||||
"Enforces that the PC has not exceeded a certain point"
|
||||
|
@ -575,7 +575,6 @@ class Assembler(Pass):
|
||||
if (pc > target):
|
||||
Err.log("Attempted to .advance backwards: $%x to $%x" % (pc, target))
|
||||
else:
|
||||
zero = IR.ConstantExpr(0)
|
||||
for i in xrange(target-pc): self.outputbyte(zero, env)
|
||||
for i in xrange(target-pc): self.outputbyte(node.data[1], env)
|
||||
self.filler += target-pc
|
||||
env.setPC(target)
|
||||
|
Binary file not shown.
@ -1,7 +1,9 @@
|
||||
; This data file just dumps out $00-$0F repeatedly with different forms.
|
||||
|
||||
; This data file just dumps out $00-$0F repeatedly with different forms,
|
||||
; bracketed by $00s and then $60s.
|
||||
.advance $10, ^
|
||||
.byte 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
|
||||
.word 256, $0302, $0504, $0706, $0908, $0b0a, $0d0c, $0f0e
|
||||
.dword $03020100, $07060504, $0b0a0908, $0f0e0d0c
|
||||
.wordbe 1, $0203, $0405, $0607, $0809, $0a0b, $0c0d, $0e0f
|
||||
.dwordbe $010203, $04050607, $08090a0b, $0c0d0e0f
|
||||
.advance $70, ^
|
||||
|
Loading…
Reference in New Issue
Block a user