Browse code

(picture.tal) Optimization

Devine Lu Linvega authored on 27/02/2023 19:21:03
Showing 1 changed files
... ...
@@ -1,70 +1,66 @@
1 1
 ( GUI Picture )
2 2
 
3
-|00 @System     &vector $2 &wst      $1 &rst    $1 &eaddr  $2 &ecode  $1 &pad     $1 &r       $2 &g      $2 &b     $2 &debug  $1 &halt $1
4
-|20 @Screen     &vector $2 &width    $2 &height $2 &auto   $1 &pad    $1 &x       $2 &y       $2 &addr   $2 &pixel $1 &sprite $1
5
-
6
-( variables )
7
-
8
-|0000
9
-
10
-( program )
3
+|00 @System &vector $2 &wst $1 &rst $1 &eaddr $2 &ecode $1 &pad $1 &r $2 &g $2 &b $2 &debug $1 &halt $1
4
+|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1
11 5
 
12 6
 |0100
13
-	
14
-	( theme ) 
15
-	#f0f7 .System/r DEO2 
16
-	#f00e .System/g DEO2 
7
+
8
+	( theme )
9
+	#f0f7 .System/r DEO2
10
+	#f00e .System/g DEO2
17 11
 	#f00c .System/b DEO2
18 12
 
19
-	#0030 .Screen/x DEO2
20
-	#0030 .Screen/y DEO2
21
-	;picture-icn #20 #10 #01 ;draw-icn JSR2
13
+	#0010
14
+		DUP2 .Screen/x DEO2
15
+		.Screen/y DEO2
16
+	;akane20x10 #20 #10 #01 draw-icn
22 17
 
23 18
 	#0100 .Screen/x DEO2
24
-	#0090 .Screen/y DEO2
25
-	#10 #10 ;dafu10x10 #0a ;draw-small JSR2
19
+	#0028 .Screen/y DEO2
20
+	#1010 ;dafu10x10 #0a draw-fast
26 21
 
27 22
 BRK
28 23
 
29 24
 @draw-icn ( addr* width height color -- )
30 25
 
31 26
 	#05 .Screen/auto DEO
32
-	STH 
33
-	( set bounds ) ,&height STR ,&width STR .Screen/addr DEO2
34
-	( set origin ) .Screen/x DEI2 ,&x STR2
35
-	LIT &height $1 #00
27
+	,&color STR
28
+	,&height STR
29
+	,&width STR
30
+	.Screen/addr DEO2
31
+	.Screen/x DEI2
32
+	,&x STR2
33
+	[ LIT2 00 &height $1 ] SUB
36 34
 	&ver
37
-		LIT2 &x $2 .Screen/x DEO2
38
-		LIT &width $1 #00
35
+		[ LIT2 &x $2 ] .Screen/x DEO2
36
+		[ LIT2 00 &width $1 ] SUB
39 37
 		&hor
40
-			STHkr .Screen/sprite DEO
41
-			INC GTHk ,&hor JCN
42
-		POP2
38
+			[ LIT &color $1 ] .Screen/sprite DEO
39
+			INC DUP ?&hor
40
+		POP
43 41
 		.Screen/y DEI2k #0008 ADD2 ROT DEO2
44
-		INC GTHk ,&ver JCN
45
-	POP2
46
-	POPr
42
+		INC DUP ?&ver
43
+	POP
47 44
 	#00 .Screen/auto DEO
48 45
 
49 46
 JMP2r
50 47
 
51 48
 ( makes use of the auto byte )
52 49
 
53
-@draw-small ( w h addr* color -- )
50
+@draw-fast ( w h addr* color -- )
54 51
 
55
-	STH
52
+	,&color STR
56 53
 	.Screen/addr DEO2
57
-	SWP #01 SUB #40 SFT #06 ADD .Screen/auto DEO
58
-	#00
54
+	SWP #01 SUB #40 SFT #06 ORA .Screen/auto DEO
55
+	#00 SWP SUB
59 56
 	&loop
60
-		STHkr .Screen/sprite DEO
61
-		INC GTHk ,&loop JCN
62
-	POP2
63
-	POPr
57
+		[ LIT2 &color $1 -Screen/sprite ] DEO
58
+		INC DUP ?&loop
59
+	POP
64 60
 
65 61
 JMP2r
66 62
 
67
-@picture-icn ( akane2010.bit 20 x 10 )
63
+@akane20x10
68 64
 	0000 0000 0000 0000 2b41 2341 2b41 2341
69 65
 	8881 8081 8880 8080 0a00 2000 8800 2000
70 66
 	8004 2004 8804 2a04 0000 0000 8000 0000