Article View: rec.games.programmer
Article #88Code for loading
From: colin buckley
Date: Wed, 04 Nov 1992 20:43
Date: Wed, 04 Nov 1992 20:43
56 lines
2290 bytes
2290 bytes
Date Entered: 11-04-92 15:38
JA>void PutBlock( int x, int y, int height, int width, char far * buffer )
>{ _asm {
> push di
> push si
> push es
> push ds
> mov ax, 320
> mul y ; AX = y * 320
> add ax, x ; + x
> mov di, ax ; ES:DI = destination of pixels
> mov ax, 0A000h
> mov es, ax ; Segment of VGA memory
> mov dx, height
> mov bx, width
> mov ax, 320
> sub ax, bx
> lds si, buffer
JA>rowloop:
> mov cx, bx ; width of row
> shr cx, 1 ; number of words
> rep movsw ; copy as many words as possible
> adc cx, cx ; move the odd byte
> rep movsb
JNC @@Even
MOVSB
@@Even:
REP MOVSW
is quicker on my computer, and because the possible odd byte is moved
first, we get even 16-bit moves. I assume anyways. It was faster in large
and small moves. Although, I think I was using ADC CX,0 in my test.
> add di, ax ; Go to next pixel row
> dec dx ;
> jnz rowloop
> ; Done
> pop ds
> pop es
> pop si
> pop di
> }
>}
.----------------------------------------------------.
| Colin Buckley -- 486 Powered (Packing Extra Socks) |
| Toronto, Ontario, Canada |
| InterNet: colin.buckley@rose.com |
| |
| So Eager to Play, So Relunctant to Admit it... |
`----------------------------------------------------'
---
RM 2.00 : RoseNet<=>Usenet Gateway : Rose Media 416-733-2285
Technical Details
Message-ID:
<1992Nov04.204346.19452@rose.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!portal!lll-winken!sun-barr!cs.utexas.edu!uwm.edu!zaphod.mps.ohio-state.edu!uunet.ca!rose!usenetShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!portal!lll-winken!sun-barr!cs.utexas.edu!uwm.edu!zaphod.mps.ohio-state.edu!uunet.ca!rose!usenet From: colin.buckley@rose.com (colin buckley) Newsgroups: rec.games.programmer Subject: Code for loading Message-ID: <1992Nov04.204346.19452@rose.com> Date: 4 Nov 92 20:43:44 GMT Sender: usenet@rose.com (Usenet Gateway) Organization: Rose Media Inc, Toronto, Ontario. Lines: 56 X-Gated-By: Usenet <==> RoseMail Gateway (v1.70)