mirror of
https://github.com/irmen/prog8.git
synced 2025-01-12 19:29:50 +00:00
shuffling some things around
This commit is contained in:
parent
d9546f9dc7
commit
c6fdd65c63
@ -1 +1 @@
|
||||
1.20
|
||||
1.21-dev
|
||||
|
@ -1,8 +1,5 @@
|
||||
package prog8.compiler
|
||||
package prog8.ast
|
||||
|
||||
import prog8.ast.IFunctionCall
|
||||
import prog8.ast.Module
|
||||
import prog8.ast.Program
|
||||
import prog8.ast.antlr.escape
|
||||
import prog8.ast.base.DataType
|
||||
import prog8.ast.base.NumericDatatypes
|
||||
@ -11,6 +8,7 @@ import prog8.ast.base.VarDeclType
|
||||
import prog8.ast.expressions.*
|
||||
import prog8.ast.processing.IAstVisitor
|
||||
import prog8.ast.statements.*
|
||||
import prog8.compiler.toHex
|
||||
|
||||
class AstToSourceCode(val output: (text: String) -> Unit, val program: Program): IAstVisitor {
|
||||
private var scopelevel = 0
|
@ -1,9 +1,10 @@
|
||||
package prog8.compiler
|
||||
|
||||
import prog8.ast.AstToSourceCode
|
||||
import prog8.ast.Program
|
||||
import prog8.ast.base.*
|
||||
import prog8.ast.statements.Directive
|
||||
import prog8.compiler.target.c64.AsmGen
|
||||
import prog8.compiler.target.c64.codegen.AsmGen
|
||||
import prog8.compiler.target.c64.MachineDefinition
|
||||
import prog8.optimizer.constantFold
|
||||
import prog8.optimizer.optimizeStatements
|
||||
|
@ -2,8 +2,7 @@ package prog8.compiler.target.c64
|
||||
|
||||
import java.io.CharConversionException
|
||||
|
||||
class Petscii {
|
||||
companion object {
|
||||
object Petscii {
|
||||
|
||||
// decoding: from Petscii/Screencodes (0-255) to unicode
|
||||
// character tables used from https://github.com/dj51d/cbmcodecs
|
||||
@ -1120,4 +1119,3 @@ class Petscii {
|
||||
return petscii.toShort()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
package prog8.compiler.target.c64
|
||||
package prog8.compiler.target.c64.codegen
|
||||
|
||||
// note: to put stuff on the stack, we use Absolute,X addressing mode which is 3 bytes / 4 cycles
|
||||
// possible space optimization is to use zeropage (indirect),Y which is 2 bytes, but 5 cycles
|
||||
@ -12,6 +12,9 @@ import prog8.compiler.intermediate.Instruction
|
||||
import prog8.compiler.intermediate.IntermediateProgram
|
||||
import prog8.compiler.intermediate.LabelInstr
|
||||
import prog8.compiler.intermediate.Opcode
|
||||
import prog8.compiler.target.c64.AssemblyProgram
|
||||
import prog8.compiler.target.c64.MachineDefinition
|
||||
import prog8.compiler.target.c64.Petscii
|
||||
import prog8.vm.RuntimeValue
|
||||
import java.io.File
|
||||
import java.util.*
|
@ -1,4 +1,4 @@
|
||||
package prog8.compiler.target.c64
|
||||
package prog8.compiler.target.c64.codegen
|
||||
|
||||
import prog8.compiler.target.c64.MachineDefinition.ESTACK_LO_HEX
|
||||
import prog8.compiler.target.c64.MachineDefinition.ESTACK_LO_PLUS1_HEX
|
@ -1,8 +1,9 @@
|
||||
package prog8.compiler.target.c64
|
||||
package prog8.compiler.target.c64.codegen
|
||||
|
||||
import prog8.ast.base.printWarning
|
||||
import prog8.compiler.intermediate.Instruction
|
||||
import prog8.compiler.intermediate.Opcode
|
||||
import prog8.compiler.target.c64.MachineDefinition
|
||||
import prog8.compiler.target.c64.MachineDefinition.C64Zeropage
|
||||
import prog8.compiler.target.c64.MachineDefinition.ESTACK_HI_HEX
|
||||
import prog8.compiler.target.c64.MachineDefinition.ESTACK_HI_PLUS1_HEX
|
||||
@ -2114,7 +2115,8 @@ internal val patterns = listOf<AsmPattern>(
|
||||
AsmPattern(listOf(Opcode.PUSH_BYTE, Opcode.MUL_B), listOf(Opcode.PUSH_BYTE, Opcode.MUL_UB)) { segment ->
|
||||
val amount = segment[0].arg!!.integerValue()
|
||||
val result = optimizedIntMultiplicationsOnStack(segment[1], amount)
|
||||
result ?: " lda #${hexVal(segment[0])} | sta $ESTACK_LO_HEX,x | dex | jsr prog8_lib.mul_byte"
|
||||
result
|
||||
?: " lda #${hexVal(segment[0])} | sta $ESTACK_LO_HEX,x | dex | jsr prog8_lib.mul_byte"
|
||||
},
|
||||
AsmPattern(listOf(Opcode.PUSH_WORD, Opcode.MUL_W), listOf(Opcode.PUSH_WORD, Opcode.MUL_UW)) { segment ->
|
||||
val amount = segment[0].arg!!.integerValue()
|
@ -1,4 +1,4 @@
|
||||
package prog8.compiler.target.c64
|
||||
package prog8.compiler.target.c64.codegen
|
||||
|
||||
import prog8.compiler.CompilerException
|
||||
import prog8.compiler.intermediate.Instruction
|
Loading…
x
Reference in New Issue
Block a user