Merged blend example in screen

This commit is contained in:
neauoire 2021-02-27 08:18:57 -08:00
parent 553516dfe6
commit 176bade157
4 changed files with 21 additions and 44 deletions

View File

@ -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 )

View File

@ -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

4
uxn.c
View File

@ -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);

2
uxn.h
View File

@ -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];