![]() |
Routines |
| Prev: 62821 | Up: Map | Next: 62930 |
|
Used by the routine at Drawing.
Draws a straight line from the pen. Bit 0 of the direction chooses a steep line.
|
||||
| DrawingLine | 62830 | BIT 0,C | Jump ahead to DrawingLine_PlotPixel if bit 0 is set (steep line). | |
| 62832 | JR NZ,DrawingLine_PlotPixel | |||
| 62834 | PUSH HL | Keep the picture pointer and the counters, then plot this pixel. | ||
| 62835 | PUSH BC | |||
| DrawingLine_0 | 62836 | CALL PlotPixel | ||
| 62839 | BIT 2,C | Jump ahead to DrawingLine_Next if bit 2 is clear. | ||
| 62841 | JR Z,DrawingLine_Next | |||
| 62843 | CALL StepPenLeft | Go to DrawingLine_BringSavedCount if the pen is already at the left edge. | ||
| 62846 | JR Z,DrawingLine_BringSavedCount | |||
| 62848 | 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 | 62850 | CALL StepPenRight | Go to DrawingLine_BringSavedCount if the pen is already at the right edge. | |
| 62853 | JR Z,DrawingLine_BringSavedCount | |||
| DrawingLine_TestCountFinished | 62855 | DEC B | Jump ahead to DrawingLine_1 if the count is not finished. | |
| 62856 | JR NZ,DrawingLine_1 | |||
| 62858 | BIT 1,C | Jump ahead to DrawingLine_StepPenUp if bit 1 is clear. | ||
| 62860 | JR Z,DrawingLine_StepPenUp | |||
| 62862 | CALL StepPenDown | Go to DrawingLine_BringSavedCount if the pen is already at the bottom edge. | ||
| 62865 | JR Z,DrawingLine_BringSavedCount | |||
| 62867 | 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 | 62869 | CALL StepPenUp | Go to DrawingLine_BringSavedCount if the pen is already at the top edge. | |
| 62872 | JR Z,DrawingLine_BringSavedCount | |||
| DrawingLine_CountHasRun | 62874 | POP BC | Restore the counters from the stack. | |
| 62875 | PUSH BC | Keep a copy, and plot the next pixel from DrawingLine_0 until the length in L runs out. | ||
| DrawingLine_1 | 62876 | DEC L | ||
| 62877 | JR NZ,DrawingLine_0 | |||
| DrawingLine_BringSavedCount | 62879 | POP BC | Restore the saved count and the saved pointer from the stack. | |
| 62880 | POP HL | |||
| 62881 | RET | Return. | ||
|
Plots this pixel and steps down when bit 1 is set.
|
||||
| DrawingLine_PlotPixel | 62882 | PUSH HL | Keep the picture pointer and the counters, then plot this pixel. | |
| 62883 | PUSH BC | |||
| DrawingLine_2 | 62884 | CALL PlotPixel | ||
| 62887 | BIT 1,C | Jump ahead to DrawingLine_StepPenUpAgain if bit 1 is clear. | ||
| 62889 | JR Z,DrawingLine_StepPenUpAgain | |||
| 62891 | CALL StepPenDown | Go to DrawingLine_BringSavedCountAgain if the pen is already at the bottom edge. | ||
| 62894 | JR Z,DrawingLine_BringSavedCountAgain | |||
| 62896 | 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 | 62898 | CALL StepPenUp | Go to DrawingLine_BringSavedCountAgain if the pen is already at the top edge. | |
| 62901 | JR Z,DrawingLine_BringSavedCountAgain | |||
| DrawingLine_TestCountFinishedAgain | 62903 | DEC B | Jump ahead to DrawingLine_3 if the count is not finished. | |
| 62904 | JR NZ,DrawingLine_3 | |||
| 62906 | BIT 2,C | Jump ahead to DrawingLine_StepsPenRight if bit 2 is clear. | ||
| 62908 | JR Z,DrawingLine_StepsPenRight | |||
| 62910 | CALL StepPenLeft | Go to DrawingLine_BringSavedCountAgain if the pen is already at the left edge. | ||
| 62913 | JR Z,DrawingLine_BringSavedCountAgain | |||
| 62915 | 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 | 62917 | CALL StepPenRight | Go to DrawingLine_BringSavedCountAgain if the pen is already at the right edge. | |
| 62920 | JR Z,DrawingLine_BringSavedCountAgain | |||
| DrawingLine_CountHasRunAgain | 62922 | POP BC | Restore the counters from the stack. | |
| 62923 | PUSH BC | And plot the next pixel from DrawingLine_2 until the length in L runs out. | ||
| DrawingLine_3 | 62924 | DEC L | ||
| 62925 | JR NZ,DrawingLine_2 | |||
| DrawingLine_BringSavedCountAgain | 62927 | POP BC | Restore the saved count and the saved pointer from the stack. | |
| 62928 | POP HL | |||
| 62929 | RET | Return. | ||
|
View the equivalent code in;
|
||||
| Prev: 62821 | Up: Map | Next: 62930 |