Adventurer #14
30 июня 2003

Tutorials - a new word in demomakinge: chankovy engine 2x2.

<b>Tutorials</b> - a new word in demomakinge: chankovy engine 2x2.
Chunks 2x2
Poisoned CyberJack / TBK

The new word in demomakinge:)

Greetings to all who consider themselves encoders - steep and 
so-so! Today I will try to surprise you

:)

Modern coding (for
Spectrum, of coz) is mainly based on chankovyh engines. And this
correct - for otherwise it is very difficult to realize many 
things. Explain the details will not - all of it was already 
quite a long time. Especially, the choice is already made ...


Chunks are different. Contrary
popular belief, all Gopnik, versed in
code, as I have in Chinese cooking,
chunks - is not only the squares
4x4:) Roughly speaking, the chunks - this is
such a technology in which the screen is filled with blocks 
having the same size, usually image is built not just on

screen, and in the buffer and we have random access to any part 
of the image, regardless of others (in contrast to our planar 
screen), and we usually draw the image in more colors than have 
our ZX (15, not forgotten?) Since the campaign against 
illiteracy complete dummies are not included in my

plans, at this muddled description I close this question - who 
should be may find the information in other publications (Deja 
Vu, Demo or Die, Buzz, etc) 

So - chunks may be different. On
Speke mostly yuzayutsya size 4x4 (two types - pixel [Refresh, 
Dogma, Inbetween] and Multicolor [Eye Ache 1 / 2,

Rage, Stellar Contour]), as
is the optimal ratio
between resolution and volume
screen. 8x8 species, as
purely attribute [any demos 95-97 years] and pixel-attribute 
[Emergency, 63Bit3, Smile_4K], because of the low-resolution 
strongly lose, so how to do something normal in

32h24 almost unreal. Oh, forgot
say - speaking about the code, I am
mind 3D - because it is the most difficult
(Hence interesting) application koderskih abilities.

All this has been tested very
long (97y year), and many have already nabilo mouth. Is there 
no alternative? 

And there is a solution - and also long been known. Remember 
these things Higher State / 3SC, Over The Top

/ Enigma, Matricks / Baze? Well
Yes, I'm talking about a 2x2 chunk.

Many coders who have long
not new, now suspiciously
grins. Yes, yes, at first
view the benefits of such a size
chanok a little as the screen grows as much a factor of 4 
compared to 4x4 (and, hence, the frame will be constructed to 4 
times longer) - and in the memory of this screen to jostle it 
is not so easy. And the use of tiny windows - is not out. And 
even feature - a chunk of 2x2, we have 5 colors, it's awfully 
small for the implementation of lighting in the 3D-parts (and 
Phong, and Gourado, and even look Flat

just awful). To top
everything else and c2p brake, so
as there is more than reading and
less write (compared to
4x4, again).

But! I would not just waste your time (as well as their own,
which to me is much more expensive:)
if not sold chunks 2x2
Our Deme, which we unfortunately could not lead to
CAFe'02, and now can not in any way bring to end: (((That's 
about This I tell you now ...


Most simply solve the problem
lack of 5-colors. Itself
dithering. Who does not know - in
some Deja Vu was a good
The article about it. Incidentally,
birdie. Relatively recently in
Psychoz # 11c was published
Article Dark / X-Trade of dithering
a 2x2 chunk. Despite all my
respect to the individual, the code
dithering there terribly weak. More
in 2000 to year we are on par with
Baze/3SC came up with the correct
routine c2p chanok for 2x2, and
its intro Matricks it is just
applied dithering in 16 colors
(Admittedly, c2p there it personal
more braking). C2p code like this:

sp - chunk screen
de - 1st line on spectrum screen (# 401F)
bc - 2nd line on spectrum screen (# 4120)
pop hl
ld a, (hl)
pop hl
ld l, (hl)
ld h, a
ldd
ld a, (hl)
ld (bc), a
Total: 10 +7 +10 +7 +4 +16 +7 +7 = 68tct

[Recall that two Dark'a familiarity drawn 90 94
tact, it is 92 cycles on average]

The trick you use LDD. A small feature - the picture is drawn 
inverted horizontally, as SP is growing up, and BC and DE 
reduced. Chunks of the form% --- xxxx0. For dither will have to 
put a table of graphics in different banks and to work on one 
screen. Explain I will not detail because it is all

well already passed stage:) Who
Still interesting and clear -
contact me explain.

As you can see, this speed is quite
normal - the whole screen is drawn in approximately 3 frames. 
But problem is too big-screen remains so it is inadequate 
solution. 

Experimenting with different engines and filters, I came
head of a great idea:) And
that if we miscalculate the screen is not completely but only 
partially and the remainder of the fill

