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 / VSETS.ASM < prev   
Encoding:
Assembly Source File  |  1990-05-30  |  2.7 KB  |  143 lines

  1.         page    58,132
  2.  
  3. ; vsets.asm
  4. ; contains: _vmode(),vpage(),vstate()
  5. ;
  6.         include    model.h
  7.         include    prologue.h
  8.         include equ.h
  9.         name    vsets
  10.         pseg    vsets
  11.  
  12. ;==>--    unsigned _vmode(mode)
  13. ;
  14. ;;    ARGUMENTS:
  15. ;      (int)        mode    -    video mode to set 0..7
  16. ;                    if parameter is -1 (0xffff)
  17. ;                    then don't set video mode, just
  18. ;                    read it.
  19. ;;    DESCRIPTION:
  20. ;      set rom-bios video mode
  21. ;
  22. ;;    SIDE EFFECTS:
  23. ;      video mode is changed
  24. ;
  25. ;;    RETURNS:
  26. ;      Number of columns in high order 8 bits, number of rows in
  27. ;      low order 8 bits.
  28. ;
  29. ;;    AUTHOR:
  30. ;      Copyright (C)1987-1990 Greenleaf Software Inc. All Rights Reserved.
  31. ;
  32. ;;    MODIFICATIONS:
  33. ;
  34. ;;;
  35.     cproc    _vmode
  36.     cmp    word ptr parm1_,0ffffh
  37.     jz    skset
  38.     mov    al,parm1_    ;get mode from stack to AL
  39.     xor    ah,ah        ;code to do mode set to INT 10
  40.     int    10h
  41. skset:    mov    word ptr parm1_,25    ;assume 25 rows on screen
  42.     mov    ah,12h
  43.     mov    bl,10h
  44.     mov    cx,0ffffh    ;cx will be != to -1 if ega present
  45.     int    10h
  46.     inc    cx        ;is ega bios in control?
  47.     jz    noega
  48.     mov    ax,1130h    ;get extended ega information
  49.     push    bp
  50.     push    es
  51.     int    10h
  52.     pop    es
  53.     pop    bp
  54.     inc    dl
  55.     mov    parm1_,dl    ;update number of rows
  56. noega:    mov    ah,15
  57.     int    10h        ;get number of columns to ah
  58.     mov    al,parm1_    ;number of rows to al
  59.     cproce
  60.  
  61. ;==>--    void vpage(page)
  62. ;
  63. ;;    ARGUMENTS:
  64. ;      (int)        page    -    visual page to set (0-7)
  65. ;
  66. ;;    DESCRIPTION:
  67. ;      set default video page
  68. ;
  69. ;;    SIDE EFFECTS:
  70. ;      default video page may change
  71. ;
  72. ;;    AUTHOR:
  73. ;      Copyright (C)1987-1990 Greenleaf Software Inc. All Rights Reserved.
  74. ;;;
  75.     cproc    vpage
  76.     mov    al,parm1_    ;get page number
  77.     mov    ah,5        ;function 5 to AH
  78.     int    10h
  79.     cproce
  80.  
  81. ;==>--    unsigned vstate(&out)
  82. ;
  83. ;;    ARGUMENTS:
  84. ;      (struct GFREGS *)    out    -    points to structure
  85. ;
  86. ;;    DESCRIPTION:
  87. ;      Get current video state, set registers structure with values
  88. ;      returned.
  89. ;
  90. ;;    RETURNS:
  91. ;      current video mode.
  92. ;
  93. ;;    AUTHOR:
  94. ;      Copyright (C)1987-1990 Greenleaf Software Inc. All Rights Reserved.
  95. ;
  96. ;;    MODIFICATIONS:
  97. ;
  98. ;;;
  99.     cproc    vstate
  100.     push    bp
  101.     mov    ah,15
  102.     int    10h        ;do the interrupt, getting info
  103.     pop    bp
  104.     if    _LDATA
  105.       push    ds
  106.       lds    si,parm1_
  107.     else
  108.       mov    si,parm1_
  109.     endif
  110.     xor    ch,ch
  111.     mov    cl,ah        ;cx=number of columns
  112.     mov    [si+gfbx],cx    ;save in structure
  113.     mov    cl,bh        ;cx=current video page
  114.     mov    [si+gfcx],cx    ;save in structure
  115.     xor    ah,ah        ;ax=current video mode
  116.     mov    [si+gfax],ax
  117.     mov    [si+gfdx],25    ;assume 25 rows
  118.     push    ax
  119.     mov    ah,12h
  120.     mov    bl,10h
  121.     mov    cx,0ffffh    ;cx will be != to -1 if ega present
  122.     int    10h
  123.     inc    cx        ;is ega bios in control?
  124.     jz    xnoega
  125.     mov    ax,1130h    ;get extended ega information
  126.     push    bp
  127.     push    es
  128.     push    si
  129.     int    10h
  130.     pop    si
  131.     pop    es
  132.     pop    bp
  133.     xor    dh,dh
  134.     inc    dl
  135.     mov    [si+gfdx],dx    ;save number of rows in variable
  136. xnoega:    pop    ax
  137.     if    _LDATA
  138.      pop    ds
  139.     endif
  140.     cproce
  141.     endps
  142.     end
  143.