Removed old examples

This commit is contained in:
Devine Lu Linvega 2024-03-02 19:37:45 -08:00
parent c5d8ba4e3a
commit 259b9dcf56
5 changed files with 0 additions and 1409 deletions

View File

@ -1,102 +0,0 @@
( devices )
|00 @System [ &vector $2 &wst $1 &rst $1 &pad $4 &r $2 &g $2 &b $2 &debug $1 &halt $1 ]
|10 @Console [ &vector $2 &read $1 &pad $5 &write $1 &error $1 ]
|a0 @File [ &vector $2 &success $2 &stat $2 &delete $1 &append $1 &name $2 &length $2 &read $2 &write $2 ]
( vectors )
|0100 @reset
(
Set the log level for helping to debug stuff.
Its value is the bitwise OR of all the following output types:
#01 prints the number of lines in the source code,
#04 dumps all defined labels at end, and
#08 prints the heap usage.
)
#0d ;asma/log-level STA
;asma-heap ;heap STA2
(
Assemble the source code into an output ROM file.
If all you want is to use asma.tal to assemble files, insert a BRK
after this statement.
)
;&source-file ;&dest-file ;asma-assemble-file JSR2
(
If an error has occurred, BRK here, otherwise continue. (The error
message will already have been printed to the Console in
asma-assemble-file.)
)
;asma/error LDA2 #0000 EQU2 JMP BRK
(
Load the output ROM over the currently running program, almost as if
we loaded the ROM with uxnemu directly!
It's not a totally pristine environment, as File/read doesn't zero out
memory beyond the end of the file. So if the assembled program assumes
that all memory above it is zero, it may misbehave.
Asma itself doesn't use the zero page, but this example code writes a
DEO2 instruction to 0x00ff. In order to execute File/read and have the
CPU continue at memory location 0x0100, we write the final DEO2
instruction there and jump there as our final act.
Just in case the assembled code is zero-length (which can occur when
assembling an empty source file), we write a BRK to the reset vector so
that will prevent an infinite loop.
)
;&dest-file .File/name DEO2
#ff00 .File/length DEO2
#0100 .File/read
LIT DEO2 #00ff STA
LIT BRK #0100 STA
#00ff JMP2
&source-file
"projects/examples/demos/piano.tal 00
&dest-file
"bin/asma-boot.rom 00
~projects/library/asma.tal
(
Heap, a large temporary area for keeping track of labels. More complex
programs need more of this space. If there's insufficient space then the
assembly process will fail, but having extra space above what the most
complex program needs provides no benefit.
This heap, and the buffers below, are free to be used to hold temporary
data between assembly runs, and do not need to be initialized with any
particular contents to use the assembler.
)
@asma-heap
|e000 &end
(
Buffer for use with loading source code.
The minimum size is the length of the longest token plus one, which is
0x21 to keep the same capability of the C assembler.
Larger sizes are more efficient, provided there is enough
heap space to keep track of all the labels.
)
@asma-read-buffer
|f800 &end
(
Buffer for use with writing output.
The minimum size is 1, and larger sizes are more efficient.
)
@asma-write-buffer
|ffff &end

View File

