Matrix. It was: Fast chunky gouraud shadin inner loop.
ZXNet echo conference «code.zx»
From Aleksey Malov → To Vyacheslav Kalinin 5 April 2000
Greetings, Vyacheslav!
Sat 1 Apr 2000 at 22:14:00 Vyacheslav Kalinin and Aleksey Malov were talking
on the theme Fast chunky gouraud shadin inner loop..
VK> Since you are such a cool coder, can you tell me how
Well, it turns out that I’m not the only one who thinks this way about myself ;-). I love it when I
praised for the work.
VK> quickly calculate the following matrix:
VK> 0-1 0 1 1 1
VK> -1 5-1 or such 1 1 1
VK> 0-1 0 1 1 1
VK> It’s just written in the demo that they say don’t use index ones
VK> registers, but for example I have no idea how to calculate mat
VK> rits without IX,IY, and also in matrices it is necessary to divide, but as for example
VK> can the number be divided by 9 so that it also works quickly?
Small numbers (about 0..128 /0..128) can be divided using tables. And also
It’s better not to divide at all, but to look for another way (for example, multiply by 1/9) or
algorithm (you can draw a circle using its equation: x*x+y*y=r*r,
without using either squaring or rooting. (see my procedure,
which I recently threw here)). Approximate division using the formula:
a log a-log b
---= 2
b
can be found in issue 1 of Spectrum Expert magazine.In the case of your matrix, you can do this (as I understand, you want to blur
do):
hl-address in the chunk buffer (the buffer has the following structure: each line
located at #xx00.
D-st. byte address of the division table by 9 (or by some other number)
B-st. byte of the address of the multiplication table by 5. (for the left 0th matrix)
ld c,(hl); take the central element of the matrix
ld a,(bc); and multiply it by 5
dec h; go to the line above
sub a,(hl)
inc l
inc h; go down right
sub a,(hl)
dec l
inc h; let's move down
sub (hl)
dec h
dec l; go left
sub (hl)
inc l
ld e,a
ld a,(de);divide by 9
ld (hl),a ;and put it in the buffer
inc l
VK> And if you can, tell me how to quickly increase
VK> chunk screen is not exactly 2 or 4 or 6 times, but a little bit
VK> well, you know how in demos it’s done so that it seems, for example
VK> that all the balls there fly, moving in a spiral and getting closer
this effect, IMHO, became morally obsolete 4 years ago, i.e. even before
it was implemented. Who does this and how, I haven’t really thought about it, but I’ll try
come up with your own way, especially for you ;)
within a line you can make an increase something like this:
ld c,(hl); 1 chunk
ld a,(de); 2 chunk
ld b,a
ld a,(bc);take a chunk corresponding to the overlap of the 1st and 2nd chunks from the bufferld (de),a; and push it into the buffer
inc e ;same for next. bytes
inc l; every 8 times this line must be missing in order to
; there was an increase of 8/7 times. Therefore, at the beginning of the line the register l
should be equal to (64-8*7)/2=4, and e=0.
If you understand the idea, then well done, and if not, then I’m explaining the meaning so poorly
an effect that I don’t consider good.
VK> come to you, and please explain how you output chunks in the demos
If by “you” you mean our Technogen invitation dentro on
CC'000 (4th place)) then our chunks are displayed differently than you wrote:
VK> POP HL
VK> ADD HL,BC aARTYY6TYGG
^^^^ what kind of glitch is this?
Don't lie, Technogen has this
there wasn't
VK> LDD
a, like this:
ret ──┐
│
┌───────┘
│
└─>jr chunky_address
chunky_address: ld h,a
ld (hl),#nn ;or ld (hl),b/c/d/e
inc h
ld (hl),#nn
inc h
ld (hl),#nn
inc h
ld (hl),#nn
inc l
ret ;t min: 70tacts/2chunks, t max: 82 ticks/2 chunks.
And in this way
pop hl
add hl,bc
ldd
the texture is pulled onto the walls of the subway tunnel, onto the surfacechunky lenses and on bump illuminated surfaces in greetings.
sp points to the address in the table of offsets in the texture relative to the base one
points.
bc points to the address of the base point in the texture
de points to the address in the chunky buffer
this cannot be explained, it needs to be understood
P.S. Breaking other people's demos is not good. More precisely, it’s good, but only for the authors about it
should not be said: we hoped that a certain Slava Kalinin, young
coder from St. Petersburg, will not delve into our fruit of three weeks of work during
passing the winter session. That’s why they didn’t put up any protection, but they could have
add a bunch of xorks to the 14 kilobytes remaining up to 64k that would kill
completely Scorpio monitor (or would have intercepted the magic button on it) and at the same time
and STS, which would try to hide in any page, would switch pages
with bit 4 reset, which would prevent TR-Dos from turning on when pressing
monkey. At worst, 98% of emulators would recognize it.
They are trying for you. If you want to know how something is done, ask
with us, and don’t break everything that comes to hand like Max Iwamoto.
Oh well, I’m just kidding, don’t be offended.
I wish you health, happiness and creative Uzbeks.
Aleksey Malov aka VIVID/Brainwave.