Prev: 63574 Up: Map Next: 63637
63595: 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 63595 LD HL,64000 The shift tables.
63598 LD B,2 B=2.
BuildTables_Shift 63600 LD C,0 Clear C.
BuildTables_Byte 63602 LD D,C D=C.
63603 LD E,0 Clear E.
63605 LD A,B A=B.
BuildTables_Bits 63606 SRL D Shift D right.
63608 RR E Rotate E right through the carry.
63610 DEC A Step A back.
63611 JR NZ,BuildTables_Bits Jump to BuildTables_Bits if the zero flag is clear.
63613 LD (HL),D Write D where HL points.
63614 INC H Advance H.
63615 LD (HL),E Write E where HL points.
BuildTables_Buffer 63616 DEC H Step H back.
63617 INC HL Advance HL.
63618 INC C Advance C.
63619 LD A,C A=C.
63620 AND A Jump to BuildTables_Byte if A is not zero.
63621 JR NZ,BuildTables_Byte
63623 INC H Advance H.
63624 INC B Advance B.
63625 INC B Advance B.
63626 LD A,B A=B.
63627 CP 8 Jump to BuildTables_Shift if A is not 8.
63629 JR NZ,BuildTables_Shift
63631 CALL BuildShapeTables Call BuildShapeTables.
63634 JP BuildReverseTable Jump to BuildReverseTable.
Prev: 63574 Up: Map Next: 63637