@ -1,543 +0,0 @@
( darena.tal )
( an open-ended game of rocks and sand )
( contributed by and cc0 sejo 12021 )
( parameters )
%nrocks { #1f }
%nrocks-1 { #1e }
%nrocks_mask { #1f }
%minposx { #0f }
%minposy { #0f }
%maxposx { #f1 }
%maxposy { #f1 }
%anispeedmask_normal { #03 }
%anispeedmask_slow { #07 }
%c_color_normal { #43 }
%c_color_flipx { #53 }
%index_norock { #ff }
( output macros )
%out_screen_x { LDA #00 SWP .Screen/x DEO2 } ( ;addr )
%out_screen_y { LDA #00 SWP .Screen/y DEO2 } ( ;addr )
( helper macros )
%get_bit_n { SFT #01 AND }
%get_nibble_h { #04 SFT #0f AND }
%get_nibble_l { #0f AND }
%is_bit_n_set { get_bit_n #01 EQU }
%set_animate { #01 ;c_state LDA ORA ;c_state STA }
%rst_animate { #00 ;c_state STA }
( devices )
|00 @System [ &vector $2 &wst $1 &rst $1 &pad $4 &r $2 &g $2 &b $2 ]
|20 @Screen [ &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 ]
|80 @Controller [ &vector $2 &button $1 &key $1 ]
( variables )
|0000
@c_pos [ &x $1 &y $1 ] ( character position )
@c_speed [ &x $1 &y $1 ] ( character speed )
@c_color [ $1 ] ( character color )
@c_sprite [ $2 ] ( character sprite addr )
@c_state [ $1 ] ( high_nibble: animation pointer, bit0: is_animated )
@f_count [ $1 ] ( frame counter )
@ani_speedmask [ $1 ] ( animation speed mask )
@r_speed_x [ $f ]
@r_speed_y [ $f ]
@tog [ &x $1 &y $1 &state $1 ] ( toggle station state )
( program )
|0100 @reset ( -> )
#f396 .System/r DEO2
#e263 .System/g DEO2
#9030 .System/b DEO2
;on_frame .Screen/vector DEO2
( init character )
#50 ;c_pos/x STA
#10 ;c_pos/y STA
#00 ;c_speed/x STA
#00 ;c_speed/y STA
c_color_normal ;c_color STA
;s_monitx_stepfront0 ;c_sprite STA2
rst_animate
anispeedmask_normal ;ani_speedmask STA
( init toggler )
#27 ;tog/x STA
#27 ;tog/y STA
#00 ;tog/state STA
( init background )
;init_bg JSR2
BRK
@on_frame ( -> )
;f_count LDA INC DUP ;f_count STA ( increase frame counter )
;ani_speedmask LDA ( mask with animation speed mask )
AND #00 EQU ,update_frame JCN ( jump to update if it's time )
BRK
@update_frame
( check keyboard )
;check_keys JSR2
( animate character sprite )
;animate_c JSR2
( clear sprites )
;clear JSR2
( update character vars )
;update_c/run JSR2
( update rocks + stand )
;update_r/run JSR2
( draw )
;draw JSR2
BRK
@clear
( clear rocks )
;s_clear .Screen/addr DEO2
nrocks #00
&rocks_loop
DUP ( get rocks_x[i] )
;rocks_x ROT #00 SWP ADD2 out_screen_x
DUP ( get rocks_y[i] )
;rocks_y ROT #00 SWP ADD2 out_screen_y
#40 .Screen/sprite DEO
INC
DUP2
NEQ ,&rocks_loop JCN
POP2
( clear character )
;clear_c JSR2
JMP2r
@draw
( draw toggler )
;tog/x out_screen_x
;tog/x out_screen_y
;s_stand .Screen/addr DEO2
#03 .Screen/sprite DEO
( draw rocks )
;s_bola .Screen/addr DEO2
nrocks #00
&rocks_loop
DUP ( get rocks_x[i] )
;rocks_x ROT #00 SWP ADD2 out_screen_x
DUP ( get rocks_y[i] )
;rocks_y ROT #00 SWP ADD2 out_screen_y
DUP ( get color )
;r_color ROT #00 SWP ADD2 LDA #41 ADD .Screen/sprite DEO
INC
DUP2
NEQ ,&rocks_loop JCN
POP2
( draw character )
;draw_c JSR2
JMP2r
@check_keys
#00 ;c_speed/x STA
#00 ;c_speed/y STA
.Controller/button DEI #07 is_bit_n_set ,&der JCN
.Controller/button DEI #06 is_bit_n_set ,&izq JCN
.Controller/button DEI #05 is_bit_n_set ,&aba JCN
.Controller/button DEI #04 is_bit_n_set ,&arr JCN
rst_animate
JMP2r
&der
#01 ;c_speed/x STA
set_animate
c_color_normal ;c_color STA
;s_monitx_stepside0 ;c_sprite STA2
JMP2r
&izq
#ff ;c_speed/x STA
set_animate
c_color_flipx ;c_color STA
;s_monitx_stepside0 ;c_sprite STA2
JMP2r
&aba
#01 ;c_speed/y STA
set_animate
c_color_normal ;c_color STA
;s_monitx_stepfront0 ;c_sprite STA2
JMP2r
&arr
#ff ;c_speed/y STA
set_animate
c_color_normal ;c_color STA
;s_monitx_stepback0 ;c_sprite STA2
JMP2r
&end
JMP2r
( sub-routines )
( in: sourcex, source y, index, rangex, rangey )
( puts in the stack the index of rock collisioned with )
@collision_rocks
&range_y $1
&range_x $1
&src_i $1
&src_x $1
&src_y $1
&rock_x $1
&rock_y $1
&run
,&range_y STR
,&range_x STR
,&src_i STR
,&src_y STR
,&src_x STR
( check collision with rocks )
( nrocks #00 )
,&src_i LDR nrocks_mask AND DUP INC nrocks_mask AND
&rocks_loop
DUP ( get rocks_x[i] )
;rocks_x ROT #00 SWP ADD2 LDA ,&rock_x STR
DUP ( get rocks_y[i] )
;rocks_y ROT #00 SWP ADD2 LDA ,&rock_y STR
,&src_x LDR ,&rock_x LDR ,&range_x LDR SUB GTH ( if sx > rx - 8 )
,&src_x LDR ,&rock_x LDR ,&range_x LDR ADD LTH ( if sx < rx + 8 )
,&src_y LDR ,&rock_y LDR ,&range_y LDR SUB GTH ( if sy > ry - 8 )
,&src_y LDR ,&rock_y LDR ,&range_y LDR ADD LTH ( if sy < ry + 8 )
ADD ADD ADD #04 EQU ,&found JCN
INC nrocks_mask AND
DUP2
NEQ ,&rocks_loop JCN
POP2
#ff
JMP2r
&found
NIP ( remove loop limit )
DUP ;&src_i LDA NEQ ,&end JCN ( check if result is the same as index )
POP #ff
JMP2r
&end
JMP2r
@update_c ( update character position )
&new_x $1
&new_y $1
&rock_i $1
&rock_x $1
&rock_y $1
&run
;c_speed/x LDA ;c_pos/x LDA ADD
,&new_x STR
;c_speed/y LDA ;c_pos/y LDA ADD
,&new_y STR
anispeedmask_normal ;ani_speedmask STA
&check_x
( check collision with borders )
,&new_x LDR minposx EQU ;&noup_x JCN2
,&new_x LDR maxposx EQU ;&noup_x JCN2
( check collision with rocks )
,&new_x LDR ,&new_y LDR index_norock #09 #06
;collision_rocks/run JSR2
( if it is colliding with rock, check further )
DUP #ff NEQ ,&check_x_collision JCN
POP
,&update_x JMP
&check_x_collision
( DUP DEBUG )
( slow down and save rock index )
anispeedmask_slow ;ani_speedmask STA
,&rock_i STR
( check if rock collides with others )
;rocks_x #00 ,&rock_i LDR ADD2 LDA ,&rock_x STR
;rocks_y #00 ,&rock_i LDR ADD2 LDA ,&rock_y STR
,&rock_x LDR ,&rock_y LDR ,&rock_i LDR #09 #06
;collision_rocks/run JSR2
( DUP DEBUG )
( if it is colliding, then skip adding x )
DUP #ff NEQ ,&check_y JCN
POP
( if not, check for borders )
;&rock_x LDA minposx EQU ;&noup_x JCN2
;&rock_x LDA maxposx EQU ;&noup_x JCN2
( move rock with same speed as c )
;&rock_x LDA ;c_speed/x LDA ADD
;rocks_x #00 ;&rock_i LDA ADD2
STA
&update_x
;&new_x LDA ;c_pos/x STA
,&check_y JMP
&noup_x
&check_y
( check collision with borders )
;&new_y LDA minposy EQU ;&noup_y JCN2
;&new_y LDA maxposy EQU ;&noup_y JCN2
( check collision with rocks )
;&new_x LDA ;&new_y LDA index_norock #06 #09
;collision_rocks/run JSR2
( if it is colliding with rock, check further )
DUP #ff NEQ ,&check_y_collision JCN
POP
,&update_y JMP
&check_y_collision
( DUP DEBUG )
anispeedmask_slow ;ani_speedmask STA
;&rock_i STA
( check if rock collides with others )
;rocks_x #00 ;&rock_i LDA ADD2 LDA ;&rock_x STA
;rocks_y #00 ;&rock_i LDA ADD2 LDA ;&rock_y STA
;&rock_x LDA ;&rock_y LDA ;&rock_i LDA #06 #09
;collision_rocks/run JSR2
( DUP DEBUG )
( if it is colliding, then skip adding y )
DUP #ff NEQ ,&noup_y JCN
POP
( if not, check for borders )
;&rock_y LDA minposx EQU ;&noup_y JCN2
;&rock_y LDA maxposx EQU ;&noup_y JCN2
( if not colliding, then move rock with same speed as c )
;&rock_y LDA ;c_speed/y LDA ADD
;rocks_y #00 ;&rock_i LDA ADD2
STA
&update_y
;&new_y LDA ;c_pos/y STA
JMP2r
&noup_y
JMP2r
@update_r
&rock_i $1
&run
( check collision with rocks )
;tog/x LDA ;tog/y LDA index_norock #02 #02
;collision_rocks/run JSR2
( if it is colliding with rock, check if it needs to change state )
DUP #ff NEQ ,&change_state JCN
( DUP DEBUG )
( if there's no collision, reset toggler )
POP
#00 ;tog/state STA
JMP2r
&change_state
( DUP DEBUG )
,&rock_i STR
;tog/state LDA ,&done JCN ( don't toggle if state is active )
;r_color #00 ,&rock_i LDR ADD2 DUP2 STH2
LDA #01 EOR STH2r STA
#01 ;tog/state STA
&done
JMP2r
@animate_c
( is bit0 -animate- on? )
;c_state LDA DUP #00 get_bit_n #01 NEQ ,&s_no_animate JCN
( increment and save animation pointer )
&s_animate
DUP
get_nibble_h INC #03 AND #40 SFT
SWP get_nibble_l ORA
;c_state STA
JMP2r
&s_no_animate
get_nibble_h #0f AND ;c_state STA
JMP2r
@draw_c ( draw character )
#00 ;c_state LDA get_nibble_h #30 SFT
;c_sprite LDA2 ADD2 .Screen/addr DEO2
;c_pos/x out_screen_x
;c_pos/y out_screen_y
;c_color LDA .Screen/sprite DEO
JMP2r
@clear_c ( clear character )
;s_clear .Screen/addr DEO2
;c_pos/x out_screen_x
;c_pos/y out_screen_y
#40 .Screen/sprite DEO
JMP2r
@init_bg
( init bg )
;s_border .Screen/addr DEO2
.Screen/height DEI2 #0000 STH2
&vertical0loop
DUP2
STH2r
DUP2 .Screen/y DEO2
.Screen/width DEI2 #0000 STH2
&horizontal0loop
DUP2
STH2r
DUP2 .Screen/x DEO2
#03 .Screen/sprite DEO
#0008 ADD2 DUP2 STH2
GTH2 ,&horizontal0loop JCN
STH2r POP2 POP2
#0008 ADD2 DUP2 STH2
GTH2 ,&vertical0loop JCN
STH2r
POP2 POP2
( arena )
;s_clear .Screen/addr DEO2
#00 maxposy #00 minposy STH2
&vertical0loop_clear
DUP2
STH2r
DUP2 .Screen/y DEO2
#00 maxposx #00 minposx STH2
&horizontal0loop_clear
DUP2
STH2r
DUP2 .Screen/x DEO2
#00 .Screen/sprite DEO
#0008 ADD2 DUP2 STH2
GTH2 ,&horizontal0loop_clear JCN
STH2r POP2 POP2
#0008 ADD2 DUP2 STH2 GTH2 ,&vertical0loop_clear JCN
STH2r
POP2 POP2
JMP2r
( rocks )
@rocks_x [ 25 30 42 50 67 90 98 e8 20 43 43 57 5a 7f bc a5
e5 dd a2 20 b7 9b 38 e8 33 43 63 b7 aa cf bc ]
@rocks_y [ 60 48 34 56 23 65 65 65 ba e9 24 22 72 91 22 c5
25 30 42 50 67 90 98 e8 20 43 43 57 5a 7f bc ]
@r_color [ 00 01 01 00 00 00 01 01 01 01 00 00 01 01 00 00
01 00 01 00 00 01 00 01 01 01 01 01 00 00 00 ]
( sprites )
@s_clear [ 0000 0000 0000 0000 ]
@s_border [ 3288 7e83 780d e013 ]
@s_bola [ 3c4e 9ffd f962 3c00 ]
@s_stand [ 0000 0000 0024 7eff ]
@s_stand_original [ 0000 0000 0000 3c7e ]
@s_monitx [ 3c7e 5a7f 1b3c 5a18 ]
@s_monitx_back [ 3c7e 7efe d83c 5a18 ]
@s_monitx_stepfront0 [ 3c7e 5a7f 1b3c 5a18 ]
@s_monitx_stepfront1 [ 3c7e 5a7f 1b3c 5a10 ]
@s_monitx_stepfront2 [ 3c7e 5a7f 1b3c 5a18 ]
@s_monitx_stepfront3 [ 3c7e 5a7f 1b3c 5a08 ]
@s_monitx_stepback0 [ 3c7e 7efe d83c 5a18 ]
@s_monitx_stepback1 [ 3c7e 7efe d83c 5a10 ]
@s_monitx_stepback2 [ 3c7e 7efe d83c 5a18 ]
@s_monitx_stepback3 [ 3c7e 7efe d83c 5a08 ]
@s_monitx_stepside0 [ 1c3c 7afc d81c 1818 ]
@s_monitx_stepside1 [ 1c3c 7afc d81c 1828 ]
@s_monitx_stepside2 [ 1c3c 7afc d81c 3810 ]
@s_monitx_stepside3 [ 1c3c 7afc d81c 1814 ]

View File

@ -1,528 +0,0 @@
( art by @ritualdust )
%MOUSE { #82 }
( devices )
|00 @System [ &vector $2 &wst $1 &rst $1 &pad $4 &r $2 &g $2 &b $2 &debug $1 &halt $1 ]
|10 @Console [ &vector $2 &read $1 &pad $5 &write $1 &error $1 ]
|20 @Screen [ &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 ]
|30 @Audio0 [ &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 ]
|40 @Audio1 [ &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 ]
|50 @Audio2 [ &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 ]
|60 @Audio3 [ &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 ]
|80 @Controller [ &vector $2 &button $1 &key $1 ]
|90 @Mouse [ &vector $2 &x $2 &y $2 &state $1 &wheel $1 ]
|a0 @File [ &vector $2 &success $2 &stat $2 &delete $1 &append $1 &name $2 &length $2 &read $2 &write $2 ]
|c0 @DateTime [ &year $2 &month $1 &day $1 &hour $1 &minute $1 &second $1 &dotw $1 &doty $2 &isdst $1 ]
|0000
@room
&x $2 &y $2
@player
&x $1 &y $1 &d $1
|0100
( theme )
#067f .System/r DEO2
#036f .System/g DEO2
#003f .System/b DEO2
.Screen/width DEI2 #01 SFT2 #0040 SUB2 .room/x STZ2
.Screen/height DEI2 #01 SFT2 #0040 SUB2 .room/y STZ2
( vectors )
;on-frame .Screen/vector DEO2
;on-button .Controller/vector DEO2
;entrance ;draw-dungeon JSR2
#05 .player/x STZ
#06 .player/y STZ
MOUSE ;draw-mouse JSR2
BRK
@on-button ( -> )
.Controller/button DEI
DUP #00 NEQ ,&no-null JCN
POP BRK
&no-null
DUP #10 NEQ ,&no-up JCN
#00 .player/d STZ
#00 ;draw-mouse JSR2
.player/y LDZk #01 SUB SWP STZ
MOUSE ;draw-mouse JSR2
&no-up
DUP #20 NEQ ,&no-down JCN
#01 .player/d STZ
#00 ;draw-mouse JSR2
.player/y LDZk INC SWP STZ
MOUSE ;draw-mouse JSR2
&no-down
DUP #40 NEQ ,&no-left JCN
#02 .player/d STZ
#00 ;draw-mouse JSR2
.player/x LDZk #01 SUB SWP STZ
MOUSE ;draw-mouse JSR2
&no-left
DUP #80 NEQ ,&no-right JCN
#03 .player/d STZ
#00 ;draw-mouse JSR2
.player/x LDZk INC SWP STZ
MOUSE ;draw-mouse JSR2
&no-right
POP
BRK
@on-frame ( -> )
BRK
@draw-mouse ( color -- )
;spritesheet #29 .player/d LDZ ADD #0004 SFT2 ADD2 .Screen/addr DEO2
.player/x LDZ #0005 SFT2 .room/x LDZ2 ADD2 .Screen/x DEO2
.player/y LDZ #0005 SFT2 .room/y LDZ2 ADD2 .Screen/y DEO2
#40 ADD .Screen/sprite DEO
JMP2r
@draw-dungeon ( stage* -- )
STH2
#1000
&ver
DUP #0005 SFT2 .room/y LDZ2 ADD2 .Screen/y DEO2
#1000
&hor
DUP #0005 SFT2 .room/x LDZ2 ADD2 .Screen/x DEO2
( get id ) STH2 DUP STH2r ROT OVR SWP #40 SFT ADD #00 SWP
( tile ) DUP2 STH2kr ADD2 LDA #0004 SFT2 ;spritesheet ADD2 .Screen/addr DEO2
( color ) STH2kr #0100 ADD2 ADD2 LDA .Screen/sprite DEO
INC GTHk ,&hor JCN
POP2
INC GTHk ,&ver JCN
POP2
POP2r
JMP2r
@print-hex ( value -- )
STHk #04 SFT ,&parse JSR .Console/write DEO
STHr #0f AND ,&parse JSR .Console/write DEO
JMP2r
&parse ( value -- char )
DUP #09 GTH ,&above JCN #30 ADD JMP2r &above #09 SUB #60 ADD JMP2r
JMP2r
@mouse-icn
ffff ffff ffff ffff 0000 0000 0000 0000
@spritesheet
1111 11f1 1111 111f eeee ee0e eeee eee0
f5bb 55bb 51b1 51ff 0a44 aa44 ae4e ae00
55bb 55bb 1111 1111 aa44 aa44 eeee eeee
ff11 11f1 1111 111f 00ee ee0e eeee eee0
1111 1111 1111 1111 eeee eeee eeee eeee
ff80 8080 80ff 8080 00ff ffff ffff ffff
ff01 0101 01ff 0101 00fe fefe fefe fefe
ffff 11ff 0ffd 71ff 00ee ee00 fa02 ee00
ffff 11ff cffd f9ff 00ee ee00 7a02 6600
ff8c 8f9f 9f8e ff00 0cff fcfe fefd ffff
ff82 820a 390a ff00 007d 7df5 c6f5 ffff
ff7d 7f6f 3d01 ff01 38fe d4fc fafe fefe
0000 0000 0007 0808 0000 0000 0007 0f0f
0000 0000 00ff 9191 0000 0000 006e 6e6e
0000 0000 00ff 1111 0000 0000 00ee eeee
0000 0000 00c0 0000 0000 0000 00c0 e0e0
1111 1111 1111 111f eeee eeee eeee eee0
51b1 51bf 51b1 51f1 ae4e ae40 ae4e ae0e
bb55 3b15 111f 1111 44aa c4ea eee0 eeee
bf55 bb55 1111 1111 40aa 44aa eeee eeee
51b1 51b1 51b1 51f1 ae4e ae4e ae4e ae0e
dfba afbf bfbf 9f80 a0c5 d5d5 d5c0 ffff
f5fd cdfd 8dfd f901 0a06 7606 7606 fefe
ffff 11ff f785 87ff 00ee ee00 7a7a 7800
ffff 11ff cffd fdff 00ee ee00 7a02 6200
381f 0520 2038 7000 0020 3a38 3800 7c00
00ff 0000 0000 0000 0000 ff00 0000 0000
1cec 2010 101c 3800 0010 dc1c 1c00 3e00
0808 0000 0000 0000 0f0f 0700 0000 0000
ff91 9100 0000 0000 6e6e 6e00 0000 0000
ff11 1100 0000 0000 eeee ee00 0000 0000
8000 0000 0000 0000 e0e0 c000 0000 0000
1111 11f1 1111 11ff eeee ee0e eeee ee00
51b1 51b1 1111 1111 ae4e ae4e eeee eeee
aa55 ab95 8181 817f 55aa d4ea fefe fe80
ffab 55ab 51a1 51ff 0054 aa54 ae5e ae00
d5ab d5ab d1a1 d1ff 2a54 2a54 2e5e 2e00
ffbe aaaa bf9f 80bf 80d5 d5d5 c0ff ffc0
fdfd 6d2d fdf9 01f9 0216 96d6 06fe fe06
ffff 817e ffff ffff 007e ff81 0000 0000
ffff 91ff cffd f9ff 006e 6e00 7a02 6600
0000 1c04 1830 303a 0a0e 1f0e 1e2e 2e55
2838 3878 004c 4c00 283a 297d 3e7a 32ff
1070 7878 0123 1200 1172 5375 1c3c 0c7e
080e 1e1e 98c4 4800 884e caae 203c 307e
80e0 8080 80e7 8888 e000 e0e0 e007 efef
0000 0000 00c7 0808 0000 0000 00c7 efef
080e 0808 08ce 0808 0e00 0e0e 0ec0 eeee
55ab 55ab 51a1 51ff aa54 aa54 ae5e ae00
ab55 ab55 8181 817f 54aa 54aa fefe fe80
ab55 ab55 8181 817f 54aa 54aa fefe fe80
bf7f bf77 9f81 817f 5cbe 6abe fcfe fe80
ab55 ab95 8181 817f 54aa d4ea fefe fe80
ffc0 8083 80c0 ffff ffff ffff ffff ff00
ff00 80ff 8000 ffff ffff ffff ffff ff00
ff07 03c3 0307 ffff fefe fefe fefe fe00
ffff 91ff f785 ffd9 006e 6e00 7a7a 006e
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
080e 0808 080e 0808 0e00 0e0e 0e00 0e0e
80e0 8080 80e0 8080 e000 e0e0 e000 e0e0
ee88 88ee 8890 8000 00ee ee00 eefe fe7c
0000 0000 0000 0000 0000 0000 0000 0000
5ea1 51a1 51a1 51ae af5e ae5e ae5e ae5f
7e81 8181 8181 817f fffe fefe fefe fe80
7e81 41a1 51a1 51ff ff7e be5e ae5e ae00
7e81 8185 8783 817f fffe fefa fcfe fefe
7e81 8185 8783 817f fffe fefa fcfe fe80
eaea eaea ffea ffaa 5555 5555 00ff 0055
aaaa aaaa ff00 ffaa 5555 5555 00ff 0055
afaf afaf ff17 ffab 5454 5454 00fe 0054
ffff 11ff cffd c5ff 00ee ee00 7a02 7a00
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0e0e 040a 040e 0808 0000 0a04 0a00 0e0e
e0e0 40a0 40e0 8080 0000 a040 a000 e0e0
80e0 8080 e09f 9191 e000 e0e0 00ee ee6e
080e 0808 0ef0 1012 0e00 0e0e 00ee eeec
5ea1 51a1 51a1 51fe af5e ae5e ae5e ae01
7f80 8080 8080 807f ffff ffff ffff ffff
7e8d 8f9f f1e1 817f f7f6 f0ee 1efe fe80
5ea1 51a1 51a1 51ff af5e ae5e ae5e ae00
7e81 41a1 51a9 51fe ff7e be5e ae56 ae07
ffff 18ff 7873 7474 00e7 e700 c7cc cbcb
ffff 14ff 00ff 0000 00eb eb00 ff00 ffff
ffff 18ff 1ece 2e2e 00e7 e700 e333 d3d3
ffff 11ff ff85 ffd9 00ee ee00 7a7a 006e
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
ff91 91e0 8080 e080 6eee ee00 e0e0 00e0
fe10 100e 0808 0e08 ecee ee00 0e0e 000e
0000 0000 0000 55aa 0000 0000 0000 aa55
552a ff80 efff 80ff aad5 00ff ff00 ffff
55aa ff00 ffff 00ff aa55 00ff ff00 ffff
55ab ff01 dfff 01ff aa54 00fe fe00 fefe
ffff d700 00ff ffff 0000 ffff ff00 7ce2
7474 7474 7000 00ff cbcb cbcb cfff ff00
0000 0000 0000 00ff ffff ffff ffff ff00
2e2e 2e2e 2e0e 0cff d3d3 d3d3 d3f3 f300
ffff 817e ffff fbeb 007e ff81 0004 1414
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
00ff 4444 00ff 4444 00bb bbbb 00bb bbbb
00fc 4848 00fc 4848 00b4 b6b6 02b6 b6b4
ff01 1fff 011f ff01 00fe fe00 fefe 00fe
ff80 ffff 80ff ffff 00ff ff00 ffff 0000
ff00 afff 00fd ffff 00ff ff00 ffff 0000
ff01 ffff 01ff ffff 00fe fe00 fefe 0000
ffff ffff ffff ffff 3e2e ab3d efff d8f7
ffa0 ffa8 58ff a8ff 005f 0057 a700 5700
ff81 ff09 09ff 81ff 007e 00f6 f600 7e00
ff57 5617 270c 0cff 00a9 a9e8 d9f3 f300
ffff b9ef e9ef ffe7 0046 5610 5610 3c18
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
007f 8484 e080 8080 007b fbfb 00e0 e0e0
00ff 4444 0003 0404 00bb bbbb 0003 0707
0000 0000 0000 0000 0000 0000 0000 0000
1fff 011f ff01 1dff fe00 fefe 00fe fe00
5ea3 55ab 55ab 55ff af5c aa54 aa54 aa00
7e81 55ab 55ab 55ff fffe aa54 aa54 aa00
0101 ffff ffff ffff fefe 00ff c7b9 ff67
81c1 ffff ffff ffff 7e3e 00ff 1de7 fff9
ffff 8080 8080 ff55 00ff ffff ffff 00aa
fffe 0101 0101 ff55 00ff fefe fefe 00aa
3f18 181f 4e4e 26ff c7e7 e7e0 b3b1 d900
efef adef efed fdff 185a 5a18 5a1a 5200
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 8080 00e0 8000 8101
0000 0000 0000 0000 0000 0606 3636 b6b6
1e01 0181 8181 817f fffe fefe fefe fe80
ffff ffff ffff ffff ffff ae71 ffff c7fb
ffff ffff ffff ffff fefe fe1c eefe c2be
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
ffff 817e ffff ffff 007e ff81 0008 347e
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
817e ff00 ff18 0081 7eff ffff 00e7 ffff
fe81 c1a1 c1a1 c1ff 7f7e 3e5e 3e5e 3e00
aa55 ab55 01c3 7d01 55aa 54aa febe 82fe
0101 ffff ffff ffff fefe 00fe 78a6 fefa
55ab f51b 11e1 817f aa54 eae4 ee1e fe80
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
ff55 ab81 8181 817f 00aa d4fe fefe fe80
be41 a181 8181 817f 5fbe 5efe fefe fe80
7d7d 017d 7d01 7dff 8282 fe82 82fe 8200
7d7d 017d 7d01 7d7d 8282 fe82 82fe 8282
d5ab 5db0 908f 837f 2a54 af4f eff0 fc80
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
ff88 ce96 f4f0 f695 fff8 def7 fdf1 f7b5
ff0e a634 8270 32c1 ff4f ffff 9ff9 fff7
898d 38fd 4f53 44d1 9fff fdff 7fff dffd
017d 7d01 7d7d 017d fe82 82fe 8282 fe82
ffff ffff ffff ffff ffaa ff55 ffaa 55aa
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
8d85 90b8 f2b7 848d bfc7 91f8 f6ff 9fef
ffff ffff ffff ffff 5fbf 5fa7 59bf 47b8
ffff ffff ffff ffff 55aa 55ff fff9 cfff
ffff ffff ffff ffff 55aa 55bf 53bc 5fbf
ffff ffff ffff ffff feaa fe54 feaa 54aa
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
ffff ffff ffff ffff 5faa 5fb5 5faa 55aa
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
42ff 7d41 82fa 6100 7cfc 027e fcfc 7e00
@sewers
0c0d 0ea2 0e0e 0f00 0000 0000 0000 0000
3c07 58b3 3858 3d00 0000 0000 0000 0000
3c17 18c3 3828 3d00 0000 0000 0000 0000
3c30 3132 3231 4e0e 0e0e 0e0e 0e0e 0f00
3c50 8483 a344 2858 1858 6838 6828 3d00
1c1d 1e5f 9441 0718 2718 5818 1858 3d00
0000 003c 9441 22b4 64a4 3232 3232 3d00
0000 003c 93a3 4183 9383 8383 8341 3d00
0000 001c 5f94 5294 7d7e 6e6e 6f41 3d00
000c 0e0e 4f94 4194 3d3c 5858 1841 3d00
003c 1758 1894 4194 3d3c 1818 1850 3d00
003c 1898 1894 4194 3d3c a024 33b1 3d00
003c d374 d294 4494 3d3c 23b1 4144 3d00
003c d193 9394 4194 3d3c 5052 4141 3d00
004c e0c4 c4d4 82d4 4d1c 1d1e 1e1e 1f00
00bc 0000 0000 00ca 0000 0000 0000 0000
&colors
8080 8080 8080 8000 0000 0000 0000 0000
8080 8080 8080 8000 0000 0000 0000 0000
8080 8080 8080 8000 0000 0000 0000 0000
8080 8080 8080 8080 8080 8080 8080 8000
8080 8080 8080 8080 8080 8080 8080 8000
8080 8080 8080 8080 8080 8080 8080 8000
0000 0080 8080 8080 8080 8080 8080 8000
0000 0080 8080 8080 8080 8080 8080 8000
0000 0080 8080 80a0 8080 8080 8080 8000
0080 8080 8080 80a0 8080 8080 8080 8000
0080 8080 8080 80a0 8080 8080 8080 8000
0080 8080 8080 80a0 8080 8080 8080 8000
0080 8080 8080 80a0 8080 8080 8080 8000
0080 8080 8080 80a0 8080 8080 8080 8000
00a0 8080 8080 8080 a080 8080 8080 8000
00a0 0000 0000 0080 0000 0000 0000 0000
@crypt
0000 0c0d 0e0e 0f00 0000 0000 0000 0000
0c0d 4f55 5657 4e0e 0f00 0000 0000 0000
3c55 5765 6667 5557 3d00 0000 0000 0000
3c65 6732 3232 6567 3d00 0000 0000 0000
3c30 3235 3637 3233 3d00 0000 0000 0000
3c40 4345 4647 5451 3d00 0000 0000 0000
3c75 7661 6263 7576 3d4c 604d 0000 0000
3c30 3171 7273 3232 3d3c 703d 0000 0000
3c50 4441 4141 4141 4e4f 803d 0000 0000
3c50 ff41 4152 4141 9091 923d 0000 0000
3c50 4141 4141 4141 5e1e 1e1f 0000 0000
3c50 5241 4141 4441 3d00 0000 0000 0000
1c1d 1e5f 415e 1e1e 1f00 0000 0000 0000
0000 004c 824d 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
&colors
0000 8080 8080 8000 0000 0000 0000 0000
8080 8080 8080 8080 8000 0000 0000 0000
8080 8080 8080 8080 8000 0000 0000 0000
8080 8080 8080 8080 8000 0000 0000 0000
8080 8080 8080 8080 8000 0000 0000 0000
8080 8080 8080 8080 8000 0000 0000 0000
8080 8080 8080 8080 8080 8080 0000 0000
8080 8080 8080 8080 8080 8080 0000 0000
8080 8080 8080 8080 8080 8080 0000 0000
8080 8080 8080 8080 8080 8080 0000 0000
8080 8080 8080 8080 8080 8080 0000 0000
8080 8080 8080 8080 8000 0000 0000 0000
8080 8080 8080 8080 8000 0000 0000 0000
0000 00a0 80a0 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
@entrance
0c0d 0e0e 0e0e 0e0e 0f0c 0d0e 0e0f 0000
3c07 0727 2807 0506 3d3c 1717 173d 0000
3c17 287b 0728 1516 4e4f 1717 173d 0000
3c30 3131 3131 2526 1717 31a2 313d 0000
3c50 a0a1 4141 3432 1717 41b2 443d 0000
3c50 b0b1 5241 4144 3431 4141 413d 0000
3c50 4141 4141 4141 4141 5241 413d 0000
1c1d 1e1e 5f41 5e1e 1e1e 1e1e 1e1f 0000
0000 0000 4c81 4d00 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 9d00 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
&colors
8080 8080 8080 8080 8080 8080 8080 0000
8080 8080 8080 8080 8080 8080 8080 0000
8080 8081 8080 8080 8080 8080 8080 0000
8080 8080 8080 8080 8080 8080 8080 0000
8080 8080 8080 8080 8080 8080 8080 0000
8080 8080 8080 8080 8080 8080 8080 0000
8080 8080 8080 8080 8080 8080 8080 0000
8080 8080 8080 8080 8080 8080 8080 0000
0000 0000 a080 a000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 8000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
@upper
007b 7b7b 7b7b 7b7b 7b0c 0e0e 0e0e 0f7b
cfcf cfcf cfcf cfcf 7b3c 7758 7858 3d00
0c0d 0e2e 0d0e 0e0e 0e2f 8707 8808 3d00
3c05 063e 3868 3807 283e 0102 0202 3d00
3c15 1628 090a 0b17 2828 1100 0010 3d00
3c25 2628 191a 1b01 a028 1100 0020 3d00
3c01 1313 1213 1321 1312 2100 5e1e 1f00
3c14 c0c1 c1c1 c000 1010 1004 3dcf 7e00
3c14 d0c2 c2c2 d010 1000 1041 3d00 0000
3c11 c0c1 c1c1 c004 1010 0419 3d00 0000
3c11 0404 0400 1004 0004 0412 3d00 0000
3c85 8685 865e 5f70 5e5f 8586 3d00 0000
1c1d 1e1e 1e1f 3c80 3d1c 1d1e 1f00 0000
8e8e 8e8e 8e8e 4c60 4d00 0000 0000 0000
0000 0000 00ef efef 0000 0000 0000 0000
&colors
0000 0000 0000 0000 0000 0000 0000 0000
0080 8080 8080 8080 8080 8080 8080 8080
8080 8080 8080 8080 8080 8080 8080 8000
8080 8080 8080 8080 8080 8080 8080 8000
8080 8080 8080 8080 8080 8080 8080 8000
8080 8080 8080 8080 8080 8080 8080 8000
8080 8080 8080 8080 8080 8080 8080 8000
8080 8080 8080 8080 8080 8080 8080 8000
8080 8080 8080 9080 8080 8080 8080 8000
8080 80a0 80a0 9080 8080 8080 8000 0000
8080 a0a0 a0a0 b080 8080 8080 8000 0000
8080 8080 8080 8080 8080 8080 8000 0000
8080 8080 8080 8080 8080 8080 8000 0000
8080 8080 8080 8080 8080 8080 8000 0000
8080 8080 8080 a0b0 a000 0000 0000 0000
0000 0000 0080 8080 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000

View File

@ -1,82 +0,0 @@
( pseudo-random number generator,
based on two 16-bit xorshift algorithms by George Marsaglia
http://www.jstatsoft.org/v08/i14/paper )
( devices )
|00 @System [ &vector $2 &wst $1 &rst $1 &pad $4 &r $2 &g $2 &b $2 &debug $1 &halt $1 ]
|20 @Screen [ &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 ]
|c0 @DateTime [ &year $2 &month $1 &day $1 &hour $1 &minute $1 &second $1 &dotw $1 &doty $2 &isdst $1 ]
( variables )
|0000
( program )
|0100 ( -> )
( init )
;on-frame .Screen/vector DEO2
( seed prng (must be nonzero) )
#00 .DateTime/second DEI
#00 .DateTime/minute DEI #60 SFT2 EOR2
#00 .DateTime/hour DEI #c0 SFT2 EOR2 ;prng2/x STA2
#00 .DateTime/hour DEI #04 SFT2
#00 .DateTime/day DEI #10 SFT2 EOR2
#00 .DateTime/month DEI #60 SFT2 EOR2
.DateTime/year DEI2 #a0 SFT2 EOR2 ;prng2/y STA2
;prng2/x LDA2 ;prng2/y LDA2 EOR2
ORAk ,&non-zero JCN INC2 &non-zero
;prng/seed STA2
( theme )
#0fe5 .System/r DEO2
#0fc5 .System/g DEO2
#0f25 .System/b DEO2
BRK
@on-frame ( -> )
#c0
&loop
,draw-pixel JSR
INC
DUP ,&loop JCN
POP
BRK
@draw-pixel
,prng2 JSR
#00 SWP .Screen/x DEO2
#00 SWP .Screen/y DEO2
#01 .Screen/pixel DEO
JMP2r
@prng ( -- number* )
( returns the next number in a 65,535-long sequence,
which is never zero but every other 16-bit number
appears once before the sequence repeats )
( http://www.retroprogramming.com/2017/07/xorshift-pseudorandom-numbers-in-z80.html )
,&seed LDR2
DUP2 #70 SFT2 EOR2
DUP2 #09 SFT2 EOR2
DUP2 #80 SFT2 EOR2
,&seed STR2k POP
JMP2r
&seed $2
@prng2 ( -- number* )
( returns the next number in a (2^32-1)-long sequence )
( http://b2d-f9r.blogspot.com/2010/08/16-bit-xorshift-rng-now-with-more.html )
,&x LDR2
DUP2 #50 SFT2 EOR2
DUP2 #03 SFT2 EOR2
,&y LDR2 DUP2 ,&x STR2
DUP2 #01 SFT2 EOR2 EOR2
,&y STR2k POP
JMP2r
&x $2
&y $2

View File

@ -1,154 +0,0 @@
( devices )
( uxnasm rule110.tal rule110.rom && uxnemu rule110.rom )
%2* { #10 SFT } %2/ { #01 SFT } %2** { #10 SFT2 } %2// { #01 SFT2 }
%4* { #20 SFT } %4/ { #02 SFT } %4** { #20 SFT2 } %4// { #02 SFT2 }
%8* { #30 SFT } %8/ { #03 SFT } %8** { #30 SFT2 } %8// { #03 SFT2 }
%10* { #40 SFT } %10/ { #04 SFT } %10** { #40 SFT2 } %10// { #04 SFT2 }
%20* { #50 SFT } %20/ { #05 SFT } %20** { #50 SFT2 } %20// { #05 SFT2 }
%2MOD { #01 AND } %2MOD2 { #0001 AND2 }
%4MOD { #03 AND } %4MOD2 { #0003 AND2 }
%8MOD { #07 AND } %8MOD2 { #0007 AND2 }
%10MOD { #0f AND } %10MOD2 { #000f AND2 }
%ROL2 { DUP2 #0f SFT2 SWP2 #10 SFT2 ADD2 }
%ROR2 { DUP2 #f0 SFT2 SWP2 #01 SFT2 ADD2 }
%DEBUG { ;print-hex/byte JSR2 #0a18 DEO }
%DEBUG2 { ;print-hex JSR2 #0a18 DEO }
%RTN { JMP2r }
%WIDTH { #0020 }
%STEPS { #30 }
|00 @System [ &vector $2 &pad $6 &r $2 &g $2 &b $2 ]
|20 @Screen [ &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 ]
|90 @Mouse [ &vector $2 &x $2 &y $2 &state $1 &wheel $1 ]
|0000
@input
|0100
( set system colors )
#0ff7 .System/r DEO2
#0f0e .System/g DEO2
#0f0c .System/b DEO2
;on-mouse .Mouse/vector DEO2
( set size )
#0080 .Screen/width DEO2
#0180 .Screen/height DEO2
( seed ) #0001 ;input STA2
,render JSR
BRK
@render ( -- )
STEPS #00
&loop
( update )
DUP 2* LDZ2k
;rule-110 JSR2
ROT INC INC STZ2
( draw )
DUP ,draw-line JSR
INC GTHk ,&loop JCN
POP2
RTN
@draw-line ( line -- )
STHk #00 SWP 8** .Screen/y DEO2
#1000
&loop
DUP #00 SWP 8** .Screen/x DEO2
( shift ) INCk #10 SWP SUB
( get address ) STHkr 2* LDZ2
( bit ) ROT SFT2 #0001 AND2
( get sprite ) 8** ;cell-icns ADD2 .Screen/addr DEO2
#01 STHkr #00 EQU ADD .Screen/sprite DEO
INC GTHk ,&loop JCN
POP2
POPr
RTN
@rule-110 ( value* -- value* )
#0000 ,&res STR2
ROL2 STH2
#1000
&loop
( get 3-bits ) STH2kr #e000 AND2 #0d SFT2 ;rule ADD2 LDA STH
( get result ) DUP #40 SFT #00 STHr ROT SFT2
( reset ) ROR2 ROR2 ROR2
( save ) ,&res LDR2 ADD2 ,&res STR2
STH2r ROR2 STH2
INC GTHk ,&loop JCN
POP2
POP2r
,&res LDR2
RTN
&res $2
@rule
00 01 01 01 00 01 01 00
@on-mouse ( -> )
( clear last cursor )
;mouse-icn .Screen/addr DEO2
,&x LDR2 .Screen/x DEO2
,&y LDR2 .Screen/y DEO2
#40 .Screen/sprite DEO
( record pointer positions )
.Mouse/x DEI2 DUP2 ,&x STR2 .Screen/x DEO2
.Mouse/y DEI2 DUP2 ,&y STR2 .Screen/y DEO2
( colorize on state )
#43 [ .Mouse/state DEI #00 NEQ ] SUB .Screen/sprite DEO
( on click )
.Mouse/state DEI #00 NEQ JMP BRK
( toggle bit )
.input LDZ2k
#0001 .Mouse/x DEI2 8// #000f SWP2 SUB2 NIP #40 SFT SFT2 EOR2
ROT STZ2
;render JSR2
( release ) #00 .Mouse/state DEO
BRK
&x $2 &y $2
@print-hex ( value* -- )
SWP ,&byte JSR
&byte ( byte -- )
STHk #04 SFT ,&parse JSR #18 DEO
STHr #0f AND ,&parse JSR #18 DEO
RTN
&parse ( byte -- char ) DUP #09 GTH ,&above JCN #30 ADD RTN
&above #57 ADD RTN
RTN
@mouse-icn
80c0 e0f0 f8e0 1000
@cell-icns
7c82 8282 8282 7c00
7cfe fefe fefe 7c00