home *** CD-ROM | disk | FTP | other *** search
/ Piper's Pit BBS/FTP: ibm 0040 - 0049 / ibm0040-0049 / ibm0040.tar / ibm0040 / IMGPROC.ZIP / C5CVIDEO.ZIP / IMAGECOM.ASM < prev   
Encoding:
Assembly Source File  |  1990-04-06  |  2.5 KB  |  85 lines

  1. ;Copyright 1990 by John Wiley & Sons, Inc.
  2. ;          All Rights Reserved.
  3. ;
  4.         PAGE 58,132
  5.         TITLE    Color Image Display Program
  6. ;
  7. ;320x200 Color Image Display Program
  8. ;
  9. ;NOTE: this program will only work with a VGA video adapter
  10. ;
  11. ;written by  Craig A. Lindley
  12. ;Vers: 1.0   Last Update: 06/21/89
  13. ;
  14. ;This program produces a .COM file which when execute will display a
  15. ;320x200 256 color image originally produced by the video digitizer.
  16. ;
  17. VIDEO        EQU    10H        ;video BIOS interrupt code
  18. KEYBOARD    EQU    16H        ;keyboard BIOS interrupt code
  19. ;
  20. IMAGESIZE    EQU    64000        ;320x200 image size in bytes
  21. RGBSIZE        EQU    256*3        ;number of rgb bytes
  22. GETVIDEOMODE    EQU    0FH        ;BIOS function code
  23. SETVIDEOMODE    EQU    00H        ;BIOS function code
  24. SET256COLORMODE    EQU    13H        ;320x200 256 color video mode
  25. SETCOLREGBLOCK    EQU    1012H        ;BIOS function/sub function code
  26. VGAMEMSEG    EQU    0A000H        ;segment of VGA display memory
  27. GETKEY        EQU    00H        ;wait for key function code
  28. ;
  29. ;
  30. CSEG    SEGMENT PARA PUBLIC 'CODE'
  31.     ASSUME CS:CSEG,DS:CSEG,SS:CSEG,ES:CSEG ;set by loader
  32. ;
  33.         ORG    100H        ;com file org location
  34. ;
  35. ;NOTE: when transcribing the addresses listed in the list file to the
  36. ;      procedure WriteComFile be sure to reverse the order of the address
  37. ;      bytes otherwise the resultant .COM image file will not execute.
  38. ;
  39. ;Start of the display program
  40. ;
  41. Start    proc    near
  42.  
  43.     mov    ah,GETVIDEOMODE        ;get the current video mode
  44.     int    VIDEO            ;result in al register
  45.     mov    VMode,al        ;save video mode
  46. ;
  47.     mov    ah,SETVIDEOMODE        ;set video mode function code
  48.     mov    al,SET256COLORMODE    ;to special VGA mode
  49.     int    VIDEO            ;do it
  50. ;
  51.     mov    ax,SETCOLREGBLOCK    ;prepare to load all 256 color regs
  52.     mov    bx,0            ;starting with reg 0
  53.     mov    cx,256            ;all 256 registers
  54.     mov    dx,offset ColorRegs    ;pt at rgb[256] data
  55.                     ;assumes es=cs
  56.     int    VIDEO                   ;load the registers
  57. ;
  58.     mov    cx,IMAGESIZE        ;number of bytes to move
  59.     mov    si,offset ImageData    ;source of data to move
  60.                     ;assume ds=cs
  61.     mov    ax,VGAMEMSEG        ;dest of data to be moved is VGA
  62.     mov    es,ax            ;memory. es[di] = A000:0000
  63.     mov    di,0
  64.     rep    movsb            ;move the image data
  65. ;
  66.     mov    ah,GETKEY        ;wait for key press
  67.     int    KEYBOARD        ;ask BIOS
  68. ;
  69.     mov    ah,SETVIDEOMODE        ;set video mode function code
  70.     mov    al,VMode        ;to original mode
  71.     int    VIDEO            ;do it
  72. ;
  73.     ret                ;ret to dos
  74. ;
  75. Start    endp
  76. ;
  77. ;Program Data Area - stored in code segment cs
  78. ;
  79. VMode        DB    0        ;storage for original video mode
  80. ColorRegs    DB    RGBSIZE   DUP(0);256 rgb triads
  81. ImageData    DB    IMAGESIZE DUP(0);image data storage 64000 bytes
  82. ;
  83. CSEG    ENDS
  84.     END    Start
  85.