Prev: F856 Up: Map Next: F895
F86B: Build Tables
Used by the routine at InitialiseGame.
Builds the tables that the game needs before it can start. First it makes the tables at ShiftTables of every byte shifted two, four and six bits to the right, as a pair of bytes. A page holds the first byte of every shifted value and the page after holds the second byte. Then it builds the shape tables with BuildShapeTables and the table of reversed bytes with BuildReverseTable.
BuildTables F86B LD HL,$FA00 The shift tables.
F86E LD B,$02 B=02.
BuildTables_Shift F870 LD C,$00 Clear C.
BuildTables_Byte F872 LD D,C D=C.
F873 LD E,$00 Clear E.
F875 LD A,B A=B.
BuildTables_Bits F876 SRL D Shift D right.
F878 RR E Rotate E right through the carry.
F87A DEC A Step A back.
F87B JR NZ,BuildTables_Bits Jump to BuildTables_Bits if the zero flag is clear.
F87D LD (HL),D Write D where HL points.
F87E INC H Advance H.
F87F LD (HL),E Write E where HL points.
BuildTables_Buffer F880 DEC H Step H back.
F881 INC HL Advance HL.
F882 INC C Advance C.
F883 LD A,C A=C.
F884 AND A Jump to BuildTables_Byte if A is not zero.
F885 JR NZ,BuildTables_Byte
F887 INC H Advance H.
F888 INC B Advance B.
F889 INC B Advance B.
F88A LD A,B A=B.
F88B CP $08 Jump to BuildTables_Shift if A is not 08.
F88D JR NZ,BuildTables_Shift
F88F CALL BuildShapeTables Call BuildShapeTables.
F892 JP BuildReverseTable Jump to BuildReverseTable.
Prev: F856 Up: Map Next: F895