program, say, a linear interpolation? Then, you can not use the 
brake filter (a la Sair00s) for latent defects engine-that is,

we get benefits in both speed and
volume of the screen. There are some parallels with the Amiga 
regime HAM8 (I understand), where the color of pixels depends 
on the nodal and the latest demos are working to resolve not 
640x480 or 320x240, and a lot less. So

I do not amizhnik (really), it can now be said to huge
stupidity - but it does not matter:) This
talking about the Spectrum.

What I mean by a linear
interpolation? I have not cheated
Each chunk screen, and in one
horizontally - and missed
get as an average between the two
already known. Type this:

so do the usual:
! C0! C1! C2! C3! C4! C5! C6! C7! C8!

and so do I:
! C0! -! C2! -! C4! -! C6! -! C8!
 (C0 + c2) / 2 (c4 + c6) / 2

As a result, the picture gets
some blurring, which
personally I like:) Anyway
issue immediately chankovy screen
a little risky, because of the low resolution and simplified
shading image is often obtained, so to speak, scary:)
In the past demah Sair00s about the same interpolates two
the screen - I did a cost.

If interpolation conduct a separate operation, then any 
benefits in speed, we did not find since it is not too rapid 
(takes two from memory the numbers add up on the table

We get the result and puts it in
Memory - 40 cycles per chunk
go). I therefore distort and
combined with interpolation c2p:

sp - chunk screen
de - spectrum screen
 h - previous chunk
pop bc
ld a, (bc)
ld l, a
ld a, (hl)
ld (de), a
inc h
inc d
ldi
dec d
ld h, b
Total: 10 +7 +4 +7 +7 +4 +4 +16 +4 +4 = 67tct

Mdaaaa:) I'll try to explain
available.

In order to draw the familiarity, (8x2 pixel), we must consider 
three chunks: 

! ! !
! - C0 - c1! - C2 - c3!
! ! !
 ^ ^ ^

We have 16 tables (as the chunk
previous familiarity may
be of any color), and the address of graphics is calculated as 
follows (for the second familiarity): 

c1 * # 0100 + c2 * # 0010 + c3

Chunks of the form% 110hhhh0 those # E0-# FE.
At the end of the sector is a table
junior addresses schedules, ie
from addresses # E0E0, # E2E0, etc. In the very same 32 sectors 
is schedule.


Discrepancy came out - so the graphics and the multiplication 
table located in the same address, their creeping occurs at each

other. I walked around it, throwing two
color:) That is, I do not have 16 real flowers, and 14. But 
since more convenient to work in sixteen

colors, so I just combined 0 and 1, 14 and 15 colors (in the 
table "multiplication" on display the same value). You can 
actually do something and honest 1916 colors, but only by 
slowing down c2p-so I chose this output.


Dithering I made with two cans with different chankovoy
graphics - for even rows and
odd. All this eats lots of memory, but still works on one
screen:)

What are we all this for you? We have
the following - in comparison with chunks 4x4 screen size has 
doubled (rather than four), the screen is completely rebuilt in 
about three frames, we do not need an additional filter, the 
image quality much better than (Still would be a chunk fell by 4

times). That is, we lose in
speed, but we win as a. On this engine is quite
possible to do something that we
tried to prove in his Deme.

The annex to the magazine you will find the source generilki 
chankovoy Graphics and c2p in text format, but unfortunately 
for many, syntax Storm'a:) And also

small demonstration
engine.

respect to all spectrum's coders
and Adventurer's readers!!!

(C) Triebkraft



--------------------------------- I am, of course, with a 
slightly stormozil his article (as well as with demoy

: (), And that though the thread compensate for this negative 
aspect, bring to your attention an optimized version of 
c2p-routine with interpolation. Wrote it JtN / / 4d, comments 
will not:) The principle of operation is the same, and in 
general - need to head to think more. 

pop hl; 10
l, (hl); 7
ld a, h; 4
exa; 4
ld h, a; 4
ldd; 16
ld a, (hl); 7
ld (bc), a; 7
; = 59t !!!!!!!!!!!





