Browse Source

Added bit toggling for X/Y mirror

main
neauoire 4 years ago
parent
commit
1ec88fe816
  1. 67
      src/main.tal

67
src/main.tal

@ -75,7 +75,7 @@
%BANK-SPRITESHEET { #8000 }
%BANK-NAMETABLE { #9000 }
%BANK-PAINT { #9100 }
%BANK-COLOR { #9100 }
( todo )
%DATA-CLIP { #6000 }
@ -120,7 +120,7 @@
@state
&timer $1 &blink $1 &changed $1
@settings
&depth $1 &color $1 &blending $1 &ratio $1 &tool $1 &focus $2 &zoom $1
&depth $1 &color $1 &blend $1 &ratio $1 &tool $1 &focus $2 &zoom $1
@cursor
&x $2 &y $2 &last $1
@selection
@ -175,7 +175,7 @@
#0080 #0040 ++ .frame/height STZ2
#01 .settings/depth STZ
#01 .settings/color STZ
#01 .settings/blending STZ
#81 .settings/blend STZ
#32 .settings/ratio STZ
#01 .settings/tool STZ
BANK-SPRITESHEET .settings/focus STZ2
@ -191,7 +191,7 @@
.frame/x1 LDZ2 #0001 -- .frame/y1 LDZ2 #0030 ++ HOR TOS 8** #0080 SIZE-TO-RECT ;tileview SET-RECT
.frame/x1 LDZ2 #0082 ++ .frame/y1 LDZ2 #0030 ++ #007f #007f SIZE-TO-RECT ;nametable SET-RECT
.tileview/x1 LDZ2 .tileview/y2 LDZ2 #0008 ++ #0100 #0008 SIZE-TO-RECT ;toolview SET-RECT
.frame/x1 LDZ2 .frame/y1 LDZ2 #0020 #0020 SIZE-TO-RECT ;blendview SET-RECT
.frame/x1 LDZ2 .frame/y1 LDZ2 #0020 #0028 SIZE-TO-RECT ;blendview SET-RECT
.frame/x1 LDZ2 #0030 ++ .frame/y1 LDZ2 #0020 #0020 SIZE-TO-RECT ;preview SET-RECT
.frame/x1 LDZ2 #0060 ++ .frame/y1 LDZ2 #0020 #0020 SIZE-TO-RECT ;colorview SET-RECT
.frame/x1 LDZ2 #0090 ++ .frame/y1 LDZ2 #0020 #0028 SIZE-TO-RECT ;zoomview SET-RECT
@ -505,6 +505,11 @@ BRK
.Mouse/x DEI2 .nametable/x LDZ2 -- 8// ++
BANK-NAMETABLE ++ STA
( get blending ) .settings/blend LDZ
.Mouse/y DEI2 .nametable/y LDZ2 -- 8// 10**
.Mouse/x DEI2 .nametable/x LDZ2 -- 8// ++
BANK-COLOR ++ STA
;redraw JSR2
BRK
@ -615,11 +620,25 @@ BRK
.Mouse/x DEI2 .blendview/x1 LDZ2 -- 8// NIP
.Mouse/y DEI2 .blendview/y1 LDZ2 -- 8// NIP 4* +
.settings/blending STZ
;redraw JSR2
RELEASE-MOUSE
DUP #0f > ,&no-set JCN
.settings/blend LDZ #b0 AND + .settings/blend STZ
;draw-blendview JSR2
;draw-preview JSR2
RELEASE-MOUSE BRK
&no-set
DUP #12 ! ,&no-hor JCN
.settings/blend LDZ #10 EOR .settings/blend STZ
;draw-blendview JSR2
;draw-preview JSR2
RELEASE-MOUSE POP BRK
&no-hor
DUP #13 ! ,&no-ver JCN
.settings/blend LDZ #20 EOR .settings/blend STZ
;draw-blendview JSR2
;draw-preview JSR2
RELEASE-MOUSE POP BRK
&no-ver
POP
BRK
@ -886,9 +905,7 @@ RTN
GET-ITER
DUP2 GET-ADDR .Screen/addr DEO2
#0d00 SWP2 ;is-selected JSR2 SWP? POP
.settings/blending LDZ +
.settings/depth LDZ 80* +
#00 + .Screen/sprite DEO
#81 + .Screen/sprite DEO
INC GTHk ,&hor JCN
POP2
INC GTHk ,&ver JCN
@ -902,20 +919,16 @@ RTN
#00
&loop
DUP TOS 10MOD2 8** .nametable/x LDZ2 ++ .Screen/x DEO2
DUP TOS 10// 8** .nametable/y LDZ2 ++ .Screen/y DEO2
DUP TOS BANK-NAMETABLE ++ LDA TOS 10** BANK-SPRITESHEET ++ .Screen/addr DEO2
#81 .Screen/sprite DEO
DUP TOS
DUP2 10MOD2 8** .nametable/x LDZ2 ++ .Screen/x DEO2
DUP2 10// 8** .nametable/y LDZ2 ++ .Screen/y DEO2
DUP2 BANK-NAMETABLE ++ LDA TOS 10** BANK-SPRITESHEET ++ .Screen/addr DEO2
BANK-COLOR ++ LDA .Screen/sprite DEO
INC DUP ,&loop JCN
POP
RTN
@test
ffff ffff ffff ffff
ffff ffff ffff ffff
@draw-tileview-zoom ( -- )
( find focus ) GET-POSITION STH2 STH2
@ -1077,10 +1090,8 @@ RTN
( value )
.blendview/x1 LDZ2 .Screen/x DEO2
.blendview/y2 LDZ2 INC2 .Screen/y DEO2
( get blending ) .settings/blending LDZ
( get depth ) .settings/depth LDZ 80*
( draw ) + #01 ;draw-byte JSR2
.blendview/y2 LDZ2 #0007 -- .Screen/y DEO2
( get blending ) .settings/blend LDZ #01 ;draw-byte JSR2
.settings/focus LDZ2 .Screen/addr DEO2
#10 #00
@ -1088,7 +1099,7 @@ RTN
DUP 4MOD TOS 8** .blendview/x1 LDZ2 ++ .Screen/x DEO2
DUP 4/ TOS 8** .blendview/y1 LDZ2 ++ .Screen/y DEO2
#00 .Screen/sprite DEO
DUP #00 + .settings/depth LDZ 80* + .Screen/sprite DEO
DUP #00 + .settings/blend LDZ #b0 AND + .Screen/sprite DEO
INC GTHk ,&loop JCN
POP2
@ -1116,9 +1127,7 @@ RTN
.settings/ratio LDZ #04 SFT < STHr
#0101 !! ,&outside JCN
( get tile ) STH2kr .Screen/addr DEO2
( get blending ) .settings/blending LDZ
( get depth ) .settings/depth LDZ 80*
( draw ) + .Screen/sprite DEO
( get blending ) .settings/blend LDZ .Screen/sprite DEO
( incr ) STH2r #0008 [ .settings/depth LDZ 8* TOS ++ ] ++ STH2
,&resume JMP
&outside

Loading…
Cancel
Save