![]() |
Routines |
| Prev: 7189 | Up: Map | Next: 71EB |
|
Used by the routines at PlotShape and ScaleShape_Screen.
Looks the shape number up in PictureShapes and remembers its address.
|
||||
| FindShape | 718B | LD HL,$7188 | Point HL at LastShapeNumber. | |
| 718E | CP (HL) | Jump to FindShape_Search if this is not the last matched shape. | ||
| 718F | JR NZ,FindShape_Search | |||
| 7191 | LD HL,($7189) | Reuse the last matched address. | ||
| 7194 | LD B,$00 | Point BC at this shape number. | ||
| 7196 | LD C,A | |||
| 7197 | JR FindShape_Size | Jump to FindShape_Size. | ||
|
Walk the shapes from PictureShapes.
|
||||
| FindShape_Search | 7199 | LD HL,$C708 | Point HL at PictureShapes. | |
| 719C | LD B,A | Copy the shape number into BC. | ||
| 719D | LD C,A | |||
| 719E | LD ($7188),A | Remember it at LastShapeNumber. | ||
| 71A1 | OR A | Jump to FindShape_Size if the shape number is 00. | ||
| 71A2 | JR Z,FindShape_Size | |||
|
Skip to the next FE terminator.
|
||||
| FindShape_Skip | 71A4 | INC HL | Advance to the next byte. | |
| 71A5 | LD A,(HL) | |||
| 71A6 | CP $FE | Jump to FindShape_Count if it is the terminator FE. | ||
| 71A8 | JR Z,FindShape_Count | |||
| 71AA | JR FindShape_Skip | Jump to FindShape_Skip. | ||
|
Count down through the remaining shapes.
|
||||
| FindShape_Count | 71AC | DJNZ FindShape_Skip | Jump to FindShape_Skip until this shape is reached. | |
| 71AE | INC HL | Step to its first byte. | ||
|
Remember the match and decode its size.
|
||||
| FindShape_Size | 71AF | LD ($7189),HL | Store it in LastShapeAddress. | |
| 71B2 | LD A,(HL) | Fetch the header. | ||
| 71B3 | PUSH AF | Stash it on the stack. | ||
| 71B4 | AND %11110000 | Keep only bits 4-7. | ||
| 71B6 | RRA | Shift that width down. | ||
| 71B7 | RRA | |||
| 71B8 | RRA | |||
| 71B9 | RRA | |||
| 71BA | INC A | Add one. | ||
| 71BB | PUSH AF | Stash the width on the stack. | ||
|
Some shape numbers are sixteen pixels wider.
|
||||
| 71BC | LD A,C | Fetch the shape number. | ||
| 71BD | CP $0D | Jump to FindShape_Wide if it is 0D, 22, 6F, 0F or 11. | ||
| 71BF | JR Z,FindShape_Wide | |||
| 71C1 | CP $22 | |||
| 71C3 | JR Z,FindShape_Wide | |||
| 71C5 | CP $6F | |||
| 71C7 | JR Z,FindShape_Wide | |||
| 71C9 | CP $0F | |||
| 71CB | JR Z,FindShape_Wide | |||
| 71CD | CP $11 | |||
| 71CF | JR Z,FindShape_Wide | |||
| 71D1 | CP $55 | Jump to FindShape_Store if it is not 55. | ||
| 71D3 | JR NZ,FindShape_Store | |||
|
Add sixteen to the width of those shapes.
|
||||
| FindShape_Wide | 71D5 | POP AF | Add 10 to the width. | |
| 71D6 | ADD A,$10 | |||
| 71D8 | PUSH AF | |||
|
Store the width and height.
|
||||
| FindShape_Store | 71D9 | POP AF | Restore the width from the stack. | |
| 71DA | LD ($5BC4),A | Store the width in Row_Width and Column_Counter. | ||
| 71DD | LD ($5BC6),A | |||
| 71E0 | POP AF | Restore the header from the stack. | ||
| 71E1 | AND %00001111 | Keep only bits 0-3. | ||
| 71E3 | INC A | Add one. | ||
| 71E4 | LD ($5BC5),A | Store the height in Row_Height and Rows_Remaining. | ||
| 71E7 | LD ($5BC7),A | |||
| 71EA | RET | Return. | ||
| Prev: 7189 | Up: Map | Next: 71EB |