Renamed SHR for SFT

This commit is contained in:
neauoire 2021-03-19 20:41:45 -07:00
parent 39c47c9571
commit 9f7e0edb84
7 changed files with 37 additions and 37 deletions

View File

@ -46,7 +46,7 @@ Program p;
char ops[][4] = { char ops[][4] = {
"BRK", "NOP", "LIT", "LDR", "STR", "---", "JMP", "JSR", "BRK", "NOP", "LIT", "LDR", "STR", "---", "JMP", "JSR",
"EQU", "NEQ", "GTH", "LTH", "AND", "ORA", "SHL", "SHR", "EQU", "NEQ", "GTH", "LTH", "AND", "ORA", "SHL", "SFT",
"POP", "DUP", "SWP", "OVR", "ROT", "---", "CLN", "STH", "POP", "DUP", "SWP", "OVR", "ROT", "---", "CLN", "STH",
"ADD", "SUB", "MUL", "DIV", "---", "---", "---", "XOR" "ADD", "SUB", "MUL", "DIV", "---", "---", "---", "XOR"
}; };

View File

@ -20,5 +20,5 @@ cc -std=c89 -DDEBUG -Wall -Wno-unknown-pragmas -Wpedantic -Wshadow -Wextra -Werr
# cc uxn.c emulator.c -std=c89 -Os -DNDEBUG -g0 -s -Wall -Wno-unknown-pragmas -L/usr/local/lib -lSDL2 -o bin/emulator # cc uxn.c emulator.c -std=c89 -Os -DNDEBUG -g0 -s -Wall -Wno-unknown-pragmas -L/usr/local/lib -lSDL2 -o bin/emulator
# run # run
./bin/assembler projects/software/left.usm bin/boot.rom ./bin/assembler projects/software/noodle.usm bin/boot.rom
./bin/emulator bin/boot.rom ./bin/emulator bin/boot.rom

View File

@ -34,13 +34,13 @@ BRK
( detect movement ) ( detect movement )
~Controller.buttons #f0 AND ~Controller.buttons #f0 AND
DUP #04 SHR #01 AND #01 NEQ ,$no-up ROT JMP2? DUP #04 SFT #01 AND #01 NEQ ,$no-up ROT JMP2?
( move ) ~Sprite.y -- =Sprite.y ,up_icn =Sprite.addr $no-up ( move ) ~Sprite.y -- =Sprite.y ,up_icn =Sprite.addr $no-up
DUP #05 SHR #01 AND #01 NEQ ,$no-down ROT JMP2? DUP #05 SFT #01 AND #01 NEQ ,$no-down ROT JMP2?
( move ) ~Sprite.y ++ =Sprite.y ,down_icn =Sprite.addr $no-down ( move ) ~Sprite.y ++ =Sprite.y ,down_icn =Sprite.addr $no-down
DUP #06 SHR #01 AND #01 NEQ ,$no-left ROT JMP2? DUP #06 SFT #01 AND #01 NEQ ,$no-left ROT JMP2?
( move ) ~Sprite.x -- =Sprite.x ,left_icn =Sprite.addr $no-left ( move ) ~Sprite.x -- =Sprite.x ,left_icn =Sprite.addr $no-left
DUP #07 SHR #01 AND #01 NEQ ,$no-right ROT JMP2? DUP #07 SFT #01 AND #01 NEQ ,$no-right ROT JMP2?
( move ) ~Sprite.x ++ =Sprite.x ,right_icn =Sprite.addr $no-right ( move ) ~Sprite.x ++ =Sprite.x ,right_icn =Sprite.addr $no-right
POP POP

View File

@ -81,7 +81,7 @@ RTN
$hor $hor
( get bit ) ( get bit )
,cell0_icn #00 ,cell0_icn #00
~editor.addr #00 ~pixel.y ADD2 LDR #07 ~pixel.x SUB SHR #01 AND ( get bit ) ~editor.addr #00 ~pixel.y ADD2 LDR #07 ~pixel.x SUB SFT #01 AND ( get bit )
#0008 MUL2 ADD2 =Sprite.addr ( add *8 ) #0008 MUL2 ADD2 =Sprite.addr ( add *8 )
( draw ) #08 =Sprite.color ( draw ) #08 =Sprite.color
( incr ) ~Sprite.x #0008 ADD2 =Sprite.x ( incr ) ~Sprite.x #0008 ADD2 =Sprite.x

