home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 029.lha / BlitLab / README < prev    next >
Text File  |  1987-04-02  |  8KB  |  146 lines

  1. BlitLab 1.1                        17 April 1987
  2.  
  3.     BlitLab is a program which lets you experiment with the blitter
  4. to your hearts content, in relative safety.  It opens up a workbench
  5. window with gadgets for all of the registers of the blitter, and allows
  6. you to manipulate individual registers and perform blits on a magnified
  7. bitmap.  This documentation is sketchy, but it probably won't get much
  8. better.
  9.  
  10.     This program was written for a blitter presentation at the
  11. BADGE meeting of 16 April 1987, and it met with such approval that I
  12. decided to make it available over the net.  I wrote it for Manx C using
  13. 16 bit ints.  It should port to Lattice with a minimum of effort.
  14.  
  15.     The code itself may turn out to be interesting.  I wrote the
  16. entire program in two days, but I tried to keep things clean and
  17. modular.  Any comments on the code, either positive or constructive
  18. criticism, is welcome.
  19.  
  20.     On to the program.  I'm going to describe operation of the
  21. program starting in the upper left hand corner and proceeding across
  22. and down.  I will not describe the operation of the blitter.
  23.  
  24.     The large dark area in the upper left is the bit map we are
  25. going to play with.  It has a width of 96 bits, or 12 bytes, or 6
  26. words.  It has a height of 32 rows.  Remember these numbers well.
  27. You can draw in this area with the mouse and the two gadgets in the
  28. upper right.  The topmost gadget is the Point/Box gadget.  When set
  29. to point, you can draw individual pixels on the screen by clicking on
  30. the pixels with the select button.  When set to box, you can draw a
  31. filled rectangle by clicking on the upper left hand pixel of the box you
  32. wish to draw with the select button, dragging the mouse and releasing
  33. the select button over the lower left hand pixel.  The next gadget is
  34. the Clear/Set gadget, allowing you to clear or set points.  Note that
  35. this is not a paint program, and the interaction speed may not be as
  36. fast as you are used to; no apologies.  It was only intended to draw
  37. bits for the blitter.
  38.  
  39.     Below these two gadgets are two numbers.  The adrs number
  40. holds the address of the word the cursor is currently pointing at,
  41. relative to the beginning of the bit array.  (It is written as, for
  42. instance, M+382, which means the address of the array plus 382 bytes.)
  43. The shift value is the pixel, numbered from 0 at the left to 15 at the
  44. right.  With these values, you can point at a pixel to get its address
  45. to enter into a string gadget below.
  46.  
  47.     The Calc gadget looks at the values you have entered for the
  48. blitter, and determines if any memory other than the bit array will be
  49. modified.  If it will, it prints `Blit unsafe' on the title bar.  This
  50. is a sanity check to keep you from crashing the system.  Carefully check
  51. your values if this flag is on.  The fact that this gadget writes `Blit
  52. unsafe' does not necessarily mean that the blit will destroy memory
  53. outside of the array; careful use of a source operand and mask bits
  54. might not pass this test but would be perfectly okay.  I have
  55. allocated several extra rows above and below the bit array so minor
  56. errors shouldn't crash the system.  Currently line mode is not checked,
  57. so use it with care.
  58.  
  59.     The GO gadget performs the blit you have indicated.  After the
  60. blit, the results are updated in the magnified bit array rather slowly.
  61. It performs the same check performed by Calc before executing, and
  62. complains similarly.  You can override the complaint by clicking on the
  63. GO gadget again.
  64.  
  65.     Underneath the magnified bit map, on the left, are four gadgets
  66. labeled SX, SY, EX, and EY.  These bits get the starting and ending
  67. points for the line you wish to draw.  The X values should range from
  68. 0 to 95; the Y values from 0 to 31.  These are not checked.  Be aware
  69. that these are not blitter registers; they are simply values that the
  70. program will use in calculating the actual blitter register contents
  71. necessary for the line draw.
  72.  
  73.     The (line)/LINE gadget turns on line mode.  The Setup gadget
  74. takes the SX/SY/EX/EY values, and sets up most of the blitter registers
  75. to draw the line automatically.  It does not set up the function
  76. register, because there are different ways to draw lines.  For a solid
  77. line, use ~AC+A; for a textured line, use ~AC+AB; for an XOR line, use
  78. ~AC+A~C, for instance.  It does not perform the blit, however.  Note
  79. that if you want to draw a new line, you need to change the appropriate
  80. SX/SY/EX/EY values, then click Setup, then click GO.
  81.  
  82.     The next two gadgets, W and H, hold the size of the current
  83. blit.  The W value is in words, and the H value is in bytes.  Legal
  84. values range from 1-64 for W, and 1-1024 for H.  (Of course, the useful
  85. range within this program is much smaller.)
  86.  
  87.     Next to the H gadget are gadgets for the DESC, FCI, IFE, and
  88. EFE bits of the gadget.  These can get set or cleared by selecting them.
  89. Underneath these gadgets is the Function gadget.  In this gadget you
  90. enter the function you want to perform.  0 is clear all, 255 is set all,
  91. and other combinations can be entered directly as minterms.  For
  92. instance, the A~C+~CA presented earlier means exclusive or the A and C
  93. bits for the destination.
  94.  
  95.     The lower right hand corner contains the actual blitter registers
  96. and their values in hexadecimal.  These are the values that are fed to
  97. the blitter when you select GO.  As you enter new numbers into the string
  98. gadgets corresponding to blitter registers, these values will change to
  99. reflect the new values.  (Actually, they will only change if you hit
  100. carriage return after entering the numbers into the string gadget; if you
  101. simply select another gadget after entering data into a string gadget, the
  102. old value will stay displayed until you select CALC or GO.)  This can be
  103. used to calculate minterms, for instance.  Entering ABC+A~B~C+~AB~C+~A~BC
  104. into the Function gadget hitting return will put 96 in the least
  105. significant eight bits of CON0; this is the hexadecimal value reflecting
  106. the above minterms.
  107.  
  108.     At the lower right is a table of string gadgets.  Each row is for
  109. a single DMA channel.  The first column is the USE bit; is that channel
  110. on or off?  Y means on, N means off; selecting the gadget toggles it.  The
  111. next column contains the start address for DMA.  These numbers (as in the
  112. remaining string gadgets) can be entered in decimal, hexadecimal (preceded
  113. by a $), binary (preceded by a %), or as an offset from the start of the bit
  114. array (preceeded by M+).  M alone represents the beginning of the blit
  115. array.  The third column is the modulo value which is added to the DMA
  116. channel pointer at the end of each row; this value is in bytes and can be
  117. negative.  The fourth column is the data register; if a channel is turned
  118. off, its data register can be preloaded with a value, and then it functions
  119. as a constant.  For instance, to fill a block of memory with the value
  120. $E931, simply preload the A data register with this value, turn on only the
  121. D channel, and blit with the function A.  Finally, the last column is the
  122. amount to shift the A and B operands, to the right, before using them.
  123. Finally, in the lower left corner of the DMA channel box are string gadgets
  124. for AFWM and ALWM.
  125.  
  126.     This program has been tested fairly carefully.  Therefore, if the
  127. blitter appears to do something it shouldn't, you probably have set up the
  128. registers wrong.  Remember, the Amiga blitter is a word blitter, not a bit
  129. blitter.  It can be made to look like a bit blitter with some work.  It is
  130. possible, however, that errant blits can muck up some system memory, or
  131. some internal variable memory, so if things really seem awry, reboot and
  132. go back into the program.  Try the same values again, and see if they work
  133. this time.
  134.  
  135.     Blitter documentation is not included here currently.  Sometime
  136. in the next week I will finish my blitter documentation; that documentation
  137. will tell you more than you ever wanted to know about the blitter.  So,
  138. until then, I remain:
  139.  
  140. Tomas Rokicki
  141. Box 2081
  142. Stanford, CA  94305
  143. 723-1646 (office), 326-5312, -5681 (home)
  144. rokicki@sushi.stanford.edu
  145. ...lll-crg!decwrl!sushi.stanford.edu!rokicki
  146.