home *** CD-ROM | disk | FTP | other *** search
- page 58,132
-
- ; toxxx.asm
- ; contains: tomono(),tocolor(),iscolor(),ismono()
- ;
-
- include model.h
- include prologue.h
- name toxxx
- pseg toxxx
-
- ;==>-- void tomono(void)
- ;
- ;; DESCRIPTION:
- ; Sets the equipment flags to indicate IBM Monochrome display is
- ; installed, then does set video mode to 7 (monochrome)
- ;
- ;; SIDE EFFECTS:
- ; Rom-Bios output device will change
- ;
- ;; AUTHOR:
- ; Copyright (C)1987-1990 Greenleaf Software Inc. All Rights Reserved.
- ;;;
- cproc tomono
- mov ax,0b000h
- call chkcrt ;make sure monochrome crt memory is present
- or ax,ax
- jz tomext
- push ds
- mov ax,40h ;location of equipment flags in lo core
- mov ds,ax
- mov di,10h ;address equip flag
- mov ax,00110000B ;turn on mono flags
- or [di],ax
- mov ax,7 ;function 0, set mode 7
- int 10h
- pop ds
- tomext:
- cproce
-
- ;==>-- void tocolor(void)
- ;
- ;; DESCRIPTION:
- ; Sets the equipment flags to indicate 80x25 black and white display
- ; is installed, then does set video mode to 2 (BW-80x25)
- ;
- ;; SIDE EFFECTS:
- ; Rom-Bios output device will change
- ;
- ;; AUTHOR:
- ; Copyright (C)1987-1990 Greenleaf Software Inc. All Rights Reserved.
- ;;;
- cproc tocolor
- mov ax,0b800h
- call chkcrt ;make sure monochrome crt memory is present
- or ax,ax
- jz tocext
- push ds
- mov ax,40h
- mov ds,ax
- mov di,10h ;address equip flag
- mov ax,[di] ;get current flags
- and al,11001111B ;turn monocrome OFF
- or al,00100000B ;turn on 80x25 color text as default mode
- mov [di],ax ;and put flags back
- mov ax,2 ;function 0, set 80x25 B/W mode 2
- int 10h
- pop ds
- tocext:
- cproce
-
- ;==>-- bool iscolor(void)
- ;
- ;; DESCRIPTION:
- ; Test for presence of a color adapter by attempting to modify
- ; display memory.
- ;
- ;; RETURNS:
- ; TRUE(1) if color adapter installed, FALSE(0) if not
- ;
- ;; AUTHOR:
- ; Copyright (C)1987-1990 Greenleaf Software Inc. All Rights Reserved.
- ;;;
- cproc iscolor
- mov ax,0b800h
- call chkcrt
- cproce
-
- ;==>-- bool ismono(void)
- ;
- ;; DESCRIPTION:
- ; Test for presence of a monochrome adapter by attempting to modify
- ; display memory.
- ;
- ;; RETURNS:
- ; TRUE(1) if monochrome color adapter installed, FALSE(0) if not
- ;
- ;; AUTHOR:
- ; Copyright (C)1987-1990 Greenleaf Software Inc. All Rights Reserved.
- ;;;
- cproc ismono
- mov ax,0b000h
- call chkcrt
- cproce
-
- ;==>-- Check for memory at AX:0 if memory is present
- ;
- ; enter with: ax = b000 - Monochrome
- ; ax = b800 - Graphics
- ;
- ; return: ax = 1 if memory is present
- ; ax = 0 if memory is not present
- ;
- chkcrt proc near
- push ds
- mov ds,ax
- xor bx,bx
- mov ax,bx ;ax & bx = 0
- xchg ax,[bx] ;get what is on screen
- inc byte ptr[bx]
- dec byte ptr[bx]
- xchg ax,[bx] ;put it back
- mov ax,bx ;assume no memory
- jnz chcrex ;check assumption
- inc ax ;ax=1
- chcrex: pop ds
- ret
- chkcrt endp
- endps
- end
-