Regarding the following from Anomie's regs.txt (same info exists in fullsnes.txt):
2) Assuming that 'Reg' refers to the current BGnHOFS register value that is being written to (although this isn't stated anywhere), the '((Reg>>8)&7)' part doesn't make any sense. The registers are only 10-bit. So if you right-shift by 8 then you only have 2 bits left. So doing a mask of the lower 3 bits (i.e. '&7') doesn't make any sense. Are you just supposed to set the upper bit to 0?
Some notes:
- 'Current' is the 8-bit value that's being written *right now* to the PPU by the CPU.
- 'Prev' is an 8-bit latch value storing the last 8-bit value written to any of these registers.
- Assuming that 'Reg' is the current value stored in the 10-bit BGnHOFS register. Not sure why he doesn't just use BGnHOFS instead of creating a new undefined term of 'Reg'.....??
Thanks!
Code:
210f ww+++- BG2HOFS - BG2 Horizontal Scroll
2110 ww+++- BG2VOFS - BG2 Vertical Scroll
2111 ww+++- BG3HOFS - BG3 Horizontal Scroll
2112 ww+++- BG3VOFS - BG3 Vertical Scroll
2113 ww+++- BG4HOFS - BG4 Horizontal Scroll
2114 ww+++- BG4VOFS - BG4 Vertical Scroll
------xx xxxxxxxx
Note that these are "write twice" registers, first the low byte is
written then the high. Current theory is that writes to the register
work like this:
BGnHOFS = (Current<<8) | (Prev&~7) | ((Reg>>8)&7);
Prev = Current;
or
BGnVOFS = (Current<<8) | Prev;
Prev = Current;
1) Can anyone explain to me that insane horizontal offset assignment? Why does it do this?? The vertical offset assignment makes perfect sense to me but what's up with the horizontal?2110 ww+++- BG2VOFS - BG2 Vertical Scroll
2111 ww+++- BG3HOFS - BG3 Horizontal Scroll
2112 ww+++- BG3VOFS - BG3 Vertical Scroll
2113 ww+++- BG4HOFS - BG4 Horizontal Scroll
2114 ww+++- BG4VOFS - BG4 Vertical Scroll
------xx xxxxxxxx
Note that these are "write twice" registers, first the low byte is
written then the high. Current theory is that writes to the register
work like this:
BGnHOFS = (Current<<8) | (Prev&~7) | ((Reg>>8)&7);
Prev = Current;
or
BGnVOFS = (Current<<8) | Prev;
Prev = Current;
2) Assuming that 'Reg' refers to the current BGnHOFS register value that is being written to (although this isn't stated anywhere), the '((Reg>>8)&7)' part doesn't make any sense. The registers are only 10-bit. So if you right-shift by 8 then you only have 2 bits left. So doing a mask of the lower 3 bits (i.e. '&7') doesn't make any sense. Are you just supposed to set the upper bit to 0?
Some notes:
- 'Current' is the 8-bit value that's being written *right now* to the PPU by the CPU.
- 'Prev' is an 8-bit latch value storing the last 8-bit value written to any of these registers.
- Assuming that 'Reg' is the current value stored in the 10-bit BGnHOFS register. Not sure why he doesn't just use BGnHOFS instead of creating a new undefined term of 'Reg'.....??
Thanks!