Hello all,
I am currently trying to write a game that uses a static background bitmap
with a scrolling bitmap layered on top of that with sprites layered on all of
that.
The problem I cam across was that when I copied all the relevant data to
a virtual screen, It was much to slow. What should have taken a second to
draw sixty frames, took three seconds.
I tried just flipping screens with just plotting to the virtual screen, but
still It took too long.
I tried without checking V_Sync and with V_Sync.
Im currently using Borland Pascal 7 to do this game, and if I get past this
one big problem I would be happy to distribute copies to people who can help
me with this.
Here is a sample of my ASM code for the original copying of
Static BMP -> Scrolling BMP -> Sprites -> Virtual Screen <Check V_Sync> ->
VRAM.
Begin
Asm
push ax
push cx
push ds
push si
push es
push di
cld
mov cx,$FFFF
mov di,0
mov si,0
mov ds,StaticBMP
mov es,VirtualScreen
rep movsw
pop di
pop es
pop si
pop ds
pop cx
pop ax
end;
Asm
push ax
push cx
push ds
push si
push es
push di
cld
Xor CX,CX
Mov SI,0
Mov DI,0
Mov DS,ScrollingBMP
Mov ES,VirtualScreen
@Round0: Mov AX,DS:[SI]
Cmp AX,0
Je @Next0
Mov ES:[DI],AX
@Next0: Inc SI
inc DI
Inc CX
Cmp CX,$FFFF
Jne @Round0
pop di
pop es
pop si
pop ds
pop cx
pop ax
end;
{* Do the sprite thing here*}
VidRam := segA000;
Asm
push cx
push es
push ds
push si
push di
mov di,0
mov si,0
mov ds,VirtualScreen
mov es,VidRam
mov cx,$FFFF
rep movsw
pop di
pop si
pop ds
pop es
pop cx
end;
End;
StaticBMP is the start address of the static bitmap.
ScrollingBMP is the start address of the scrolling bitmap.
VirtualScreen is the start address of the virtual screen.
Im also using Protected mode for compiling target, if that means anything to
anyone.
Any ideas to speed up the FPS or just redoing the whole thing is most welcome
either at my Email address w...@southern.co.nz or in this news group.
Thanx.