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 / TURBODSG / TLOGON.MQC / TLOGON.MAC
Text File  |  2000-06-30  |  15KB  |  791 lines

  1.     title    "tShell logon module version 0.60"
  2. ;
  3. ;    (c) 1985 S. Kluger, All Rights Reserved.
  4. ;    This is the logon module for tShell. It
  5. ;    should be copied to 31A:WARMSTRT.AUT.
  6. ;
  7. ;    History:
  8. ;    12/14/85    started, completed default logon code,
  9. ;            completed userid/password entry routine.
  10. ;    12/15/85    ready for extensive testing!
  11. ;    12/20/85    added drive access display
  12. ;    12/21/85    added priv level display
  13. ;    12/22/85    added logoff before logon, made DELETED flag work
  14. ;    01/01/86    changed for USRSUP
  15. ;    01/04/86    started clock inop code
  16. ;
  17. cr    equ    0dh
  18. lf    equ    0ah
  19. cfunc    equ    5
  20. tfunc    equ    50h
  21. jconv    equ    10958
  22. tries    equ    4        ; up to 4 missed logons in a row
  23. wait    equ    60        ; number of seconds to delay after n tries
  24. ;
  25. .z80
  26. .request syslib
  27. ;
  28. ;    +----------------------+
  29. ;    | data storage section |
  30. ;    +----------------------+
  31. ;
  32.     dseg
  33. ;
  34.     INCLUDE    TSHELL.DEF
  35. ;
  36. idfcb:    db    1,'TSHELL  IDS',0,0,0,0    ; password file
  37.     ds    22
  38. logfcb:    db    1,'TSHELL  LOG',0,0,0,0    ; activity log
  39.     ds    22
  40. crtfcb:    db    1,'TSHELL  CRT',0,0,0,0    ; crt configuration file
  41.     ds    22
  42. lgofcb:    db    1,'TSHELL  SCR',0,0,0,0    ; logo file
  43.     ds    22
  44. bulfcb:    db    1,'TSHELL  BUL',0,0,0,0    ; bulletin file
  45.     ds    22
  46. ;
  47. rqid:    db    '         '        ; requested user id
  48. rqpw:    db    '         '        ; requested password
  49. ;
  50. idsize:    dw    0            ; password file size (must be < 8M)
  51. ;
  52. retry:    db    tries            ; retry counter
  53. delay:    db    wait
  54. ;
  55. inbuf1:    db    5
  56.     db    0
  57. hhmm:    db    '00:00'
  58. ;
  59. inbuf:    db    8
  60. ccnt:    db    0
  61. ;
  62. @dcfld::db    '00/00/00 at ',0
  63. mnon:    db    'nonprivileged',0
  64. msemi:    db    'restricted',0
  65. mfull:    db    'full access',0
  66. ;
  67. bauds::    db    5,6,7,10,12,14,15,0ffh
  68.     ds    9
  69. ;
  70. actlog:
  71.     db    1ah
  72. actid:    ds    8            ; activity log user id
  73. actdt:    ds    4            ;   date/time
  74. actst:    ds    2            ;   station
  75. act01:    db    0            ;   on/off/bad flag (1/0/FF)
  76. actdu:    ds    2            ;   drive/user
  77. actbp:    ds    8            ;   bad password given
  78.     db    1ah,1ah,1ah,1ah,1ah,1ah    ; filler
  79. ;
  80. mstrs:    db    0            ; master date reset code (c9=ok)
  81. ;
  82. id:    db    '.tShell.'
  83. offset:    db    0
  84. mstoff:    db    0
  85. ;
  86. ; default buffer. this buffer is overwritten as soon
  87. ; as a valid password file is detected.
  88. ;
  89. defbuf:    db    'UNLOGGED',2,0ffh,0ffh,0ffh,0ffh,0ffh,0ffh,0ffh,0ffh,0ffh
  90.     db    'ABCDEFGHIJKLMNOP',1,1
  91.     ds    128-($-defbuf)        ; reserve 128 bytes
  92.     ds    40            ; stack space
  93. stack    equ    $
  94. ;
  95. ;    +------------------+
  96. ;    | code begins here |
  97. ;    +------------------+
  98. ;
  99.     cseg
  100. ;
  101. start:    jr    .skcls            ; skip past cls code
  102. ;
  103. defcls:    db    2,1bh,'E',0,0        ; default clearscreen
  104.     'Copyright (c) 1985 S. Kluger. All Rights Reserved. '
  105. ;
  106. .skcls:    ld    sp,stack        ; set up local stack
  107.     ld    c,8            ; set abort address
  108.     ld    de,abort        ; point to any RET
  109.     call    tfunc
  110.     ld    de,80h
  111.     ld    hl,id
  112.     ld    bc,8
  113.     ldir
  114.     ld    bc,41
  115.     ld    l,0
  116.     call    tfunc
  117.     ld    (offset),a        ; save offset
  118.     or    a
  119.     jp    z,fatal            ; fatal error if no USR FCN
  120.     ld    bc,0fe29h        ; now set reset time in master
  121.     ld    de,0
  122.     ld    l,0
  123.     call    tfunc
  124.     ld    (mstoff),a
  125.     call    resmt
  126.     ld    c,13            ; set compatibility flags
  127.     ld    e,0f8h
  128.     call    tfunc
  129.     ld    bc,41            ; log off tShell
  130.     ld    de,0ffffh
  131.     ld    l,2
  132.     call    getoff            ; get usrsup offset
  133.     call    tfunc
  134.     ld    de,idfcb        ; get password file
  135.     push    de
  136.     ld    c,35            ; filesize function
  137.     call    cfunc
  138.     ld    hl,(idfcb+33)        ; get size
  139.     ld    (idsize),hl        ; save it
  140.     pop    de            ; get fcb back
  141.     or    a
  142.     jp    nz,deflog        ; default logon without any ado
  143.     ld    hl,defcls        ; default clearscreen
  144.     call    crtctl
  145.     call    print##
  146.     cr,lf
  147.     'tShell (c) 1985 S. Kluger, All Rights Reserved.'
  148.     '            8-bit Station ',0
  149.     ld    c,12            ; get network address
  150.     call    cfunc
  151.     ld    a,d
  152.     add    a,'A'
  153.     call    cout##
  154.     ld    a,'-'
  155.     call    cout##
  156.     ld    a,e
  157.     call    pafdc##
  158.     call    crlf##
  159.     ld    de,lgofcb
  160.     call    fi0$open##        ; open for byte read
  161.     call    z,dsplgo        ; display logo if found
  162.     ld    de,USERID        ; set dma to password file template
  163.     ld    c,26
  164.     call    cfunc
  165. idloop:    ld    hl,actlog+1
  166.     ld    b,25
  167. .zal..:    ld    (hl),0
  168.     inc    hl
  169.     djnz    .zal..
  170.     call    print##            ; now ask for userid
  171.     cr,lf
  172.     'Enter User ID  >',0
  173.     ld    hl,rqid
  174.     call    get8            ; get up to 8 chars
  175.     call    print##            ; now ask for password
  176.     cr,lf
  177.     'Enter Password >',0
  178.     ld    hl,rqpw
  179.     call    get8n            ; get up to 8 chars without echo
  180.     ld    hl,rqid
  181.     ld    de,actid
  182.     ld    bc,8
  183.     ldir                ; move name to log line
  184.     ld    de,idfcb
  185.     call    openf            ; now open password file
  186.     ld    hl,(idsize)        ; get filesize
  187.     ld    a,h
  188.     or    l            ; if initially 0k file...
  189.     jp    z,errlog        ;   then error
  190. .rpfl.:    dec    hl            ; decrement file pointer
  191.     ld    (idfcb+33),hl        ; set file pointer
  192.     ld    de,idfcb        ; point to file
  193.     call    rdsec            ; read a sector
  194.     jp    nz,errlog        ; default logon if error
  195.     call    match            ; try to match userid/password
  196.     ld    hl,(idfcb+33)        ; get pointer
  197.     ld    a,h
  198.     or    l            ; if not yet 0...
  199.     jr    nz,.rpfl.        ;   ...then loop
  200.     ld    de,idfcb        ; else close file
  201.     ld    c,16
  202.     call    cfunc
  203.     call    print##
  204.     cr,lf,7
  205.     'ERROR: invalid logon',cr,lf,0
  206.     ld    hl,rqpw
  207.     ld    de,actbp
  208.     ld    bc,8
  209.     ldir                ; move bad password
  210.     ld    a,0ffh
  211.     ld    (act01),a        ; set bad flag
  212.     call    applog            ; append to log file
  213.     ld    a,(retry)
  214.     dec    a
  215.     ld    (retry),a
  216.     jp    nz,idloop
  217.     call    print##
  218.     cr,lf,lf
  219.     9,9,9,'*** SECURITY ACCESS VIOLATION ***',cr,lf,lf
  220.     'WAIT: [',0
  221. ..try.:    ld    a,(delay)
  222.     dec    a
  223.     ld    (delay),a
  224.     jr    z,.kill
  225.     call    pa3dc##
  226.     call    print##
  227.     ']',7,7,7,7,8,8,8,8,0
  228.     ld    c,2
  229.     ld    de,60            ; 60 ticks
  230.     call    tfunc
  231.     jr    ..try.
  232. ;
  233. .kill:    ld    bc,41
  234.     ld    l,6
  235.     call    getoff
  236.     call    tfunc
  237. ..inf:    call    cin##
  238.     jr    ..inf
  239. ;
  240. ; attempt to match typed id/pw with the current sector
  241. ; return only if no match
  242. ;
  243. match:    call    decryp            ; decrypt sector
  244.     ld    hl,USERID
  245.     ld    de,rqid
  246.     ld    b,8
  247.     call    compb##            ; compare userid
  248.     ret    nz            ; return if error
  249.     ld    hl,PASSWD
  250.     ld    de,rqpw
  251.     ld    b,8
  252.     call    compb##            ; compare password
  253.     ret    nz            ; return if error
  254.     ld    a,(LEVEL)        ; get priv level
  255.     cp    0e5h            ; deleted?
  256.     ret    z            ;   yes, ignore
  257.     ld    hl,USERID
  258.     ld    de,defbuf        ; move for update
  259.     ld    bc,128
  260.     ldir
  261.     ld    de,defbuf
  262.     ld    c,26
  263.     call    cfunc            ; set dma
  264.     ld    c,10
  265.     call    tfunc            ; get date/time
  266.     ld    (defbuf+(LASTON-USERID)),hl        ; store date
  267.     ld    (defbuf+(LASTON+2-USERID)),de        ; store time
  268.     ld    c,12            ; get ckt/node
  269.     call    cfunc
  270.     ld    (defbuf+(LASTPR-USERID)),de        ; store it
  271.     call    encryp            ; encrypt
  272.     ld    de,idfcb
  273.     call    wrsec            ; write sector back
  274.     ld    c,16
  275.     ld    de,idfcb
  276.     call    cfunc            ; close
  277. ;
  278. ; housekeeping done, now transpose data to the
  279. ; user data block and log him on
  280. ;
  281.     ld    hl,USERID
  282.     ld    de,LCLID
  283.     ld    bc,8
  284.     ldir
  285.     ld    a,(LEVEL)
  286.     ld    (LCLLV),a
  287.     ld    a,(USRCOD)
  288.     ld    (LCLUSC),a
  289.     ld    hl,(DRVACC)
  290.     ld    (LCLDRA),hl
  291.     ld    hl,(USRACC)
  292.     ld    (LCLUSA),hl
  293.     ld    hl,(USRACC+2)
  294.     ld    (LCLUSA+2),hl
  295.     ld    hl,DREDEF
  296.     ld    de,LCLRDD
  297.     ld    bc,16
  298.     ldir
  299.     ld    a,0ffh
  300.     ld    (LCLLGD),a
  301.     ld    a,(SHRDRV)
  302.     ld    (LCLSHD),a
  303.     ld    hl,(DEFPRT)
  304.     ld    (LCLDPR),hl
  305.     ld    a,(SCREEN)
  306.     ld    (LCLSCM),a
  307.     ld    a,(INITUS)        ; get initial user
  308.     ld    e,a            ; put into e
  309.     ld    a,(INITDR)        ; get initial drive
  310.     ld    d,a
  311.     ld    (actdu),de        ; save in activity log
  312.     ld    a,1            ; set on flag
  313.     ld    (act01),a
  314.     push    de
  315.     call    applog
  316.     pop    de
  317.     ld    a,(LEVEL)        ; get acl
  318.     and    3
  319.     cp    2            ; see if full
  320.     jr    nz,..nf.        ;   no
  321.     ld    a,80h
  322.     or    e
  323.     ld    e,a
  324. ..nf.:    ld    c,14
  325.     call    tfunc
  326.     inc    a            ; see if t-logon ok
  327.     jp    z,log.er        ;   no, error!!!
  328.     ld    de,LCLID        ; set dma
  329.     ld    c,26
  330.     call    cfunc
  331.     ld    de,0ffffh        ; set security
  332.     ld    bc,41
  333.     ld    l,1
  334.     call    getoff
  335.     call    tfunc            ; attempt tShell logon
  336.     or    a
  337.     jp    nz,log.er        ; error!
  338.     ld    a,(mstrs)        ; see if master was date-reset
  339.     inc    a
  340.     jp    nz,..mrtk        ;   yes, reset time ok
  341.     call    resmt            ; else try now
  342.     inc    a
  343.     jp    nz,..mrtk
  344.     call    print##
  345.     cr,lf,lf
  346.     'Please enter:',cr,lf,0
  347. .date.:    call    print##
  348.     cr,'Date : [MM/DD/YY]',8,8,8,8,8,8,8,8,8,0
  349.     ld    hl,inbuf
  350.     call    bline##
  351.     cp    8
  352.     jr    nz,.date.
  353.     call    @udcvt##        ; convert date
  354.     jr    c,.date.
  355.     ld    de,jconv
  356.     add    hl,de
  357.     push    hl            ; save julian date
  358.     ld    a,' '
  359.     ld    (@dcfld+8),a
  360.     call    crlf##
  361. .time.:    call    print##
  362.     cr,'Time : [HH:MM]',8,8,8,8,8,8,0
  363.     ld    hl,inbuf1
  364.     call    bline##
  365.     cp    5
  366.     jr    nz,.time.
  367.     ld    hl,hhmm
  368.     call    eval10##
  369.     push    af
  370.     inc    hl
  371.     call    eval10##
  372.     pop    af
  373.     ld    d,a
  374.     pop    hl
  375.     ld    b,0
  376.     ld    c,9
  377.     call    tfunc
  378.     call    resmt
  379. ..mrtk:    call    print##
  380.     cr,lf,lf
  381.     'Logged on ',0
  382.     ld    c,10
  383.     call    tfunc
  384.     call    time
  385.     ld    hl,(LASTON)
  386.     ld    a,h
  387.     or    l            ; ever been on?
  388.     jr    z,.never        ;   no, skip
  389.     call    print##
  390.     '.   Last on ',0
  391.     ld    de,(LASTON+2)
  392.     call    time
  393.     call    print##
  394.     ' on terminal ',0
  395.     ld    hl,(LASTPR)
  396.     ld    a,'A'
  397.     add    a,h
  398.     call    cout##
  399.     ld    a,'-'
  400.     call    cout##
  401.     ld    a,l
  402.     call    pafdc##
  403. .never:    call    print##
  404.     cr,lf,lf
  405.     'Privilege level ',0
  406.     ld    a,(LEVEL)
  407.     and    3
  408.     add    a,'0'
  409.     call    cout##
  410.     call    print##
  411.     ' (',0
  412.     ld    hl,mnon            ; expect nonpriv
  413.     sub    30h
  414.     jr    z,..ppl
  415.     ld    hl,msemi
  416.     dec    a
  417.     jr    z,..ppl
  418.     ld    hl,mfull
  419. ..ppl:    call    pstr##
  420.     call    print##
  421.     ')',cr,lf
  422.     'Drive access: ',0
  423.     ld    de,80h            ; set dma to 80h
  424.     ld    c,26
  425.     call    cfunc
  426.     ld    bc,41
  427.     ld    de,0ffffh
  428.     ld    l,10            ; get dskast
  429.     call    getoff
  430.     call    tfunc
  431.     ld    hl,80h            ; hl=pointer
  432.     ld    de,3            ; de=increment
  433.     ld    b,16            ; b =count
  434.     ld    c,0            ; c =drive
  435. .ckdr.:    ld    a,(hl)            ; get access byte
  436.     inc    a            ; see if FF
  437.     jr    z,.ckna.        ;   yes, no access
  438.     ld    a,'A'            ; make drive letter
  439.     add    a,c
  440.     call    cout##            ; print it
  441. .ckna.:    inc    c            ; bump drive
  442.     add    hl,de            ; point to next entry
  443.     djnz    .ckdr.            ; and loop till done
  444.     call    crlf##
  445.     ld    de,(DEFPRM)        ; get default printer stuff
  446.     ld    b,0ffh            ; do not change spool drive
  447.     ld    c,27
  448.     call    tfunc
  449.     ld    a,(LEVEL)        ; get access codes
  450.     and    80h            ; see if menu
  451.     jp    nz,wrmxit        ;   yes, exit with warmstart
  452.     ld    de,CMDLN        ; point to command line
  453.     ld    a,(de)            ; get count
  454.     or    a            ; empty?
  455.     jr    z,.skc..        ;   yes, skip
  456.     ld    c,18
  457.     call    tfunc
  458. .skc..:    jp    nwrmxt            ; exit without warmstart
  459. ;
  460. ; default error logon (this should never happen, but...)
  461. ;
  462. errlog:    call    print##
  463.     cr,lf,lf,7
  464.     'ERROR: munched password file? Call sysadmin.',cr,lf,lf,0
  465.     ld    a,30
  466.     ld    (deflog+3),a        ; make logon user 30, nonpriv
  467. ;
  468. ; default logon, priv 0A:
  469. ;
  470. deflog:    ld    c,14            ; logon
  471.     ld    de,80h            ; priv level 1
  472.     call    tfunc
  473.     inc    a            ; test error
  474.     jp    z,log.er
  475.     ld    de,defbuf        ; point to default buffer
  476.     ld    c,26
  477.     call    cfunc            ; set dma
  478.     ld    bc,41            ; log into tshell
  479.     ld    de,0ffffh
  480.     ld    l,1
  481.     call    getoff
  482.     call    tfunc
  483.     or    a
  484.     jp    nz,log.er
  485.     call    crlf##
  486.     rst    0
  487. ;
  488. ; subroutines
  489. ;
  490. ; display logo file
  491. ;
  492. dsplgo:    call    f0$get##        ; get a byte
  493.     jr    nz,.dslx        ; eof maybe or some other error
  494.     and    7fh            ; strip parity
  495.     cp    1ah            ; eof?
  496.     jr    z,.dslx            ;   yes
  497.     cp    7fh            ; another way to mark eof
  498.     jr    z,.dslx            ;   yes
  499.     call    cout##            ; display character
  500.     jr    dsplgo            ;   and loop
  501. ;
  502. .dslx:    call    fi0$close##        ; close file
  503. abort:    ret
  504. ;
  505. ; get up to 8 characters
  506. ;
  507. get8n:    ld    d,1
  508.     jr    .g8.
  509. ;
  510. get8:    ld    d,0
  511. .g8.:    call    .g8zl            ; clear input line
  512.     ld    b,8            ; set max count
  513. .g8l:    call    capin##            ; get a character, capitalize
  514.     cp    ' '+1            ; check if space or less
  515.     jr    nc,.g8nc        ;   no, continue
  516.     cp    8            ; backspace?
  517.     jr    z,.g8bs
  518.     cp    7fh            ; delete?
  519.     jr    z,.g8bs
  520.     cp    cr            ; return?
  521.     jr    nz,.g8er        ;   no, error
  522.     ld    a,8            ; see if b=8
  523.     cp    b
  524.     ret    nz            ; typed something (b<8)
  525. .g8er:    call    error
  526.     jr    .g8l
  527. ;
  528. .g8nc:    bit    0,d            ; see if echo on
  529.     call    z,cout##
  530.     ld    (hl),a
  531.     inc    hl
  532.     djnz    .g8l            ; loop
  533. .g8wcr:    call    capin##            ; wait for cr or bs
  534.     cp    cr
  535.     ret    z            ; return if cr
  536.     cp    7fh
  537.     jr    z,.g8bs            ; backspace if delete key
  538.     cp    8
  539.     jr    z,.g8bs
  540.     call    error
  541.     jr    .g8wcr
  542. ;
  543. ; process backspace
  544. ;
  545. .g8bs:    ld    a,8            ; see if b=8
  546.     cp    b
  547.     jr    z,.g8er            ; can't backspace on blank line
  548.     inc    b            ; increment counter
  549.     dec    hl            ; decrement pointer
  550.     ld    (hl),' '        ; blank out
  551.     bit    0,d            ; test echo flag
  552.     jr    nz,.g8l            ; loop back if echo off
  553.     call    print##            ; else wipe out char on screen
  554.     8,' ',8,0
  555.     jr    .g8l
  556. ;
  557. ; zero input line
  558. ;
  559. .g8zl:    push    hl
  560.     ld    b,8
  561. .g8zll:    ld    (hl),' '
  562.     inc    hl
  563.     djnz    .g8zll
  564.     pop    hl
  565.     ret
  566. ;
  567. log.er:    ld    b,a
  568.     call    logerr            ; display logon error message
  569.     inc    b
  570.     jr    z,l.ts.e
  571.     call    print##
  572.     'TurboDOS',0
  573.     jp    wrmxit            ; exit with warmstrt on
  574. ;
  575. l.ts.e:    call    print##
  576.     'tShell',0
  577. ;
  578. ; exit with warmstart enabled
  579. ;
  580. wrmxit:    ld    e,0ffh
  581.     jr    exit
  582. ;
  583. ; exit with warmstart disabled
  584. ;
  585. nwrmxt:    ld    e,0
  586. exit:    ld    c,17            ; warmstart function
  587.     call    tfunc
  588.     call    print##
  589.     cr,lf,lf,0
  590.     ld    hl,USERID        ; be sure to blank data area
  591.     ld    bc,stack-USERID
  592. .bldl:    ld    (hl),0
  593.     inc    hl
  594.     dec    bc
  595.     ld    a,b
  596.     or    c
  597.     jr    nz,.bldl
  598.     rst    0            ; exit to tdos
  599. ;
  600. logerr:    call    print##
  601.     cr,lf,lf
  602.     'ERROR: Cannot log on! Error source: ',0
  603. error:    ld    a,7            ; sound bell
  604.     jp    cout##
  605. ;
  606. ; crt control routine
  607. ; input: hl points to string <len><byt><byt>...
  608. ; uses hl, af
  609. ;
  610. crtctl:    ld    a,(hl)
  611.     or    a
  612.     ret    z            ; return if null
  613.     push    bc
  614.     ld    b,a            ; count to b
  615. .crctl:    inc    hl
  616.     ld    a,(hl)
  617.     call    cout##
  618.     djnz    .crctl
  619.     pop    bc
  620.     ret
  621. ;
  622. ; open file with lock
  623. ;
  624. openf:    ld    hl,5            ; point to shared flag
  625.     add    hl,de
  626.     ld    a,80h
  627.     or    (hl)
  628.     ld    (hl),a            ; set shared flag
  629.     push    de
  630.     ld    c,15
  631.     call    cfunc
  632.     pop    de
  633.     ld    hl,32
  634.     add    hl,de
  635.     ld    (hl),0
  636.     or    a
  637.     ret    z            ; file is now open
  638.     jr    openf            ; else loop since we know file exists
  639. ;
  640. ; read a sector - enter with hl = sector, de = fcb
  641. ;
  642. rdsec:    call    loksec            ; lock sector
  643.     push    de
  644.     ld    c,33            ; read
  645.     call    cfunc
  646.     or    a            ; set error flag
  647.     jr    fresec            ; free sector
  648. ;
  649. ; write a sector - enter with hl = sector, de=fcb
  650. ;
  651. wrsec:    call    loksec            ; lock sector
  652.     push    de            ; save fcb
  653.     ld    c,34            ; write
  654.     call    cfunc
  655.     or    a            ; set error flag
  656. ;
  657. ; free current file sector
  658. ;
  659. fresec:    pop    de
  660.     push    af
  661.     ld    c,43
  662.     call    cfunc
  663.     pop    af
  664.     ret
  665. ;
  666. ; lock current file sector
  667. ;
  668. loksec:    push    de            ; save fcb pointer
  669.     ld    c,42            ; attempt lock
  670.     call    cfunc
  671.     pop    de
  672.     cp    8            ; locked already?
  673.     jr    z,loksec        ;   yes, loop
  674.     ret
  675. ;
  676. ; decrypt user block
  677. ;
  678. decryp:    ld    hl,USERID
  679.     ret
  680. ;
  681. ; encrypt default buffer
  682. ;
  683. encryp:    ld    hl,defbuf
  684.     ret
  685. ;
  686. time:    push    de
  687.     ld    de,-jconv
  688.     add    hl,de
  689.     call    @dcvrt##
  690.     ld    hl,@dcfld
  691.     call    pstr##
  692.     pop    de
  693.     ld    a,d
  694.     call    ..10
  695.     ld    a,':'
  696.     call    cout##
  697.     ld    a,e
  698. ..10:    cp    10
  699.     jr    nc,..10.
  700.     push    af
  701.     ld    a,'0'
  702.     call    cout##
  703.     pop    af
  704. ..10.:    jp    pafdc##
  705. ;
  706. ; append to activity log
  707. ;
  708. applog:    ld    de,logfcb        ; point to log
  709.     ld    c,35            ; filesize
  710.     call    cfunc
  711.     or    a
  712.     ret    nz            ; ignore file not found
  713.     ld    c,10
  714.     call    tfunc            ; get date/time
  715.     ld    (actdt),hl
  716.     ld    (actdt+2),de
  717.     ld    c,12
  718.     call    cfunc            ; get station
  719.     ld    (actst),de
  720.     ld    hl,(logfcb+33)
  721.     dec    hl
  722.     ld    (logfcb+33),hl        ; decrement file pointer
  723.     ld    de,logfcb
  724.     call    openf            ; open shared
  725.     ld    de,80h            ; set defdma
  726.     ld    c,26
  727.     call    cfunc
  728.     ld    de,logfcb
  729.     call    rdsec            ; read last sector
  730.     ld    hl,80h            ; hl=pointer to def dma
  731.     ld    de,20h            ; de=byte count
  732. ..ckel:    ld    a,(hl)            ; get byte
  733.     cp    0ffh            ; endmark?
  734.     jr    z,.fe..            ;   yes
  735.     add    hl,de
  736.     ld    a,l
  737.     or    a
  738.     jr    nz,..ckel        ; try next entry
  739.     ld    hl,(logfcb+33)
  740.     inc    hl
  741.     ld    (logfcb+33),hl
  742.     ld    hl,80h            ; set start of buffer
  743.     push    hl
  744. .zac.:    ld    (hl),0ffh        ; blank buffer
  745.     inc    l
  746.     jr    nz,.zac.
  747.     pop    hl
  748. .fe..:    ld    de,actlog
  749.     ex    de,hl
  750.     ld    bc,32            ; 32 bytes to be moved
  751.     ldir
  752.     ld    a,l            ; see if end of buffer
  753.     or    a
  754.     jr    z,.eob.            ; yes, skip
  755.     ld    (hl),0ffh        ;   else set endmark
  756. .eob.:    ld    de,logfcb
  757.     call    wrsec            ; write the sector
  758.     ld    de,logfcb
  759.     ld    c,16
  760.     jp    cfunc            ; close and exit
  761. ;
  762. getoff:    ld    a,(offset)
  763.     add    a,l
  764.     ld    l,a
  765.     ret
  766. ;
  767. ; reset master reset date/time
  768. ;
  769. resmt::    ld    a,(offset)
  770.     add    a,16
  771.     ld    l,a
  772.     ld    bc,41
  773.     call    tfunc            ; get master node
  774.     ex    de,hl
  775.     ld    a,(mstoff)
  776.     add    a,15
  777.     ld    l,a
  778.     ld    bc,0fe29h
  779.     call    tfunc
  780.     ld    (mstrs),a        ; save master date set code
  781.     ret
  782. ;
  783. fatal:    call    print##
  784.     cr,lf,lf,7
  785.     'ERROR: tShell not installed',cr,lf,lf,0
  786.     rst    0
  787.     end
  788.  dma
  789.     ld    de,20h            ; de=byte count
  790. ..ckel:    ld    a,(hl)            ; get byte
  791.     cp    0f