Prev: 22CB Up: Map Next: 2307
22DC: THE 'PLOT' COMMAND ROUTINE
The address of this routine is found in the parameter table.
This routine consists of a main subroutine plus one line to call it and one line to exit from it. The main routine is used twice by CIRCLE and the subroutine is called by DRAW_LINE. The routine is entered with the coordinates of a pixel on the calculator stack. It finds the address of that pixel and plots it, taking account of the status of INVERSE and OVER held in the P-FLAG.
Input
Output
PLOT 22DC CALL STK_TO_BC y-coordinate to B, x to C.
22DF CALL PLOT_SUB The subroutine is called.
22E2 JP TEMPS Exit, setting temporary colours.
This entry point is used by the routine at DRAW_LINE.
PLOT_SUB 22E5 LD ($5C7D),BC The system variable COORDS is set.
22E9 CALL PIXEL_ADD Pixel address to HL.
22EC LD B,A B will count A+1 loops to get a zero to the correct place in A.
22ED INC B
22EE LD A,$FE The zero is entered.
PLOT_LOOP 22F0 RRCA Then lined up with the pixel bit position in the byte.
22F1 DJNZ PLOT_LOOP
22F3 LD B,A Then copied to B.
22F4 LD A,(HL) The pixel-byte is obtained in A.
22F5 LD C,(IY+$57) P-FLAG is obtained and first tested for OVER.
22F8 BIT 0,C
22FA JR NZ,PL_TST_IN Jump if OVER 1.
22FC AND B OVER 0 first makes the pixel zero.
PL_TST_IN 22FD BIT 2,C Test for INVERSE.
22FF JR NZ,PLOT_END INVERSE 1 just leaves the pixel as it was (OVER 1) or zero (OVER 0).
2301 XOR B INVERSE 0 leaves the pixel complemented (OVER 1) or 1 (OVER 0).
2302 CPL
PLOT_END 2303 LD (HL),A The byte is entered. Its other bits are unchanged in every case.
2304 JP PO_ATTR Exit, setting attribute byte.
Prev: 22CB Up: Map Next: 2307