mirror of
https://github.com/irmen/prog8.git
synced 2024-09-07 03:54:27 +00:00
bugfix: non-existing asm function was sometimes called to swap floats
This commit is contained in:
parent
b3107cfad0
commit
0204002d9b
@ -888,7 +888,7 @@ internal class BuiltinFunctionsAsmGen(private val program: Program, private val
|
|||||||
sta P8ZP_SCRATCH_W2
|
sta P8ZP_SCRATCH_W2
|
||||||
lda #>(${arrayVarName2}+$index2)
|
lda #>(${arrayVarName2}+$index2)
|
||||||
sta P8ZP_SCRATCH_W2+1
|
sta P8ZP_SCRATCH_W2+1
|
||||||
jsr floats.swap_floats
|
jsr floats.func_swap_f
|
||||||
""")
|
""")
|
||||||
}
|
}
|
||||||
else -> throw AssemblyError("invalid aray elt type")
|
else -> throw AssemblyError("invalid aray elt type")
|
||||||
@ -961,7 +961,7 @@ internal class BuiltinFunctionsAsmGen(private val program: Program, private val
|
|||||||
sta P8ZP_SCRATCH_W2
|
sta P8ZP_SCRATCH_W2
|
||||||
bcc +
|
bcc +
|
||||||
inc P8ZP_SCRATCH_W2+1
|
inc P8ZP_SCRATCH_W2+1
|
||||||
+ jsr floats.swap_floats
|
+ jsr floats.func_swap_f
|
||||||
""")
|
""")
|
||||||
}
|
}
|
||||||
else -> throw AssemblyError("invalid aray elt type")
|
else -> throw AssemblyError("invalid aray elt type")
|
||||||
@ -1019,7 +1019,7 @@ internal class BuiltinFunctionsAsmGen(private val program: Program, private val
|
|||||||
sta P8ZP_SCRATCH_W1
|
sta P8ZP_SCRATCH_W1
|
||||||
bcc +
|
bcc +
|
||||||
inc P8ZP_SCRATCH_W1+1
|
inc P8ZP_SCRATCH_W1+1
|
||||||
+ jsr floats.swap_floats
|
+ jsr floats.func_swap_f
|
||||||
""")
|
""")
|
||||||
}
|
}
|
||||||
else -> throw AssemblyError("invalid aray elt type")
|
else -> throw AssemblyError("invalid aray elt type")
|
||||||
@ -1077,7 +1077,7 @@ internal class BuiltinFunctionsAsmGen(private val program: Program, private val
|
|||||||
sta P8ZP_SCRATCH_W2
|
sta P8ZP_SCRATCH_W2
|
||||||
lda #>(${arrayVarName2}+$index2)
|
lda #>(${arrayVarName2}+$index2)
|
||||||
sta P8ZP_SCRATCH_W2+1
|
sta P8ZP_SCRATCH_W2+1
|
||||||
jsr floats.swap_floats
|
jsr floats.func_swap_f
|
||||||
""")
|
""")
|
||||||
}
|
}
|
||||||
else -> throw AssemblyError("invalid aray elt type")
|
else -> throw AssemblyError("invalid aray elt type")
|
||||||
|
@ -1,47 +1,47 @@
|
|||||||
%import textio
|
%import textio
|
||||||
%zeropage dontuse
|
%import floats
|
||||||
|
%import test_stack
|
||||||
|
%zeropage basicsafe
|
||||||
|
|
||||||
main {
|
main {
|
||||||
|
|
||||||
label:
|
label:
|
||||||
sub start() {
|
sub start() {
|
||||||
|
|
||||||
txt.print("hey\n")
|
ubyte ub1
|
||||||
%breakpoint
|
ubyte ub2
|
||||||
txt.print("hey2\n")
|
uword uw1
|
||||||
|
uword uw2
|
||||||
|
float fl1
|
||||||
|
float fl2
|
||||||
|
ubyte[10] ubarr
|
||||||
|
uword[10] uwarr
|
||||||
|
float[10] flarr
|
||||||
|
|
||||||
; sub2(&label)
|
swap(ub1, ub2)
|
||||||
; sub2(&label_local)
|
swap(uw1, uw2)
|
||||||
; sub2(&main.sub2.label_in_sub2)
|
swap(fl1, fl2)
|
||||||
; uword xx = &label_local
|
swap(ubarr[1], ubarr[2])
|
||||||
; txt.print_uwhex(xx, true)
|
swap(uwarr[1], uwarr[2])
|
||||||
; txt.nl()
|
swap(flarr[1], flarr[2])
|
||||||
; xx = &label
|
|
||||||
; txt.print_uwhex(xx, true)
|
|
||||||
; txt.nl()
|
|
||||||
; xx = &main.label
|
|
||||||
; txt.print_uwhex(xx, true)
|
|
||||||
; txt.nl()
|
|
||||||
; xx = &main.sub2.label_in_sub2
|
|
||||||
; txt.print_uwhex(xx, true)
|
|
||||||
; txt.nl()
|
|
||||||
; xx = main.sub2.sub2var
|
|
||||||
; txt.print_uwhex(xx, true)
|
|
||||||
; txt.nl()
|
|
||||||
; xx = &main.start.label_local
|
|
||||||
; txt.print_uwhex(xx, true)
|
|
||||||
; txt.nl()
|
|
||||||
|
|
||||||
label_local:
|
ubyte ix1
|
||||||
return
|
ubyte ix2
|
||||||
|
|
||||||
|
swap(ubarr[ix1], ubarr[ix2])
|
||||||
|
swap(uwarr[ix1], uwarr[ix2])
|
||||||
|
swap(flarr[ix1], flarr[ix2])
|
||||||
|
swap(flarr[ix1], flarr[2])
|
||||||
|
swap(flarr[2], flarr[ix2])
|
||||||
|
|
||||||
|
swap(ubarr[ix1], ubarr[ix1+2])
|
||||||
|
swap(uwarr[ix1], uwarr[ix1+2])
|
||||||
|
swap(flarr[ix1], flarr[ix1+2])
|
||||||
|
|
||||||
|
uword ptr = $c000
|
||||||
|
swap(@(ptr+1), @(ptr+2))
|
||||||
|
swap(@(ptr+ub1), @(ptr+ub2))
|
||||||
|
|
||||||
|
test_stack.test()
|
||||||
}
|
}
|
||||||
|
|
||||||
; sub sub2(uword ad) {
|
|
||||||
; uword sub2var = 42
|
|
||||||
;
|
|
||||||
; txt.print_uwhex(ad,true)
|
|
||||||
; txt.nl()
|
|
||||||
;label_in_sub2:
|
|
||||||
; txt.nl()
|
|
||||||
; }
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user