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 / SECTION2.ASM < prev    next >
Assembly Source File  |  2000-06-30  |  8KB  |  166 lines

  1. ; SECTION2: This program changes the user number on an RCP/M system in which 
  2. ;  the USER command has been removed (or renamed)
  3. ;  (The program is named SECTION@ because my origional section program was
  4. ;     a 4k disaster written in C (Moral: never send a high-level language to
  5. ;     do a low-level job). The name (Hopefully) won't confilict with other, 
  6. ;     similar programs)
  7. ;
  8. ;  By Nick Holland, 1-8-85, released to Public Domain 8-24.
  9. ;       ^
  10. ;       | <- Sysop of East Detroit Heath/Zenith BBS (313-772-0417 evenings only)
  11. ;
  12. ; PURPOSE: I origionaly wrote this program to make my bulletin board more 
  13. ;  useable. My board had files for CP/M, MS-DOS, CP/M-86, BASIC, Pascal, etc
  14. ;  all jumbled into two winchester partitions. Clearly, it was not very easy 
  15. ;  to find those files that interested the caller. At this time, I had renamed 
  16. ;  the USER command, so that only user 0 (for the general public) and user 15
  17. ;  (for my maintainence) were in use. I had tried a USER program, but the 
  18. ;  concept of user levels seemed to escape many of my MS-DOS users, who I tried 
  19. ;  to serve, not to mention that it can be hard to remember what is on what 
  20. ;  user level. What I needed was a program that was quick and easy to use, but 
  21. ;  ALSO would present a menu to the caller, telling him what was where, if 
  22. ;  neccessary. This is my solution to the problem. Typing in SECTION alone 
  23. ;  gives a menu, telling the user where he is, and where he can go from there.
  24. ;  Typing SECTION x, where 'x' is a decimal number, changes to the desired 
  25. ;  section number, returning the caller to RCP/M, without a warm boot making
  26. ;  the program quick in operation, even on floppy based systems. 
  27. ;
  28. ; MODIFICATION: I have much reason to believe that many people will want to 
  29. ;  change this program to suit their individual needs. I am distributing this
  30. ;  primarily to give other sysops ideas, and a possible base to work with. 
  31. ;   Ideas for expansion/extension:
  32. ;    1) More than 10 sections (0-9): I like the one key response to the menu, so
  33. ;       I did not incorporate that many sections into this program. The other
  34. ;       reason I did not do this my self is that I use the higher user levels 
  35. ;       for files that are uploaded. Each section has it's own upload area, so
  36. ;       I can sort out the files easier (is SD.OBJ for MS-DOS or CP/M?)
  37. ;    2) Change drive and user number: Perhaps not a bad idea if you suport 
  38. ;       machines that are not commonly used with more than one drive 
  39. ;       (Commadore, Apple...), since the caller may forget to check other 
  40. ;       drives.
  41. ;    3) Mneomics for sections instead of numbers: Some people like 'em, I don't
  42. ;       not. My twisted mind remembers single digits better than whole "words". 
  43. ;       When I use the SYSOP BBS, I have difficulty remembering if the section
  44. ;       name is RCP/M or RPCM, COMM or COM, etc. Numbers also make it easier to
  45. ;       check all areas for new files (Start at section 0 and work up) Numbers
  46. ;       are also better if the user can not type or spell (like me).
  47. ;
  48. ;
  49. ;     OPERATION:
  50. ;     ==========
  51. ;
  52. ;  A>SECTION        {displays menu, prompts for section.}
  53. ;  A>SECTION 3      {Changes to section 3, no other display}
  54. ;  A>SECTION <garbage> {Displays menu, like with no parameters **}
  55. ;          (** If there is a valid section number within the garbage, it is 
  56. ;                recognized, and used)
  57. ;
  58. ;  1/8/84    -N. Holland
  59. ;
  60.         
  61. BDOS:   EQU     0005H   ; BDOS call address
  62. CONIN:  EQU     01H     ; BDOS Console in
  63. CONOUT: EQU     02H     ; BDOS Console out
  64. PRINTS: EQU     09H     ; BDOS PRINT STRING
  65. USERNO: EQU     20H     ; BDOS Get/Set user #
  66.  
  67. LF      EQU     0AH     ; Line Feed
  68. CR      EQU     0DH     ; Carrage Return
  69. MAX     EQU     5       ; MAXIMUM user level
  70.  
  71.         ORG     100H
  72.         NOP             ; This forces a 00h byte somewere in the program's 
  73.                         ; search for a section number (that is how it quits 
  74.                         ; looking). I know, it should not be necessary, but 
  75.                         ; I am a little paranoid. (Also good for hacked CCP's)
  76.         LXI     H,0080H ; This location has # of bytes entered after prog. name
  77. LOOP1:  MOV     A,M     ; Get byte in command line
  78.         ORA     A       ; Set flags
  79.         JZ      MENU    ; No characters after command
  80.         CALL    CHECK   ; Is it a good section?
  81.         RNZ             ; If good (A <> 0), return to CP/M 
  82.         INX     H       ; point to next byte
  83.         JMP     LOOP1   ; check it...
  84.  
  85. ; If program end up here, either no valid section number character was found, 
  86. ;  or there was no command tail. In either event, display the main menu.
  87. ; Whatever was on the command line (if anything), was not a valid SECTION #
  88. ;   so display menu
  89. ;
  90. MENU:   MVI     C,PRINTS        
  91.         LXI     D,DMENU ; point to begining part of menu.
  92.         CALL    BDOS    ; Display menu.
  93.  
  94.         MVI     C, USERNO ; Tell the caller where he currently is (completing 
  95.         MVI     E, 0FFH ;                                          the menu)
  96.         CALL    BDOS    ; get user number
  97.         ADI     '0'     ; make it an ASCII character
  98.         MVI     C, CONOUT
  99.         MOV     E, A    ; move it to A
  100.         CALL    BDOS    ; Show it to the caller
  101.  
  102. PROMPT: MVI     C,PRINTS ; Prompt user to enter SECTION number
  103.         LXI     D,DPROMPT
  104.         CALL    BDOS    ; Display prompt message.
  105.  
  106.         MVI     C,CONIN
  107.         CALL    BDOS    ; Get user's response
  108.         CALL    CHECK   ; See if good SECTION number
  109.         JZ      PROMPT  ; Bad Section number, so re-PROMPT user.
  110.  
  111.         RET             ; RETURN TO CP/M
  112.  
  113. ; CHECK: Tests the ASCII character in register A. If in the range of '0' to
  114. ;   'MAX', changes to that user level, and returns FFh in A. If not valid, 
  115. ;   returns 00h in A, and takes no other action. May alter all registers.
  116. ;
  117. CHECK:  SUI     '0'     ; If carry here, then A is too small
  118.         JC      ERREXIT ; Exit with error
  119.         CPI     MAX+1   ; If no carry, then A too big
  120.         JNC     ERREXIT 
  121.  
  122. ; The value in A is a valid user number, so change user number, and exit
  123. ; showing success.
  124. ; To change user levels, there are three ways to do it:
  125. ;  1) BDOS call: Lasts untill first warm boot.
  126. ;  2) Change byte at 0004h (drive/user): Takes effect only after Warm Boot
  127. ;  3) Do both of the above: Makes change last, but eliminates the wait for the 
  128. ;      Warm Boot. That is what I do in this program
  129.  
  130.         MOV     B,A     ; hide desired user level in B.
  131.         LDA     0004H   ; Get drive/user byte
  132.         ANI     0FH     ; Strip current user #, leave drive number.
  133.         MOV     C,A     ; stash drive # in C
  134.         MOV     A,B     ; restore user # (in form 0000uuuu)
  135.         RLC             ; (000uuuu0)
  136.         RLC             ; (00uuuu00)
  137.         RLC             ; (0uuuu000)
  138.         RLC             ; (uuuu0000): the desired position
  139.         ADD     C       ; (uuuudddd): Re-created drive/user byte
  140.         MVI     C,USERNO 
  141.         MOV     E,B     ; Get the user number again
  142.         CALL    BDOS    ; change user # through BDOS call also,
  143.         ORI     0FFH    ; and return OK code
  144.         RET
  145. ERREXIT: XRA    A       ; Set A=0, and set zero flag.
  146.         RET
  147.  
  148. ; Text for menus, prompts: You will almost certainly wish to change this.
  149.  
  150. DMENU:  DB CR, LF, LF
  151.         DB '         Available Sections:', CR, LF, LF
  152.         DB '   0) Bulletin Board, General Interest', CR, LF
  153.         DB '   1) CP/M-80 related files', CR, LF
  154.         DB '   2) CP/M-86 files', CR, LF
  155.         DB '   3) Generic MS-DOS files', CR, LF
  156.         DB '   4) IBM & compatable files', CR, LF
  157.         DB '   5) General High-level Language stuff', CR, LF, LF ; skip line
  158.         DB ' Currently in Section $'
  159.  
  160. DPROMPT:
  161.         DB CR, LF, LF, LF, ' Enter desired Section Number (0 - 5) ->$'
  162.  
  163.  
  164.         END
  165.  
  166.