From 176bade157c007c9b7a26181496e00686e8a38d4 Mon Sep 17 00:00:00 2001 From: neauoire Date: Sat, 27 Feb 2021 08:18:57 -0800 Subject: [PATCH] Merged blend example in screen --- examples/dev.screen.usm | 19 ++++++++++++++++++- examples/gui.blending.usm | 40 --------------------------------------- uxn.c | 4 ++-- uxn.h | 2 +- 4 files changed, 21 insertions(+), 44 deletions(-) delete mode 100644 examples/gui.blending.usm diff --git a/examples/dev.screen.usm b/examples/dev.screen.usm index 15ed524..e4c0d11 100644 --- a/examples/dev.screen.usm +++ b/examples/dev.screen.usm @@ -1,8 +1,9 @@ ( dev/screen ) &Screen { width 2 height 2 pad 4 x 2 y 2 color 1 } +&Sprite { pad 8 x 2 y 2 addr 2 color 1 } -;centerx 2 ;centery 2 ;i 2 +;centerx 2 ;centery 2 ;i 2 ;j 1 |0100 @RESET @@ -26,15 +27,31 @@ ~i #0002 ADD2 =i ( increment ) ~i ~dev/screen.width LTH2 ,draw-ver ROT JMP? POP2 + ( draw blending modes ) + @draw-blends + ~j ,icon #00 ~j #0008 MUL2 ~dev/screen.height #0010 SUB2 ,draw-sprite JSR + ~j #01 ADD =j + ~j #10 LTH ,draw-blends ROT JMP? POP2 + ( draw pixel in the middle ) #01 ~centerx ~centery =dev/screen.y =dev/screen.x =dev/screen.color BRK +@draw-sprite + =dev/sprite.y + =dev/sprite.x + =dev/sprite.addr + =dev/sprite.color + RTS + +@icon [ 3c7e e7c3 c3e7 7e3c ] + |c000 @FRAME BRK |d000 @ERROR BRK |FF10 ;dev/screen Screen +|FF20 ;dev/sprite Sprite |FFF0 [ f0ac f0bb f053 ] ( palette ) |FFFA .RESET .FRAME .ERROR ( vectors ) diff --git a/examples/gui.blending.usm b/examples/gui.blending.usm deleted file mode 100644 index b28215e..0000000 --- a/examples/gui.blending.usm +++ /dev/null @@ -1,40 +0,0 @@ -( desktop ) - -:dev/w fff9 ( const write port ) - -|0100 @RESET - - #02 =dev/w - #00 ,icon #0040 #0040 ,draw-sprite JSR - #01 ,icon #0048 #0040 ,draw-sprite JSR - #02 ,icon #0050 #0040 ,draw-sprite JSR - #03 ,icon #0058 #0040 ,draw-sprite JSR - #04 ,icon #0040 #0048 ,draw-sprite JSR - #05 ,icon #0048 #0048 ,draw-sprite JSR - #06 ,icon #0050 #0048 ,draw-sprite JSR - #07 ,icon #0058 #0048 ,draw-sprite JSR - #08 ,icon #0040 #0050 ,draw-sprite JSR - #09 ,icon #0048 #0050 ,draw-sprite JSR - #0a ,icon #0050 #0050 ,draw-sprite JSR - #0b ,icon #0058 #0050 ,draw-sprite JSR - #0c ,icon #0040 #0058 ,draw-sprite JSR - #0d ,icon #0048 #0058 ,draw-sprite JSR - #0e ,icon #0050 #0058 ,draw-sprite JSR - #0f ,icon #0058 #0058 ,draw-sprite JSR - -BRK - -@icon [ 3c7e e7c3 c3e7 7e3c ] - -@draw-sprite - IOW2 ( y byte ) - IOW2 ( x byte ) - IOW2 ( sprite address ) - IOW ( layer-color ) - RTS - -|c000 @FRAME -|d000 @ERROR - -|FFF0 [ f3f0 f30b f30a ] ( palette ) -|FFFA .RESET .FRAME .ERROR \ No newline at end of file diff --git a/uxn.c b/uxn.c index 95cb4e4..6c77ba0 100644 --- a/uxn.c +++ b/uxn.c @@ -114,6 +114,8 @@ Uint8 opr[][2] = { /* clang-format on */ +#pragma mark - Core + int haltuxn(Uxn *u, char *name, int id) { @@ -191,8 +193,6 @@ loaduxn(Uxn *u, char *filepath) if(!(f = fopen(filepath, "rb"))) return haltuxn(u, "Missing input rom.", 0); fread(u->ram.dat, sizeof(u->ram.dat), 1, f); - u->devr = 0xfff8; - u->devw = 0xfff9; u->vreset = mempeek16(u, 0xfffa); u->vframe = mempeek16(u, 0xfffc); u->verror = mempeek16(u, 0xfffe); diff --git a/uxn.h b/uxn.h index 1bb1d06..ea42a7f 100644 --- a/uxn.h +++ b/uxn.h @@ -39,7 +39,7 @@ typedef struct Device { typedef struct { Uint8 literal, status, devices; - Uint16 counter, devr, devw, vreset, vframe, verror; + Uint16 counter, vreset, vframe, verror; Stack wst, rst; Memory ram; Device dev[8];