 
*  ED:/PREDC    40 col        Jul / 11 / 93
*---------------------
*  Minimum Function
 
*  Patch to speed screen mapping - move to PAD
*----------------------------------------------
 
PAD01  MOVB *R10+,*R14
       DEC  R9                R14 = VDPWD
       JGT  PAD01-38
       RT
       DATA >2020             Fast space data
 
FCLOOP MOVB *R8+,*R9+
       DEC  R12
       JGT  FCLOOP
       RT
FCLEN  EQU  $-PAD01
FCEND  EQU  $
 
 
*  Code overlay -- write over REFRMT for Pr/Ed
*---------------------------------------------
 
ASMCOD EQU   $                71 w
       MOV   R11,R14          Save return
       ABS   @ASPARS          Check if in ASMODE
       JEQ   ASMCEX           No
 
       LI   R15,'* '          Load comparison bytes
       MOV  @BUFADR,R8        Point to current line buffer
       CB   *R8,R15           Comment line ?
       JEQ  ASMCEX            Yup - no further action
 
*  Not a comment line
 
       SWPB R15               Blank for byte comparisons
       MOV  R8,R9             Copy pointer
       AI   R9,LLL            Point to end of line
 
*  Do label field
 
LABEL  C    R8,R9             End of line ?
       JHE  ASMCEX            Yes
       CB   *R8,R15           Blank ?
       JEQ  GAP1              Yes - go scan for next field
 
       BL   @CNVLC8           UPCASE
       INC  R8                Next char
       JMP  LABEL             Go look at it
 
*  Cross gap to Opcode field
 
GAP1   C    R8,R9             End of line ?
       JHE  ASMCEX            Quit
       CB   *R8+,R15          Blank ?
       JEQ  GAP1              Yes
       DEC  R8                Back off to char
 
*  Check Opcode field for illegal chars
 
OPCODF C    R8,R9             End of line ?
       JHE  ASMCEX            Yes
       CB   *R8,R15           Blank ?
       JEQ  GAP2              Yes
 
       BL   @CNVLC8           UPCASE
       CB   *R8,@UCA          Lower ASCII limit "A" ?
       JL   ASMERR            Bad char
       CB   *R8+,@UCZ         Upper ASCII limit "Z" ?
       JH   ASMERR            Bad char
       JMP  OPCODF            Check next
 
*  Search for Operand field
 
GAP2   C    R8,R9             End of line ?
       JHE  ASMCEX            Quit
       CB   *R8+,R15          Blank ?
       JEQ  GAP2              Yes
       DEC  R8                Back off to char
 
*  Convert Operand field
 
       CLR  R10               Quote counter
OPRND  C    R8,R9             End of line ?
       JHE  OPND30            Yes
 
       CB   *R8,@SQUOTE       "'" ?
       JNE  OPND10
 
       DEC  R10               Toggle quote indicator
OPND10 ABS  R10               Check if even or odd # of quotes
       JNE  OPND20
 
       CB   *R8,R15           Blank ?
       JEQ  OPND30
 
       BL   @CNVLC8           UPCASE
       CB   *R8,@PERIOD       "." for "," is common typo
       JEQ  ASMERR            Bloop it
 
OPND20 INC  R8                Next char
       JMP  OPRND             Do it again
 
*  Check quotes on way out
 
OPND30 ABS R10                Uneven # of quotes
       JNE ASMERR             Sound the alarm
 
ASMCEX BLWP @UPDTLN           Update edit buffer
       B    *R14              Return
 
ASMERR BL   @HONK             Show displeasure
       JMP  ASMCEX            Don't do next to make more obvious still
 
*  Previous line-start align and insert new line
 
PRET10 EQU  $
       BL   @UPDT10           Current line to text buffer
PRTB10 BL   @>0               ENTRY writes in
       MOV  R8,R2             Use first non-blank position
       INC  R1                Next line - blank line re-entry
       B    @INSERU           Go insert blank and set cursor on it
 
PRED10 EQU  $
       MOV  R11,R14           Save return
PRTB20 BL   @>0               ENTRY writes in
       B    *R14              Ignore if non-blank
       B    @DELLIN           Delete the blank line
 
*  Check for blank line between margins
 
CHKBLK EQU  $
       MOV  @LMRG,R8          Start at left margin
CHBL10 MOV  @LINADR,R9        Current line buffer
       A    R8,R9             Index into line
       CB   *R9,@DSPACE       Search for non-blank
       JNE  CHBL20            Found
       INC  R8                Next char
       C    R8,@RMRG          Stop at right margin
       JL   CHBL10            Loop on it
       INCT R11               Step over for blank line
CHBL20 B    *R11              Non-blank line - direct return
 
 
ASMLEN EQU  $-ASMCOD          Length of replacement block
PRETTY EQU  PRET10-ASMCOD     Offset value for entry code
PREDEL EQU  PRED10-ASMCOD     Offset value for entry code
CHKBLM EQU  CHKBLK-ASMCOD     Offset value for entry code
PRDOF1 EQU  PREDEL-PRETTY
PRDOF2 EQU  CHKBLM-PREDEL
ASMCM2 EQU  ASMCOD-2
PRTB12 EQU  PRTB10+2
PRTB22 EQU  PRTB20+2
 
*----------------------------------------------
 
