Prev: 44290 Up: Map Next: 44502
44464: Draw Line Step
Used by the routine at Draw_Line.
Draws one step of a line. It plots a pixel with Plot_Pixel, adds the slope in DE and the fraction in Shadow_Line_Fraction to the x position, and moves the display file address across by the new x position and up by one pixel line.
Input
HL Display file address
C x position
DE Slope
Output
HL New display file address
C New x position
Draw_Line_Step 44464 PUSH BC Stash the steps and the direction on the stack.
44465 CALL Plot_Pixel Plot a pixel.
44468 LD A,H Stash the high byte of the display file address in AF'.
44469 EX AF,AF'
44470 LD A,(43681) Fetch the fraction of the line.
44473 LD H,C Copy the x position to H.
44474 LD B,L Stash the low byte of the display file address in B.
44475 LD L,A Copy the fraction to L.
44476 ADD HL,DE Add the slope to the x position and the fraction.
44477 LD A,L Copy the new fraction to A.
44478 LD (43681),A Store it as the fraction of the line.
44481 LD C,H Copy the new x position to C.
44482 LD A,B Restore the low byte of the display file address.
44483 AND %11100000 Keep only the row bits of the low byte.
44485 LD B,A Store them in B.
44486 LD A,C Copy the new x position to A.
44487 RRA Divide the x position by 8.
44488 RRA
44489 RRA
44490 AND %00011111 Keep only five bits to make the column.
44492 OR B Combine the row bits with the column.
44493 LD L,A Store the new low byte of the display file address in L.
44494 LD A,C Copy the new x position to A.
44495 POP BC Restore the steps and the direction from the stack.
44496 LD C,A Store the new x position in C.
44497 EX AF,AF' Restore the high byte of the display file address and store it in H.
44498 LD H,A
44499 JP ScreenPosition1PixelAbove Jump to ScreenPosition1PixelAbove to move up a pixel line.
Prev: 44290 Up: Map Next: 44502