Browse code

Ported devw/devr changes to uxn.c

neauoire authored on 09/09/2021 00:51:23
Showing 5 changed files
... ...
@@ -33,6 +33,7 @@
33 33
 
34 34
 |00 @System     [ &vector $2 &wst      $1 &rst    $1 &pad   $4 &r      $2 &g     $2 &b      $2 ]
35 35
 |20 @Screen     [ &vector $2 &width    $2 &height $2 &pad   $2 &x      $2 &y      $2 &addr  $2 &pixel $1 &sprite $1 ]
36
+|30 @Audio0     [ &vector $2 &position $2 &output $1 &pad   $3 &adsr   $2 &length $2 &addr $2 &volume $1 &pitch $1 ]
36 37
 |80 @Controller [ &vector $2 &button   $1 &key    $1 ]
37 38
 |90 @Mouse      [ &vector $2 &x        $2 &y      $2 &state $1 &wheel $1 ]
38 39
 
... ...
@@ -87,7 +88,7 @@ BRK
87 88
 	BANK2 STH2k GET-SIZE ++ STH2r
88 89
 	&clear-loop
89 90
 		DUP2 #0000 SWP2 STA2
90
-		#0002 ++ GTH2k ,&clear-loop JCN
91
+		INC2 INC2 GTH2k ,&clear-loop JCN
91 92
 	POP2 POP2
92 93
 
93 94
 	( run grid )
... ...
@@ -112,8 +113,7 @@ BRK
112 113
 	&copy-loop
113 114
 		DUP2 LDA2k
114 115
 		SWP2 #2000 -- STA2
115
-		#0002 ++ 
116
-		GTH2k ,&copy-loop JCN
116
+		INC2 INC2 GTH2k ,&copy-loop JCN
117 117
 	POP2 POP2
118 118
 
119 119
 	;draw-grid JSR2
... ...
@@ -99,9 +99,9 @@ BRK
99 99
 	&loop
100 100
 		.adsr-view/x2 LDZ2 #003a -- .Screen/x DEO2
101 101
 		#10 OVR - .Audio0/output DEI #0f AND < .Screen/pixel DEO
102
-		.adsr-view/x2 LDZ2 #003a -- #0002 ++ .Screen/x DEO2
102
+		.adsr-view/x2 LDZ2 #003a -- INC2 INC2 .Screen/x DEO2
103 103
 		#10 OVR - .Audio0/output DEI #04 SFT < .Screen/pixel DEO
104
-		.Screen/y DEI2 #0002 ++ .Screen/y DEO2
104
+		.Screen/y DEI2 INC2 INC2 .Screen/y DEO2
105 105
 		INC GTHk ,&loop JCN
106 106
 	POP2
107 107
 
... ...
@@ -26,7 +26,7 @@ static Uint16 (*pop8)(Stack *s);
26 26
 static Uint16 (*pop)(Stack *s);
27 27
 static void   (*poke)(Uint8 *m, Uint16 a, Uint16 b);
28 28
 static Uint16 (*peek)(Uint8 *m, Uint16 a);
29
-static void   (*devw)(Device *d, Uint8 a, Uint16 b);
29
+static int    (*devw)(Device *d, Uint8 a, Uint16 b);
30 30
 static Uint16 (*devr)(Device *d, Uint8 a);
31 31
 static void   (*warp)(Uxn *u, Uint16 a);
32 32
 static void   (*pull)(Uxn *u);
... ...
@@ -63,7 +63,7 @@ system_talk(Device *d, Uint8 b0, Uint8 w)
63 63
 		case 0xf: return 0;
64 64
 		}
65 65
 	}
66
-    return 1;
66
+	return 1;
67 67
 }
68 68
 
69 69
 static int
... ...
@@ -71,7 +71,7 @@ console_talk(Device *d, Uint8 b0, Uint8 w)
71 71
 {
72 72
 	if(w && b0 > 0x7)
73 73
 		write(b0 - 0x7, (char *)&d->dat[b0], 1);
74
-    return 1;
74
+	return 1;
75 75
 }
76 76
 
77 77
 static int
... ...
@@ -91,7 +91,7 @@ file_talk(Device *d, Uint8 b0, Uint8 w)
91 91
 		}
92 92
 		poke16(d->dat, 0x2, result);
93 93
 	}
94
-    return 1;
94
+	return 1;
95 95
 }
96 96
 
97 97
 static int
... ...
@@ -111,7 +111,7 @@ datetime_talk(Device *d, Uint8 b0, Uint8 w)
111 111
 	d->dat[0xa] = t->tm_isdst;
112 112
 	(void)b0;
113 113
 	(void)w;
114
-    return 1;
114
+	return 1;
115 115
 }
116 116
 
117 117
 static int
... ...
@@ -120,7 +120,7 @@ nil_talk(Device *d, Uint8 b0, Uint8 w)
120 120
 	(void)d;
121 121
 	(void)b0;
122 122
 	(void)w;
123
-    return 1;
123
+	return 1;
124 124
 }
125 125
 
126 126
 #pragma mark - Generics
... ...
@@ -306,7 +306,7 @@ system_talk(Device *d, Uint8 b0, Uint8 w)
306 306
 		if(b0 > 0x7 && b0 < 0xe)
307 307
 			docolors(d);
308 308
 	}
309
-    return 1;
309
+	return 1;
310 310
 }
311 311
 
312 312
 static int
... ...
@@ -314,7 +314,7 @@ console_talk(Device *d, Uint8 b0, Uint8 w)
314 314
 {
315 315
 	if(w && b0 > 0x7)
316 316
 		write(b0 - 0x7, (char *)&d->dat[b0], 1);
317
-    return 1;
317
+	return 1;
318 318
 }
319 319
 
320 320
 static int
... ...
@@ -337,7 +337,7 @@ screen_talk(Device *d, Uint8 b0, Uint8 w)
337 337
 			ppu_1bpp(&ppu, layer, x, y, addr, d->dat[0xf] & 0xf, d->dat[0xf] >> 0x4 & 0x1, d->dat[0xf] >> 0x5 & 0x1);
338 338
 		reqdraw = 1;
339 339
 	}
340
-    return 1;
340
+	return 1;
341 341
 }
342 342
 
343 343
 static int
... ...
@@ -359,7 +359,7 @@ file_talk(Device *d, Uint8 b0, Uint8 w)
359 359
 		}
360 360
 		poke16(d->dat, 0x2, result);
361 361
 	}
362
-    return 1;
362
+	return 1;
363 363
 }
364 364
 
365 365
 static int
... ...
@@ -383,7 +383,7 @@ audio_talk(Device *d, Uint8 b0, Uint8 w)
383 383
 		SDL_UnlockAudioDevice(audio_id);
384 384
 		SDL_PauseAudioDevice(audio_id, 0);
385 385
 	}
386
-    return 1;
386
+	return 1;
387 387
 }
388 388
 
389 389
 static int
... ...
@@ -403,7 +403,7 @@ datetime_talk(Device *d, Uint8 b0, Uint8 w)
403 403
 	d->dat[0xa] = t->tm_isdst;
404 404
 	(void)b0;
405 405
 	(void)w;
406
-    return 1;
406
+	return 1;
407 407
 }
408 408
 
409 409
 static int
... ...
@@ -412,7 +412,7 @@ nil_talk(Device *d, Uint8 b0, Uint8 w)
412 412
 	(void)d;
413 413
 	(void)b0;
414 414
 	(void)w;
415
-    return 1;
415
+	return 1;
416 416
 }
417 417
 
418 418
 #pragma mark - Generics