Info Guide #02

Programming - On multicolor program in general and in particular the MC24.

<b>Programming</b> - On multicolor program in general and in particular the MC24.
 About multicolor in general and in particular the MC24.

  AlCo


   The first question that torments the user, who saw on-screen 
pretty Multicolor effect - as one put familiarity

so many colors?

   Fortunately, in recent years, programmers gradually 
unleashed their languages ​​(and sometimes some of the 
non-programmer himself comes) and in the computer press began 
to appear small articles, sometimes just allusions to the 
principle of the effect. I going to do in this article 
voluminous work: take stock of their own and others' 
achievements in this area and, of course, tell the practical 
side of this issue. 


                 Chapter 1.

              General principle.


   Effects Multicolor most of all
similar to the effects of bordernym - on CPU utilization and 
intolerance on the clones. They are also close to the famous 
problem <July>, or <gap>: when the beam scan

catching up with the construction of images in the bottom of 
the screen visible to the previous frame, whereas top - the 
right (or vice versa), but separates their band gap, or 
<Mirror>. 

   The first thing to understand the principle of
display screen.

   66% of the time displayed on the screen or
curb, or nothing (go back moves the sweep). The rest of the 
time from the memory (or rather, from the current video page) 
are selected two bytes: the mask and attribute them to the known

principles are applied within 4 strokes are displayed on the 
screen in the form of 8 points. 

   From this it follows directly that every
attribute byte is read eight times - obviously
wasteful, though just try to realize
differently. That's what we use: if the attribute byte to 
change in time, the familiarity fall height. The ideal size 
Multicolor familiarity - 1x8 pixels - on neturbirovannoy 
machine is unreachable for the entire screen. Often used in 
familiarity 2x8 - mazh though the entire screen, there is still 
time left. 4x8 mode is even easier - you just need to toggle 
on-screen pages. 


                 Chapter 2.

                Constants.


   Lists the parameters for the sweep , as most 
standard machine Not long ago, but sunk in stormy

the flow of brake clones (primarily
is ).
 - The length of the frame (how many clock cycles between two 
scans of adjacent frames) - 71,680 cycles.  - Length of the 
line - 224 bar.  - Break begins - from the beginning reverse 
sweep.  - Strings in the top of the Border - 64.

 - Line the bottom of the Border - 48.
 - Total lines on the screen - 304 = 38 * 8.
 - Includes unseen - 320 = 40 * 8.
 - From: bars to the top of the graphical display - 17,920 = 80 
* 224. (Actually, for constructing multicolor need only know

two constants - the string length and number of cycles to the 
top edge. The last parameter in Pros and ATM is 14,336, the 
remaining clones unknown.)



                 Chapter 3.

                Classics.


   Date of invention, multicolor unknown, as well as the 
unknown inventor. In package SuperCode (1983), these procedures 
do not, Although there is static on the band

Border. Perhaps to clarify these issues should be a good 
rummage in the compilation of  or <Your 
Sinclair>, but in Russian, these logs were not released, but to 
get the original problematic. Therefore, just the facts: 

   Most well-known classical multicolor dated 1985-86. As the 
years greatest Spectrum . 

   Sometimes familiarity replaced Multicolor stripes on the 
curb - this effect is used in copiers <Last hope>. 

   In games <Venom strikes back>, ,
<Little Puff> shifty Multicolor stripes are present in the game 
menyu.V <Monty run> they are in the menu items.


   Programme of the then giants of the machine
Code (James Hatchbi, brothers Oliver), and
all Spanish program do without Multicolor 
effektov.Prenebrezhenie it or difficulties with mastering 
effects - is unknown. 

   Later in the countries of Eastern Europe began the actual 
experiments in this field. The strips have already tried to do 
the horizontal and combined with bordernymi. (Although 
bordernye stripes have tried to combine with standard screen: 
Italian SuperCar (Code Masters), the same Venom.) Classic 
example - Part 2 Shock megademo (ESI, Poland). Just make a 
reservation: they do not pervye.Byla some demo without music: 
on the Border and the screen from the center line and escaped 
rainbow stripes. 

   Our people quickly mastered the effect.

   The first (not guaranteed!) Multicolor
the picture was in the Gift MULTDEMO (Flash Inc.)
It consisted of eight-points of the 1x4 and
size was 16 * 16 familiarity.

   Multicolor most famous picture was, of course, 
