And now - the following effect.
According to the logic of it is similar to
the previous one, but it looks completely different. There is
no change in attributes, and change in hatching familiarity.
It is used as a Screen Saver'a in this issue
"Revue" (click CS + S to invoke it, and press C Switch
color).
140.
;--------------------------;
3; (c) Ivan Roshchin, 1997;
; EFFECT "PLASMA-2";
;--------------------------;
BUF EQU # 8000; Address Buffer
; Setting attributes:
LD HL, # 5800
LD (HL),% 00101111
LD DE, # 5801
LD BC, # 2FF
LDIR
; Clear the buffer area
, (# 640 bytes from the address BUF):
LD HL, BUF
LD (HL), 0
LD DE, BUF +1
LD BC, # 63F
LDIR
; Transfers the contents of the upper row
; Buffer area down and vice versa,
, Ie screen as it is closed vertically:
M2 LD HL, BUF +32
LD DE, BUF + # 300 32
LD BC, 32
LDIR
LD HL, BUF + # 300
LD DE, BUF
LD BC, 32
LDIR
; In the cycle of updating the attributes in the buffer:
LD IX, BUF +32
M1 LD A, (IX +1)
ADD A, (IX-1)
ADD A, (IX +32)
ADD A, (IX-32)
SRL A
DEC A
SRL A
LD (IX), A
CALL TO_SCR
INC IX
LD A, XL
CP BUF + # 320 - ((BUF + # 320) / 256 * 256)
JP NZ, M1
LD A, XH
CP (BUF + # 320) / 256
JP NZ, M1
; Upgraded the entire buffer:
XOR A
IN A, (254)
CPL
AND 31
JR Z, M2
RET
;-------------------------------------; Procedure TO_SCR stroke
current ; Familiarity.
;
; Log: A - the value of the buffer
, Determines the type of shading
; IX - the current address in the buffer
TO_SCR AND% 00111000
RRCA
LD L, A
LD H, 0
LD DE, TAB-4
ADD HL, DE
LD B, H
LD C, L
; BC - address hatching
PUSH IX
POP HL
LD DE, # 320
ADD HL, DE
; HL - address in the auxiliary buffer
, Which stores the value of past
; Shading for this familiarity
CP (HL); values match?
RET Z; if yes - go
PUSH AF
LD (HL), A
LD DE,-BUF-# 340
ADD HL, DE
; HL - offset in the main buffer, find out
; On it the coordinates of familiarity:
LD A, L
AND 31
LD D, A; X
RL L
RL H
RL L
RL H
RL L
RL H
LD A, H
AND 31
LD E, A; Y
AND # 18
OR # 40
LD H, A
LD A, E
AND # 7
RRA
RRA
RRA
RRA
ADD A, D
LD L, A
; HL - address on the screen
POP AF;, if A = 0,
AND A; easy to clean
JP Z, TO_CL; familiarity
LD D, H
LD E, L
INC D
INC D
INC D
INC D
; HL points to the upper line of familiarity,
, And DE - four lines below
LD A, (BC)
LD (HL), A
LD (DE), A
INC H
INC D
INC BC
LD A, (BC)
LD (HL), A
LD (DE), A
INC H
INC D
INC BC
LD A, (BC)
LD (HL), A
LD (DE), A
INC H
INC D
INC BC
LD A, (BC)
LD (HL), A
LD (DE), A
RET
; If you just want to clear familiarity:
TO_CL LD (HL), A
INC H
LD (HL), A
INC H
LD (HL), A
INC H
LD (HL), A
INC H
LD (HL), A
INC H
LD (HL), A
INC H
LD (HL), A
INC H
LD (HL), A
RET
; Table that defines the different types of
; Hatches:
TAB DB% 01000100
DB% 00000000
DB% 00010001
DB% 00000000
DB% 01000100
DB% 00010001
DB% 01000100
DB% 00010001
DB% 01010101
DB% 10101010
DB% 01010101
DB% 10101010
DB% 11011101
DB% 10101010
DB% 01110111
DB% 10101010
DB% 01010101
DB% 10101010
DB% 01010101
DB% 10101010
DB% 01000100
DB% 00010001
DB% 01000100
DB% 00010001
DB% 01000100
DB% 00000000
DB% 00010001
DB% 00000000