Prev: 55390 Up: Map Next: 55514
55402: Draw Edge Pixels
Used by the routine at EndSegment.
Draws the pixels that finish the edge of a flat segment when the horizontal offset is not a multiple of eight. Nothing is drawn unless the segment is flat, its shape code (see EndShape) is 19 or 147 and steps have been flagged. The four bytes come from EdgePatternsRight or EdgePatternsLeft, depending on the type, and are stored going up the screen at the address in SegmentScreenAddress, except that only 2 are stored when the segment is at the top or bottom of the area.
Input
IX Address of the drawing record at ScrollWorld_Record
DrawEdgePixels 55402 LD A,(52791) The vertical step.
55405 AND A Return if A is not zero.
55406 RET NZ
55407 LD A,(23604) The segment end shape.
55410 AND %01111111 Keep the bits of A that are set in 127.
55412 CP 19 Return if A is not 19.
55414 RET NZ
55415 LD A,(23599) The flagged steps.
55418 AND A Return if A is zero.
55419 RET Z
55420 LD HL,55377 The edge patterns right.
55423 LD A,(IX+3) Read offset 3 of IX.
55426 AND A Jump to DrawEdgePixels_Table if A is zero.
55427 JR Z,DrawEdgePixels_Table
55429 LD HL,55390 The edge patterns left.
DrawEdgePixels_Table 55432 LD A,(52801) The horizontal offset.
55435 AND %00000111 Keep the bits of A that are set in 7.
55437 RET Z Return if the zero flag is set.
55438 DEC A Step A back.
55439 DEC A Step A back.
55440 ADD A,A Double A.
55441 LD E,A E=A.
55442 LD D,0 Clear D.
55444 ADD HL,DE HL gains DE.
55445 EX DE,HL Swap DE and HL.
55446 LD A,(55389) The edge flag.
55449 AND A Is A zero?
55450 LD HL,(52809) Fetch the word at SegmentScreenAddress into HL.
55453 JR Z,DrawEdgePixels_Address Jump to DrawEdgePixels_Address if the zero flag is set.
55455 LD (IX+1),0 Store 0 at offset 1 of IX.
55459 LD A,L A=L.
55460 SUB 32 Subtract 32 from A.
55462 LD L,A L=A.
55463 INC L Advance L.
55464 INC L Advance L.
55465 INC L Advance L.
DrawEdgePixels_Address 55466 INC L Advance L.
55467 INC L Advance L.
55468 INC L Advance L.
55469 LD A,L A=L.
55470 AND %00011111 Keep the bits of A that are set in 31.
55472 DEC A Step A back.
55473 CP 28 Return if A is 28 or more.
55475 RET NC
55476 LD B,4 B=4.
55478 LD A,(23597) The segment screen row.
55481 CP 185 Jump to DrawEdgePixels_Rows if A is not 185.
55483 JR NZ,DrawEdgePixels_Rows
55485 INC DE Advance DE.
55486 INC DE Advance DE.
55487 LD H,87 H=87.
55489 LD A,L A=L.
55490 AND %00011111 Keep the bits of A that are set in 31.
55492 OR %11000000 Set the bits of A that are set in 192.
55494 LD L,A L=A.
55495 LD B,2 B=2.
55497 JR DrawEdgePixels_Draw Jump to DrawEdgePixels_Draw.
DrawEdgePixels_Rows 55499 CP 25 Jump to DrawEdgePixels_Draw if A is not 25.
55501 JR NZ,DrawEdgePixels_Draw
55503 LD B,2 B=2.
DrawEdgePixels_Draw 55505 LD A,(DE) Read DE.
55506 LD (HL),A Write A where HL points.
55507 INC DE Advance DE.
55508 CALL MoveUpARow Call MoveUpARow.
55511 DJNZ DrawEdgePixels_Draw Decrease B and jump to DrawEdgePixels_Draw until none remain.
55513 RET Return.
Prev: 55390 Up: Map Next: 55514