Forum - The effects on the curb and Multicolor.

ZX Review #7-8-9-10
(C) Plyasunov D., Kazan


   The 3-m room in 1996 (Section "Etudes") HACKER JOHN asked 
about the effects on the curb in INSULT MD. I would like to 
share it with the readers of reviews.


   And start with the basics: no longer a
secret that every computer
there is a signal STAFF Sync. On his arrival ULA began to 
deploy the image on the monitor, and scan speed is 8 pixels by 4

processor cycle (or 2 pixels per clock). Such work is repeated 
50 times per second. Simultaneously with the advent of CSI 
comes to the signal INT (more accurately say that the cause of

INT signal and the signal is
CSI. But more on this later). And I would like to
little fix VOLGAsoft'a:
image on the screen starts
based not on the signal INT, and
the signal CSI! Why am I singled out, I'll tell you in detail, 
because I think it is very important. In all the computers 
signal INT based on the signal CSI, and

generation circuit can be
different: where the signal is constructed
the leading edge of CSI, where
rear, where the row count is
in the beginning, and where at the end (do not tell "creators 
")... 


   Ca. Ed.: All quite understandable: for
simplify the scheme for the Pentagon signal INT
formed with the arrival of (the leading edge)
IAC, which was very convenient for programming. No need to 
calculate the delay. A standard machine INT is formed on the 
trailing edge of CSI. The latter solution is more difficult for 
an encoder, but there is compatibility with foreign programs,

using multicolor. There are still
Several methods of forming INT'a, but
consider them in this article makes no sense.


    Well, and, respectively, while
between the arrival of IAC and the formation of INT can be 
different! And therefore, MULTICOLOR, written

on one type of computer will not work on another. Because
and this sprites flicker on slower machines (like PROFI,
ATM), for example, have BOOT'e VAV'a
lost to MC PROFI. Now
are already appear remarks demoshki where
before starting your first offer to combine lines in BORDER'e 
with screen (ECHOLOGY +, KSAGIFT).



   Ca. Ed.: The following information is partly repeats the 
already published by us materials MULTICOLOR'u, but we decided

give it completely because it is given in
more simple (close to a particular
problem) form.


   And now, directly on the
screen: how many times it was written
REVIEW on the pages, the screen is
of the lines from 224 cycles each
(About 217 I do not know). See Figure 1.
Total number of such lines should be
312 (a PENTAGON'a 320, but it is not
dangerous). Multiplying, we find that
length of the interruption is equal to 69888 (in
PENTAGON'a - 71680). But not only that unlike computers. K
example, at RST7 PENTAGON, but not
everyone will have the right to go
hidden part INSULT'a, but from this the following fact: in his
PC INT formed on the leading edge of CSI, but on the other
PENTAGON'a types - on the back,
that's not the same BORDER.



             Border



             Screen



            224 cycles


             Figure 1.


   The theory seems to be everything. Now shaped as letters: it 
was noted that sweep speed is 2 pixels by 1 stroke. Hence,

that if we change the color
border very quickly, we can
achieve interesting effects.
Consider the command OUT (C), A:
This is the fastest team to send to the port, and it takes 12
cycles (there are even faster: OUT
(# FE), A - 11 clock cycles, but still
Replacement battery, how many
time will be ...), so the minimum possible "point" on
curb is 2 * 12 = 24 pixels, or 3 familiarity. Here's the
such points and will be our shaped as letters. And now an 
example program deducing the letter A on the curb:



                   **

                  *

   Template letters: *

                  ****

                  *

                  * 140.


       ORG # 8000

       LD HL, # FE00; filling a region of size 257 bytes

       LD DE, # FE01; byte # FF.

       LD BC, # 100

       LD (HL), # FF

       LDIR

       LD HL, # FFFF; address of the interrupt handler

       LD (HL), # C9; here is the only team RET


       DI; initialization IM 2

       LD A, # FE

       LD I, A

       IM 2

       EI

LOOP HALT; waiting for the arrival of INT

       EI

       LD BC, # 200, this latency
WAIT DEC BC; one run cycle takes 28

       LD A, B; cycles. This gives some

       OR C; advantage because increasing the value

       NOP; BC to 8, the delay will increase by 224

       JP NZ, WAIT; stroke, ie, 1 pixel down.


       LD BC, # 00FE; C-port curb, B-color of the border

       LD DE, # 0206; letter will be yellow on a red background.


       OUT (C), D; upper band letters

       OUT (C), E; only 12 * 4 = 48 cycles

       OUT (C), E

       OUT (C), D

       OUT (C), B; on black, and 12 cycles

       LD A, 10, a delay until the next line of 7 clocks
WAIT_1 DEC A; (4 +10) * 10 = 140 cycles

       JP NZ, WAIT_1; Total: 48 +12 +7 +140 = 207 cycles

       RET NZ; Team Dummy, complementary to 224

       INC HL; 5 +6 +6 = 17 cycles

       INC HL; 17 207 = 224 cycles. The line is finished!

       OUT (C), E; further by the second line

       OUT (C), D; Further, by analogy, many times

       OUT (C), D; what height you letter.

       OUT (C), E

       OUT (C), B

...........................

                           , There may be other actions
...........................


       LD A, # 7F; survey of the space key

       IN A, (# FE)

       RRA

       JP C, LOOP


       DI; recovery mode interrupts.

       LD A, # 3F

       LD I, A

       IM 1

       EI

       RET
2

   The procedure for drawing a point in
78 cycles.


   To operate this procedure
need a sign to 1 KB. Idea
I threw my friend vytsepiv
her out of some toys.
140.

     Input: B - coordinate Y, C - coordinate X.

PLOT LD H, # FA; to address # FA00 is a table

       LD L, B

       LD B, (HL); byte has already been formed

       INC H

       LD A, (HL)

       INC H

       LD L, C

       OR (HL)

       LD C, A

       INC H

       LD A, (BC); combine the display byte

       OR (HL); resulting

       LD (BC), A; and return it to the screen

       RET
2

   And now the program that produces a table in memory:
140.
CREAT LD HL, # FA00; start address table

                           , Should be "round" number

       LD C, # 1940

       CALL CREAT_1

       LD C, # 1948

       CALL CREAT_1

       LD C, # 1950

       CALL CREAT_1

140. LD L, B

       INC H

       XOR A

       LD C, # 1920
LOOP_1 LD B, # 08
LOOP_2 LD (HL), A

       INC HL

       DJNZ LOOP_2

       ADD A, # 20

       DEC C

       JR NZ, LOOP_1
LOOP_3 LD B, 8
LOOP_4 LD (HL), A

       INC HL

       DJNZ LOOP_4

       LD A, # 80
LOOP_5 LD (HL), A

       INC HL

       RRCA

       DJNZ LOOP_5

       RET

CREAT_1 LD B, # 40

       LD A, C
LOOP_6 LD (HL), A

       INC L

       INC A

       AND # 07

       OR C

       DJNZ LOOP_6

       RET
2

   I would also like a couple of words
say about the command HALT. Execute commands similar ztoy
implement a series of commands to the NOP
the arrival of an interrupt. When it comes to interrupt, the 
processor first DOVYPOLNYAET team on which he broke off, and 
only then moves to the interrupt. NOP command four-stroke, so 
when you run HALT may be four situations:

when INT come after a stroke NOP, two bars,
three bars and full implementation of this command. Therefore, 
the length our whole procedure should be

multiple of four cycles. If
This will not be, INT will
arrive with different delays from
0 to 3 cycles, which will affect
shake the letters on the curb.

   And one more thing. Always write synchronizers to your
effects on the curb for multicolor and for the effects of two
screens (blind, etc.).


   At the request of the author we publish his address:

420073 Kazan, ul.Gvardeyskaya,
d.32, komn.323, Plyasunova Dimitri.

INTERNET E-Mail: pavel@open.ksu.
ras.ru


           *