Browse code

Implemented new-file

neauoire authored on 28/03/2021 04:22:51
Showing 1 changed files
... ...
@@ -30,7 +30,7 @@
30 30
 ;cursor { x 2 y 2 x0 2 y0 2 dx 2 dy 2 }
31 31
 ;brush { tool 1 size 1 patt 1 drag 1 last 1 oper 2 }
32 32
 ;zoom { active 1 x 2 y 2 }
33
-;center { x 2 y 2 }
33
+;document { state 1 edit 1 }
34 34
 ( interface )
35 35
 ;toolpane { x1 2 y1 2 x2 2 y2 2 }
36 36
 ;pattpane { x1 2 y1 2 x2 2 y2 2 }
... ...
@@ -74,38 +74,19 @@
74 74
 	( load file )
75 75
 	,filepath ,load-file JSR2
76 76
 
77
-	( find screen center )
78
-	~Screen.width #0002 DIV2 =center.x
79
-	~Screen.height #0002 DIV2 =center.y
80
-
81
-	( center canvas )
82
-	~center.x ~canvas.w 8* 2/ SUB2 =canvas.x1 
83
-	~center.y ~canvas.h 8* 2/ SUB2 =canvas.y1
84
-
85
-	,draw-background JSR2
86
-	,fit-canvas JSR2
87
-
88 77
 	( setup panes )
89 78
 	#0010 =toolpane.x1 #0010 =toolpane.y1
90 79
 	~Screen.width #0050 SUB2 =pattpane.x1 #0010 =pattpane.y1
91 80
 	#0040 =sizepane.x1 #0010 =sizepane.y1
92 81
 	~Screen.width #0078 SUB2 =viewpane.x1 #0010 =viewpane.y1
93 82
 
94
-	~toolpane.x1 #0028 ADD2 =toolpane.x2
95
-	~toolpane.y1 #0008 ADD2 =toolpane.y2
96
-	,draw-toolpane JSR2
97
-
98
-	~pattpane.x1 #0040 ADD2 =pattpane.x2
99
-	~pattpane.y1 #0008 ADD2 =pattpane.y2
100
-	,draw-pattpane JSR2
101
-
102
-	~sizepane.x1 #0040 ADD2 =sizepane.x2
103
-	~sizepane.y1 #0008 ADD2 =sizepane.y2
104
-	,draw-sizepane JSR2
83
+	~toolpane.x1 #0028 ADD2 =toolpane.x2 ~toolpane.y1 #0008 ADD2 =toolpane.y2
84
+	~pattpane.x1 #0040 ADD2 =pattpane.x2 ~pattpane.y1 #0008 ADD2 =pattpane.y2
85
+	~sizepane.x1 #0040 ADD2 =sizepane.x2 ~sizepane.y1 #0008 ADD2 =sizepane.y2
86
+	~viewpane.x1 #0020 ADD2 =viewpane.x2 ~viewpane.y1 #0008 ADD2 =viewpane.y2
105 87
 
106
-	~viewpane.x1 #0020 ADD2 =viewpane.x2
107
-	~viewpane.y1 #0008 ADD2 =viewpane.y2
108
-	,draw-viewpane JSR2
88
+	( center canvas )
89
+	,center JSR2
109 90
 
110 91
 BRK
111 92
 
... ...
@@ -201,7 +182,7 @@ BRK
201 182
 		~Mouse.x CLN2r ~viewpane.x1 GTH2 STH2r ~viewpane.x2 LTH2 #0101 NEQ2 ,$no-touch-viewpane JNZ2
202 183
 		~Mouse.y CLN2r ~viewpane.y1 GTH2 STH2r ~viewpane.y2 LTH2 #0101 NEQ2 ,$no-touch-viewpane JNZ2
203 184
 			( release ) #00 =Mouse.state
204
-			~canvas.x1 #0002 SUB2 ~canvas.y1 #0002 SUB2 ~canvas.x2 #0002 ADD2 ~canvas.y2 #0002 ADD2 #00 ,fill-rect JSR2
185
+			( clear ) ~canvas.x1 #0002 SUB2 ~canvas.y1 #0002 SUB2 ~canvas.x2 #0002 ADD2 ~canvas.y2 #0002 ADD2 #00 ,fill-rect JSR2
205 186
 			,draw-background JSR2
206 187
 			~Mouse.x ~viewpane.x1 SUB2 8/ SWP POP
207 188
 			DUP #00 NEQ ^$no-incwidth JNZ
