Adventurer #08
31 августа 1998

Exchange of experience - The movement procedure of attribute labels in pixels (floating atrubuty).

<b>Exchange of experience</b> - The movement procedure of attribute labels in pixels (floating atrubuty).
     (C) Ivan Roshchin, Moscow, 1998


     If you've seen "ART VISION" demo,
remember that in the last part there
moving attribute the inscription "intel
outside ". Since the label attribute, then
and moves it in increments of 8 pixels (1 familiarity), which 
looks very nice. I wrote a program that essentially implements 
the same Full-screen, fit into an interrupt "effect, but is now 
moving - pixel by pixel, which looks incomparably better. This 
program has a detailed commentary, so that it does not 
understand be easy.


     If you want to see how
This effect appeared in the original "-
simply remove the program from two lines
marked with "*".

     Picture size 64 * 64 familiarity
taken from the "ART VISION" demo and is in
array PICTURE. Each familiarity is encoded by a single bit, 
thus the whole Image is 512 bytes.


     The trajectory of motion is given with an array of CRDS, 
which contains 100 elements of the form:



     1 byte - offset (familiarity)
the left side of the fragment relative to the left border of 
the picture (see fig.) 

     1 byte - offset (in pixels, in
modulo 8) the left side of the fragment relative to the left 
border of the picture. 

     1 byte - offset (familiarity)
the upper hand with respect to fragment
the upper limit of the picture.

     1 byte - offset (in pixels, in
modulo 8) the upper side of the fragment relative to the upper 
boundary of the picture. 


                    > X

                       whole picture



                       inferred

                       fragment



 y


     The number of elements in the array and their
values ​​can be changed, thereby setting a new trajectory.

   So here's the program itself:


        CALL MAKEADR; Preparing ...

        CALL UNPACK

        CALL CLS

M1 LD IX, CRDS; address table

        LD D, 100; number of coordinates

                         ; Table
M2 LD BC, 4

        LD A, (IX); Take

        LD (XATR), A; coordinates

        LD A, (IX +1); output window

        LD (XPIX), A; *

        LD A, (IX +2)

        LD (YATR), A

        LD A, (IX +3)

        LD (YPIX), A; *



        ADD IX, BC; enlarge. Address

        PUSH IX

        PUSH DE

        CALL OUTSCR; Displays

        POP DE

        POP IX


        XOR A

        IN A, (254)

        CPL

        AND 31; If something

        RET NZ; pressed, exit



        DEC D; continue ...

        JR NZ, M2

        JR M1

;***************************************
, Proc. OUTSCR displays a fragment
; Pictures.
; Login: XATR, XPIX - shift left
; Of the fragment in relation
; The left border of the picture (XATR * 8 + XPIX
; Pixels);
; YATR, YPIX - displacement of the upper hand
; Fragment relative to the upper boundary
; Pictures.

OUTSCR DI

        LD (TO_Q +1), SP; have preserved SP

        LD SP, TAB_SCR

; SP indicates the start address table
; Of the screen. Each execution
; Team POP from the stack address is removed
; The next line.


        LD A, (XPIX)

        ADD A, A

        ADD A, A

        ADD A, A

        ADD A, A

        ADD A, # 80

        LD H, A

        LD L, 0

        LD A, (YATR)

        LD D, A

        LD E, 0

        SRL D

        RR E

        SRL D

        RR E

        ADD HL, DE

        LD D, 0

        LD A, (XATR)

        LD E, A

        ADD HL, DE


        POP DE; # 4000

        LD BC, - # 10

        EX DE, HL

        ADD HL, BC

        EX DE, HL

        LD (LP4 +1), DE

