home *** CD-ROM | disk | FTP | other *** search
/ Oakland CPM Archive / oakcpm.iso / cpm / 22rsx / rxmd.ark.2 / RXMD10.MAC < prev    next >
Encoding:
Text File  |  1985-12-08  |  8.5 KB  |  354 lines

  1. ;
  2. ; set user (a)
  3. ; a,f,e
  4. usrset:    mov    e,a
  5.     sta    actusr;        record for other uses
  6.     mvi    a,setusr
  7.     jmp    dos
  8. ;
  9. ; set disk (a)
  10. ; a,f,e
  11. dskset:    mov    e,a
  12.     sta    actdrv;        record for other uses
  13.     mvi    a,seldsk
  14.     jmp    dos
  15. ;
  16. ; set general receive area if remon and NOT whlbit and enabled
  17. ; else return 0 and z flag
  18. ; a,f,b
  19. setgrv:    call    qwheel
  20.     mvi    a,grdrv
  21.     mvi    b,grusr
  22.     jz    setrcv;        else try to set it up
  23.     xra    a
  24.     ret;            with z, signal not done
  25. ;
  26. ; set private if enabled, else return z flag
  27. ; a,f,b
  28. setpvt:    mvi    a,gprdrv
  29.     mvi    b,gprusr
  30. ;    "    "
  31. ; set receive area according to a and b rsxcalls for drv/usr
  32. ; return zero and z flag if inhibited, else 0ffh and nz
  33. ; a,f
  34. setrcv:    call    dorsx
  35.     sui    '@'
  36.     rz;            disabled
  37.     dcr    a
  38.     call    dskset
  39.     mov    a,b;        appropriate user query
  40.     call    dorsx
  41.     call    usrset
  42.     ori    0ffh;        signal done
  43.     ret
  44. ;
  45. ; IF private AND (prvdisk <> '@') THEN rcvarea(private)
  46. ; ELSE IF remon AND NOT whlbit AND (rcvdisk <> '@') THEN
  47. ;   rcvarea(receive)
  48. ; ELSE (* nothing, unrestricted *)
  49. ;
  50. ; Set access (drive/user) area, and see if file exists.
  51. ; If so, abort the remote and ask for a different name.
  52. ; a,f,b (if no file exists)
  53. chekfil:
  54.     lda    prvtfl;        Receiving in private area?
  55.     ora    a
  56.     cnz    setpvt;        If yes, set drive and user area
  57.     cz    setgrv;        else, or if disabled, set genl rcv
  58.     mvi    a,srchf
  59.     call    fileop
  60.     inr    a
  61.     rz;            Not found, return
  62.     call    send3can;    Tell the remote we are aborting
  63. chekf1:    mvi    b,1
  64.     call    recv
  65.     jnc    chekf1;        Wait until no more chars
  66.     lda    bchflg;        Using batch mode now?
  67.     sta    remoff;        If not, send message to modem also
  68.     ora    a
  69.     jz    chekf2;        If not, exit
  70.     call    send3can
  71.     mvi    a,bs
  72.     call    send3x
  73. chekf2:    call    erxit;        Exit, print error message
  74.  db    '++ File exists, use a different name ++','$'
  75. ;
  76. ; Makes the file to be received
  77. ;
  78. makefil:
  79.     xra    a;        Set extent and record number to 0
  80.     sta    fcbext
  81.     sta    fcbrno
  82.     mvi    a,make
  83.     call    fileop;        create the file
  84.     inr    a;        0FFH=bad?
  85.     push    psw
  86.     call    dskstp;        Stop disks, won't need for a while
  87.     pop    psw
  88.     rnz;            Open ok
  89. ;    "    "
  90. ; Directory full - can't make file
  91.     call    erxit
  92.  db    '++ Error: can''t make file -'
  93.  db    ' directory may be full? ++','$'
  94. ;
  95. ;
  96. ; Computes record count, and saves it until a successful file-open.
  97. ;
  98. cnrec:    mvi    a,filsiz;    Computes file size
  99.     call    fileop;        Read first
  100.     lhld    random;        Get the file size
  101.     shld    rcnt;        Save total record count
  102.     ret
  103. ;
  104. ;
  105. ; -------------------------------------------------------------------
  106. ;            opens file to send
  107. ;
  108. ; Opens the file to be sent
  109. ;
  110. opnfil:    xra    a;        Set extent and rec number to 0
  111.     sta    fcbext;        For proper open
  112.     sta    fcbrno
  113.     mvi    a,open
  114.     call    fileop;        Open it
  115.     inr    a
  116.     jz    badopn;        failed
  117.     call    qwheel
  118.     jnz    opnf1;        no restrictions
  119.     call    qtags;        check for restriction tags
  120.     jnz    nosend;        tagged to not send
  121.     call    qtyp;        check types if not wheel
  122.     jc    nosend;        a restricted type
  123. opnf1:    lda    bchflg;        Requesting batch mode?
  124.     ora    a
  125.     jnz    fisopen;    If yes, skip library stuff
  126.     lda    optsav;        Get the primary option back
  127.     cpi    'L'
  128.     jnz    fisopen;    not asking for library member, exit
  129.     lxi    d,tbuf
  130.     mvi    a,stdma
  131.     call    dos
  132.     mvi    a,read
  133.     call    fileop
  134.     lhld    tbuf+14
  135.     shld    dirsiz
  136.     lxi    h,tbuf
  137.     mov    a,m
  138.     ora    a
  139.     jnz    notlbr;        not valid library
  140. ;    "    "
  141. ; Check to see if there is a .LBR file directory with that name
  142. ; and complain if not.
  143.     mvi    b,11;        Max. length of file name
  144.     mvi    a,' ';        1st entry must be all blanks
  145.     inx    h
  146. opnf2:    cmp    m
  147.     jnz    notlbr;        not valid library
  148.     dcr    b
  149.     inx    h
  150.     jnz    opnf2
  151. ;    "    "
  152. ; The first entry in the .LBR directory is indeed blank.
  153. ; Now see if the directory size is more than 0.
  154.     mov    d,m;        Get directory starting location
  155.     inx    h;        Which must be 0000H...
  156.     mov    a,m
  157.     ora    d
  158.     jnz    notlbr;        Directory does not start in record 0
  159.     inx    h
  160.     mov    a,m;        Get size of directory
  161.     inx    h
  162.     ora    m
  163.     jz    notlbr;        Directory must be >0 records!
  164.     lxi    h,tbuf;        Point to directory
  165. ;    "    "
  166. ; The next routine checks the .LBR directory for
  167. ; the specified member name one sector at a time.
  168. opnf3:    mov    a,m;        Get member active flag
  169.     ora    a;        00=active, anything else can be...
  170.     mvi    b,11;        Regarded as invalid (erased or blank)
  171.     inx    h;        Point to member name
  172.     jnz    opnf5;        No match if inactive entry
  173. opnf4:    ldax    d;        Now compare the file name specified...
  174.     cmp    m;        Against the member file name
  175.     jnz    opnf5;        Exit loop if no match found
  176.     inx    h
  177.     inx    d
  178.     dcr    b
  179.     jnz    opnf4;        Check all 11 char
  180.     mov    e,m;        Got the file - get file address
  181.     inx    h
  182.     mov    d,m
  183.     xchg
  184.     shld    index;        Save file address in .LBR
  185.     xchg
  186.     inx    h
  187.     mov    e,m;        Get the file size
  188.     inx    h
  189.     mov    d,m
  190.     xchg
  191.     shld    rcnt;        Save size a # of records
  192.     lhld    index;        Get file address
  193.     shld    random;        Place it into random field
  194.     xra    a
  195.     sta    random+2;    Must zero the 3rd byte
  196.     sta    fcbrno;        Also zero FCB record #
  197.     mvi    a,rrdm;        Read random
  198.     call    fileop
  199.     jmp    fisopen;    No need to error check
  200. ;
  201. ; Come here if no file name match and another sector is needed
  202. opnf5:    inx    h;        Skip past the end of the file entry
  203.     dcr    b
  204.     jnz    opnf5
  205.     lxi    b,20;        Point to next file entry
  206.     dad    b
  207.     lxi    d,memfcb;    Point to member name again
  208.     mov    a,h;        See if we checked all 4 entries
  209.     ora    a
  210.     jz    opnf3;        No, check next
  211.     lhld    dirsiz;        Get directory size
  212.     mov    a,h
  213.     ora    l
  214.     jz    notinlbr;    Can't find in library
  215.     dcx    h;        Decrement dirctory size
  216.     shld    dirsiz
  217.     mvi    a,read;        Read next sector of directory
  218.     call    fileop
  219.     lxi    h,tbuf;        Set our pointers for compare
  220.     lxi    d,memfcb
  221.     jmp    opnf3;        Check next sector
  222. ;
  223. ; File is open.  Report size, xfr time, etc.
  224. fisopen:
  225.     call    ilprt;        Print the message
  226.  db    cr,lf,'File open: ',0
  227.     lhld    rcnt;        Get record count
  228.     call    decout;        Print dec. number of records
  229.     push    h
  230.     call    ilprt
  231.  db    ' records (',0
  232.     pop    h;        Get # of 128 byte records
  233.     mov    a,h
  234.     ora    l
  235.     jz    zeroln;        Can't send 0-length files
  236.     call    decoutk;    Show # of kilobytes
  237.     lda    sndflg;        Receiving batch mode now?
  238.     ora    a
  239.     rnz;            If yes, all done
  240. ;    "    "
  241. ; Show transfer time, first for 1k blocks, then for 128 (skip the 1k
  242. ; times for slower than 1200 bps.)for 1200 bps
  243.     call    ilprt
  244.  db    'k)',cr,lf,'Send time: ',0
  245. ;    "    "
  246.     call    mspeed
  247.     cpi    5;        1200 bps
  248.     jc    fisop1;        Skip 1k speed if less than 1200 bps
  249.     call    ktim;        Get file xfr time in BC (minutes)
  250.     call    stortim;    Store for comparing time remaining
  251.     call    showtime
  252.     call    ilprt
  253.  db    ' - 1k size',cr,lf,'Send time: ',0
  254. ;    "    "
  255. fisop1:    call    xtim;        Get file xfr time in BC (minutes)
  256.     lda    kflg;        If 'SK' set, 1k time already stored
  257.     ora    a
  258.     cz    stortim
  259.     call    showtime
  260.     call    ilprt
  261.  db    ' - 128 size',cr,lf,0
  262.     lda    bchflg
  263.     ora    a
  264.     cnz    cumsts;        Show how many files remain after this
  265.     lda    fstflg
  266.     ora    a
  267.     rnz
  268.     call    ilprt
  269.  db    cr,lf,'File open - ready to send',cr,lf
  270.  db    'Aborts with several CTL-X',cr,lf,0
  271.     ret
  272. ;
  273. ; Show time for file (bc mins, hl secs) and check for excess
  274. showtime:
  275.     push    h;        Save seconds in 'L'
  276.     mov    l,c
  277.     mov    h,b
  278.     call    decout;        print decimal number of minutes
  279.     inx    h;        advance to next full minute
  280.     xthl;            save, get seconds
  281.     call    ilprt
  282.  db    ':',0
  283.     mov    a,l
  284.     cpi    9+1
  285.     mvi    a,'0'
  286.     cc    ctype;        if < 10 insert a '0'
  287.     call    decout;        print seconds portion
  288.     lda    fstflg
  289.     ora    a
  290.     jnz    showt1
  291.     call    ilprt
  292.  db    ' at ',0
  293.     lxi    h,sptbl;    Start of baud rate speeds
  294.     call    mspeed;        Get speed indicator
  295.     push    psw
  296.     add    a;        baud rate table in units of 4 bytes
  297.     call    indexw;        into baud rate table
  298.     xchg;            Put address in 'DE' regs.
  299.     mvi    a,print;    Show the baud
  300.     call    dos
  301.     pop    psw;        recall mspeed
  302.     cpi    5
  303.     mvi    a,'0'
  304.     cnc    ctype;        Add '0' for 1200..9600 bps
  305.     call    ilprt
  306.  db    ' bps',0
  307. showt1:    pop    h;        restore minutes, incremented
  308.     lda    tlimit;        Check for special user or user with
  309.     ora    a;          unlimited time
  310.     rz
  311.     mov    a,h;        Get minute count high byte
  312.     ora    a;        Check if zero
  313.     jnz    overtm;        If not, is over 255 minutes!
  314.     lda    tlimit;        Mxtime allowed
  315.     inr    a;        Plus 1
  316.     sub    l;        Subtract file time from MXTIME
  317.     rnc;            If less, it's ok to continue
  318. ;    "    "
  319. overtm:    call    ilprt
  320.  db    cr,lf,cr,lf,'++ RXMD ABORTED - send time exceeds the ',0
  321.     lda    tlimit
  322.     call    decouta
  323.     call    erxit1
  324.  db    ' minutes allowed ++','$'
  325. ;
  326. badopn:    lda    optsav;        Get command line option
  327.     cpi    'L';        Want to send a library file?
  328.     jnz    noname;        Exit, if not
  329.     call    erxit
  330.  db    cr,lf,'++ No library file with that name ++','$'
  331. ;
  332. noname:    call    erxit
  333.  db    cr,lf,'++ No file with that name ++','$'
  334. ;
  335. zeroln:    call    erxit
  336.  db    cr,lf,'++ Can''t send a 0-length file ++','$'
  337. ;    "    "
  338. notlbr:    call    erxit
  339.  db    cr,lf,'++ Library directory invalid? ++','$'
  340. ;
  341. notinlbr:
  342.     call    erxit
  343.  db    cr,lf,'++ Library does not have that file ++','$'
  344. ;
  345. nosend:    call    erxit
  346.  db    cr,lf,'++ That file not for distribution ++','$'
  347. ;
  348. sptbl:    db    '110$','300$','450$','600$','710$'
  349.     db    '120$','240$','480$','960$','1920$'
  350. ;
  351. stortim:
  352.     ret
  353. ;
  354. <%