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

Studies - remake of the procedures in 1993.

<b>Studies</b> - remake of the procedures in 1993.
            ETUDES



Music by ZET and MITCHELL

(C) Kolotov Sergei g.Shadrinsk,
SerzhSoft, July, 1997


    Remake some of the procedures

            1993


   In the ZX-REVIEW-93 p. 121 was published procedure NM Stinova
called DOORS, realizing the effect of cleaning the screen by
moving apart pictures in hand. The procedure takes 101 bytes
and, frankly, is not written
very effectively. Used
alternative registers, but register as HL nowhere and is not 
saved, which makes it impossible call this procedure from 
BASIC. Applying command block Shipping and LDIR LDDR, managed

"Make friends" with new procedure
BASIC (good in her alternate registers are not generally used), 
more than halving the volume of memory and significantly 
improve performance. The new procedure also was completely 
moved. When cleaning the image on the screen set to the current 
system attributes of a cell 23693. That is, there is a 
possibility change the color right out of Basic

teams INK, PAPER, BRIGHT,
FLASH or directly by submitting the command POKE 23693, n 
before calling procedures RANDOMIZE USR adr.

Performing POKE adr +1, n (n = 1 .. 16),
You can set the number of
shifts to be performed in one run the procedure.
140.
; SCREEN-APART
3; (c) SerzhSoft, 11 july 1997
;

        ORG 60000; address assembly
;
ATTR_P EQU 23693; current attributes of the main screen
;
APART

        LD B, # 10, the number of pairs of shifts in the side 
of the screen LP_APR1 PUSH BC; store count changes on the stack


        LD A, (ATTR_P); A = attributes filled. after sdiga

        LD DE, # 5AFF; the last byte of attributes
LP_APR2 LD H, D; copied this address

        LD L, E; in HL and decreased to 1:

        DEC HL; address byte of the penultimate line

        LD BC, # 000F; shift: 15 bytes

        LDDR; shift in the right half-line right

        LD (DE), A; set the new value

        LD BC, # FFF2; correction of p-pa HL - now

        ADD HL, BC; indicates the second byte of the line

        LD E, L; DE = HL

        DEC E; first byte to the left of the line

        LD BC, # 000F; will move 15 bytes

        LDIR; shift left half-line to the left

        LD (DE), A; establish a new byte (clear)

        LD BC, # FFEF; correction register DE -

        ADD HL, BC; go one

        EX DE, HL; line up in the screen (attributes)

        BIT 3, D; if the attributes are not over,

        JR NZ, LP_APR2; something cool cycle

        XOR A; passed in Graphics

        BIT 6, D; if we have not yet got into the ROM

        JR NZ, LP_APR2; then continue to twist the loop

        POP BC; restore counter shifts

        DJNZ LP_APR1; twist cycle put the number of times

        RET; exit procedures
2

   Hex dump procedure APART:


    EA60: June 10 C5 3A 8D 5C 11 FF: 58

    EA68: 5A 62 6B 2B 01 0F 00 ED: A1

    EA70: B8 January 12 F2 FF 09 5D 1D: 99

    EA78: 01 0F 00 ED B0 December 2001 EF: 11

    EA80: FF 09 EB CB 5A 20 E2 AF: 1933

    EA88: CB 72 20 DD C1 10 D3 C9: 19

Saving: SAVE "arart.c" CODE
60000,48


   On page 35 ZX-REVIEW-93 was
published program of the shadow
Path. I was able to significantly improve the procedure for
Just rewrite it from scratch. The new procedure takes
138 bytes (old - 211 bytes) and
became relotsiruemoy. As before, to get a 
pseudo-three-dimensional image, rather identify attributes of 
high brightness places on the screen, which require shade and 
call the procedure SHADOW. It is possible to change the 
configuration of the most shade. For this necessary to change 
the values ​​in the Two teams load register pair DE, which are 
labeled asterisks. In the present

