From 5167a103ecd9de3c17be3b58cf765cf07ac449eb Mon Sep 17 00:00:00 2001 From: neauoire Date: Tue, 17 Aug 2021 19:30:34 -0700 Subject: [PATCH] Fixed issue with null vectors --- etc/mkuxn-fast.lua | 2 +- etc/mkuxn-fast.moon | 2 +- projects/examples/devices/audio.channels.tal | 4 +--- projects/examples/gui/shapes.tal | 17 ++++++++--------- src/uxn-fast.c | 2 +- src/uxn.c | 2 +- 6 files changed, 13 insertions(+), 16 deletions(-) diff --git a/etc/mkuxn-fast.lua b/etc/mkuxn-fast.lua index 3b0264d..b5b43ae 100644 --- a/etc/mkuxn-fast.lua +++ b/etc/mkuxn-fast.lua @@ -319,7 +319,7 @@ int uxn_eval(Uxn *u, Uint16 vec) { Uint8 instr; - if(u->dev[0].dat[0xf]) + if(!vec || u->dev[0].dat[0xf]) return 0; u->ram.ptr = vec; if(u->wst.ptr > 0xf8) u->wst.ptr = 0xf8; diff --git a/etc/mkuxn-fast.moon b/etc/mkuxn-fast.moon index 30c5b30..0e74526 100644 --- a/etc/mkuxn-fast.moon +++ b/etc/mkuxn-fast.moon @@ -228,7 +228,7 @@ int uxn_eval(Uxn *u, Uint16 vec) { Uint8 instr; - if(u->dev[0].dat[0xf]) + if(!vec || u->dev[0].dat[0xf]) return 0; u->ram.ptr = vec; if(u->wst.ptr > 0xf8) u->wst.ptr = 0xf8; diff --git a/projects/examples/devices/audio.channels.tal b/projects/examples/devices/audio.channels.tal index 190f465..a185a81 100644 --- a/projects/examples/devices/audio.channels.tal +++ b/projects/examples/devices/audio.channels.tal @@ -1,7 +1,5 @@ ( dev/audio ) -%4** { #20 SFT2 } -%8** { #30 SFT2 } %MOD { DUP2 DIV MUL SUB } ( devices ) @@ -55,7 +53,7 @@ BRK @on-frame ( -> ) - ( incr ) .timer LDZ #01 ADD .timer STZ + ( incr ) .timer LDZ INC .timer STZ ( skip ) .timer LDZ #10 EQU #01 JCN [ BRK ] ( get note ) diff --git a/projects/examples/gui/shapes.tal b/projects/examples/gui/shapes.tal index 7d8bdfe..0ac5598 100644 --- a/projects/examples/gui/shapes.tal +++ b/projects/examples/gui/shapes.tal @@ -1,7 +1,6 @@ ( GUI Shapes ) %RTN { JMP2r } -%++ { #0001 ADD2 } %-- { #0001 SUB2 } %8++ { #0008 ADD2 } %2** { #10 SFT2 } @@ -79,7 +78,7 @@ RTN ( save ) OVR2 .Screen/y DEO2 ( draw ) .rect/x1 LDZ2 .Screen/x DEO2 .color LDZ DUP .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 POP2 POP2 .rect/x1 LDZ2 .rect/x2 LDZ2 @@ -87,8 +86,8 @@ RTN ( save ) OVR2 .Screen/x DEO2 ( draw ) .rect/y1 LDZ2 .Screen/y DEO2 .color LDZ DUP .Screen/pixel DEO ( draw ) .rect/y2 LDZ2 .Screen/y DEO2 .Screen/pixel DEO - ( incr ) SWP2 ++ SWP2 - OVR2 OVR2 ++ LTS2 ,&hor JCN + ( incr ) SWP2 INC2 SWP2 + OVR2 OVR2 INC2 LTS2 ,&hor JCN POP2 POP2 RTN @@ -103,10 +102,10 @@ RTN &hor ( save ) OVR2 .Screen/x DEO2 ( draw ) .color LDZ .Screen/pixel DEO - ( incr ) SWP2 ++ SWP2 + ( incr ) SWP2 INC2 SWP2 OVR2 OVR2 LTS2 ,&hor JCN POP2 POP2 STH2r STH2r - ( incr ) SWP2 ++ SWP2 + ( incr ) SWP2 INC2 SWP2 OVR2 OVR2 LTS2 ,&ver JCN POP2 POP2 POP2 POP2 @@ -119,7 +118,7 @@ RTN .circle/r LDZ2 2** .circle/d STZ2 ( draw ) ;&seg JSR2 &loop - ( incr ) .circle/x LDZ2 ++ .circle/x STZ2 + ( incr ) .circle/x LDZ2 INC2 .circle/x STZ2 .circle/d LDZ2 #0001 LTS2 ,&else JCN ( decr ) .circle/y LDZ2 -- .circle/y STZ2 .circle/x LDZ2 .circle/y LDZ2 SUB2 4** .circle/d LDZ2 ADD2 .circle/d STZ2 @@ -167,7 +166,7 @@ RTN &loop ( save ) OVR2 .Screen/x DEO2 ( draw ) STHkr .Screen/pixel DEO - ( incr ) SWP2 #0002 ++ SWP2 + ( incr ) SWP2 #0002 INC2 SWP2 LTH2k ,&loop JCN POP2 POP2 POPr @@ -179,7 +178,7 @@ RTN &loop ( save ) OVR2 .Screen/y DEO2 ( draw ) STHkr .Screen/pixel DEO - ( incr ) SWP2 #0002 ++ SWP2 + ( incr ) SWP2 #0002 INC2 SWP2 LTH2k ,&loop JCN POP2 POP2 POPr diff --git a/src/uxn-fast.c b/src/uxn-fast.c index 214592e..aeaa2f1 100644 --- a/src/uxn-fast.c +++ b/src/uxn-fast.c @@ -44,7 +44,7 @@ int uxn_eval(Uxn *u, Uint16 vec) { Uint8 instr; - if(u->dev[0].dat[0xf]) + if(!vec || u->dev[0].dat[0xf]) return 0; u->ram.ptr = vec; if(u->wst.ptr > 0xf8) u->wst.ptr = 0xf8; diff --git a/src/uxn.c b/src/uxn.c index 688472b..1f9b824 100644 --- a/src/uxn.c +++ b/src/uxn.c @@ -125,7 +125,7 @@ int uxn_eval(Uxn *u, Uint16 vec) { Uint8 instr; - if(u->dev[0].dat[0xf]) + if(!vec || u->dev[0].dat[0xf]) return 0; u->ram.ptr = vec; if(u->wst.ptr > 0xf8) u->wst.ptr = 0xf8;