Article View: rec.games.programmer
Article #1611Copying whole screens for Page Flipping
From: Baylor
Date: Mon, 28 Dec 1992 22:37
Date: Mon, 28 Dec 1992 22:37
80 lines
2737 bytes
2737 bytes
Me and my finicky Pascal compiler can't get some code
to work. I'm trying to page flip and to do it, i want to copy
everything from page 0 to page 1. Below is a hard-coded routine
to copy all of page 0 to page 1, hoping of course page 1
starts at 0a000:8000.
And it don't work - it sometimes does nothing (page 1
stays the same) or else only icons with bit 0 set (like blue,
gray purple colors) are copied, but when they copy they make
solid white icons. I assume somehow only bit 0 is being copied over,
which is why page 2 only has black and white images on it.
I don't have the hang of switching planes, and since i
have to copy from a plane from dest to plane on source, i hope
1 plane switch does tha plane switching for both source and dest.
If any of you have any ideas about what i could look at, please
let me know.
Kinda makes me wish i had an amiga...
Procedure Copy_Page; assembler;
(* Updates global variable Vis_Page *)
(* ES:DI - Destination (to) DS:SI - Source (from) *)
(* CX - Plane Loop CX - Row Loop *)
const
ScreenWidth = 320;
ScreenHeight = 200;
Sequencer_Index = $3C4;
Color_Plane_Index = $02;
CurrentPlane : byte = 8;
Screen_Offset = $0A000;
ScreenBytes = ScreenWidth div 8; (* Bytes per scanline *)
PlaneBytes = ScreenBytes*ScreenHeight;
PlaneWords = PlaneBytes div 2;
Page_1_Offset = ScreenBytes*ScreenHeight;
(* var
CurrentPlane : byte;*)
Asm
push ds
push es
cld
mov CurrentPlane,8
mov cx,4 (* Num Planes *)
mov ax,Screen_Offset
mov ds,ax
mov ax,Screen_Offset
mov es,ax
@@Set_Address:
mov di,Page_1_Offset
xor si,si
@@Plane_Loop:
push cx (* Save Plane Number *)
mov dx,Sequencer_Index (* set plane *)
mov al,Color_Plane_Index
out dx,al
inc dx
mov al,CurrentPlane
out dx,al
mov cx,PlaneWords (* copy that plane *)
rep movsw
shr CurrentPlane,1 (* next plane *)
pop cx (* set cx back to planes *)
loop @@Set_Address
pop es
pop ds
End;
Technical Details
Message-ID:
<85893@ut-emx.uucp>Path:
arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!uwm.edu!cs.utexas.edu!ut-emx!ccwf.cc.utexas.eduShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!uwm.edu!cs.utexas.edu!ut-emx!ccwf.cc.utexas.edu From: baylor@ccwf.cc.utexas.edu (Baylor) Newsgroups: rec.games.programmer Subject: Copying whole screens for Page Flipping Message-ID: <85893@ut-emx.uucp> Date: 28 Dec 92 22:37:17 GMT Sender: news@ut-emx.uucp Organization: The University of Texas at Austin, Austin TX Lines: 81