prog8/examples/test.p8
2019-01-18 01:33:54 +01:00

57 lines
1.2 KiB
Lua

%import c64utils
%import c64flt
~ main {
sub start() {
word[8] rotatedx = [11,33,55,77,22,44,66,88]
word[8] rotatedy = [11,33,55,77,22,44,66,88]
word[8] rotatedz = [1,3,-5,7,2,4,-6,8]
printarray()
c64scr.print_ub(X)
c64.CHROUT('\n')
for ubyte sorti in 6 to 0 step -1 {
for ubyte i1 in 0 to sorti {
ubyte i2=i1+1
if(rotatedz[i2]>rotatedz[i1]) {
swap(rotatedx[i1], rotatedx[i2])
swap(rotatedy[i1], rotatedy[i2])
swap(rotatedz[i1], rotatedz[i2])
}
}
}
c64scr.print_ub(X)
c64.CHROUT('\n')
printarray()
sub printarray() {
for word a in rotatedx {
c64scr.print_w(a)
c64.CHROUT(',')
}
c64.CHROUT('\n')
for word a in rotatedy {
c64scr.print_w(a)
c64.CHROUT(',')
}
c64.CHROUT('\n')
for word a in rotatedz {
c64scr.print_w(a)
c64.CHROUT(',')
}
c64.CHROUT('\n')
c64.CHROUT('\n')
}
}
}