View File

@ -19,7 +19,7 @@
%RTN? { JMP2r? } %RTN? { JMP2r? }
%++ { #0001 ADD2 } %-- { #0001 SUB2 } %++ { #0001 ADD2 } %-- { #0001 SUB2 }
%8/ { #0003 SHR2 } %8* { #0003 SHL2 } %8/ { #0003 SFT2 } %8* { #0003 SHL2 }
%8- { #0008 SUB2 } %8+ { #0008 ADD2 } %8- { #0008 SUB2 } %8+ { #0008 ADD2 }
;lock { byte 1 } ;lock { byte 1 }
@ -78,37 +78,37 @@ BRK
@no-ctrl-right @no-ctrl-right
( alt ) ( alt )
,no-alt ~Controller #0f AND #02 NEQ JMP2? ,no-alt ~Controller #0f AND #02 NEQ JMP2?
,no-aup ~Controller #04 SHR #01 NEQ JMP2? ,no-aup ~Controller #04 SFT #01 NEQ JMP2?
,find-wordstart JSR2 =selection.to ,find-wordstart JSR2 =selection.to
,clamp-selection JSR2 ,redraw JSR2 ,ctrl-end JMP2 ,clamp-selection JSR2 ,redraw JSR2 ,ctrl-end JMP2
@no-aup @no-aup
,no-adown ~Controller #04 SHR #02 NEQ JMP2? ,no-adown ~Controller #04 SFT #02 NEQ JMP2?
,find-wordend JSR2 =selection.to ,find-wordend JSR2 =selection.to
,clamp-selection JSR2 ,redraw JSR2 ,ctrl-end JMP2 ,clamp-selection JSR2 ,redraw JSR2 ,ctrl-end JMP2
@no-adown @no-adown
,no-aleft ~Controller #04 SHR #04 NEQ JMP2? ,no-aleft ~Controller #04 SFT #04 NEQ JMP2?
~selection.to -- =selection.to ~selection.to -- =selection.to
,clamp-selection JSR2 ,redraw JSR2 ,ctrl-end JMP2 ,clamp-selection JSR2 ,redraw JSR2 ,ctrl-end JMP2
@no-aleft @no-aleft
,no-aright ~Controller #04 SHR #08 NEQ JMP2? ,no-aright ~Controller #04 SFT #08 NEQ JMP2?
~selection.to ++ =selection.to ~selection.to ++ =selection.to
,clamp-selection JSR2 ,redraw JSR2 ,ctrl-end JMP2 ,clamp-selection JSR2 ,redraw JSR2 ,ctrl-end JMP2
@no-aright @no-aright
@no-alt @no-alt
( ctrl ) ( ctrl )
,no-ctrl ~Controller #0f AND #01 NEQ JMP2? ,no-ctrl ~Controller #0f AND #01 NEQ JMP2?
,no-cup ~Controller #04 SHR #01 NEQ JMP2? ,no-cup ~Controller #04 SFT #01 NEQ JMP2?
#0004 ,scroll-up JSR2 #0004 ,scroll-up JSR2
,redraw JSR2 ,ctrl-end JMP2 ,redraw JSR2 ,ctrl-end JMP2
@no-cup @no-cup
,no-cdown ~Controller #04 SHR #02 NEQ JMP2? ,no-cdown ~Controller #04 SFT #02 NEQ JMP2?
#0004 ,scroll-down JSR2 #0004 ,scroll-down JSR2
,redraw JSR2 ,ctrl-end JMP2 ,redraw JSR2 ,ctrl-end JMP2
@no-cdown @no-cdown
,no-cleft ~Controller #04 SHR #04 NEQ JMP2? ,no-cleft ~Controller #04 SFT #04 NEQ JMP2?
,goto-linestart JSR2 ,redraw JSR2 ,ctrl-end JMP2 ,goto-linestart JSR2 ,redraw JSR2 ,ctrl-end JMP2
@no-cleft @no-cleft
,no-cright ~Controller #04 SHR #08 NEQ JMP2? ,no-cright ~Controller #04 SFT #08 NEQ JMP2?
,goto-lineend JSR2 ,redraw JSR2 ,ctrl-end JMP2 ,goto-lineend JSR2 ,redraw JSR2 ,ctrl-end JMP2
@no-cright @no-cright
@no-ctrl @no-ctrl
@ -468,13 +468,13 @@ RTN
@draw-short ( short ) @draw-short ( short )
=addr =addr
,font_hex #00 ,addr LDR #f0 AND #04 SHR #08 MUL ADD2 =Sprite.addr ,font_hex #00 ,addr LDR #f0 AND #04 SFT #08 MUL ADD2 =Sprite.addr
( draw ) #0e =Sprite.color ( draw ) #0e =Sprite.color
~Sprite.x 8+ =Sprite.x ~Sprite.x 8+ =Sprite.x
,font_hex #00 ,addr LDR #0f AND #08 MUL ADD2 =Sprite.addr ,font_hex #00 ,addr LDR #0f AND #08 MUL ADD2 =Sprite.addr
( draw ) #0e =Sprite.color ( draw ) #0e =Sprite.color
~Sprite.x 8+ =Sprite.x ~Sprite.x 8+ =Sprite.x
,font_hex #00 ,addr ++ LDR #f0 AND #04 SHR #08 MUL ADD2 =Sprite.addr ,font_hex #00 ,addr ++ LDR #f0 AND #04 SFT #08 MUL ADD2 =Sprite.addr
( draw ) #0e =Sprite.color ( draw ) #0e =Sprite.color
~Sprite.x 8+ =Sprite.x ~Sprite.x 8+ =Sprite.x
,font_hex #00 ,addr ++ LDR #0f AND #08 MUL ADD2 =Sprite.addr ,font_hex #00 ,addr ++ LDR #0f AND #08 MUL ADD2 =Sprite.addr
@ -556,7 +556,7 @@ RTN
#0000 =Sprite.x #0000 =Sprite.x
~scroll.y ~Sprite.y 8/ ADD2 DUP2 SWP POP =k ~scroll.y ~Sprite.y 8/ ADD2 DUP2 SWP POP =k
~position.y EQU2 #0c MUL =l ~position.y EQU2 #0c MUL =l
,font_hex #00 ~k #f0 AND #04 SHR #08 MUL ADD2 =Sprite.addr ,font_hex #00 ~k #f0 AND #04 SFT #08 MUL ADD2 =Sprite.addr
#02 ~l ADD =Sprite.color #02 ~l ADD =Sprite.color
#0008 =Sprite.x #0008 =Sprite.x
,font_hex #00 ~k #0f AND #08 MUL ADD2 =Sprite.addr ,font_hex #00 ~k #0f AND #08 MUL ADD2 =Sprite.addr

View File

@ -8,11 +8,11 @@
%RTN { JMP2r } %RTN { JMP2r }
%RTN? { JMP2r? } %RTN? { JMP2r? }
%STEP8 { #0003 SHR2 #0003 SHL2 } %STEP8 { #0003 SFT2 #0003 SHL2 }
%++ { #0001 ADD2 } %++ { #0001 ADD2 }
%2/ { #0001 SHR2 } %2* { #0001 SHL2 } %2/ { #0001 SFT2 } %2* { #0001 SHL2 }
%8/ { #0003 SHR2 } %8* { #0003 SHL2 } %8/ { #0003 SFT2 } %8* { #0003 SHL2 }
%8- { #0008 SUB2 } %8+ { #0008 ADD2 } %8- { #0008 SUB2 } %8+ { #0008 ADD2 }
;bankview { x 2 y 2 mode 1 addr 2 } ;bankview { x 2 y 2 mode 1 addr 2 }
@ -359,7 +359,7 @@ RTN
#00 =i #00 =i
$bytes $bytes
~tileview.x #0088 ADD2 =SPRT.x ~tileview.x #0088 ADD2 =SPRT.x
,font_hex #00 ~tileview.addr #00 ~i ADD2 LDR #f0 AND #04 SHR #08 MUL ADD2 =SPRT.addr ,font_hex #00 ~tileview.addr #00 ~i ADD2 LDR #f0 AND #04 SFT #08 MUL ADD2 =SPRT.addr
( draw ) #02 =SPRT.color ( draw ) #02 =SPRT.color
~SPRT.x 8+ =SPRT.x ~SPRT.x 8+ =SPRT.x
,font_hex #00 ~tileview.addr #00 ~i ADD2 LDR #0f AND #08 MUL ADD2 =SPRT.addr ,font_hex #00 ~tileview.addr #00 ~i ADD2 LDR #0f AND #08 MUL ADD2 =SPRT.addr
@ -404,7 +404,7 @@ RTN
$hor $hor
( get bit ) ( get bit )
,blank_icn #00 ,blank_icn #00
~tileview.addr #00 ~pt.y ADD2 LDR #07 ~pt.x SUB SHR #01 AND ( get bit ) ~tileview.addr #00 ~pt.y ADD2 LDR #07 ~pt.x SUB SFT #01 AND ( get bit )
8* ADD2 =SPRT.addr ( add *8 ) 8* ADD2 =SPRT.addr ( add *8 )
( draw ) #01 =SPRT.color ( draw ) #01 =SPRT.color
( incr ) ~SPRT.x 8+ =SPRT.x ( incr ) ~SPRT.x 8+ =SPRT.x
@ -445,13 +445,13 @@ RTN
@draw-short ( short ) @draw-short ( short )
=addr =addr
,font_hex #00 ,addr LDR #f0 AND #04 SHR #08 MUL ADD2 =SPRT.addr ,font_hex #00 ,addr LDR #f0 AND #04 SFT #08 MUL ADD2 =SPRT.addr
( draw ) #02 =SPRT.color ( draw ) #02 =SPRT.color
~SPRT.x 8+ =SPRT.x ~SPRT.x 8+ =SPRT.x
,font_hex #00 ,addr LDR #0f AND #08 MUL ADD2 =SPRT.addr ,font_hex #00 ,addr LDR #0f AND #08 MUL ADD2 =SPRT.addr
( draw ) #02 =SPRT.color ( draw ) #02 =SPRT.color
~SPRT.x 8+ =SPRT.x ~SPRT.x 8+ =SPRT.x
,font_hex #00 ,addr ++ LDR #f0 AND #04 SHR #08 MUL ADD2 =SPRT.addr ,font_hex #00 ,addr ++ LDR #f0 AND #04 SFT #08 MUL ADD2 =SPRT.addr
( draw ) #02 =SPRT.color ( draw ) #02 =SPRT.color
~SPRT.x 8+ =SPRT.x ~SPRT.x 8+ =SPRT.x
,font_hex #00 ,addr ++ LDR #0f AND #08 MUL ADD2 =SPRT.addr ,font_hex #00 ,addr ++ LDR #0f AND #08 MUL ADD2 =SPRT.addr

View File

@ -21,8 +21,8 @@
%RTN { JMP2r } %RTN { JMP2r }
%RTN? { JMP2r? } %RTN? { JMP2r? }
%++ { #0001 ADD2 } %-- { #0001 SUB2 } %++ { #0001 ADD2 } %-- { #0001 SUB2 }
%2/ { #0001 SHR2 } %2/ { #0001 SFT2 }
%8/ { #0003 SHR2 } %8* { #0003 SHL2 } %8/ { #0003 SFT2 } %8* { #0003 SHL2 }
%8+ { #0008 ADD2 } %8+ { #0008 ADD2 }
%MOD8 { #0007 AND2 } %MOD8 { #0007 AND2 }
@ -149,13 +149,13 @@ BRK
$no-touch $no-touch
~Controller.buttons #f0 AND ~Controller.buttons #f0 AND
DUP #04 SHR #01 AND #01 NEQ ,$no-up ROT JMP2? DUP #04 SFT #01 AND #01 NEQ ,$no-up ROT JMP2?
( move ) ~zoom.y -- =zoom.y $no-up ( move ) ~zoom.y -- =zoom.y $no-up
DUP #05 SHR #01 AND #01 NEQ ,$no-down ROT JMP2? DUP #05 SFT #01 AND #01 NEQ ,$no-down ROT JMP2?
( move ) ~zoom.y ++ =zoom.y $no-down ( move ) ~zoom.y ++ =zoom.y $no-down
DUP #06 SHR #01 AND #01 NEQ ,$no-left ROT JMP2? DUP #06 SFT #01 AND #01 NEQ ,$no-left ROT JMP2?
( move ) ~zoom.x -- =zoom.x $no-left ( move ) ~zoom.x -- =zoom.x $no-left
DUP #07 SHR #01 AND #01 NEQ ,$no-right ROT JMP2? DUP #07 SFT #01 AND #01 NEQ ,$no-right ROT JMP2?
( move ) ~zoom.x ++ =zoom.x $no-right ( move ) ~zoom.x ++ =zoom.x $no-right
#00 NEQ ,draw-canvas ROT JSR2? #00 NEQ ,draw-canvas ROT JSR2?
@ -231,7 +231,7 @@ RTN
#00 =px.x #00 =px.x
$hor $hor
( addr ) ,size_icn #00 ~cursor.size 8* ADD2 ( addr ) ,size_icn #00 ~cursor.size 8* ADD2
( byte ) #00 ~px.y ADD2 LDR #07 ~px.x SUB SHR #01 AND ( byte ) #00 ~px.y ADD2 LDR #07 ~px.x SUB SFT #01 AND
#00 EQU ,$no-pixel ROT JMP2? #00 EQU ,$no-pixel ROT JMP2?
,$no-pixel ,patternize JSR2 #00 EQU JMP2? ,$no-pixel ,patternize JSR2 #00 EQU JMP2?
~pt0.x #00 ~px.x ADD2 ~pt0.y #00 ~px.y ADD2 ,add-pixel JSR2 ~pt0.x #00 ~px.x ADD2 ~pt0.y #00 ~px.y ADD2 ,add-pixel JSR2
@ -267,7 +267,7 @@ RTN
#00 =px.x #00 =px.x
$hor $hor
( addr ) ,size_icn #00 ~cursor.size 8* ADD2 ( addr ) ,size_icn #00 ~cursor.size 8* ADD2
( byte ) #00 ~px.y ADD2 LDR #07 ~px.x SUB SHR #01 AND ( byte ) #00 ~px.y ADD2 LDR #07 ~px.x SUB SFT #01 AND
#00 EQU ,$no-pixel ROT JMP2? #00 EQU ,$no-pixel ROT JMP2?
,$no-pixel ,patternize JSR2 #00 EQU JMP2? ,$no-pixel ,patternize JSR2 #00 EQU JMP2?
~pt0.x #00 ~px.x ADD2 ~pt0.y #00 ~px.y ADD2 ,remove-pixel JSR2 ~pt0.x #00 ~px.x ADD2 ~pt0.y #00 ~px.y ADD2 ,remove-pixel JSR2
@ -336,7 +336,7 @@ RTN
SWP POP #07 AND =px.x SWP POP #07 AND =px.x
( get tile ) ~pt1.x 8/ ~pt1.y 8/ ~canvas.w MUL2 ADD2 8* ( get tile ) ~pt1.x 8/ ~pt1.y 8/ ~canvas.w MUL2 ADD2 8*
( add addr ) ,data ADD2 ( add addr ) ,data ADD2
#00 ~px.y ADD2 LDR #07 ~px.x SUB SHR #01 AND #00 ~px.y ADD2 LDR #07 ~px.x SUB SFT #01 AND
RTN RTN
@ -517,14 +517,14 @@ RTN
( draw width ) ( draw width )
~Screen.width #0048 SUB2 =Sprite.x ~Screen.width #0048 SUB2 =Sprite.x
,font_hex ~canvas.w #f0 AND #04 SHR #08 MUL ADD2 =Sprite.addr ,font_hex ~canvas.w #f0 AND #04 SFT #08 MUL ADD2 =Sprite.addr
( draw ) #02 =Sprite.color ( draw ) #02 =Sprite.color
~Sprite.x 8+ =Sprite.x ~Sprite.x 8+ =Sprite.x
,font_hex ~canvas.w #0f AND #08 MUL ADD2 =Sprite.addr ,font_hex ~canvas.w #0f AND #08 MUL ADD2 =Sprite.addr
( draw ) #02 =Sprite.color ( draw ) #02 =Sprite.color
~Sprite.x 8+ =Sprite.x ~Sprite.x 8+ =Sprite.x
( draw height ) ( draw height )
,font_hex ~canvas.h #f0 AND #04 SHR #08 MUL ADD2 =Sprite.addr ,font_hex ~canvas.h #f0 AND #04 SFT #08 MUL ADD2 =Sprite.addr
( draw ) #02 =Sprite.color ( draw ) #02 =Sprite.color
~Sprite.x 8+ =Sprite.x ~Sprite.x 8+ =Sprite.x
,font_hex ~canvas.h #0f AND #08 MUL ADD2 =Sprite.addr ,font_hex ~canvas.h #0f AND #08 MUL ADD2 =Sprite.addr