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
|
||||
lda #>(${arrayVarName2}+$index2)
|
||||
sta P8ZP_SCRATCH_W2+1
|
||||
jsr floats.swap_floats
|
||||
jsr floats.func_swap_f
|
||||
""")
|
||||
}
|
||||
else -> throw AssemblyError("invalid aray elt type")
|
||||
@ -961,7 +961,7 @@ internal class BuiltinFunctionsAsmGen(private val program: Program, private val
|
||||
sta P8ZP_SCRATCH_W2
|
||||
bcc +
|
||||
inc P8ZP_SCRATCH_W2+1
|
||||
+ jsr floats.swap_floats
|
||||
+ jsr floats.func_swap_f
|
||||
""")
|
||||
}
|
||||
else -> throw AssemblyError("invalid aray elt type")
|
||||
@ -1019,7 +1019,7 @@ internal class BuiltinFunctionsAsmGen(private val program: Program, private val
|
||||
sta P8ZP_SCRATCH_W1
|
||||
bcc +
|
||||
inc P8ZP_SCRATCH_W1+1
|
||||
+ jsr floats.swap_floats
|
||||
+ jsr floats.func_swap_f
|
||||
""")
|
||||
}
|
||||
else -> throw AssemblyError("invalid aray elt type")
|
||||
@ -1077,7 +1077,7 @@ internal class BuiltinFunctionsAsmGen(private val program: Program, private val
|
||||
sta P8ZP_SCRATCH_W2
|
||||
lda #>(${arrayVarName2}+$index2)
|
||||
sta P8ZP_SCRATCH_W2+1
|
||||
jsr floats.swap_floats
|
||||
jsr floats.func_swap_f
|
||||
""")
|
||||
}
|
||||
else -> throw AssemblyError("invalid aray elt type")
|
||||
|
@ -1,47 +1,47 @@
|
||||
%import textio
|
||||
%zeropage dontuse
|
||||
%import floats
|
||||
%import test_stack
|
||||
%zeropage basicsafe
|
||||
|
||||
main {
|
||||
|
||||
label:
|
||||
sub start() {
|
||||
|
||||
txt.print("hey\n")
|
||||
%breakpoint
|
||||
txt.print("hey2\n")
|
||||
ubyte ub1
|
||||
ubyte ub2
|
||||
uword uw1
|
||||
uword uw2
|
||||
float fl1
|
||||
float fl2
|
||||
ubyte[10] ubarr
|
||||
uword[10] uwarr
|
||||
float[10] flarr
|
||||
|
||||
; sub2(&label)
|
||||
; sub2(&label_local)
|
||||
; sub2(&main.sub2.label_in_sub2)
|
||||
; uword xx = &label_local
|
||||
; txt.print_uwhex(xx, true)
|
||||
; txt.nl()
|
||||
; 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()
|
||||
swap(ub1, ub2)
|
||||
swap(uw1, uw2)
|
||||
swap(fl1, fl2)
|
||||
swap(ubarr[1], ubarr[2])
|
||||
swap(uwarr[1], uwarr[2])
|
||||
swap(flarr[1], flarr[2])
|
||||
|
||||
label_local:
|
||||
return
|
||||
ubyte ix1
|
||||
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