ZX Review #7-8-9-10
08 ноября 1997 |
|
Studies - Graphic effect "color bars".
ETUDES Music by ZET (C) Ivan Roshchin, Moscow, 1996 Bring to your attention I wrote a program that implements a nice visual effect: the screen moving color bars, which fades each other. This full-screen REAL-TIME takes effect only about 60% of the time processor. Sequence bands and smooth transition between them can be changed. 140 .;*********************************************** ***** CLR0 EQU 0; COLOR BANDS CLR1 EQU 1; (downward) CLR2 EQU 2 CLR3 EQU 3 CLR4 EQU 4 CLR5 EQU 5 CLR6 EQU 6 ;************************************************* *** DEMO LD C, 0; vertical displace ; STRIP lifting: LOOP1 CALL SHOW; DRAW BAND CALL KEY; ANYTHING pressed? RET NZ; IF YES, EXIT INC C; INCREASED DISPLACEMENT LD A, C; reached the limit? CP TABMAXA-23 JP NZ, LOOP1; IF NO, CONTINUE. ; STRIP DOWN: DEC C; REDUCE DEC C; OFFSET LOOP2 CALL SHOW; DRAW BAND CALL KEY; ANYTHING pressed? RET NZ; IF YES, EXIT DEC C; REDUCE THE OFFSET LD A, C; reached the minimum? CP # FF JP NZ, LOOP2; IF NO, CONTINUE. LD C, 1; OTHERWISE GO TO JP LOOP1; beginning the program. ;*************************************** ; PROCEDURE SHOW ; LOG: C-BAND VERTICAL DISPLACEMENT (IN ; Familiarity) ; OUTPUT: Mimicking PASS. PICTURE. SHOW; FIRST, an imaging ATTRIBUTES: LD DE, TABL_A; ADDRESS attribute table LD H, 0; HL = OFFSET LD L, C ADD HL, DE; add an offset LD DE, # 5800; beginning of the file ATTRIBUTES HALT; WAITING FOR THE START OF FRAME DI; disable interruptions, TK ; WILL manipulated from the stack. NEXT_A LD A, (DE); which attribute picture? CP (HL); what we need? JP Z, RETU; IF YES, DO NOT PEESYLAEM PUSH HL; SAVE ADDRESS OF SOURCE LD A, (HL); BYTES FROM THE SOURCE LD (M1 +1), SP; PRESERVE SP (NOTE WHERE). LD HL, # 20, generates a new ADD HL, DE; ADDRESS STACK LD SP, HL LD D, A; than fill LD E, A; STRING PUSH DE; forming one PUSH DE; STRING PUSH DE PUSH DE PUSH DE PUSH DE PUSH DE PUSH DE PUSH DE PUSH DE PUSH DE PUSH DE PUSH DE PUSH DE PUSH DE PUSH DE EX DE, HL; In DE NEW ADDRESS RECEIVER M1 LD SP, 0; RESTORE SP. ; This command LOAD SP ; DONE twice as fast ; Than a team of LD SP, (NN). POP HL; RESTORE HL JP NE_RETU; WAY, TEAM JP ; Run faster ; WHAT TEAM JR. ; If a line is was necessary to fill, , Increases DE (addr. RECEIVER) FOR # 20: RETU LD A, # 20, looks like it is ADD A, E; unusual, but LD E, A; WORKS LD A, 0; FASTER. ADC A, D LD D, A , Otherwise the destination address has already been increased. NE_RETU INC HL; Source Address LD A, D CP # 5B JP NZ, NEXT_A And now draw the image: LD L, C; Offset in familiarity SLA L; multiplied by 8 SLA L SLA L RES 7, L LD B, L; GET OFFSET TABLE LD H, 0; HL = OFFSET. TABLE LD DE, TABL; ADDRESS TABLE ADD HL, DE EX DE, HL LD HL, # 4000; HOME DISPLAY FILE And here, on the contrary, HL-receiver address, A ; DE-source address. NEXT LD A, (DE); an imaging BYTES CP (HL); Compares with the image. JP Z, RET3; If zero, do not send PUSH HL; SAVE ADDRESS OF RECEIVER , Increases HL (addr. RECEIVER) FOR # 20: LD A, # 20, looks like it is ADD A, L; unusual, but LD L, A; WORKS LD A, 0; FASTER. ADC A, H LD H, A LD (M2 +1), SP; PRESERVE SP LD SP, HL; SP indicates the end of STRING LD A, (DE) LD H, A; than fill LD L, A; STRING PUSH HL; forming one PUSH HL; STRING PUSH HL PUSH HL PUSH HL PUSH HL PUSH HL PUSH HL PUSH HL PUSH HL PUSH HL PUSH HL PUSH HL PUSH HL PUSH HL PUSH HL M2 LD SP, 0; RESTORE SP POP HL; RESTORE ADDRESS OF RECEIVER RET3 INC DE; HAS INCREASED SOURCE ADDRESS INC B; INCREASED COUNTER LD A, B CP TABMAX; ACHIEVED MAX. ADDRESS? JP NZ, TAB_OK LD B, 0; IF YES, Zeroing COUNTER LD DE, TABL; AND GO TO TOP OF TABLE TAB_OK INC H; SINGLE LD A, H; NEW ADDRESS AND 7 LINES ON LD A, H; SCREEN JP NZ, NEW_OK; AT LD A, L; LAST ADD A, 32; STRING. LD L, A LD A, H JP C, NEW_OK LD A, H SUB 8 LD H, A NEW_OK CP # 58 JP NZ, NEXT EI RET ;*************************************** TABMAX EQU 16 * 8, the size of data sets (see below) TABL DB% 00000000; the data to DB% 00000000; smooth transition between DB% 00000000; colored stripes. DB% 00000000; WAY, FROM THEM DB% 00000000; DEPENDS ON SPEED DB% 00000000; PROCEDURE SHOW. DB% 00000000 DB% 00000000 DB% 00000000 DB% 00000000 DB% 00000000 DB% 00000000 DB% 00000000 DB% 00000000 DB% 00000000 DB% 00000000 DB% 00001000 DB% 00000000 DB% 10000000 DB% 00000000 DB% 00001000 DB% 10000000 DB% 00001000 DB% 10000000 DB% 00100010 DB% 10001000 DB% 00100010 DB% 10001000 DB% 00100010 DB% 10001000 DB% 00100010 DB% 10001000 DB% 00100010 DB% 10001000 DB% 00100010 DB% 10001000 DB% 00100010 DB% 10001000 DB% 00100010 DB% 10001000 DB% 00100010 DB% 01010101 DB% 10001000 DB% 01010101 DB% 00100010 DB% 01010101 DB% 10001000 DB% 01010101 DB% 00100010 DB% 01010101 DB% 00100010 DB% 01010101 DB% 10001000 DB% 01010101 DB% 00100010 DB% 01010101 DB% 10001000 DB% 01010101 DB% 00100010 DB% 01010101 DB% 10101010 DB% 01010101 DB% 10101010 DB% 01010101 DB% 10101010 DB% 01010101 DB% 10101010 DB% 01010101 DB% 10101010 DB% 01010101 DB% 10101010 DB% 01010101 DB% 10101010 DB% 01010101 DB% 10101010 DB% 01010101 DB% 10101010 DB% 01010101 DB% 10101010 DB% 01010101 DB% 10101010 DB% 01010101 DB% 10101010 DB% 01010101 DB% 10101010 DB% 01110111 DB% 10101010 DB% 11011101 DB% 10101010 DB% 01110111 DB% 10101010 DB% 11011101 DB% 10101010 DB% 01110111 DB% 10101010 DB% 11011101 DB% 10101010 DB% 01110111 DB% 10101010 DB% 11011101 DB% 10101010 DB% 01110111 DB% 10101010 DB% 11011101 DB% 11011101 DB% 01110111 DB% 11011101 DB% 01110111 DB% 11011101 DB% 01110111 DB% 11011101 DB% 01110111 DB% 11011101 DB% 01110111 DB% 11011101 DB% 01110111 DB% 11011101 DB% 01110111 DB% 11011101 DB% 01110111 DB% 01111111 DB% 11110111 DB% 01111111 DB% 11110111 DB% 11111111 DB% 01111111 DB% 11111111 DB% 11110111 ;************************************************* ******* TABMAXA EQU 6 * 16 +2, the size of data sets (see below) TABL_A DB CLR0 * 8 + CLR1; FROM THEM DEPENDS DB CLR0 * 8 + CLR1; COLOR OF EACH STRIP DB CLR0 * 8 + CLR1 DB CLR0 * 8 + CLR1 DB CLR0 * 8 + CLR1 DB CLR0 * 8 + CLR1 DB CLR0 * 8 + CLR1 DB CLR0 * 8 + CLR1 DB CLR0 * 8 + CLR1 DB CLR0 * 8 + CLR1 DB CLR0 * 8 + CLR1 DB CLR0 * 8 + CLR1 140. DB CLR0 * 8 + CLR1 DB CLR0 * 8 + CLR1 DB CLR0 * 8 + CLR1 DB CLR0 * 8 + CLR1 DB CLR1 * 8 + CLR2 DB CLR1 * 8 + CLR2 DB CLR1 * 8 + CLR2 DB CLR1 * 8 + CLR2 DB CLR1 * 8 + CLR2 DB CLR1 * 8 + CLR2 DB CLR1 * 8 + CLR2 DB CLR1 * 8 + CLR2 DB CLR1 * 8 + CLR2 DB CLR1 * 8 + CLR2 DB CLR1 * 8 + CLR2 DB CLR1 * 8 + CLR2 DB CLR1 * 8 + CLR2 DB CLR1 * 8 + CLR2 DB CLR1 * 8 + CLR2 DB CLR1 * 8 + CLR2 DB CLR2 * 8 + CLR3 DB CLR2 * 8 + CLR3 DB CLR2 * 8 + CLR3 DB CLR2 * 8 + CLR3 DB CLR2 * 8 + CLR3 DB CLR2 * 8 + CLR3 DB CLR2 * 8 + CLR3 DB CLR2 * 8 + CLR3 DB CLR2 * 8 + CLR3 DB CLR2 * 8 + CLR3 DB CLR2 * 8 + CLR3 DB CLR2 * 8 + CLR3 DB CLR2 * 8 + CLR3 DB CLR2 * 8 + CLR3 DB CLR2 * 8 + CLR3 DB CLR2 * 8 + CLR3 DB CLR3 * 8 + CLR4 DB CLR3 * 8 + CLR4 DB CLR3 * 8 + CLR4 DB CLR3 * 8 + CLR4 DB CLR3 * 8 + CLR4 DB CLR3 * 8 + CLR4 DB CLR3 * 8 + CLR4 DB CLR3 * 8 + CLR4 DB CLR3 * 8 + CLR4 DB CLR3 * 8 + CLR4 DB CLR3 * 8 + CLR4 DB CLR3 * 8 + CLR4 DB CLR3 * 8 + CLR4 DB CLR3 * 8 + CLR4 DB CLR3 * 8 + CLR4 DB CLR3 * 8 + CLR4 DB CLR4 * 8 + CLR5 DB CLR4 * 8 + CLR5 DB CLR4 * 8 + CLR5 DB CLR4 * 8 + CLR5 DB CLR4 * 8 + CLR5 DB CLR4 * 8 + CLR5 DB CLR4 * 8 + CLR5 DB CLR4 * 8 + CLR5 DB CLR4 * 8 + CLR5 DB CLR4 * 8 + CLR5 DB CLR4 * 8 + CLR5 DB CLR4 * 8 + CLR5 DB CLR4 * 8 + CLR5 DB CLR4 * 8 + CLR5 DB CLR4 * 8 + CLR5 DB CLR4 * 8 + CLR5 DB CLR5 * 8 + CLR6 DB CLR5 * 8 + CLR6 DB CLR5 * 8 + CLR6 DB CLR5 * 8 + CLR6 DB CLR5 * 8 + CLR6 DB CLR5 * 8 + CLR6 DB CLR5 * 8 + CLR6 DB CLR5 * 8 + CLR6 DB CLR5 * 8 + CLR6 DB CLR5 * 8 + CLR6 DB CLR5 * 8 + CLR6 DB CLR5 * 8 + CLR6 DB CLR5 * 8 + CLR6 DB CLR5 * 8 + CLR6 DB CLR5 * 8 + CLR6 DB CLR5 * 8 + CLR6 DB CLR6 * 8 + CLR6 DB CLR6 * 8 + CLR6 ;************************************** ; PROCEDURE KEY returns a flag Z = 0 ; If your keyboard ANYTHING down. KEY XOR A IN A, (254) AND% 00011111 CP% 00011111 RET 2 *
Other articles:
Similar articles:
В этот день... 21 November