CodeBusters'ovskaya. Demonstration of Satisfaction (1994) was 
then a real discovery. People stuck to the screen

trying to understand what the hell, it's all
done. Well, not counting those comrades who, without 
understanding the intricacies of special programming in 
assembly language, just listen Digital Mouzon from another part 
of the demo;). He By the way, is still unmatched, as well as

picture ... The picture was shown in
box 14 * 14. (Why not 16 * 16? Because walking
mapping, and this extra 25 cycles per line.)

   Since then, the tradition in multicolor
asked solely RST7.

   EYE ACHE (1996) - Mode 4x4 in 8 colors.
Before that, nobody (at least, know who) is not used. And then 
- Real Time MultiColor Rotator area two and a half thousand and 
points! Zoom Rotator 4x4 / 8 was in BINARYLOVE (DR, 1997). (The 
algorithm, of course, has nothing in common but the main thing -

idea!) Sine Plasma mode 1x8 - also did not
a very bad effect. Repeated (on the box in
1 / 4 screen) in a demo of bourgeois LAZARUS.

   EYE ACHE February (1997) - 2 SinePlasm'y mode 2x8, which had 
hitherto been used only neplavnyh effects (sm.ECHOLOGY).

3 effects in the resolution of the original 4x4/8.Mars 
MultiColor mode 1x8/64. Pictures mode 4x4/64 (horizontal 
hatching) and one in the mode of 2x2 / 8 (in the epilogue, for 
some reason called 2x2/2048? - /)


   1 (adyn) times, where Ito used a shimmering version of 
4x4/64. 

   Sineplasma 2x4 / 8 Repeat in EMERGENGY
(Real Masters, 1998). Still some great effects in 4x4/64 are
worthy ornament of their demo ANAMNESIS.


                 Chapter 4.

         Practical implementation.


   Consider the implementation of multicolor 1x8.

   What is required: after the arrival interrupt
wait until the top of the screen and in the upper distribute 
the familiarity some Moore. 

   To the top of the screen should go
know in advance the number of ticks, so that the first 
interrupt mode in any case can not be used. Therefore, 
including the second mode and hang up on him multicolor:

ATTRS EQU 0; ADDRESS ATTRIBUTES multicolor

      ORG 24576

      CALL SETIM; SETS THE INTERRUPTION

      CALL 8020

      JR C, $ -3; Wait BEFORE BREAK

      IM 1

      RET

SETIM LD HL, IMER

      LD DE, 65524

      LD BC, 12

      LDIR; TRANSFER Hooks

      LD A, 59, 59-th interrupt vector

      LD I, A; POINTS IN 65535

      IM 2

      RET

IMER PUSH AF

      PUSH BC

      PUSH HL

      CALL PROG

      POP HL

      POP BC

      POP AF

      RST 56; possible juzat FROM BASIC

      RET

      JR IMER

PROG PUSH DE; possible and in IMER, BUT WILL SEE ...

      LD HL, 679, OR 541 FOR PROS

      DEC HL

      LD A, H

      OR L

      JR NZ, $ -3; PAUSE, like, twisted

      LD HL, ATTRS

      LD A, 8; OSEM LINES Piha
PROG0 LD DE, # 5800; ADDRESS ATTRIBUTES OF SCREEN

      LD BC, 9

      LDIR

      NOP

      DEC A

      JR NZ, PROG0; 10 +10 +184 +4 +4 +12 = 224

      POP DE

      RET


   You do not find that 9 CHR $ - narrowish
for multicolor? Then replace LDIR on
LDI:

PROG PUSH DE

      LD HL, 679

      DEC HL

      LD A, H

      OR L

      JR NZ, $ -3

      LD HL, ATTRS

      LD DE, # 5800

      LD A, E

      LD BC, # 8FF; SHOP BE NOT me:)
PROG0 DUP 13

      LDI

      EDUP

      LD E, A

      DJNZ PROG0; = 225 (STILL does not matter)

      POP DE

      RET


   Still narrow, but what can you do - cycle
is a cycle, and LDI is LDI. Keep in mind that in real 
multicolor cycles do not use, and instead inflated (sometimes

This process is called DeCrunch), for example, such a program:

      POP HL

      LD (NN), HL

      POP HL

      LD (NN +2), HL

      ... 8 * 26 +16 = 224 clocks.

      POP HL whole Labuda repeat
      LD (NN +14), HL satisfies many times (the rate
      NOP lko lines on the screen)

      NOP

      NOP

      NOP

   Process like this, often referred to as