... ...
@@ -253,6 +234,11 @@ BRK
253 234
 		( background interface )
254 235
 		~Mouse.y STEP8 ~Screen.height #0010 SUB2 NEQ2 ^$no-touch-background JNZ
255 236
 			~Mouse.x ~Screen.width #0020 SUB2 SUB2 8/ 
237
+			DUP2 #0000 NEQ2 ^$no-clear-button JNZ
238
+				,center JSR2
239
+				,clear JSR2
240
+				( release ) #00 =Mouse.state
241
+			$no-clear-button
256 242
 			DUP2 #0001 NEQ2 ^$no-load-button JNZ
257 243
 				,filepath ,load-file JSR2
258 244
 				,draw-canvas JSR2
... ...
@@ -310,8 +296,44 @@ BRK
310 296
 
311 297
 BRK
312 298
 
313
-@clear
299
+@center
314 300
 	
301
+	( clear ) ~canvas.x1 #0002 SUB2 ~canvas.y1 #0002 SUB2 ~canvas.x2 #0002 ADD2 ~canvas.y2 #0002 ADD2 #00 ,fill-rect JSR2
302
+
303
+	,draw-background JSR2
304
+
305
+	~Screen.width #0002 DIV2 ~canvas.w 8* 2/ SUB2 =canvas.x1 
306
+	~Screen.height #0002 DIV2 ~canvas.h 8* 2/ SUB2 =canvas.y1
307
+
308
+	,fit-canvas JSR2
309
+
310
+	,draw-toolpane JSR2
311
+	,draw-pattpane JSR2
312
+	,draw-sizepane JSR2
313
+	,draw-viewpane JSR2
314
+
315
+RTN
316
+
317
+@clear
318
+		
319
+	,untitled_txt ,filepath 
320
+	$rename
321
+		( copy src->dst ) OVR2 OVR2 SWP2 PEK2 ROT ROT POK2
322
+		( incr dst ) ++
323
+		( incr src ) SWP2 ++ SWP2
324
+		OVR2 PEK2 #00 NEQ ^$rename JNZ
325
+	#00 ROT ROT POK2 POP2
326
+
327
+	( erase old label )
328
+	~Screen.height #0010 SUB2 =Sprite.y
329
+	#0000 =Sprite.x
330
+	$erase
331
+		( draw ) #00 =Sprite.color
332
+		( incr ) ~Sprite.x ++ =Sprite.x
333
+		~Sprite.x ~Screen.width LTH2 ^$erase JNZ
334
+
335
+	,draw-background JSR2
336
+
315 337
 	( from ) ,data
316 338
 	( to ) ~canvas.w ~canvas.h MUL2 #0008 MUL2 ,data ADD2
317 339
 	$loop
... ...
@@ -705,7 +727,7 @@ RTN
705 727
 @draw-background
706 728
 	
707 729
 	( draw hor line )
708
-	#0000 =Screen.x ~center.y =Screen.y
730
+	#0000 =Screen.x ~Screen.height #0002 DIV2 =Screen.y
709 731
 	#0000 ~Screen.width ( from/to )
710 732
 	$draw-hor
711 733
 		( draw ) #01 =Screen.color
... ...
@@ -714,7 +736,7 @@ RTN
714 736
 	POP2 POP2
715 737
 
716 738
 	( draw ver line )
717
-	~center.x =Screen.x #0000 =Screen.y
739
+	~Screen.width #0002 DIV2 =Screen.x #0000 =Screen.y
718 740
 	#0000 ~Screen.height ( from/to )
719 741
 	$draw-ver
720 742
 		( draw ) #01 =Screen.color
... ...
@@ -722,32 +744,36 @@ RTN
722 744
 		OVR2 OVR2 LTH2 ^$draw-ver JNZ
723 745
 	POP2 POP2
724 746
 
747
+	( draw size )
748
+	#0010 =Sprite.y
749
+	( draw width )
750
+	~Screen.width #00a0 SUB2 =Sprite.x ,font_hex ~canvas.w #f0 AND #04 SFT #08 MUL ADD2 =Sprite.addr
751
+	( draw ) #03 =Sprite.color
752
+	~Sprite.x 8+ =Sprite.x ,font_hex ~canvas.w #0f AND #08 MUL ADD2 =Sprite.addr
753
+	( draw ) #03 =Sprite.color
754
+	( draw height )
755
+	~Sprite.x 8+ =Sprite.x ,font_hex ~canvas.h #f0 AND #04 SFT #08 MUL ADD2 =Sprite.addr
756
+	( draw ) #03 =Sprite.color
757
+	~Sprite.x 8+ =Sprite.x ,font_hex ~canvas.h #0f AND #08 MUL ADD2 =Sprite.addr
758
+	( draw ) #03 =Sprite.color
759
+
725 760
 	( draw save/load/guides icons )
