mirror of
https://github.com/irmen/prog8.git
synced 2024-11-26 11:49:22 +00:00
fix jump jsr/rts
This commit is contained in:
parent
fdf9054b99
commit
fbb4ba4bd8
@ -422,14 +422,15 @@ class CodeGenerator:
|
|||||||
targetstr = stmt.target.name or Parser.to_hex(stmt.address)
|
targetstr = stmt.target.name or Parser.to_hex(stmt.address)
|
||||||
else:
|
else:
|
||||||
raise TypeError("call sub target should be mmapped")
|
raise TypeError("call sub target should be mmapped")
|
||||||
|
if stmt.is_goto:
|
||||||
|
self.p("\t\tjmp " + targetstr)
|
||||||
|
return
|
||||||
clobbered = set() # type: Set[str]
|
clobbered = set() # type: Set[str]
|
||||||
if targetdef.clobbered_registers:
|
if targetdef.clobbered_registers:
|
||||||
if stmt.preserve_regs: # @todo make this work with the separate assignment statements for the parameters.. :(
|
if stmt.preserve_regs: # @todo make this work with the separate assignment statements for the parameters.. :(
|
||||||
clobbered = targetdef.clobbered_registers
|
clobbered = targetdef.clobbered_registers
|
||||||
with self.preserving_registers(clobbered):
|
with self.preserving_registers(clobbered):
|
||||||
self.p("\t\tjsr " + targetstr)
|
self.p("\t\tjsr " + targetstr)
|
||||||
if stmt.is_goto:
|
|
||||||
self.p("\t\trts")
|
|
||||||
return
|
return
|
||||||
if isinstance(stmt.target, ParseResult.IndirectValue):
|
if isinstance(stmt.target, ParseResult.IndirectValue):
|
||||||
if stmt.target.name:
|
if stmt.target.name:
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
const .float constf = 3.4556677
|
const .float constf = 3.4556677
|
||||||
const .text constt = "derp"
|
const .text constt = "derp"
|
||||||
|
|
||||||
subx sub1 () -> () = $ffdd
|
subx sub1 () -> (X?) = $ffdd
|
||||||
|
|
||||||
|
|
||||||
bar
|
bar
|
||||||
@ -24,7 +24,7 @@ bar
|
|||||||
go [AX]
|
go [AX]
|
||||||
go [var1]
|
go [var1]
|
||||||
go [mem1]
|
go [mem1]
|
||||||
go [#mem1] ; @todo error: indirection of address-of makes no sense
|
go [#mem1] ; @todo error: indirection of address-of makes no sense, should have outputted jmp mem1 instead of jmp(mem1)
|
||||||
go [$c2.word]
|
go [$c2.word]
|
||||||
go [$c2dd.word]
|
go [$c2dd.word]
|
||||||
go $c000
|
go $c000
|
||||||
|
Loading…
Reference in New Issue
Block a user