Renamed SHR for SFT
This commit is contained in:
parent
39c47c9571
commit
9f7e0edb84
|
@ -46,7 +46,7 @@ Program p;
|
|||
|
||||
char ops[][4] = {
|
||||
"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",
|
||||
"ADD", "SUB", "MUL", "DIV", "---", "---", "---", "XOR"
|
||||
};
|
||||
|
|
2
build.sh
2
build.sh
|
@ -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
|
||||
|
||||
# run
|
||||
./bin/assembler projects/software/left.usm bin/boot.rom
|
||||
./bin/assembler projects/software/noodle.usm bin/boot.rom
|
||||
./bin/emulator bin/boot.rom
|
||||
|
|
|
@ -34,13 +34,13 @@ BRK
|
|||
|
||||
( detect movement )
|
||||
~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
|
||||
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
|
||||
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
|
||||
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
|
||||
POP
|
||||
|
||||
|
|
|
@ -81,7 +81,7 @@ RTN
|
|||
$hor
|
||||
( get bit )
|
||||
,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 )
|
||||
( draw ) #08 =Sprite.color
|
||||
( incr ) ~Sprite.x #0008 ADD2 =Sprite.x
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
%RTN? { JMP2r? }
|
||||
|
||||
%++ { #0001 ADD2 } %-- { #0001 SUB2 }
|
||||
%8/ { #0003 SHR2 } %8* { #0003 SHL2 }
|
||||
%8/ { #0003 SFT2 } %8* { #0003 SHL2 }
|
||||
%8- { #0008 SUB2 } %8+ { #0008 ADD2 }
|
||||
|
||||
;lock { byte 1 }
|
||||
|
@ -78,37 +78,37 @@ BRK
|
|||
@no-ctrl-right
|
||||
( alt )
|
||||
,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
|
||||
,clamp-selection JSR2 ,redraw JSR2 ,ctrl-end JMP2
|
||||
@no-aup
|
||||
,no-adown ~Controller #04 SHR #02 NEQ JMP2?
|
||||
,no-adown ~Controller #04 SFT #02 NEQ JMP2?
|
||||
,find-wordend JSR2 =selection.to
|
||||
,clamp-selection JSR2 ,redraw JSR2 ,ctrl-end JMP2
|
||||
@no-adown
|
||||
,no-aleft ~Controller #04 SHR #04 NEQ JMP2?
|
||||
,no-aleft ~Controller #04 SFT #04 NEQ JMP2?
|
||||
~selection.to -- =selection.to
|
||||
,clamp-selection JSR2 ,redraw JSR2 ,ctrl-end JMP2
|
||||
@no-aleft
|
||||
,no-aright ~Controller #04 SHR #08 NEQ JMP2?
|
||||
,no-aright ~Controller #04 SFT #08 NEQ JMP2?
|
||||
~selection.to ++ =selection.to
|
||||
,clamp-selection JSR2 ,redraw JSR2 ,ctrl-end JMP2
|
||||
@no-aright
|
||||
@no-alt
|
||||
( ctrl )
|
||||
,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
|
||||
,redraw JSR2 ,ctrl-end JMP2
|
||||
@no-cup
|
||||
,no-cdown ~Controller #04 SHR #02 NEQ JMP2?
|
||||
,no-cdown ~Controller #04 SFT #02 NEQ JMP2?
|
||||
#0004 ,scroll-down JSR2
|
||||
,redraw JSR2 ,ctrl-end JMP2
|
||||
@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
|
||||
@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
|
||||
@no-cright
|
||||
@no-ctrl
|
||||
|
@ -468,13 +468,13 @@ RTN
|
|||
@draw-short ( short )
|
||||
|
||||
=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
|
||||
~Sprite.x 8+ =Sprite.x
|
||||
,font_hex #00 ,addr LDR #0f AND #08 MUL ADD2 =Sprite.addr
|
||||
( draw ) #0e =Sprite.color
|
||||
~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
|
||||
~Sprite.x 8+ =Sprite.x
|
||||
,font_hex #00 ,addr ++ LDR #0f AND #08 MUL ADD2 =Sprite.addr
|
||||
|
@ -556,7 +556,7 @@ RTN
|
|||
#0000 =Sprite.x
|
||||
~scroll.y ~Sprite.y 8/ ADD2 DUP2 SWP POP =k
|
||||
~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
|
||||
#0008 =Sprite.x
|
||||
,font_hex #00 ~k #0f AND #08 MUL ADD2 =Sprite.addr
|
||||
|
|
|
@ -8,11 +8,11 @@
|
|||
|
||||
%RTN { JMP2r }
|
||||
%RTN? { JMP2r? }
|
||||
%STEP8 { #0003 SHR2 #0003 SHL2 }
|
||||
%STEP8 { #0003 SFT2 #0003 SHL2 }
|
||||
|
||||
%++ { #0001 ADD2 }
|
||||
%2/ { #0001 SHR2 } %2* { #0001 SHL2 }
|
||||
%8/ { #0003 SHR2 } %8* { #0003 SHL2 }
|
||||
%2/ { #0001 SFT2 } %2* { #0001 SHL2 }
|
||||
%8/ { #0003 SFT2 } %8* { #0003 SHL2 }
|
||||
%8- { #0008 SUB2 } %8+ { #0008 ADD2 }
|
||||
|
||||
;bankview { x 2 y 2 mode 1 addr 2 }
|
||||
|
@ -359,7 +359,7 @@ RTN
|
|||
#00 =i
|
||||
$bytes
|
||||
~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
|
||||
~SPRT.x 8+ =SPRT.x
|
||||
,font_hex #00 ~tileview.addr #00 ~i ADD2 LDR #0f AND #08 MUL ADD2 =SPRT.addr
|
||||
|
@ -404,7 +404,7 @@ RTN
|
|||
$hor
|
||||
( get bit )
|
||||
,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 )
|
||||
( draw ) #01 =SPRT.color
|
||||
( incr ) ~SPRT.x 8+ =SPRT.x
|
||||
|
@ -445,13 +445,13 @@ RTN
|
|||
@draw-short ( short )
|
||||
|
||||
=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
|
||||
~SPRT.x 8+ =SPRT.x
|
||||
,font_hex #00 ,addr LDR #0f AND #08 MUL ADD2 =SPRT.addr
|
||||
( draw ) #02 =SPRT.color
|
||||
~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
|
||||
~SPRT.x 8+ =SPRT.x
|
||||
,font_hex #00 ,addr ++ LDR #0f AND #08 MUL ADD2 =SPRT.addr
|
||||
|
|
|
@ -21,8 +21,8 @@
|
|||
%RTN { JMP2r }
|
||||
%RTN? { JMP2r? }
|
||||
%++ { #0001 ADD2 } %-- { #0001 SUB2 }
|
||||
%2/ { #0001 SHR2 }
|
||||
%8/ { #0003 SHR2 } %8* { #0003 SHL2 }
|
||||
%2/ { #0001 SFT2 }
|
||||
%8/ { #0003 SFT2 } %8* { #0003 SHL2 }
|
||||
%8+ { #0008 ADD2 }
|
||||
%MOD8 { #0007 AND2 }
|
||||
|
||||
|
@ -149,13 +149,13 @@ BRK
|
|||
$no-touch
|
||||
|
||||
~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
|
||||
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
|
||||
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
|
||||
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
|
||||
#00 NEQ ,draw-canvas ROT JSR2?
|
||||
|
||||
|
@ -231,7 +231,7 @@ RTN
|
|||
#00 =px.x
|
||||
$hor
|
||||
( 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?
|
||||
,$no-pixel ,patternize JSR2 #00 EQU JMP2?
|
||||
~pt0.x #00 ~px.x ADD2 ~pt0.y #00 ~px.y ADD2 ,add-pixel JSR2
|
||||
|
@ -267,7 +267,7 @@ RTN
|
|||
#00 =px.x
|
||||
$hor
|
||||
( 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?
|
||||
,$no-pixel ,patternize JSR2 #00 EQU JMP2?
|
||||
~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
|
||||
( get tile ) ~pt1.x 8/ ~pt1.y 8/ ~canvas.w MUL2 ADD2 8*
|
||||
( 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
|
||||
|
||||
|
@ -517,14 +517,14 @@ RTN
|
|||
|
||||
( draw width )
|
||||
~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
|
||||
~Sprite.x 8+ =Sprite.x
|
||||
,font_hex ~canvas.w #0f AND #08 MUL ADD2 =Sprite.addr
|
||||
( draw ) #02 =Sprite.color
|
||||
~Sprite.x 8+ =Sprite.x
|
||||
( 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
|
||||
~Sprite.x 8+ =Sprite.x
|
||||
,font_hex ~canvas.h #0f AND #08 MUL ADD2 =Sprite.addr
|
||||
|
|
Loading…
Reference in New Issue