Exchange of experience - Features video controller ZX Spectrum (for programmers).

Adventurer #08
     (C) Ivan Roshchin, Moscow, 1998

Features video controller ZX SPECTRUM


     What will be seen on the screen, if we write to the 
addresses # 4000 - # 57FF any information, and attributes 
reset? And if zero # 4000 - # 57FF and install PAPER equal to 
0, and INK how you like? Common sense suggests that in fact, 
and in another If we do not see anything at all. All

this is so, but the following program
proves the opposite.


         LD HL, # 5800

         LD (HL), L

         LD DE, # 5801

         LD BC, # 2FF

         LDIR

         LD HL, 0

         LD DE, # 4000

         LD BC, # 1800

         LDIR


         LD BC, # 7FFD

         LD A, # 17

         OUT (C), A


         LD HL, # C000

         LD (HL), L

         LD DE, # C001

         LD BC, # 17FF

         LDIR

         LD HL, # D800

         LD (HL), 7

         LD DE, # D801

         LD BC, # 2FF

         LDIR


         LD BC, # 7FFD
 M1 LD A, # 18

         OUT (C), A

         LD A, # 10

         OUT (C), A

         XOR A

         IN A, (254)

         CPL

         AND 31

         JR Z, M1

         RET


     This program fills in the 1 st screen contents ROM and 
resets the attributes (such way, the screen can not see 
anything), then clears the 2 nd screen and sets He attributes 
July INK, PAPER 0 (on 2-m screen can not see anything). The 
program then begins to rapidly switch between the 1 st and 2 nd 
screens, and here we see the following picture: 



             - - -

              - - -

               - - -

                - - -

                 - -

                  - -

            - - -



     Apparently, the following occurs: at
displaying an image on screen bytes from a screen memory, 
together with his attribute falls into a special shift register

but it may happen that the video controller will take a byte 
from the screen memory 1 screen, and then the program will 
switch the screen and the attribute byte is taken from the 
already 2 nd screen (or vice versa). In both cases, the screen 
shows white streaks. 

     I wonder whether this effect is observed
on other computers, but "Pentagona128? And the emulators? Can 
we find for it any use?



     Now we'll show you how I discovered this
effect. It was like this: I wrote a program
that show some picture on the
1-m screen, and then displays the following
Zoom in on the 2-m screen, and then again at
1-m, etc. Here's how this program works
(Active screen isolated double frame):


     1) A 1-m screen, some picture on the
2-m screen with another picture, hidden under
attributes INK 0, PAPER 0.



     2) Clear 1-th screen and set
7 INK, PAPER 0.



     3) Turn on the 2 nd screen, and on it at
moment, a horizontal white
line length of about 8 pixels.



                                 -



     4) After HALT 'and for the pictures on the 2-m
screen, set its attributes.



                   *