726
-	~Screen.width #0018 SUB2 =Sprite.x
727 761
 	~Screen.height #0010 SUB2 =Sprite.y
728
-	,load_icn =Sprite.addr
729
-	#01 =Sprite.color
730
-	~Screen.width #0010 SUB2 =Sprite.x
731
-	,save_icn =Sprite.addr
732
-	#01 =Sprite.color
762
+
733 763
 	~Screen.width #0020 SUB2 =Sprite.x
764
+	,filestate_icn =Sprite.addr
765
+	#01 =Sprite.color
734 766
 
735
-	( draw width )
736
-	~Screen.width #0040 SUB2 =Sprite.x
737
-	,font_hex ~canvas.w #f0 AND #04 SFT #08 MUL ADD2 =Sprite.addr
738
-	( draw ) #02 =Sprite.color
739 767
 	~Sprite.x 8+ =Sprite.x
740
-	,font_hex ~canvas.w #0f AND #08 MUL ADD2 =Sprite.addr
741
-	( draw ) #02 =Sprite.color
742
-	~Sprite.x 8+ =Sprite.x
743
-	( draw height )
744
-	,font_hex ~canvas.h #f0 AND #04 SFT #08 MUL ADD2 =Sprite.addr
745
-	( draw ) #02 =Sprite.color
768
+	,load_icn =Sprite.addr
769
+	#01 =Sprite.color
770
+
746 771
 	~Sprite.x 8+ =Sprite.x
747
-	,font_hex ~canvas.h #0f AND #08 MUL ADD2 =Sprite.addr
748
-	( draw ) #02 =Sprite.color
772
+	,save_icn =Sprite.addr
773
+	#01 =Sprite.color
749 774
 
750 775
 	( draw filename )
776
+
751 777
 	#0008 =Sprite.x
752 778
 	,filepath #01 ,draw-label JSR2
753 779
 
... ...
@@ -855,18 +881,19 @@ RTN
855 881
 @load_icn       [ feaa d6aa d4aa f400 ]
856 882
 @save_icn       [ fe82 8282 848a f400 ]
857 883
 @blank_icn      [ 0000 0000 0000 0000 ]
858
-@filepath       [ projects/pictures/tima2a1a.bit 00 ]
884
+@filestate_icn  [ 1054 28c6 2854 1000 ] ( TODO, add to background! )
885
+@untitled_txt   [ untitled.bit 00 ]
859 886
 
860
-@font_hex ( 0-F ) 
887
+@font_hex ( 0-F TODO: should pull from @font instead.. ) 
861 888
 [
862
-	007c 8282 8282 827c 0030 1010 1010 1010
863
-	007c 8202 7c80 80fe 007c 8202 1c02 827c
864
-	000c 1424 4484 fe04 00fe 8080 7c02 827c
865
-	007c 8280 fc82 827c 007c 8202 1e02 0202
866
-	007c 8282 7c82 827c 007c 8282 7e02 827c
867
-	007c 8202 7e82 827e 00fc 8282 fc82 82fc 
868
-	007c 8280 8080 827c 00fc 8282 8282 82fc 
869
-	007c 8280 f080 827c 007c 8280 f080 8080
889
+	003c 464a 5262 3c00 0018 0808 0808 1c00
890
+	003c 4202 3c40 7e00 003c 421c 0242 3c00
891
+	000c 1424 447e 0400 007e 407c 0242 3c00
892
+	003c 407c 4242 3c00 007e 0204 0810 1000
893
+	003c 423c 4242 3c00 003c 4242 3e02 3c00
894
+	003c 4242 7e42 4200 007c 427c 4242 7c00 
895
+	003c 4240 4042 3c00 007c 4242 4242 7c00 
896
+	007e 4078 4040 7e00 007e 4078 4040 4000
870 897
 ]
871 898
 
872 899
 @font ( spectrum-zx font ) 
... ...
@@ -907,4 +934,6 @@ RTN
907 934
 
908 935
 @ERROR BRK 
909 936
 
910
-@data [ ]
937
+|2000 @filepath       [ projects/pictures/tima2a1a.bit 00 ]
938
+
939
+|2100 @data