Especially for the Surgeon and
Blaster.
--------------------------------
================================
********************************
================================
--------------------------------
Not the slowest procedure
output sprites 2*2 with precision
to the pixel.
A little theory. How probably
It’s already clear to everyone that if a sprite
decompose into dots and output
by points, then it will slow down
scary, that's why they use it
all sorts of tricks.
There is a 2*2 familiarity sprite. By
it’s easy to move it vertically, but
here horizontally... So,
prepare 8 sprites in advance
2*3 familiar places, moved in advance
move horizontally, and then you-
we drive the right one. But it'll do
only when there are no sprites
a lot. What if there are 50 of them?
2*3*8 - size of one spr.2*Zzn.
There are 8 of them - 2*3*8*8. And in total - 50...
2*3*8*8*50=6*64*50=64*300=19200.
However, for a large program 50 this is
few, and not just sprites
The man is alive - Mouzon, the program itself.
There is only one conclusion - move the sprites to
withdrawal time. At the end of the section
you can also find the output program itself,
which displays the sprite by OR.
The program itself is not very complicated,
the main thing is to understand the idea. In prog three
main procedures:
PTBL_S - shift 2 bytes from (hl) and
(hl+1) and res. in B',C',D'.
PTBL_O - output 3 bytes to the screen
given that the screen is not
infinite.
PTBL_D - because in DE address in screen,
then this procedure shifts DE to
oneпиксель вниз.
HL-ADRESS SPRITE
B-COORD_Y (0..191)
C-COORD_X (0..255)
PTBL CALL PTBL_A
LD B,8*2
PTBLO CALL PTBL_S
CALL PTBL_O
CALL PTBL_D
LD A,D
CP #58
RET NC ;OUT OF SCR
DJNZ PTBLO
RET
PTBL_D INC D ; DOWN_DE
LD A,D
AND 7
RET NZ
LD A,E
ADD A,#20
LD E,A
RET C
LD A,D
SUB 8
LD D,A
RET
PTBL_O PUSH DE
EXX
LD A,B
EXX
LD (DE),A
INC E
LD A,E
AND 31
JR Z,PTBL_O0 ;OUT OF SCR
EXX
LD A,C
EXX
LD (DE),A
INC E
LD A,E
AND 31
JR Z,PTBL_O0 ; -//-
EXX
LD A,D
EXX
LD (DE),A
PTBL_O0 POP DE
RET
PTBL_S LD A,(HL)
INC HL
EXX
LD B,A
EXX
LD A,(HL)
INC HL
EXX
LD C,A
EXX
LD A,C
EXX
LD D,0
PTBL_S0 AND A
JR Z,PTBL_S1
RR B
RR C
RR D
DEC A
JR PTBL_S0
PTBL_S1 EXX
RET
PTLB_A LD A,B
RRCA
RRCA
RRCA
AND #18
OR #40
LD D,A
LD A,B
AND 7
ADD A,D
LD D,A
LD A,B
RLCA
RLCA
AND #E0
LD E,A
LD A,C
RRCA
RRCA RRCA
AND #1F
ADD A,E
LD E,A
LD A,C
AND 7
LD C,A
RET
--------------------------------
================================
********************************
================================
--------------------------------
The end. Mad Z-Group (C)2000.
Main editor : Slavik/ZGR.
Music made by uncnown.
Share your thoughts about the article