CODING. FAST C2P PROCEDURE
(C) Monster / Sage Group
And again on chank'ah. You have probably noticed in the intro
to the newspaper quite quickly (> 25 frm / sec) bump mapping on
the entire screen. So a speed effect was achieved by
sly c2p protsedurki about which I tell you.
I shall warn this protsedurka takes a minimum of page
memory, speed requires sacrifice :-)
Ultra fassst procedure chanky to planar screen (c2p):
Bytes from the buffer for each c2p chank'a has the form -
11xxxx00, where xxxx - Brightness chank'a, 11 - 2 bits of the
address table jump'ov.
Table jump'ov looks like this:
# C0C0: JP ADR_ # 00 # C4C0: JP ADR_ # 10 ... # FCC0: JP ADR_ #
F0 # C0C4: JP ADR_ # 01 # C4C4: JP ADR_ # 11 ... # FCC4: JP
ADR_ # F1 ... ... ... ...
# C0FC: JP ADR_ # 0F # C4FC: JP ADR_ # 1F ... # FCFC: JP ADR_ #
FF
ADR_ # XX: LD H, D; # xx - 6 lines sprite pair chank'ov
LD (HL), # xx; draw the line 0
INC H
LD (HL), # xx; 1
INC H
LD (HL), # xx; 2
INC H
LD (HL), # xx; 3
INC H
LD (HL), # xx; 4
INC H
LD (HL), # xx; 5
INC L
RET NZ; 99 +10 (jmp adr) = 109 cycles per couple
LD A, D; for mezhsegmentogo screen transition
ADD A, E
LD D, A
RET
, 83,712 cycles - full screen!
SP_ indicates the beginning of c2p screen buffer
HL_ # 4000 beginning of the screen or # C000 (if the table
jump'ov to # 8080) DE_ see below
The procedure for drawing buffer chank'ov on the screen:
C2P_DRW LD (C2P_RET +1), SP
LD SP, C2P_BUF
LD HL, # 4000
LD D, H
LD E, 8
RET
C2P_RET LD SP, 0
RET
And do not forget to put the end of the buffer address
C2P_RET udachvozvrata for the procedure.