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

  1. ;
  2. ; ======================================
  3. ;
  4. ;        SUBROUTINES
  5. ;
  6. ; ======================================
  7. ;
  8. ; Is (a) an Ascii digit.  Carry if not
  9. ; f
  10. qnum:    cpi    '0'
  11.     rc;            not digit
  12.     cpi    '9'+1
  13.     cmc
  14.     ret
  15. ;
  16. ; Check next character to see if a space or non-space,
  17. ; file name error if not ASCII character.
  18. ;
  19. chkfsp:    lda    bchflg;        Requesting batch mode now?
  20.     ora    a
  21.     jz    chkfsp2;    Exit if not
  22.     lda    sndflg;        Sending batch?
  23.     ora    a
  24.     jz    chkfsp2;    If yes, exit
  25.     dcr    b;        next char
  26.     jz    chkfsp1;    eol and batch receive
  27.     inr    b
  28. chkfsp2:
  29.     dcr    b
  30.     jz    nfn;        Error if end of chars.
  31.     mov    a,m
  32.     cpi    ' '+1
  33.     rnc;            Ok if valid char so return
  34.     inx    h
  35.     jmp    chkfsp
  36. chkfsp1:
  37.     pop    h;        Do not return to GETDU
  38.     ret;            return instead to SNDFL
  39. ;
  40. ; Get Disk and User from DUSAVE and log in if valid.
  41. ;
  42. getdu:    lda    bchflg
  43.     ora    a
  44.     jz    getdu1;        not requesting batch mode
  45.     lda    sndflg
  46.     ora    a
  47.     jnz    getdu2;        not sending batch, exit
  48. getdu1:    call    chkfsp;        See if a file name is included
  49.     shld    savehl;        Save location of filename
  50. getdu2:    lda    prvtfl
  51.     ora    a
  52.     jnz    trap;        uploading to a private area
  53.     lxi    h,dusave;    Point to drive/user
  54.     lda    olddrv;        Get current drive
  55.     sta    dud
  56.     adi    'A'
  57.     sta    rcvdrv
  58.     mov    a,m;        Get 1st char
  59.     call    qnum
  60.     jnc    getdu4
  61.     sta    rcvdrv;        Allows SYSOP to upload to any drive
  62.     cpi    'A'-1
  63.     jc    getdu3;        Satisfied with current drive
  64.     sui    'A'
  65.     sta    dud
  66.     mvi    a,sgmaxdrv
  67.     call    sysquery
  68.     push    h
  69.     lxi    h,dud
  70.     cmp    m
  71.     pop    h
  72.     jc    illdu
  73.     inx    h;        Get 2nd char
  74. ;    "    "
  75. getdu3:    mov    a,m
  76.     cpi    ':'
  77.     jz    getdu8;        Colon for drive only, no user number
  78.     call    cknum;        Check if numeric
  79.     mov    b,a;        Save char
  80.     lda    bchflg
  81.     ora    a
  82.     jz    getdu4;        not in batch mode
  83.     lda    sndflg
  84.     ora    a
  85.     jz    nobat;        batch send from current du only
  86. getdu4:    mov    a,b;        Get the value back
  87.     sui    '0';        Convert ASCII to binary
  88.     sta    duu;        Save it
  89.     inx    h;        Get 3rd char., if any
  90.     mov    a,m
  91.     cpi    ':'
  92.     jz    getdu5
  93.     lda    duu
  94.     cpi    1;        Is first number a '1'?
  95.     jnz    illdu
  96.     mov    a,m
  97.     call    cknum
  98.     sui    '0'-10
  99.     sta    duu
  100.     inx    h;        Get 4th (and last char) if any
  101.     mov    a,m
  102.     cpi    ':'
  103.     jnz    illdu
  104. getdu5:    lda    optsav;        Get the option back
  105.     cpi    'R';        Receiving a file?
  106.     lda    duu;        Get desired user area
  107.     jz    getdu6;        Yes, can not use special download area
  108.     mvi    a,gpsdrv
  109.     call    dorsx
  110.     push    h
  111.     lxi    h,dud;        was special download drive requested
  112.     sub    m
  113.     sui    'A'
  114.     pop    h
  115.     lda    duu;        Get user area requested
  116.     jnz    getdu6;        If not special, exit
  117.     mvi    a,gpsusr
  118.     call    dorsx
  119.     push    h
  120.     lxi    h,duu;        If special download area requested
  121.     cmp    a
  122.     mov    a,m
  123.     pop    h
  124.     jz    getdu7;        then process request
  125. getdu6:    push    h
  126.     mvi    a,sgmaxusr
  127.     call    sysquery
  128.     lxi    h,duu;        Check for max user download area
  129.     cmp    m
  130.     mov    a,m
  131.     pop    h
  132.     jc    illdu;        Error if more (and not special area)
  133. ;    "    "
  134. getdu7:    call    usrset;        Set to requested user area
  135. getdu8:    lda    dud;        Get drive
  136.     call    dskset;        Set to requested drive
  137.     jmp    trap;        Now find file selected
  138. ;
  139. ;
  140. ; Check next character to see if a space or non-space,
  141. ; No carry for eoln reached in batch send. Z flag for space
  142. ; a,f,h,l
  143. chksp:    lda    bchflg;        Requesting batch mode?
  144.     ora    a
  145.     jz    chksp2;        Exit if not
  146.     lda    sndflg;        Sending in batch mode now?
  147.     ora    a
  148.     jz    chksp2;        If yes, exit
  149.     dcr    b
  150.     rz;            with no carry for eoln in batch send
  151.     inr    b
  152. chksp2:    dcr    b
  153.     jz    opterr
  154.     inx    h
  155.     mov    a,m;        Get the char there
  156.     cpi    ' '
  157.     stc;            signal NOT eoln in batch send
  158.     ret;            JZ = space, JNZ = non-space
  159. ;
  160. ; Log into drive and user (if specified).  If none mentioned,
  161. ; it falls through to 'TRAP' routine for normal use.
  162. ;
  163. logdu:    lxi    h,tbuf;        Point to default buffer command line
  164.     mov    b,m;        Store number of characters in command
  165.     inr    b;        Add in current location
  166. logdu1:    call    chksp;        Skip spaces to find 1st command
  167.     rnc;            eoln found
  168.     jz    logdu1
  169. logdu2:    call    chksp;        Skip 1st command (non-spaces)
  170.     rnc;            eoln found
  171.     jnz    logdu2
  172.     inx    h
  173.     call    chkfsp;        Skip spaces to find 2nd command
  174.     shld    savehl;        Save start address of the 2nd command
  175. ;    "    "
  176. ; Now point to the first byte in the argument, i.e., if it was of format
  177. ; similar to:  B6:HELLO.DOC then we point at the drive character 'B'.
  178.     lxi    d,dusave
  179.     mvi    c,4;        Drive/user is 4 chars maximum
  180. logdu3:    mov    a,m
  181.     cpi    ' '+1
  182.     jc    trap;        Space or return, finished
  183.     stax    d
  184.     inx    h
  185.     inx    d
  186.     cpi    ':'
  187.     jz    getdu;        If colon, get drive/user and log in
  188.     dcr    b;        One less position to check
  189.     dcr    c;        One less to go
  190.     jnz    logdu3
  191. ;    "    "
  192. ; Check for no file name or ambiguous name
  193. trap:    call    movefcb;    Move filename into file block
  194.     lxi    h,fcb+1;    Point to file name
  195.     mov    a,m;        Get first char of file name
  196.     cpi    ' ';        Any there?
  197.     jz    nfn;        no name present
  198. ;    "    "
  199. ; check for ambiguous file name
  200.     mvi    b,11;        11 chars to check
  201. trap1:    mov    a,m;        Get char from FCB
  202.     cpi    '?';        Ambiguous?
  203.     jz    trerr;        Yes, exit with error message
  204.     cpi    '*';        Even more ambiguous?
  205.     jz    trerr;        Yes, exit with error message
  206.     inx    h;        Point to next char
  207.     dcr    b;        One less to go
  208.     jnz    trap1;        more
  209.     ret
  210. ;
  211. trerr:    lda    bchflg
  212.     ora    a
  213.     rnz;            Wildcards are ok in batch mode
  214.     call    erxit;        Print message, exit
  215.  db    cr,lf,'++ Wild-card options are not valid ++','$'
  216. ;
  217. cknum:    call    qnum
  218.     rnc;            ok if '0'..'9'
  219. ;    "    "
  220. illdu:    call    erxit
  221.  db    cr,lf,'++ Improper drive/user combination ++','$'
  222. ;
  223. nfn:    call    erxit;        Print message, exit
  224.  db    cr,lf,'++ No file name requested ++','$'
  225. ;
  226. nobat:    call    erxit
  227.  db    cr,lf,'++ Batch files sent only from current D/U ++$'
  228. ▐s