Browse code

Progress on preview in nasu

neauoire authored on 09/05/2021 21:10:07
Showing 2 changed files
1 1
new file mode 100644
2 2
Binary files /dev/null and b/projects/pictures/cyr10x8.chr differ
... ...
@@ -20,7 +20,7 @@
20 20
 %SFL { #40 SFT SFT }
21 21
 %MOD { DUP2 DIV MUL SUB }
22 22
 
23
-%TOB { SWP POP }
23
+%TOB { SWP POP } %TOS { #00 SWP }
24 24
 
25 25
 %DEBUG  { .Console/byte DEO #0a .Console/char DEO }
26 26
 %DEBUG2 { .Console/short DEO2 #0a .Console/char DEO }
... ...
@@ -55,7 +55,13 @@
55 55
 
56 56
 |0000
57 57
 
58
-@settings [ &blending $1 &depth $1 &brush $1 &page $2 &tile $2 ]
58
+@settings [ 
59
+	&blending $1 
60
+	&depth $1 
61
+	&brush $1 
62
+	&page $2 
63
+	&tile $2 
64
+	&ratio $1 ]
59 65
 
60 66
 @frame [ &x1 $2 &y1 $2 &x2 $2 &y2 $2 &width $2 &height $2 ]
61 67
 
... ...
@@ -75,7 +81,6 @@
75 81
 
76 82
 @color $1 
77 83
 @i     $1
78
-@ratio $1
79 84
 
80 85
 ( program )
81 86
 
... ...
@@ -95,6 +100,7 @@
95 100
 	#0130 .frame/width POK2
96 101
 	#00a8 .frame/height POK2
97 102
 	#01 .settings/brush POK
103
+	#44 .settings/ratio POK
98 104
 
99 105
 	.Screen/width DEI2 #0001 SFT2 .frame/width PEK2 #0001 SFT2 SUB2
100 106
 	.Screen/height DEI2 #0001 SFT2 .frame/height PEK2 #0001 SFT2 SUB2 #0010 ADD2
... ...
@@ -326,7 +332,7 @@ BRK
326 332
 	( x ) .Mouse/x DEI2 .preview/x1 PEK2 SUB2 #0008 DIV2 TOB
327 333
 
328 334
 	#40 SFT ADD #11 ADD
329
-	DEBUG
335
+	.settings/ratio POK
330 336
 
331 337
 	( release ) #00 .Mouse/state DEO
332 338
 	;redraw JSR2
... ...
@@ -634,7 +640,7 @@ RTN
634 640
 RTN
635 641
 
636 642
 @draw-colorview ( -- )
637
-	
643
+
638 644
 	.colorview/y1 PEK2 #18 ADD .Screen/y DEO2
639 645
 	.colorview/x1 PEK2 #08 ADD .Screen/x DEO2
640 646
 	.System/r DEI2 ;draw-color-code JSR2
... ...
@@ -662,6 +668,39 @@ RTN
662 668
 @draw-preview ( -- )
663 669
 
664 670
 	.preview/x1 PEK2 #0002 SUB2 .preview/y1 PEK2 #0002 SUB2 .preview/x2 PEK2 #0001 ADD2 .preview/y2 PEK2 #0001 ADD2 #03 ;line-rect JSR2
671
+	( stash address )
672
+	.settings/tile PEK2 DUP2 STH2 .Screen/addr DEO2
673
+	#00 #04
674
+	&ver
675
+		OVR #08 MUL TOS .preview/y1 PEK2 ADD2 .Screen/y DEO2
676
+		#00 #04
677
+		&hor
678
+			OVR #08 MUL TOS .preview/x1 PEK2 ADD2 .Screen/x DEO2
679
+			( get x,y )
680
+			SWP2 OVR STH SWP2 OVR STHr
681
+			( check if within ratio )
682
+			.settings/ratio PEK #0f AND LTH STH
683
+			.settings/ratio PEK #04 SFT LTH STHr
684
+			#0101 NEQ2 ,&outside JNZ 
685
+				( get blending ) .settings/blending PEK
686
+				( get depth ) .settings/depth PEK #20 MUL
687
+				( draw ) #20 ADD ADD .Screen/color DEO
688
+				( incr ) STH2r #0008 ADD2 DUP2 STH2 .Screen/addr DEO2
689
+				,&resume JMP
690
+			&outside
691
+			;halftone_icn .Screen/addr DEO2
692
+			#23 .Screen/color DEO
693
+			&resume
694
+			( incr ) SWP #01 ADD SWP
695
+			DUP2 LTH ,&hor JNZ
696
+		POP2
697
+		( incr ) SWP #01 ADD SWP
698
+		DUP2 LTH ;&ver JNZ2
699
+	POP2
700
+	POP2r
701
+	.preview/x1 PEK2 #0001 SUB2 .Screen/x DEO2
702
+	.preview/y2 PEK2 #0001 ADD2 .Screen/y DEO2
703
+	.settings/ratio PEK #23 ;draw-byte JSR2
665 704
 
666 705
 RTN
667 706
 
... ...
@@ -752,17 +791,14 @@ RTN
752 791
 
753 792
 RTN
754 793
 
794
+@halftone_icn [
795
+	aa55 aa55 aa55 aa55 ]
755 796
 @circle_icns
756
-	[ 0038 7cfe fefe 7c38 ] ( full )
757
-	[ 0038 4482 8282 4438 ] ( line )
797
+	0038 7cfe fefe 7c38 ( full )
798
+	0038 4482 8282 4438 ( line )
758 799
 @eye_icns
759
-	[ 0038 4492 2810 0000 ] ( open )
760
-	[ 0000 0082 4438 0000 ] ( closed )
761
-@tool_selector [ 80c0 e0f0 f8e0 1000 ]
762
-@tool_hand     [ 2020 20b8 7c7c 3838 ]
763
-@tool_eraser   [ 2050 b87c 3e1c 0800 ]
764
-@moveup_icn    [ 0010 387c fe10 1000 ]
765
-@movedown_icn  [ 0010 1010 fe7c 3810 ]
800
+	0038 4492 2810 0000 ( open )
801
+	0000 0082 4438 0000 ( closed )
766 802
 @blank_icn     [
767 803
 	0000 0000 0000 0000
768 804
 	7cfe fefe fefe 7c00
... ...
@@ -771,8 +807,14 @@ RTN
771 807
 	00fe 8282 fe82 82fe
772 808
 	00fe 9292 fe92 92fe
773 809
 ]
810
+@tool_selector [ 80c0 e0f0 f8e0 1000 ]
811
+@tool_hand     [ 2020 20b8 7c7c 3838 ]
812
+@tool_eraser   [ 2050 b87c 3e1c 0800 ]
813
+@moveup_icn    [ 0010 387c fe10 1000 ]
814
+@movedown_icn  [ 0010 1010 fe7c 3810 ]
815
+
774 816
 @filepath1     [ "projects/fonts/specter8.bit 00 ]
775
-@filepath2     [ "projects/pictures/cibo.bit 00 ]
817
+@filepath2     [ "projects/pictures/cyr10x8.chr 00 ]
776 818
 @filepath3     [ "projects/pictures/zerotwo10x10.chr 00 ]
777 819
 @filepath4     [ "projects/fonts/katahira8.bit 00 ]
778 820
 @filepath5     [ "projects/pictures/ako10x10.chr 00 ]