Prev: AD02 Up: Map Next: ADD6
ADB0: 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 ADB0 PUSH BC Stash the steps and the direction on the stack.
ADB1 CALL Plot_Pixel Plot a pixel.
ADB4 LD A,H Stash the high byte of the display file address in AF'.
ADB5 EX AF,AF'
ADB6 LD A,($AAA1) Fetch the fraction of the line.
ADB9 LD H,C Copy the x position to H.
ADBA LD B,L Stash the low byte of the display file address in B.
ADBB LD L,A Copy the fraction to L.
ADBC ADD HL,DE Add the slope to the x position and the fraction.
ADBD LD A,L Copy the new fraction to A.
ADBE LD ($AAA1),A Store it as the fraction of the line.
ADC1 LD C,H Copy the new x position to C.
ADC2 LD A,B Restore the low byte of the display file address.
ADC3 AND %11100000 Keep only the row bits of the low byte.
ADC5 LD B,A Store them in B.
ADC6 LD A,C Copy the new x position to A.
ADC7 RRA Divide the x position by 08.
ADC8 RRA
ADC9 RRA
ADCA AND %00011111 Keep only five bits to make the column.
ADCC OR B Combine the row bits with the column.
ADCD LD L,A Store the new low byte of the display file address in L.
ADCE LD A,C Copy the new x position to A.
ADCF POP BC Restore the steps and the direction from the stack.
ADD0 LD C,A Store the new x position in C.
ADD1 EX AF,AF' Restore the high byte of the display file address and store it in H.
ADD2 LD H,A
ADD3 JP ScreenPosition1PixelAbove Jump to ScreenPosition1PixelAbove to move up a pixel line.
Prev: AD02 Up: Map Next: ADD6