program are set
# 5500, # 5500, respectively,
gives shade with slightly rounded edges. Substituting # 2A80,
# AA80, we shade the direct
edges. To get the same
result as in the original
option, you must install
# AA00, # 2A80. But the values
# 7F80, # FF80 will show you a continuous, unprimed shadow.
140.
; SHADOW-PROCESSOR
3; (c) SerzhSoft, 11 july 1997
;

        ORG 60000; address assembly
SHADOW

        LD HL, # 5AFF; the last byte of attributes
LP_SHD1 LD BC, # 0020, the number of bytes in one line 
attributes 

        DEC HL; go to the previous attribute

        BIT 3, H; we have not "stopped" in the schedule?

        RET Z; if you have already, then exit procedure

        BIT 6, (HL); this attribute with high brightness?
LP_SHD0 JR Z, LP_SHD1; if not, then the previous attribute

        PUSH HL; attribute stores the address on the stack

        INC L; move to the next attribute

        LD A, L; test for transition

        AND # 1F; to the next line attributes

        JR Z, GO_SHD2; if yes, then jump

        BIT 6, (HL); included whether the brightness?

        JR NZ, GO_SHD2; if yes, then jump

        PUSH HL; attribute stores the address on the stack

        ADD HL, BC; the transition to an attribute on a line 
below 

        LD C, (HL); put this attribute in the register C

        POP HL; restore the address attribute

        LD A, H; calculation of addresses

        AND # 03; top line

        RLCA; familiarity

        RLCA; in the screen

        RLCA; for a given

        OR # 40; address in

        LD H, A; field attributes

        LD DE, # 5500 * way to create a shadow on the right *

        LD B, # 0C; shadow height: 12 pixels
LP_SHD2 LD A, E; shifted byte image of the shadow line

        AND # F0; discard the extra "right" bits

        OR (HL); impose the contents of the screen

        LD (HL), A; and write the new byte to the screen

        INC H ;---------------------------------
        LD A, H;

        AND # 07; standard

        JR NZ, GO_SHD0; sequence

        LD A, L; commands to move

        ADD A, # 20, on a line below

        LD L, A; in the display area

        JR C, GO_SHD1;

        LD A, H;

        SUB # 08;

        LD H, A ;--------------------------------- GO_SHD1 LD 
A, H; byte address into the graph 

        CP # 58; verification. to go beyond the boundaries of 
the screen 

        JR NC, GO_SHD2; if yes, then jump

        BIT 6, C; check brightness: can we image
        JR NZ, GO_SHD2; reap shadow. if not, then jump
GO_SHD0 SRL D; rotation of the image

        RR E; shadow line to the right

        DJNZ LP_SHD2; cycle the number of lines in the shadows
GO_SHD2 POP HL; restore the address attribute

        PUSH HL; attribute stores the address on the stack

        LD BC, # 0020, the number of bytes in one line 
attributes 

        ADD HL, BC; the transition to an attribute under the 
current 

        LD A, H; check the new address attribute

        CP # 5B; for joining the edge of the screen

        JR NC, GO_SHD4; if outside, then the transition

        BIT 6, (HL); if he enters the screen, but the brightness

        JR NZ, GO_SHD4; enabled, anyway - go

        INC L; next byte of attributes (right)

        LD C, (HL); put in the register C

        LD A, H; calculation of addresses

        AND # 03; top line

        RLCA; familiarity

        RLCA; in the screen

        RLCA; for a given

        OR # 40; address in

        LD H, A; field attributes

        LD DE, # 5500 * way to create shadows below *

        LD B, # 04; height of the shade lower
LP_SHD3 DEC L; back to byte back

        LD A, (HL); took bytes from the screen

        OR D; imposed bytes left of the image line

        LD (HL), A; the shadows and put back into the screen

        INC L; the transition to a byte to the right

        LD A, L; check out

        AND # 1F; for the right border of the screen:

        JR Z, GO_SHD3; if yes, then jump

        BIT 6, C; if the attribute with the brightness,

        JR NZ, GO_SHD3; it the same way - jump

        LD A, (HL); took bytes from the screen

        OR E; laid right bytes of the image line

        LD (HL), A; the shadows and put back into the screen