<Output through a stack>, although it should be soon
call  because this conclusion through 
the stack goes through PUSH. POP-method often used when printing

sprites (faster and a register pair
exempt).

   Program that creates such a sequence, I usually call the 
maker. Paste it into our program:

MAKER LD HL, TABLO

      LD DE, # 5800

      LD C, 12, 12 familiarity in height
MAK0 LD B, 8, 8 lines in familiarity
MAK1 PUSH BC

      PUSH DE

      LD B, 8
MAK2 LD (HL), 225; POP HL

      INC HL

      LD (HL), 34; LD (..), HL

      INC HL

      LD (HL), E

      INC HL

      LD (HL), D

      INC HL

      INC E

      INC E

      DJNZ MAK2

      LD B, 4
MAK3 LD (HL), 0; NOP

      INC HL

      DJNZ MAK3

      POP DE

      POP BC

      DJNZ MAK1

      LD A, E; MOVES

      ADD A, 32; NEXT

      LD E, A; familiarity

      JR NC, $ +3; (familiar with the procedure

      INC D; 8 +16-> 16)

      DEC C

      JR NZ, MAK0

      LD (HL), 49; LD SP,

      INC HL

      LD (PROG +2), HL

      INC HL

      INC HL

      LD (HL), 201; RET

      RET

PROG LD (0), SP; SAVES SP (NOT ROM, COZ)

      LD HL, 679

      DEC HL

      LD A, H

      OR L

      JR NZ, $ -3

      LD SP, ATTRS
TABLO

   Before CALL SETIM, of course, should stand CALL MAKER.

   Thus (unless, of course, I do not navertel errors) usually 
do multicolor a la MEGASCREEN.Izmeneniem number (and content), 
empty commands and constants in the PROG You can adjust it for 
different types of computers. 

   The program can be further simplified, but
Then she nerestanet be as universal: an eightfold repetition of 
identical commands must be enclosed in a ring; then working 
part will be eight times shorter, and maker, even a little bit 
easier. 

      LD C, A
METKA POP HL

      LD (NN), HL

      POP HL

      LD (NN +2), HL

      ...

      POP HL

      LD (NN +14), HL

      DEC C

      JR NZ, METKA

      NOP / 4; this BS once in four CHR $


   With additional tricks can be the same method to throw 18CHR 
$ MultiColor - For this top line of familiarity

to fill the attributes in advance, in the
early termination. One of the rooms ZXRevyu someone called this 
the most multicolor wide from achievable at Pentagon.



                 Chapter 5.

          Multicolor in 24 CHR $.


   As is known, POP-method is not best metod.Po least I have 
walked on this issue in the previous issue zhurnala.Tak now 
let's see what a PUSH. 

      LD DE, ...

      PUSH DE

      ...

   Very inconvenient, especially in our case,
that PUSH is working towards reducing adresov.Esli so fill 
every line, then we'll see on the screen <Yulu>. It can be 
avoided in several ways, so leave this

problem. Here is the problem more complicated.

   Try to calculate the maximum width of a multicolor PUSH:

     l = 224 / 5.10 = 21.3333!

   What will happen now - just throw it
idea? Not worth it, if we recall that:

   1) 18CHR $ MultiColor too ~ can not be>;

   2) the 128k is a second screen area.

   The method consists in the fact that pre-fill two top lines 
in each of familiarity, so directly in while constructing the 
screen will handle all 

     24 * 6 = 144 bytes

   for

     224 * 8 = 1792 cycles;

   Total

     1792 / 144 ¢ 12.4 cycles per byte.

   Now that's more like a reality.

   Although a certain percentage of time will
switch display pages, and not
all bytes are thrown through the PUSH: some and
by LD ... Once the beam begins draws the first byte in 
znakomestnoy line, multicolor after it begins to change the 
bytes on the screen. Once the line is filled, filled line on 
the another screen stranitse.Razumeetsya every

224 clock cycles needed to switch ekrany.Multikolor begins 
increasingly lag behind the sweep, and when it will surpass its 
for two terms and is already sitting on his tail, He quickly 
throws his last byte of the index registers (pre-filled, of 
course). 

   To understand what a beauty, it must be
