Fixed issue with null vectors

This commit is contained in:
neauoire 2021-08-17 19:30:34 -07:00
parent ddac370775
commit 5167a103ec
6 changed files with 13 additions and 16 deletions

View File

@ -319,7 +319,7 @@ int
uxn_eval(Uxn *u, Uint16 vec) uxn_eval(Uxn *u, Uint16 vec)
{ {
Uint8 instr; Uint8 instr;
if(u->dev[0].dat[0xf]) if(!vec || u->dev[0].dat[0xf])
return 0; return 0;
u->ram.ptr = vec; u->ram.ptr = vec;
if(u->wst.ptr > 0xf8) u->wst.ptr = 0xf8; if(u->wst.ptr > 0xf8) u->wst.ptr = 0xf8;

View File

@ -228,7 +228,7 @@ int
uxn_eval(Uxn *u, Uint16 vec) uxn_eval(Uxn *u, Uint16 vec)
{ {
Uint8 instr; Uint8 instr;
if(u->dev[0].dat[0xf]) if(!vec || u->dev[0].dat[0xf])
return 0; return 0;
u->ram.ptr = vec; u->ram.ptr = vec;
if(u->wst.ptr > 0xf8) u->wst.ptr = 0xf8; if(u->wst.ptr > 0xf8) u->wst.ptr = 0xf8;

View File

@ -1,7 +1,5 @@
( dev/audio ) ( dev/audio )
%4** { #20 SFT2 }
%8** { #30 SFT2 }
%MOD { DUP2 DIV MUL SUB } %MOD { DUP2 DIV MUL SUB }
( devices ) ( devices )
@ -55,7 +53,7 @@ BRK
@on-frame ( -> ) @on-frame ( -> )
( incr ) .timer LDZ #01 ADD .timer STZ ( incr ) .timer LDZ INC .timer STZ
( skip ) .timer LDZ #10 EQU #01 JCN [ BRK ] ( skip ) .timer LDZ #10 EQU #01 JCN [ BRK ]
( get note ) ( get note )

View File

@ -1,7 +1,6 @@
( GUI Shapes ) ( GUI Shapes )
%RTN { JMP2r } %RTN { JMP2r }
%++ { #0001 ADD2 }
%-- { #0001 SUB2 } %-- { #0001 SUB2 }
%8++ { #0008 ADD2 } %8++ { #0008 ADD2 }
%2** { #10 SFT2 } %2** { #10 SFT2 }
@ -79,7 +78,7 @@ RTN
( save ) OVR2 .Screen/y DEO2 ( save ) OVR2 .Screen/y DEO2
( draw ) .rect/x1 LDZ2 .Screen/x DEO2 .color LDZ DUP .Screen/pixel DEO ( draw ) .rect/x1 LDZ2 .Screen/x DEO2 .color LDZ DUP .Screen/pixel DEO
( draw ) .rect/x2 LDZ2 .Screen/x DEO2 .Screen/pixel DEO ( draw ) .rect/x2 LDZ2 .Screen/x DEO2 .Screen/pixel DEO
( incr ) SWP2 ++ SWP2 ( incr ) SWP2 INC2 SWP2
OVR2 OVR2 LTS2 ,&ver JCN OVR2 OVR2 LTS2 ,&ver JCN
POP2 POP2 POP2 POP2
.rect/x1 LDZ2 .rect/x2 LDZ2 .rect/x1 LDZ2 .rect/x2 LDZ2
@ -87,8 +86,8 @@ RTN
( save ) OVR2 .Screen/x DEO2 ( save ) OVR2 .Screen/x DEO2
( draw ) .rect/y1 LDZ2 .Screen/y DEO2 .color LDZ DUP .Screen/pixel DEO ( draw ) .rect/y1 LDZ2 .Screen/y DEO2 .color LDZ DUP .Screen/pixel DEO
( draw ) .rect/y2 LDZ2 .Screen/y DEO2 .Screen/pixel DEO ( draw ) .rect/y2 LDZ2 .Screen/y DEO2 .Screen/pixel DEO
( incr ) SWP2 ++ SWP2 ( incr ) SWP2 INC2 SWP2
OVR2 OVR2 ++ LTS2 ,&hor JCN OVR2 OVR2 INC2 LTS2 ,&hor JCN
POP2 POP2 POP2 POP2
RTN RTN
@ -103,10 +102,10 @@ RTN
&hor &hor
( save ) OVR2 .Screen/x DEO2 ( save ) OVR2 .Screen/x DEO2
( draw ) .color LDZ .Screen/pixel DEO ( draw ) .color LDZ .Screen/pixel DEO
( incr ) SWP2 ++ SWP2 ( incr ) SWP2 INC2 SWP2
OVR2 OVR2 LTS2 ,&hor JCN OVR2 OVR2 LTS2 ,&hor JCN
POP2 POP2 STH2r STH2r POP2 POP2 STH2r STH2r
( incr ) SWP2 ++ SWP2 ( incr ) SWP2 INC2 SWP2
OVR2 OVR2 LTS2 ,&ver JCN OVR2 OVR2 LTS2 ,&ver JCN
POP2 POP2 POP2 POP2 POP2 POP2 POP2 POP2
@ -119,7 +118,7 @@ RTN
.circle/r LDZ2 2** .circle/d STZ2 .circle/r LDZ2 2** .circle/d STZ2
( draw ) ;&seg JSR2 ( draw ) ;&seg JSR2
&loop &loop
( incr ) .circle/x LDZ2 ++ .circle/x STZ2 ( incr ) .circle/x LDZ2 INC2 .circle/x STZ2
.circle/d LDZ2 #0001 LTS2 ,&else JCN .circle/d LDZ2 #0001 LTS2 ,&else JCN
( decr ) .circle/y LDZ2 -- .circle/y STZ2 ( decr ) .circle/y LDZ2 -- .circle/y STZ2
.circle/x LDZ2 .circle/y LDZ2 SUB2 4** .circle/d LDZ2 ADD2 .circle/d STZ2 .circle/x LDZ2 .circle/y LDZ2 SUB2 4** .circle/d LDZ2 ADD2 .circle/d STZ2
@ -167,7 +166,7 @@ RTN
&loop &loop
( save ) OVR2 .Screen/x DEO2 ( save ) OVR2 .Screen/x DEO2
( draw ) STHkr .Screen/pixel DEO ( draw ) STHkr .Screen/pixel DEO
( incr ) SWP2 #0002 ++ SWP2 ( incr ) SWP2 #0002 INC2 SWP2
LTH2k ,&loop JCN LTH2k ,&loop JCN
POP2 POP2 POPr POP2 POP2 POPr
@ -179,7 +178,7 @@ RTN
&loop &loop
( save ) OVR2 .Screen/y DEO2 ( save ) OVR2 .Screen/y DEO2
( draw ) STHkr .Screen/pixel DEO ( draw ) STHkr .Screen/pixel DEO
( incr ) SWP2 #0002 ++ SWP2 ( incr ) SWP2 #0002 INC2 SWP2
LTH2k ,&loop JCN LTH2k ,&loop JCN
POP2 POP2 POPr POP2 POP2 POPr

View File

@ -44,7 +44,7 @@ int
uxn_eval(Uxn *u, Uint16 vec) uxn_eval(Uxn *u, Uint16 vec)
{ {
Uint8 instr; Uint8 instr;
if(u->dev[0].dat[0xf]) if(!vec || u->dev[0].dat[0xf])
return 0; return 0;
u->ram.ptr = vec; u->ram.ptr = vec;
if(u->wst.ptr > 0xf8) u->wst.ptr = 0xf8; if(u->wst.ptr > 0xf8) u->wst.ptr = 0xf8;

View File

@ -125,7 +125,7 @@ int
uxn_eval(Uxn *u, Uint16 vec) uxn_eval(Uxn *u, Uint16 vec)
{ {
Uint8 instr; Uint8 instr;
if(u->dev[0].dat[0xf]) if(!vec || u->dev[0].dat[0xf])
return 0; return 0;
u->ram.ptr = vec; u->ram.ptr = vec;
if(u->wst.ptr > 0xf8) u->wst.ptr = 0xf8; if(u->wst.ptr > 0xf8) u->wst.ptr = 0xf8;