home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / mbug / mbug144.arc / EASE16.LBR / EASECMD.ZZ0 / EASECMD.Z80
Text File  |  1979-12-31  |  5KB  |  276 lines

  1. ;Prog:    EASE CMD file creator
  2. ;Date:    8/6/87
  3. ;Auth:    Paul Pomerleau
  4.  
  5.     extrn    print
  6.     extrn    bline
  7.     extrn    f0$put, fo0$open, fo0$close
  8.     extrn    f$open, f$read, f$delete
  9.     extrn    z3log, z3init
  10.     extrn    zprsfn
  11.     extrn    crlf
  12.  
  13. version    equ    11
  14. FCB    equ    5ch
  15.  
  16. ;=============================================================================
  17. ;
  18. ;        S T A N D A R D    P R O G R A M    H E A D E R
  19. ;
  20. ;=============================================================================
  21.  
  22. ENTRY:
  23.     jp    START
  24.     defb    'Z3ENV'
  25.     defb    3        ; Type-3 environment
  26. ENVADDR:
  27.     dw    0f300h
  28.     dw    ENTRY
  29.     defb    version
  30.  
  31. ;=============================================================================
  32. ;
  33. ;        C O N F I G U R A T I O N    A R E A
  34. ;
  35. ;=============================================================================
  36.  
  37. NAME:    db    'FillFillFIL'    ; Padding to help find proper places
  38.  
  39. WIDTH:    dw    80
  40. TOOSHORT:
  41.     dw    02
  42. gobeg:    db    0
  43. bellflg:
  44.     db    0
  45. smartsav:
  46.     db    0
  47.     ds    3
  48.                 ; For EASE.COM's table
  49. TABLE:    db    'l'
  50.     db    'l!'
  51.  
  52. VECTOR:
  53. ;=============================================================================
  54. ;
  55. ;        M A I N    C O D E    S E C T I O N
  56. ;
  57. ;=============================================================================
  58.  
  59. START:
  60.  
  61.     ld    hl,(ENVADDR)    ; Get environment address
  62.     call    Z3INIT        ; Initialize library routines
  63.  
  64.     call    HEADER
  65.     ld    a,(FCB+1)
  66.     cp    '/'
  67.     jp    z,HELP
  68.     cp    ' '
  69.     jr    nz,GOTNAME
  70.     call    PRINT
  71.     db    'Filename of EASE: ',0
  72.     ld    hl,80h
  73.     ld    (hl),79
  74.     ld    a,0ffh
  75.     call    BLINE
  76.     call    CRLF
  77.     ld    a,(hl)
  78.     or    a
  79.     ret    z
  80.     ld    de,FCB
  81.     call    ZPRSFN
  82.  
  83. GOTNAME:
  84.     ld    de,FCB
  85.     ld    hl,FCB+9
  86.     ld    (hl),'C'
  87.     inc    hl
  88.     ld    (hl),'O'
  89.     inc    hl
  90.     ld    (hl),'M'
  91.     call    Z3LOG
  92.     call    F$OPEN        ; We have BLAHBLAH.COM -- Open it.
  93.     jp    nz,RERR
  94.     ld    de,BUFFER
  95.     ld    c,26
  96.     call    5        ; Dma to BUFFER
  97.     ld    de,FCB
  98.     call    F$READ        ; Read first record
  99.  
  100.     ld    hl,FCB + 12
  101.     ld    (hl),0
  102.     inc    hl
  103.     ld    b,22
  104. ZEROFCB:
  105.     inc    hl
  106.     ld    (hl),0
  107.     djnz    ZEROFCB
  108.     ld    hl,FCB+9
  109.     ld    (hl),'C'
  110.     inc    hl
  111.     ld    (hl),'M'
  112.     inc    hl
  113.     ld    (hl),'D'    ; Gonna write BLAHBLAH.CMD
  114.     ld    de,FCB
  115.     push    de
  116.     call    f$delete
  117.     pop    de
  118.     call    FO0$OPEN    ; Open it.
  119.     jp    nz,WERR
  120.  
  121.     ld    hl,82h
  122. NAMELOOP:
  123.     ld    a,(hl)
  124.     or    a
  125.     jr    z,OKNAMED
  126.     cp    ' '
  127.     jr    z,OKNAMED
  128.     push    hl
  129.     call    F0$PUT
  130.     pop    hl
  131.     inc    hl
  132.     jr    NAMELOOP
  133. OKNAMED:
  134.     call    PUTS
  135.     db    ' Editing Commands:',13,10,0
  136.     ld    de,BUFFER + VECTOR - ENTRY
  137.     ld    hl,TEXT        ; all this means write each line
  138.     call    LINE        ; or composite line to the file.
  139.     call    LINE2    ; <>
  140.     call    LINE2    ; ^v
  141.     call    LINE2    ; <  >
  142.     call    LINE2    ; <---  --->
  143.     call    FCRLF
  144.     call    LINE    ; d >
  145.     call    LINE2    ; d <<
  146.     call    LINE2    ; d <  >
  147.     call    LINE2    ; d -->;   d --->
  148.     call    LINE2    ; du <--->
  149.     call    FCRLF
  150.     call    LINE2    ; c <> (h)
  151.     call    LINE    ; Search
  152.     call    FCRLF
  153.     call    LINE2    ; Toggle + Tab insert
  154.     call    LINE    ; Special insert
  155.     call    LINE2    ; Replot, Warm Boot
  156.     call    FCRLF
  157.     call    WCHARS    ; Done
  158.     call    PUTS
  159.     db    9,0
  160.     call    WCHARS    ; Quit
  161.             ; No ending CR LF
  162.  
  163.     call    FO0$CLOSE        ; Close the file.
  164.     jp    nz,WERR
  165.     call    print
  166.     db    'File Completed.',0    ; Tah Dah!
  167.     ret
  168.  
  169. WCHARS:    ld    a,(de)
  170.     inc    de
  171.     inc    de
  172.     inc    de
  173.     bit    7,a            ; High bit == Meta command.
  174.     jr    z,NOMETA
  175.     call    PUTS
  176.     db    '<Meta> ',0
  177.     jr    METADONE
  178. NOMETA:    call    PUTS            ; Or skip over that space for TAB
  179.     db    '       ',0
  180. METADONE:
  181.     and    7fh            ; get rid of META bit
  182.     cp    7fh
  183.     jr    nz,NOTDEL        ; If it's <del>, we write that else...
  184.     call    PUTS
  185.     db    '<DEL>',0
  186.     jr    NODEL
  187. NOTDEL:    push    af
  188.     ld    a,' '
  189.     call    F0$PUT            ; We write the Control-Code.
  190.     ld    a,'^'
  191.     call    F0$PUT
  192.     pop    af
  193.     call    F0$PUT
  194.     ld    a,' '
  195.     call    F0$PUT            ; Sinch up the spacing.
  196.     ld    a,' '
  197.     call    F0$PUT
  198. NODEL:    call    PUTS
  199.     db    '-- ',0            ; And a dash of this and that.
  200. PUTSTR:    ld    a,(hl)
  201.     inc    hl
  202.     or    a
  203.     ret    z
  204.     call    F0$PUT
  205.     jr    PUTSTR            ; And write the description string.
  206.  
  207. PUTS:    ex    (sp),hl            ; Routine to write strings to file
  208.     push    af
  209.     call    PUTSTR
  210.     pop    af
  211.     ex    (sp),hl
  212.     ret
  213.  
  214. TEXT:    db    'Meta key',0
  215.     db    'Right Char',9,0
  216.     db    'Left Char',9,0
  217.     db    'Up line',9,9,0
  218.     db    'Down line',9,0
  219.     db    'word Back',9,0
  220.     db    'word Forward',9,0
  221.     db    'Go to start of line',0
  222.     db    'Go to end of line',0
  223.     db    'Delete char right',0
  224.     db    'Delete char left',9,0
  225.     db    'Delete left char',0
  226.     db    'Delete word right',0
  227.     db    'Delete word left',0
  228.     db    'Delete command right',0
  229.     db    'Delete to end of line',0
  230.     db    'Delete line',9,0
  231.     db    'Undelete line/cmd',0
  232.     db    'Back command line',0
  233.     db    'Forward command line',0
  234.     db    'Search backwards for command by first char',0
  235.     db    'Toggle insert',9,0
  236.     db    'Insert tab',0
  237.     db    'Insert next char',0
  238.     db    'Reprint line',9,0
  239.     db    'Force Warm Boot',0
  240.     db    'Done editing',9,0
  241.     db    'Quit shell',0
  242.  
  243. LINE:    call    WCHARS
  244. FCRLF:    call    PUTS
  245.     db    13,10,0
  246.     ret
  247. LINE2:    call    WCHARS        ; Two lines of text on one.
  248.     call    PUTS
  249.     db    9,0
  250.     jr    LINE
  251.  
  252. HEADER:    call    PRINT
  253.     db    'EASE CMD File Creator -- Version ',(version / 10) + '0'
  254.     db    '.',(version mod 10) + '0',13,10,0
  255.     ret
  256.  
  257. HELP:    call    PRINT
  258.     db    'Usage: EASECMD [filname]',13,10,0
  259.     ret
  260.  
  261. WERR:    call    PRINT
  262.     db    'Disk Full.',13,10,0
  263.     ret
  264.  
  265. RERR:    call    PRINT
  266.     db    'Cannot Open File.',13,10,0
  267.     ret
  268.  
  269. BUFFER    equ    1000h        ; Past SYSLIB, Z3LIB, etc.
  270.  
  271.     end
  272. 10,0
  273.     ret
  274.  
  275. RERR:    call    PRINT
  276.     db    'Cann