GO_SHD3 INC H; the transition to the next line

        SRL D; rotation of the image of one

        RR E; shadow line to the right

        DJNZ LP_SHD3; cycle the number of lines in the image of 
the shadows GO_SHD4 POP HL; restore the address attribute


        XOR A; mouth. Flag Z, to JR Z worked

        JR LP_SHD0; go to a team JR Z, LP_SHD1
2

   Hex dump procedure SHADOW:


    EA60: 21 FF 5A 20 January 2000 2B CB: DB

    EA68: 5C C8 CB 76 28 F5 E5 2C: E5

    EA70: 7D E6 1F 28 3A CB 76 20: 9F

    EA78: 36 E5 09 4E E1 7C E6 03: 1A

    EA80: 7 July 2007 F6 40 67 November 2000: 2D

    EA88: 55 06 0C 7B E6 F0 B6 77: 57

    EA90: 24 7C E6 20 July 1913 7D C6: 7D

    EA98: 20 6F 38 04 7C D6 August 1967: 0E

    EAA0: 7C FE 58 30 0A CB 71 20: F2

    EAA8: 06 CB 3A CB 1B 10 DC E1: 50

    EAB0: E5 20 January 2000 09 7C FE 5B: 7E

    EAB8: 30 2C CB 76 20 28 2C 4E: 01

    EAC0: 7C E6 03 7 July 2007 40 F6: 5A

    EAC8: 67 11 00 55 06 04 2D 7E: 34

    EAD0: B2 77 2C 7D E6 1F July 28: C0

    EAD8: CB 1971 March 20 7E B3 77 24: ED

    EAE0: CB 3A CB 1B 10 E8 E1 AF: 3D

    EAE8: 18 82 00 00 00 00 00 00: 6C

Saving: SAVE "shadow.c" CODE
60000,13


   In the ZX-REVIEW-93 at p.117 was
published procedure LOOK BASIC
PROGRAMMS, the author - Alexander Bessonov. It takes 344 bytes
that in my opinion - is simply blasphemous! I managed to cut 
the program more than twice (or more precisely, to rewrite it 
from scratch). The principle of operation is almost changed, 
however, there was a new opportunity. When you print a notation 
of any control code followed by the output value of its 
parameter. For example, after the panel. Code 16

(INK CTRL) is a byte value
color that the screen will look something like this: I [7] (all
inverted). And after the codes 22 and 23
(AT CTRL, TAB CTRL) must be followed by two values: A [2] [10]
or T [18] [0]. Otherwise, the program works the same way as
original. The procedure takes 158
bytes.
140.
;
; LOOK BASIC PROGRAMS II
3; (c) SerzhSoft, 11 july 1997
;

        ORG 65000; address assembly
;
PROG EQU # 5C53; syst. per. "Address start BASIC-program
VARS EQU # 5C4B; system. per. "Address start BASIC-variables"
;
OUT_NUM_2 EQU # 1A28; system. pr-pa "print the line number (HL)"
CHAN_OPEN EQU # 1601; system. pr-pa "discovery channel output"
STACK_NUM EQU # 33B4; system. pr-pa "to put (HL) on the stack 
to-ra" STACK_A EQU # 2D28; system. Ave pa 'to put A on the 
stack Calculator RA STACK_BC EQU # 2D2B; system. pr-pa "to put 
BC on the stack to-ra" PRINT_FP EQU # 2DE3; system. pr-pa 
"print the contents of the stack k." ;

LBP_2

        LD A, # 02; open the output channel

        CALL CHAN_OPEN; on the main screen

        LD HL, (PROG); address of the start BASIC-program
LP_LBP1 LD DE, (VARS); address of the start BASIC-variables

        AND A; reset carry flag for SBC

        SBC HL, DE; check for completion of the program

        RET NC; if HL> = DE, then the output of the procedure

        ADD HL, DE; recover the value of HL

        PUSH HL; store the string address on the stack

        CALL OUT_NUM_2; print line numbers

        POP HL; Restore rd row address from the stack

        PUSH HL; and - again - keep

        LD B, H; copied

        LD C, L; HL in BC


