Prev: 29065 Up: Map Next: 29163
29067: Find Shape In Picture Font
Used by the routines at PlotShape and ScaleShape_Screen.
Looks the shape number up in PictureShapes and remembers its address.
FindShape 29067 LD HL,29064 Point HL at LastShapeNumber.
29070 CP (HL) Jump to FindShape_Search if this is not the last matched shape.
29071 JR NZ,FindShape_Search
29073 LD HL,(29065) Reuse the last matched address.
29076 LD B,0 Point BC at this shape number.
29078 LD C,A
29079 JR FindShape_Size Jump to FindShape_Size.
Walk the shapes from PictureShapes.
FindShape_Search 29081 LD HL,50952 Point HL at PictureShapes.
29084 LD B,A Copy the shape number into BC.
29085 LD C,A
29086 LD (29064),A Remember it at LastShapeNumber.
29089 OR A Jump to FindShape_Size if the shape number is 0.
29090 JR Z,FindShape_Size
Skip to the next 254 terminator.
FindShape_Skip 29092 INC HL Advance to the next byte.
29093 LD A,(HL)
29094 CP 254 Jump to FindShape_Count if it is the terminator 254.
29096 JR Z,FindShape_Count
29098 JR FindShape_Skip Jump to FindShape_Skip.
Count down through the remaining shapes.
FindShape_Count 29100 DJNZ FindShape_Skip Jump to FindShape_Skip until this shape is reached.
29102 INC HL Step to its first byte.
Remember the match and decode its size.
FindShape_Size 29103 LD (29065),HL Store it in LastShapeAddress.
29106 LD A,(HL) Fetch the header.
29107 PUSH AF Stash it on the stack.
29108 AND %11110000 Keep only bits 4-7.
29110 RRA Shift that width down.
29111 RRA
29112 RRA
29113 RRA
29114 INC A Add one.
29115 PUSH AF Stash the width on the stack.
Some shape numbers are sixteen pixels wider.
29116 LD A,C Fetch the shape number.
29117 CP 13 Jump to FindShape_Wide if it is 13, 34, 111, 15 or 17.
29119 JR Z,FindShape_Wide
29121 CP 34
29123 JR Z,FindShape_Wide
29125 CP 111
29127 JR Z,FindShape_Wide
29129 CP 15
29131 JR Z,FindShape_Wide
29133 CP 17
29135 JR Z,FindShape_Wide
29137 CP 85 Jump to FindShape_Store if it is not 85.
29139 JR NZ,FindShape_Store
Add sixteen to the width of those shapes.
FindShape_Wide 29141 POP AF Add 16 to the width.
29142 ADD A,16
29144 PUSH AF
Store the width and height.
FindShape_Store 29145 POP AF Restore the width from the stack.
29146 LD (23492),A Store the width in Row_Width and Column_Counter.
29149 LD (23494),A
29152 POP AF Restore the header from the stack.
29153 AND %00001111 Keep only bits 0-3.
29155 INC A Add one.
29156 LD (23493),A Store the height in Row_Height and Rows_Remaining.
29159 LD (23495),A
29162 RET Return.
Prev: 29065 Up: Map Next: 29163