home *** CD-ROM | disk | FTP | other *** search
/ World of Shareware - Software Farm 2 / wosw_2.zip / wosw_2 / CPROG / ASMLIB35.ZIP / ASM3DEMO.ZIP / MODECHNG.ASM < prev    next >
Assembly Source File  |  1992-08-24  |  1KB  |  94 lines

  1. ; MODECHNG.ASM - Sample program for ASMLIB graphics
  2. ; Programmer: Douglas Herr
  3. ; date: 5/24/1992
  4.  
  5. ; detect video equipment and switch to highest resolution mode available
  6. ; does not attempt to detect non-default monitor or SVGA or VESA equipment
  7.  
  8. include    asm.inc
  9.  
  10. public    graphmode, textmode
  11.  
  12. extrn    getcrt:proc, hgraph0:proc, htext:proc
  13. ;extrn    svga16:proc, whichvga:proc
  14.  
  15. .data
  16. crt    dw 0
  17. nocard    db 'graphics card required',0Dh,0Ah,7,'$'
  18.  
  19. grmode    db 0,0
  20.  
  21. .code
  22. graphmode    proc
  23. ;    call    whichvga
  24. ;    mov    ax,1
  25. ;    call    svga16
  26. ;    ret
  27.     call    getcrt
  28.     mov    crt,ax
  29.     cmp    al,-1
  30.     je    cga
  31.     cmp    al,127
  32.     ja    hercules
  33.     or    al,al
  34.     jnz    evga
  35.  
  36.     or    ah,ah
  37.     jnz    egamono
  38.     lea    dx,nocard    ; point to error message
  39.     jmp    oops        ; exit with CF = 1
  40.  
  41. egamono:mov    ax,000Fh
  42.     int    10h
  43.     mov    ah,07h
  44.     jmp    short g10
  45.  
  46. ; if CGA, use 2-color "high" resolution mode
  47. cga:    mov    ax,6
  48.     push    bp
  49.     int    10h
  50.     pop    bp
  51.     mov    ah,03h
  52.     jmp    short g10
  53.  
  54. ; EGA color, VGA color or MCGA
  55. evga:    add    al,0Fh
  56.     int    10h
  57.     mov    ah,03h
  58.     jmp    short g10
  59.  
  60. hercules:
  61.     call    hgraph0
  62.     mov    ax,0708h
  63.  
  64. g10:    mov    word ptr grmode,ax
  65.     clc
  66.     ret
  67. oops:    stc
  68.     ret
  69. graphmode    endp
  70.  
  71.  
  72. ; use TextMode to return to text mode after calling GraphMode
  73. ; call with: no parameters
  74. ; returns: nothing in particular
  75. ; uses: AX, flags
  76. textmode    proc
  77.     mov    ax,word ptr grmode
  78.     cmp    al,08h
  79.     je    herctext
  80.     mov    al,ah
  81.     xor    ah,ah
  82.  
  83.     push    bp
  84.     int    10h
  85.     pop    bp
  86.     ret
  87.  
  88. herctext:
  89.     call    htext
  90.     ret
  91. textmode    endp
  92.  
  93.     end
  94.