PutPixel 320*200: how can i do it? 
Author Message
 PutPixel 320*200: how can i do it?

Someone knows what I must do to write a pixel in a 320*200 resolution.
I use Turbo C++ 3.0 with Tasm 5
                                                            Thanks !


Fri, 24 May 2002 03:00:00 GMT  
 PutPixel 320*200: how can i do it?



Quote:
> Someone knows what I must do to write a pixel in a 320*200 resolution.
> I use Turbo C++ 3.0 with Tasm 5
>                                                             Thanks !

;    pop    ax    ; get Color (integer)
;    pop    dx    ; get Y
;    pop    bx    ; get X

push    0A000h
pop    es

mov    si, dx    ; si = Y
shl    si, 6        ; si = Y * 64
mov    cx, si    ; cx = Y * 64
shl    si, 2        ; si = Y * 256
add    si, cx    ; si = (Y * 256) + (Y * 64)

mov es:[si+bx], al

ret

This code will POP the arguments into AX, BX and DX which is used to hold X,
Y and Color, you may have to swap the order, I cannot remember the argument
order. Also, this is 16-bit code.

For a block-fill or block-copy routine I would strongly recommend using a
loop of REP STOSD's or REP MOVSD's instead, the same goes for a Line
routine. You should also differ between straight lines or angeled (is this a
real word?) lines.

Regards,
Thomas.



Fri, 24 May 2002 03:00:00 GMT  
 PutPixel 320*200: how can i do it?

Quote:

> Someone knows what I must do to write a pixel in a 320*200 resolution.
> I use Turbo C++ 3.0 with Tasm 5
>                                                             Thanks !

The video memory is in segment A000h . In mode 13h you just need to put
the value of the color in location : [a000h:320*y+x]


Sat, 25 May 2002 03:00:00 GMT  
 PutPixel 320*200: how can i do it?

Set a pointer to the video memory like:

char *video = (char *)0xa0000L;

Then simply write to x,y by multiplying y with the width of the screen,
and adding that and the x variable to your pointer..

void PutPixel(x,y,color)
{
  video[y*320+x] = color;

Quote:
}

Oh.. If TurboC++3.5 is a protected mode compiler, this won't work..
You'll probably want to write to a back buffer and copy it with some
routine that bypasses tha memory protection.

--

Sent via Deja.com http://www.deja.com/
Before you buy.



Sat, 25 May 2002 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. PutPixel 320*200: how can i do it?

2. Oki 320 Repost of Quest

3. Oki 320 font help...desperate!

4. More Oki 320

5. Okidata 320-IBM dot matrix printer

6. NDN:Info Dylan digest V2 #320

7. Multiplying by 320/640 in assembler

8. Mode X (320*400)

9. 320*240 in 'modex'

10. 320-face [2/2]

11. Modulo 320...

 

 
Powered by phpBB® Forum Software