home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 14 / CDACTUAL.iso / cdactual / demobin / share / program / asm / SETMOD.ZIP / SETMOD.ASM
Encoding:
Assembly Source File  |  1992-09-10  |  3.0 KB  |  77 lines

  1. ; SetVideoMode320x200x256x4
  2.  
  3. ; Sets the VGA video hardware to a 320 pixel wide by 200
  4. ; pixel tall graphics mode with 256 colors and 4 pages.
  5.  
  6. ; This is written in Turbo Assembler 2.0's Ideal mode, and may require
  7. ; slight changes in order to compile under a different assembler.
  8.  
  9. Ideal
  10.  
  11. Model Small, C
  12.  
  13. CodeSeg
  14.  
  15.     Public SetVideoMode320x200x256x4
  16.  
  17.     Proc SetVideoMode320x200x256x4
  18.  
  19.         mov ax, 0013h                   ; Allow BIOS to set 320x200x256x1
  20.         int 10h                         ;
  21.  
  22.         mov dx, 3CEh                    ; Tell the Graphics Controller
  23.         mov al, 5                       ; to change the graphics mode
  24.         out dx, al                      ; (register 5) to use linear
  25.         inc dx                          ; addresses instead of seperating
  26.         in al, dx                       ; the odd and even addresses.
  27.         and al, 11101111b               ;
  28.         out dx, al                      ;
  29.         dec dx                          ;
  30.  
  31.         mov al, 6                       ; Tell the Graphics Controller
  32.         out dx, al                      ; to change the misc. register
  33.         inc dx                          ; (register 6) to use linear
  34.         in al, dx                       ; addresses instead of seperating
  35.         and al, 11111101b               ; the odd and even addresses.
  36.         out dx, al                      ;
  37.  
  38.         mov dx, 3C4h                    ; Tell the Sequencer Controller
  39.         mov al, 4                       ; to change the memory mode
  40.         out dx, al                      ; (register 4) to disable chain4
  41.         inc dx                          ; mode, and allow linear
  42.         in al, dx                       ; processing on a bitplane.
  43.         and al, 11110111b               ;
  44.         or al, 4                        ;
  45.         out dx, al                      ;
  46.  
  47.         mov ax, 0A000h                  ; Clear the screen.
  48.         mov es, ax                      ;
  49.         xor di, di                      ;
  50.         mov ax, di                      ;
  51.         mov cx, 8000h                   ;
  52.         rep stosw                       ;
  53.  
  54.         mov dx, 3D4h                    ; Tell the CRT Controller to
  55.         mov al, 14h                     ; change the underline location
  56.         out dx, al                      ; (register 14h) to turn off
  57.         inc dx                          ; the double word mode.
  58.         in al, dx                       ;
  59.         and al, 10111111b               ;
  60.         out dx, al                      ;
  61.         dec dx                          ;
  62.  
  63.         mov al, 17h                     ; Tell the CRT Controller to
  64.         out dx, al                      ; change the mode control
  65.         inc dx                          ; (register 17h) to switch
  66.         in al, dx                       ; to byte mode.
  67.         or al, 01000000b                ;
  68.         out dx, al                      ;
  69.  
  70.         ret
  71.  
  72.     EndP
  73.  
  74. EndS
  75.  
  76. End
  77.