; HL points to a string image;
; DE - the address in memory where
; To forward this line
, (In this case is the highest
; Line screen with the address # 4000).


        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

; Forward the remaining (7-YPIX) line:


        LD (HL_S1 +1), HL


        LD A, (YPIX)

        LD B, A

        LD A, 7

        SUB B

        JP Z, SCRH

LP4 LD HL, 0

        POP DE

        LD BC, - # 10

        EX DE, HL

        ADD HL, BC

        EX DE, HL

        LD (LP4 +1), DE

        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

        DEC A

        JP NZ, LP4

, Now has 23 times forward the on 8 pages

SCRH LD YL, 23; Counter
HL_S1 LD HL, 0; address next

        LD BC, # 40; forwarded

        ADD HL, BC; line

        LD (HL_S1 +1), HL

, Prepares to transfer the address:


        EX DE, HL; have preserved HL

        LD C, # 1910

        POP HL; where to send

        LD (SP_0 +1), HL

        ADD HL, BC

        LD (SP_01 +1), HL

        POP HL; On the line below

        LD (SP_1 +1), HL

        ADD HL, BC

        LD (SP_11 +1), HL

        POP HL; On the line below

        LD (SP_2 +1), HL

        ADD HL, BC

        LD (SP_21 +1), HL

        POP HL; On the line below

        LD (SP_3 +1), HL

        ADD HL, BC

        LD (SP_31 +1), HL

        POP HL; On the line below

        LD (SP_4 +1), HL

        ADD HL, BC

        LD (SP_41 +1), HL

        POP HL; On the line below

        LD (SP_5 +1), HL

        ADD HL, BC

        LD (SP_51 +1), HL

        POP HL; On the line below

        LD (SP_6 +1), HL

        ADD HL, BC

        LD (SP_61 +1), HL

        POP HL; On the line below

        LD (SP_7 +1), HL

        ADD HL, BC

        LD (SP_71 +1), HL

        LD (PUT_SP +1), SP; Save. SP



        EX DE, HL; recuperated HL

        LD BC, - # 20

        ADD HL, BC

        LD SP, HL

        POP AF; took the first

        POP BC; 16 bytes

        POP DE; forwarded

        POP HL; line

        EXX

        POP BC

        POP DE

        POP HL

        POP IX

        LD (TWO +1), SP

SP_0 LD SP, 0; write down their

        PUSH IX; screen

        PUSH HL; in 8 neighboring

        PUSH DE; lines

        PUSH BC

        EXX

        PUSH HL

        PUSH DE

        PUSH BC

        PUSH AF

        EXX
SP_1 LD SP, 0

        PUSH IX

        PUSH HL

        PUSH DE

        PUSH BC

        EXX

        PUSH HL

        PUSH DE

        PUSH BC

        PUSH AF

        EXX
SP_2 LD SP, 0

        PUSH IX

        PUSH HL

        PUSH DE

        PUSH BC

        EXX

        PUSH HL

        PUSH DE

        PUSH BC

        PUSH AF

        EXX
SP_3 LD SP, 0

        PUSH IX

        PUSH HL

        PUSH DE

        PUSH BC

        EXX

        PUSH HL

        PUSH DE

        PUSH BC

        PUSH AF

        EXX
SP_4 LD SP, 0

        PUSH IX

        PUSH HL

        PUSH DE

        PUSH BC

        EXX

        PUSH HL

        PUSH DE

        PUSH BC

        PUSH AF

        EXX
SP_5 LD SP, 0

        PUSH IX

        PUSH HL

        PUSH DE

        PUSH BC

        EXX

        PUSH HL

        PUSH DE

        PUSH BC

        PUSH AF

        EXX
SP_6 LD SP, 0

        PUSH IX

        PUSH HL

        PUSH DE

        PUSH BC

        EXX

        PUSH HL

        PUSH DE

        PUSH BC

        PUSH AF

        EXX
SP_7 LD SP, 0

        PUSH IX

        PUSH HL

        PUSH DE

        PUSH BC

        EXX

        PUSH HL

        PUSH DE

        PUSH BC

        PUSH AF

        EXX

TWO LD SP, 0

        POP AF; took second

        POP BC; 16 bytes

        POP DE; forwarded

        POP HL; line

        EXX

        POP BC

        POP DE

        POP HL

        POP IX

SP_01 LD SP, 0

        PUSH IX; Write ...

        PUSH HL

        PUSH DE

        PUSH BC

        EXX

        PUSH HL

        PUSH DE

        PUSH BC

        PUSH AF

        EXX
SP_11 LD SP, 0

        PUSH IX

        PUSH HL

        PUSH DE

        PUSH BC

        EXX

        PUSH HL

        PUSH DE

        PUSH BC

        PUSH AF

        EXX
SP_21 LD SP, 0

        PUSH IX

        PUSH HL

        PUSH DE

        PUSH BC

        EXX

        PUSH HL

        PUSH DE

        PUSH BC

        PUSH AF

        EXX
SP_31 LD SP, 0

        PUSH IX

        PUSH HL

        PUSH DE

        PUSH BC

        EXX

        PUSH HL

        PUSH DE

        PUSH BC

        PUSH AF

        EXX
SP_41 LD SP, 0

        PUSH IX

        PUSH HL

        PUSH DE

        PUSH BC

        EXX

        PUSH HL

        PUSH DE

        PUSH BC

        PUSH AF

        EXX
SP_51 LD SP, 0

        PUSH IX

        PUSH HL

        PUSH DE

        PUSH BC

        EXX

        PUSH HL

        PUSH DE

        PUSH BC

        PUSH AF

        EXX
SP_61 LD SP, 0

        PUSH IX

        PUSH HL

        PUSH DE

        PUSH BC

        EXX

        PUSH HL

        PUSH DE

        PUSH BC

        PUSH AF

        EXX
SP_71 LD SP, 0

        PUSH IX

        PUSH HL

        PUSH DE

        PUSH BC

        EXX

        PUSH HL

        PUSH DE

        PUSH BC

        PUSH AF

        EXX

PUT_SP LD SP, 0; Rest. SP

        DEC YL; decrements

        LD A, YL

        AND A

        JP Z, END_ML; They took 23 lines

; Once brought 12 lines, waiting
; Interruption. It is necessary to synchronize
; With the progress of the beam. When the beam draws the top
; Of the screen, the program displays
; Image at the bottom, and vice versa.


        CP 12

        JP NZ, HL_S1

        LD HL, 0

        ADD HL, SP

        LD SP, (TO_Q +1)

        PUSH IY

        LD IY, # 5C3A

        EI

        HALT

        DI

        POP IY

        LD SP, HL

        JP HL_S1

; If YPIX <> 0, to derive the last
; Line at the bottom of the screen:

END_ML LD A, (YPIX)

        AND A

        JP Z, TO_Q


        LD HL, (HL_S1 +1)

        LD BC, # 20

        ADD HL, BC

        POP DE

        LD BC, - # 10

        EX DE, HL

        ADD HL, BC

        EX DE, HL

        LD (LP5 +1), DE

        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

; Forward the remaining rows:


        LD A, (YPIX)

        DEC A

        JP Z, TO_Q

        LD B, A

LP5 LD HL, 0

        POP DE

        LD BC, - # 10

        EX DE, HL

        ADD HL, BC

        EX DE, HL

        LD (LP5 +1), DE

        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

        DEC A

        JP NZ, LP5

TO_Q LD SP, 0; recuperated SP

        LD IY, # 5C3A ;---/--- IY

        EI

        RET; Exit Procedure

;***************************************
, Proc. MAKEADR creates a table
; Addresses of all 192 lines of screen
, In which each address is increased by # 10.
; Address Table - TAB_SCR.

MAKEADR LD HL, TAB_SCR

        LD DE, # 4010

        LD B, 192

LP_MAKE LD (HL), E

        INC HL

        LD (HL), D

        INC HL

        CALL DOWN_DE

        DJNZ LP_MAKE

        RET

DOWN_DE INC D

        LD A, D

        AND 7

        RET NZ

        LD A, E

        SUB # E0

        LD E, A

        RET NC

        LD A, D

        SUB 8

        LD D, A

        RET

;***************************************
, Proc. UNPACK Unpack the picture
To the address on the PICTURE # 8000 - # FFFF

UNPACK LD HL, # 8000

        LD DE, PICTURE
LP_UP1 LD B, 8

        LD A, (DE)
LP_UP2 RLA

        LD C, # FF

        JR C, TO_MEM

        LD C, 0
TO_MEM LD (HL), C

        INC HL

        DJNZ LP_UP2

        INC DE

        LD A, H

        CP # 90

        JR NZ, LP_UP1


        LD HL, # 8FFF

        LD DE, # 9FFF

        AND A

        PUSH AF

LP_UP3 POP AF

        LD A, (HL)

        RLA

        PUSH AF

        LD (DE), A

        DEC HL

        DEC DE

        LD A, L

        CP # FF

        JR NZ, LP_UP3

        LD A, H

        AND # 0F

        CP # 0F

        JR NZ, LP_UP3

        LD BC, # 2000

        ADD HL, BC

        EX DE, HL

        ADD HL, BC

        EX DE, HL

        LD A, D

        CP # 0F

        JR NZ, LP_UP3

        POP AF

        RET

;***************************************
, Proc. CLS sets the attributes:


CLS LD HL, # 5800

        LD (HL), 5

        LD DE, # 5801

        LD BC, # 2FF

        LDIR

        RET

;****************************************
; Picture # 40x # 40 = # 1000 # bit = 200 bytes

PICTURE

      DB # 00, # 00, # 00, # 00, # 7F, # F0, # 00, # 00

      DB # 00, # 00, # 00, # 1F, # FF, # FF, # 80, # 00

      DB # 00, # 00, # 00, # 7F, # FF, # FF, # E0, # 00

      DB # 00, # 00, # 03, # FF, # FF, # FF, # FC, # 00

      DB # 00, # 00, # 1F, # FF, # FF, # FF, # FE, # 2000

      DB # 00, # 00, # 3F, # FF, # FF, # FF, # FE, # 2000

      DB # 00, # 00, # FF, # FE, # 1F, # FF, # FC, # 00

      DB # 00, # 01, # FF, # F0, # 03, # FF, # FC, # 00

      DB # 00, # 07, # FF, # 00, # 00, # 1F, # F8, # 00

      DB # 00, # 0F, # F8, # 00, # 00, # 0F, # F8, # 00

      DB # 00, # 1F, # C0, # 00, # 00, # C1, # F0, # 00

      DB # 00, # 3F, # 00, # 18, # 00, # E0, # 70, # 00

      DB # 00, # 7E, # 00, # 18, # 01, # E0, # 20, # 00

      DB # 00, # F0, # 00, # 18, # 01, # E0, # 00, # 00

      DB # 01, # F0, # 01, # FF, # 81, # C0, # 04, # 00

      DB # 03, # E7, # 03, # FF, # 31, # C0, # 0E, # 00

      DB # 03, # C7, # 00, # 1C, # 79, # C0, # 0F, # 00

      DB # 07, # 87, # 00, # 18, # F9, # C0, # 0F, # 80

      DB # 0F, # 00, # 5E, # 19, # 99, # C0, # 1F, # C0

      DB # 0F, # 0E, # 7E, # 19, # 99, # C0, # 1F, # C0

      DB # 1E, # 0E, # 67, # 39, # B1, # C0, # 3F, # F0

      DB # 1C, # 0E, # 67, # 31, # B1, # C0, # 3F, # F0

      DB # 1C, # 0C, # 67, # 33, # E1, # C0, # 0F, # F8

      DB # 38, # 0C, # 67, # 33, # C1, # C0, # 07, # F8

      DB # 30, # 1C, # 67, # 33, # 89, # C0, # 03, # F8

      DB # 30, # 18, # 67, # 31, # 99, # 80, # 01, # FC

      DB # 30, # 18, # 67, # 31, # 99, # 80, # 00, # FC

      DB # 60, # 18, # 07, # 31, # F1, # 80, # E0, # 7C

      DB # 60, # 18, # 03, # 30, # E1, # 80, # E0, # 7E

      DB # 60, # 00, # 00, # 30, # 00, # 00, # E0, # 3E

      DB # E0, # 00, # 00, # 00, # 00, # 00, # E0, # 3E

      DB # E0, # 00, # 00, # 00, # 00, # 00, # E0, # 1E






Other articles:

From the Author - help: New bugs in the new shell.

From the Author - the author: about the authors of the magazine.

Presentation - Content of the program: Installer to AUTORUN DISK v2. 0 adventyurnaya game Diamond.

Presentation - a program for protecting programs TRICK v1. 003b.

Presentation - HELP Z_80: User's Guide.

Interface - letters from readers: Black Raven, The Secret Game NEW DIZZY, On the errors of the game APOLLO, a new debugger Veros STS 6.2, How to beat the game Svyatogor.

Interface - PC vs Amiga: Is AMIGA RULEZ? First impressions neophyte.

Interface - support for producers of "iron" their "creations" after they (the creatures) get into the hands of users.

Interface - thinking out loud: "SPECCY computer for young people. If we have so many cool coders, why so little steep domestic soft'a?"

Interface - pens from CAV inc: "SPECCY it does not work, this rest is, even more than the rest, it's a lifestyle, and if by that you still manage to get the money. .. "

Interface - SPECCY pros and cons, Reflections Spy / Eternity Industry.

System - Overview of system programming: ZX-IBM Editor v1.5M, PPF v1.05, Multistudio v2.0p, Mods Player v2.0, Bitmap Viewer v2.0, Corrector v2.0, Storm v1.1, 866 v1.2, HRUM v3.5, TDU v1.0, HRUST v1.0, RLE-Compressor v1.21, Overlays Consul Commander.

Toy Review - An overview of new gaming software: Rabbit Jazzy, Quadrax, Komplex, Math of the day, Cue Boy, Zly Sen, Prva Aakcia, Outlaw, The Dark Empire, Gary Linekers.

Toy Review - Demos: Little Ghost, The Dark Empire, Worms, Smagli 3 Monster Land, Civilization, Mysteries of Captain Shelton.

Guests - Presentation of a group of Kovrova - Eternity Industry.

Guests - Filix about creating games Winnie The Pooh-2.

Guests - ekstremalschiki: new section which highlights aspects of the life and work of extreme Rybinsk musicians. Today, a visit Marat and Demon - stood at the origins of such well-known (in the narrow circles) team "Disgust".

Promotion - How to play the game Encyclopedia of WAR.

Promotion - the passing game Where time Stood Still.

Promotion - description of the game Elopement: back to the Earth.

Promotion - the passage of text adventyury Island of Darkness (Island Darkness).

Promotion - the passage of text adventyury Knightmare.

Exchange of experience - Russian glitches: The Island of Darkness Game (how NOT to write adventyurnye game).

Exchange of experience - Finalization ZX-ASM v3.0 by Ivan Roshchina.

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

Exchange of experience - Graphic effect IRIS (plasma).

Exchange of experience - the procedure output window frame.

Exchange of experience - on how to operate in the assembly with the long numbers of type Long.

Exchange of experience - Art Studio and the principle of open architecture (how to write their own modules to the editor).

Exchange of experience - The movement procedure of attribute labels in pixels (floating atrubuty).

Ottyag - A Tale of Pentium Pentiumovicha Pentiumova. 20 things you can do if your favorite team lost on the road. Toilet, as a measure of human values.

Ottyag - Test "Formatsevt, check for authenticity."

Ottyag - Test "You are not dumb ass."

Ottyag - The test "Do you have a sense of humor."

Ottyag - Test "Which of your student."

Ottyag - How to PROPERLY kill Windows'95.

Ottyag - Winnie the Pooh and all-all-all - 2.

Novella - Tales Corporal Djilali (the game Laser Squad).

Novella - Escape from Space (the game Elite).

Novella - Hedgehogs mutants.

News - News from the Rybinsk spektrumistov: Infosoft, Shrsoft, Surgeon, Chasm, Protecvision, Groboclone, Volume 4, Experience, Mr. Vano, Ant, Demon, Miguel, Veka, RDM, Auryn.

News - News from the Yaroslavl spektrmistov: Marchy, Kav Software, Nicolas Viper, Dr Shura, Harkonnen, MacKeymn, DJ Reason.

Advertising - advertising and announcements.


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

Similar articles:
Miscellaneous - the history of creation of ZXNet.
INTRO - Brad what else.

В этот день...   21 November