| Routines

08924: 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.
PLOT | 08924 | CALL STK_TO_BC | y-coordinate to B, x to C.
| 08927 | CALL PLOT_SUB | The subroutine is called.
| 08930 | JP TEMPS | Exit, setting temporary colours.
This entry point is used by the routine at DRAW_LINE.
PLOT_SUB | 08933 | LD (23677),BC | The system variable COORDS is set.
| 08937 | CALL PIXEL_ADD | Pixel address to HL.
| 08940 | LD B,A | B will count A+1 loops to get a zero to the correct place in A.
| 08941 | INC B
| 08942 | LD A,254 | The zero is entered.
PLOT_LOOP | 08944 | RRCA | Then lined up with the pixel bit position in the byte.
| 08945 | DJNZ PLOT_LOOP
| 08947 | LD B,A | Then copied to B.
| 08948 | LD A,(HL) | The pixel-byte is obtained in A.
| 08949 | LD C,(IY+87) | P-FLAG is obtained and first tested for OVER.
| 08952 | BIT 0,C
| 08954 | JR NZ,PL_TST_IN | Jump if OVER 1.
| 08956 | AND B | OVER 0 first makes the pixel zero.
PL_TST_IN | 08957 | BIT 2,C | Test for INVERSE.
| 08959 | JR NZ,PLOT_END | INVERSE 1 just leaves the pixel as it was (OVER 1) or zero (OVER 0).
| 08961 | XOR B | INVERSE 0 leaves the pixel complemented (OVER 1) or 1 (OVER 0).
| 08962 | CPL
PLOT_END | 08963 | LD (HL),A | The byte is entered. Its other bits are unchanged in every case.
| 08964 | JP PO_ATTR | Exit, setting attribute byte.