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 / BDOS / DOSPLSOR.ARK / SETFLAGS.MAC < prev    next >
Text File  |  1986-11-09  |  3KB  |  145 lines

  1. ;
  2. ; usage: SETFLAGS [ON|OFF] [flagbitid]
  3. ;
  4. ; DOS+ utility.  For run-time configuration of DOS+.
  5. ; Any reboot restores the defaults after this is run.
  6. ;
  7. taccbit    equ    010h;        controls access time stamping
  8. dciobk    equ    020h;        controls breaks on BDOS call #6
  9. brkbit    equ    040h;        controls all breaks
  10. @flags    equ    018h;        BDOS offset to flags byte, base page
  11. ;
  12. ; DOS+/CPM  calls
  13. tstr    equ    9
  14. cpmver    equ    12
  15. getinfo    equ    210;        e = 0 returns BDOS base address
  16. ;
  17. bdos    equ    5
  18. fcb    equ    05ch
  19. altfcb    equ    06ch
  20. defdma    equ    080h
  21. ;
  22. cr    equ    0dh
  23. lf    equ    0ah
  24. ;
  25.     jmp    bgn
  26. ;
  27. ; This message also defines the acceptable words. ']' terminates lists.
  28. hlpmsg:    db    'usage: SETFLAGS'
  29. onoff:    DB    ' [ OFF | ON ]'
  30. flags:    DB    ' [ BREAK | DCIOBRK | TACCESS | COMPAT ]', cr,lf
  31.     db    '  dis/enable access time file stamps/breaks'
  32.     db    '/compatiblity mode for DOS+',cr,lf
  33.     db    'ex: SETFLAGS on taccess$'
  34. ;
  35. badver:    db    'Needs DOS+ 2.4 up$'
  36. ;
  37. ; Start here
  38. bgn:    lxi    h,0
  39.     dad    sp
  40.     lxi    sp,stack
  41.     push    h
  42.     lda    defdma
  43.     ora    a
  44.     jz    help;        empty command line, help
  45.     mvi    c,cpmver;    Make sure running DOS+ 2.4 up
  46.     call    bdos
  47.     lxi    d,badver
  48.     inr    h
  49.     dcr    h
  50.     jnz    msgxit;        not MPM etc
  51.     cpi    22h
  52.     jc    msgxit;        < 2.2, cant be compatible mode
  53.     cpi    30h
  54.     jnc    msgxit;        Can't use CPM 3
  55.     cpi    24h
  56.     jnc    bgn2;        ok, 2.4 thru 2.f
  57.     call    getbas;        of DOS+, if running
  58.     mov    a,h;        DOS+ returns base pointer
  59.     ora    a;        CPM returns 0
  60.     jz    msgxit;        not in compatible mode
  61. ;    "    "
  62. ; DOS+ running, check parameters and execute
  63. bgn2:    lxi    h,onoff    
  64.     lxi    d,fcb+1
  65.     call    which;        scan 1st parameter
  66.     jnz    help
  67.     mov    a,c;        on returns 20h, off 40h
  68.     sui    40h;        carry for on
  69.     sbb    a;        0 for off, 0ffh for on
  70.     mov    b,a;        save flag
  71.     lxi    h,flags
  72.     lxi    d,altfcb+1;    2nd parameter
  73.     call    which;        select the particular flag in c
  74.     jnz    help;        not found
  75. bgn3:    call    getbas
  76.     mvi    l,@flags;    offset to flag byte
  77.     mov    a,b
  78.     cma
  79.     ana    c
  80.     mov    b,a;        bit select, 0 or bit
  81.     mov    a,m
  82.     ora    c;        set bit
  83.     xra    b;        then set/reset it
  84.     mov    m,a
  85. ;    "    "
  86. ; restore sp and exit
  87. exit:    pop    h
  88.     sphl
  89.     ret    
  90. ;
  91. ; Help message and exit
  92. help:    lxi    d,hlpmsg
  93. ;    "    "
  94. ; Message de^ to console
  95. msgxit:    mvi    c,tstr
  96.     call    bdos
  97.     jmp    exit
  98. ;
  99. ; Get BDOS base page, on DOS+.  CPM returns 0
  100. ; a,f,h,l
  101. getbas:    push    b
  102.     push    d
  103.     mvi    c,getinfo
  104.     mvi    e,0
  105.     call    bdos;        get BDOS base page
  106.     pop    d
  107.     pop    b
  108.     ret
  109. ;
  110. ; select the flag. z flag if ok.  Result in c
  111. ; DE points to string to check, HL to reference, ']' terminated.
  112. ; (reference string starts with blank, non-blk, blk, then string)
  113. ; 1st in list return 40h, then 20h, etc.  8th returns 80h.
  114. which:    mvi    c,80h;        break left shifted
  115.     push    d
  116. wh1:    pop    d
  117. wh2:    mov    a,m
  118.     cpi    ' '
  119.     inx    h
  120.     jnz    wh2;        skip to a blank
  121. wh3:    mov    a,m
  122.     cpi    ' '
  123.     inx    h
  124.     jz    wh3;        skip to non-blank
  125.     cpi    ']';        test for done
  126.     jz    wh6;        done, not found
  127.     mov    a,c;        now hl points past non-blank
  128.     rrc
  129.     mov    c,a;        r shift bit
  130.     push    d;        save input id
  131. wh4:    inx    h;        advance to 1st ref. char
  132.     ldax    d
  133.     inx    d
  134.     cmp    m
  135.     jnz    wh1;        not this, try next
  136.     sui    ' ';        legals are blank terminated
  137.     jnz    wh4;        test next char
  138.     pop    d;        a = 0 here
  139. wh6:    ora    a;        set flags
  140.     ret
  141.     
  142.     ds    48
  143. stack:
  144.     end
  145. îJ