ZX Review #11-12
26 ноября 1997

Studies - Useful tips. Rapid transfer of your screen.

<b>Studies</b> - Useful tips. Rapid transfer of your screen.
   And now - a few useful
Boards of music lovers
DEMO:

   EYE ACHE 2 - if, during
podgruzki from CD music begins to slow down, try to rewrite the 
program to disk with alternating sectors = 1 (be sure to start 
disk!) 

   RAGE - when you start holding down SPACE
(Or run in a mode of 48K), you can read the interesting text, 
which contains a few tips for beginners demomeykeram.



           *

(C) Ivan Roshchin, Moscow, 1997


   Rapid transfer of screen


   It is known that the transfer of content on-screen memory (# 
1800 bytes) took more time

than the interval between two interrupts. Nevertheless, if
image should not change
every 1 / 50 seconds, and at least
every 1 / 25 seconds, there is a way
so do shipping, that while the beam draws the current frame - we
see the first picture, when the beam
draws the next frame - we see
already the second picture.

   Consider what the
this way. Let the memory
(# 4000 - # 5800) is the first
picture. After the arrival of the pulse
interrupts the beam begins to draw
image, starting from the top
edge of the screen, draws the border and in
eventually draws the most
upper row of the small screen.


                        \

          border



                          television

       small screen display



                        /


   It was then that we begin to throw out the second picture
buffer in video memory, in strict
the same manner as it is portrayed on the screen (ie, along the 
lines, from top to bottom). Since the beam forms an image faster

What we update the content of video memory, the display will 
shows the first image. 

   The transfer of images continues until the ray Tracings
the entire screen. Calculate how much
It will take time: full screen -
320 lines, the upper part of the border - 80 rows, and another 
line We especially missed. Because

while drawing a single line -
224 cycles, we get (320-81) * 224
= 53,536 cycles. During this time, of course, completely 
refresh the video memory does not work, but it's still is not 
necessary. 

   Once the beam Tracings entire screen, proceed as follows 
pulse interrupt, and starts draw in the next frame.

While the beam draws the upper part of
border and the upper part of small
screen (ie, already the second picture), we are not wasting any 
time, throws in a video memory the remainder of the second 
picture. The transfer must be completed before such time as the 
beam begins to draw the bottom line of the small screen, ie, 
transfer procedure shall be packed in 53,536 + (80 +

192-1) * 224 = 114240 cycles. And that is abundantly sufficient 
for even transferring pictures, along with the attributes (in 
this case, the procedure must be forwarded to the queue 8 lines 
of image and attributes for these 8 lines).


   This calculation for "Pentagona128. Corporate Spectrum 
differs from it by the following parameters: the upper part of 
the border is 64 rows instead of 80 and

on the screen 312 rows instead of 320.
Procedure to transfer work on it, it should take no more than 
(312-81) * 224 + (64 + 191) * 224 = 108864 cycles. But this

still lacking, even considering that the write / read memory 
ULA slow processor. But if the processor, by contrast, will run 
faster (Turbocharged Spectrum) transfer procedure may not give

the desired result. To make it
function properly in this case, you need to make it "fit into 
the break, and accomplishes their work before it begins

drawn the bottom line of small screen).


   And now - two programs that perform the same task:
every 1 / 25 second, they change
screen color from white to black and
vice versa. The first program uses LDIR, while the other works
on the algorithm considered above. Feel the difference!


   Program 1:
140.

        LD HL, # 8000; 1-I picture

        LD (HL), 0

        LD DE, # 8001

        LD BC, # 17FF

        LDIR


        LD HL, # 9800, 2 nd picture

        LD (HL), # FF

        LD DE, # 9801

        LD BC, # 17FF

        LDIR

L1 HALT

        LD HL, # 8000

        LD DE, # 4000

        LD BC, # 1800

        LDIR

        HALT

        LD HL, # 9800

        LD DE, # 4000

        LD BC, # 1800

        LDIR


        XOR A

        IN A, (254)

        CPL

        AND 31

        JR Z, L1

        RET



   Program 2:

PIC1 EQU # 8000; 1-I picture
PIC2 EQU # 9800; 2-I picture


        LD HL, PIC1

        LD (HL), 0

        LD DE, PIC1 +1

        LD BC, # 17FF

        LDIR


        LD HL, PIC2

        LD (HL), # FF

        LD DE, PIC2 +1

        LD BC, # 17FF

        LDIR

