ZX Review #3-4
22 июля 1997

Studies - I. Roshchin. Two graphic effect.

<b>Studies</b> - I. Roshchin. Two graphic effect.
(C) Ivan Roshchin, Moscow, 1996.


    Bring to your attention
two procedures, native,
realizing the beautiful and unusual
effects (at least to me
these do not have to see).

    Before the first procedure on the screen should be any 
picture. You will see how this picture changes gradually. To 
leave enough press any key.


    This effect, you can use in your program, for example: if a 
user does not press for a long time on the keys, store the 
contents of display area and start the procedure. As soon as 
any key is pressed, restore the image on the screen (by the 
way, this can help the second procedure). 

    This procedure is easy to change. Try these
places to put the CALL
SET_0 or CALL SET_1 and see what happens.


    Here is the text of the procedure for
Assembler:
148.
EFFECT LD HL, 0; ADDRESS ROM

        LD (ADR_ROM), HL

, GET IN DE random coordinates
; The next point and retained in memory:

NEXT_X LD HL, (ADR_ROM)

        LD B, (HL); X coordinate

        INC HL

        LD A, R

        XOR B

        LD R, A

        LD D, A

NEXT_Y LD B, (HL); Y coordinate

        INC HL

        LD A, R

        XOR B

        CP 191

        JR NC, NEXT_Y

        LD E, A

        LD (KRDS), DE

        LD (ADR_ROM), HL

        LD A, (HL)

        PUSH AF


        CALL GET_P; find the color of this point (0 .. 1)

        LD (COL), A

; CHOOSE direction in which
, Is the second point, and knew her
; CONTACT:


        POP AF

        AND 3 NUMBER OF 0 .. 3 ROOM AREAS

        LD HL, TABLE

        LD B, 0

        LD C, A

        ADD HL, BC

        LD A, (HL); ON HOW TO CHANGE Y

        PUSH AF

        LD BC, 4

        ADD HL, BC

        LD A, (HL); ON HOW MUCH X


        ADD A, D

        LD D, A

        POP AF; ON HOW Y

        ADD A, E

        LD E, A

        CP 192

        JR NZ, NE_192

        LD E, 190
NE_192 CP # FF

        JR NZ, X_OK

        LD E, 1

X_OK CALL GET_P; find the color of second point

        LD IX, COL; compares it with the color of the first 
POINT 

        CP (IX); if they are identical,

        JR Z, H_OK; CHANGE THE POINT OF SITES ARE NOT NECESSARY.


        PUSH DE; SAVE. Coord. The second point

        LD DE, (KRDS); DRAW this color first point


        CP 0; THESE 5 teams can be replaced by

        PUSH AF; TEAM OR CALL SET_0

        CALL Z, SET_0; CALL SET_1, The observed

        POP AF; EFFECT CHANGE.

        CALL NZ, SET_1


        POP DE; RESET. COORDINATES OF THE SECOND POINT


        LD A, (COL); THESE 6 commands can be replaced by

        CP 0; TEAM OR CALL SET_0

        PUSH AF; CALL SET_1, The observed

        CALL Z, SET_0; EFFECT CHANGE.

        POP AF

        CALL NZ, SET_1


        LD A, (ADR_ROM +1); CHECK not been reached

        AND # 1F; LIMITING ADDRESS

        LD (ADR_ROM +1), A; in the Spectrum ROM.

