prog8/compiler/examples/test.p8

110 lines
2.8 KiB
Plaintext
Raw Normal View History

%import c64utils
%option enable_floats
2018-10-16 00:26:35 +00:00
~ main {
2018-11-11 17:19:08 +00:00
sub start() {
2018-12-12 00:13:13 +00:00
ubyte ub1
2018-12-14 22:15:44 +00:00
ubyte ub2
byte b1 = -99
2018-12-14 22:15:44 +00:00
byte b2
2018-12-12 00:13:13 +00:00
uword uw1
2018-12-14 22:15:44 +00:00
uword uw2
word w1 = -9999
2018-12-14 22:15:44 +00:00
word w2
2018-12-12 00:13:13 +00:00
float f1
float f2
float f3
2018-12-12 00:13:13 +00:00
2018-12-16 12:58:18 +00:00
ubyte[3] uba = [1,2,3]
2018-12-17 00:59:04 +00:00
byte[3] ba = [-1,0,3]
uword[3] uwa = [1000,200,0]
2018-12-16 12:58:18 +00:00
word[3] wa = -222
2018-12-17 00:59:04 +00:00
ubyte[3] uba0 = 0
byte[3] ba0 = 0
uword[3] uwa0 = 0
word[3] wa0 = 0
2018-12-16 12:58:18 +00:00
;word[3] wa = [-1000.w,2000.w,3000.w] ; @todo array data type fix (float->word)
;word[3] wa = [1000,2000,3000] ; @todo array data type fix (uword->word)
2018-12-17 00:59:04 +00:00
float[3] fa0 = 0.0
float[3] fa1 = [-1000,44.555, 99.999]
float[3] fa2 = [-1000,44.555, 0]
2018-12-16 12:58:18 +00:00
str string = "hello"
str_p pstring = "hello1"
str_s sstring = "hello12"
str_ps psstring = "hello123"
2018-12-16 02:38:17 +00:00
c64.CHROUT('x')
c64scr.print_ubyte_decimal(X)
2018-12-14 22:15:44 +00:00
c64.CHROUT('\n')
2018-12-16 12:58:18 +00:00
ub1 = any(uba)
c64scr.print_ubyte_decimal(ub1)
2018-12-14 22:15:44 +00:00
c64.CHROUT('\n')
2018-12-16 12:58:18 +00:00
ub1 = any(ba)
c64scr.print_ubyte_decimal(ub1)
c64.CHROUT('\n')
ub1 = any(uwa)
c64scr.print_ubyte_decimal(ub1)
c64.CHROUT('\n')
ub1 = any(wa)
c64scr.print_ubyte_decimal(ub1)
2018-12-14 22:15:44 +00:00
c64.CHROUT('\n')
2018-12-17 00:59:04 +00:00
ub1 = any(fa1)
2018-12-16 12:58:18 +00:00
c64scr.print_ubyte_decimal(ub1)
2018-12-14 22:15:44 +00:00
c64.CHROUT('\n')
2018-12-17 00:59:04 +00:00
ub1 = any(fa2)
c64scr.print_ubyte_decimal(ub1)
c64.CHROUT('\n')
ub1 = any(uba0)
c64scr.print_ubyte_decimal(ub1)
c64.CHROUT('\n')
ub1 = any(ba0)
c64scr.print_ubyte_decimal(ub1)
c64.CHROUT('\n')
ub1 = any(uwa0)
c64scr.print_ubyte_decimal(ub1)
c64.CHROUT('\n')
ub1 = any(wa0)
c64scr.print_ubyte_decimal(ub1)
c64.CHROUT('\n')
ub1 = any(fa0)
c64scr.print_ubyte_decimal(ub1)
c64.CHROUT('\n')
2018-12-16 02:38:17 +00:00
c64.CHROUT('x')
c64scr.print_ubyte_decimal(X)
c64.CHROUT('\n')
2018-12-17 00:59:04 +00:00
c64.CHROUT('x')
c64scr.print_ubyte_decimal(X)
c64.CHROUT('\n')
; ub1 = all(uba) ; 1 ok
; c64scr.print_ubyte_decimal(ub1)
; c64.CHROUT('\n')
; ub1 = all(ba) ; 0 ok
; c64scr.print_ubyte_decimal(ub1)
; c64.CHROUT('\n')
; ub1 = all(uwa) ; 0 ok
; c64scr.print_ubyte_decimal(ub1)
; c64.CHROUT('\n')
; ub1 = all(wa) ; 1 ok
; c64scr.print_ubyte_decimal(ub1)
; c64.CHROUT('\n')
; ub1 = all(fa1) ; 1 ok
; c64scr.print_ubyte_decimal(ub1)
; c64.CHROUT('\n')
; ub1 = all(fa2) ; 0 ok
; c64scr.print_ubyte_decimal(ub1)
; c64.CHROUT('\n')
; c64.CHROUT('x')
; c64scr.print_ubyte_decimal(X)
; c64.CHROUT('\n')
}
}
2018-12-12 00:13:13 +00:00