home *** CD-ROM | disk | FTP | other *** search
/ ftp.barnyard.co.uk / 2015.02.ftp.barnyard.co.uk.tar / ftp.barnyard.co.uk / cpm / walnut-creek-CDROM / CPM / RCPM / ZMD150.LBR / ZNEWS.ZZ0 / ZNEWS.Z80
Text File  |  2000-06-30  |  7KB  |  298 lines

  1. ;
  2.  
  3.       TITLE  ZNEWS.Z80 - 09/29/88 - ZMD Sysop Transfer Log Utility
  4. ;                    Copyrighted (c) 1987, 1988
  5. ;                    Robert W. Kramer III
  6.  
  7.     PAGE
  8. ;-                                     -;
  9. ;                         Update History                                  ;
  10. ;                                                                         ;
  11. ;    Date    Release                 Comments                     ;
  12. ;  --------    -------      ----------------------------------------------  ;
  13. ;                                      ;
  14. ;  09/29/88    v1.50    - Fixed problem that caused a 'ZMD     .L$$' file ;
  15. ;              to not be deleted from directory after aborted  ;
  16. ;              sessions.                      ;
  17. ;            - Also, was moving 9 filename bytes intead of 8,  ;
  18. ;              this is what caused the mysterious filename of  ;
  19. ;              '.L$$' as mentioned above.  The filename left      ;
  20. ;              in the directory should have been '.$$$'.      ;
  21. ;            - Some minor cosmetic changes.              ;
  22. ;  03/18/88    v1.49    - No change(s) made to this file          ;
  23. ;  03/13/88    v1.48    - Redefined buffer table at end of programs. STACK;
  24. ;              and filename buffers now EQUated with offsets      ;
  25. ;              from the last switch/toggle in program instead  ;
  26. ;              of with DS directive.                  ;
  27. ;  02/25/88    v1.47    - No change(s) made to this file
  28. ;  01/27/88    v1.46    - Some changes were made to ZMDSUBS file that are ;
  29. ;              not directly related to this file          ;
  30. ;  01/17/88    v1.45    - First public release                  ;
  31. ;  11/19/87    v1.00    - Initial version                  ;
  32. ;-                                                                       -;
  33.  
  34. ;
  35. ;-------------------------------------------------------------------------;
  36. ; EXTERNAL Declarations:                          |
  37. ;-------------------------------------------------------------------------;
  38.  
  39.  
  40.     EXTRN    CASEFLG,CKABRT,CLEARIT,CMDBUF,DESC,DSTOR,DSTOR1,ERXIT
  41.     EXTRN    EXIT,ILPRTB,INPUT,LNLNGTH,NOFILE,NOLOG,NOROOM,OLDDRV
  42.     EXTRN    OLDUSR,OLINE,PRINTV,RECAR1,RECDR1,RENFCB,RERROR,RSDMA
  43.     EXTRN    SHONM4,STACK,TDONE,UCASE
  44.  
  45. ;
  46. ;-------------------------------------------------------------------------;
  47. ; Program Starts Here                              |
  48. ;-------------------------------------------------------------------------;
  49.  
  50.  
  51.        .Z80
  52.     ASEG
  53.     ORG    100H        ; Program starts 
  54.     JP    BEGIN        ; Jump around configuration table
  55.     INCLUDE    ZMDHDR.Z80    ; Include the ZMD header overlay
  56.        .REQUEST ZMDSUBS        ; Include the ZMD subroutines
  57.  
  58. ;
  59. ;
  60. ; Save CP/M stack, initialize new one for this program
  61. ;
  62. BEGIN:    LD    (STACK),SP    ; Save current CCP stack address
  63.     LD    SP,STACK    ; Initialize new one for this program
  64.  
  65. ;
  66. ; Get current drive/user area and store for later
  67. ;
  68.     LD    A,255        ; Get current user area
  69.     CALL    RECAR1
  70.     LD    (OLDUSR),A    ; Save it
  71.     LD    C,CURDRV    ; Get current drive 
  72.     CALL    BDOS
  73.     LD    (OLDDRV),A    ; Save it
  74.  
  75. ;
  76. ; Display program name, version, and copyright notice
  77. ;
  78. BEGIN1:    LD    HL,SYSNEW
  79.     CALL    PRINTV
  80.  
  81.     LD    A,(LOGCAL)    ; Log file enabled?
  82.     OR    A
  83.     JP    Z,NOLOG        ; No, then don't run program
  84.  
  85.     LD    A,(GOTLAST)    ; Already located last entry?
  86.     OR    A
  87.     JP    NZ,GTNEW    ; Yes, then just show it
  88.     LD    (DESWAIT),A    ; Disable sleepy caller time out
  89.  
  90.     CALL    ILPRTB
  91.     DB    'Working.',0
  92.  
  93. ;
  94. ; Log into log file drive/user
  95. ;
  96.     LD    A,(LOGUSR)    ; User area to find ZMD.LOG
  97.     CALL    RECAR1
  98.     LD    A,(LOGDRV)    ; Drive to find ZMD.LOG
  99.     CALL    RECDR1
  100.  
  101. ;
  102. ; Open 'ZMD     .LOG' file
  103. ;
  104.     LD    DE,LOGNAM    ; Current log filename
  105.     LD    HL,FILE        ; Internal FCB
  106.     CALL    RENFCB        ; Initialize
  107.  
  108.     LD    DE,FILE
  109.     LD    C,OPEN        ; Open log file
  110.     CALL    BDOS
  111.     INC    A        ; ZMD.LOG file exist?
  112.     LD    HL,LOGNAM
  113.     JP    Z,NOFILE    ; No, inform user and exit to CP/M
  114.  
  115. ;
  116. ; Open 'ZMD     .$$$' file
  117. ;
  118.     LD    DE,TEMPFIL    ; Current '$$$' filename
  119.     LD    HL,DEST        ; Internal FCB
  120.     CALL    RENFCB        ; Initialize
  121.  
  122.     LD    HL,FILE+1    ; Point to log filename
  123.     LD    DE,DEST+1    ; And temporary filename
  124.     LD    BC,8        ; Set to move filename bytes only
  125.     LDIR
  126.  
  127.     LD    C,OPEN        ; Open new log file
  128.     LD    DE,DEST
  129.     CALL    BDOS
  130.     INC    A        ; Did file already exist?
  131.  
  132.     LD    C,DELETE    ; Prepare for delete
  133.     LD    DE,DEST
  134.     CALL    NZ,BDOS        ; Yes, delete existing file
  135.  
  136.     LD    C,MAKE        ; Make new temporary file
  137.     LD    DE,DEST
  138.     CALL    BDOS
  139.     INC    A
  140.     LD    HL,DEST+1
  141.     JP    Z,NOROOM    ; Exit if no more disk space
  142.  
  143. ;
  144. ; Read record from ZMD.LOG file
  145. ;
  146.     LD    DE,CMDBUF    ; Point to last log entry buffer
  147.  
  148. RDRECD:    PUSH    DE        ; Save current buffer position
  149.     CALL    RSDMA        ; Reset DMA
  150.     LD    DE,FILE
  151.     LD    C,READ
  152.     CALL    BDOS
  153.     POP    DE        ; Last entry buffer address
  154.     OR    A        ; Read ok?
  155.     JP    NZ,RERROR    ; No
  156.  
  157. ;
  158. ; Now look for the end of the file overwriting OLINE with each entry found
  159. ; (from LF to LF).  Upon ^Z (EOF) display last entry and get prompt for new
  160. ; one
  161. ;
  162.     LD    HL,TBUF
  163.  
  164. WRDLP:    LD    A,(HL)        ; Get a character
  165.     AND    7FH
  166.     CP    7FH        ; Delete character?
  167.     JP    Z,NEXT        ; Yes, don't store this character
  168.  
  169.     CP    EOF        ; End of file?
  170.     JP    Z,GTNEW        ; Yes, display last entry and get new one
  171.  
  172.     LD    (DE),A        ; Else store character in last entry buffer
  173.     INC    DE        ; Next positition in last entry buffer
  174.     CP    LF        ; Was it a line feed?
  175.     JP    NZ,NEXT        ; No, get next character
  176.  
  177. ;
  178. ; Check periodically (every LF) for user abort
  179. ;
  180.     LD    A,1        ; Disable page pausing
  181.     CALL    CKABRT        ; Check for user requests
  182.     LD    A,'$'        ; Terminator for BDOS print function
  183.     LD    (DE),A        ; At end of last entry string
  184.  
  185.     PUSH    HL
  186.     LD    HL,CMDBUF
  187.     CALL    DSTOR1
  188.     POP    HL
  189.     LD    DE,CMDBUF
  190.  
  191. NEXT:    INC    L
  192.     JP    Z,RDRECD
  193.     JP    WRDLP
  194.  
  195. ;
  196. ; Get new entry to ZMD.LOG.  First display the last entry added to the file
  197. ; for use as a typing guide.
  198. ;
  199. GTNEW:    CALL    ILPRTB
  200.     DB    CR
  201.     DB    'Current format of ',0
  202.  
  203.     LD    HL,LOGNAM    ; Point to log filename
  204.     CALL    SHONM4
  205.  
  206.     CALL    SHWLAST        ; Show last entry in log file
  207.     LD    A,1
  208.     LD    (GOTLAST),A    ; Show we've found/displayed last entry
  209.  
  210. ;
  211. ; Get the new entry.  Process input - CR terminates entry.
  212. ;
  213.     LD    A,79
  214.     LD    (LNLNGTH+1),A    ; Set for up to 79 character string
  215.     LD    (WRAP),A    ; Disable word wrap
  216.     LD    (CASEFLG),A    ; Convert all input to uppercase
  217.     CALL    DESC        ; Go get string
  218.     LD    A,0
  219.     LD    (CASEFLG),A    ; Disable uppercase lock
  220.     JP    Z,NOCHANG    ; Z=CR entered on blank line
  221.     LD    (HL),'$'    ; Place a '$' for BDOS print function
  222.  
  223. ;
  224. ; Done with entry, ask for verification before writing to disk
  225. ;
  226.     CALL    ILPRTB
  227.     DB    CR,LF
  228.     DB    '   Repeating to verify:',0
  229.  
  230.     CALL    SHWLAST        ; Show last entry
  231.     LD    DE,OLINE    ; Point to new entry buffer
  232.     LD    C,PRINT        ; BDOS print function
  233.     CALL    BDOS
  234.  
  235.     CALL    ILPRTB
  236.     DB    CR,LF
  237.     DB    'Correct? (Y/N): ',0
  238.  
  239. GETOK1:    CALL    INPUT        ; Get repsonse
  240.     CALL    UCASE        ; Convert to uppercase
  241.     CP    'N'        ; No?
  242.     JP    NZ,GETOK2    ; Yes, all done
  243.  
  244.     CALL    ILPRTB
  245.     DB    'No.'
  246.     DB    CR,LF,0
  247.     JP    BEGIN1
  248.  
  249. GETOK2:    CP    'Y'        ; Yes?
  250.     JP    NZ,GETOK1    ; Loop until we get a yes or no
  251.  
  252.     CALL    ILPRTB
  253.     DB    CR
  254.     DB    'Writing log entry to ',0
  255.     LD    HL,LOGNAM
  256.     CALL    SHONM4    
  257.     CALL    ILPRTB
  258.     DB    '...',0
  259.     CALL    DSTOR        ; Go store it in disk buffer
  260.     JP    TDONE        ; Transfer to disk
  261. ;
  262. ;
  263. ;-------------------
  264. ; UTILITIES SECTION
  265. ;-------------------
  266. ;
  267. NOCHANG:CALL    ILPRTB        ; Else nothing typed, abort
  268.     DB    CR,LF
  269.     DB    '-- Log entry aborted... ',0
  270.  
  271.     LD    C,DELETE
  272.     LD    DE,DEST
  273.     CALL    BDOS        ; Clean up (Erase 'ZMD     .$$$' file)
  274.  
  275.     JP    EXIT
  276.  
  277. ;
  278. ; Show last entry in ZMD.LOG file
  279. ;
  280. SHWLAST:CALL    ILPRTB
  281.     DB    CR,LF,LF,0
  282.     LD    DE,CMDBUF    ; Point to last entry buffer
  283.     LD    C,PRINT        ; BDOS print function
  284.     JP    BDOS
  285.  
  286. ;
  287. ; These next are just dummy routines to satisfy external ZMDSUBS requests.
  288. ; They do nothing but leave alone.
  289. ;
  290. DONE::    JP    EXIT
  291. TIME::    RET
  292.  
  293.  
  294. GOTLAST:DB    0
  295.  
  296.  
  297.     END
  298.