From 574aca9c0d34348f8d8543bcd6533ed8df330061 Mon Sep 17 00:00:00 2001 From: Bad Diode Date: Wed, 10 Nov 2021 09:37:40 +0100 Subject: Add screen auto vector --- roms/audio.rom | Bin 435 -> 959 bytes roms/automata.rom | Bin 255 -> 243 bytes roms/bifurcan.rom | Bin 583 -> 634 bytes roms/controller.rom | Bin 958 -> 958 bytes roms/dvd.rom | Bin 307 -> 307 bytes roms/file.load.rom | Bin 1233 -> 1230 bytes roms/file.save.rom | Bin 108 -> 108 bytes roms/hover.rom | Bin 502 -> 493 bytes roms/label.rom | Bin 1439 -> 1434 bytes roms/multichannel.audio.rom | Bin 1228 -> 1228 bytes roms/noodle.rom | Bin 0 -> 7274 bytes roms/polycat.rom | Bin 793 -> 793 bytes roms/proportional_fonts.rom | Bin 1333 -> 1330 bytes roms/screen.rom | Bin 785 -> 785 bytes roms/shapes.rom | Bin 1055 -> 1147 bytes roms/theme.rom | Bin 3224 -> 3152 bytes roms/wallpaper.rom | Bin 190 -> 181 bytes src/main.c | 79 +++++++++++++++++++++++++++----------------- src/uxn.h | 1 + 19 files changed, 50 insertions(+), 30 deletions(-) create mode 100644 roms/noodle.rom diff --git a/roms/audio.rom b/roms/audio.rom index 614c817..15c8f2d 100644 Binary files a/roms/audio.rom and b/roms/audio.rom differ diff --git a/roms/automata.rom b/roms/automata.rom index ec6dfb9..9c0b3f7 100644 Binary files a/roms/automata.rom and b/roms/automata.rom differ diff --git a/roms/bifurcan.rom b/roms/bifurcan.rom index 284e22a..92e613f 100644 Binary files a/roms/bifurcan.rom and b/roms/bifurcan.rom differ diff --git a/roms/controller.rom b/roms/controller.rom index 3e786fb..eb672b3 100644 Binary files a/roms/controller.rom and b/roms/controller.rom differ diff --git a/roms/dvd.rom b/roms/dvd.rom index 7ddabe9..9d47e7d 100644 Binary files a/roms/dvd.rom and b/roms/dvd.rom differ diff --git a/roms/file.load.rom b/roms/file.load.rom index e99bae3..1f486ee 100644 Binary files a/roms/file.load.rom and b/roms/file.load.rom differ diff --git a/roms/file.save.rom b/roms/file.save.rom index 8680264..6d8debb 100644 Binary files a/roms/file.save.rom and b/roms/file.save.rom differ diff --git a/roms/hover.rom b/roms/hover.rom index 9ad97a1..3c59f52 100644 Binary files a/roms/hover.rom and b/roms/hover.rom differ diff --git a/roms/label.rom b/roms/label.rom index c8fe6b8..fc5fd9c 100644 Binary files a/roms/label.rom and b/roms/label.rom differ diff --git a/roms/multichannel.audio.rom b/roms/multichannel.audio.rom index dc1d708..e737701 100644 Binary files a/roms/multichannel.audio.rom and b/roms/multichannel.audio.rom differ diff --git a/roms/noodle.rom b/roms/noodle.rom new file mode 100644 index 0000000..4776074 Binary files /dev/null and b/roms/noodle.rom differ diff --git a/roms/polycat.rom b/roms/polycat.rom index a8c3a22..cc9df69 100644 Binary files a/roms/polycat.rom and b/roms/polycat.rom differ diff --git a/roms/proportional_fonts.rom b/roms/proportional_fonts.rom index 2208d35..ff8291b 100644 Binary files a/roms/proportional_fonts.rom and b/roms/proportional_fonts.rom differ diff --git a/roms/screen.rom b/roms/screen.rom index de04425..ced1f64 100644 Binary files a/roms/screen.rom and b/roms/screen.rom differ diff --git a/roms/shapes.rom b/roms/shapes.rom index 0aeabac..9e6acfb 100644 Binary files a/roms/shapes.rom and b/roms/shapes.rom differ diff --git a/roms/theme.rom b/roms/theme.rom index b3eb1ef..58d0e41 100644 Binary files a/roms/theme.rom and b/roms/theme.rom differ diff --git a/roms/wallpaper.rom b/roms/wallpaper.rom index 81a55f0..114f465 100644 Binary files a/roms/wallpaper.rom and b/roms/wallpaper.rom differ diff --git a/src/main.c b/src/main.c index c15a9e3..60be453 100644 --- a/src/main.c +++ b/src/main.c @@ -129,36 +129,55 @@ system_talk(Device *d, u8 b0, u8 w) { IWRAM_CODE void screen_talk(Device *d, u8 b0, u8 w) { - if(w && b0 == 0xe) { - u16 x = mempeek16(d->dat, 0x8); - u16 y = mempeek16(d->dat, 0xa); - u8 *addr = &d->mem[mempeek16(d->dat, 0xc)]; - u8 *layer = d->dat[0xe] >> 4 & 0x1 ? ppu.fg : ppu.bg; - u8 mode = d->dat[0xe] >> 5; - u8 color = d->dat[0xf] & 0xf; - if(!mode) { - ppu_pixel(layer, x, y, d->dat[0xe] & 0x3); - } else if(mode-- & 0x1) { - u8 flipx = mode & 0x2; - u8 flipy = mode & 0x4; - ppu_1bpp(layer, x, y, addr, color, flipx, flipy); - } else { - u8 flipx = mode & 0x2; - u8 flipy = mode & 0x4; - ppu_2bpp(layer, x, y, addr, color, flipx, flipy); - } - } else if(w && b0 == 0xf) { - u16 x = mempeek16(d->dat, 0x8); - u16 y = mempeek16(d->dat, 0xa); - u8 *addr = &d->mem[mempeek16(d->dat, 0xc)]; - u8 *layer = d->dat[0xf] >> 6 & 0x1 ? ppu.fg : ppu.bg; - u8 color = d->dat[0xf] & 0xf; - u8 flipx = (d->dat[0xf] >> 0x4) & 0x1; - u8 flipy = (d->dat[0xf] >> 0x5) & 0x1; - if(d->dat[0xf] >> 0x7 & 0x1) { - ppu_2bpp(layer, x, y, addr, color, flipx, flipy); - } else { - ppu_1bpp(layer, x, y, addr, color, flipx, flipy); + if (w) { + switch (b0) { + case 0x1: { + d->vector = mempeek16(d->dat, 0x0); + } break; + case 0xe: { + u16 x = mempeek16(d->dat, 0x8); + u16 y = mempeek16(d->dat, 0xa); + u8 *addr = &d->mem[mempeek16(d->dat, 0xc)]; + u8 *layer = d->dat[0xe] >> 4 & 0x1 ? ppu.fg : ppu.bg; + u8 mode = d->dat[0xe] >> 5; + u8 color = d->dat[0xf] & 0xf; + if(!mode) { + ppu_pixel(layer, x, y, d->dat[0xe] & 0x3); + } else if(mode-- & 0x1) { + u8 flipx = mode & 0x2; + u8 flipy = mode & 0x4; + ppu_1bpp(layer, x, y, addr, color, flipx, flipy); + } else { + u8 flipx = mode & 0x2; + u8 flipy = mode & 0x4; + ppu_2bpp(layer, x, y, addr, color, flipx, flipy); + } + if(d->dat[0x6] & 0x01) { mempoke16(d->dat, 0x8, x + 1); } + if(d->dat[0x6] & 0x02) { mempoke16(d->dat, 0xa, y + 1); } + } break; + case 0xf: { + u16 x = mempeek16(d->dat, 0x8); + u16 y = mempeek16(d->dat, 0xa); + u8 *addr = &d->mem[mempeek16(d->dat, 0xc)]; + u8 *layer = d->dat[0xf] >> 6 & 0x1 ? ppu.fg : ppu.bg; + u8 color = d->dat[0xf] & 0xf; + u8 flipx = (d->dat[0xf] >> 0x4) & 0x1; + u8 flipy = (d->dat[0xf] >> 0x5) & 0x1; + if(d->dat[0xf] >> 0x7 & 0x1) { + ppu_2bpp(layer, x, y, addr, color, flipx, flipy); + if(d->dat[0x6] & 0x04) { + mempoke16(d->dat, 0xc, mempeek16(d->dat, 0xc) + 16); + } + } else { + ppu_1bpp(layer, x, y, addr, color, flipx, flipy); + if(d->dat[0x6] & 0x04) { + mempoke16(d->dat, 0xc, mempeek16(d->dat, 0xc) + 8); + } + } + if(d->dat[0x6] & 0x01) { mempoke16(d->dat, 0x8, x + 8); } + if(d->dat[0x6] & 0x02) { mempoke16(d->dat, 0xa, y + 8); } + } break; + default: break; } } } diff --git a/src/uxn.h b/src/uxn.h index bd9379c..6f01405 100644 --- a/src/uxn.h +++ b/src/uxn.h @@ -29,6 +29,7 @@ typedef struct { typedef struct Device { struct Uxn *u; u8 addr, dat[16], *mem; + u16 vector; void (*talk)(struct Device *d, u8, u8); } Device; -- cgit v1.2.1