* PLOT1.CMD  Plots points for PLOT.CMD
*
STORE 0 TO OUTBND
GO TOP
DO WHILE .NOT. EOF
  IF .NOT. *
    STORE (&XVAR-MINX)/(MAXX-MINX) TO XFRAC
    STORE (&YVAR-MINY)/(MAXY-MINY) TO YFRAC
    STORE PLOT:LF+1+INT((XFRAC*(PLOT:RT-PLOT:LF-1))+.5) TO XPOS
    STORE PLOT:BT-1-INT((YFRAC*(PLOT:BT-1))+.5) TO YPOS
* check if point is in bounds
    IF XPOS > PLOT:RT .OR. XPOS < PLOT:LF+1 .OR. YPOS > PLOT:BT-1;
        .OR. YPOS<0
      STORE OUTBND+1 TO OUTBND
    ELSE
* Point is in bounds so plot it
      IF YFRAC*(PLOT:BT-1) > INT(YFRAC*(PLOT:BT-1))+.5
        STORE T TO VF
      ELSE
        STORE F TO VF
      ENDIF
      IF XFRAC*(PLOT:RT-PLOT:LF-1) > INT(XFRAC*(PLOT:RT-PLOT:LF-1))+.5
        STORE T TO HF
      ELSE
        STORE F TO HF
      ENDIF
*
      DO CASE
        CASE VF .AND. HF
          STORE 6 TO CHRN
        CASE VF .AND. (.NOT. HF)
          STORE 7 TO CHRN
        CASE HF .AND. (.NOT. VF)
          STORE 18 TO CHRN
        OTHERWISE
          STORE 20 TO CHRN
      ENDCASE
*
     @ YPOS,XPOS SAY CHR(CHRN)
*
    ENDIF
  ENDIF
  SKIP
ENDDO
*
* Turn graphics off
@ 1,115 SAY ' '
? CHR(27)+CHR(71)
RETURN