; Building tables with addresses transfer:


        LD BC, PIC1-# 4000

        LD HL, TABL1

        LD DE, # 4000

        CALL MAKE_T

        LD BC, PIC2-# 4000

        LD HL, TABL2

        LD DE, # 4000

        CALL MAKE_T

; Main program loop:

LOOP1 LD HL, TABL1

        LD DE, BUFER +100

        LD BC, 192 * 4

        LDIR

        CALL MOVER


        LD HL, TABL2

        LD DE, BUFER +100

        LD BC, 192 * 4

        LDIR

        CALL MOVER


        XOR A

        IN A, (254)

        CPL

        AND 31

        JR Z, LOOP1

;--------------------------------------; Procedure directly 
MOVER ; Forwards:


MOVER HALT

; To avoid delays in processing
; Interrupt can be put here DI
, (Then at the exit from this procedure
; You need to put EI)


        LD (QUIT +1), SP

        LD SP, BUFER +100

; Delay until Tracings Line 1


        LD HL, 0

        LD DE, 0

        LD BC, # 330

        LDIR


        LD BC, # 1800

; We take from the stack the new values ​​of HL and DE,
, Pointing to the next line:

MMMM POP DE

        POP HL

TO_LDI LDI: LDI: LDI: LDI: LDI: LDI: LDI: LDI

        LDI: LDI: LDI: LDI: LDI: LDI: LDI: LDI

        LDI: LDI: LDI: LDI: LDI: LDI: LDI: LDI

        LDI: LDI: LDI: LDI: LDI: LDI: LDI: LDI


        JP PE, MMMM; continue ...

QUIT LD SP, 0

        RET

;--------------------------------------; MAKE_T procedure 
builds a plate: 

MAKE_T LD A, D

        CP # 58

        RET Z

        LD (HL), E

        INC HL

        LD (HL), D

        INC HL

        EX DE, HL

        ADD HL, BC

        EX DE, HL

        LD (HL), E

        INC HL

        LD (HL), D

        INC HL

        EX DE, HL

        AND A

        SBC HL, BC

        EX DE, HL

        INC D

        LD A, D

        AND 7

        JR NZ, MAKE_T

        LD A, E

        SUB # E0

        LD E, A

        JR NC, MAKE_T

        LD A, D

        SUB 8

        LD D, A

        JR MAKE_T

;--------------------------------------
TABL1 DS 192 * 4
TABL2 DS 192 * 4

; Stack for procedure
; Interrupt (if during
; Of percent. MOVER interrupt
; Banned, it is not needed):

BUFER DS 100

, "Disposable" address label lines
, (Broken handling procedures
; Interrupt needs to be updated):


        DS 192 * 4


           *







Other articles:

Authoring - S. Zonov, A. Larchenko. On the controller SMUC (HDD IBM and peripherals).

Computer novella - Warriors Stars (the game Shadowfire).

New Programs - Overview of Digital Studio v1.12, Digital Studio Compiler v1.01

New Programs - Xas Review editor-assembler 128K (v5.05).

New Programs - Review of Musical Instrument v3.01 editor

New Programs - Overview of programs and FASTzasm @-zasm.

New Programs - Overview of No Kempston.

professional approach - Algorithms for the construction and transmission of labyrinths.

laugh for no reason ... - Proceedings of the humor magazine SpectrofUn.

Expert Tips - Game FEUD.

Expert Tips - Game Killed Until Dead.

Expert Tips - Game War in Middle Earth.

Forum - Conversion of Spectrum color images at IBM. Conversion of B / W images from IBM's ZX Spectrum.

Forum - On the Russification of game programs.

Forum - The program detector emulator.

Forum - A procedure with colored stripes on the curb. " Noise Reduction FDD.

Forum - The transfer numbers in decimal form. Procedure - scanner password.

Forum - Unprotect Microprotector'a.

Forum - Emulators, which we choose: 'UKV Spectrum Debugger', 'Z80TRDOS'.

reader-reader - Driver input in serial mode and direct access from the files of TR-DOS.

Studies - Graphic effect "Plasma 2.

Studies - Graphic effect "Plasma 2.

Studies - Graphic effect "plasma".

Studies - Useful tips. Rapid transfer of your screen.

Studies - remake of the procedures in 1993.

Studies - The effect of "flame".


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

Similar articles:
ZXNet - regulations are to use the network SKY NET.
Presentation - On the new game genre Adventure "Ship of Doom".
INTRO - Anniversary Issue

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