Article View: rec.games.programmer
Article #74Re: Code for loading
From: John A. Slagel
Date: Tue, 03 Nov 1992 01:34
Date: Tue, 03 Nov 1992 01:34
78 lines
2053 bytes
2053 bytes
Here goes: (This isn't the same code... I just rewrote it and
tested it with MS Quick C 2.0 )
(I used 2-byte moves instead of 1-byte moves when possible to speed
things up a bit)
#include <conio.h>
char buffer[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
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
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
add di, ax ; Go to next pixel row
dec dx ;
jnz rowloop
; Done
pop ds
pop es
pop si
pop di
}
}
main()
{ int i;
_asm {
mov ax, 13H
int 10h
}
getch();
for (i=0; i<50; i++ ) {
PutBlock( 10, 80+i , 5, 10, buffer );
getch();
}
_asm {
mov ax, 03H
int 10h
}
return 0;
}
--
------------------------------------------------------------------------
John A. Slagel, email: jas37876@uxa.cso.uiuc.edu
Technical Details
Message-ID:
<Bx49ou.6JB@news.cso.uiuc.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!ogicse!uwm.edu!ux1.cso.uiuc.edu!news.cso.uiuc.edu!uxa.cso.uiuc.edu!jas37876References:
<1992Nov02.002322.11241@rose.com> <82905@ut-emx.uucp>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!ogicse!uwm.edu!ux1.cso.uiuc.edu!news.cso.uiuc.edu!uxa.cso.uiuc.edu!jas37876 From: jas37876@uxa.cso.uiuc.edu (John A. Slagel) Newsgroups: rec.games.programmer Subject: Re: Code for loading Message-ID: <Bx49ou.6JB@news.cso.uiuc.edu> Date: 3 Nov 92 01:34:04 GMT Article-I.D.: news.Bx49ou.6JB References: <1992Nov02.002322.11241@rose.com> <82905@ut-emx.uucp> Sender: usenet@news.cso.uiuc.edu (Net Noise owner) Organization: University of Illinois at Urbana Lines: 78