PUTPIX.TXT

===============================================================================
     Date: 05-03-95    Time: 10:01p     Number: 23     
     From: JAN_REIDAR JØRGENSEN          Refer: 19      
       To: BJOERN STAERK              Board ID: ROLVSOY         Recvd: Yes
  Subject: Putpixel                         86: Programmerin   Status: Public 
-------------------------------------------------------------------------------
BS│ JJ> Fungerer den i alle grafiske modusene/oppløsningene?
BS│ Nei, det blir *mye* mer komplisert... Denne fungerer bare i MCGA
BS│ (320*200*256), det er jo stort sett denne modusen som brukes
BS│ til spill/demoer....
BS│ Har du noen rutiner som fungerer til andre moduser??

Fant denne rutinen i boken "Programmer's Guide to the EGA, VGA, and
Super VGA Cards":

; Write a point into display memory in a 256-color mode

; Input parameters
;  x,y              hor and vert coordinates of pnt
;  color  color to drw pnt
;  offset display offset = # of pxls per line

; Calling Protocol
;  Wr_Pixel_256(x,y,color,offset);

Wr_Pixel_256 proc FAR C PUBLIC USES ES
DI,x_addr,y_addr,color:byte,bytes_per_row
; determine the (long) address = (y*offset)+x.  segment
; is in dx and the offset is in ax
          mov       ax,bytes_per_row    ;get offset
          mov       bx,y_addr           ;get y
          mul       bx                            ;y*offset
          add       ax,x_addr           ;(y*offset)+x(lower 16 bits)
          adc       dx,0                          ;(y*offset)+x(upper n
bits)
          and       dx,0fh                        ;only keep lower 4
bits of segment

; load the segment register
          push      ax                            ;save the offset for
later
          mov       al,dl                         ;get the segment value
          mov       dx,3cdh                       ;pnt to segment reg
          out       dx,al                         ;load the segment reg

; send the data to the display memory in es
          mov       es,SegA000
          pop       di                            ;get display offset
value
          mov       al,color            ;get color
          mov       es:[di],al                    ;store color in
display memory
          ret
Wr_Pixel_256 endp

Håper den kan hjelpe deg.  Jeg har IKKE testet den, og vet ikke om
den virker.

╔═══════════════════════════════════════════════════════════════════
║ JARE - Jan Reidar Jørgensen - SigOp i Programmering - JARETAG 1.1A
===============================================================================