mirror of
https://github.com/irmen/prog8.git
synced 2024-11-23 07:32:10 +00:00
fixed block label itself not getting the correct memory address in the assembly
fixed %asmbinary relative path issues
This commit is contained in:
parent
ac0b1da3fc
commit
791dbbab9b
@ -15,6 +15,7 @@ import prog8.compiler.target.c64.codegen.assignment.AsmAssignment
|
|||||||
import prog8.compiler.target.c64.codegen.assignment.AssignmentAsmGen
|
import prog8.compiler.target.c64.codegen.assignment.AssignmentAsmGen
|
||||||
import java.io.CharConversionException
|
import java.io.CharConversionException
|
||||||
import java.nio.file.Path
|
import java.nio.file.Path
|
||||||
|
import java.nio.file.Paths
|
||||||
import java.time.LocalDate
|
import java.time.LocalDate
|
||||||
import java.time.LocalDateTime
|
import java.time.LocalDateTime
|
||||||
import java.util.*
|
import java.util.*
|
||||||
@ -176,14 +177,10 @@ internal class AsmGen(private val program: Program,
|
|||||||
|
|
||||||
private fun block2asm(block: Block) {
|
private fun block2asm(block: Block) {
|
||||||
out("\n\n; ---- block: '${block.name}' ----")
|
out("\n\n; ---- block: '${block.name}' ----")
|
||||||
|
if(block.address!=null)
|
||||||
|
out("* = ${block.address!!.toHex()}")
|
||||||
out("${block.name}\t" + (if("force_output" in block.options()) ".block\n" else ".proc\n"))
|
out("${block.name}\t" + (if("force_output" in block.options()) ".block\n" else ".proc\n"))
|
||||||
|
|
||||||
val addr = block.address
|
|
||||||
if(addr!=null) {
|
|
||||||
out(".cerror * > ${addr.toHex()}, 'block address overlaps by ', *-${addr.toHex()},' bytes'")
|
|
||||||
out("* = ${addr.toHex()}")
|
|
||||||
}
|
|
||||||
|
|
||||||
outputSourceLine(block)
|
outputSourceLine(block)
|
||||||
zeropagevars2asm(block.statements)
|
zeropagevars2asm(block.statements)
|
||||||
memdefs2asm(block.statements)
|
memdefs2asm(block.statements)
|
||||||
@ -1254,7 +1251,9 @@ $counterVar .word 0""")
|
|||||||
"%asmbinary" -> {
|
"%asmbinary" -> {
|
||||||
val offset = if(stmt.args.size>1) ", ${stmt.args[1].int}" else ""
|
val offset = if(stmt.args.size>1) ", ${stmt.args[1].int}" else ""
|
||||||
val length = if(stmt.args.size>2) ", ${stmt.args[2].int}" else ""
|
val length = if(stmt.args.size>2) ", ${stmt.args[2].int}" else ""
|
||||||
out(" .binary \"${stmt.args[0].str}\" $offset $length")
|
val includedSourcePath = stmt.definingModule().source.resolveSibling(stmt.args[0].str)
|
||||||
|
val relPath = Paths.get("").relativize(includedSourcePath)
|
||||||
|
out(" .binary \"./$relPath\" $offset $length")
|
||||||
}
|
}
|
||||||
"%breakpoint" -> {
|
"%breakpoint" -> {
|
||||||
val label = "_prog8_breakpoint_${breakpointLabels.size+1}"
|
val label = "_prog8_breakpoint_${breakpointLabels.size+1}"
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
TODO
|
TODO
|
||||||
====
|
====
|
||||||
|
|
||||||
|
- make blocks without explicit memory address, word-aligned in the assembly.
|
||||||
- add sound to the cx16 tehtriz
|
- add sound to the cx16 tehtriz
|
||||||
- hoist all variable declarations up to the subroutine scope *before* even the constant folding takes place (to avoid undefined symbol errors when referring to a variable from another nested scope in the subroutine)
|
- hoist all variable declarations up to the subroutine scope *before* even the constant folding takes place (to avoid undefined symbol errors when referring to a variable from another nested scope in the subroutine)
|
||||||
- refactor the asmgen into their own submodule?
|
- refactor the asmgen into their own submodule?
|
||||||
|
Loading…
Reference in New Issue
Block a user