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

  1. Path: sparky!uunet!think.com!yale.edu!qt.cs.utexas.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: Copy whole EGA screens
  5. Message-ID: <85999@ut-emx.uucp>
  6. Date: 31 Dec 92 17:54:05 GMT
  7. Sender: news@ut-emx.uucp
  8. Lines: 58
  9.  
  10.  
  11.     Ok, my code to copy EGA screens from one page to another
  12. finally works. Thanks to all those people who asked why some idiot
  13. would try direct moves when he could use Latched Moves, which of 
  14. course solved the problem.
  15.     Included is the code to copy from page 0 to 1 for both the
  16. people possibly interested (EGA, like the good old days)
  17.  
  18.  
  19. (******************************************************************)
  20. Procedure Copy_Page; assembler;
  21. (* Updates global variable Vis_Page                 *)
  22. (* ES:DI - Destination (to)   DS:SI - Source (from) *)
  23. (* Select Plane - Sequencer, Index 2                *)
  24. (* Select Write Mode - Graph, Index 5, bits 0 and 1 *)
  25.  const
  26.       SC_Index            = $3C4;
  27.       Plane_Select        =  $02;
  28.       All_4_Planes        =  $0F;  (* turn on all 4 planes *)
  29.       Graph_Index         = $3CE;
  30.       Write_Mode_Index    =  $05;
  31.       Latch_Write_Mode    =  $01;   (* latches - 32 bit *)
  32.   Asm
  33.      push es  (* forget this and get runtime error -1 *)
  34.      push ds
  35.  
  36.  @@Set_Address:
  37.      mov ax,Screen_Offset
  38.      mov ds,ax
  39.      mov es,ax
  40.  
  41.      mov di,Page_1_Offset
  42.      xor si,si
  43.  
  44.      (* Turn on all 4 planes *)
  45.      mov dx,SC_Index
  46.      mov al,Plane_Select
  47.      out dx,al
  48.      inc dx
  49.      mov al,All_4_Planes
  50.      out dx,al
  51.  
  52.      (* Set Write Mode 1 - latches *)
  53.      mov dx,Graph_Index
  54.      mov al,Write_Mode_Index
  55.      out dx,al
  56.      inc dx
  57.      mov al,Latch_Write_Mode
  58.      out dx,al
  59.  
  60.      (* Copy Data *)
  61.      mov cx,PlaneBytes  (* Bytes per line times height *)
  62.      rep movsb
  63.  
  64.      pop ds
  65.      pop es
  66.   End; (* asm *)
  67. (******************************************************************)
  68.