(C) Komandin IG, Kaluga
Offer my program from.
This sprite scroller with the possibility of using sprites
height from 1 to 8, and familiarity
width from 1 to 31 familiarity.
140.
; (C) ZX-MANIACS
; SPECIAL FOR INFORCOM
3; KALUGA'1996
ORG 40000
DX EQU 4
DY EQU 4
CALL INIT
CALL SCROLL
RET
INIT LD HL, BUFF
LD DE, BUFF +1
LD BC, DX * DY * 8-1
LD (HL), 0
LDIR
LD HL, TEXT
LD (TEXTP), HL
LD HL, 41000
LD (FONT), HL
XOR A
LD (COL), A
RET
SCROLL LD A, (COL)
OR A
JR Z, LDCOL
DEC A
LD (COL), A
JR NEXT
LDCOL CALL LDIRB
LD A, DX * 8
LD (COL), A
NEXT LD HL, # 481F;!
LD DE, BUFF + DX-1
LD B, DY
LOOP PUSH BC
PUSH HL
LD B, 8
LOOP1 PUSH BC
PUSH HL
EX DE, HL
AND A
LD B, DX
LOOP3 RL (HL)
DEC HL
DJNZ LOOP3
EX DE, HL
LD B, 32;!
LOOP2 RL (HL)
DEC HL
DJNZ LOOP2
POP HL
LD B, DX * 2
LOOP4 INC DE
DJNZ LOOP4
POP BC
INC H
DJNZ LOOP1
POP HL
LD BC, 32
ADD HL, BC
POP BC
DJNZ LOOP
RET
LDIRB LD HL, (TEXTP)
LD A, (HL)
OR A
JR NZ, NEXTA
LD HL, TEXT
LD (TEXTP), HL
LD A, 32;!
JR NEXTB
NEXTA INC HL
LD (TEXTP), HL
NEXTB SUB 32
LD H, A
LD C, DX * DY
LD L, 0
LD B, L
LD A, 8
L1 ADD HL, HL
JR NC, L2
ADD HL, BC
L2 DEC A
JR NZ, L1
ADD HL, HL
ADD HL, HL
ADD HL, HL
LD DE, (FONT)
ADD HL, DE
LD DE, BUFF
LD BC, DX * DY * 8
LDIR
RET
COL DEFB DX * 8
TEXTP DEFW TEXT
FONT DEFW 41000
BUFF DEFS DX * DY * 8
TEXT DEFM "MEGA SPRITE"
DEFM "SCROLL IS"
DEFM "WRITTEN BY"
DEFM "KOMANDIN ILYA"
DEFM "(ZX-MANIACS)"
3 DEFM ", KALUGA'1996"
DEFB 0
2
And now some annotations to the program.
1. As a basis for program
used a running line
Sergei Kaminsky (ZX REVIEW N3 '
1995, p.43-45).
2. The program also uses the procedure MUL_3 Alexei
Zhil'tsova (ZX REVIEW N3'1995, p.
35-36).
3. Although the size of sprites
procedure and can be very
great, I would not recommend to use sprites larger than
6x6 familiarity. First, the character set for these sprites
takes more than 27 kilobytes and secondly, the speed, then
programs are not instantaneous. If
You are running out of BASIC, then you
would have to abandon the usual PAUSE 1 is already in sprites
more than 3x3 familiarity. However, the native, fortunately,
You can use the HALT even at fairly large sprites.
4. When getting your program, you
should use the assembler,
perceiving the mathematical
operation "multiply", or if you
have to recalculate some numbers manually, which will agree, is
not very convenient.
5. How to create a sprite
set for the scroller - it is
Your concern, but I would advise
use the Yuri Alekhine (ZX REVIEW 1'95, p. 45). In
Basically, it can be easily
remake for sprites of any
size.
6. At the end of the text messages, recorded from the label
TEXT, the program automatically writes another space. It's not
an eccentricity of the author, but a necessity, but if you want
should be issued is not a space, and any other symbol, are
registered the code into the battery in the string
marked with three exclamation icon.
7. Now it's time to tell you how to change these
scroller. Dimensions of the sprite
horizontal and vertical variables are defined in the DX and DY,
respectively, at the very beginning
program. Byte address in the display area corresponding to
top right corner of the output scroller is given in a row
with one exclamation point
and the length of the window - with two. Attention! Make sure
the window to display scrolling text does not go beyond
one-third screen, otherwise there will be bugs!
8. Scroller similar program run by Sergei Kaminsky - see 1
st para.
Sincerely, ZX-MANIACS.
*
(C) Komandin IG, Kaluga
Propose a procedure screen display horizontal lines. Offer
full and simplified procedures, although quality of the latter
to me, honestly speaking, does not like.
140.
; (C) ZX-MANIACS
; SPECIAL FOR INFORCOM
;
ORG 40000
ENT
BUFF EQU 41000
LD HL, TABL
LD DE, TABL +1
LD BC, 191
LD (HL), 0
LDIR
LD B, 192
LD HL, 14000; *
LOOP PUSH BC
LOOP1 PUSH HL
LD A, (HL)
CP 192
JR NC, CONT
LD HL, TABL
LD D, 0
LD E, A
ADD HL, DE
LD B, A
LD A, (HL)
OR A
JR NZ, CONT
INC A
LD (HL), A
LD A, B
LD C, 0
CALL 8880
LD D, H
LD E, L
LD BC, BUFF-16384
ADD HL, BC
LD BC, 32
LDIR
HALT
POP HL
POP BC
DEC HL
DJNZ LOOP
LD HL, BUFF +6144
LD DE, 22528
LD BC, 768
LDIR
RET
CONT POP HL
DEC HL
JR LOOP1
TABL DEFS 192
ORG 40000
LD BC, 400
LD HL, 14000; *
LOOP PUSH BC
LOOP1 PUSH HL
LD A, (HL)
CP 192
JR NC, CONT
LD C, 0
CALL 8880
LD D, H
LD E, L
LD BC, BUFF-16384
ADD HL, BC
LD BC, 32
LDIR
HALT
POP HL
POP BC
DEC HL
DEC BC
LD A, B
OR C
JR NZ, LOOP
LD HL, BUFF
LD DE, 16384
LD BC, 6912
LDIR
RET
CONT POP HL
DEC HL
JR LOOP1
BUFF EQU 41000
2
In lines with an asterisk, given the address in the ROM used
as a generator of random numbers. By changing this address, You
can get different sequences of output images.
The following procedure is like
puts a picture of the individual
lines, falling from above.
140.
; (C) ZX-MANIACS
; SPECIAL FOR INFORCOM
;
ORG 40000
BUFF EQU 41000
LD A, 191
LD BC, 49152
LOOP PUSH BC
PUSH AF
CALL 8880
LD DE, BUFF-16384
ADD HL, DE
POP AF
PUSH AF
INC A
LD B, A
XOR A
LOOP1 PUSH BC
PUSH AF
PUSH HL
CALL 8880
EX DE, HL
POP HL
PUSH HL
LD BC, 32
LDIR
POP HL; *
POP AF
PUSH AF
140. PUSH HL
DEC A
CALL 8880
LD D, H
LD E, L
INC DE
LD (HL), 0
LD BC, 31
LDIR
LD B, 250
PAUSE NOP
NOP
DJNZ PAUSE; **
POP HL
POP AF
INC A
POP BC
DJNZ LOOP1
POP AF
DEC A
POP BC
DJNZ LOOP
LD HL, BUFF +6144
LD DE, 22528
LD BC, 768
LDIR
RET
2
Falling speed lines can be
changed by changing the amount on line
before the label PAUSE. With a small delay in the image
I began to tremble visibly. In
Basically, I am inclined to attribute all
it to the eccentricities of my computer (I have, for example,
very strong shaking screen LASER
SQUAD), but who knows ... If
delete all lines beginning with
line with an asterisk, and
up to the line with two asterisks (inclusive), we get the
shortest ever offered programs "Pouring" screen.
The following program shows
screen rather zamorochennym way, so I will not even
attempt to describe its action
words. I can only advise
poizmenyat number in line with
star and see what
will (try to put there, for example, number 190).
140.
; (C) ZX-MANIACS
;
ORG 40000
BUFF EQU 41000
LD B, 192
LD HL, # 4000
LD DE, 22497
LOOP PUSH BC
PUSH HL
PUSH DE
LD A, 255, *
LD B, 16
LOOP1 LD (HL), A
INC HL
INC HL
LD (DE), A
INC DE
INC DE
DJNZ LOOP1
POP DE
CALL UP
POP HL
CALL DOWN
POP BC
HALT
DJNZ LOOP
LD HL, # 4001
LD DE, 22496
LD B, 192
LOOP2 PUSH BC
PUSH HL
PUSH DE
LD B, 16
LOOP3 PUSH BC
LD BC, BUFF-16384
ADD HL, BC
LD A, (HL)
SBC HL, BC
LD (HL), A
INC HL
INC HL
EX DE, HL
ADD HL, BC
LD A, (HL)
SBC HL, BC
LD (HL), A
EX DE, HL
INC DE
INC DE
POP BC
DJNZ LOOP3
POP DE
CALL UP
POP HL
CALL DOWN
POP BC
HALT
DJNZ LOOP2
LD HL, BUFF +6144
LD DE, 22528
LD BC, 768
LDIR
RET
DOWN INC H
LD A, H
AND 7
RET NZ
LD A, L
ADD A, 32
LD L, A
RET C
LD A, H
SUB 8
LD H, A
RET
UP DEC D
LD A, D
AND 7
CP 7
RET NZ
LD A, E
SUB 32
LD E, A
RET C
LD A, D
ADD A, 8
LD D, A
RET
2
*