140. CALL PRN_BC; printed the address of the string in memory

        POP HL; Restore rd row address from the stack

        INC HL; transition to

        INC HL; length of the string

        LD C, (HL); low byte string length

        INC HL; further

        LD B, (HL); byte string length

        INC HL; the transition to the contents of a string

        PUSH HL; store address on the stack

        CALL PRN_BC; print length of the current BASIC-line

        POP HL; reconstruct the address from the stack
LP_LBP2 LD A, (HL); the current character string

        INC HL; move to the next

        CP # 0D; check for end of line

        JR Z, GO_LBP1; if yes, then go to the processing

        LD DE, LP_LBP2; address cycle on the characters throw on

        PUSH DE; stack to "return" on RET

        CP # 0E; stumbled upon a number?

        JR Z, GO_LBP2; if yes, then go to the processing

        CP # 08; code shift back by one position?

        JR Z, GO_LBP3; if so, the process

        CP # 10, if the character code is less than 16,

        JR C, GO_LBP0; then print it and - "to CA. characters.

        CP # 18, if 16 <= character code <= 23

        JR C, GO_LBP4; then go to panel processing. code
GO_LBP0 RST # 10; print one character

        RET; transition to LP_LBP2
;
GO_LBP1 RST # 10; print code # 0D - newline

        LD A, # 0D; and again

        RST # 10; newline

        JR LP_LBP1; move to the next BASIC-line
;
GO_LBP2 PUSH HL; store address on the stack

        CALL STACK_NUM; 5-byte number -> on the stack tracing 
paper. 

        CALL PRN_NUM; print it

        POP HL; reconstruct the address from the stack

        LD BC, # 0005, and the transition to a character string 
for the BASIC- 

        ADD HL, BC; this 5-byte number

        RET; transition to LP_LBP2
;
GO_LBP3 ADD A, # 07; correction code for # 08
GO_LBP4 SUB # 0F 3; received the number # 00 ... # 07 and have 
brought 

        LD C, A; it in BC - it is the index (position)

        LD B, # 00; notation Ex. code in the table

        PUSH HL; store address on the stack

        LD HL, TBLCODE; address table notation Ex. k.

        ADD HL, BC; addressed the element of this table

        SET 2, (IY +87); include inversion for printing

        LD A, (HL); took the code no. Ex. code from the table

        RST # 10, published his (written)

        RES 2, (IY +87); disable inversion for printing

        POP HL; reconstruct the address from the stack

        LD A, C; determine the size of Manage. Code:

        OR A; if it was the code # 08,

        RET Z; then leave (it has no parameters)

        CP # 06; if it were code # 16, # 17,

        CALL NC, GO_LBP5; need to print two perametra
GO_LBP5 LD A, (HL); have one byte of memory (pair-p)

        PUSH HL; store address on the stack

        CALL STACK_A; scores a value of A on the stack since

        CALL PRN_NUM; print this value (parameter)
        POP HL; reconstruct the address from the stack

        INC HL; move to the next. character in a string

        RET; "return" on GO_LBP5 or LP_LBP2
;
PRN_BC CALL STACK_BC; put BC on stack calculator
;
PRN_NUM SET 2, (IY +87); include inversion for printing

        LD A, "["; print it

        RST # 10, a left bracket (opening)

        CALL PRINT_FP; then - the number from the stack 
Calculator pa, 

        LD A, "]"; and finally print

        RST # 10, right bracket (closing)

        RES 2, (IY +87); disable inversion for printing

        RET; return from subroutine
;
TBLCODE DB "




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:
News - Recent news from the life Kovrov hackers.
Topic - Tusovka: CSP'99 - an interview with the father of Playgear cool uncle Ze Pagan.
events, facts, comments - flooding the station "Mir", new toys ....
Feedback - contact the publisher.
Interview - GPY claims that he is a cool ...

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