home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / lambda / soundpot / p / wid.lbr / WID.AZM / WID.ASM
Encoding:
Assembly Source File  |  1993-10-25  |  5.0 KB  |  196 lines

  1. ;
  2. ;--------------------------------------------------------------------------
  3. ; W.ASM          by Claude Ostyn                  May 2, 1983
  4. ;    rev 5/23/83
  5. ; This program sets the Osborne 1 screen width to 52, 80 or 104 columns and
  6. ; switches the auto scrolling feature on or off.
  7. ; This program will work only if the Screen-Pac modification is installed.
  8. ;--------------------------------------------------------------------------
  9. ;  EQUATES
  10. clear        equ    26        ;clear screen
  11. cr        equ    0dh        ;carriage return
  12. lf        equ    0ah        ;line feed
  13. esc        equ    1bh        ;escape
  14. phalf        equ    ')'        ;begin dim display
  15. pfull        equ    '('        ;end dim display
  16. pcall        equ    9        ;BDOS print call
  17. concall        equ    0bh        ;BDOS check console status call
  18. kcall        equ    01h        ;BDOS read character call
  19. bdos        equ    5        ;BDOS call address
  20. widthflag    equ    0e1a5h        ;screen width flag byte
  21. adjust        equ    0e4e5h        ;BIOS routine to set width
  22. scrollctl    equ    0e168h        ;scroll control byte
  23. widfiftytwo    equ    0
  24. wideighty    equ    3
  25. widoneohfour    equ    1
  26. doscroll    equ    0ffh
  27. noscroll    equ    00h
  28. ;
  29. ;  START            
  30.         org    0100h
  31. beginhere:    lxi    d,promptwidth    ;print prompt for new width
  32.         call    print
  33.         call    whatsnew    ;go check keyboard
  34. whatwasit:
  35.         mvi    c,kcall        ;now, what was that character?    
  36.         call    bdos
  37.         mov    b,a        ;copy the character into register B
  38.         cpi    'A'
  39.         jz    fiftytwo    ;and do the appropriate thing
  40.         mov    a,b
  41.         cpi    'a'
  42.         jz    fiftytwo    ;etc.
  43.         mov    a,b
  44.         cpi    '5'        ;accept digits from distracted
  45.         jz    fiftytwo    ; or tired users...
  46.         mov    a,b
  47.         cpi    'B'
  48.         jz    eighty
  49.         mov    a,b
  50.         cpi    'b'
  51.         jz    eighty
  52.         mov    a,b
  53.         cpi    '8'
  54.         jz    eighty
  55.         mov    a,b
  56. è        cpi    'C'
  57.         jz    oneohfour
  58.         mov    a,b
  59.         cpi    'c'
  60.         jz    oneohfour
  61.         mov    a,b
  62.         cpi    '1'
  63.         jz    oneohfour
  64.         jmp    beginhere    ;character not acceptable...
  65.                     ;so try again
  66. ;
  67. fiftytwo:
  68.         lxi    h,widthflag    ;point to the flagbyte
  69.         mvi    m,widfiftytwo    ;set the flagbyte
  70.         call    adjust        ;and adjust the width
  71.         call     backspace    ;erase answer
  72.         lxi    d,selected    ;and show selected
  73.         call    print
  74.         lxi    d,showfiftytwo    ;width
  75.         call    print
  76.         lxi    d,screenhome    ;(reset screen home,
  77.         call    print        ;    just in case)
  78.         call    makitscroll    ;enable autoscrolling
  79.         jmp    autoscrollset
  80. eighty:
  81.         lxi    h,widthflag
  82.         mvi    m,wideighty
  83.         call    adjust
  84.         call    backspace
  85.         lxi    d,selected
  86.         call    print
  87.         lxi    d,showeighty
  88.         call    print
  89.         call    nomorescroll    ;disable auto scrolling
  90.         jmp    autoscrollset
  91. oneohfour:
  92.         lxi    h,widthflag
  93.         mvi    m,widoneohfour
  94.         call    adjust
  95.         call    backspace    ;erase answer
  96.         lxi    d,selected    ;show selected width
  97.         call    print
  98.         lxi    d,showoneohfour
  99.         call    print
  100.         call    nomorescroll    ;disable auto scrolling
  101. ;
  102. autoscrollset:
  103.         lxi    d,promptscroll
  104.         call    print
  105.         call    whatsnew
  106. whatwasitagain:
  107.         mvi    c,kcall        ;now, what was this character?    
  108.         call    bdos
  109.         mov    b,a        ;copy the character into register B
  110.         cpi    'Y'
  111. è        jz    scrollyes    ;and do the appropriate thing
  112.         mov    a,b
  113.         cpi    'y'
  114.         jz    scrollyes
  115.         mov    a,b
  116.         cpi    'N'
  117.         jz    scrollnoway
  118.         mov    a,b
  119.         cpi    'n'
  120.         jz    scrollnoway
  121.         mov    a,b
  122.         cpi    cr        ;if <CR> then leave it as it is
  123.         jz    scrollstatus
  124.         call    backspace
  125.         jmp    whatwasitagain
  126.         db    'Copyright 1983 Claude Ostyn'
  127. scrollyes:
  128.         call    makitscroll    ;enable auto scrolling
  129.         call    backspace
  130.         jmp    scrollstatus
  131. scrollnoway:
  132.         call    nomorescroll    ;disable auto scrolling
  133.         call    backspace
  134. scrollstatus:
  135.         lxi    d,selected    ;print "selected"
  136.         call    print
  137.         lxi    h,scrollctl    ; point to scroll control byte
  138.         mov    a,m        ; read it
  139.         cpi    doscroll    ; on or off?
  140.         jz    yes        ; if on, go print "ON"
  141.         lxi    d,shownoscroll    ; else print "OFF"
  142.         call    print
  143.         jmp    fini
  144.     yes:    lxi    d,showscroll
  145.         call    print
  146.         jmp    fini        ;go to exit point 
  147. ;
  148. ;  SUBROUTINES
  149. ;
  150. whatsnew:
  151.         mvi    c,concall    ;go check for console status    
  152.         call    bdos        ;
  153.         cpi    00h        ;if no character ready,
  154.         jz    whatsnew    ;    keep going back
  155.         ret            ;if ready, go on with the program
  156. print:
  157.         mvi    c,pcall        ;get call into C
  158.         jmp    bdos        ;and get BDOS to do it
  159. backspace:
  160.         mvi    e,08h        ;backspace character
  161.         mvi    c,02        ;is being output to console
  162.         call    bdos        ;to erase wrong entry
  163.         ret
  164. makitscroll:
  165.         lxi    h,scrollctl    ;point to scroll control byte
  166.         mvi    m,doscroll    ;set it to FFh
  167. è        ret
  168. nomorescroll:
  169.         lxi    h,scrollctl    ;point to scroll control byte
  170.         mvi    m,noscroll    ;set it to 00
  171.         ret
  172. ;
  173. ;  STORAGE AREA
  174. ;
  175. screenhome:    db    esc,'S',20h,20h,'$'
  176. promptwidth:    db    clear,lf
  177.         db    'New screen width:',cr,lf,lf
  178.         db    9,'A. 52 columns',cr,lf
  179.         db    9,'B. 80 columns',cr,lf
  180.         db    9,'C. 104 columns',cr,lf
  181.         db    9,9,9,9,'$'
  182. promptscroll:    db    esc,'=',28h,20h
  183.         db    'Automatic scrolling?',cr,lf,esc,phalf
  184.         db    '(Note:  Normally ON for 52 column display,',cr,lf
  185.         db    ' except with Supercalc, and normally OFF',cr,lf
  186.         db    ' with 80 or 104 column display.)',esc,pfull,cr,lf,lf
  187.         db    'Enter <Y> for autoscroll ON, <N> for OFF: ',cr,lf,lf
  188.         db     '$'
  189. selected:    db    'Selected: $'
  190. showfiftytwo:    db    '52$'
  191. showeighty:    db    '80$'
  192. showoneohfour:    db    '104$'
  193. showscroll:    db    'Autoscroll ON',cr,lf,lf,lf,'$'
  194. shownoscroll:    db    'Autoscroll OFF',cr,lf,lf,lf,'$'
  195. ;
  196. fini:
  197.         ret
  198. end
  199.