home *** CD-ROM | disk | FTP | other *** search
/ Piper's Pit BBS/FTP: ibm 0020 - 0029 / ibm0020-0029 / ibm0028.tar / ibm0028 / GRLF-C-2.ZIP / GFUNC / CURSOR.ASM < prev    next >
Encoding:
Assembly Source File  |  1990-05-30  |  7.2 KB  |  273 lines

  1.  
  2.         page    58,132
  3. ;
  4. ; cursor.asm
  5. ; contains: curtype(),curset(),getcur(),cls(),upscroll(),dnscroll()
  6. ; contains: _gcurvpc(),_cursetc()
  7. ;
  8.         include    model.h
  9.         include    prologue.h
  10.         name    cursor
  11.         pseg    curtype
  12.  
  13. ;==>--    void curtype(type,startline,stopline)
  14. ;
  15. ;;    ARGUMENTS:
  16. ;      (int)        type    -    Cursor type, (blink,blank etc)
  17. ;      (int)        startline -    Top scan line 0..9 of cursor
  18. ;      (int)        stopline -    Bottom scan line 0..9 of cursor
  19. ;
  20. ;;    DESCRIPTION:
  21. ;      Set cursor type.  Defines cursor shape on screen.
  22. ;
  23. ;      The first (type) arg controls start_line bits 5 and 6 which control
  24. ;      blink and display of the cursor.  Controls to the function from C 
  25. ;     are:
  26. ;        BLANK = 20h    NOBLINK = 4    FAST = 2    SLOW = 3
  27. ;        0010xxxx    0000xxxx    0100xxxx    0110xxxx
  28. ;                (NORM = 1)
  29. ;      Note:  There are 3 different blink types.  The power-up default is
  30. ;           close to NOBLINK.. i.e. it is a slow, 50% duty-cycle type of 
  31. ;           blink, and for whatever reason, at least with the IBM Color
  32. ;           Graphics card,the NOBLINK parameter value produces the same 
  33. ;           effect as pwr-up.  Therefore, an additional value, NORM, 
  34. ;           will also produce NOBLINK.
  35. ;
  36. ;;    AUTHOR:
  37. ;      Copyright (C)1987-1990 Greenleaf Software Inc. All Rights Reserved.
  38. ;;;
  39.     cproc    curtype
  40.     mov    ax,parm2_    ;get start line
  41.     mov    cx,parm3_    ;and stop line to CL
  42.     mov    ch,al        ;put start line in CH
  43.     and    cx,0F0Fh    ;don't use values over 15 for either
  44.     mov    dx,parm1_    ;get type.
  45.     cmp    dx,1        ;is it "norm" ?
  46.     jz    ctnob        ;this is normal "no blink"
  47.     cmp    dx,4        ;is it noblink ?
  48.     jz    ctnob
  49.     cmp    dx,20h        ;is it non display ?
  50.     jz    ctnod
  51.     cmp    dx,2        ;is it fast blink ?
  52.     jz    ctfast
  53.     cmp    dx,3        ;is it slow ?
  54.     jz    ctslow
  55.     jmp    short ctnob    ;default to normal.
  56. ctnod:    or    ch,00100000b    ;set bits to non-display
  57.     jmp    short ctnob
  58. ctfast:    or    ch,01000000b    ;..to fast blink
  59.     jmp    short ctnob
  60. ctslow:    or    ch,01100000b    ;.. to slow
  61. ctnob:                ;no bits to put in for no-blink
  62.     mov    ah,1        ;function to set cursor type
  63.     int    10h
  64.     xor    ax,ax        ;cleanup
  65.     cproce
  66.  
  67. ;==>--    void curset(row,column,page)
  68. ;
  69. ;;    ARGUMENTS:
  70. ;      (int)        row        -    row to position on
  71. ;      (int)        column        -    column to position on
  72. ;      (int)        page        -    video page
  73. ;
  74. ;;    DESCRIPTION:
  75. ;      Set cursor position on indicated video page.
  76. ;
  77. ;;    AUTHOR:
  78. ;      Copyright (C)1987-1990 Greenleaf Software Inc. All Rights Reserved.
  79. ;;;
  80.     cproc    curset
  81.     mov    dl,parm2_    ;get column no. to DL
  82.     mov    dh,parm1_    ;get row no. to dh
  83.     mov    bh,parm3_    ;get page to BH
  84.     mov    ah,02        ;function to AH
  85.     int    10h
  86.     cproce
  87.  
  88. ;==>--    unsigned getcur(page)
  89. ;
  90. ;;    ARGUMENTS:
  91. ;      (int)        page    -    video page to read
  92. ;
  93. ;;    DESCRIPTION:
  94. ;      Determine cursor position on the indicated video page
  95. ;
  96. ;;    RETURNS:
  97. ;      Row in high order 8 bits, column in low order 8 bits.
  98. ;
  99. ;;    AUTHOR:
  100. ;      Copyright (C)1987-1990 Greenleaf Software Inc. All Rights Reserved.
  101. ;;;
  102.     cproc    getcur
  103.     mov    bh,parm1_    ;get page
  104.     mov    ah,3        ;function 3
  105.     int    10h
  106.     mov    ax,dx        ;get return value
  107.     cproce
  108.  
  109. ;==>--    void cls(void)
  110. ;
  111. ;;    ARGUMENTS:
  112. ;      (none)
  113. ;
  114. ;;    DESCRIPTION:
  115. ;      Clear screen.  Works only in text mode and on current video page
  116. ;      paint a NORMAL attribute on the screen.
  117. ;
  118. ;;    SIDE EFFECTS:
  119. ;      screen will clear
  120. ;
  121. ;;    AUTHOR:
  122. ;      Copyright (C)1987-1990 Greenleaf Software Inc. All Rights Reserved.
  123. ;;;
  124.     cproc    cls
  125.     mov    ah,15
  126.     int    10h        ;get number of columns in AH
  127.     push    ax
  128.     mov    cx,0ffffh    ;check for EGA BIOS
  129.     mov    ah,12h
  130.     mov    bl,10h
  131.     int    10h
  132.     inc    cx
  133.     mov    dh,24        ;assume 24 rows
  134.     jz    noega
  135.     mov    ax,1130h    ;get extended information
  136.     push    bp
  137.     push    es
  138.     push    si
  139.     int    10h
  140.     pop    si
  141.     pop    es
  142.     pop    bp        ;dl has max row
  143.     mov    dh,dl        ;get to dh
  144. noega:    pop    ax        ;get number of columns back
  145.     dec    ah
  146.     mov    dl,ah        ;dl=columns
  147.     mov    ax,0600h    ;upscroll entire screen fn=6
  148.     mov    cx,0        ;ul corner = 0,0
  149.     mov    bh,07h        ;normal attribute on blanked lines
  150.     int    10h
  151.     cproce
  152.  
  153. ;==>--    void upscroll(lines,urow,lrow,lcol,rcol,attr)
  154. ;
  155. ;;    ARGUMENTS:
  156. ;      (int)        lines    -- no. lines to scroll
  157. ;      (int)        urow    -- upper row of area to scroll
  158. ;      (int)        lrow    -- lower row af area
  159. ;      (int)        lcol    -- left hand column of area
  160. ;      (int)        rcol    -- right hand column of area
  161. ;      (int)        attr    -- video attribute for blank line
  162. ;
  163. ;;    DESCRIPTION:
  164. ;      Scroll Active Page Up. A rectangular area bounded by urow,lcol
  165. ;      at the upper left, and by lrow,rcol at the lower right, is scrolled
  166. ;      up.  Lines are blanked on the bottom of the page as they are rolled
  167. ;      upwards, and the attr parameter determines the attribute to be used 
  168. ;      for all characters there.
  169. ;
  170. ;;    SIDE EFFECTS:
  171. ;      This function only loads registers per IBM-PC Technical Reference
  172. ;      manual and calls the Rom-Bios.
  173. ;
  174. ;;    AUTHOR:
  175. ;      Copyright (C)1987-1990 Greenleaf Software Inc. All Rights Reserved.
  176. ;;;
  177.     cproc    upscroll
  178.     mov    al,parm1_
  179.     mov    ch,parm2_    ;ch=upper row
  180.     mov    dh,parm3_    ;dh=lower row
  181.     mov    cl,parm4_    ;cl=upper left column
  182.     mov    dl,parm5_    ;dl=right column
  183.     mov    bh,parm6_    ;bh=attribute
  184.     mov    ah,6        ;function 6
  185.     int    10h
  186.     cproce
  187.  
  188. ;==>--    void dnscroll(lines,urow,lrow,lcol,rcol,attr)
  189. ;
  190. ;;    ARGUMENTS:
  191. ;      (int)        lines    -- no. lines to scroll
  192. ;      (int)        urow    -- upper row of area to scroll
  193. ;      (int)        lrow    -- lower row af area
  194. ;      (int)        lcol    -- left hand column of area
  195. ;      (int)        rcol    -- right hand column of area
  196. ;      (int)        attr    -- video attribute for blank line
  197. ;
  198. ;;    DESCRIPTION:
  199. ;      Scroll Active Page down. A rectangular area bounded by urow,lcol
  200. ;      at the upper left, and by lrow,rcol at the lower right, is scrolled
  201. ;      down.  Lines are blanked on the bottom of the page as they are
  202. ;      rolled upwards, and the attr parameter determines the attribute 
  203. ;      to be used for all characters there.
  204. ;
  205. ;;    SIDE EFFECTS:
  206. ;      This function only loads registers per IBM-PC Technical Reference
  207. ;      manual and calls the Rom-Bios.
  208. ;
  209. ;;    AUTHOR:
  210. ;      Copyright (C)1987-1990 Greenleaf Software Inc. All Rights Reserved.
  211. ;;;
  212.     cproc    dnscroll
  213.     mov    al,parm1_
  214.     mov    ch,parm2_    ;ch=upper row
  215.     mov    dh,parm3_    ;dh=lower row
  216.     mov    cl,parm4_    ;cl=upper left column
  217.     mov    dl,parm5_    ;dl=right column
  218.     mov    bh,parm6_    ;bh=attribute
  219.     mov    ah,7        ; function 7
  220.     int    10h
  221.     cproce
  222.  
  223. ;==>--    unsigned _gcurvpc(void)
  224. ;
  225. ;;    ARGUMENTS:
  226. ;      (none)
  227. ;
  228. ;;    DESCRIPTION:
  229. ;      Determine cursor position on the current video page.  This is a
  230. ;      helper function for the curlf(), currt(), curup(), curdn()
  231. ;      functions.
  232. ;
  233. ;;    RETURNS:
  234. ;      Row in high order 8 bits, column in low order 8 bits.
  235. ;
  236. ;;    AUTHOR:
  237. ;    ""   10-APR-1987  09:06:02.83
  238. ;      Copyright (C)1987-1990 Greenleaf Software Inc. All Rights Reserved.
  239. ;;;
  240.     cproc    _gcurvpc
  241.     mov    ah,15
  242.     int    10h        ;get current page to bh
  243.     mov    ah,3        ;read cursor position to dx
  244.     int    10h
  245.     mov    ax,dx        ;return value in ax
  246.     cproce
  247.  
  248. ;==>--    void _cursetc(row,column)
  249. ;
  250. ;;    ARGUMENTS:
  251. ;      (int)        row        -    row to position on
  252. ;      (int)        column        -    column to position on
  253. ;
  254. ;;    DESCRIPTION:
  255. ;      Set cursor position on current video page.  This is a
  256. ;      helper function for the curlf(), currt(), curup(), curdn()
  257. ;      functions.
  258. ;
  259. ;;    AUTHOR:
  260. ;    ""   10-APR-1987  09:11:14.70
  261. ;      Copyright (C)1987-1990 Greenleaf Software Inc. All Rights Reserved.
  262. ;;;
  263.     cproc    _cursetc
  264.     mov    ah,15        ;get current page to BH
  265.     int    10h
  266.     mov    dl,parm2_    ;get column no. to DL
  267.     mov    dh,parm1_    ;get row no. to dh
  268.     mov    ah,2        ;function to AH
  269.     int    10h
  270.     cproce
  271.     endps
  272.     end
  273.