🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: rec.games.programmer
Article #1650

Copy whole EGA screens

#1650
From: Baylor
Date: Thu, 31 Dec 1992 17:54
58 lines
1994 bytes
	Ok, my code to copy EGA screens from one page to another
finally works. Thanks to all those people who asked why some idiot
would try direct moves when he could use Latched Moves, which of 
course solved the problem.
	Included is the code to copy from page 0 to 1 for both the
people possibly interested (EGA, like the good old days)


(******************************************************************)
Procedure Copy_Page; assembler;
(* Updates global variable Vis_Page                 *)
(* ES:DI - Destination (to)   DS:SI - Source (from) *)
(* Select Plane - Sequencer, Index 2                *)
(* Select Write Mode - Graph, Index 5, bits 0 and 1 *)
 const
      SC_Index            = $3C4;
      Plane_Select        =  $02;
      All_4_Planes        =  $0F;  (* turn on all 4 planes *)
      Graph_Index         = $3CE;
      Write_Mode_Index    =  $05;
      Latch_Write_Mode    =  $01;   (* latches - 32 bit *)
  Asm
     push es  (* forget this and get runtime error -1 *)
     push ds

 @@Set_Address:
     mov ax,Screen_Offset
     mov ds,ax
     mov es,ax

     mov di,Page_1_Offset
     xor si,si

     (* Turn on all 4 planes *)
     mov dx,SC_Index
     mov al,Plane_Select
     out dx,al
     inc dx
     mov al,All_4_Planes
     out dx,al

     (* Set Write Mode 1 - latches *)
     mov dx,Graph_Index
     mov al,Write_Mode_Index
     out dx,al
     inc dx
     mov al,Latch_Write_Mode
     out dx,al

     (* Copy Data *)
     mov cx,PlaneBytes  (* Bytes per line times height *)
     rep movsb

     pop ds
     pop es
  End; (* asm *)
(******************************************************************)
Technical Details
Message-ID: <85999@ut-emx.uucp>
Path: arc1-ca.pugleaf.net!sparky!uunet!think.com!yale.edu!qt.cs.utexas.edu!cs.utexas.edu!ut-emx!ccwf.cc.utexas.edu

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!think.com!yale.edu!qt.cs.utexas.edu!cs.utexas.edu!ut-emx!ccwf.cc.utexas.edu
From: baylor@ccwf.cc.utexas.edu (Baylor)
Newsgroups: rec.games.programmer
Subject: Copy whole EGA screens
Message-ID: <85999@ut-emx.uucp>
Date: 31 Dec 92 17:54:05 GMT
Sender: news@ut-emx.uucp
Lines: 58