uxn

Varvara Ordinator, written in ANSI C(SDL2)
git clone https://git.eamoncaddigan.net/uxn.git
Log | Files | Refs | README | LICENSE

dvd.tal (1379B)


      1 ( DVD Bounce )
      2 
      3 |00 @System &vector $2 &wst $1 &rst $1 &eaddr $2 &ecode $1 &pad $1 &r $2 &g $2 &b $2 &debug $1 &halt $1
      4 |20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1
      5 
      6 |000
      7 
      8 	@dvd &x $2 &y $2
      9 
     10 |100
     11 
     12 @on-reset ( -> )
     13 	( | theme )
     14 	#4cfd .System/r DEO2
     15 	#4cf3 .System/g DEO2
     16 	#dcf2 .System/b DEO2
     17 	( | vectors )
     18 	;on-frame .Screen/vector DEO2
     19 	( | starting position )
     20 	.Screen/width DEI2 DUP2 #01 SFT2 .dvd/x STZ2
     21 	#0020 SUB2 ;on-frame/hit-hor STA2
     22 	.Screen/height DEI2 DUP2 #01 SFT2 .dvd/y STZ2
     23 	#0010 SUB2 ;on-frame/hit-ver STA2
     24 	( | drawing mode )
     25 	[ LIT2 36 -Screen/auto ] DEO
     26 	#01 <draw-dvd>
     27 	BRK
     28 
     29 @on-frame ( -> )
     30 	#00 <draw-dvd>
     31 	( | x )
     32 	.dvd/x LDZ2
     33 	( left ) ORAk ?{
     34 		[ LIT2 ADD2 _&x ] STR }
     35 	( right ) DUP2 [ LIT2 &hit-hor $2 ] NEQ2 ?{
     36 		[ LIT2 SUB2 _&x ] STR }
     37 	#0001 [ &x ADD2 ] .dvd/x STZ2
     38 	( | y )
     39 	.dvd/y LDZ2
     40 	( top ) ORAk ?{
     41 		[ LIT2 ADD2 _&y ] STR }
     42 	( bottom ) DUP2 [ LIT2 &hit-ver $2 ] NEQ2 ?{
     43 		[ LIT2 SUB2 _&y ] STR }
     44 	#0001 [ &y ADD2 ] .dvd/y STZ2
     45 	#01 <draw-dvd>
     46 	BRK
     47 
     48 @<draw-dvd> ( color -- )
     49 	;dvd-icn .Screen/addr DEO2
     50 	.dvd/x LDZ2 .Screen/x DEO2
     51 	.dvd/y LDZ2 .Screen/y DEO2
     52 	.Screen/sprite DEOk DEO
     53 	JMP2r
     54 
     55 @dvd-icn ( 4 x 2 )
     56 	[
     57 	001f 3f38 3838 787f 00fe fe7e 7777 e3c3
     58 	000f 1f3b 7b77 e7c7 00fc fe8f 8707 0efc
     59 	7f00 000f ff7f 0700 0301 00ff f0f8 ff00
     60 	8700 00ff 7f7f ff00 f000 00e0 fcfc 8000 ]
     61