H_OK LD A, 0; Checks you have pressed

        IN A, (# FE); ANYTHING on the keyboard.

        AND% 00011111

        CP% 00011111

        JP Z, NEXT_X

        RET; IF YES, output.

SET_1 CALL BYTE

        LD B, (HL)

        OR B

        LD (HL), A

        RET

SET_0 CALL BYTE

        LD B, # FF

        XOR B

        LD B, (HL)

        AND B

        LD (HL), A

        RET

GET_P CALL BYTE

        LD B, (HL)

        AND B

        CP 0

        RET Z

        LD A, 1

        RET

BYTE PUSH DE

        LD A, E

        AND A

        RRA

        SCF

        RRA

        AND A

        RRA

        XOR E

        AND # F8

        XOR E

        LD H, A

        LD A, D

        RLCA

        RLCA

        RLCA

        XOR E

        AND # C7

        XOR E

        RLCA

        RLCA

        LD L, A

        LD A, D

        AND 7

        LD B, A

        INC B

        LD A, 1
LOOP RRCA


        DJNZ LOOP

        POP DE

        RET

KRDS DW 0; CONTACT POINT
COL DB 0; COLOR POINT
TABLE DB 0, # FF, 0,1

        DB 1,0, # FF, 0
ADR_ROM DW 0
2


   The second procedure is designed to display images on the 
screen. Before its launch in the register

HL pair to specify the address of the picture.

   Here is the text of the procedure for
Assembler:
148.
DEMO LD HL, # C000; ADDRESS The output PICTURES

        CALL EFFECT

        RET

; TREATMENT EFFECT implement the findings
; PICTURES ON SCREEN.
; ENTRY: HL-ADDRESS The output PICTURES.
; When you call the interrupt is to be
; Allowed!

Q EQU 7; Q can be changed
Q_2 EQU Q * Q; range [1 .. 8], from its

                        ; Value depends EFFECT.

EFFECT LD DE, # C000; SET ADDRESSES

        ADD HL, DE; IN PROCEDURE

        LD (ADR1 +1), HL

        LD D, # 58; File Transfer

        ADD HL, DE; Attributes.

        LD BC, # 300

        LDIR; THEN E = 0.

        LD D,-Q_2; D-current line number.

, The Register E-How many rows processed (YET 0).

LOOP1 HALT; DELAY

        LD BC, Q +1 * 256 + Q_2; B-COUNTER, C-SHIFT

LOOP2 LD A, D; current line number

        ADD A, C; add an offset

        CP 192; If the number is more rows 192,

        JR NC, NEXT; miss it.


        EXX

        CALL ADR_STR; otherwise you'll ADDRESS LINES
ADR1 LD BC, 0

        ADD HL, BC; in HL-ADDRESS BUFFER

        LD BC, # 20, THE LENGTH OF A LINE

        LDIR; brought to SCREEN.

        EXX; Increases the number of

        INC E; rows processed

NEXT LD A, C; REDUCE THE OFFSET

        SUB Q

        LD C, A

        DJNZ LOOP2; repeat the cycle.


        INC D; INCREASED NUMBER TEK.STROKI

And if it is divisible by (Q +1), increment it by Q


        LD B, 0; COUNTER (256 Reprise)

        LD A, D; checking of
LOOP3 SUB Q +1; Subtracts DIVIDED

        JR Z, DEL; If you receive a 0, ie Divisible

        DJNZ LOOP3; continue ...

        JR M12; If number is not divisible

DEL LD A, D; increment

        ADD A, Q; Current Line

        LD D, A; on Q.

M12 LD A, E; how many lines deduced?

        CP 192; 192 LINES ALREADY?

        JR NZ, LOOP1; If Not, Conclusion.

        RET

;
; PROCEDURE ADR_STR
; LOG: A-line number (0 .. 191)
; EXIT: HL, DE-ADDRESS DISPLAY FILE.

ADR_STR LD E, A

        AND A

        RRA

        SCF

        RRA

        AND A

        RRA

        XOR E

        AND # F8

        XOR E

        LD H, A

        XOR A

        XOR E

        AND # C7

        XOR E

        RLCA

        RLCA

        LD L, A

        LD E, A

        LD D, H

        RET
2
********************************






Other articles:

TR-DOS for beginners - Part 1.

Authoring - General Sound - Multimedia for the ZX Spectrum!

Business Card - Introducing the new electronic journal "Major Wares" (c) Codebusters & VMG

Computer novella - Knight Lore "legends of chivalry times."

New Programs - I. Roshchin. HELP_Z80. Davydov. Catalog's Base v1.8.

description of the shell of the journal "ZX-REVIEW"

Crossing Dragon - Aavlon, Castle of Dreams, Erik the Viking.

Crossing Dragon - Eureka!, Eye of Bain, Kentilla.

Crossing - Sherlock, Apollo, Shadows of Mordor, Rigels Revenge, Temple of Terror, ID, That's the Spirit, Return to Ithaka.

Retro - Dzh.Hardman, E. Hyuzon. Top 40 procedures.

Expert Tips - Castle Master.

Expert Tips - Firelord.

Expert Tips - Stonkers.

Forum Games - Insult Megademo, Catch 23, Livingstone, Rock Star ate my Hampster, UFO-2: Devils of the Abyss, Terminator 2, Venturama, The Spririts, Nipper, Sweewo'S World, King's Bounti -2, Hacker 2, Black Magic, Satcom, Star Heritage.

Forum - A. Gura. Code programmer.

Forum - A. Strelnikov. Prospects of development of ZX Spectrum.

Forum - Davydov. According to materials published in the ZX-REVIEW: Some issues related to autostart BASIC programs. Redefine Keys. How to print 42 characters per line. The procedure of multiplication HL = B * C. Refinement cloning downloaders. Mini-driver disk.

Forum - With 'Light'. Music processor ZX-Speccy.

Forum - Dmitry Fyodorov: Print images with a mask with pixel precision. Algorithm for calculating the address coordinates to within a pixel.

Forum - I. Roshchin. Sharing ZX ASM 3.0 and STS 5.1.

Forum - M. Bekarev. The calculation of the address display area of familiarity, and vice versa.

Forum - VP Fedin. Refinement Profi for conflict-free peripheral connectivity.

Forum - S. Astrov. Pseudorandom number generator.

reader-reader - V. Sirotkin. Protection program (look at the problem).

reader-reader - I. Roshchin. Display driver for the computer, "Pentagon-128.

Studies - A. Savinov: The procedure for displaying a double-height characters. Procedure "dissolution" of characters.

Studies - A. Urzha. The procedure for drawing a circle.

Studies - V. Sirotkin. Program checksum.

Studies - E. Volchkov. Improvement routines address calculation system on display file.

Studies - E. Frost. Running line.

Studies - I. Komandin. The program display screen.

Studies - I. Roshchin. Two graphic effect.

Studies - M. Lazutov: The modernization program font. Program encode / decode block codes. The effect of the attributes.

Studies - O. Smolyankin: Procedures for cleaning the screen. Output of text messages on the screen.


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

Similar articles:
Foreword - a story about the gathering of fans of AD & D.
Events - A report by visiting the St. Petersburg party CHAOS CONSTRUCTION'2000 from weIrd.
Pro-overview - insanity # 9 review: "This number though was not initially expect me as scandalous, but after such has become. Personally, I have stayed if not beaten to death, then at As maimed "

В этот день...   4 May