Just a little head-scratcher

Show us what you're working on, (preferably with screenshots).
stupidget
Microbot
Posts: 173
Joined: Wed Jan 24, 2018 2:09 pm

Re: Just a little head-scratcher

Post by stupidget » Thu Jan 10, 2019 3:07 pm

dfzx wrote:
Thu Jan 10, 2019 2:52 pm
Clearly the clever people can see how it works, but can someone post a dumbed down explanation of how it's doing it for the rest of us? :?
Yep +1 vote from me for this info as well please. I'm as thick as a plank me is :lol:
0 x

User avatar
Ast A. Moore
Manic Miner
Posts: 831
Joined: Mon Nov 13, 2017 3:16 pm

Re: Just a little head-scratcher

Post by Ast A. Moore » Thu Jan 10, 2019 3:25 pm

dfzx wrote:
Thu Jan 10, 2019 2:52 pm
Clearly the clever people can see how it works, but can someone post a dumbed down explanation of how it's doing it for the rest of us? :?
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| . . .
Here, xs represent the set screen bits (or pixels) and os the reset bits.

Now, let’s shift the whole thing one pixel to the left:

Code: Select all

xxxxxxoo|ooooooxx|xxxxxxoo| . . .
The attribute pattern looks something like this:

Code: Select all

BLUE/YELLOW|YELLOW/MAGENTA|MAGENTA/RED| . . .
At a pixel level, the colors will be as follows:

Code: Select all

BBBBBBYY|YYYYYYMM|MMMMMMRR| . . .
And so on.

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.
1 x
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.

dfzx
Microbot
Posts: 110
Joined: Mon Nov 13, 2017 6:55 pm
Location: New Forest, UK
Contact:

Re: Just a little head-scratcher

Post by dfzx » Thu Jan 10, 2019 3:29 pm

Ast A. Moore wrote:
Thu Jan 10, 2019 3:25 pm
Hope this clears things up a bit.
Yes, thanks! Kind of obvious when you put it like that, but I wouldn't have worked it out from looking at the code. :)
0 x

Joefish
Manic Miner
Posts: 357
Joined: Tue Nov 14, 2017 10:26 am

Re: Just a little head-scratcher

Post by Joefish » Thu Jan 10, 2019 3:32 pm

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.
1 x

Bizzley
Dizzy
Posts: 74
Joined: Thu Nov 16, 2017 10:47 am

Re: Just a little head-scratcher

Post by Bizzley » Thu Jan 10, 2019 9:29 pm

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.
0 x

User avatar
R-Tape
Site Admin
Posts: 1871
Joined: Thu Nov 09, 2017 11:46 am

Re: Just a little head-scratcher

Post by R-Tape » Thu Jan 10, 2019 10:57 pm

Bizzley wrote:
Thu Jan 10, 2019 9:29 pm
...then you can see the raw pixel data being redrawn behind the scenes every loop.
Image
:)
0 x

Post Reply