Browse Source

emul/sms: don't hardcode name table offset

Use reg 2 as specified.
master
Virgil Dupras 3 years ago
parent
commit
1681e61956
2 changed files with 3 additions and 2 deletions
  1. +2
    -1
      emul/hw/sms/vdp.c
  2. +1
    -1
      recipes/sms/blk/605

+ 2
- 1
emul/hw/sms/vdp.c View File

@@ -61,7 +61,8 @@ uint8_t vdp_pixel(VDP *vdp, uint16_t x, uint16_t y)
return 0; return 0;
} }
// name table offset // 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 tableval = vdp->vram[offset] + (vdp->vram[offset+1] << 8);
uint16_t tilenum = tableval & 0x1ff; uint16_t tilenum = tableval & 0x1ff;
// is palette select bit on? if yes, use sprite palette instead // is palette select bit on? if yes, use sprite palette instead


+ 1
- 1
recipes/sms/blk/605 View File

@@ -1,7 +1,7 @@
CREATE _idat CREATE _idat
0b00000100 C, 0x80 C, ( Bit 2: Select mode 4 ) 0b00000100 C, 0x80 C, ( Bit 2: Select mode 4 )
0b00000000 C, 0x81 C, 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, 0x85 C, ( Sprite table: 0x3f00 )
0b11111111 C, 0x86 C, ( sprite use tiles from 0x2000 ) 0b11111111 C, 0x86 C, ( sprite use tiles from 0x2000 )
0b11111111 C, 0x87 C, ( Border uses palette 0xf ) 0b11111111 C, 0x87 C, ( Border uses palette 0xf )


Loading…
Cancel
Save