mirror of
https://github.com/irmen/prog8.git
synced 2024-11-18 19:12:44 +00:00
added fast code for x*640
This commit is contained in:
parent
664818fd29
commit
0a5b30e21c
@ -774,6 +774,13 @@ stack_mul_word_320 .proc
|
||||
rts
|
||||
.pend
|
||||
|
||||
stack_mul_word_640 .proc
|
||||
; stackW = (stackLo * 2 * 320) (stackHi doesn't matter)
|
||||
asl P8ESTACK_LO+1,x
|
||||
jmp stack_mul_word_320
|
||||
.pend
|
||||
|
||||
|
||||
; ----------- optimized multiplications (in-place A (byte) and ?? (word)) : ---------
|
||||
mul_byte_3 .proc
|
||||
; A = A + A*2
|
||||
@ -1264,6 +1271,13 @@ mul_word_320 .proc
|
||||
rts
|
||||
.pend
|
||||
|
||||
mul_word_640 .proc
|
||||
; AY = (A * 2 * 320) (msb in Y doesn't matter)
|
||||
asl a
|
||||
jmp mul_word_320
|
||||
.pend
|
||||
|
||||
|
||||
; ----------- end optimized multiplications -----------
|
||||
|
||||
|
||||
|
@ -30,7 +30,7 @@ internal class AsmGen(private val program: Program,
|
||||
|
||||
// for expressions and augmented assignments:
|
||||
val optimizedByteMultiplications = setOf(3,5,6,7,9,10,11,12,13,14,15,20,25,40,50,80,100)
|
||||
val optimizedWordMultiplications = setOf(3,5,6,7,9,10,12,15,20,25,40,50,80,100,320)
|
||||
val optimizedWordMultiplications = setOf(3,5,6,7,9,10,12,15,20,25,40,50,80,100,320,640)
|
||||
private val callGraph = CallGraph(program)
|
||||
|
||||
private val assemblyLines = mutableListOf<String>()
|
||||
|
@ -1,14 +1,27 @@
|
||||
%import textio
|
||||
%zeropage basicsafe
|
||||
|
||||
main {
|
||||
|
||||
sub start() {
|
||||
|
||||
uword enemyRef = $2000
|
||||
ubyte cur
|
||||
uword x=22
|
||||
x*=320
|
||||
txt.print_uw(x)
|
||||
txt.nl()
|
||||
|
||||
x=22
|
||||
x*=640
|
||||
txt.print_uw(x)
|
||||
txt.nl()
|
||||
|
||||
ubyte a=1
|
||||
ubyte b=22
|
||||
|
||||
x = (a*b)*640*a
|
||||
txt.print_uw(x)
|
||||
txt.nl()
|
||||
|
||||
cur = enemyRef[1]
|
||||
+ enemyRef[2]
|
||||
+ enemyRef[3]
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user