Browse code

Always return current PPU size when Screen/width,height is read

Andrew Alderwick authored on 19/09/2021 21:53:45
Showing 1 changed files
... ...
@@ -343,8 +343,12 @@ console_talk(Device *d, Uint8 b0, Uint8 w)
343 343
 static int
344 344
 screen_talk(Device *d, Uint8 b0, Uint8 w)
345 345
 {
346
-	if(!w)
347
-		return 1;
346
+	if(!w) switch(b0) {
347
+		case 0x2: d->dat[0x2] = ppu.width >> 8; break;
348
+		case 0x3: d->dat[0x3] = ppu.width; break;
349
+		case 0x4: d->dat[0x4] = ppu.height >> 8; break;
350
+		case 0x5: d->dat[0x5] = ppu.height; break;
351
+		}
348 352
 	else
349 353
 		switch(b0) {
350 354
 		case 0x3:
... ...
@@ -583,10 +587,6 @@ main(int argc, char **argv)
583 587
 	/* unused   */ uxn_port(&u, 0xe, nil_talk);
584 588
 	/* unused   */ uxn_port(&u, 0xf, nil_talk);
585 589
 
586
-	/* Write screen size */
587
-	poke16(devscreen->dat, 2, ppu.width);
588
-	poke16(devscreen->dat, 4, ppu.height);
589
-
590 590
 	run(&u);
591 591
 	quit();
592 592
 	return 0;