mirror of
https://github.com/irmen/prog8.git
synced 2024-11-18 04:08:58 +00:00
fix too greedy removal of loop statement bodies sometimes
This commit is contained in:
parent
aa3d8afe00
commit
de4353a93e
@ -156,7 +156,7 @@ asmsub HOMECRSR () -> clobbers(A,X,Y) -> () = $E566 ; cursor to top left of sc
|
||||
|
||||
; ---- C64 kernal routines ----
|
||||
|
||||
asmsub STROUT (uword strptr @ AY) -> clobbers(A, X, Y) -> () = $AB1E ; print null-terminated string (a bit slow, see if you can use c64scr.print_string instead)
|
||||
asmsub STROUT (uword strptr @ AY) -> clobbers(A, X, Y) -> () = $AB1E ; print null-terminated string (use c64scr.print instead)
|
||||
asmsub IRQDFRT () -> clobbers(A,X,Y) -> () = $EA31 ; default IRQ routine
|
||||
asmsub IRQDFEND () -> clobbers(A,X,Y) -> () = $EA81 ; default IRQ end/cleanup
|
||||
asmsub CINT () -> clobbers(A,X,Y) -> () = $FF81 ; (alias: SCINIT) initialize screen editor and video chip
|
||||
|
@ -247,12 +247,6 @@ class StatementOptimizer(private val namespace: INameScope, private val heap: He
|
||||
|
||||
override fun process(whileLoop: WhileLoop): IStatement {
|
||||
super.process(whileLoop)
|
||||
if(whileLoop.body.isEmpty()) {
|
||||
statementsToRemove.add(whileLoop)
|
||||
optimizationsDone++
|
||||
return whileLoop
|
||||
}
|
||||
|
||||
val constvalue = whileLoop.condition.constValue(namespace, heap)
|
||||
if(constvalue!=null) {
|
||||
return if(constvalue.asBooleanValue){
|
||||
@ -277,11 +271,6 @@ class StatementOptimizer(private val namespace: INameScope, private val heap: He
|
||||
|
||||
override fun process(repeatLoop: RepeatLoop): IStatement {
|
||||
super.process(repeatLoop)
|
||||
if(repeatLoop.body.isEmpty()) {
|
||||
statementsToRemove.add(repeatLoop)
|
||||
optimizationsDone++
|
||||
return repeatLoop
|
||||
}
|
||||
val constvalue = repeatLoop.untilCondition.constValue(namespace, heap)
|
||||
if(constvalue!=null) {
|
||||
return if(constvalue.asBooleanValue){
|
||||
|
@ -7,108 +7,108 @@
|
||||
byte v1
|
||||
byte v2
|
||||
|
||||
c64scr.print_ub(X)
|
||||
c64.CHROUT('\n')
|
||||
|
||||
v1 = 100
|
||||
v2 = 127
|
||||
if v1==v2
|
||||
c64.STROUT("error in 100==127!\n")
|
||||
c64scr.print("error in 100==127!\n")
|
||||
else
|
||||
c64.STROUT("ok: 100 not == 127\n")
|
||||
c64scr.print("ok: 100 not == 127\n")
|
||||
|
||||
if v1!=v2
|
||||
c64.STROUT("ok: 100 != 127\n")
|
||||
c64scr.print("ok: 100 != 127\n")
|
||||
else
|
||||
c64.STROUT("error in 100!=127!\n")
|
||||
c64scr.print("error in 100!=127!\n")
|
||||
|
||||
if v1<v2
|
||||
c64.STROUT("ok: 100 < 127\n")
|
||||
c64scr.print("ok: 100 < 127\n")
|
||||
else
|
||||
c64.STROUT("error in 100<127!\n")
|
||||
c64scr.print("error in 100<127!\n")
|
||||
|
||||
if v1<=v2
|
||||
c64.STROUT("ok: 100 <= 127\n")
|
||||
c64scr.print("ok: 100 <= 127\n")
|
||||
else
|
||||
c64.STROUT("error in 100<=127!\n")
|
||||
c64scr.print("error in 100<=127!\n")
|
||||
|
||||
if v1>v2
|
||||
c64.STROUT("error in 100>127!\n")
|
||||
c64scr.print("error in 100>127!\n")
|
||||
else
|
||||
c64.STROUT("ok: 100 is not >127\n")
|
||||
c64scr.print("ok: 100 is not >127\n")
|
||||
|
||||
if v1>=v2
|
||||
c64.STROUT("error in 100>=127!\n")
|
||||
c64scr.print("error in 100>=127!\n")
|
||||
else
|
||||
c64.STROUT("ok: 100 is not >=127\n")
|
||||
c64scr.print("ok: 100 is not >=127\n")
|
||||
|
||||
|
||||
v1 = 125
|
||||
v2 = 22
|
||||
if v1==v2
|
||||
c64.STROUT("error in 125==22!\n")
|
||||
c64scr.print("error in 125==22!\n")
|
||||
else
|
||||
c64.STROUT("ok: 125 not == 22\n")
|
||||
c64scr.print("ok: 125 not == 22\n")
|
||||
|
||||
if v1!=v2
|
||||
c64.STROUT("ok: 125 != 22\n")
|
||||
c64scr.print("ok: 125 != 22\n")
|
||||
else
|
||||
c64.STROUT("error in 125!=22!\n")
|
||||
c64scr.print("error in 125!=22!\n")
|
||||
|
||||
if v1<v2
|
||||
c64.STROUT("error in 125<22!\n")
|
||||
c64scr.print("error in 125<22!\n")
|
||||
else
|
||||
c64.STROUT("ok: 125 is not < 22\n")
|
||||
c64scr.print("ok: 125 is not < 22\n")
|
||||
|
||||
if v1<=v2
|
||||
c64.STROUT("error in 125<=22!\n")
|
||||
c64scr.print("error in 125<=22!\n")
|
||||
else
|
||||
c64.STROUT("ok: 125 is not <= 22\n")
|
||||
c64scr.print("ok: 125 is not <= 22\n")
|
||||
|
||||
if v1>v2
|
||||
c64.STROUT("ok: 125 > 22\n")
|
||||
c64scr.print("ok: 125 > 22\n")
|
||||
else
|
||||
c64.STROUT("error in 125>22!\n")
|
||||
c64scr.print("error in 125>22!\n")
|
||||
|
||||
if v1>=v2
|
||||
c64.STROUT("ok: 125 >= 22\n")
|
||||
c64scr.print("ok: 125 >= 22\n")
|
||||
else
|
||||
c64.STROUT("error in 125>=22!\n")
|
||||
c64scr.print("error in 125>=22!\n")
|
||||
|
||||
v1 = 22
|
||||
v2 = 22
|
||||
if v1==v2
|
||||
c64.STROUT("ok: 22 == 22\n")
|
||||
c64scr.print("ok: 22 == 22\n")
|
||||
else
|
||||
c64.STROUT("error in 22==22!\n")
|
||||
c64scr.print("error in 22==22!\n")
|
||||
|
||||
if v1!=v2
|
||||
c64.STROUT("error in 22!=22!\n")
|
||||
c64scr.print("error in 22!=22!\n")
|
||||
else
|
||||
c64.STROUT("ok: 22 is not != 22\n")
|
||||
c64scr.print("ok: 22 is not != 22\n")
|
||||
|
||||
if v1<v2
|
||||
c64.STROUT("error in 22<22!\n")
|
||||
c64scr.print("error in 22<22!\n")
|
||||
else
|
||||
c64.STROUT("ok: 22 is not < 22\n")
|
||||
c64scr.print("ok: 22 is not < 22\n")
|
||||
|
||||
if v1<=v2
|
||||
c64.STROUT("ok: 22 <= 22\n")
|
||||
c64scr.print("ok: 22 <= 22\n")
|
||||
else
|
||||
c64.STROUT("error in 22<=22!\n")
|
||||
c64scr.print("error in 22<=22!\n")
|
||||
|
||||
if v1>v2
|
||||
c64.STROUT("error in 22>22!\n")
|
||||
c64scr.print("error in 22>22!\n")
|
||||
else
|
||||
c64.STROUT("ok: 22 is not > 22\n")
|
||||
c64scr.print("ok: 22 is not > 22\n")
|
||||
|
||||
if v1>=v2
|
||||
c64.STROUT("ok: 22 >= 22\n")
|
||||
c64scr.print("ok: 22 >= 22\n")
|
||||
else
|
||||
c64.STROUT("error in 22>=22!\n")
|
||||
c64scr.print("error in 22>=22!\n")
|
||||
|
||||
c64scr.print_ub(X)
|
||||
c64.CHROUT('\n')
|
||||
ubyte endX = X
|
||||
if endX == 255
|
||||
c64scr.print("stack x ok!\n")
|
||||
else
|
||||
c64scr.print("error: stack x != 255 !\n")
|
||||
|
||||
}
|
||||
|
||||
|
@ -8,109 +8,108 @@
|
||||
float v1
|
||||
float v2
|
||||
|
||||
c64scr.print_ub(X)
|
||||
c64.CHROUT('\n')
|
||||
|
||||
v1 = 1.11
|
||||
v2 = 699.99
|
||||
if v1==v2
|
||||
c64.STROUT("error in 1.11==699.99!\n")
|
||||
c64scr.print("error in 1.11==699.99!\n")
|
||||
else
|
||||
c64.STROUT("ok: 1.11 not == 699.99\n")
|
||||
c64scr.print("ok: 1.11 not == 699.99\n")
|
||||
|
||||
if v1!=v2
|
||||
c64.STROUT("ok: 1.11 != 699.99\n")
|
||||
c64scr.print("ok: 1.11 != 699.99\n")
|
||||
else
|
||||
c64.STROUT("error in 1.11!=699.99!\n")
|
||||
c64scr.print("error in 1.11!=699.99!\n")
|
||||
|
||||
if v1<v2
|
||||
c64.STROUT("ok: 1.11 < 699.99\n")
|
||||
c64scr.print("ok: 1.11 < 699.99\n")
|
||||
else
|
||||
c64.STROUT("error in 1.11<699.99!\n")
|
||||
c64scr.print("error in 1.11<699.99!\n")
|
||||
|
||||
if v1<=v2
|
||||
c64.STROUT("ok: 1.11 <= 699.99\n")
|
||||
c64scr.print("ok: 1.11 <= 699.99\n")
|
||||
else
|
||||
c64.STROUT("error in 1.11<=699.99!\n")
|
||||
c64scr.print("error in 1.11<=699.99!\n")
|
||||
|
||||
if v1>v2
|
||||
c64.STROUT("error in 1.11>699.99!\n")
|
||||
c64scr.print("error in 1.11>699.99!\n")
|
||||
else
|
||||
c64.STROUT("ok: 1.11 is not >699.99\n")
|
||||
c64scr.print("ok: 1.11 is not >699.99\n")
|
||||
|
||||
if v1>=v2
|
||||
c64.STROUT("error in 1.11>=699.99!\n")
|
||||
c64scr.print("error in 1.11>=699.99!\n")
|
||||
else
|
||||
c64.STROUT("ok: 1.11 is not >=699.99\n")
|
||||
c64scr.print("ok: 1.11 is not >=699.99\n")
|
||||
|
||||
|
||||
v1 = 555.5
|
||||
v2 = -22.2
|
||||
if v1==v2
|
||||
c64.STROUT("error in 555.5==-22.2!\n")
|
||||
c64scr.print("error in 555.5==-22.2!\n")
|
||||
else
|
||||
c64.STROUT("ok: 555.5 not == -22.2\n")
|
||||
c64scr.print("ok: 555.5 not == -22.2\n")
|
||||
|
||||
if v1!=v2
|
||||
c64.STROUT("ok: 555.5 != -22.2\n")
|
||||
c64scr.print("ok: 555.5 != -22.2\n")
|
||||
else
|
||||
c64.STROUT("error in 555.5!=-22.2!\n")
|
||||
c64scr.print("error in 555.5!=-22.2!\n")
|
||||
|
||||
if v1<v2
|
||||
c64.STROUT("error in 555.5<-22.2!\n")
|
||||
c64scr.print("error in 555.5<-22.2!\n")
|
||||
else
|
||||
c64.STROUT("ok: 555.5 is not < -22.2\n")
|
||||
c64scr.print("ok: 555.5 is not < -22.2\n")
|
||||
|
||||
if v1<=v2
|
||||
c64.STROUT("error in 555.5<=-22.2!\n")
|
||||
c64scr.print("error in 555.5<=-22.2!\n")
|
||||
else
|
||||
c64.STROUT("ok: 555.5 is not <= -22.2\n")
|
||||
c64scr.print("ok: 555.5 is not <= -22.2\n")
|
||||
|
||||
if v1>v2
|
||||
c64.STROUT("ok: 555.5 > -22.2\n")
|
||||
c64scr.print("ok: 555.5 > -22.2\n")
|
||||
else
|
||||
c64.STROUT("error in 555.5>-22.2!\n")
|
||||
c64scr.print("error in 555.5>-22.2!\n")
|
||||
|
||||
if v1>=v2
|
||||
c64.STROUT("ok: 555.5 >= -22.2\n")
|
||||
c64scr.print("ok: 555.5 >= -22.2\n")
|
||||
else
|
||||
c64.STROUT("error in 555.5>=-22.2!\n")
|
||||
c64scr.print("error in 555.5>=-22.2!\n")
|
||||
|
||||
v1 = -22.2
|
||||
v2 = -22.2
|
||||
if v1==v2
|
||||
c64.STROUT("ok: -22.2 == -22.2\n")
|
||||
c64scr.print("ok: -22.2 == -22.2\n")
|
||||
else
|
||||
c64.STROUT("error in -22.2==-22.2!\n")
|
||||
c64scr.print("error in -22.2==-22.2!\n")
|
||||
|
||||
if v1!=v2
|
||||
c64.STROUT("error in -22.2!=-22.2!\n")
|
||||
c64scr.print("error in -22.2!=-22.2!\n")
|
||||
else
|
||||
c64.STROUT("ok: -22.2 is not != -22.2\n")
|
||||
c64scr.print("ok: -22.2 is not != -22.2\n")
|
||||
|
||||
if v1<v2
|
||||
c64.STROUT("error in -22.2<-22.2!\n")
|
||||
c64scr.print("error in -22.2<-22.2!\n")
|
||||
else
|
||||
c64.STROUT("ok: -22.2 is not < -22.2\n")
|
||||
c64scr.print("ok: -22.2 is not < -22.2\n")
|
||||
|
||||
if v1<=v2
|
||||
c64.STROUT("ok: -22.2 <= -22.2\n")
|
||||
c64scr.print("ok: -22.2 <= -22.2\n")
|
||||
else
|
||||
c64.STROUT("error in -22.2<=-22.2!\n")
|
||||
c64scr.print("error in -22.2<=-22.2!\n")
|
||||
|
||||
if v1>v2
|
||||
c64.STROUT("error in -22.2>-22.2!\n")
|
||||
c64scr.print("error in -22.2>-22.2!\n")
|
||||
else
|
||||
c64.STROUT("ok: -22.2 is not > -22.2\n")
|
||||
c64scr.print("ok: -22.2 is not > -22.2\n")
|
||||
|
||||
if v1>=v2
|
||||
c64.STROUT("ok: -22.2 >= -22.2\n")
|
||||
c64scr.print("ok: -22.2 >= -22.2\n")
|
||||
else
|
||||
c64.STROUT("error in -22.2>=-22.2!\n")
|
||||
|
||||
c64scr.print_ub(X)
|
||||
c64.CHROUT('\n')
|
||||
c64scr.print("error in -22.2>=-22.2!\n")
|
||||
|
||||
ubyte endX = X
|
||||
if endX == 255
|
||||
c64scr.print("stack x ok!\n")
|
||||
else
|
||||
c64scr.print("error: stack x != 255 !\n")
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -8,108 +8,108 @@
|
||||
ubyte v1
|
||||
ubyte v2
|
||||
|
||||
c64scr.print_ub(X)
|
||||
c64.CHROUT('\n')
|
||||
|
||||
v1 = 100
|
||||
v2 = 200
|
||||
if v1==v2
|
||||
c64.STROUT("error in 100==200!\n")
|
||||
c64scr.print("error in 100==200!\n")
|
||||
else
|
||||
c64.STROUT("ok: 100 not == 200\n")
|
||||
c64scr.print("ok: 100 not == 200\n")
|
||||
|
||||
if v1!=v2
|
||||
c64.STROUT("ok: 100 != 200\n")
|
||||
c64scr.print("ok: 100 != 200\n")
|
||||
else
|
||||
c64.STROUT("error in 100!=200!\n")
|
||||
c64scr.print("error in 100!=200!\n")
|
||||
|
||||
if v1<v2
|
||||
c64.STROUT("ok: 100 < 200\n")
|
||||
c64scr.print("ok: 100 < 200\n")
|
||||
else
|
||||
c64.STROUT("error in 100<200!\n")
|
||||
c64scr.print("error in 100<200!\n")
|
||||
|
||||
if v1<=v2
|
||||
c64.STROUT("ok: 100 <= 200\n")
|
||||
c64scr.print("ok: 100 <= 200\n")
|
||||
else
|
||||
c64.STROUT("error in 100<=200!\n")
|
||||
c64scr.print("error in 100<=200!\n")
|
||||
|
||||
if v1>v2
|
||||
c64.STROUT("error in 100>200!\n")
|
||||
c64scr.print("error in 100>200!\n")
|
||||
else
|
||||
c64.STROUT("ok: 100 is not >200\n")
|
||||
c64scr.print("ok: 100 is not >200\n")
|
||||
|
||||
if v1>=v2
|
||||
c64.STROUT("error in 100>=200!\n")
|
||||
c64scr.print("error in 100>=200!\n")
|
||||
else
|
||||
c64.STROUT("ok: 100 is not >=200\n")
|
||||
c64scr.print("ok: 100 is not >=200\n")
|
||||
|
||||
|
||||
v1 = 155
|
||||
v2 = 22
|
||||
if v1==v2
|
||||
c64.STROUT("error in 155==22!\n")
|
||||
c64scr.print("error in 155==22!\n")
|
||||
else
|
||||
c64.STROUT("ok: 155 not == 22\n")
|
||||
c64scr.print("ok: 155 not == 22\n")
|
||||
|
||||
if v1!=v2
|
||||
c64.STROUT("ok: 155 != 22\n")
|
||||
c64scr.print("ok: 155 != 22\n")
|
||||
else
|
||||
c64.STROUT("error in 155!=22!\n")
|
||||
c64scr.print("error in 155!=22!\n")
|
||||
|
||||
if v1<v2
|
||||
c64.STROUT("error in 155<22!\n")
|
||||
c64scr.print("error in 155<22!\n")
|
||||
else
|
||||
c64.STROUT("ok: 155 is not < 22\n")
|
||||
c64scr.print("ok: 155 is not < 22\n")
|
||||
|
||||
if v1<=v2
|
||||
c64.STROUT("error in 155<=22!\n")
|
||||
c64scr.print("error in 155<=22!\n")
|
||||
else
|
||||
c64.STROUT("ok: 155 is not <= 22\n")
|
||||
c64scr.print("ok: 155 is not <= 22\n")
|
||||
|
||||
if v1>v2
|
||||
c64.STROUT("ok: 155 > 22\n")
|
||||
c64scr.print("ok: 155 > 22\n")
|
||||
else
|
||||
c64.STROUT("error in 155>22!\n")
|
||||
c64scr.print("error in 155>22!\n")
|
||||
|
||||
if v1>=v2
|
||||
c64.STROUT("ok: 155 >= 22\n")
|
||||
c64scr.print("ok: 155 >= 22\n")
|
||||
else
|
||||
c64.STROUT("error in 155>=22!\n")
|
||||
c64scr.print("error in 155>=22!\n")
|
||||
|
||||
v1 = 22
|
||||
v2 = 22
|
||||
if v1==v2
|
||||
c64.STROUT("ok: 22 == 22\n")
|
||||
c64scr.print("ok: 22 == 22\n")
|
||||
else
|
||||
c64.STROUT("error in 22==22!\n")
|
||||
c64scr.print("error in 22==22!\n")
|
||||
|
||||
if v1!=v2
|
||||
c64.STROUT("error in 22!=22!\n")
|
||||
c64scr.print("error in 22!=22!\n")
|
||||
else
|
||||
c64.STROUT("ok: 22 is not != 22\n")
|
||||
c64scr.print("ok: 22 is not != 22\n")
|
||||
|
||||
if v1<v2
|
||||
c64.STROUT("error in 22<22!\n")
|
||||
c64scr.print("error in 22<22!\n")
|
||||
else
|
||||
c64.STROUT("ok: 22 is not < 22\n")
|
||||
c64scr.print("ok: 22 is not < 22\n")
|
||||
|
||||
if v1<=v2
|
||||
c64.STROUT("ok: 22 <= 22\n")
|
||||
c64scr.print("ok: 22 <= 22\n")
|
||||
else
|
||||
c64.STROUT("error in 22<=22!\n")
|
||||
c64scr.print("error in 22<=22!\n")
|
||||
|
||||
if v1>v2
|
||||
c64.STROUT("error in 22>22!\n")
|
||||
c64scr.print("error in 22>22!\n")
|
||||
else
|
||||
c64.STROUT("ok: 22 is not > 22\n")
|
||||
c64scr.print("ok: 22 is not > 22\n")
|
||||
|
||||
if v1>=v2
|
||||
c64.STROUT("ok: 22 >= 22\n")
|
||||
c64scr.print("ok: 22 >= 22\n")
|
||||
else
|
||||
c64.STROUT("error in 22>=22!\n")
|
||||
c64scr.print("error in 22>=22!\n")
|
||||
|
||||
c64scr.print_ub(X)
|
||||
c64.CHROUT('\n')
|
||||
ubyte endX = X
|
||||
if endX == 255
|
||||
c64scr.print("stack x ok!\n")
|
||||
else
|
||||
c64scr.print("error: stack x != 255 !\n")
|
||||
|
||||
}
|
||||
|
||||
|
@ -8,108 +8,109 @@
|
||||
uword v1
|
||||
uword v2
|
||||
|
||||
c64scr.print_ub(X)
|
||||
c64.CHROUT('\n')
|
||||
|
||||
v1 = 100
|
||||
v2 = 64444
|
||||
if v1==v2
|
||||
c64.STROUT("error in 100==64444!\n")
|
||||
c64scr.print("error in 100==64444!\n")
|
||||
else
|
||||
c64.STROUT("ok: 100 not == 64444\n")
|
||||
c64scr.print("ok: 100 not == 64444\n")
|
||||
|
||||
if v1!=v2
|
||||
c64.STROUT("ok: 100 != 64444\n")
|
||||
c64scr.print("ok: 100 != 64444\n")
|
||||
else
|
||||
c64.STROUT("error in 100!=64444!\n")
|
||||
c64scr.print("error in 100!=64444!\n")
|
||||
|
||||
if v1<v2
|
||||
c64.STROUT("ok: 100 < 64444\n")
|
||||
c64scr.print("ok: 100 < 64444\n")
|
||||
else
|
||||
c64.STROUT("error in 100<64444!\n")
|
||||
c64scr.print("error in 100<64444!\n")
|
||||
|
||||
if v1<=v2
|
||||
c64.STROUT("ok: 100 <= 64444\n")
|
||||
c64scr.print("ok: 100 <= 64444\n")
|
||||
else
|
||||
c64.STROUT("error in 100<=64444!\n")
|
||||
c64scr.print("error in 100<=64444!\n")
|
||||
|
||||
if v1>v2
|
||||
c64.STROUT("error in 100>64444!\n")
|
||||
c64scr.print("error in 100>64444!\n")
|
||||
else
|
||||
c64.STROUT("ok: 100 is not >64444\n")
|
||||
c64scr.print("ok: 100 is not >64444\n")
|
||||
|
||||
if v1>=v2
|
||||
c64.STROUT("error in 100>=64444!\n")
|
||||
c64scr.print("error in 100>=64444!\n")
|
||||
else
|
||||
c64.STROUT("ok: 100 is not >=64444\n")
|
||||
c64scr.print("ok: 100 is not >=64444\n")
|
||||
|
||||
|
||||
v1 = 5555
|
||||
v2 = 322
|
||||
if v1==v2
|
||||
c64.STROUT("error in 5555==322!\n")
|
||||
c64scr.print("error in 5555==322!\n")
|
||||
else
|
||||
c64.STROUT("ok: 5555 not == 322\n")
|
||||
c64scr.print("ok: 5555 not == 322\n")
|
||||
|
||||
if v1!=v2
|
||||
c64.STROUT("ok: 5555 != 322\n")
|
||||
c64scr.print("ok: 5555 != 322\n")
|
||||
else
|
||||
c64.STROUT("error in 5555!=322!\n")
|
||||
c64scr.print("error in 5555!=322!\n")
|
||||
|
||||
if v1<v2
|
||||
c64.STROUT("error in 5555<322!\n")
|
||||
c64scr.print("error in 5555<322!\n")
|
||||
else
|
||||
c64.STROUT("ok: 5555 is not < 322\n")
|
||||
c64scr.print("ok: 5555 is not < 322\n")
|
||||
|
||||
if v1<=v2
|
||||
c64.STROUT("error in 5555<=322!\n")
|
||||
c64scr.print("error in 5555<=322!\n")
|
||||
else
|
||||
c64.STROUT("ok: 5555 is not <= 322\n")
|
||||
c64scr.print("ok: 5555 is not <= 322\n")
|
||||
|
||||
if v1>v2
|
||||
c64.STROUT("ok: 5555 > 322\n")
|
||||
c64scr.print("ok: 5555 > 322\n")
|
||||
else
|
||||
c64.STROUT("error in 5555>322!\n")
|
||||
c64scr.print("error in 5555>322!\n")
|
||||
|
||||
if v1>=v2
|
||||
c64.STROUT("ok: 5555 >= 322\n")
|
||||
c64scr.print("ok: 5555 >= 322\n")
|
||||
else
|
||||
c64.STROUT("error in 5555>=322!\n")
|
||||
c64scr.print("error in 5555>=322!\n")
|
||||
|
||||
v1 = 322
|
||||
v2 = 322
|
||||
if v1==v2
|
||||
c64.STROUT("ok: 322 == 322\n")
|
||||
c64scr.print("ok: 322 == 322\n")
|
||||
else
|
||||
c64.STROUT("error in 322==322!\n")
|
||||
c64scr.print("error in 322==322!\n")
|
||||
|
||||
if v1!=v2
|
||||
c64.STROUT("error in 322!=322!\n")
|
||||
c64scr.print("error in 322!=322!\n")
|
||||
else
|
||||
c64.STROUT("ok: 322 is not != 322\n")
|
||||
c64scr.print("ok: 322 is not != 322\n")
|
||||
|
||||
if v1<v2
|
||||
c64.STROUT("error in 322<322!\n")
|
||||
c64scr.print("error in 322<322!\n")
|
||||
else
|
||||
c64.STROUT("ok: 322 is not < 322\n")
|
||||
c64scr.print("ok: 322 is not < 322\n")
|
||||
|
||||
if v1<=v2
|
||||
c64.STROUT("ok: 322 <= 322\n")
|
||||
c64scr.print("ok: 322 <= 322\n")
|
||||
else
|
||||
c64.STROUT("error in 322<=322!\n")
|
||||
c64scr.print("error in 322<=322!\n")
|
||||
|
||||
if v1>v2
|
||||
c64.STROUT("error in 322>322!\n")
|
||||
c64scr.print("error in 322>322!\n")
|
||||
else
|
||||
c64.STROUT("ok: 322 is not > 322\n")
|
||||
c64scr.print("ok: 322 is not > 322\n")
|
||||
|
||||
if v1>=v2
|
||||
c64.STROUT("ok: 322 >= 322\n")
|
||||
c64scr.print("ok: 322 >= 322\n")
|
||||
else
|
||||
c64.STROUT("error in 322>=322!\n")
|
||||
c64scr.print("error in 322>=322!\n")
|
||||
|
||||
c64scr.print_ub(X)
|
||||
c64.CHROUT('\n')
|
||||
|
||||
ubyte endX = X
|
||||
if endX == 255
|
||||
c64scr.print("stack x ok!\n")
|
||||
else
|
||||
c64scr.print("error: stack x != 255 !\n")
|
||||
|
||||
}
|
||||
|
||||
|
@ -8,108 +8,108 @@
|
||||
word v1
|
||||
word v2
|
||||
|
||||
c64scr.print_ub(X)
|
||||
c64.CHROUT('\n')
|
||||
|
||||
v1 = 100
|
||||
v2 = 30333
|
||||
if v1==v2
|
||||
c64.STROUT("error in 100==30333!\n")
|
||||
c64scr.print("error in 100==30333!\n")
|
||||
else
|
||||
c64.STROUT("ok: 100 not == 30333\n")
|
||||
c64scr.print("ok: 100 not == 30333\n")
|
||||
|
||||
if v1!=v2
|
||||
c64.STROUT("ok: 100 != 30333\n")
|
||||
c64scr.print("ok: 100 != 30333\n")
|
||||
else
|
||||
c64.STROUT("error in 100!=30333!\n")
|
||||
c64scr.print("error in 100!=30333!\n")
|
||||
|
||||
if v1<v2
|
||||
c64.STROUT("ok: 100 < 30333\n")
|
||||
c64scr.print("ok: 100 < 30333\n")
|
||||
else
|
||||
c64.STROUT("error in 100<30333!\n")
|
||||
c64scr.print("error in 100<30333!\n")
|
||||
|
||||
if v1<=v2
|
||||
c64.STROUT("ok: 100 <= 30333\n")
|
||||
c64scr.print("ok: 100 <= 30333\n")
|
||||
else
|
||||
c64.STROUT("error in 100<=30333!\n")
|
||||
c64scr.print("error in 100<=30333!\n")
|
||||
|
||||
if v1>v2
|
||||
c64.STROUT("error in 100>30333!\n")
|
||||
c64scr.print("error in 100>30333!\n")
|
||||
else
|
||||
c64.STROUT("ok: 100 is not >30333\n")
|
||||
c64scr.print("ok: 100 is not >30333\n")
|
||||
|
||||
if v1>=v2
|
||||
c64.STROUT("error in 100>=30333!\n")
|
||||
c64scr.print("error in 100>=30333!\n")
|
||||
else
|
||||
c64.STROUT("ok: 100 is not >=30333\n")
|
||||
c64scr.print("ok: 100 is not >=30333\n")
|
||||
|
||||
|
||||
v1 = 125
|
||||
v2 = -222
|
||||
if v1==v2
|
||||
c64.STROUT("error in 125==-222!\n")
|
||||
c64scr.print("error in 125==-222!\n")
|
||||
else
|
||||
c64.STROUT("ok: 125 not == -222\n")
|
||||
c64scr.print("ok: 125 not == -222\n")
|
||||
|
||||
if v1!=v2
|
||||
c64.STROUT("ok: 125 != -222\n")
|
||||
c64scr.print("ok: 125 != -222\n")
|
||||
else
|
||||
c64.STROUT("error in 125!=-222!\n")
|
||||
c64scr.print("error in 125!=-222!\n")
|
||||
|
||||
if v1<v2
|
||||
c64.STROUT("error in 125<-222!\n")
|
||||
c64scr.print("error in 125<-222!\n")
|
||||
else
|
||||
c64.STROUT("ok: 125 is not < -222\n")
|
||||
c64scr.print("ok: 125 is not < -222\n")
|
||||
|
||||
if v1<=v2
|
||||
c64.STROUT("error in 125<=-222!\n")
|
||||
c64scr.print("error in 125<=-222!\n")
|
||||
else
|
||||
c64.STROUT("ok: 125 is not <= -222\n")
|
||||
c64scr.print("ok: 125 is not <= -222\n")
|
||||
|
||||
if v1>v2
|
||||
c64.STROUT("ok: 125 > -222\n")
|
||||
c64scr.print("ok: 125 > -222\n")
|
||||
else
|
||||
c64.STROUT("error in 125>-222!\n")
|
||||
c64scr.print("error in 125>-222!\n")
|
||||
|
||||
if v1>=v2
|
||||
c64.STROUT("ok: 125 >= -222\n")
|
||||
c64scr.print("ok: 125 >= -222\n")
|
||||
else
|
||||
c64.STROUT("error in 125>=-222!\n")
|
||||
c64scr.print("error in 125>=-222!\n")
|
||||
|
||||
v1 = -222
|
||||
v2 = -222
|
||||
if v1==v2
|
||||
c64.STROUT("ok: -222 == -222\n")
|
||||
c64scr.print("ok: -222 == -222\n")
|
||||
else
|
||||
c64.STROUT("error in -222==-222!\n")
|
||||
c64scr.print("error in -222==-222!\n")
|
||||
|
||||
if v1!=v2
|
||||
c64.STROUT("error in -222!=-222!\n")
|
||||
c64scr.print("error in -222!=-222!\n")
|
||||
else
|
||||
c64.STROUT("ok: -222 is not != -222\n")
|
||||
c64scr.print("ok: -222 is not != -222\n")
|
||||
|
||||
if v1<v2
|
||||
c64.STROUT("error in -222<-222!\n")
|
||||
c64scr.print("error in -222<-222!\n")
|
||||
else
|
||||
c64.STROUT("ok: -222 is not < -222\n")
|
||||
c64scr.print("ok: -222 is not < -222\n")
|
||||
|
||||
if v1<=v2
|
||||
c64.STROUT("ok: -222 <= -222\n")
|
||||
c64scr.print("ok: -222 <= -222\n")
|
||||
else
|
||||
c64.STROUT("error in -222<=-222!\n")
|
||||
c64scr.print("error in -222<=-222!\n")
|
||||
|
||||
if v1>v2
|
||||
c64.STROUT("error in -222>-222!\n")
|
||||
c64scr.print("error in -222>-222!\n")
|
||||
else
|
||||
c64.STROUT("ok: -222 is not > -222\n")
|
||||
c64scr.print("ok: -222 is not > -222\n")
|
||||
|
||||
if v1>=v2
|
||||
c64.STROUT("ok: -222 >= -222\n")
|
||||
c64scr.print("ok: -222 >= -222\n")
|
||||
else
|
||||
c64.STROUT("error in -222>=-222!\n")
|
||||
c64scr.print("error in -222>=-222!\n")
|
||||
|
||||
c64scr.print_ub(X)
|
||||
c64.CHROUT('\n')
|
||||
ubyte endX = X
|
||||
if endX == 255
|
||||
c64scr.print("stack x ok!\n")
|
||||
else
|
||||
c64scr.print("error: stack x != 255 !\n")
|
||||
|
||||
}
|
||||
|
||||
|
@ -8,10 +8,7 @@
|
||||
byte v2
|
||||
ubyte cr
|
||||
|
||||
; check stack usage:
|
||||
c64.STROUT("signed byte ")
|
||||
c64scr.print_ub(X)
|
||||
c64.CHROUT(' ')
|
||||
c64scr.print("signed byte ")
|
||||
|
||||
cr=v1==v2
|
||||
cr=v1==v2
|
||||
@ -38,61 +35,62 @@
|
||||
cr=v1>=v2
|
||||
cr=v1>=v2
|
||||
|
||||
c64scr.print_ub(X)
|
||||
c64.CHROUT('\n')
|
||||
|
||||
; comparisons:
|
||||
v1=-20
|
||||
v2=125
|
||||
c64.STROUT("v1=-20, v2=125\n")
|
||||
c64scr.print("v1=-20, v2=125\n")
|
||||
compare()
|
||||
|
||||
v1=80
|
||||
v2=80
|
||||
c64.STROUT("v1 = v2 = 80\n")
|
||||
c64scr.print("v1 = v2 = 80\n")
|
||||
compare()
|
||||
|
||||
v1=20
|
||||
v2=-111
|
||||
c64.STROUT("v1=20, v2=-111\n")
|
||||
c64scr.print("v1=20, v2=-111\n")
|
||||
compare()
|
||||
|
||||
c64scr.print_ub(X)
|
||||
c64.CHROUT('\n')
|
||||
ubyte endX = X
|
||||
if endX == 255
|
||||
c64scr.print("\nstack x ok!\n")
|
||||
else
|
||||
c64scr.print("\nerror: stack x != 255 !\n")
|
||||
|
||||
return
|
||||
|
||||
|
||||
sub compare() {
|
||||
c64.STROUT(" == != < > <= >=\n")
|
||||
c64scr.print(" == != < > <= >=\n")
|
||||
|
||||
if v1==v2
|
||||
c64.STROUT(" Q ")
|
||||
c64scr.print(" Q ")
|
||||
else
|
||||
c64.STROUT(" . ")
|
||||
c64scr.print(" . ")
|
||||
if v1!=v2
|
||||
c64.STROUT(" Q ")
|
||||
c64scr.print(" Q ")
|
||||
else
|
||||
c64.STROUT(" . ")
|
||||
c64scr.print(" . ")
|
||||
|
||||
if v1<v2
|
||||
c64.STROUT(" Q ")
|
||||
c64scr.print(" Q ")
|
||||
else
|
||||
c64.STROUT(" . ")
|
||||
c64scr.print(" . ")
|
||||
|
||||
if v1>v2
|
||||
c64.STROUT(" Q ")
|
||||
c64scr.print(" Q ")
|
||||
else
|
||||
c64.STROUT(" . ")
|
||||
c64scr.print(" . ")
|
||||
|
||||
if v1<=v2
|
||||
c64.STROUT(" Q ")
|
||||
c64scr.print(" Q ")
|
||||
else
|
||||
c64.STROUT(" . ")
|
||||
c64scr.print(" . ")
|
||||
|
||||
if v1>=v2
|
||||
c64.STROUT(" Q ")
|
||||
c64scr.print(" Q ")
|
||||
else
|
||||
c64.STROUT(" . ")
|
||||
c64scr.print(" . ")
|
||||
c64.CHROUT('\n')
|
||||
|
||||
}
|
||||
|
@ -9,10 +9,7 @@
|
||||
float v2
|
||||
ubyte cr
|
||||
|
||||
; check stack usage:
|
||||
c64.STROUT("floating point ")
|
||||
c64scr.print_ub(X)
|
||||
c64.CHROUT(' ')
|
||||
c64scr.print("floating point ")
|
||||
|
||||
cr=v1==v2
|
||||
cr=v1==v2
|
||||
@ -39,76 +36,77 @@
|
||||
cr=v1>=v2
|
||||
cr=v1>=v2
|
||||
|
||||
c64scr.print_ub(X)
|
||||
c64.CHROUT('\n')
|
||||
|
||||
; comparisons:
|
||||
v1=20
|
||||
v2=666.66
|
||||
c64.STROUT("v1=20, v2=666.66\n")
|
||||
c64scr.print("v1=20, v2=666.66\n")
|
||||
compare()
|
||||
|
||||
v1=-20
|
||||
v2=666.66
|
||||
c64.STROUT("v1=-20, v2=666.66\n")
|
||||
c64scr.print("v1=-20, v2=666.66\n")
|
||||
compare()
|
||||
|
||||
v1=666.66
|
||||
v2=555.55
|
||||
c64.STROUT("v1=666.66, v2=555.55\n")
|
||||
c64scr.print("v1=666.66, v2=555.55\n")
|
||||
compare()
|
||||
|
||||
v1=3.1415
|
||||
v2=-3.1415
|
||||
c64.STROUT("v1 = 3.1415, v2 = -3.1415\n")
|
||||
c64scr.print("v1 = 3.1415, v2 = -3.1415\n")
|
||||
compare()
|
||||
|
||||
v1=3.1415
|
||||
v2=3.1415
|
||||
c64.STROUT("v1 = v2 = 3.1415\n")
|
||||
c64scr.print("v1 = v2 = 3.1415\n")
|
||||
compare()
|
||||
|
||||
v1=0
|
||||
v2=0
|
||||
c64.STROUT("v1 = v2 = 0\n")
|
||||
c64scr.print("v1 = v2 = 0\n")
|
||||
compare()
|
||||
|
||||
c64scr.print_ub(X)
|
||||
c64.CHROUT('\n')
|
||||
ubyte endX = X
|
||||
if endX == 255
|
||||
c64scr.print("\nstack x ok!\n")
|
||||
else
|
||||
c64scr.print("\nerror: stack x != 255 !\n")
|
||||
|
||||
|
||||
return
|
||||
|
||||
sub compare() {
|
||||
c64.STROUT(" == != < > <= >=\n")
|
||||
c64scr.print(" == != < > <= >=\n")
|
||||
|
||||
if v1==v2
|
||||
c64.STROUT(" Q ")
|
||||
c64scr.print(" Q ")
|
||||
else
|
||||
c64.STROUT(" . ")
|
||||
c64scr.print(" . ")
|
||||
if v1!=v2
|
||||
c64.STROUT(" Q ")
|
||||
c64scr.print(" Q ")
|
||||
else
|
||||
c64.STROUT(" . ")
|
||||
c64scr.print(" . ")
|
||||
|
||||
if v1<v2
|
||||
c64.STROUT(" Q ")
|
||||
c64scr.print(" Q ")
|
||||
else
|
||||
c64.STROUT(" . ")
|
||||
c64scr.print(" . ")
|
||||
|
||||
if v1>v2
|
||||
c64.STROUT(" Q ")
|
||||
c64scr.print(" Q ")
|
||||
else
|
||||
c64.STROUT(" . ")
|
||||
c64scr.print(" . ")
|
||||
|
||||
if v1<=v2
|
||||
c64.STROUT(" Q ")
|
||||
c64scr.print(" Q ")
|
||||
else
|
||||
c64.STROUT(" . ")
|
||||
c64scr.print(" . ")
|
||||
|
||||
if v1>=v2
|
||||
c64.STROUT(" Q ")
|
||||
c64scr.print(" Q ")
|
||||
else
|
||||
c64.STROUT(" . ")
|
||||
c64scr.print(" . ")
|
||||
c64.CHROUT('\n')
|
||||
|
||||
}
|
||||
|
@ -8,10 +8,7 @@
|
||||
ubyte v2
|
||||
ubyte cr
|
||||
|
||||
; check stack usage:
|
||||
c64.STROUT("unsigned byte ")
|
||||
c64scr.print_ub(X)
|
||||
c64.CHROUT(' ')
|
||||
c64scr.print("unsigned byte ")
|
||||
|
||||
cr=v1==v2
|
||||
cr=v1==v2
|
||||
@ -38,61 +35,61 @@
|
||||
cr=v1>=v2
|
||||
cr=v1>=v2
|
||||
|
||||
c64scr.print_ub(X)
|
||||
c64.CHROUT('\n')
|
||||
|
||||
; comparisons:
|
||||
v1=20
|
||||
v2=199
|
||||
c64.STROUT("v1=20, v2=199\n")
|
||||
c64scr.print("v1=20, v2=199\n")
|
||||
compare()
|
||||
|
||||
v1=80
|
||||
v2=80
|
||||
c64.STROUT("v1 = v2 = 80\n")
|
||||
c64scr.print("v1 = v2 = 80\n")
|
||||
compare()
|
||||
|
||||
v1=220
|
||||
v2=10
|
||||
c64.STROUT("v1=220, v2=10\n")
|
||||
c64scr.print("v1=220, v2=10\n")
|
||||
compare()
|
||||
|
||||
c64scr.print_ub(X)
|
||||
c64.CHROUT('\n')
|
||||
ubyte endX = X
|
||||
if endX == 255
|
||||
c64scr.print("\nstack x ok!\n")
|
||||
else
|
||||
c64scr.print("\nerror: stack x != 255 !\n")
|
||||
|
||||
return
|
||||
|
||||
sub compare() {
|
||||
c64.STROUT(" == != < > <= >=\n")
|
||||
c64scr.print(" == != < > <= >=\n")
|
||||
|
||||
if v1==v2
|
||||
c64.STROUT(" Q ")
|
||||
c64scr.print(" Q ")
|
||||
else
|
||||
c64.STROUT(" . ")
|
||||
c64scr.print(" . ")
|
||||
if v1!=v2
|
||||
c64.STROUT(" Q ")
|
||||
c64scr.print(" Q ")
|
||||
else
|
||||
c64.STROUT(" . ")
|
||||
c64scr.print(" . ")
|
||||
|
||||
if v1<v2
|
||||
c64.STROUT(" Q ")
|
||||
c64scr.print(" Q ")
|
||||
else
|
||||
c64.STROUT(" . ")
|
||||
c64scr.print(" . ")
|
||||
|
||||
if v1>v2
|
||||
c64.STROUT(" Q ")
|
||||
c64scr.print(" Q ")
|
||||
else
|
||||
c64.STROUT(" . ")
|
||||
c64scr.print(" . ")
|
||||
|
||||
if v1<=v2
|
||||
c64.STROUT(" Q ")
|
||||
c64scr.print(" Q ")
|
||||
else
|
||||
c64.STROUT(" . ")
|
||||
c64scr.print(" . ")
|
||||
|
||||
if v1>=v2
|
||||
c64.STROUT(" Q ")
|
||||
c64scr.print(" Q ")
|
||||
else
|
||||
c64.STROUT(" . ")
|
||||
c64scr.print(" . ")
|
||||
c64.CHROUT('\n')
|
||||
|
||||
}
|
||||
|
@ -8,10 +8,7 @@
|
||||
uword v2
|
||||
ubyte cr
|
||||
|
||||
; check stack usage:
|
||||
c64.STROUT("unsigned word ")
|
||||
c64scr.print_ub(X)
|
||||
c64.CHROUT(' ')
|
||||
c64scr.print("unsigned word ")
|
||||
|
||||
cr=v1==v2
|
||||
cr=v1==v2
|
||||
@ -38,91 +35,92 @@
|
||||
cr=v1>=v2
|
||||
cr=v1>=v2
|
||||
|
||||
c64scr.print_ub(X)
|
||||
c64.CHROUT('\n')
|
||||
|
||||
; comparisons:
|
||||
v1=20
|
||||
v2=$00aa
|
||||
c64.STROUT("v1=20, v2=$00aa\n")
|
||||
c64scr.print("v1=20, v2=$00aa\n")
|
||||
compare()
|
||||
|
||||
v1=20
|
||||
v2=$ea00
|
||||
c64.STROUT("v1=20, v2=$ea00\n")
|
||||
c64scr.print("v1=20, v2=$ea00\n")
|
||||
compare()
|
||||
|
||||
v1=$c400
|
||||
v2=$22
|
||||
c64.STROUT("v1=$c400, v2=$22\n")
|
||||
c64scr.print("v1=$c400, v2=$22\n")
|
||||
compare()
|
||||
|
||||
v1=$c400
|
||||
v2=$2a00
|
||||
c64.STROUT("v1=$c400, v2=$2a00\n")
|
||||
c64scr.print("v1=$c400, v2=$2a00\n")
|
||||
compare()
|
||||
|
||||
v1=$c433
|
||||
v2=$2a00
|
||||
c64.STROUT("v1=$c433, v2=$2a00\n")
|
||||
c64scr.print("v1=$c433, v2=$2a00\n")
|
||||
compare()
|
||||
|
||||
v1=$c433
|
||||
v2=$2aff
|
||||
c64.STROUT("v1=$c433, v2=$2aff\n")
|
||||
c64scr.print("v1=$c433, v2=$2aff\n")
|
||||
compare()
|
||||
|
||||
v1=$aabb
|
||||
v2=$aabb
|
||||
c64.STROUT("v1 = v2 = aabb\n")
|
||||
c64scr.print("v1 = v2 = aabb\n")
|
||||
compare()
|
||||
|
||||
v1=$aa00
|
||||
v2=$aa00
|
||||
c64.STROUT("v1 = v2 = aa00\n")
|
||||
c64scr.print("v1 = v2 = aa00\n")
|
||||
compare()
|
||||
|
||||
v1=$aa
|
||||
v2=$aa
|
||||
c64.STROUT("v1 = v2 = aa\n")
|
||||
c64scr.print("v1 = v2 = aa\n")
|
||||
compare()
|
||||
|
||||
c64scr.print_ub(X)
|
||||
c64.CHROUT('\n')
|
||||
ubyte endX = X
|
||||
if endX == 255
|
||||
c64scr.print("\nstack x ok!\n")
|
||||
else
|
||||
c64scr.print("\nerror: stack x != 255 !\n")
|
||||
|
||||
|
||||
return
|
||||
|
||||
sub compare() {
|
||||
c64.STROUT(" == != < > <= >=\n")
|
||||
c64scr.print(" == != < > <= >=\n")
|
||||
|
||||
if v1==v2
|
||||
c64.STROUT(" Q ")
|
||||
c64scr.print(" Q ")
|
||||
else
|
||||
c64.STROUT(" . ")
|
||||
c64scr.print(" . ")
|
||||
if v1!=v2
|
||||
c64.STROUT(" Q ")
|
||||
c64scr.print(" Q ")
|
||||
else
|
||||
c64.STROUT(" . ")
|
||||
c64scr.print(" . ")
|
||||
|
||||
if v1<v2
|
||||
c64.STROUT(" Q ")
|
||||
c64scr.print(" Q ")
|
||||
else
|
||||
c64.STROUT(" . ")
|
||||
c64scr.print(" . ")
|
||||
|
||||
if v1>v2
|
||||
c64.STROUT(" Q ")
|
||||
c64scr.print(" Q ")
|
||||
else
|
||||
c64.STROUT(" . ")
|
||||
c64scr.print(" . ")
|
||||
|
||||
if v1<=v2
|
||||
c64.STROUT(" Q ")
|
||||
c64scr.print(" Q ")
|
||||
else
|
||||
c64.STROUT(" . ")
|
||||
c64scr.print(" . ")
|
||||
|
||||
if v1>=v2
|
||||
c64.STROUT(" Q ")
|
||||
c64scr.print(" Q ")
|
||||
else
|
||||
c64.STROUT(" . ")
|
||||
c64scr.print(" . ")
|
||||
c64.CHROUT('\n')
|
||||
|
||||
}
|
||||
|
@ -8,11 +8,7 @@
|
||||
word v2
|
||||
ubyte cr
|
||||
|
||||
|
||||
; check stack usage:
|
||||
c64.STROUT("signed word ")
|
||||
c64scr.print_ub(X)
|
||||
c64.CHROUT(' ')
|
||||
c64scr.print("signed word ")
|
||||
|
||||
cr=v1==v2
|
||||
cr=v1==v2
|
||||
@ -39,127 +35,127 @@
|
||||
cr=v1>=v2
|
||||
cr=v1>=v2
|
||||
|
||||
c64scr.print_ub(X)
|
||||
c64.CHROUT('\n')
|
||||
|
||||
; comparisons:
|
||||
v1=20
|
||||
v2=$00aa
|
||||
c64.STROUT("v1=20, v2=$00aa\n")
|
||||
c64scr.print("v1=20, v2=$00aa\n")
|
||||
compare()
|
||||
|
||||
v1=20
|
||||
v2=$7a00
|
||||
c64.STROUT("v1=20, v2=$7a00\n")
|
||||
c64scr.print("v1=20, v2=$7a00\n")
|
||||
compare()
|
||||
|
||||
v1=$7400
|
||||
v2=$22
|
||||
c64.STROUT("v1=$7400, v2=$22\n")
|
||||
c64scr.print("v1=$7400, v2=$22\n")
|
||||
compare()
|
||||
|
||||
v1=$7400
|
||||
v2=$2a00
|
||||
c64.STROUT("v1=$7400, v2=$2a00\n")
|
||||
c64scr.print("v1=$7400, v2=$2a00\n")
|
||||
compare()
|
||||
|
||||
v1=$7433
|
||||
v2=$2a00
|
||||
c64.STROUT("v1=$7433, v2=$2a00\n")
|
||||
c64scr.print("v1=$7433, v2=$2a00\n")
|
||||
compare()
|
||||
|
||||
v1=$7433
|
||||
v2=$2aff
|
||||
c64.STROUT("v1=$7433, v2=$2aff\n")
|
||||
c64scr.print("v1=$7433, v2=$2aff\n")
|
||||
compare()
|
||||
|
||||
; with negative numbers:
|
||||
v1=-512
|
||||
v2=$00aa
|
||||
c64.STROUT("v1=-512, v2=$00aa\n")
|
||||
c64scr.print("v1=-512, v2=$00aa\n")
|
||||
compare()
|
||||
|
||||
v1=-512
|
||||
v2=$7a00
|
||||
c64.STROUT("v1=-512, v2=$7a00\n")
|
||||
c64scr.print("v1=-512, v2=$7a00\n")
|
||||
compare()
|
||||
|
||||
v1=$7400
|
||||
v2=-512
|
||||
c64.STROUT("v1=$7400, v2=-512\n")
|
||||
c64scr.print("v1=$7400, v2=-512\n")
|
||||
compare()
|
||||
|
||||
v1=-20000
|
||||
v2=-1000
|
||||
c64.STROUT("v1=-20000, v2=-1000\n")
|
||||
c64scr.print("v1=-20000, v2=-1000\n")
|
||||
compare()
|
||||
|
||||
v1=-1000
|
||||
v2=-20000
|
||||
c64.STROUT("v1=-1000, v2=-20000\n")
|
||||
c64scr.print("v1=-1000, v2=-20000\n")
|
||||
compare()
|
||||
|
||||
v1=-1
|
||||
v2=32767
|
||||
c64.STROUT("v1=-1, v2=32767\n")
|
||||
c64scr.print("v1=-1, v2=32767\n")
|
||||
compare()
|
||||
|
||||
v1=32767
|
||||
v2=-1
|
||||
c64.STROUT("v1=32767, v2=-1\n")
|
||||
c64scr.print("v1=32767, v2=-1\n")
|
||||
compare()
|
||||
|
||||
v1=$7abb
|
||||
v2=$7abb
|
||||
c64.STROUT("v1 = v2 = 7abb\n")
|
||||
c64scr.print("v1 = v2 = 7abb\n")
|
||||
compare()
|
||||
|
||||
v1=$7a00
|
||||
v2=$7a00
|
||||
c64.STROUT("v1 = v2 = 7a00\n")
|
||||
c64scr.print("v1 = v2 = 7a00\n")
|
||||
compare()
|
||||
|
||||
v1=$aa
|
||||
v2=$aa
|
||||
c64.STROUT("v1 = v2 = aa\n")
|
||||
c64scr.print("v1 = v2 = aa\n")
|
||||
compare()
|
||||
|
||||
c64scr.print_ub(X)
|
||||
c64.CHROUT('\n')
|
||||
ubyte endX = X
|
||||
if endX == 255
|
||||
c64scr.print("\nstack x ok!\n")
|
||||
else
|
||||
c64scr.print("\nerror: stack x != 255 !\n")
|
||||
|
||||
return
|
||||
|
||||
sub compare() {
|
||||
c64.STROUT(" == != < > <= >=\n")
|
||||
c64scr.print(" == != < > <= >=\n")
|
||||
|
||||
if v1==v2
|
||||
c64.STROUT(" Q ")
|
||||
c64scr.print(" Q ")
|
||||
else
|
||||
c64.STROUT(" . ")
|
||||
c64scr.print(" . ")
|
||||
if v1!=v2
|
||||
c64.STROUT(" Q ")
|
||||
c64scr.print(" Q ")
|
||||
else
|
||||
c64.STROUT(" . ")
|
||||
c64scr.print(" . ")
|
||||
|
||||
if v1<v2
|
||||
c64.STROUT(" Q ")
|
||||
c64scr.print(" Q ")
|
||||
else
|
||||
c64.STROUT(" . ")
|
||||
c64scr.print(" . ")
|
||||
|
||||
if v1>v2
|
||||
c64.STROUT(" Q ")
|
||||
c64scr.print(" Q ")
|
||||
else
|
||||
c64.STROUT(" . ")
|
||||
c64scr.print(" . ")
|
||||
|
||||
if v1<=v2
|
||||
c64.STROUT(" Q ")
|
||||
c64scr.print(" Q ")
|
||||
else
|
||||
c64.STROUT(" . ")
|
||||
c64scr.print(" . ")
|
||||
|
||||
if v1>=v2
|
||||
c64.STROUT(" Q ")
|
||||
c64scr.print(" Q ")
|
||||
else
|
||||
c64.STROUT(" . ")
|
||||
c64scr.print(" . ")
|
||||
c64.CHROUT('\n')
|
||||
|
||||
}
|
||||
|
@ -1,60 +0,0 @@
|
||||
%import c64utils
|
||||
%import c64flt
|
||||
|
||||
|
||||
~ main {
|
||||
|
||||
ubyte[3] ubarray = [11,55,222]
|
||||
byte[3] barray = [-11,-22,-33]
|
||||
uword[3] uwarray = [111,2222,55555]
|
||||
word[3] warray = [-111,-222,-555]
|
||||
float[3] farray = [1.11, 2.22, -3.33]
|
||||
str text = "hello\n"
|
||||
|
||||
sub start() {
|
||||
c64scr.print_ub(X)
|
||||
c64.CHROUT('\n')
|
||||
|
||||
c64scr.print("loop str\n")
|
||||
for ubyte c in text {
|
||||
c64scr.print_ub(c)
|
||||
c64.CHROUT(',')
|
||||
}
|
||||
|
||||
c64scr.print("\nloop ub\n")
|
||||
for ubyte ub in ubarray{
|
||||
c64scr.print_ub(ub)
|
||||
c64.CHROUT(',')
|
||||
}
|
||||
|
||||
c64scr.print("\nloop b\n")
|
||||
for byte b in barray {
|
||||
c64scr.print_b(b)
|
||||
c64.CHROUT(',')
|
||||
}
|
||||
|
||||
c64scr.print("\nloop uw\n")
|
||||
for uword uw in uwarray {
|
||||
c64scr.print_uw(uw)
|
||||
c64.CHROUT(',')
|
||||
}
|
||||
|
||||
c64scr.print("\nloop w\n")
|
||||
for word w in warray {
|
||||
c64scr.print_w(w)
|
||||
c64.CHROUT(',')
|
||||
}
|
||||
|
||||
c64scr.print("\nloop f\n")
|
||||
for float f in farray {
|
||||
c64flt.print_f(f)
|
||||
c64.CHROUT(',')
|
||||
}
|
||||
|
||||
|
||||
ending:
|
||||
c64scr.print("\nending\n")
|
||||
c64scr.print_ub(X)
|
||||
c64.CHROUT('\n')
|
||||
}
|
||||
}
|
@ -11,17 +11,16 @@
|
||||
c64.COLOR = 1
|
||||
c64.VMCSB |= 2
|
||||
|
||||
; use kernel routine to write text
|
||||
c64.STROUT("Hello!\n")
|
||||
|
||||
str question = "How are you?\n"
|
||||
; use optimized routine to write text
|
||||
c64scr.print("Hello!\n")
|
||||
|
||||
; use iteration to write text
|
||||
for ubyte char in question {
|
||||
str question = "How are you?\n"
|
||||
for ubyte char in question { ; @todo allow for/while/repeat loops without curly braces just like ifs
|
||||
c64.CHROUT(char)
|
||||
}
|
||||
|
||||
; use loop to write characters
|
||||
; use indexed loop to write characters
|
||||
str bye = "Goodbye!\n"
|
||||
for ubyte c in 0 to len(bye) {
|
||||
c64.CHROUT(bye[c])
|
||||
|
@ -35,6 +35,8 @@
|
||||
c64scr.setcc(pixelx+4, pixely+1, 160, max_iter-iter)
|
||||
}
|
||||
}
|
||||
|
||||
; @todo calculation is wrong, gives "1"
|
||||
float duration = floor(((c64.TIME_LO as float) + 256.0*(c64.TIME_MID as float) + 65536.0*(c64.TIME_HI as float))/60.0)
|
||||
c64.PLOT(0, 0, 21)
|
||||
c64scr.print("finished in ")
|
||||
|
@ -4,11 +4,11 @@
|
||||
~ main {
|
||||
|
||||
sub start() {
|
||||
c64.SCROLY &= %11101111 ; blank screen
|
||||
c64.SCROLY &= %11101111 ; blank the screen
|
||||
c64utils.set_rasterirq_excl(40)
|
||||
|
||||
dontstop:
|
||||
goto dontstop
|
||||
while(true) {
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -23,9 +23,9 @@
|
||||
}
|
||||
|
||||
sub screenx(float x) -> word {
|
||||
return (x/4.1* (width as float)) as word + width / 2
|
||||
return (x*width/4.1) + width / 2.0 as word
|
||||
}
|
||||
sub screeny(float y) -> word {
|
||||
return (y/4.1 * (height as float)) as word + height / 2
|
||||
return (y*height/4.1) + height / 2.0 as word
|
||||
}
|
||||
}
|
||||
|
@ -6,70 +6,41 @@
|
||||
sub start() {
|
||||
|
||||
|
||||
ubyte b1=42
|
||||
ubyte b2=42
|
||||
ubyte b3=99
|
||||
ubyte b4=42
|
||||
word w1=42
|
||||
word w2=42
|
||||
word w3=99
|
||||
word w4=42
|
||||
uword uw1=42
|
||||
uword uw2=42
|
||||
uword uw3=99
|
||||
uword uw4=42
|
||||
float f1 = 3.14
|
||||
float f2 = 3.14
|
||||
float f3 = 99.0
|
||||
float f4 = 3.14
|
||||
str string1="hoi"
|
||||
str string2="hoi"
|
||||
str string3="hoi222"
|
||||
str string4="hoi"
|
||||
c64scr.print_ub(c64utils.str2ubyte("1"))
|
||||
c64.CHROUT('\n')
|
||||
c64scr.print_ub(c64utils.str2ubyte("12"))
|
||||
c64.CHROUT('\n')
|
||||
c64scr.print_ub(c64utils.str2ubyte("123"))
|
||||
c64.CHROUT('\n')
|
||||
c64scr.print_ub(c64utils.str2ubyte("1234"))
|
||||
c64.CHROUT('\n')
|
||||
c64scr.print_ub(c64utils.str2ubyte("12xyz"))
|
||||
c64.CHROUT('\n')
|
||||
c64.CHROUT('\n')
|
||||
|
||||
c64scr.print_ub(c64utils.str2byte("1"))
|
||||
c64.CHROUT('\n')
|
||||
c64scr.print_ub(c64utils.str2byte("12"))
|
||||
c64.CHROUT('\n')
|
||||
c64scr.print_ub(c64utils.str2byte("123"))
|
||||
c64.CHROUT('\n')
|
||||
c64scr.print_ub(c64utils.str2byte("1234"))
|
||||
c64.CHROUT('\n')
|
||||
c64scr.print_ub(c64utils.str2ubyte("12xyz"))
|
||||
c64.CHROUT('\n')
|
||||
c64.CHROUT('\n')
|
||||
|
||||
|
||||
;
|
||||
; c64scr.print_ub(c64utils.str2ubyte("1"))
|
||||
; c64.CHROUT('\n')
|
||||
; c64scr.print_ub(c64utils.str2ubyte("12"))
|
||||
; c64.CHROUT('\n')
|
||||
; c64scr.print_ub(c64utils.str2ubyte("123"))
|
||||
; c64.CHROUT('\n')
|
||||
; c64scr.print_ub(c64utils.str2ubyte("1234"))
|
||||
; c64.CHROUT('\n')
|
||||
; c64scr.print_ub(c64utils.str2ubyte("12xyz"))
|
||||
; c64.CHROUT('\n')
|
||||
; c64.CHROUT('\n')
|
||||
;
|
||||
; c64scr.print_ub(c64utils.str2byte("1"))
|
||||
; c64.CHROUT('\n')
|
||||
; c64scr.print_ub(c64utils.str2byte("12"))
|
||||
; c64.CHROUT('\n')
|
||||
; c64scr.print_ub(c64utils.str2byte("123"))
|
||||
; c64.CHROUT('\n')
|
||||
; c64scr.print_ub(c64utils.str2byte("1234"))
|
||||
; c64.CHROUT('\n')
|
||||
; c64scr.print_ub(c64utils.str2ubyte("12xyz"))
|
||||
; c64.CHROUT('\n')
|
||||
; c64.CHROUT('\n')
|
||||
;
|
||||
; c64scr.print_b(c64utils.str2byte("-1"))
|
||||
; c64.CHROUT('\n')
|
||||
; c64scr.print_b(c64utils.str2byte("-12"))
|
||||
; c64.CHROUT('\n')
|
||||
; c64scr.print_b(c64utils.str2byte("-123"))
|
||||
; c64.CHROUT('\n')
|
||||
; c64scr.print_b(c64utils.str2byte("-1111"))
|
||||
; c64.CHROUT('\n')
|
||||
; c64scr.print_b(c64utils.str2byte("-12xyz"))
|
||||
; c64.CHROUT('\n')
|
||||
c64scr.print_b(c64utils.str2byte("-1"))
|
||||
c64.CHROUT('\n')
|
||||
c64scr.print_b(c64utils.str2byte("-12"))
|
||||
c64.CHROUT('\n')
|
||||
c64scr.print_b(c64utils.str2byte("-123"))
|
||||
c64.CHROUT('\n')
|
||||
c64scr.print_b(c64utils.str2byte("-1111"))
|
||||
c64.CHROUT('\n')
|
||||
c64scr.print_b(c64utils.str2byte("-12xyz"))
|
||||
c64.CHROUT('\n')
|
||||
|
||||
}
|
||||
|
||||
sub foo(ubyte param1, ubyte param2) {
|
||||
ubyte local1
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -53,8 +53,8 @@
|
||||
c64.MSIGX=0
|
||||
|
||||
for ubyte i in 7 to 0 step -1 {
|
||||
uword x = sin8u(angle*2-i*8) as uword + 50
|
||||
ubyte y = cos8u(angle*3-i*8) / 2 + 70
|
||||
uword x = sin8u(angle*2-i*16) as uword + 50
|
||||
ubyte y = cos8u(angle*3-i*16) / 2 + 70
|
||||
c64.SPXYW[i] = mkword(lsb(x), y)
|
||||
lsl(c64.MSIGX)
|
||||
if msb(x) c64.MSIGX++
|
||||
|
Loading…
Reference in New Issue
Block a user