write your own.

   Source program, which implements
This multicolor, lies in the junk. It's called MC24.H.


                 Chapter 6.

        Multicolor or full screen.


   At each Multicolor picture caught <nemultikolornye> area 
where the attribute familiarity 1x8 coincides with the 
attribute neighboring top familiarity. Therefore,

You can use the engine from 18CHR $ MultiColor, removing it 
unnecessary POP-LD. Of course, not every image will suffer a 
, but in this case we can write some very clever 
algorithm <Optimization>. 

   In the example (STARWARS.H) optimization procedure trial and 
are not optimized :-). 

   Remember: the effects of this method is not applicable! 
(Although, of course, if you ... then ..) 


                 Chapter 7.

             Multicolor 2x8.


   Achievable on the entire screen, even
with the external attribute table (which is not
say about the MC24). The method used POP-LD
without any frills:

     OUT (C), D

     NOP

     POP HL

     LD (# 5800), HL

     POP HL

     LD (# 5802), HL

      ...

     POP HL

     LD (# 581E), HL

     OUT (C), E

     NOP

     POP HL

     LD (# D800), HL

     POP HL

     LD (# D802), HL

      ...

     POP HL

     LD (# D81E), HL

      etc.


   As you probably already guessed, BC should be equal to 
32,765, D = 31, E = 23. 


                 Chapter 8.

      Multicolor screen mode.


   With multicolor and X-color'ov on
Speccy probably about 40 different graphics modes. Enumerate 
them. 

   MC means MultiColor, ie simply compressed
familiarity; GREY color means, obtained from
by shading; COL means that the color of each point does not 
depend on the colors of neighboring points; OPT means that 
there are some restrictions on the display kartinku.Poslednee 
number in the line - number  screens.


   Some of the modes contain other
regimes as podmnozhestva.Esli shows the number of
colors, you can always use less
;).

        Standard screen

        MC 1x8

        MC 2x8

        MC 4x8

     83-color / 2 (Mortal Kombat)

     83-MC 1x8 / 2

     83-MC 2x8 / 2

     83-MC 4x8 / 2

      8 COL 64x192 (MULTDEMO)

      8 COL 64X96 (ECHOLOGY)

      8 COL 64X48 (EYE ACHE)

      8 COL 32x48

      8 COL 64X24 (WOLFDEMO)

     64 COL 64x192 / 2

     64 COL 64x96 / 2

     64 COL 64x48 (EYE ACHE 2)

     64 COL 32x128 (EYE ACHE 2)

    256 COL 64x48 / 2 (4R, 4G, 4B, 4W)

    512 COL 64x48 / 2 (8R, 8G, 8B)

     64 COL 32x24 (VIBRATIONS)

      2 COL 512x192 / 2

      3 OPT 256x192

      4 COL 256x192 / 2

      5 OPT 256x192 / 2

      8 COL 256X192 / 3

     16 COL 128x96 / 2 (RGBW)

     81 COL 128x96 / 2 (3R, 3G, 3B, 3W)

    256 COL 128x96 / 2 (4R, 4G, 4B, 4W)

      4 COL 128x96 / 2 (EYE ACHE)

     22 COL 128x96 / 2 (colored dots)

      4 COL 256X96

      8 OPT 128x192 (3 colors for 4 points)

      8 OPT 128X96 (EYE ACHE 2)

     15 OPT 96x96

     83 OPT 96x96

      5 GREY 128x96

      Seven GREY 128x64 (everyone goes

      7 GREY 86x96 crazy in their own way ...)

      9 GREY 64x96

      9 GREY 128x48

     10 GREY 86x64 (SHIT 4 BRAIN)

      Seven GREY 128x96 (in multicolor)

      September BLUE 128x96 (with a blue tint)

     17 GREY 64X48 (chunks)


   It is possible that I forgot something or
overlooked. If so, then let me know
about this, please.



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

Similar articles:
Diploma - Diploma Alone Coder-a. Development of software for special logic analyzer. Part 2.
Archive - On programs for existing PC "ZX-SPECTRUM": AMAUROTE, ATIC ATAC, ALIEN HIGHWAY, ACE 2088, RESCATE ATLANTIDA part 1 & 2.
authors say - April Fools issue.
little about yourself - Energy Group Welcomes You!

В этот день...   30 April