Yep +1 vote from me for this info as well please. I'm as thick as a plank me is
Just a little head-scratcher
- Ast A. Moore
- Rick Dangerous
- Posts: 2641
- Joined: Mon Nov 13, 2017 3:16 pm
Re: Just a little head-scratcher
Just a note that each 8x8 cell still contains no more that one INK and one PAPER color at any one time; so no ULA timing tomfoolery here.
It’s kind of easier to draw on a piece of paper than to put into writing, but I’ll try.
Imagine the following pattern:
Code: Select all
xxxxxxxo|ooooooox|xxxxxxxo| . . .
Now, let’s shift the whole thing one pixel to the left:
Code: Select all
xxxxxxoo|ooooooxx|xxxxxxoo| . . .
Code: Select all
BLUE/YELLOW|YELLOW/MAGENTA|MAGENTA/RED| . . .
Code: Select all
BBBBBBYY|YYYYYYMM|MMMMMMRR| . . .
Once we’ve shifted our pixel pattern eight times, we need to shift our attributes one cell to the left, and start shifting the pixels again.
The vertical shifting is done in a similar manner.
Hope this clears things up a bit.
Every man should plant a tree, build a house, and write a ZX Spectrum game.
Author of A Yankee in Iraq, a 50 fps shoot-’em-up—the first game to utilize the floating bus on the +2A/+3,
and zasm Z80 Assembler syntax highlighter.
Author of A Yankee in Iraq, a 50 fps shoot-’em-up—the first game to utilize the floating bus on the +2A/+3,
and zasm Z80 Assembler syntax highlighter.
Re: Just a little head-scratcher
Yes, thanks! Kind of obvious when you put it like that, but I wouldn't have worked it out from looking at the code.
Derek Fountain, author of the ZX Spectrum C Programmer's Getting Started Guide and various open source games, hardware and other projects, including an IF1 and ZX Microdrive emulator.
Re: Just a little head-scratcher
Each character cell starts off empty of pixels so it's showing its PAPER colour. What you can't see (because it's empty) is that the INK of that square is set to the colour of its neighbour.
So then you start filling in pixels on the right-hand-side of that character cell, and it looks like it's neighbouring character square is moving into it one pixel at a time.
As I say, knowing this you can paint a big 'PlaySchool' style (child's drawing) house and road using only PAPER attributes, then make the whole thing pixel-scroll to the left.
So then you start filling in pixels on the right-hand-side of that character cell, and it looks like it's neighbouring character square is moving into it one pixel at a time.
As I say, knowing this you can paint a big 'PlaySchool' style (child's drawing) house and road using only PAPER attributes, then make the whole thing pixel-scroll to the left.
Re: Just a little head-scratcher
If you start the code from 32771 instead of 32768 (or zero out the first three bytes) you'll remove the Call to the routine that initially draws the attributes, then you can see the raw pixel data being redrawn behind the scenes every loop.
"He made eloquent speeches to an audience consisting of a few depressed daffodil roots, and sometimes the cat from next door."