Author: Sergey Kolotov, SerzhSoft,
__________________________________________
Demo KODIT I WANT TO - LET teach me!
Certainly, in recent demostroenie on Speccy is one of the
leading ing the location of the amplification
ly huge army code
ditch, MUSIC-, GFX-and other
makerov ... It is impossible not to
mark progression
improved coding,
graphics, music, and with
The collection of effects (FX).
Thus, in the latest "prodvi
nutyh "demah emphasis is on the timing,
conformity visual and sound effects to each other.
And, is the most promising
direction EURODEMO, or more technical and confusing -
TRACKMO.
Demos created by this standard,
more undemanding to architecture companies
do not slow down on slower company and will not be reset, for
example, buggy data bus affecting the interrupt vector. These
demos "Go" and various "branded" versions Speccy (+2 A, +2 B,
+3 ...). And what very nice - all of these programs is easy
transferred from one system to another
(Eg, disk), swing across networks and
obtain the largest distribution and popularity.
Here are the most basic requirements,
applicable to EURODEMO:
1. Correct work at all "branded"
Spectrum, including a +2 A, +2 B, +3.
as well.) When using port # FD to switch pages, the sixth bit
of the port must be installed in yedinichku (eg, OR # 40; SET
6, A).
b). The value of the number of cycles in one
Termination (tacts in one frame) should not
exceed 224 * 312 = 69888.
cent.) interrupt vector I should be installed within a # 80
... # BE, ie point to address in the "fast" the second page
RAM. Otherwise, you risk to slow down the program on some
machines approximately 25%.
city) Vector table must necessarily consist of 257 (!) bytes
beginning at a multiple of 256, ie, in within the # 8000 .. #
BE00. If you decide to "Saved" by 255 bytes, be
sure: on machines with unstable bus
data your creation is unlikely to work!
2. Disk version demos in no case
should not be made as a monoblock. BASIC part must perform a
simple loading and allow for
Transfer to another - not TR-DOS "- system. Under the monoblock
understood BASIC file with the downloader program, and she deme,
related "dyrkovym" (can also be expressed
Inforkom!) By sectors of the TR-DOS. But
You can cheat and small demos of up to
40 kb enter zero in REM-line
BASIC on the principle of tape loaders and avoid all the
problems of adaptation.
Example:
0 REM ... mover ... depacker ... pack_codes.
10 RANDOMIZE USR VAL "5" + PEEK 23635 +
256 * PEEK 23636 "
3. Multicolor effects of best
abandon or dispose of setting first on all branded machines and
only then already in the PENTAGON, SCORPION ...
4. Desirable place greater emphasis on effects and
then - the graphics and music. Animation
not welcome! The people are longing
REALTIME'ovyh procedures!
5. Ideally, the transition from part to part
should occur automatically and in its
time. Dema should look at one
breathing. But as the ideal to achieve a very
difficult, for acceleration and transition to
the next part - not bad poll
SPACE and ENTER.
The Council is also to look through these articles:
DEJA VU # 1 \ SOFTWARE \ SOFTNOVOSTI \ DEMOSTSENA;
DEJA VU # 1 \ Beyond the hill \ RICH also cry;
ZX-FORMAT # 3 \ PROGRAMMERS / ASSEMBLER.
So what motivates all the coders, graphics designers,
musicians, what makes them whole day and night to sit at the
monitor screens and push, push buttons Speccy, sleepy eyes,
evaluating the results already the work done ... Do I have to
say? I hope that since you listateli DEJA
VU, read this, the answer to this
the question you probably know, otherwise would not be sitting
for all of us loved komp'om!
Yes, there are still people whose greatest pleasure is a new
coding effects, for which time spent in
Assembler will never be lost. Possible, and you, my reader want
to become the coolest coder in the world. In this case, you
certainly will be useful to read The following lines in which
the little tricks witnesses of writing quality MEGADEMO ...
It should be noted that recently the greatest emphasis
placed on megademah
implementation realtime'ovyh
effects. Real word
time is often the appearance
lies at the screens of our
Spectrum'ov, and upot
reblyaetsya usually with a proud
shade ... But many
USER'ov so far this
the concept is some
PoE bewilderment. And not in vain.
as significance of this witty rather vague:
1. So said all the effects that
not based on a simple animation (derivation
alternately sprites are stored in memory).
That is, made some calculations, etc.
2. Under realtime-effects are those
procedures and their combination, which have time to return for
one interrupt thus ensuring the smooth graphics and
lack of 'twitching' image.
3. And this is often achieved by traditional
ods of programming is sometimes simply impossible, and coders
have to resort to various tricks and ruses, to provide the
necessary performance ...
The term 'programming in realtime'
I think just means one of
these techniques cool-prog
Ramming. Explain what
essence. Before the launching of the
anyone any effect on you
complement SPECIAL
procedure creates
(Generated) fragments
code of procedure, take
ing sometimes the entire 48th PA
rumple Speccy. Such procedures have a very
'loose' code, they are usually 'discloses' the commands of
cycles and not the least is the work stack.
Moreover, such procedures are not necessarily located in the
memory for different addresses. Different effects addresses the
procedures can be the same, just every time there will be 'is
generated' your code ...
All well and just when you have a memory of sitting one
effect, then usually no problems ... But when the effects of a
few, when they need to somehow tie together so they do not
conflict and no wipe each other ... Here already and with the
head can happen 'bo-bo'!
Monsters demomeykinga already used this technique when under
each effect is already discharged all 48 kb Speccy. As
is this achieved? It's very simple ... Created, how-to 'base
packed effects' the so-called 'FX-stack'. And all the effects
(Codes, graphics, tables, ...) scatter
on additional page 128th memory and waiting there in the
'sandwiched' state of its queue.
Usually left free to all
48th memory and seventh bank of RAM - for the effects of using
two video page. A more - all on wheels: with 'FX-stack'
removed once the effect rackompressuetsya, creates the
necessary signs and realtime-procedure, and then we observe
regular 'Otpad'.
And so the viewer does not mayalsya in anticipation,
until the whole thing unpack, settle down 'and calculated as it
is necessary, the screen displays a variety of labels,
messages, fuck'i, finally ... (But in my opinion good EURODEMO
and fuck'i - things are absolutely incompatible!)
Should be used dekrunchery working with interrupt enable.
This necessary that the music never stopped and
'Pleased user. " In an extreme case because
can always be rewritten depaker using the stack, changing, for
example, POP HL at LD L, (IX +0): LD H, (IX +1) ... Or
for example, using alternative registries ...
Yes, I almost forgot. It must be noted
also receive so-called 'pseudo-realtime'. The essence is as
follows. For example, we take a sprite and memory are
calculated and stored it changed options to get, say other
sprite (morphing). That is, as a result we
we have in mind the sequence
Sprites, which subsequently will be
alternately displayed on the screen - simple animation. Such a
device, such as is used in the demo MENTAL MASTURBATION (RUSH)
at the organization of the same morph ...
But back to our sheep ... I
constantly surprises and to put it mildly -
annoying that some megademschiki to
still 'spit with high mountains' to reverse the beam. And the
best graphics just jerks ... And when the lost
part of the sprites, and sometimes entire scrolls -
there is medicine, as they say, is powerless! And, perhaps even
on the mountain komp'e encoder it all works as it should. A
Here are the other 'wheelbarrows' can occur Anything ... But
get rid of the 'radial problems' very, very simply, we need
only recall the existence of 128-Speccy two screens, switching
which is simply a port OUT'om # FD (third bit).
As a result, while both the 'visible'
screen will be one picture, we
shall modify or generates a new one - at
'Active' screen. And then just swap them. Perhaps a better cause
specific asm-code? We ought to ...
...
; Cell storage
BANK_M EQU # 5B5C
...
, Visible: scr_0, attached: scr_1 (7 banks)
LD A, # 57
; Call the procedure output port # FD
CALL RAMPAGE
...
LOOP HALT; waiting for the arrival interrupt
LD A, (BANK_M)
; Swap the visible and active screens
; Ekran_0/stranitsa 7 or ekran_1/str. 5
XOR # 0A
CALL RAMPAGE; out (# fd)
...
And create a new image at # C000
...
LD A, # 7F; twist
IN A, (# FE); cycle until the
RRA; not pressed
JR C, LOOP; SPACE
...
;
RAMPAGE; procedure output port # FD
LD BC, # 7FFD; OR # 40
OUT (C), A; OUT (# FD), A
LD (BANK_M), A; preserved. in cell
RET
...
So we have two cases:
1. See screen 0 (starting with # 4000) -
The third bit of the port reset. And at this time
connected to the seventh page of memory with the first screen
(# C000), which we are going to change ... 2. After the arrival
of the next interrupt team XOR # 0A followed OUT'om we
see Figure 1 (third bit of the port
# FD is equal to one) and connect the fifth
page of RAM - the same 0th screen
become active and will adresovyvatsya
also # C000!
3. All again from the beginning ...
But should take into account the fact that
must now be careful with
Port # FD. For example, when processing
interruption in the second mode, when playing music, you need
to keep track of the contents of the port # FD, and in
particular third bit. Say, the music we sit
in the first bank. Then the sample handler
interrupt will be:
...
MY_INT; procedure interrupt
PUSH
...
LD A, (BANK_M); contains. Port # FD
PUSH AF; saved on the stack
AND # F8; preserved. bits of the screen, etc.
OR # 01; page with Mouzon
CALL RAMPAGE; brought to the port
CALL PLAYMUS; lost
POP AF; restored AF
CALL RAMPAGE; have brought to the port
...
POP
EI; allowed to interrupt
RET; exit interrupt
...
Yes, I think we need to show it all 'live'. -Ka I'll walk
some realtime-effect. Experience shows that people learn much
faster on concrete examples. And therefore, read the article
'Floating ATTRIBUTES', where we have used Many of these ideas
...
I hope that reading this text does not
cause you lost a sense of wonder
time and something useful to you in
further work on the beloved Speccy.
If you are interested in any questions
DEMO-MAKING'a and realtime-programming -
do not be lazy to ask them and maybe get a comprehensive answer
on the pages DEJA VU.
And remember:
YOU CAN NOT WRITE demo,
BUT KODIT, ALL F, MUST be able to!