uxn

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

commit 2e3cfff21008821ab6ae204968491a3f65f37d08
parent 364ba49da872ed161aa4cd6c17bf1fa5f3a062f2
Author: neauoire <aliceffekt@gmail.com>
Date:   Mon,  5 Apr 2021 13:27:43 -0700

Porter more examples to the new vectors

Diffstat:
Mbuild.sh | 2+-
Mprojects/examples/dev.keys.usm | 2+-
Mprojects/examples/dev.mouse.usm | 2+-
Mprojects/examples/dev.time.usm | 19++++++++++---------
Mprojects/examples/gui.hover.usm | 19++++++++++---------
Mprojects/examples/gui.label.usm | 19+++++++++----------
Mprojects/examples/gui.picture.usm | 15++++++++-------
Mprojects/examples/gui.shapes.usm | 13++++++++-----
Mprojects/software/left.usm | 2--
Mprojects/software/nasu.usm | 2--
Mprojects/software/neralie.usm | 2--
Mprojects/software/noodle.usm | 34++++++++++++++++------------------
Msrc/uxn.c | 2+-
13 files changed, 65 insertions(+), 68 deletions(-)

diff --git a/build.sh b/build.sh @@ -28,7 +28,7 @@ else fi echo "Assembling.." -./bin/assembler projects/examples/dev.screen.usm bin/boot.rom +./bin/assembler projects/software/noodle.usm bin/boot.rom echo "Running.." if [ "${2}" = '--cli' ]; diff --git a/projects/examples/dev.keys.usm b/projects/examples/dev.keys.usm @@ -16,7 +16,7 @@ ( program ) -|0200 @RESET +|0200 ( theme ) #0f73 =System.r #0fe3 =System.g #0fc3 =System.b ( vectors ) ,KEY =Keys.vector diff --git a/projects/examples/dev.mouse.usm b/projects/examples/dev.mouse.usm @@ -20,7 +20,7 @@ ( program ) -|0200 @RESET +|0200 ( theme ) #03fd =System.r #0ef3 =System.g #0bf2 =System.b ( vectors ) ,on-mouse =Mouse.vector diff --git a/projects/examples/dev.time.usm b/projects/examples/dev.time.usm @@ -14,16 +14,19 @@ ( devices ) -|0100 ;Console { pad 8 char 1 byte 1 short 2 } -|0110 ;Screen { width 2 height 2 pad 4 x 2 y 2 color 1 } -|0120 ;Sprite { pad 8 x 2 y 2 addr 2 color 1 } -|0170 ;Audio { ch1adsr 2 ch2adsr 2 ch3adsr 2 ch4adsr 2 ch1vol 1 ch1pitch 1 ch2vol 1 ch2pitch 1 ch3vol 1 ch3pitch 1 ch4vol 1 ch4pitch 1 } -|0190 ;Time { year 2 month 1 day 1 hour 1 minute 1 second 1 dow 1 doy 2 isdst 1 get 1 } -|01F0 ;System { pad 8 r 2 g 2 b 2 } +|0100 ;System { vector 2 pad 6 r 2 g 2 b 2 } +|0110 ;Console { pad 8 char 1 byte 1 short 2 } +|0120 ;Screen { vector 2 width 2 height 2 pad 2 x 2 y 2 color 1 } +|0130 ;Sprite { vector 2 pad 6 x 2 y 2 addr 2 color 1 } +|0140 ;Controller { vector 2 button 1 } +|0150 ;Keys { vector 2 key 1 } +|0160 ;Mouse { vector 2 x 2 y 2 state 1 chord 1 } +|0180 ;Audio { ch1adsr 2 ch2adsr 2 ch3adsr 2 ch4adsr 2 ch1vol 1 ch1pitch 1 ch2vol 1 ch2pitch 1 ch3vol 1 ch3pitch 1 ch4vol 1 ch4pitch 1 } +|01a0 ;Time { year 2 month 1 day 1 hour 1 minute 1 second 1 dow 1 doy 2 isdst 1 get 1 } ( program ) -|0200 @RESET +|0200 ( theme ) #0ff8 =System.r #0f08 =System.g #0f08 =System.b ( vectors ) ,FRAME =Screen.vector @@ -134,8 +137,6 @@ BRK RTN -@ERROR BRK - @table ( 60 positions on a circle in bytes ) [ 8000 8d00 9a02 a706 b40b c011 cb18 d520 diff --git a/projects/examples/gui.hover.usm b/projects/examples/gui.hover.usm @@ -10,17 +10,20 @@ ;r2 { x1 2 y1 2 x2 2 y2 2 } ;r3 { x1 2 y1 2 x2 2 y2 2 } -|0110 ;Screen { width 2 height 2 pad 4 x 2 y 2 color 1 } -|0120 ;Sprite { pad 8 x 2 y 2 addr 2 color 1 } -|0150 ;Mouse { x 2 y 2 state 1 chord 1 } -|01F0 ;System { pad 8 r 2 g 2 b 2 } +|0100 ;System { vector 2 pad 6 r 2 g 2 b 2 } +|0110 ;Console { pad 8 char 1 byte 1 short 2 } +|0120 ;Screen { vector 2 width 2 height 2 pad 2 x 2 y 2 color 1 } +|0130 ;Sprite { vector 2 pad 6 x 2 y 2 addr 2 color 1 } +|0140 ;Controller { vector 2 button 1 } +|0150 ;Keys { vector 2 key 1 } +|0160 ;Mouse { vector 2 x 2 y 2 state 1 chord 1 } ( program ) -|0200 @RESET +|0200 ( theme ) #0f0f =System.r #0fff =System.g #0ff0 =System.b - ( vectors ) ,FRAME =Screen.vector + ( vectors ) ,on-mouse =Mouse.vector #0020 #0030 #0060 #0060 =r1.y2 =r1.x2 =r1.y1 =r1.x1 #0058 #0050 #0090 #0080 =r2.y2 =r2.x2 =r2.y1 =r2.x1 @@ -28,7 +31,7 @@ BRK -@FRAME +@on-mouse ,pointer_icn =pointer.sprite @@ -98,5 +101,3 @@ RTN @clear_icn [ 0000 0000 0000 0000 ] @pointer_icn [ 80c0 e0f0 f8e0 1000 ] @hand_icn [ 4040 4070 f8f8 f870 ] - -@ERROR BRK diff --git a/projects/examples/gui.label.usm b/projects/examples/gui.label.usm @@ -3,20 +3,21 @@ %RTN { JMP2r } ;label { x 2 y 2 color 1 addr 2 } -;rect { x1 2 y1 2 x2 2 y2 2 } ;center { x 2 y 2 } -;i { short 2 } -|0110 ;Screen { width 2 height 2 pad 4 x 2 y 2 color 1 } -|0120 ;Sprite { pad 8 x 2 y 2 addr 2 color 1 } -|01F0 ;System { pad 8 r 2 g 2 b 2 } +|0100 ;System { vector 2 pad 6 r 2 g 2 b 2 } +|0110 ;Console { pad 8 char 1 byte 1 short 2 } +|0120 ;Screen { vector 2 width 2 height 2 pad 2 x 2 y 2 color 1 } +|0130 ;Sprite { vector 2 pad 6 x 2 y 2 addr 2 color 1 } +|0140 ;Controller { vector 2 button 1 } +|0150 ;Keys { vector 2 key 1 } +|0160 ;Mouse { vector 2 x 2 y 2 state 1 chord 1 } ( program ) |0200 @RESET ( theme ) #0f0f =System.r #0fff =System.g #0ff0 =System.b - ( vectors ) ,FRAME =Screen.vector ( find screen center ) ~Screen.width #0002 DIV2 =center.x @@ -128,7 +129,4 @@ RTN @text2 [ Middle 20 Aligned 00 ] @text3 [ Right 20 Aligned 00 ] @text4 [ even 00 ] -@text5 [ odd 00 ] - -@FRAME BRK -@ERROR BRK +@text5 [ odd 00 ] +\ No newline at end of file diff --git a/projects/examples/gui.picture.usm b/projects/examples/gui.picture.usm @@ -4,15 +4,19 @@ ;pict { x 2 y 2 width 2 height 2 color 1 addr 2 } -|0120 ;Sprite { pad 8 x 2 y 2 addr 2 color 1 } -|01F0 ;System { pad 8 r 2 g 2 b 2 } +|0100 ;System { vector 2 pad 6 r 2 g 2 b 2 } +|0110 ;Console { pad 8 char 1 byte 1 short 2 } +|0120 ;Screen { vector 2 width 2 height 2 pad 2 x 2 y 2 color 1 } +|0130 ;Sprite { vector 2 pad 6 x 2 y 2 addr 2 color 1 } +|0140 ;Controller { vector 2 button 1 } +|0150 ;Keys { vector 2 key 1 } +|0160 ;Mouse { vector 2 x 2 y 2 state 1 chord 1 } ( program ) -|0200 @RESET +|0200 ( theme ) #0ffc =System.r #0f0b =System.g #0f03 =System.b - ( vectors ) ,FRAME =Screen.vector #0000 #0000 #0100 #0100 #01 ,pict_large ,draw-picture JSR2 #0098 #0060 #0080 #0080 #01 ,pict_medium ,draw-picture JSR2 @@ -309,6 +313,3 @@ RTN 1081 4182 0500 0000 aa25 512a 44aa 0000 0254 0992 4984 0000 9452 4925 5289 0000 ] - -@FRAME BRK -@ERROR BRK diff --git a/projects/examples/gui.shapes.usm b/projects/examples/gui.shapes.usm @@ -10,16 +10,19 @@ ;rect { x1 2 y1 2 x2 2 y2 2 } ;line { x0 2 y0 2 x 2 y 2 sx 2 sy 2 dx 2 dy 2 e1 2 e2 2 } ;color { byte 1 } - ;circle { xc 2 yc 2 x 2 y 2 r 2 d 2 } -|0110 ;Screen { width 2 height 2 pad 4 x 2 y 2 color 1 } -|0120 ;Sprite { pad 8 x 2 y 2 addr 2 color 1 } -|01F0 ;System { pad 8 r 2 g 2 b 2 } +|0100 ;System { vector 2 pad 6 r 2 g 2 b 2 } +|0110 ;Console { pad 8 char 1 byte 1 short 2 } +|0120 ;Screen { vector 2 width 2 height 2 pad 2 x 2 y 2 color 1 } +|0130 ;Sprite { vector 2 pad 6 x 2 y 2 addr 2 color 1 } +|0140 ;Controller { vector 2 button 1 } +|0150 ;Keys { vector 2 key 1 } +|0160 ;Mouse { vector 2 x 2 y 2 state 1 chord 1 } ( program ) -|0200 @RESET +|0200 ( theme ) #13fd =System.r #1ef3 =System.g #1bf2 =System.b diff --git a/projects/software/left.usm b/projects/software/left.usm @@ -726,7 +726,5 @@ RTN @filepath1 [ projects/examples/gui.hover.usm 00 ] @filepath [ projects/examples/dev.time.usm 00 ] -@ERROR BRK - ;clip { len 2 body 256 } ;document { eof 2 body 2 } \ No newline at end of file diff --git a/projects/software/nasu.usm b/projects/software/nasu.usm @@ -524,6 +524,4 @@ RTN 007c 8280 f080 827c 007c 8280 f080 8080 ] -@ERROR BRK - |2000 @bank [ ] diff --git a/projects/software/neralie.usm b/projects/software/neralie.usm @@ -39,8 +39,6 @@ OVR2 OVR2 ~lines.x1 ,v JSR2 ~lines.x2 ,v JSR2 - @ERROR BRK - @FRAME ,update-fps JSR2 #00 =neralie.color diff --git a/projects/software/noodle.usm b/projects/software/noodle.usm @@ -54,10 +54,10 @@ |0100 ;System { vector 2 pad 6 r 2 g 2 b 2 } |0110 ;Console { pad 8 char 1 byte 1 short 2 } |0120 ;Screen { vector 2 width 2 height 2 pad 2 x 2 y 2 color 1 } -|0130 ;Sprite { pad 8 x 2 y 2 addr 2 color 1 } -|0140 ;Controller { p1 1 } -|0150 ;Keys { key 1 } -|0160 ;Mouse { x 2 y 2 state 1 chord 1 } +|0130 ;Sprite { vector 2 pad 6 x 2 y 2 addr 2 color 1 } +|0140 ;Controller { vector 2 button 1 } +|0150 ;Keys { vector 2 key 1 } +|0160 ;Mouse { vector 2 x 2 y 2 state 1 chord 1 } |0170 ;File { pad 8 name 2 length 2 load 2 save 2 } ( program ) @@ -134,7 +134,7 @@ BRK ~Mouse.state #00 EQU ,$no-touch JNZ2 ( drag ) - ~Controller #02 NEQ ,$no-drag JNZ2 + ~Controller.button #02 NEQ ,$no-drag JNZ2 ~brush.drag #00 NEQ ^$no-drag-start JNZ ~canvas.x1 =origin.x1 ~canvas.y1 =origin.y1 @@ -262,8 +262,8 @@ BRK $no-touch - ~Controller.p1 #00 EQU ,$no-ctrl JNZ2 - ~Controller.p1 #f0 AND + ~Controller.button #00 EQU ,$no-ctrl JNZ2 + ~Controller.button #f0 AND DUP #04 SFT #01 AND #01 NEQ ^$no-up JNZ ( move ) ~zoom.y -- =zoom.y $no-up DUP #05 SFT #01 AND #01 NEQ ^$no-down JNZ @@ -275,8 +275,8 @@ BRK #00 EQU #04 JNZ ,draw-canvas JSR2 $no-ctrl - ~Keys #00 EQU ,$no-keys JNZ2 - ~Keys + ~Keys.key #00 EQU ,$no-keys JNZ2 + ~Keys.key DUP #20 NEQ ^$no-space JNZ ( toggle zoom ) ~zoom.active #00 EQU =zoom.active ,redraw JSR2 $no-space DUP #08 NEQ ^$no-backspace JNZ @@ -293,7 +293,7 @@ BRK ( tool0 ) #04 =brush.tool ,draw-toolpane JSR2 $no-tkey DUP DUP #30 GTH SWP #39 LTH #0101 NEQ2 ^$no-numkey JNZ - ( size ) ~Keys #31 SUB =brush.size ,draw-sizepane JSR2 $no-numkey + ( size ) ~Keys.key #31 SUB =brush.size ,draw-sizepane JSR2 $no-numkey POP ( release ) #00 =Keys $no-keys @@ -306,21 +306,21 @@ BRK @on-rename ( -- ) - ~Keys #00 EQU ,$no-keys JNZ2 + ~Keys.key #00 EQU ,$no-keys JNZ2 ( enter ) - ~Keys #0d NEQ ^$no-enter JNZ + ~Keys.key #0d NEQ ^$no-enter JNZ #00 =document.edit ,redraw JSR2 BRK $no-enter ( backspace ) - ~Keys #08 NEQ ^$no-backspace JNZ + ~Keys.key #08 NEQ ^$no-backspace JNZ ~path.length #00 EQU ^$end JNZ ~path.length #01 SUB =path.length ^$end JMP $no-backspace ( default ) ~path.length #1f EQU ^$end JNZ - ~Keys ,path.name #00 ~path.length ADD2 POK2 + ~Keys.key ,path.name #00 ~path.length ADD2 POK2 ~path.length #01 ADD =path.length $end #00 ,path.name #00 ~path.length ADD2 POK2 @@ -659,7 +659,7 @@ RTN ( draw size cursor ) ~brush.tool #01 NEQ ,$outside-canvas JNZ2 ( do not draw size when holding alt ) - ~Controller #02 EQU ,$outside-canvas JNZ2 + ~Controller.button #02 EQU ,$outside-canvas JNZ2 ~Mouse.x CLN2r ~canvas.x1 GTH2 STH2r ~canvas.x2 LTH2 #0101 NEQ2 ,$outside-canvas JNZ2 ~Mouse.y CLN2r ~canvas.y1 GTH2 STH2r ~canvas.y2 LTH2 #0101 NEQ2 ,$outside-canvas JNZ2 ( do not draw size in toolpane ) @@ -673,7 +673,7 @@ RTN $outside-canvas ( draw new cursor ) ~cursor.x =Sprite.x ~cursor.y =Sprite.y - ,pointers_icn #00 ~Controller #02 EQU 8* ADD2 =Sprite.addr + ,pointers_icn #00 ~Controller.button #02 EQU 8* ADD2 =Sprite.addr #1f ~Mouse.state #01 EQU #0a MUL SUB =Sprite.color RTN @@ -998,6 +998,4 @@ RTN 0008 0808 0808 0800 0030 1008 0810 3000 0000 0032 4c00 0000 3c42 99a1 a199 423c ] -@ERROR BRK - |2100 @data diff --git a/src/uxn.c b/src/uxn.c @@ -189,6 +189,6 @@ portuxn(Uxn *u, Uint8 id, char *name, Uint8 (*pofn)(Uxn *u, Uint16 ptr, Uint8 b0 Device *d = &u->dev[id]; d->addr = PAGE_DEVICE + id * 0x10; d->poke = pofn; - printf("Device added #%d: %s, at 0x%04x \n", id, name, d->addr); + printf("Device added #%02x: %s, at 0x%04x \n", id, name, d->addr); return d; }