home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / rec / games / programm / 5208 < prev    next >
Encoding:
Internet Message Format  |  1992-12-29  |  2.6 KB

  1. Path: sparky!uunet!zaphod.mps.ohio-state.edu!uwm.edu!cs.utexas.edu!ut-emx!ccwf.cc.utexas.edu
  2. From: baylor@ccwf.cc.utexas.edu (Baylor)
  3. Newsgroups: rec.games.programmer
  4. Subject: Copying whole screens for Page Flipping
  5. Message-ID: <85893@ut-emx.uucp>
  6. Date: 28 Dec 92 22:37:17 GMT
  7. Sender: news@ut-emx.uucp
  8. Organization: The University of Texas at Austin, Austin TX
  9. Lines: 81
  10.  
  11.  
  12.     Me and my finicky Pascal compiler can't get some code
  13. to work. I'm trying to page flip and to do it, i want to copy 
  14. everything from page 0 to page 1. Below is a hard-coded routine
  15. to copy all of page 0 to page 1, hoping of course page 1
  16. starts at 0a000:8000.
  17.     And it don't work - it sometimes does nothing (page 1
  18. stays the same) or else only icons with bit 0 set (like blue,
  19. gray purple colors) are copied, but when they copy they make 
  20. solid white icons. I assume somehow only bit 0 is being copied over,
  21. which is why page 2 only has black and white images on it.
  22.     I don't have the hang of switching planes, and since i 
  23. have to copy from a plane from dest to plane on source, i hope
  24. 1 plane switch does tha plane switching for both source and dest.
  25. If any of you have any ideas about what i could look at, please 
  26. let me know.
  27.     Kinda makes me wish i had an amiga...
  28.  
  29.  
  30.  
  31.  
  32. Procedure Copy_Page; assembler;
  33. (* Updates global variable Vis_Page                 *)
  34. (* ES:DI - Destination (to)   DS:SI - Source (from) *)
  35. (* CX    - Plane Loop         CX    - Row Loop      *)
  36.  const
  37.       ScreenWidth          = 320;
  38.       ScreenHeight         = 200;
  39.  
  40.       Sequencer_Index      = $3C4;
  41.       Color_Plane_Index    = $02;
  42.       CurrentPlane : byte  = 8;
  43.  
  44.       Screen_Offset        = $0A000;
  45.       ScreenBytes          = ScreenWidth div 8; (* Bytes per scanline *)
  46.       PlaneBytes           = ScreenBytes*ScreenHeight;
  47.       PlaneWords           = PlaneBytes div 2;
  48.       Page_1_Offset        = ScreenBytes*ScreenHeight;
  49. (* var
  50.     CurrentPlane : byte;*)
  51.   Asm
  52.      push ds
  53.      push es
  54.  
  55.      cld
  56.  
  57.      mov  CurrentPlane,8
  58.      mov  cx,4   (* Num Planes *)
  59.  
  60.      mov ax,Screen_Offset
  61.      mov ds,ax
  62.  
  63.      mov ax,Screen_Offset
  64.      mov es,ax
  65.  
  66.  @@Set_Address:
  67.      mov di,Page_1_Offset
  68.      xor si,si
  69.  
  70.      @@Plane_Loop:
  71.          push cx           (* Save Plane Number *)
  72.  
  73.          mov dx,Sequencer_Index    (* set plane *)
  74.          mov al,Color_Plane_Index
  75.          out dx,al
  76.          inc dx
  77.          mov al,CurrentPlane
  78.          out dx,al
  79.  
  80.          mov cx,PlaneWords  (* copy that plane *)
  81.          rep movsw
  82.  
  83.          shr CurrentPlane,1    (* next plane *)
  84.          pop cx                (* set cx back to planes *)
  85.  
  86.          loop @@Set_Address
  87.  
  88.      pop es
  89.      pop ds
  90.   End;
  91.  
  92.