Compare commits

...

5 Commits

Author SHA1 Message Date
neauoire 0966239f2a Fixed issue with flip filters 2 years ago
neauoire 0cdcfd5844 Added flipy 2 years ago
neauoire 438bf832c4 Added flipx 2 years ago
neauoire 8fa3ef3097 Starting flipping sprites 2 years ago
neauoire 093eb0d66d Added colorize mode 2 years ago
  1. 8
      src/manifest.tal
  2. 93
      src/nasu.tal

8
src/manifest.tal

@ -429,14 +429,6 @@ JMP2r
@scpy ( src* dst* -- ) STH2 &w LDAk STH2kr STA INC2r INC2 LDAk ,&w JCN POP2 #00 STH2r STA JMP2r
@mclr ( src* len* -- ) OVR2 ADD2 SWP2 &l STH2k #00 STH2r STA INC2 GTH2k ,&l JCN POP2 POP2 JMP2r
@phex ( short* -- )
SWP phex/b
&b ( byte -- ) DUP #04 SFT phex/b
&c ( char -- ) #0f AND DUP #09 GTH #27 MUL ADD #30 ADD #18 DEO
JMP2r
@exit ( -- )
#010f DEO

93
src/nasu.tal

@ -71,7 +71,7 @@ BRK
( name ) "Nasu 0a
( details ) "A 20 "Sprite 20 "Editor 0a
( author ) "By 20 "Hundred 20 "Rabbits 0a
( date ) "2 20 "Dec 20 "2023 00
( date ) "13 20 "Dec 20 "2023 00
01
( icon ) 83 =appicon
@ -87,16 +87,19 @@ BRK
00 00 =file-save-mono "SaveMono $1
01 "p =save-theme "SaveTheme $1
01 "q =exit "Exit $1
06 "Edit $1
09 "Edit $1
01 "c =edit-copy-chr "Copy $1
05 "C =edit-copy-icn "CopyMono $1
01 "v =edit-paste "Paste $1
01 "x =edit-cut "Cut $1
00 08 =edit-erase "Erase $1
00 "i =edit-invert "Invert $1
00 "c =edit-colorize "Colorize $1
00 00 =edit-flipx "Horizontal $1
00 00 =edit-flipy "Veritcal $1
01 "View $1
02 00 =toggle-zoom "Zoom $1
09 "Move $1
0a "Move $1
10 00 =move-up "Up $1
20 00 =move-down "Down $1
40 00 =move-left "Left $1
@ -106,6 +109,7 @@ BRK
44 00 =move-decw "Decr.W $1
84 00 =move-incw "Incr.W $1
00 1b =move-reset "Reset $1
01 "a =select-all "SelectAll $1
07 "Tool $1
00 "q =tool-brush "Brush $1
00 "w =tool-selector "Selector $1
@ -510,6 +514,58 @@ JMP2r
!redraw
(
@|filter )
@filter ( op* -- )
,&t STR2
.selection/y2 LDZ INC #30 SFT .selection/y1 LDZ #30 SFT
&ver
STHk
.selection/x2 LDZ INC #30 SFT .selection/x1 LDZ #30 SFT
&hor
#00 OVR #00 STHkr [ LIT2 &t $2 ] JSR2
INC GTHk ?&hor
POP2 POPr
INC GTHk ?&ver
POP2
JMP2r
@filter-colorize ( x* y* -- )
OVR2 OVR2 get-pixel INC #03 AND !put-pixel
@filter-flipx ( x* y* -- )
( ignore second half )
OVR2
( ) [ LIT2 00 -selection/x1 ] LDZ #30 SFT2
( ) [ LIT2 00 -selection/x2 ] LDZ INC #30 SFT2 OVR2 SUB2 #01 SFT2
( ) ADD2 LTH2 ?{ POP2 POP2 JMP2r }
( write )
STH2 DUP2 ,&x1 STR2
[ LIT2 00 -selection/x2 ] LDZ INC #30 SFT2 #0001 SUB2 SWP2 SUB2
[ LIT2 00 -selection/x1 ] LDZ #30 SFT2 ADD2 ,&x2 STR2
[ LIT2 &x1 $2 ] STH2kr get-pixel ,&c1 STR
[ LIT2 &x2 $2 ] STH2kr get-pixel ,&c2 STR
,&x2 LDR2 STH2kr [ LIT &c1 $1 ] put-pixel
,&x1 LDR2 STH2r [ LIT &c2 $1 ] !put-pixel
@filter-flipy ( x* y* -- )
( ignore second half )
DUP2
( ) [ LIT2 00 -selection/y1 ] LDZ #30 SFT2
( ) [ LIT2 00 -selection/y2 ] LDZ INC #30 SFT2 OVR2 SUB2 #01 SFT2
( ) ADD2 LTH2 ?{ POP2 POP2 JMP2r }
( write )
DUP2 ,&y1 STR2
[ LIT2 00 -selection/y2 ] LDZ INC #30 SFT2 #0001 SUB2 SWP2 SUB2
[ LIT2 00 -selection/y1 ] LDZ #30 SFT2 ADD2 ,&y2 STR2
DUP2 [ LIT2 &y1 $2 ] get-pixel ,&c1 STR
DUP2 [ LIT2 &y2 $2 ] get-pixel ,&c2 STR
DUP2 ,&y2 LDR2 [ LIT &c1 $1 ] put-pixel
,&y1 LDR2 [ LIT &c2 $1 ] !put-pixel
(
@|map )
@ -1341,6 +1397,33 @@ JMP2r
!redraw
@edit-colorize ( -- )
;filter-colorize filter
#01 .state/changed STZ draw-state
!redraw
@edit-flipx ( -- )
;filter-flipx filter
#01 .state/changed STZ draw-state
!redraw
@edit-flipy ( -- )
;filter-flipy filter
#01 .state/changed STZ draw-state
!redraw
@<phex> ( short* -- )
SWP <phex>/b
&b ( -- )
DUP #04 SFT <phex>/c
&c ( -- )
#0f AND DUP #09 GTH #27 MUL ADD [ LIT "0 ] ADD #18 DEO
JMP2r
( select )
@tool-brush ( -- ) #00 !set-tool
@ -1357,6 +1440,10 @@ JMP2r
@move-incw ( -- ) #0100 !mod-selection
@move-reset ( -- ) .selection/x1 LDZ2 .selection/x2 STZ2 !redraw
@select-all ( -- )
#0000 set-selection-from
#0f0f !set-selection-to
( pick )
@pick-color1 ( -- ) #00 !set-color

Loading…
Cancel
Save