...
|
...
|
@@ -303,8 +303,7 @@ system_talk(Device *d, Uint8 b0, Uint8 w)
|
303
|
303
|
case 0x3: d->u->rst.ptr = d->dat[0x3]; break;
|
304
|
304
|
case 0xf: return 0;
|
305
|
305
|
}
|
306
|
|
- if(b0 > 0x7 && b0 < 0xe)
|
307
|
|
- docolors(d);
|
|
306
|
+ if(b0 > 0x7 && b0 < 0xe) docolors(d);
|
308
|
307
|
}
|
309
|
308
|
return 1;
|
310
|
309
|
}
|
...
|
...
|
@@ -331,10 +330,16 @@ screen_talk(Device *d, Uint8 b0, Uint8 w)
|
331
|
330
|
Uint16 y = peek16(d->dat, 0xa);
|
332
|
331
|
Uint8 layer = d->dat[0xf] >> 0x6 & 0x1;
|
333
|
332
|
Uint8 *addr = &d->mem[peek16(d->dat, 0xc)];
|
334
|
|
- if(d->dat[0xf] >> 0x7 & 0x1)
|
|
333
|
+ /* Sprite byte */
|
|
334
|
+ if(d->dat[0xf] >> 0x7 & 0x6)
|
335
|
335
|
ppu_2bpp(&ppu, layer, x, y, addr, d->dat[0xf] & 0xf, d->dat[0xf] >> 0x4 & 0x1, d->dat[0xf] >> 0x5 & 0x1);
|
336
|
336
|
else
|
337
|
337
|
ppu_1bpp(&ppu, layer, x, y, addr, d->dat[0xf] & 0xf, d->dat[0xf] >> 0x4 & 0x1, d->dat[0xf] >> 0x5 & 0x1);
|
|
338
|
+ /* Auto byte */
|
|
339
|
+ if(d->dat[0x6] & 0x1) poke16(d->dat, 0x8, x + 8);
|
|
340
|
+ if(d->dat[0x6] & 0x2) poke16(d->dat, 0xa, y + 8);
|
|
341
|
+ if(d->dat[0x6] & 0x3) poke16(d->dat, 0xc, peek16(d->dat, 0xc) + 8);
|
|
342
|
+ if(d->dat[0x6] & 0x4) poke16(d->dat, 0xc, peek16(d->dat, 0xc) + 16);
|
338
|
343
|
reqdraw = 1;
|
339
|
344
|
}
|
340
|
345
|
return 1;
|
...
|
...
|
@@ -506,8 +511,7 @@ static int
|
506
|
511
|
load(Uxn *u, char *filepath)
|
507
|
512
|
{
|
508
|
513
|
FILE *f;
|
509
|
|
- if(!(f = fopen(filepath, "rb")))
|
510
|
|
- return 0;
|
|
514
|
+ if(!(f = fopen(filepath, "rb"))) return 0;
|
511
|
515
|
fread(u->ram.dat + PAGE_PROGRAM, sizeof(u->ram.dat) - PAGE_PROGRAM, 1, f);
|
512
|
516
|
fprintf(stderr, "Loaded %s\n", filepath);
|
513
|
517
|
return 1;
|
...
|
...
|
@@ -522,14 +526,10 @@ main(int argc, char **argv)
|
522
|
526
|
audio0_event = SDL_RegisterEvents(POLYPHONY);
|
523
|
527
|
SDL_CreateThread(stdin_handler, "stdin", NULL);
|
524
|
528
|
|
525
|
|
- if(argc < 2)
|
526
|
|
- return error("usage", "uxnemu file.rom");
|
527
|
|
- if(!uxn_boot(&u))
|
528
|
|
- return error("Boot", "Failed to start uxn.");
|
529
|
|
- if(!load(&u, argv[1]))
|
530
|
|
- return error("Load", "Failed to open rom.");
|
531
|
|
- if(!init())
|
532
|
|
- return error("Init", "Failed to initialize emulator.");
|
|
529
|
+ if(argc < 2) return error("usage", "uxnemu file.rom");
|
|
530
|
+ if(!uxn_boot(&u)) return error("Boot", "Failed to start uxn.");
|
|
531
|
+ if(!load(&u, argv[1])) return error("Load", "Failed to open rom.");
|
|
532
|
+ if(!init()) return error("Init", "Failed to initialize emulator.");
|
533
|
533
|
|
534
|
534
|
/* system */ devsystem = uxn_port(&u, 0x0, system_talk);
|
535
|
535
|
/* console */ devconsole = uxn_port(&u, 0x1, console_talk);
|