Spectrum programming - Mirroring bytes and restoration of the background buffer.

RUSH #01
    Hi everyone! Today I would like to
tell you about two things to know about that
will, I think, helpful to those who are engaged
toys.

    First: Mirroring bytes
(Of course, what is it for?). The algorithm does not
my, I should say. I found it in
DIZZY-XX demo by VAV / MEGACODE. C address
multiple of 256 (eg # 8000)
is a table (256 bytes)
SLR bytes (for 0 is # 00 for # 01
is # 80, etc). When we need
mirror-bytes, for example, to 1, then do
as follows: ...


    LD A, 1

    LD E, A

    LD D, # 80

    LD A, (DE); A = # 80, if the table
formed correctly ...


    Second: the restoration of the background from the buffer
(Printing sprites with a mask). During
save the background before each line
images retain the address where she
displayed. The working buffer
increase by (window height * 2), however,
recovery rate of increase for
account that will not have to calculate
the next screen line. Example procedure
Recovery:


    LD HL, BUFER

    LD A, HIGH; height M1 LD E, (HL)

    INC HL

    LD D, (HL)

    INC HL

    LDI

    LDI

    LDI; width of 3 bytes

    DEC A

    JR NZ, M1

    RET


    Speed ​​can count themselves.

    That's probably all for today. See
you later! Bye!