mirror of
https://github.com/irmen/prog8.git
synced 2025-02-16 22:30:46 +00:00
* fix #54 / step 2: the path stated with assembler directive .binary must be *relative to the .asm file*, not the working directory
This commit is contained in:
parent
23c99002c0
commit
402884b5ce
@ -1309,19 +1309,26 @@ $repeatLabel lda $counterVar
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO: %asminclude and %asmbinary should be done earlier than code gen (-> put content into AST)
|
||||||
|
*/
|
||||||
private fun translate(stmt: Directive) {
|
private fun translate(stmt: Directive) {
|
||||||
when(stmt.directive) {
|
when(stmt.directive) {
|
||||||
"%asminclude" -> {
|
"%asminclude" -> {
|
||||||
val sourcecode = loadAsmIncludeFile(stmt.args[0].str!!, stmt.definingModule().source)
|
val includedName = stmt.args[0].str!!
|
||||||
|
val sourcePath = stmt.definingModule().source // FIXME: %asminclude inside non-library, non-filesystem module
|
||||||
|
val sourcecode = loadAsmIncludeFile(includedName, sourcePath)
|
||||||
assemblyLines.add(sourcecode.trimEnd().trimStart('\n'))
|
assemblyLines.add(sourcecode.trimEnd().trimStart('\n'))
|
||||||
}
|
}
|
||||||
"%asmbinary" -> {
|
"%asmbinary" -> {
|
||||||
val includedName = stmt.args[0].str!!
|
val includedName = stmt.args[0].str!!
|
||||||
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 ""
|
||||||
val includedPath = stmt.definingModule().source.resolveSibling(includedName)
|
val sourcePath = stmt.definingModule().source // FIXME: %asmbinary inside non-library, non-filesystem module
|
||||||
val pathForAssembler = Paths.get("")
|
val includedPath = sourcePath.resolveSibling(includedName)
|
||||||
.absolute() // avoid IllegalArgumentExc in case non-absolute path .relativize(absolute path)
|
|
||||||
|
val pathForAssembler = outputDir // 64tass needs the path *relative to the .asm file*
|
||||||
|
.absolute() // avoid IllegalArgumentExc due to non-absolute path .relativize(absolute path)
|
||||||
.relativize(includedPath)
|
.relativize(includedPath)
|
||||||
out(" .binary \"$pathForAssembler\" $offset $length")
|
out(" .binary \"$pathForAssembler\" $offset $length")
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user