Prev: F565 Up: Map Next: F5D2
F56E: Drawing Line
Used by the routine at Drawing.
Draws a straight line from the pen. Bit 0 of the direction chooses a steep line.
DrawingLine F56E BIT 0,C Jump ahead to DrawingLine_PlotPixel if bit 0 is set (steep line).
F570 JR NZ,DrawingLine_PlotPixel
F572 PUSH HL Keep the picture pointer and the counters, then plot this pixel.
F573 PUSH BC
DrawingLine_0 F574 CALL PlotPixel
F577 BIT 2,C Jump ahead to DrawingLine_Next if bit 2 is clear.
F579 JR Z,DrawingLine_Next
F57B CALL StepPenLeft Go to DrawingLine_BringSavedCount if the pen is already at the left edge.
F57E JR Z,DrawingLine_BringSavedCount
F580 JR DrawingLine_TestCountFinished The pen has moved left, so skip the rightward step and join DrawingLine_TestCountFinished.
Steps the pen right, and steps it up or down (bit 1) when this pixel column is finished.
DrawingLine_Next F582 CALL StepPenRight Go to DrawingLine_BringSavedCount if the pen is already at the right edge.
F585 JR Z,DrawingLine_BringSavedCount
DrawingLine_TestCountFinished F587 DEC B Jump ahead to DrawingLine_1 if the count is not finished.
F588 JR NZ,DrawingLine_1
F58A BIT 1,C Jump ahead to DrawingLine_StepPenUp if bit 1 is clear.
F58C JR Z,DrawingLine_StepPenUp
F58E CALL StepPenDown Go to DrawingLine_BringSavedCount if the pen is already at the bottom edge.
F591 JR Z,DrawingLine_BringSavedCount
F593 JR DrawingLine_CountHasRun Carry on with the line once this step is ready.
Steps the pen up and repeats for the pixels still left.
DrawingLine_StepPenUp F595 CALL StepPenUp Go to DrawingLine_BringSavedCount if the pen is already at the top edge.
F598 JR Z,DrawingLine_BringSavedCount
DrawingLine_CountHasRun F59A POP BC Restore the counters from the stack.
F59B PUSH BC Keep a copy, and plot the next pixel from DrawingLine_0 until the length in L runs out.
DrawingLine_1 F59C DEC L
F59D JR NZ,DrawingLine_0
DrawingLine_BringSavedCount F59F POP BC Restore the saved count and the saved pointer from the stack.
F5A0 POP HL
F5A1 RET Return.
Plots this pixel and steps down when bit 1 is set.
DrawingLine_PlotPixel F5A2 PUSH HL Keep the picture pointer and the counters, then plot this pixel.
F5A3 PUSH BC
DrawingLine_2 F5A4 CALL PlotPixel
F5A7 BIT 1,C Jump ahead to DrawingLine_StepPenUpAgain if bit 1 is clear.
F5A9 JR Z,DrawingLine_StepPenUpAgain
F5AB CALL StepPenDown Go to DrawingLine_BringSavedCountAgain if the pen is already at the bottom edge.
F5AE JR Z,DrawingLine_BringSavedCountAgain
F5B0 JR DrawingLine_TestCountFinishedAgain Skip the upward step and carry on from DrawingLine_TestCountFinishedAgain.
Steps the pen up, and steps it left or right when this pixel row is finished.
DrawingLine_StepPenUpAgain F5B2 CALL StepPenUp Go to DrawingLine_BringSavedCountAgain if the pen is already at the top edge.
F5B5 JR Z,DrawingLine_BringSavedCountAgain
DrawingLine_TestCountFinishedAgain F5B7 DEC B Jump ahead to DrawingLine_3 if the count is not finished.
F5B8 JR NZ,DrawingLine_3
F5BA BIT 2,C Jump ahead to DrawingLine_StepsPenRight if bit 2 is clear.
F5BC JR Z,DrawingLine_StepsPenRight
F5BE CALL StepPenLeft Go to DrawingLine_BringSavedCountAgain if the pen is already at the left edge.
F5C1 JR Z,DrawingLine_BringSavedCountAgain
F5C3 JR DrawingLine_CountHasRunAgain Carry on with the line once the other step is ready.
Steps the pen right and repeats for the pixels still left.
DrawingLine_StepsPenRight F5C5 CALL StepPenRight Go to DrawingLine_BringSavedCountAgain if the pen is already at the right edge.
F5C8 JR Z,DrawingLine_BringSavedCountAgain
DrawingLine_CountHasRunAgain F5CA POP BC Restore the counters from the stack.
F5CB PUSH BC And plot the next pixel from DrawingLine_2 until the length in L runs out.
DrawingLine_3 F5CC DEC L
F5CD JR NZ,DrawingLine_2
DrawingLine_BringSavedCountAgain F5CF POP BC Restore the saved count and the saved pointer from the stack.
F5D0 POP HL
F5D1 RET Return.
View the equivalent code in;
Prev: F565 Up: Map Next: F5D2