2018-11-09 22:42:17 +00:00
|
|
|
%import c64utils
|
2018-12-06 00:25:06 +00:00
|
|
|
%import mathlib
|
|
|
|
%option enable_floats
|
2018-10-16 00:26:35 +00:00
|
|
|
|
2018-12-04 21:30:35 +00:00
|
|
|
~ main {
|
2018-11-11 17:19:08 +00:00
|
|
|
|
2018-12-04 21:30:35 +00:00
|
|
|
sub start() {
|
2018-12-06 00:25:06 +00:00
|
|
|
|
2018-12-06 23:08:22 +00:00
|
|
|
math.randseed($2ae4)
|
2018-12-06 00:25:06 +00:00
|
|
|
|
|
|
|
ubyte loop
|
|
|
|
c64scr.print_string("random bytes:\n")
|
|
|
|
for loop in 1 to 5 {
|
|
|
|
rsave() ; @todo automatic based on clobbers declaration
|
|
|
|
c64scr.print_byte_decimal(loop)
|
|
|
|
c64.CHROUT(':')
|
|
|
|
c64.CHROUT(' ')
|
|
|
|
ubyte ubr = rnd()
|
|
|
|
c64scr.print_byte_decimal(ubr)
|
|
|
|
rrestore()
|
|
|
|
c64.CHROUT('\n')
|
|
|
|
}
|
|
|
|
c64scr.print_string("\nrandom words:\n")
|
|
|
|
for loop in 1 to 5 {
|
|
|
|
rsave() ; @todo automatic based on clobbers declaration
|
|
|
|
c64scr.print_byte_decimal(loop)
|
|
|
|
c64.CHROUT(':')
|
|
|
|
c64.CHROUT(' ')
|
|
|
|
uword uwr = rndw()
|
|
|
|
c64scr.print_word_decimal(uwr)
|
|
|
|
rrestore()
|
|
|
|
c64.CHROUT('\n')
|
|
|
|
}
|
|
|
|
c64scr.print_string("\nrandom floats:\n")
|
|
|
|
for loop in 1 to 5 {
|
|
|
|
c64scr.print_byte_decimal(loop)
|
|
|
|
c64.CHROUT(':')
|
|
|
|
c64.CHROUT(' ')
|
|
|
|
float f = rndf()
|
|
|
|
c64flt.print_float_ln(f)
|
|
|
|
}
|
2018-12-04 21:30:35 +00:00
|
|
|
}
|
2018-10-16 20:49:19 +00:00
|
|
|
}
|