 
*  FVMAKE/S                   May / 06 / 94
*-------------------------------------------
*  For assembling components of EdRing Editor
*  Allows 2*>50 at mailbox
*  Saves low-mem to top of Load/Save
*  Saves files as EX & EY & EZ
*  Displays on screen values for labels
*  -----
*  SLAST  - End of HI-mem block
*  GAPLO  - Gap above lo-mem code
*  HMAREA - Start of Hi-mem area above permanent code
 
*  LSLEN  - Length of Load/Save module
*  BMLEN  - Length of Buffer/Mgr module
*  SDLEN  - Length of Show-Dir module
 
 
       AORG >E9B0             Overlay FSAVE
 
 
PABV   EQU  >F80
PBFV   EQU  >1000
 
DSRLNK EQU  >FFD4
KSCANA EQU  >FFD0
DELSPR EQU  >FFC8
VMBWD  EQU  >FFBA
CMSRET EQU  >FF5C
HEXDGS EQU  >FEA4
 
       REF  VMBR,VMBW
       REF  VSBW,VDPWD,KSCAN
 
       REF  LLAST,SLAST
       REF  HMAREA,SDLEN,LSLEN,BMLEN
       REF  VTEXTP,TXTVDL,HFIRST
 
       DEF  SAVE
 
*  Autostart entry defined for ScriptLoad
 
SAVE   EQU  $
       LIMI 0
       LWPI OUREG
 
*  Clear screen
 
       BLWP @VSBW             R0-2 preloaded
CLRS1  MOVB R15,*R8           VDPWD
       DEC  R2
       JNE  CLRS1
 
*  Write up size/gap data
 
       LI   R0,LLAST
       BL   *R10
       BL   *R5
       DATA TXGAP1
       A    R4,R3
 
       LI   R0,HMAREA
       BL   *R10
       BL   *R5
       DATA TXGAP2
       A    R4,R3
       A    R4,R3
 
       LI   R0,LSLEN
       BL   *R10
       BL   *R5
       DATA TXSIZ1
       A    R4,R3
 
       LI   R0,BMLEN
       BL   *R10
       BL   *R5
       DATA TXSIZ2
       A    R4,R3
 
       LI   R0,SDLEN
       BL   *R10
       BL   *R5
       DATA TXSIZ3
 
*  EX to disk
 
       LI   R0,PBFV+6
       LI   R1,>2000
       LI   R2,LLAST
       S    R1,R2
       BLWP *R7               @VMBW
       MOV  R2,@EDHDR+2
       LI   R1,EDHDR
       BL   @FILOP
 
*  EY back to disk
 
       LI   R0,PBFV+6
       LI   R1,>A0A0
       LI   R2,>1FFA
       BLWP *R7
       LI   R1,EEHDR
       BL   @FILON
 
*  EZ back to disk
 
       LI   R0,PBFV+6
       LI   R1,>A0A0+>1FFA
       LI   R2,SLAST
       S    R1,R2
       BLWP *R7
       MOV  R2,@EFHDR+2
       LI   R1,EFHDR
       BL   @FILON
 
*  Exit
 
EXITEM BLWP @VMBWD
       DATA >02E8,KEYMS,KEYML
KEY    BLWP @KSCANA
       JOP  KEY
 
       LWPI >FF7C
       MOV  @CMSRET,R11
       RT
 
*  Program file handler
 
FILON  AB   R12,@NXFILE
 
FILOP  EQU  $
       A    R14,R2            File length add 6
       MOV  R2,@FILLEN
       LI   R0,PBFV           Finish file header
       MOV  R14,R2            6
       BLWP *R7               VMBW
       BLWP *R6               VMBWD PAB to VDP
       DATA PABV
       DATA PABDAT,PABLEN
       MOV  R13,@>8356        PABV+9
       BLWP @DSRLNK
       JEQ  ERROR
       RT
 
ERROR  BLWP @VMBWD
       DATA >207,ERMS1,ERMS1L
       JMP  EXITEM
 
*  Convert to hex
 
I2H    EQU  $
       LI   R2,HEXNO+1
       MOV  R0,R1
       SRL  R1,12
       MOVB @HEXDGS(R1),*R2+
       MOV  R0,R1
       SLA  R1,4
       SRL  R1,12
       MOVB @HEXDGS(R1),*R2+
 
       MOV  R0,R1
       SLA  R1,8
       SRL  R1,12
       MOVB @HEXDGS(R1),*R2+
 
       MOV  R0,R1
       SLA  R1,12
       SRL  R1,12
       MOVB @HEXDGS(R1),*R2
 
       LI   R1,HEXNO
       LI   R2,5
       MOV  R3,R0
       BLWP *R7               VMBW
       MOVB R15,*R8           Two blanks
       MOVB R15,*R8
       RT
 
 
*  Message write to screen - needs VDPWA preset
 
MSGWRI EQU  $
       MOV  *R11+,R0
       MOV  R9,R2
MSGWRJ MOVB *R0+,*R8
       DEC  R2
       JGT  MSGWRJ
       RT
 
*  FW Header
 
EDHDR  DATA >FFFF,>1FFA,>2000
EEHDR  DATA >FFFF,>1FFA,>A0A0
EFHDR  DATA >0000,>0000,>1FFA+>A0A0
 
*  Various PAB data
 
PABDAT DATA >0600,PBFV,>0
FILLEN DATA >0
       DATA >07
       TEXT 'DSK7.EX'
NXFILE EQU  $-1
PABLEN EQU  $-PABDAT
 
HEXNO  TEXT '>    '
 
KEYMS  TEXT 'Key to exit'
KEYML  EQU  $-KEYMS
 
ERMS1  TEXT 'Save error'
ERMS1L EQU  $-ERMS1
 
TXGAP1 TEXT 'LM-free'
TXGAP2 TEXT 'HMbegin'
 
TXSIZ1 TEXT 'LS len '
TXSIZ2 TEXT 'BM len '
TXSIZ3 TEXT 'SD len '
 
       EVEN
 
OUREG  DATA 0             R0
       DATA >2000
       DATA >2FF
       DATA >24               Start on screen
 
       DATA >20           R4  Space to next line
       DATA MSGWRI            Message follows
       DATA VMBWD
       DATA VMBW
 
       DATA VDPWD         R8
       DATA 7                 Advice len
       DATA I2H
       DATA 0
 
       DATA >0100         R12 Byte ONE
       DATA PABV+9
       DATA 6
       DATA >2000
 
       END
 
