On the effects on the curb, and about something else.
music by DNK
(C) MIK 20.10.1996
_________________________________________
The idea of this article was born after reading some articles
that were published in ZX-REVIEW dedicated BORDER effects.
As a result of reading them, I
impression that either I went
to these issues as something wrong, or the authors of articles
(no offense to them it is said) is not know enough on this
topic, or hide a "secret" information. Next I will try as much
as possible to analyze in detail the principle of creating
these effects. Immediately apologize for what I can miss some
little things so as to me they are obvious things. So
start:
Chapter I.
The most common effects.
The simplest thing that could come up with so
outright turned BASICom:
10 BORDER 1: BORDER 2: BORDER 3:
BORDER 4: BORDER 5: GOTO 1910
The result of this action will
color bars flashing on BORDERu. Nabalovavshis this program, you
will definitely come to the conclusion that it would be fairly
well-to nail them tightly to certain places on BORDERe. Since
experimentation with hammer and nails are unlikely to help,
have to consider a software solution
this simple (!) problems. But for a start
some literacy classes:
Computer all the time engaged in that
builds a picture on your (and on my
too) screen. Here's how: With the advent of human clock (simply
signal, meaning that the beam forming
the picture is in the upper left corner
screen) chip ULA (do not look for it
card if you do not have firm SPECTRUM)
begins to transmit information that
it is necessary to build. This information is
gets from two sources - the port # FE
(254), or rather of its three least significant bits
and the display area. Delaet this ULA all
time but on different computers in different ways, in most cars
every 4 cycles CPU (more precisely a time equal to the
implementation of four CPU clocks) is formed information in a
special register (the registers of the processor has no
relation) on 8 points to be construct, whether related
they have to BORDERu or to the main screen. In
PENTAGON computer to curb this
rights are not respected in the construction
its area about each point zanogo requested from the port # FE.
Meaning the above will be explained further in analyzing the
examples. Information is constructed by rows from top
down. On the construction of each row spent some time recording
is strictly for the computer (usually 220 or 224 cycles). Total
built 312 or 320 lines. It is easy to see that the number of
cycles available to the processor, is the product of the number
of rows on number of cycles in a row. Performance of the same
notorious PENTAGONA - result 320 lines * 224 clock cycles in a
row. The foregoing is repeated 50 times per second, all the
time until konpyuter not turn off or he will not break. But
there is another process is repeated 50 times per second, and
attachment hardware (?) to the first - namely, interrupt
handling. Sovkupnost the information provided allows me to
hope that all the legend on you will be understood.
Chapter II.
Firmly stoyashie stripes on bodyure
Immediately give you an example, and then explain it.
ORG 25000
DI
LD HL, # B200; Set
LD DE, # B201; second mode
LD BC, 256; interrupt
LD (HL), # B3
LD A, H
LD I, A
LDIR
LD A, # C9; handler is
LD (# B3B3), A; from one team RET
IM 2
LOOP EI
HALT
DI
LD B, 255; Screen started
L1 LD A, 1; built
OUT (# FE), A; synchronously with
NOP; it works
NOP; program.
NOP; Here the first
DJNZ L1; line.
DEC B
L2 LD A, 2
OUT (# FE), A; And here we draw
NOP; second.
NOP
NOP
DJNZ L2
DEC B
L3 LD A, 3
OUT (# FE), A; Then a third.
NOP
NOP
NOP
DJNZ L3
DEC B
L4 LD A, 4
OUT (# FE), A; Another.
NOP
NOP
NOP
DJNZ L4
DEC B
L5 LD A, 5
OUT (# FE), A; And more.
NOP
NOP
NOP
DJNZ L5
DEC B
L6 LD A, 6
OUT (# FE), A
NOP
NOP
NOP
DJNZ L6
DEC B
L7 LD A, 7
OUT (# FE), A; latter.
NOP
NOP
NOP
DJNZ L7
"LD A, # 7F; interested
IN A, (# FE); not pressed if
RRA; ANY KEY.
JP C, LOOP; If not - all
IM 1; again,
RET; otherwise ago
; TASM.
Legend:
1.Komandy NOP need to stretch the lines in magnitude.
2.Chast program located after the command HALT is possible with
small changes to make interrupt handlers, and the band will
work in parallel with the main program.
3.Programma is tied in time
(The signal INT), runs every
Rebuilding the screen, and each time has the same number of
cycles. If something remains unclear, it is still
again carefully look at the program
or (better yet) try to change it and see what happens.
Chapter III.
Just another chapter.
Having dealt with drawing horizontal
lines, we can take a picture of the vertical lines. But here
waiting for a bummer: looking at a table in which
painted strokes for each team (ie in
Annex 1 of the book "How to write a game
assembly language "), you will learn that the most
Fast team work with the ports is
12 cycles CPU, which means that it does not try,
dash for 24 points does not portray. Now about the technology
of drawing vertical lines.
1. Throw in the port # FE any color,
such as white.
2. Immediately followed by a color that will send the
background (black)
3. Allow a pause equal to the number of ticks per
to construct the line in your computer, minus the number of
cycles spent on paragraphs one and two.
4 Repeat steps 1-3
I explain with an example:
Start as in the previous example
............
LOOP EI
HALT
; On entirely different
LD D, 7
LD E, 0
LD A, 80
LD C, # FE
MAX OUT (C), D; 12 cycles
OUT (C), E; 12 cycles
OUT (C), D; 12 cycles
OUT (C), E; 12 cycles
OUT (C), D; 12 cycles
OUT (C), E; 12 cycles
OUT (C), D; 12 cycles
OUT (C), E; 12 cycles
OUT (C), D; 12 cycles
OUT (C), E; 12 cycles
OUT (C), D; 12 cycles
OUT (C), E; 12 cycles
OUT (C), D; 12 cycles
OUT (C), E; 12 cycles
OUT (C), D; 12 cycles
OUT (C), E; 12 cycles
, Total has 192 cycles
NOP; 4 stroke
NOP; 4 stroke
NOP; 4 stroke
DEC A; 4 stroke
JR NZ, MAX; 12 cycles
, Ran up a total 220 cycles is
; As much as time spent
; My computer to build a
; Line
LD A, # 7F
IN A, (# FE)
RRA
JP C, LOOP
IM 1
RET
Theoretically, after starting the program you must
a vertical strip at the top of the screen, if the two are
canted to one side then change number NORov inside the loop
(Increase or decrease). The variant of the bands
will be brutally twitch (if
You PENTAGON, then it never will be)
out of this situation is as follows: insert
after HALTa team (or teams) are satisfied for the time is not a
multiple of 4-th cycle. For example, try:
LD A, (0) 13 cycles 3 * 4 +1
or
DEC DE 6 cycles 4 +2
or
ADC A, (HL) 7 clocks 4 +3
Will certainly help!
In fact, on the curb the effects of speaking
nothing more. A final note: after the arrival of the signal INT
management interrupt handler will be passed immediately (If INT
came in the command HALT) or after a short delay (Duration
depends on the number of ticks remaining for the current
command to execute).
That's all.
If you have anything to add on this
question, write to the editor and share your knowledge.