1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-11-27 12:18:07 +11:00

emul/sms: don't hardcode name table offset

Use reg 2 as specified.
This commit is contained in:
Virgil Dupras 2020-10-12 21:11:46 -04:00
parent 6b895d0745
commit 1681e61956
2 changed files with 3 additions and 2 deletions

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

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 )