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 / ENTERPRS / CPM / UTILS / S / ZPM3N08.ARC / AUTOTOG.Z80 < prev    next >
Text File  |  1992-05-27  |  4KB  |  131 lines

  1.  
  2. ;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  3. ;            A U T O T O G
  4. ;              for ZPM3
  5. ;            by Simeon Cran
  6. ;               30/3/92
  7. ;
  8. ; This program toggles the Auto Command Prompting facility of ZPM3. It is
  9. ; presented in source code form to inform users about how the facility is
  10. ; manipulated.
  11.  
  12. ; Be aware that when Auto Command Prompting is enabled with this program,
  13. ; it won't actually operate until turned on at the keyboard with ^Q. This
  14. ; program simply enables the ^Q toggling of Auto Command Prompting.
  15.  
  16. ; When ZPM3 is booted, Auto Command Prompting is disabled. Usually, a
  17. ; startup file would include the AUTOTOG command to turn it on unless it
  18. ; is felt that the facility could confuse the operator (as may happen with
  19. ; a remote ZPM3 system).
  20. ;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  21.  
  22. ; SYNTAX:
  23. ;  AUTOTOG    Toggles the state of the Auto Command Prompting
  24. ;  AUTOTOG ON    Enables Auto Command Prompting
  25. ;  AUTOTOG OFF    Disables Auto Command Prompting
  26. ;  AUTOTOG //    Displays a brief help message
  27.  
  28. ;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  29. ;
  30. ; Automatic Command Prompting is enabled and disabled by a bit 6 of offset
  31. ; 85h of the SCB page. This offset can not be directly accessed by the SCB
  32. ; function (31h). Instead, we get the SCB base page with function 31h, and
  33. ; then find the offset from there. No other bits in the byte may be touched.
  34. ;
  35. ;===============================================================================
  36.  
  37. BDOS    equ    5
  38. deffcb    equ    5ch
  39. SCBfunc    equ    31h    ; Get/Set SCB function number
  40. SCBoff    equ    3bh    ; Offset in SCB to get SCB base page
  41. ACPoff    equ    85h    ; Offset in SCB base page of Auto Command Prompting bit
  42.  
  43.     jp    start    ; Jump over general data
  44.  
  45. HELPmsg:
  46.     db    ' SYNTAX:'
  47.     db    10,13
  48.     db    '  AUTOTOG    Toggles the state of the Auto Command Prompting'
  49.     db    10,13
  50.     db    '  AUTOTOG ON    Enables Auto Command Prompting'
  51.     db    10,13
  52.     db    '  AUTOTOG OFF    Disables Auto Command Prompting'
  53.     db    10,13
  54.     db    '  AUTOTOG //    Displays a brief help message'
  55.     db    '$'
  56. ONmsg:
  57.     db    'ZPM3 Auto Command Prompting is now enabled. Toggle with ^Q.'
  58.     db    '$'
  59. OFFmsg:
  60.     db    'ZPM3 Auto Command Prompting is now disabled.'
  61.     db    '$'
  62.  
  63. ONword:    ; Word to match to turn Auto Command Prompting on
  64.     db    'ON      '
  65. OFFword:    ; Word to match to turn Auto Command Prompting off
  66.     db    'OFF     '
  67. TOGword:    ; Word to match to toggle Auto Command Prompting
  68.     db    '        '
  69.  
  70. HELP:    ld    de,HELPmsg
  71. MSGexit:
  72.     ld    c,9
  73.     call    bdos
  74.     rst    0
  75.  
  76. start:    ; Get the address of the bit which controls Auto Command Prompting.
  77.     ld    c,SCBfunc
  78.     ld    de,SCBPB
  79.     call    bdos        ; Get base page of SCB
  80.     ld    h,a
  81.     ld    l,ACPoff    ; HL is now the address of the byte
  82.     ld    (ACPaddr),hl    ; Save it    
  83.  
  84. ; Find out what the user wants to do. If the argument matches
  85. ;  any of the three control words, act accordingly, otherwise
  86. ;  show the help message and exit.
  87.     ld    hl,ONword
  88.     call    matchWord
  89.     jr    z,TurnON
  90.     ld    hl,OFFword
  91.     call    matchWord
  92.     jr    z,TurnOFF
  93.     ld    hl,TOGword
  94.     call    matchWord
  95.     jr    nz,HELP
  96. ; Toggle the Auto Command Prompting.
  97.     ld    hl,(ACPaddr)
  98.     bit    6,(hl)
  99.     jr    z,TurnON
  100. TurnOFF:    ; Turn the Auto Command Prompting off.
  101.     ld    hl,(ACPaddr)
  102.     res    6,(hl)
  103.     ld    de,OFFmsg
  104.     jr    MSGexit    
  105.  
  106. TurnON:        ; Turn the Auto Command Prompting on.
  107.     ld    hl,(ACPaddr)
  108.     set    6,(hl)
  109.     ld    de,ONmsg
  110.     jr    MSGexit
  111.  
  112.  
  113.  
  114. matchWord:    ; Compare the string at HL with the string at defFCB+1 for
  115.         ;  8 bytes. Return Z if it matches.
  116.     ld    de,defFCB
  117.     ld    bc,8
  118. matchW1:
  119.     inc    de
  120.     ld    a,(de)
  121.     cpi
  122.     ret    nz
  123.     jp    pe,matchW1
  124.     ret
  125.     
  126. SCBPB:    ; System control block function parameter block.
  127. ACPaddr:    ; Save the address of the ACP bit here too.
  128.     db    03bh
  129.     db    0        ; Get operation
  130.  
  131.