home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-386-Vol-2of3.iso / b / bgi256-3.zip / SPIXEL.INC < prev    next >
Text File  |  1992-12-27  |  2KB  |  70 lines

  1. ;SPIXEL.INC - Copyright 1991,1992 Knight Software
  2. ;    History:
  3. ;       17 May 1991 - Original release
  4. ;       10 Jun 1992 - Added ability to control pixel writing style
  5. ;       22 Nov 1992 - Adapted for protected mode operation 
  6. ;
  7. ;-----------------------------------------------------------------
  8. ;read a pixel from the screen. Returns Color in PixelForeColor
  9. ;assumes that the address and segment have been pre-set
  10. ;Assume: DS = data segment
  11. ;Entry:  N/A
  12. ;Return: AL = color read
  13.  
  14. ReadPixel PROC    NEAR
  15.     PUSH    ES
  16.     PUSH    SI
  17.     MOV    SI,DS:[PixelAddress]   ;get the address to read
  18.     MOV    ES,DS:[VideoSegment]   ;video is at segment 0a000h
  19.     MOV    AL,ES:[SI]             ;read from video memory
  20.     POP    SI
  21.     POP    ES
  22.     RET
  23. ReadPixel ENDP
  24.  
  25.  
  26. ;--------------------------------------------------
  27. ;write a pixel on the screen in the indicated color in reg AL
  28. ;assumes that the address and segment have been preset
  29. ;Assume:  DS = data segment
  30. ;Entry:   AL = Color
  31. ;Return:  N/A
  32. ;Destory: nothing
  33.  
  34. WritePixel PROC    NEAR
  35.     PUSH    ES
  36.     PUSH    DI
  37.     MOV    DI,DS:[PixelAddress]   ;get the address to write
  38.     MOV    ES,DS:[VideoSegment]   ;video is at segment 0a000h
  39.     MOV    ES:[DI],AL           ;write to video memory
  40.     POP    DI
  41.     POP    ES
  42.     RET
  43. WritePixel ENDP
  44.  
  45.  
  46. ;--------------------------------------------------
  47. ;put a pixel on the screen in the indicated color
  48. ;assumes that the address and segment have been preset
  49. ;DrawPixelProc controls how the pixel is drawn
  50. ;Assume: DS = data segment
  51. ;Entry:  AL = drawing color
  52. ;Return: N/A
  53.  
  54. DrawPixel PROC    NEAR
  55.     PUSH    ES
  56.     PUSH    DI
  57.     PUSH    AX
  58.     MOV    DI,DS:[PixelAddress]   ;get the address to write
  59.     MOV    ES,DS:[VideoSegment]   ;video is at segment 0a000h
  60.     MOV    AH,DS:[PixelBackColor] ;get the background color
  61.     OR    AL,AL               ;drawing color is in AL
  62.     CALL    WORD PTR DS:[DrawPixelProc] ;write to video memory
  63.     POP    AX
  64.     POP    DI
  65.     POP    ES
  66.     RET
  67. DrawPixel ENDP
  68.  
  69.  
  70.