Other articles:

Editorial - Our Time Machine.

Editorial - Editorial.

Editorial - Seven years of the magazine, the fourteenth number. Magic numbers.

Editorial - a new shell magazine.

Editorial - addresses editors and authors of the magazine.

News - news from: Alco / Anarchia, Studio Stall, Hooy-Program, Tbk +4 d, C-jeff, Colour of Magi, Skrju, Triumph, n-Dicovery, Perspective Group, Cronosoft , Stefano.

News - News from: Alco / Anarchia, Studio Stall, Hooy-Program, Tbk +4 d, C-jeff, Colour of Magi, Skrju, Triumph, n-Dicovery, Perspective Group, Cronosoft , Stefano.

Scene - demokoderov survey about their favorite demah.

Scene - Democoders Questionnarie: best zx demo.

Scene - the current trends in demomeykinge.

Scene - Modern tendencies in demomaking.

Scene - Adventure Finns in Russia: Report on a trip to the Russian party CAFe'2002.

Scene - The Scene Behind A Curtain.

Scene - an epic trip report on the CPU CAFe'2002.

Scene - CPU global report on the visit to Belarus to party Millennium'1902.

Scene - a detailed report from Rostov party Paradox'2002.

Scene - a report of the Slovak party for 8-bit Forever Quatro 2003.

Scene - an interview with the famous Polish spektrumistom Yerzmyey / Hooy-Programm.

Scene - Interview with Yerzmyey / Hooy-Programm.

Scene - a conversation Sq, Diver, CJ about the fate of newspapers Insanity.

Scene - an interview with Brainwave taken on CAFe'2002.

Scene - an interview with the Color of Magic taken on CAFe'2002.

Scene - Interview with Mayhem taken on CAFe'2002.

Scene - an interview with the Power Of Sound taken on CAFe'2002.

Scene - an interview with a group of Antares taken on CAFe'2002.

Scene - interview with Triumph the commitment made by CAFe'2002.

Scene - an interview with a group of OCA taken on CAFe'2002.

Scene - an interview with a group Jeez taken on CAFe'2002.

Scene - an interview with ukraiskim spektrumistom Looker taken on CAFe'2002.

Scene - an interview with Kacuk taken on CAFe'2002.

Scene - an interview with the band Phantom Family taken on CAFe'2002.

Scene - an interview with a group of Master Home Computers Group taken on CAFe'2002.

Scene - an interview with the band Placebo taken on CAFe'2002.

Scene - an interview with Screamer'om taken on CAFe'2002.

Scene - an interview with the organizers CAFe'2002 - xPasha, Adam Bazaroff and Unbeliever.

Interface - Forever Music compo psychology.

Interface - psychology of voting for the music on the example of European demopati Forever.

Interface - The problems of Russian spekovskoy news scene. Review of the modern press.

Interface - the history of creation in the form of demos Summermilk IRC log.

Interface - the story of creating a virtual party of Antique Toy.

Interface - History of Antique Toy.

Reviews - an overview of demos for 2002: Alter Ego, Reject, Laya, Lovemaker, Harm, Abyss Of Madness, Losing Victoria, Inbetween, Summermilk, demo21, Black & White, Traffic Of Death, Invasion, The Loop.

Reviews - 2002 year demo review: Alter Ego, Reject, Laya, Lovemaker, Harm, Abyss Of Madness, Losing Victoria, Inbetween, Summermilk, demo21, Black & White, Traffic Of Death, Invasion, The Loop.

Review - Review sovrennogo Spectrum iron.

Reviews - ZX Spectrum 2002 year Hardware Review.

Review - zhelezyachny retro Fetishizm.

Review - Hardware Retrofetishism.

Tutorials - a new word in demomakinge: chankovy engine 2x2.

Tutorials - New trend in demomaking: Chunks 2x2.

Ottyag - observing life.

Ottyag - the secret places of my mind.


Темы: Игры, Программное обеспечение, Пресса, Аппаратное обеспечение, Сеть, Демосцена, Люди, Программирование

Similar articles:
Interview with Pheel - an interview with a famous artist Spectrum.
Locman - On the game MECHANIC WARS.
Demoscene - the composition and the contacts of the Lithuanian group zERo.

В этот день...   21 November