home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / lang / pascal / 7705 < prev    next >
Encoding:
Internet Message Format  |  1992-12-29  |  3.5 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: comp.lang.pascal
  4. Subject: Setting Watches
  5. Message-ID: <85895@ut-emx.uucp>
  6. Date: 28 Dec 92 22:56:18 GMT
  7. Sender: news@ut-emx.uucp
  8. Organization: The University of Texas at Austin, Austin TX
  9. Lines: 98
  10.  
  11.  
  12.     I have written some code to copy everything from 
  13. page 0 to page 1 in ega mode. I'm trying to use assembler
  14. under the venerable 6.0. But it doesn't work and i can't debug
  15. it.
  16.     I have set it's constant and variables in the procedure.
  17. When i do, i can't watch any of these variables - the watch 
  18. windows claims it doesn't know the symbol (below, CurrentPlane,
  19. Page_1_Offset, ScreenHeight&Width, PlaneWords).
  20.     When i move it out of the procedure to global constants
  21. the procedure can't change the constants variables
  22. (constants defined CurrentPlane : word = 8 ), even though the
  23. watch window claims the variable was changed.
  24.     I also think i'm getting the wrong value for tracing
  25. registers. While watching/tracing this statement
  26.     mov di,8000
  27. I can see di = 65,535. Later (after the movsw which affects di)
  28. di claims to be 8,000 then 16,000 as the code goes on.
  29.     The code doesn't properly work. It should copy
  30. all of plane 3 to plane 3 on page 2, plane 2 to plane 2, etc.
  31. If i define CurrentPlane as CurrentPlane : byte = 8, 
  32. nothing happens, and the trace claims that 
  33.     shr CurrentPlane,1   currentplane=8 after, no matter
  34. how often i do this. Page 2 doesn't change at all. If i 
  35. define CurrentPlane as var CurrentPlane : byte then
  36. something radically different happens - any color with 
  37. bit 0 set (like blue, gray, magenta) copies over, but shows as
  38. white, so solid blue bars will show on page 2 as a solid white bar.
  39.     Why does this occur from simply defining a variable 
  40. different (const CP : byte = 8 vs. var CP : byte    mov CP,8)?
  41.     My assembler manual doesn't say too much or i'm
  42. just looking on the wrong pages, but i can't get this to work
  43. and i can't seem to properly trace and watch this.
  44.  
  45.     If anyone can give me some insight as to why position
  46. and definition of variables affects performance and watches, 
  47. please let me know. It's hard to fix without my poor debugger :(
  48.  
  49.  
  50. Procedure Copy_Page; assembler;
  51. (* Updates global variable Vis_Page                 *)
  52. (* ES:DI - Destination (to)   DS:SI - Source (from) *)
  53. (* CX    - Plane Loop         CX    - Row Loop      *)
  54.  const
  55.       ScreenWidth          = 320;
  56.       ScreenHeight         = 200;
  57.  
  58.       Sequencer_Index      = $3C4;
  59.       Color_Plane_Index    = $02;
  60.       CurrentPlane : byte  = 8;
  61.  
  62.       Screen_Offset        = $0A000;
  63.       ScreenBytes          = ScreenWidth div 8; (* Bytes per scanline *)
  64.       PlaneBytes           = ScreenBytes*ScreenHeight;
  65.       PlaneWords           = PlaneBytes div 2;
  66.       Page_1_Offset        = ScreenBytes*ScreenHeight;
  67. (* var
  68.     CurrentPlane : byte;*)
  69.   Asm
  70.      push ds
  71.      push es
  72.  
  73.      cld
  74.  
  75.      mov  CurrentPlane,8
  76.      mov  cx,4   (* Num Planes *)
  77.  
  78.      mov ax,Screen_Offset
  79.      mov ds,ax
  80.  
  81.      mov ax,Screen_Offset
  82.      mov es,ax
  83.  
  84.  @@Set_Address:
  85.      mov di,Page_1_Offset
  86.      xor si,si
  87.  
  88.      @@Plane_Loop:
  89.          push cx           (* Save Plane Number *)
  90.  
  91.          mov dx,Sequencer_Index    (* set plane *)
  92.          mov al,Color_Plane_Index
  93.          out dx,al
  94.          inc dx
  95.          mov al,CurrentPlane
  96.          out dx,al
  97.  
  98.          mov cx,PlaneWords  (* copy that plane *)
  99.          rep movsw
  100.  
  101.          shr CurrentPlane,1    (* next plane *)
  102.          pop cx                (* set cx back to planes *)
  103.  
  104.          loop @@Set_Address
  105.  
  106.      pop es
  107.      pop ds
  108.   End;
  109.