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 / TOXXX.ASM < prev    next >
Encoding:
Assembly Source File  |  1990-05-30  |  2.8 KB  |  131 lines

  1.         page    58,132
  2.  
  3. ; toxxx.asm
  4. ; contains: tomono(),tocolor(),iscolor(),ismono()
  5. ;
  6.  
  7.         include    model.h
  8.         include    prologue.h
  9.         name    toxxx
  10.         pseg    toxxx
  11.  
  12. ;==>--    void tomono(void)
  13. ;
  14. ;;    DESCRIPTION:
  15. ;      Sets the equipment flags to indicate IBM Monochrome display is
  16. ;      installed, then does set video mode to 7 (monochrome)
  17. ;
  18. ;;    SIDE EFFECTS:
  19. ;      Rom-Bios output device will change
  20. ;
  21. ;;    AUTHOR:
  22. ;      Copyright (C)1987-1990 Greenleaf Software Inc. All Rights Reserved.
  23. ;;;
  24.     cproc    tomono
  25.     mov    ax,0b000h
  26.     call    chkcrt        ;make sure monochrome crt memory is present
  27.     or    ax,ax
  28.     jz    tomext
  29.     push    ds
  30.     mov    ax,40h        ;location of equipment flags in lo core
  31.     mov    ds,ax
  32.     mov    di,10h        ;address equip flag
  33.     mov    ax,00110000B    ;turn on mono flags
  34.     or    [di],ax
  35.     mov    ax,7        ;function 0, set mode 7
  36.     int    10h
  37.     pop    ds
  38. tomext:    
  39.     cproce
  40.  
  41. ;==>--    void tocolor(void)
  42. ;
  43. ;;    DESCRIPTION:
  44. ;      Sets the equipment flags to indicate 80x25 black and white display
  45. ;      is installed, then does set video mode to 2 (BW-80x25)
  46. ;
  47. ;;    SIDE EFFECTS:
  48. ;      Rom-Bios output device will change
  49. ;
  50. ;;    AUTHOR:
  51. ;      Copyright (C)1987-1990 Greenleaf Software Inc. All Rights Reserved.
  52. ;;;
  53.     cproc    tocolor
  54.     mov    ax,0b800h
  55.     call    chkcrt        ;make sure monochrome crt memory is present
  56.     or    ax,ax
  57.     jz    tocext
  58.     push    ds
  59.     mov    ax,40h
  60.     mov    ds,ax
  61.     mov    di,10h        ;address equip flag
  62.     mov    ax,[di]        ;get current flags
  63.     and    al,11001111B    ;turn monocrome OFF
  64.     or    al,00100000B    ;turn on 80x25 color text as default mode
  65.     mov    [di],ax        ;and put flags back
  66.     mov    ax,2        ;function 0, set 80x25 B/W mode 2
  67.     int    10h
  68.     pop    ds
  69. tocext:
  70.     cproce
  71.  
  72. ;==>--    bool iscolor(void)
  73. ;
  74. ;;    DESCRIPTION:
  75. ;      Test for presence of a color adapter by attempting to modify
  76. ;      display memory.
  77. ;
  78. ;;    RETURNS:
  79. ;      TRUE(1) if color adapter installed, FALSE(0) if not
  80. ;
  81. ;;    AUTHOR:
  82. ;      Copyright (C)1987-1990 Greenleaf Software Inc. All Rights Reserved.
  83. ;;;
  84.     cproc    iscolor
  85.     mov    ax,0b800h
  86.     call    chkcrt
  87.     cproce
  88.  
  89. ;==>--    bool ismono(void)
  90. ;
  91. ;;    DESCRIPTION:
  92. ;      Test for presence of a monochrome adapter by attempting to modify
  93. ;      display memory.
  94. ;
  95. ;;    RETURNS:
  96. ;      TRUE(1) if monochrome color adapter installed, FALSE(0) if not
  97. ;
  98. ;;    AUTHOR:
  99. ;      Copyright (C)1987-1990 Greenleaf Software Inc. All Rights Reserved.
  100. ;;;
  101.     cproc    ismono
  102.     mov    ax,0b000h
  103.     call    chkcrt
  104.     cproce
  105.  
  106. ;==>--    Check for memory at AX:0 if memory is present
  107. ;
  108. ;    enter with:    ax = b000  -  Monochrome
  109. ;            ax = b800  -  Graphics
  110. ;
  111. ;    return:        ax = 1  if memory is present
  112. ;            ax = 0  if memory is not present
  113. ;
  114. chkcrt    proc    near
  115.     push    ds
  116.     mov    ds,ax
  117.     xor    bx,bx
  118.     mov    ax,bx        ;ax & bx = 0
  119.     xchg    ax,[bx]        ;get what is on screen
  120.     inc    byte ptr[bx]
  121.     dec    byte ptr[bx]
  122.     xchg    ax,[bx]        ;put it back
  123.     mov    ax,bx        ;assume no memory
  124.     jnz    chcrex        ;check assumption
  125.     inc    ax        ;ax=1
  126. chcrex:    pop    ds
  127.     ret
  128. chkcrt    endp
  129.     endps
  130.     end
  131.