home *** CD-ROM | disk | FTP | other *** search
- ;Copyright 1990 by John Wiley & Sons, Inc.
- ; All Rights Reserved.
- ;
- PAGE 58,132
- TITLE Color Image Display Program
- ;
- ;320x200 Color Image Display Program
- ;
- ;NOTE: this program will only work with a VGA video adapter
- ;
- ;written by Craig A. Lindley
- ;Vers: 1.0 Last Update: 06/21/89
- ;
- ;This program produces a .COM file which when execute will display a
- ;320x200 256 color image originally produced by the video digitizer.
- ;
- VIDEO EQU 10H ;video BIOS interrupt code
- KEYBOARD EQU 16H ;keyboard BIOS interrupt code
- ;
- IMAGESIZE EQU 64000 ;320x200 image size in bytes
- RGBSIZE EQU 256*3 ;number of rgb bytes
- GETVIDEOMODE EQU 0FH ;BIOS function code
- SETVIDEOMODE EQU 00H ;BIOS function code
- SET256COLORMODE EQU 13H ;320x200 256 color video mode
- SETCOLREGBLOCK EQU 1012H ;BIOS function/sub function code
- VGAMEMSEG EQU 0A000H ;segment of VGA display memory
- GETKEY EQU 00H ;wait for key function code
- ;
- ;
- CSEG SEGMENT PARA PUBLIC 'CODE'
- ASSUME CS:CSEG,DS:CSEG,SS:CSEG,ES:CSEG ;set by loader
- ;
- ORG 100H ;com file org location
- ;
- ;NOTE: when transcribing the addresses listed in the list file to the
- ; procedure WriteComFile be sure to reverse the order of the address
- ; bytes otherwise the resultant .COM image file will not execute.
- ;
- ;Start of the display program
- ;
- Start proc near
-
- mov ah,GETVIDEOMODE ;get the current video mode
- int VIDEO ;result in al register
- mov VMode,al ;save video mode
- ;
- mov ah,SETVIDEOMODE ;set video mode function code
- mov al,SET256COLORMODE ;to special VGA mode
- int VIDEO ;do it
- ;
- mov ax,SETCOLREGBLOCK ;prepare to load all 256 color regs
- mov bx,0 ;starting with reg 0
- mov cx,256 ;all 256 registers
- mov dx,offset ColorRegs ;pt at rgb[256] data
- ;assumes es=cs
- int VIDEO ;load the registers
- ;
- mov cx,IMAGESIZE ;number of bytes to move
- mov si,offset ImageData ;source of data to move
- ;assume ds=cs
- mov ax,VGAMEMSEG ;dest of data to be moved is VGA
- mov es,ax ;memory. es[di] = A000:0000
- mov di,0
- rep movsb ;move the image data
- ;
- mov ah,GETKEY ;wait for key press
- int KEYBOARD ;ask BIOS
- ;
- mov ah,SETVIDEOMODE ;set video mode function code
- mov al,VMode ;to original mode
- int VIDEO ;do it
- ;
- ret ;ret to dos
- ;
- Start endp
- ;
- ;Program Data Area - stored in code segment cs
- ;
- VMode DB 0 ;storage for original video mode
- ColorRegs DB RGBSIZE DUP(0);256 rgb triads
- ImageData DB IMAGESIZE DUP(0);image data storage 64000 bytes
- ;
- CSEG ENDS
- END Start