mirror of
https://github.com/irmen/prog8.git
synced 2024-11-27 03:50:27 +00:00
mult todos.
This commit is contained in:
parent
949d536e42
commit
836509c1d1
@ -36,6 +36,7 @@ internal class AsmGen(private val program: Program,
|
||||
private val outputDir: Path): IAssemblyGenerator {
|
||||
|
||||
// for expressions and augmented assignments:
|
||||
// TODO add 50, 80 and 100 as well (especially for the commanderX16)
|
||||
val optimizedByteMultiplications = setOf(3,5,6,7,9,10,11,12,13,14,15,20,25,40)
|
||||
val optimizedWordMultiplications = setOf(3,5,6,7,9,10,12,15,20,25,40)
|
||||
|
||||
|
@ -372,10 +372,10 @@ internal class AugmentableAssignmentAsmGen(private val program: Program,
|
||||
asmgen.out(" sta (P8ZP_SCRATCH_W1),y")
|
||||
}
|
||||
"*" -> {
|
||||
if(value.absoluteValue in asmgen.optimizedByteMultiplications) {
|
||||
TODO("optimized mem mul byte litval $value")
|
||||
if(value in asmgen.optimizedByteMultiplications) {
|
||||
TODO("optimized mem mul ubyte litval $value")
|
||||
} else {
|
||||
TODO("mem mul byte litval $value")
|
||||
TODO("mem mul ubyte litval $value")
|
||||
// asmgen.out(" jsr prog8_lib.mul_byte")
|
||||
}
|
||||
}
|
||||
@ -581,11 +581,20 @@ internal class AugmentableAssignmentAsmGen(private val program: Program,
|
||||
"+" -> asmgen.out(" lda $name | clc | adc #$value | sta $name")
|
||||
"-" -> asmgen.out(" lda $name | sec | sbc #$value | sta $name")
|
||||
"*" -> {
|
||||
if(value.absoluteValue in asmgen.optimizedByteMultiplications) {
|
||||
TODO("optimized var mul byte litval $value")
|
||||
if(dt == DataType.UBYTE) {
|
||||
if(value in asmgen.optimizedByteMultiplications) {
|
||||
TODO("optimized var mul ubyte litval $value")
|
||||
} else {
|
||||
TODO("var mul ubyte litval $value")
|
||||
// asmgen.out(" jsr prog8_lib.mul_byte")
|
||||
}
|
||||
} else {
|
||||
TODO("var mul byte litval $value")
|
||||
// asmgen.out(" jsr prog8_lib.mul_byte")
|
||||
if(value.absoluteValue in asmgen.optimizedByteMultiplications) {
|
||||
TODO("optimized var mul sbyte litval $value")
|
||||
} else {
|
||||
TODO("var mul sbyte litval $value")
|
||||
// asmgen.out(" jsr prog8_lib.mul_byte")
|
||||
}
|
||||
}
|
||||
}
|
||||
"/" -> {
|
||||
@ -681,11 +690,19 @@ internal class AugmentableAssignmentAsmGen(private val program: Program,
|
||||
}
|
||||
}
|
||||
"*" -> {
|
||||
if(value.absoluteValue in asmgen.optimizedWordMultiplications) {
|
||||
TODO("optimized var word mul litval $value")
|
||||
if(dt == DataType.UWORD){
|
||||
if(value in asmgen.optimizedWordMultiplications) {
|
||||
TODO("optimized var uword mul litval $value")
|
||||
} else {
|
||||
TODO("var uword mul litval $value")
|
||||
}
|
||||
} else {
|
||||
// TODO don't use stack here
|
||||
asmgen.out("""
|
||||
if(value.absoluteValue in asmgen.optimizedWordMultiplications) {
|
||||
TODO("optimized var sword mul litval $value")
|
||||
} else {
|
||||
// TODO don't use stack here
|
||||
// TODO does this work for signed words?
|
||||
asmgen.out("""
|
||||
lda $name
|
||||
sta P8ZP_SCRATCH_W1
|
||||
lda $name+1
|
||||
@ -697,6 +714,7 @@ internal class AugmentableAssignmentAsmGen(private val program: Program,
|
||||
sta $name
|
||||
lda math.multiply_words.result+1
|
||||
sta $name+1""")
|
||||
}
|
||||
}
|
||||
}
|
||||
"/" -> {
|
||||
|
Loading…
Reference in New Issue
Block a user