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 / BYTIME31.ASM < prev    next >
Assembly Source File  |  2000-06-30  |  9KB  |  433 lines

  1. ;
  2. ;    BYETIME2     by:   Joubert Berger
  3. ;               Atlanta Kaypro MBBS
  4. ;               (404) 923-2580 [300/1200 baud]
  5. ;
  6. ; 8/16/86 - Fixed code to save stack properly so program will exit
  7. ; v. 31     with a simple RETurn instead of a warm-boot (faster this
  8. ;        way).  Removed seconds display (non-essential info).
  9. ;
  10. ; 6/28/86 - Eliminated 'S' option. Now displays time/date along with
  11. ; v. 30     stats.  Fixed nulls (removed MOV E,A as value already in A).
  12. ;        Added equate for clock. Made display a little more pleasing
  13. ;        to the eye.
  14. ;        Lawrence Davis - Glendale Litera QBBS - 818/956-6164
  15. ;
  16. ;
  17. ;**********************************************************************
  18. ; 12/22/85  ADDED RBBS38 SUPPORT     JIM GOOCH (Norcross RCPM) 921-1116
  19. ;**********************************************************************
  20. ;  After just setting up BYE502, I decided to play around a bit with
  21. ;  the extended BDOS functions that are in BYE5xx.
  22. ;
  23. ;  BYETIME will display the time and date to the user if he just types
  24. ;  'BYETIME'.  If he types 'BYETIME S' he will be given some statistcs about
  25. ;  what kind of access he has.    It will include the max. drive/user,
  26. ;  time on system, max. time allowed, number of nulls, and if the
  27. ;  sysop is in.
  28. ;
  29. ;  It is nothing fancy, and not written that great, but it is just a
  30. ;  demonstration how you can use all those new BDOS calls in BYE5xx.
  31. ;  If anyone adds or updates anything to this, I would appreciate it
  32. ;  if they send me a copy of it.
  33. ;            Joubert Berger - 12/17/85
  34. ;
  35. ;
  36. NO    EQU    0
  37. YES    EQU    NOT NO
  38. ;
  39. RBBS    EQU    YES        ; Set YES if RBBS or QBBS
  40. MBBS    EQU    NO        ; Set YES if MBBS
  41. CLOCK    EQU    YES        ; Yes, if RTC installed
  42. ;
  43. GSUSR    EQU    32        ; Get/Set user
  44. MXDRV    EQU    69        ; Max drive
  45. MXUSR    EQU    70        ; Max user
  46. NULLS    EQU    72        ; Number of nulls
  47. BELLON    EQU    78        ; Bell toggle
  48. RTCBUF    EQU    79        ; Get clock(RTC) buffer
  49. LCDATA    EQU    80        ; Get user buffer
  50. MXTIME    EQU    81        ; Max time on system
  51. ;
  52. CR    EQU    0DH        ; Carrige return
  53. LF    EQU    0AH        ; Line feed
  54. FCB    EQU    5CH        ; File control block
  55. BDOS    EQU    0005H        ;
  56.  
  57.     ORG    100H
  58.  
  59. BEGIN:    LXI    H,0        ; Save stack for RET exit
  60.     DAD    SP
  61.     SHLD    OLDSP
  62. ;
  63.     MVI    C,GSUSR        ; Check if running BYE
  64.     MVI    E,241
  65.     CALL    BDOS
  66.     CPI    77
  67.     JZ    START        ; If there continue
  68.     CALL    ILPRT        ; If not abort - Print abort message
  69.     DB    'BYE5xx is not running....aborting.',0
  70.     JMP    EXIT
  71. ;
  72. START:
  73. ;
  74.      IF    CLOCK
  75. TIME:    CALL    ILPRT
  76.     DB    CR,LF,0
  77.     CALL    DATE        ; Read the clock buffer
  78.     LDA    HRSAV        ; Get hour
  79.     CALL    PASC        ; Print it
  80. ;
  81.     MVI    A,':'
  82.     CALL    CTYPE
  83. ;
  84.     LDA    MNSAV        ; Get minutes
  85.     CALL    PASC        ; Print it
  86. ;
  87.     CALL    ILPRT
  88.     DB    '  ',0
  89. ;
  90.     LDA    MMSAV        ; Get the month
  91.     CPI    1        ; And print the month name
  92.     JNZ    FEBU
  93.     CALL    ILPRT
  94.     DB    'January ',0
  95.     JMP    DONE
  96. ;
  97. FEBU:    CPI    2
  98.     JNZ    MARC
  99.     CALL    ILPRT
  100.     DB    'February ',0
  101.     JMP    DONE
  102. ;
  103. MARC:    CPI    3
  104.     JNZ    APRL
  105.     CALL    ILPRT
  106.     DB    'March ',0
  107.     JMP    DONE
  108. ;
  109. APRL:    CPI    4
  110.     JNZ    MAYY
  111.     CALL    ILPRT
  112.     DB    'April ',0
  113.     JMP    DONE
  114. ;
  115. MAYY:    CPI    5
  116.     JNZ    JUNE
  117.     CALL    ILPRT
  118.     DB    'May ',0
  119.     JMP    DONE
  120. ;
  121. JUNE:    CPI    6
  122.     JNZ    JULY
  123.     CALL    ILPRT
  124.     DB    'June ',0
  125.     JMP    DONE
  126. ;
  127. JULY:    CPI    7
  128.     JNZ    AUGS
  129.     CALL    ILPRT
  130.     DB    'July ',0
  131.     JMP    DONE
  132. ;
  133. AUGS:    CPI    8
  134.     JNZ    SEPT
  135.     CALL    ILPRT
  136.     DB    'August ',0
  137.     JMP    DONE
  138. ;
  139. SEPT:    CPI    9
  140.     JNZ    OCTO
  141.     CALL    ILPRT
  142.     DB    'September ',0
  143.     JMP    DONE
  144. ;
  145. OCTO:    CPI    10
  146.     JNZ    NOVB
  147.     CALL    ILPRT
  148.     DB    'October ',0
  149.     JMP    DONE
  150. ;
  151. NOVB:    CPI    11
  152.     JNZ    DECM
  153.     CALL    ILPRT
  154.     DB    'November ',0
  155.     JMP    DONE
  156. ;
  157. DECM:    CALL    ILPRT
  158.     DB    'December ',0
  159. ;
  160. DONE:
  161. ;
  162.     LDA    DDSAV        ; Get the day
  163.     CALL    PASC        ; Print it
  164. ;
  165.     CALL    ILPRT
  166.     DB    ', ',0
  167. ;
  168.     LDA    CNSAV        ; Get the century
  169.     CALL    PASC        ; Print it
  170.     LDA    YYSAV        ; Get the year
  171.     CALL    PASC        ; Print it
  172.      ENDIF
  173. ;
  174. ;
  175. STATIS:
  176.     CALL    ILPRT
  177.     DB    CR,LF,LF,0
  178.     MVI    C,LCDATA    ; Get the user buffer
  179.     MVI    E,255
  180.     CALL    BDOS
  181. ; next 2 not necessary for RBBS (lastcalr name starts in col 1)
  182. ;
  183.      IF    MBBS
  184.     INX    H        ; Jump over the first two spaces
  185.     INX    H        ; AT LEAST FOR MBBS
  186.      ENDIF            ; MBBS
  187. ;
  188. PRTNAM:    MOV    A,M        ; Print the first name
  189. ;
  190.      IF    MBBS
  191.     CPI    ';'        ; Check for end of first name
  192.      ENDIF            ; MBBS
  193. ;
  194.      IF    RBBS
  195.     CPI    ' '        ; Rbbs uses a space
  196.      ENDIF            ; Rbbs
  197. ;
  198.     JZ    PRTNDN
  199.     CALL    CTYPE
  200.     INX    H
  201.     JMP    PRTNAM
  202. ;
  203. PRTNDN:    CALL    ILPRT
  204.     DB    ', here are some statistics regarding your'
  205.     DB    ' access level.',CR,LF,LF,0
  206. ;
  207. ;  Here we go...
  208.     CALL    ILPRT
  209.     DB    'Maximum Drive/User      : ',0
  210. ;
  211.     MVI    C,MXDRV        ; Get max. drive
  212.     MVI    E,255        ; Using the BDOS calls in BYE5
  213.     CALL    BDOS
  214.     ADI    40H        ; Make it a letter
  215.     CALL    CTYPE        ; Print it
  216. ;
  217.     MVI    C,MXUSR        ; Get max. user
  218.     MVI    E,255
  219.     CALL    BDOS
  220. ;
  221.     CPI    10        ; If user # < 10, skip
  222.     JC    DUX
  223.     PUSH    B
  224.     MVI    C,'0'-1
  225. DUY:    INR    C        ; Get tens digit
  226.     SUI    10
  227.     JNC    DUY        ; Loop until we've gone too far
  228.     ADI    10
  229.     MOV    B,A        ; Save units digit
  230.     MOV    A,C        ; Print tens digit
  231.     CALL    CTYPE
  232.     MOV    A,B        ; Get units back
  233.     POP    B
  234. DUX:    ADI    '0'
  235.     CALL    CTYPE
  236. ;
  237.     CALL    ILPRT        ; Finish with a colon
  238.     DB    ':',CR,LF,0
  239. ;
  240. ;
  241.     CALL    ILPRT
  242.     DB    'Number of Nulls         : ',0
  243. ;
  244.     MVI    C,NULLS        ; Get number of nulls
  245.     MVI    E,255        ; Will be between 0 and 9
  246.     CALL    BDOS
  247. ;    MOV    A,E            ; Move it over
  248.     ADI    30H        ; Make it a digit to print
  249.     CALL    CTYPE
  250.     CALL    ILPRT        ; Clean up with a CR/LF
  251.     DB    CR,LF,0
  252. ;
  253. ;
  254.     CALL    ILPRT
  255.     DB    'Minutes on System       : ',0
  256. ;
  257.     CALL    DATE        ; Use DATE to get current time on
  258.     LDA    TOS        ; System
  259.     CALL    PASC        ; Print it - already in binary
  260.     CALL    ILPRT        ; And clean up
  261.     DB    CR,LF,0
  262. ;
  263. ;
  264.     CALL    ILPRT
  265.     DB    'Maximum Time Allowed    : ',0
  266. ;
  267.     MVI    C,MXTIME    ; Max. time on system allowed
  268.     MVI    E,255
  269.     CALL    BDOS
  270.     CPI    0        ; Check for unlimited
  271.     JNZ    NOLIMT
  272.     CALL    ILPRT        ; And print "Unlimited" if so
  273.     DB    'UNLIMITED',0
  274.     JMP    EXMXTIM
  275. NOLIMT:    CALL    PASC        ; Else print max. time allowed
  276.     CALL    ILPRT
  277.     DB    ' minutes',0
  278. EXMXTIM:CALL    ILPRT        ; And finish up
  279.     DB    CR,LF,0
  280. ;
  281. ;
  282.     CALL    ILPRT
  283.     DB    CR,LF,'The System Operator is currently ',0
  284. ;
  285.     MVI    C,BELLON    ; Now tell if sysop is in - this
  286.     MVI    E,255        ; Is done by checking if console
  287.     CALL    BDOS        ; Bell is set or not
  288.     CPI    0FFH        ; Check if set
  289.     JZ    BELON
  290.     CALL    ILPRT
  291.     DB    'not ',0    ; It is set so report it
  292. BELON:    CALL    ILPRT
  293.     DB    'in.',CR,LF,0
  294. ;
  295.  
  296. EXIT:
  297.     LHLD    OLDSP
  298.     SPHL
  299.     RET            ; Done, so lets exit...
  300. ;
  301. ;========================================================================
  302. ;
  303. ;  The call will find the Real-Time Clock buffer in BYE and get the hour,
  304. ;  minutes, second, month, date, century, and year and save it in buffers
  305. ;
  306. DATE:    MVI    C,RTCBUF    ; Lets find the buffer
  307.     CALL    BDOS        ; Use BYE's BDOS call
  308. ;
  309.     MOV    A,M        ; Get the hour
  310.     CALL    BCDBIN        ; Change to binary
  311.     STA    HRSAV        ; Save it for later
  312.     INX    H        ; Increment the buffer
  313. ;
  314.     MOV    A,M        ; Get the minute
  315.     CALL    BCDBIN        ; Change to binary
  316.     STA    MNSAV        ; Save it for later
  317.     INX    H        ; Increment buffer
  318. ;
  319.     MOV    A,M        ; Get the second
  320.     CALL    BCDBIN        ; Change to binary
  321.     STA    SESAV        ; Save it
  322.     INX    H        ; Increment buffer
  323. ;
  324.     MOV    A,M        ; Get the century
  325.     CALL    BCDBIN        ; Change to binary
  326.     STA    CNSAV        ; Save it
  327.     INX    H        ; Increment buffer
  328. ;
  329.     MOV    A,M        ; Get the year
  330.     CALL    BCDBIN        ; Change to binary
  331.     STA    YYSAV        ; Save it
  332.     INX    H        ; Increment buffer
  333. ;
  334.     MOV    A,M        ; Get the month
  335.     STA    MMSAV        ; Save it - no need to change
  336.     INX    H        ; Increment buffer
  337. ;
  338.     MOV    A,M        ; Get the day
  339.     CALL    BCDBIN        ; Change to binary
  340.     STA    DDSAV        ; Save it for later
  341.     INX    H        ; Increment buffer
  342. ;
  343.     MOV    A,M        ; Get time on system
  344.     STA    TOS        ; Save if for later
  345. ;
  346.     RET
  347. ;
  348. ;  Inline print routine - this will print everything until it finds
  349. ;  a null (0).
  350. ;
  351. ILPRT:    XTHL
  352. ILPLP:    MOV    A,M
  353.     INX    H
  354.     ORA    A
  355.     JZ    ILPRET
  356.     CALL    CTYPE
  357.     JMP    ILPLP
  358. ILPRET:    XTHL
  359.     RET
  360. ;
  361. ;  This will print the character in register A
  362. ;
  363. CTYPE:    PUSH    B
  364.     PUSH    D
  365.     PUSH    H
  366.     PUSH    PSW
  367.     MOV    E,A
  368.     MVI    C,2
  369.     CALL    BDOS
  370.     POP    PSW
  371.     POP    H
  372.     POP    D
  373.     POP    B
  374.     RET
  375. ;
  376. ;  This will convert the BCD number in A to binary
  377. ;
  378. BCDBIN:    PUSH    PSW
  379.     ANI    0F0H
  380.     RRC
  381.     RRC
  382.     RRC
  383.     RRC
  384.     MOV    C,A
  385.     MVI    B,9
  386. ;
  387. BCDBL:    ADD    C
  388.     DCR    B
  389.     JNZ    BCDBL
  390.     MOV    B,A
  391.     POP    PSW
  392.     ANI    0FH
  393.     ADD    B
  394.     RET
  395. ;
  396. ;  This will print the the binary number in A
  397. ;
  398. PASC:    MVI    C,0
  399. PASC1:    SUI    10
  400.     JC    PASC2
  401.     INR    C
  402.     JMP    PASC1
  403. PASC2:    ADI    10
  404.     PUSH    PSW
  405.     MOV    A,C
  406.     ORA    A
  407.     JZ    ONENUM
  408.     ADI    030H
  409.     CALL    CTYPE
  410.     JMP    TWONUM
  411. ONENUM:    MVI    A,'0'
  412.     CALL    CTYPE
  413. TWONUM:    POP    PSW
  414.     ADI    030H
  415.     CALL    CTYPE
  416.     RET
  417. ;
  418. ;    Buffer area
  419. ;
  420. HRSAV:    DB    0        ; Hour
  421. MNSAV:    DB    0        ; Minutes
  422. SESAV:    DB    0        ; Seconds
  423. CNSAV:    DB    0        ; Century
  424. YYSAV:    DB    0        ; Year
  425. MMSAV:    DB    0        ; Month
  426. DDSAV:    DB    0        ; Day
  427. TOS:    DB    0        ; Time on system
  428. ;
  429. OLDSP:    DS    2
  430.     DS    20
  431. STACK    EQU    $
  432.     END
  433.