![]() |
Routines |
| Prev: 54041 | Up: Map | Next: 54664 |
|
Used by the routine at NextStep.
Sets up the drawing of the piece of picture for a step of a segment. Normally the routine for the type of the segment and the address of its picture are looked up in the table at ShapeTablePointer (four bytes for each type: the routine, which goes into IY, and the picture) and the screen address for the start of the piece is found with FindSegmentAddress. Then, depending on the type of the segment and where on the screen it is, the routine sets the displacement of the jump at JumpToDrawingRoutine_Jump (in 55042) to choose a routine, and changes the instructions of the drawing routines to suit. Steps that were set up already start at SetUpPiece_Type.
|
||||||||||
| SetUpPiece | 54226 | LD E,(HL) | Read HL into E. | |||||||
| 54227 | LD A,(IX+1) | Read offset 1 of IX. | ||||||||
| 54230 | AND A | Jump to SetUpPiece_Type if A is not zero. | ||||||||
| 54231 | JP NZ,SetUpPiece_Type | |||||||||
| SetUpPiece_Table | 54234 | EXX | Switch to the alternate registers. | |||||||
| 54235 | LD HL,(52413) | Fetch the word at ShapeTablePointer into HL. | ||||||||
| 54238 | LD E,(IX+3) | Read offset 3 of IX into E. | ||||||||
| 54241 | LD D,0 | Clear D. | ||||||||
| 54243 | SLA E | Shift E left. | ||||||||
| 54245 | SLA E | Shift E left. | ||||||||
| 54247 | ADD HL,DE | HL gains DE. | ||||||||
| 54248 | LD C,(HL) | Read HL into C. | ||||||||
| 54249 | INC HL | Advance HL. | ||||||||
| 54250 | LD B,(HL) | Read HL into B. | ||||||||
| 54251 | INC HL | Advance HL. | ||||||||
| 54252 | PUSH BC | Stash BC on the stack. | ||||||||
| 54253 | POP IY | Bring IY back off the stack. | ||||||||
| 54255 | LD C,(HL) | Read HL into C. | ||||||||
| 54256 | INC HL | Advance HL. | ||||||||
| 54257 | LD B,(HL) | Read HL into B. | ||||||||
| 54258 | LD (52807),BC | Update the picture pointer. | ||||||||
| 54262 | LD A,(52826) | The vertical step copy. | ||||||||
| 54265 | SRL A | Shift A right. | ||||||||
| 54267 | LD (52800),A | Update the segment height. | ||||||||
| 54270 | CALL FindSegmentAddress | Call FindSegmentAddress. | ||||||||
| 54273 | LD A,(52790) | The column step. | ||||||||
| 54276 | LD B,A | B=A. | ||||||||
| 54277 | LD A,L | A=L. | ||||||||
| 54278 | SUB B | Subtract B from A. | ||||||||
| 54279 | LD L,A | L=A. | ||||||||
| 54280 | LD (52809),HL | Update the segment screen address. | ||||||||
| 54283 | LD DE,(52811) | Fetch the word at PictureOffsetsPointer into DE. | ||||||||
| 54287 | LD A,(IX+3) | Read offset 3 of IX. | ||||||||
| 54290 | CP 7 | Jump to SetUpPiece_Offsets if A is less than 7. | ||||||||
| 54292 | JR C,SetUpPiece_Offsets | |||||||||
| 54294 | SUB 7 | Subtract 7 from A. | ||||||||
| SetUpPiece_Offsets | 54296 | ADD A,A | Double A. | |||||||
| 54297 | LD H,A | H=A. | ||||||||
| 54298 | ADD A,A | Double A. | ||||||||
| 54299 | ADD A,H | A gains H. | ||||||||
| 54300 | LD L,A | L=A. | ||||||||
| 54301 | LD H,0 | Clear H. | ||||||||
| 54303 | ADD HL,DE | HL gains DE. | ||||||||
| 54304 | LD (52817),HL | Update the segment picture offsets. | ||||||||
| 54307 | EXX | Switch to the alternate registers. | ||||||||
| 54308 | XOR A | Clear A. | ||||||||
| 54309 | LD D,A | D=A. | ||||||||
| 54310 | LD (54400),A | Shorten the piece by one column. | ||||||||
| 54313 | LD A,(IX+0) | Read offset 0 of IX. | ||||||||
| 54316 | AND %00000111 | Keep the bits of A that are set in 7. | ||||||||
| 54318 | JR NZ,SetUpPiece_Type | Jump to SetUpPiece_Type if the zero flag is clear. | ||||||||
| 54320 | LD A,1 | A=1. | ||||||||
| 54322 | LD (54400),A | Keep the width of the piece. | ||||||||
| SetUpPiece_Type | 54325 | LD A,(52825) | The horizontal step copy. | |||||||
| 54328 | AND A | Jump to SetUpPiece_Slope if A is not zero. | ||||||||
| 54329 | JR NZ,SetUpPiece_Slope | |||||||||
| 54331 | LD A,D | A=D. | ||||||||
| 54332 | AND A | Jump to LocatePicture if A is not zero. | ||||||||
| 54333 | JP NZ,LocatePicture | |||||||||
| 54336 | LD A,(58395) | The slope direction. | ||||||||
| 54339 | NEG | Negate A. | ||||||||
| 54341 | ADD A,A | Double A. | ||||||||
| 54342 | ADD A,A | Double A. | ||||||||
| 54343 | ADD A,A | Double A. | ||||||||
| 54344 | LD (52789),A | Update the horizontal step. | ||||||||
|
Flat segments are handled at SetUpFlatPiece.
|
||||||||||
| SetUpPiece_Slope | 54347 | XOR A | Clear A. | |||||||
| 54348 | LD (55042),A | Use the routine in IY. | ||||||||
| 54351 | LD A,(52791) | The vertical step. | ||||||||
| 54354 | AND A | Jump to SetUpFlatPiece if A is zero. | ||||||||
| 54355 | JP Z,SetUpFlatPiece | |||||||||
| 54358 | LD A,(23596) | The segment screen column. | ||||||||
| 54361 | CP 209 | Jump to SetUpPiece_Left if A is less than 209. | ||||||||
| 54363 | JP C,SetUpPiece_Left | |||||||||
| 54366 | LD B,A | B=A. | ||||||||
| 54367 | LD A,(52789) | The horizontal step. | ||||||||
|
The displacement of this jump is set by SetSlopeParameters: it is zero when the second step of the slope is negative, so that the next instruction is run, and two otherwise, to skip it.
|
||||||||||
| SetUpPiece_Patched | 54370 | JR SetUpPiece_Patched | Skip ahead by the displacement at 54371. | |||||||
| 54372 | NEG | Negate A. | ||||||||
| 54374 | ADD A,B | A gains B. | ||||||||
| 54375 | CP 233 | Jump to SetUpPiece_Left if A is less than 233. | ||||||||
| 54377 | JP C,SetUpPiece_Left | |||||||||
| 54380 | LD A,B | A=B. | ||||||||
| 54381 | CP 224 | Jump to SetUpPiece_Reverse if A is less than 224. | ||||||||
| 54383 | JR C,SetUpPiece_Reverse | |||||||||
| 54385 | LD A,(58395) | The slope direction. | ||||||||
| 54388 | CP 1 | Jump to SetUpPiece_Edge if A is 1. | ||||||||
| 54390 | JR Z,SetUpPiece_Edge | |||||||||
| 54392 | LD A,(52790) | The column step. | ||||||||
| 54395 | LD B,A | B=A. | ||||||||
| 54396 | LD A,33 | A=33. | ||||||||
| 54398 | SUB B | Subtract B from A. | ||||||||
| SetUpPiece_ShortPatch | 54399 | JR SetUpPiece_ShortPatch | Skip ahead by the displacement at 54400. | |||||||
| 54401 | DEC A | Step A back. | ||||||||
| 54402 | LD (56210),A | Whether the second byte of the slope row is skipped. | ||||||||
| 54405 | LD A,2 | A=2. | ||||||||
| 54407 | LD (55042),A | Draw the slope rows. | ||||||||
| 54410 | LD A,(52825) | The horizontal step copy. | ||||||||
| 54413 | AND A | Call AdvanceScreenAddress if A is zero. | ||||||||
| 54414 | CALL Z,AdvanceScreenAddress | |||||||||
| 54417 | JP LocatePicture | Jump to LocatePicture. | ||||||||
| SetUpPiece_Reverse | 54420 | LD A,(58395) | The slope direction. | |||||||
| 54423 | CP 1 | Jump to SetUpPiece_Draw if A is 1. | ||||||||
| 54425 | JR Z,SetUpPiece_Draw | |||||||||
| 54427 | XOR A | Clear A. | ||||||||
| 54428 | LD (56210),A | Draw both bytes of the slope row. | ||||||||
| 54431 | LD A,2 | A=2. | ||||||||
| 54433 | LD (55042),A | Draw the slope rows. | ||||||||
| 54436 | JP LocatePicture | Jump to LocatePicture. | ||||||||
| SetUpPiece_Edge | 54439 | LD A,(54400) | Whether the piece was shortened. | |||||||
| 54442 | LD (54455),A | Whether the piece is shortened at the edge. | ||||||||
| 54445 | LD A,(52790) | The column step. | ||||||||
| 54448 | NEG | Negate A. | ||||||||
| 54450 | LD B,A | B=A. | ||||||||
| 54451 | LD A,41 | A=41. | ||||||||
| 54453 | SUB B | Subtract B from A. | ||||||||
| SetUpPiece_EdgePatch | 54454 | JR SetUpPiece_EdgePatch | Skip ahead by the displacement at 54455. | |||||||
| SetUpPiece_Draw | 54456 | DEC A | Step A back. | |||||||
| 54457 | LD (56410),A | How far to skip along the mirrored row. | ||||||||
| 54460 | LD A,5 | A=5. | ||||||||
| 54462 | LD (55042),A | Draw the mirrored slope rows. | ||||||||
| 54465 | LD A,(52825) | The horizontal step copy. | ||||||||
| 54468 | AND A | Call AdvanceScreenAddress if A is zero. | ||||||||
| 54469 | CALL Z,AdvanceScreenAddress | |||||||||
| 54472 | JP LocatePicture | Jump to LocatePicture. | ||||||||
| SetUpPiece_Left | 54475 | LD A,(23596) | The segment screen column. | |||||||
| 54478 | ADD A,8 | Add 8 to A. | ||||||||
| 54480 | CP 15 | Jump to SetUpPiece_Direction if A is less than 15. | ||||||||
| 54482 | JR C,SetUpPiece_Direction | |||||||||
| 54484 | LD A,(52825) | The horizontal step copy. | ||||||||
| 54487 | AND A | Jump to LocatePicture if A is not zero. | ||||||||
| 54488 | JP NZ,LocatePicture | |||||||||
| 54491 | CALL AdvanceScreenAddress | Call AdvanceScreenAddress. | ||||||||
| 54494 | JP LocatePicture | Jump to LocatePicture. | ||||||||
| SetUpPiece_Direction | 54497 | LD A,(58395) | The slope direction. | |||||||
| 54500 | CP 1 | Jump to SetUpPiece_Backwards if A is 1. | ||||||||
| 54502 | JR Z,SetUpPiece_Backwards | |||||||||
| 54504 | LD A,(52809) | The segment screen address. | ||||||||
| 54507 | AND %00011111 | Keep the bits of A that are set in 31. | ||||||||
| 54509 | CP 29 | Jump to SetUpPiece_Column29 if A is 29. | ||||||||
| 54511 | JR Z,SetUpPiece_Column29 | |||||||||
| 54513 | CP 30 | Jump to SetUpPiece_Column30 if A is 30. | ||||||||
| 54515 | JR Z,SetUpPiece_Column30 | |||||||||
| SetUpPiece_Flat | 54517 | LD A,(52825) | The horizontal step copy. | |||||||
| 54520 | AND A | Call AdvanceScreenAddress if A is zero. | ||||||||
| 54521 | CALL Z,AdvanceScreenAddress | |||||||||
| 54524 | LD A,(52790) | The column step. | ||||||||
| 54527 | LD (23598),A | Update the piece column. | ||||||||
| 54530 | LD A,44 | A=44. | ||||||||
| 54532 | LD (56262),A | Skip along the slope row. | ||||||||
| SetUpPiece_SetCounts | 54535 | LD A,1 | A=1. | |||||||
| 54537 | LD (56257),A | Skip a word of the picture. | ||||||||
| SetUpPiece_SelectEight | 54540 | LD A,8 | A=8. | |||||||
| 54542 | LD (55042),A | Draw the slope rows from the edge. | ||||||||
| 54545 | JP LocatePicture | Jump to LocatePicture. | ||||||||
| SetUpPiece_Column29 | 54548 | LD A,1 | A=1. | |||||||
| 54550 | LD (23598),A | Update the piece column. | ||||||||
| 54553 | XOR A | Clear A. | ||||||||
| 54554 | LD (56257),A | Keep the word of the picture. | ||||||||
| 54557 | LD A,48 | A=48. | ||||||||
| 54559 | LD (56262),A | Skip further along the slope row. | ||||||||
| 54562 | JP SetUpPiece_SelectEight | Jump to SetUpPiece_SelectEight. | ||||||||
| SetUpPiece_Column30 | 54565 | LD A,(54400) | Whether the piece was shortened. | |||||||
| 54568 | CP 1 | Jump to SetUpPiece_Flat if A is 1. | ||||||||
| 54570 | JR Z,SetUpPiece_Flat | |||||||||
| 54572 | LD A,(52790) | The column step. | ||||||||
| 54575 | LD (23598),A | Update the piece column. | ||||||||
| 54578 | XOR A | Clear A. | ||||||||
| 54579 | LD (56262),A | Do not skip along the slope row. | ||||||||
| 54582 | JP SetUpPiece_SetCounts | Jump to SetUpPiece_SetCounts. | ||||||||
| SetUpPiece_Backwards | 54585 | LD A,(52790) | The column step. | |||||||
| 54588 | LD B,A | B=A. | ||||||||
| 54589 | LD A,(52809) | The segment screen address. | ||||||||
| 54592 | SUB B | Subtract B from A. | ||||||||
| 54593 | AND %00011111 | Keep the bits of A that are set in 31. | ||||||||
| 54595 | CP 2 | Jump to SetUpPiece_Two if A is 2. | ||||||||
| 54597 | JR Z,SetUpPiece_Two | |||||||||
| 54599 | CP 3 | Jump to SetUpPiece_Three if A is 3. | ||||||||
| 54601 | JR Z,SetUpPiece_Three | |||||||||
| 54603 | LD A,(54400) | Whether the piece was shortened. | ||||||||
| 54606 | CP 1 | Jump to SetUpPiece_Two if A is 1. | ||||||||
| 54608 | JR Z,SetUpPiece_Two | |||||||||
| 54610 | XOR A | Clear A. | ||||||||
| 54611 | LD (56340),A | Do not skip along the mirrored slope row. | ||||||||
| 54614 | INC A | Advance A. | ||||||||
| SetUpPiece_SelectEleven | 54615 | LD (56332),A | Whether a word of the mirrored picture is skipped. | |||||||
| 54618 | LD A,11 | A=11. | ||||||||
| 54620 | LD (55042),A | Draw the mirrored rows from the edge. | ||||||||
| 54623 | JP LocatePicture | Jump to LocatePicture. | ||||||||
| SetUpPiece_Two | 54626 | LD A,(52825) | The horizontal step copy. | |||||||
| 54629 | AND A | Call AdvanceScreenAddress if A is zero. | ||||||||
| 54630 | CALL Z,AdvanceScreenAddress | |||||||||
| 54633 | LD A,38 | A=38. | ||||||||
| 54635 | LD (56340),A | Skip along the mirrored slope row. | ||||||||
| 54638 | LD A,1 | A=1. | ||||||||
| 54640 | JP SetUpPiece_SelectEleven | Jump to SetUpPiece_SelectEleven. | ||||||||
| SetUpPiece_Three | 54643 | LD A,D | A=D. | |||||||
| 54644 | AND A | Jump to SetUpPiece_ThreeBytes if A is not zero. | ||||||||
| 54645 | JR NZ,SetUpPiece_ThreeBytes | |||||||||
| 54647 | LD A,(52809) | The segment screen address. | ||||||||
| 54650 | SUB 32 | Subtract 32 from A. | ||||||||
| 54652 | LD (52809),A | Update the segment screen address. | ||||||||
| SetUpPiece_ThreeBytes | 54655 | LD A,42 | A=42. | |||||||
| 54657 | LD (56340),A | Skip further along the mirrored slope row. | ||||||||
| 54660 | XOR A | Clear A. | ||||||||
| 54661 | JP SetUpPiece_SelectEleven | Jump to SetUpPiece_SelectEleven. | ||||||||
| Prev: 54041 | Up: Map | Next: 54664 |