Browse code

Removed duplicate function in ppu

neauoire authored on 11/04/2021 05:00:49
Showing 2 changed files
... ...
@@ -18,10 +18,10 @@
18 18
 
19 19
 ( program )
20 20
 
21
-|0200 @RESET
21
+|0200
22 22
 
23 23
 	( theme ) #03fd =System.r #0ef3 =System.g #0bf2 =System.b
24
-	( vectors ) ,FRAME =Screen.vector
24
+	( vectors ) ,on-screen =Screen.vector
25 25
 	#01 =fps.current
26 26
 
27 27
 	#000c
... ...
@@ -38,7 +38,7 @@
38 38
 	OVR2 OVR2 ~lines.x1 ,v JSR2
39 39
 	          ~lines.x2 ,v JSR2
40 40
 
41
-@FRAME
41
+@on-screen
42 42
 	,update-fps JSR2
43 43
 	#00 =neralie.color
44 44
 	,neralie-lines JSR2
... ...
@@ -63,36 +63,6 @@ drawchr(Ppu *p, Uint16 x, Uint16 y, Uint8 *sprite, Uint8 alpha)
63 63
 		}
64 64
 }
65 65
 
66
-void
67
-drawicn(Ppu *p, Uint16 x, Uint16 y, Uint8 *sprite, Uint8 fg, Uint8 bg)
68
-{
69
-	Uint8 v, h;
70
-	for(v = 0; v < 8; v++)
71
-		for(h = 0; h < 8; h++) {
72
-			Uint8 ch1 = (sprite[v] >> (7 - h)) & 0x1;
73
-			drawpixel(p, x + h, y + v, ch1 ? fg : bg);
74
-		}
75
-}
76
-
77
-void
78
-drawdebugger(Ppu *p, Uint8 *stack, Uint8 ptr)
79
-{
80
-	Uint8 i, x, y, b;
81
-	for(i = 0; i < 0x10; ++i) { /* memory */
82
-		x = ((i % 8) * 3 + 3) * 8, y = p->pad + 8 + i / 8 * 8, b = stack[i];
83
-		drawicn(p, x, y, font[(b >> 4) & 0xf], 1 + (ptr == i), 0);
84
-		drawicn(p, x + 8, y, font[b & 0xf], 1 + (ptr == i), 0);
85
-	}
86
-	for(x = 0; x < 32; ++x) {
87
-		drawpixel(p, x, p->height / 2, 2);
88
-		drawpixel(p, p->width - x, p->height / 2, 2);
89
-		drawpixel(p, p->width / 2, p->height - x, 2);
90
-		drawpixel(p, p->width / 2, x, 2);
91
-		drawpixel(p, p->width / 2 - 16 + x, p->height / 2, 2);
92
-		drawpixel(p, p->width / 2, p->height / 2 - 16 + x, 2);
93
-	}
94
-}
95
-
96 66
 void
97 67
 putpixel(Ppu *p, Uint8 *layer, Uint16 x, Uint16 y, Uint8 color)
98 68
 {
... ...
@@ -134,6 +104,25 @@ putchr(Ppu *p, Uint8 *layer, Uint16 x, Uint16 y, Uint8 *sprite, Uint8 color)
134 104
 		}
135 105
 }
136 106
 
107
+void
108
+drawdebugger(Ppu *p, Uint8 *stack, Uint8 ptr)
109
+{
110
+	Uint8 i, x, y, b;
111
+	for(i = 0; i < 0x20; ++i) { /* memory */
112
+		x = ((i % 8) * 3 + 1) * 8, y = (i / 8 + 1) * 8, b = stack[i];
113
+		puticn(p, p->bg, x, y, font[(b >> 4) & 0xf], 2);
114
+		puticn(p, p->bg, x + 8, y, font[b & 0xf], 2);
115
+	}
116
+	for(x = 0; x < 0x20; ++x) {
117
+		drawpixel(p, x, p->height / 2, 2);
118
+		drawpixel(p, p->width - x, p->height / 2, 2);
119
+		drawpixel(p, p->width / 2, p->height - x, 2);
120
+		drawpixel(p, p->width / 2, x, 2);
121
+		drawpixel(p, p->width / 2 - 16 + x, p->height / 2, 2);
122
+		drawpixel(p, p->width / 2, p->height / 2 - 16 + x, 2);
123
+	}
124
+}
125
+
137 126
 void
138 127
 getcolors(Ppu *p, Uint8 *addr)
139 128
 {