Coding - fast print 2x2 sprite familiarity, up to familiarity.

Deja Vu #09
(C) Death MoroZ
__________________________________________



   Hello everyone who is pro chunky-bump'y, and I
fast printing of 2x2 sprite familiarity,
which is designed for fixed position of the sprite, for 
example, it can be printed maps. 

   Thus, the following procedure, you must call before starting 
the main program. 

   Procedure CREAT several changes the format of sprites, 
namely: leaving unchanged the first 2 familiarity, with the 
second following occurs: 


        before the call: after:

          16 17 30 31

          18 19 28 29

          20 21 26 27

          .. .. .. ..



   What is it? And here is why: For example, in HL we have 
given the address of the screen, which is printed, to print the 
first 2 familiarity is no problem, but with less loss pass to 
the second pair? For example, You can save up to change the 
address: LD A, H, and then restore: LD H, A, you can use the 
stack, setting it on a table of addresses, but there is a 
better way. To go the following familiarity simply do

INC H, and then continue to show lower
up, for this purpose and is intended
The following procedure.


CREAT LD HL, address sprites 16

       LD DE, address sprites 30
DCR LD B, the number of sprites
M1_ PUSH BC, HL, DE

       LD B, 4
M2_ LD A, (HL)

       EX AF, AF '

       LD A, (DE)

       LD (HL), A

       EX AF, AF '

       LD (DE), A

       INC HL

       INC DE

       LD A, (HL)

       EX AF, AF '

       LD A, (DE)

       LD (HL), A

       EX AF, AF '

       LD (DE), A

       INC HL

       DEC DE

       DEC DE

       DEC DE

       DJNZ M2_

       POP DE

       EX DE, HL

       LD BC, 32

       ADD HL, BC

       EX DE, HL

       POP HL

       ADD HL, BC

       POP BC

       DJNZ M1_

       RET


Example of procedure output:


       LD (SP_ +1), SP

       LD IX, OUTS

       LD DE, ADDRESS MAP

       EXX

       LD BC, # 6000; ADDRESS BUFFER

       EXX; SCREEN

       LD IX, OUTS

       LD B, NUMBER sprite Y
LOOP LD HL, $ +3

       ! ASSM NUMBER sprite X

       JP (IX)

       ! CONT
; YOUR PROCESS OF TRANSITION TO SLED.GORIZON; PORARY LINES AND 
TRANSITION TO SNA SLED.PARE; COMEST SCREEN 

       DJNZ LOOP
SP_ LD SP, 0

       RET


OUTS LD A, (DE)

       EXX

       ADD A, A

       LD L, A

       LD H, SPR_TBL '&H; High Byte
; Pre-arranged address table
, (To create a Static ANIMATION Dost, EXACT CHANGE ONLY HIS 
SNACHENIE) 

       LD SP, HL

       POP HL

       LD SP, HL; took the address Sprite

       LD H, B

       LD L, C; in HL-ADDRESS TO PRINT
;

       ! ASSM 3

       POP DE

       LD (HL), E

       INC L

       LD (HL), D

       INC H

       POP DE

       LD (HL), D

       DEC L

       LD (HL), E

       INC H

       ! CONT

       POP DE

       LD (HL), E

       INC L

       LD (HL), D

       INC H

       POP DE

       LD (HL), D

       DEC L

       LD (HL), E; print the top
One half


       LD A, # 20

       ADD A, L

       LD L, A; PERSHLI TO BOTTOM


       ! ASSM 3; PRINT NIH ...

       POP DE

       LD (HL), E

       INC L

       LD (HL), D

       DEC H

       POP DE

       LD (HL), D

       DEC L

       LD (HL), E

       DEC H

       ! CONT

       POP DE

       LD (HL), E

       INC L

       LD (HL), D

       DEC H

       POP DE

       LD (HL), D

       DEC L

       LD (HL), E

       INC C; REQUIRED

       INC C; ADJUSTMENTS ...

       EXX

       INC E

       INC HL

       INC HL

       JP (HL); OUTPUT
-----------------------------------------