~vdupras/collapseos

1681e619563bb92880a9bdd7a8bb5bc2f150f5e6 — Virgil Dupras a month ago 6b895d0
emul/sms: don't hardcode name table offset

Use reg 2 as specified.
2 files changed, 3 insertions(+), 2 deletions(-)

M emul/hw/sms/vdp.c
M recipes/sms/blk/605
M emul/hw/sms/vdp.c => emul/hw/sms/vdp.c +2 -1
@@ 61,7 61,8 @@ uint8_t vdp_pixel(VDP *vdp, uint16_t x, uint16_t y)
        return 0;
    }
    // name table offset
    uint16_t offset = 0x3800 + ((y/8) << 6) + ((x/8) << 1);
    uint16_t offset = (vdp->regs[2] & 0xe) << 10;
    offset += ((y/8) << 6) + ((x/8) << 1);
    uint16_t tableval = vdp->vram[offset] + (vdp->vram[offset+1] << 8);
    uint16_t tilenum = tableval & 0x1ff;
    // is palette select bit on? if yes, use sprite palette instead

M recipes/sms/blk/605 => recipes/sms/blk/605 +1 -1
@@ 1,7 1,7 @@
CREATE _idat
0b00000100 C, 0x80 C, ( Bit 2: Select mode 4 )
0b00000000 C, 0x81 C,
0b11111111 C, 0x82 C, ( Name table: 0x3800 )
0b00001110 C, 0x82 C, ( Name table: 0x3800 )
0b11111111 C, 0x85 C, ( Sprite table: 0x3f00 )
0b11111111 C, 0x86 C, ( sprite use tiles from 0x2000 )
0b11111111 C, 0x87 C, ( Border uses palette 0xf )