mirror of
https://github.com/irmen/prog8.git
synced 2024-12-24 16:29:21 +00:00
de06353194
some programs are now 100% source compatible between C64 and Cx16 targets! import libraries have been rena;med
69 lines
1.3 KiB
Lua
69 lines
1.3 KiB
Lua
%import textio
|
|
%zeropage basicsafe
|
|
|
|
; Note: this program is compatible with C64 and CX16.
|
|
|
|
main {
|
|
|
|
sub start() {
|
|
|
|
ubyte[] uba = [10,0,2,8,5,4,3,9]
|
|
uword[] uwa = [1000,0,200,8000,50,40000,3,900]
|
|
byte[] ba = [-10,0,-2,8,5,4,-3,9,-99]
|
|
word[] wa = [-1000,0,-200,8000,50,31111,3,-900]
|
|
|
|
txt.print("original\n")
|
|
print_arrays()
|
|
|
|
sort(uba)
|
|
sort(uwa)
|
|
sort(ba)
|
|
sort(wa)
|
|
|
|
txt.print("sorted\n")
|
|
print_arrays()
|
|
|
|
reverse(uba)
|
|
reverse(uwa)
|
|
reverse(ba)
|
|
reverse(wa)
|
|
|
|
txt.print("reversed\n")
|
|
print_arrays()
|
|
|
|
return
|
|
|
|
|
|
sub print_arrays() {
|
|
ubyte ub
|
|
uword uw
|
|
byte bb
|
|
word ww
|
|
for ub in uba {
|
|
txt.print_ub(ub)
|
|
txt.chrout(',')
|
|
}
|
|
txt.chrout('\n')
|
|
|
|
for uw in uwa {
|
|
txt.print_uw(uw)
|
|
txt.chrout(',')
|
|
}
|
|
txt.chrout('\n')
|
|
|
|
for bb in ba {
|
|
txt.print_b(bb)
|
|
txt.chrout(',')
|
|
}
|
|
txt.chrout('\n')
|
|
|
|
for ww in wa {
|
|
txt.print_w(ww)
|
|
txt.chrout(',')
|
|
}
|
|
txt.chrout('\n')
|
|
txt.chrout('\n')
|
|
}
|
|
}
|
|
}
|