uxn

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

commit 4e9ca47e383b897f6604fa48cfde6face0ef56fd
parent e86503901cf2e27d25383e1335c91440109c937f
Author: neauoire <aliceffekt@gmail.com>
Date:   Wed, 10 Feb 2021 19:05:40 -0800

Cleaned up examples

Diffstat:
Mexamples/blank.usm | 3+++
Mexamples/hello.usm | 32++++++++++++++------------------
Mexamples/pixel.usm | 2+-
Mexamples/pixels.usm | 24+++++++++++-------------
Mexamples/test.usm | 4+---
5 files changed, 30 insertions(+), 35 deletions(-)

diff --git a/examples/blank.usm b/examples/blank.usm @@ -1,5 +1,8 @@ ( blank ) +:dev/r fff8 ( std read port ) +:dev/w fff9 ( std write port ) + |0100 @RESET BRK |c000 @FRAME BRK |d000 @ERROR BRK diff --git a/examples/hello.usm b/examples/hello.usm @@ -1,29 +1,25 @@ -( hello world ) +( hello world, to console ) -;iterator +:dev/w fff9 ( const write port ) +;i 1 ( var iterator ) |0100 @RESET -@word1 "hello_world ( len: 0x0b ) + ,00 ,dev/w STR ( set dev/write to console ) -@loop - IOW ( write to device#0 ) - ,incr JSR ( increment itr ) - ,word1 ,strlen JSR ( get strlen ) - NEQ ,loop ROT JSR? ( loop != strlen ) + @word1 "hello_world ( len: 0x0b ) -BRK + @loop + IOW ( write to device#0 ) + ,incr JSR ( increment itr ) + ,i LDR ( a = i ) + ,word1 ,strlen JSR ( b = string length ) + NEQ ,loop ROT JSR? ( a != b ? loop ) -@strlen - ,0001 ADD^ LDR - RTS +BRK -@incr - ,iterator LDR - ,01 ADD - ,iterator STR - ,iterator LDR - RTS +@strlen ,0001 ADD^ LDR RTS +@incr ,i LDR ,01 ADD ,i STR RTS |c000 @FRAME BRK |d000 @ERROR BRK diff --git a/examples/pixel.usm b/examples/pixel.usm @@ -1,4 +1,4 @@ -( draw pixel ) +( draw a single pixel ) :dev/w fff9 ( keep write port in a const ) ;x 2 diff --git a/examples/pixels.usm b/examples/pixels.usm @@ -3,7 +3,7 @@ :dev/r fff8 ( std read port ) :dev/w fff9 ( std write port ) -;x 2 ;y 2 ;color 1 +;x 2 ;y 2 ;color 1 ;alive 1 |0100 @RESET @@ -11,36 +11,34 @@ ,01 ,color STR ( set color ) ,0020 ,x STR^ ( set x-pos ) ,0030 ,y STR^ ( set y-pos ) + ,01 ,alive STR ( set alive = true ) BRK |c000 @FRAME - ,colorize JSR - ,move JSR - ( draw ) + ,alive LDR ,00 EQU BRK? ,01 ,color LDR ,x LDR^ ,y LDR^ ,putpixel JSR + ,move JSR BRK -@colorize - ,color LDR ,01 ADD ,color STR ( incr color ) - ,color LDR ,04 LTH RTS? - ,01 ,color STR - RTS - @move ,x LDR^ ,0001 ADD^ ,x STR^ ( incr x ) - ,x LDR^ ,0060 LTH^ RTS? ( if x > 60 ) + ,x LDR^ ,0040 LTH^ RTS? ( if x > 60 ) ,0020 ,x STR^ ( x = 0x0020 ) ,y LDR^ ,0001 ADD^ ,y STR^ ( incr y ) + + ,y LDR^ ,0050 LTH^ RTS? ( y > 50 ) + ,00 ,alive STR ( alive = 0 ) + RTS @putpixel IOW^ ( y short ) IOW^ ( x short ) - IOW ( color byte ) - IOW ( redraw byte ) + IOW ( color byte ) + IOW ( redraw byte ) RTS |d000 @ERROR BRK diff --git a/examples/test.usm b/examples/test.usm @@ -1,11 +1,9 @@ -( my default test file ) +( my test file, junk ) :dev/r fff8 ( std read port ) :dev/w fff9 ( std write port ) |0100 @RESET - - ,01 ,dev/w STR ( set dev/write screen#01 ) BRK