tomaz / zx-next-dev-guide

Guide for ZX Spectrum Next assembler developer. Available as free to download PDF from releases page, or printed coil bound book at https://bit.ly/zx-next-assembler-dev-guide

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

confusing wording to me

ped7g opened this issue · comments

Also similar to 320x256 mode, we can't represent full extent of columns with 2 bytes. However, we can still represent all pixels within each individual bank. If upper byte is used for X and lower for Y, then most significant 2 bits correspond to 16K and top 3 bits to 8K bank. The rest of the X + Y is memory location within the bank.

we can't represent full extent of columns with 2 bytes

If that means you can't address all pixels with 16bit register like HL or DE, I would probably go with

we can't address all pixels with 16 bit address

But I'm not sure if I did understand that paragraph correctly.

commented

I updated 320x256 and 640x256 addressing mode descriptions as both are confusing in retrospect - @ped7g how does this sound to you?

320x256:

Addressing is more complicated though. As we need 9 bits for X and 8 for Y, we can't address all screen pixels with single 16-bit register pair. However we can use 16-bit register pair to address all pixels within each individual bank. From this perspective, the setup is similar to 256$\times$192 mode, except that X and Y are reversed: if upper byte is used for X and lower for Y, then most significant 2 bits of 16-bit register pair represent lower 2 bits of 16K bank number. And for 8K banks, most significant 3 bits correspond to lower 3 bits of 8K bank number. In either case, most significant bit of bank number arrives from 9th bit of the X coordinate ($X_8$ in table above). The rest of the X + Y is memory location within the bank.

640x256:

Addressing wise, this mode is the same as 230$\times$256. Using 16-bit register pair we can't address all pixels on screen, but we can address all pixels within each individual bank. Again, assuming upper byte of 16-bit register pair is used for X and lower for Y and using 9th bit of X coordinate (bit $X_8$ in table above) as most significant bit of bank number, then most significant 2 bits of 16-bit register pair represent lower 2 bits of 16K bank number. And for 8K banks, most significant 3 bits correspond to lower 3 bits of 8K bank number. The rest of the X + Y is memory location within the bank. Don't forget: each colour byte represents 2 screen pixels, so memory X coordinate (as described above) needs to be multiplied by 2 to convert to screen X coordinate. Don't forget: each colour byte represents 2 screen pixels, so memory X coordinate (as described above) needs to be multiplied by 2 to convert to screen X coordinate.

Also updated both addressing tables to make it clear 9th bit is needed for X. Screenshots for full text for both modes:

image

image

Looks good to me. 👍