home *** CD-ROM | disk | FTP | other *** search
/ Really Useful CD 1 / ReallyUsefulCD1.iso / extras / progutils / _moddis / docs / changes23 < prev    next >
Encoding:
Text File  |  1991-11-16  |  12.5 KB  |  262 lines

  1. This file describes the changes from version 2 to version 3 of ModDis.
  2.  
  3. CONFIGURATION VARIABLES
  4. =======================
  5. There are now six logical variables in PROCinit which the user can change
  6. to suit his own preferences. All are TRUE by default. They are:
  7.  
  8. debug%        If TRUE debugging information is displayed in cyan while
  9.               the program is running. This is useful for keeping an eye
  10.               on where the program has got to.
  11. flop%         If TRUE floating point instructions are recognised and
  12.               disassembled using the FNflop macro, otherwise floating
  13.               point instructions are rejected as coprocessor instructions.
  14. verbose%      If TRUE full output is enabled while Script files are being
  15.               replayed. This displays the full prompts and responses.If you
  16.               are re-creating a particularly large Source file from its
  17.               Script you may like to set verbose% to FALSE to speed up the
  18.               process.
  19. guessalign%   If TRUE alignment-byte guessing is enabled
  20. guessbratab%  If TRUE branch-table guessing is enabled
  21. guessldrstr%  If TRUE load/store double guessing is enabled
  22.  
  23.  
  24. FLOATING POINT MNEMONICS
  25. ========================
  26. The program will now disassemble floating-point instructions using a macro
  27. FNflop. This is accessed by a LIBRARY call which is built into every source
  28. file generated by ModDis. Also enabled are assembler directives FNequfs,
  29. FNequfd, FNequfe and FNequfp which store floating-point numbers to single,
  30. double, extended precision and packed decimal respectively. These directives
  31. are used by the program in response to LDF and STF instructions.
  32.  
  33.  
  34. EXTERNAL PROCEDURES
  35. ===================
  36. In version 2 of ModDis, the user was allowed to define to procedures
  37. (PROCexternal and PROCdisexternal) to allow the program to deal with unusual
  38. situations. These have now been moved outside the program and are stored in
  39. a file in the Externals directory, which is accessed via a LIBRARY statement
  40. in ModDis. The default file (Externals.Default) consists of two empty
  41. procedures, namely:
  42.  
  43.     DEFPROCdisexternal
  44.     ENDPROC
  45.  
  46.     DEFPROCexternal
  47.     ENDPROC
  48.  
  49. PROCexternal is called once before the analysis of the module begins.
  50. PROCdisexternal is called during the final phase when the assembly listing
  51. is being spooled to file whenever a type 7 (external) is encountered. For
  52. example, if,say, a Sprite file of length &100 bytes is embedded in a module
  53. at offset &1234 then the user might create the following External file:
  54.  
  55.     DEFPROCdisexternal
  56.     PRINT"]"
  57.     PRINT"OSCLI""Load SpriteFile ""+STR$~(O%)"
  58.     PRINT"O%+=&100"
  59.     PRINT"P%+=&100"
  60.     PRINT"[OPT pass%"
  61.     offset%+=&100
  62.     ENDPROC
  63.  
  64.     DEFPROCexternal
  65.     FORoffset%=&1234TO&1333
  66.       type%(offset%)=7
  67.     NEXT
  68.     ENDPROC
  69.  
  70. In PROCexternal all the bytes corresponding to the Sprite file are set to
  71. type 7 (external) at the start of the program. When the disassembly proper
  72. comes across the first type 7 byte it calls PROCdisexternal. This prints the
  73. appropriate messages to exit the assembler, load the Sprite file at the
  74. assembler pointer O%, increment both O% and P% and re-enter the assembler.
  75. Finally it increments the ModDis pointer offset%.
  76.  
  77.  
  78. SCRIPT FILE FORMAT
  79. ==================
  80. The Script file format has been extensively revised. The format is now a
  81. series of blocks like this:
  82.  
  83. begin keyword
  84. ...
  85. ...
  86. ...
  87. end
  88.  
  89. A line starting with the word "begin" marks the beginning of a block and a
  90. line consisting only of the word "end" marks the end. There can be any
  91. number of lines between the begin and end, although most blocks use only
  92. one. The order of the blocks is not important, except that the responses
  93. block must come last. The keywords currently recognised are as follows:
  94.  
  95.     KEYWORD      MEANING
  96.  
  97.     version      The version number of ModDis used to produce the script file.
  98.                  eg ModDis 3.04. This information is placed in the Script
  99.                  file by ModDis when it's created, and is used to make sure
  100.                  that the Script file is compatible with the version of the
  101.                  program in use.
  102.  
  103.     module       The name and version number of the module eg
  104.                      SpriteUtils  1.04 (22 Jul 1988)
  105.                  This is placed in the Script file by ModDis when it's
  106.                  created and is used to make sure that the Script file
  107.                  refers to the same module.
  108.  
  109.     nonreturn    The number of subroutines which modify their return address
  110.                  in some way, followed by the offsets of these subroutines.
  111.                  In most cases this will simply be a single zero. It is
  112.                  intended to cope with things like this:
  113.                      BL   s1234
  114.                      EQUS "Hello world"
  115.                      ....
  116.                  where the subroutine at offset 1234 does not return to
  117.                  execute the following instruction. To cope with this, the
  118.                  user would enter 1,1234 in the nonreturn block, meaning one
  119.                  subroutine at offset &1234. Note that ModDis does not
  120.                  automatically recognise these cases - it's up to you to spot
  121.                  them and modify the Script file manually to cope with them.
  122.  
  123.     external     The name of the BASIC file in the Externals directory which
  124.                  contains the external procedures used for this module. The
  125.                  default is "Default", which uses a file with empty
  126.                  procedures. If you want to use the external facility you
  127.                  should write your own external routines, store them in a file
  128.                  in the Externals directory and edit this block to contain
  129.                  the name of your External file.
  130.  
  131.     responses    The user responses, written as 3 numbers separated by
  132.                  commas. They consist of the offset in hex, the type of data
  133.                  at this offset and the number of items. For example,
  134.                  1240,-1,1 would mean one zero-terminated string at offset
  135.                  &1240. At present the responses block must be the last one
  136.                  in the Script file, and is not terminated by an "end". This
  137.                  may change in the future .
  138.  
  139. If you try to run this version with a Script file from version 2 it will
  140. display an error message and stop, but will write a file called "Header"
  141. into the current directory. You can simply paste this header into your old
  142. Script file to bring it up to version 3 standard. (Note: A few people have
  143. pre-release copies of version 3. If you are one of these, you should delete
  144. the first 2 lines of the Script file before adding the new header)
  145.  
  146.  
  147. TYPE GUESSING
  148. =============
  149. Version 3 of ModDis includes "guessing" for the first time. If it
  150. encounters some bytes of unknown type and there is no entry in the Script
  151. file the program applies some simple rules to try to establish what their
  152. type is before asking the user for help. At the moment there are three types
  153. of guessing:
  154.  
  155.     Alignment bytes    If the program is not on a word boundary, and all the
  156.                        bytes to the word boundary are zero then it guesses
  157.                        that these are alignment bytes. This action is
  158.                        controlled by the variable guessalign% - it takes
  159.                        place if the variable is TRUE
  160.  
  161.     Branch tables      If the program is on a word boundary and both this
  162.                        instruction and the previous one are unconditional
  163.                        branches then it guesses that this is part if a
  164.                        branch table. This action is controlled by the
  165.                        variable guessbratab% - it takes place if the
  166.                        variable is TRUE.
  167.  
  168.     Load/store word    If the program is at a load/store register
  169.                        instruction, then the location loaded from/stored to
  170.                        is guessed to be a double. This action is controlled
  171.                        by the variable guessldrstr% - it takes place if the
  172.                        variable is TRUE.
  173.  
  174. These three types of guessing were chosen initially because they were easy
  175. to implement and because they give very good results in practice. In most
  176. cases the amount of user interaction (and hence the size of the Script file)
  177. is reduced by about 30% and in extreme cases by as much as 60%. In the case
  178. of some very short modules guessing allows disassembly to be completed with
  179. no user intervention at all. The branch table guessing is particularly
  180. welcome since the old recognition routines never worked particularly well,
  181. and it was very tedious to be forced to single-step through a long table
  182. when it was perfectly obvious what it was.
  183.  
  184. There is, however, a penalty to be paid in that the guesses may sometimes
  185. not be what you would have chosen. For instance, it is common for certain
  186. strings (like TASK) to be stored as a double, but if it is accessed by an
  187. LDR then guessing will disassemble it as a double rather than a string.
  188. Also, guessing alignment bytes will only work if the original programmer has
  189. taken the trouble to initialise his workspace to zeros when the original
  190. module was assembled. If there are any garbage bytes showing through
  191. guessing will fail to recognise them alignment bytes.
  192.  
  193. Note that the program always checks the Script file first before resorting
  194. to guessing, so if you find that it's guessing wrong in one particular case
  195. you can manually add this one case to the Script file and leave guessing
  196. enabled for the rest of the module. If you find the program is guessing
  197. consistently wrong you should disable guessing and carry on as normal.
  198.  
  199.  
  200. CONFLICTS
  201. =========
  202. Previous version did not deal with conflicts very well. If the program
  203. identified a byte as one type and then found it was already marked as
  204. another it simply stopped the program with an error message like "Expecting
  205. type n at nnnn". This version has improved things slightly, and now offers
  206. the prompt "[A]dvance, [R]etreat, [S]top ?" when a conflict arises. Pressing
  207. "A" means go ahead and overwrite the old type with the new one. "R" means
  208. back off and leave things as they are while "S" means stop the program while
  209. you figure out what's happening.
  210.  
  211.  
  212. SYSTEM VARIABLES
  213. ================
  214. ModDis now stores the current filename in a system variable called
  215. ModDis$File. When prompted for a filename you can just press Return and
  216. ModDis will look up the system variable and use it as a filename. This
  217. system variable is also used by the Checker program if you don't give it a
  218. filename. The idea is that if you need to exit ModDis to edit the Script
  219. file manually, you can restart easily. Obviously the system variable is
  220. created the first time ModDis is run and is lost if the computer is reset
  221. so you must supply a filename at least once at the start of the ModDis
  222. session.
  223.  
  224.  
  225. COMMENTS
  226. ========
  227. Comments can now be placed in the Script file, but only in the responses
  228. block at the moment. Putting a ! as the first character on a line will cause
  229. that line to be ignored by the program. I only added this feature so that I
  230. could experiment with removing certain responses from the Script file to see
  231. if the guessing routines could cope without them, so it will probably be of
  232. limited use to the user.
  233.  
  234.  
  235. OTHER MINOR CHANGES
  236. ===================
  237. There have been many other minor changes to ModDis, mainly correcting
  238. various bugs. For instance, version 2.01 incorrectly treated a conditional
  239. OS_Exit as an end-of-code, while ADD PC and SUB PC instructions were not.
  240. These and various other changes mean that Script files which worked with
  241. version 2 may no longer contain enough information to disassemble a module,
  242. and you may find yourself answering one or two extra questions. Similarly,
  243. the new guessing routines may render information already in the Script file
  244. unnecessary, but this will not impair the program's operation.
  245.  
  246. The program now checks the validity of your responses, so that it refuses
  247. type 3, 4 or 5 if it is not on a word boundary, and refuses type 2 if it is
  248. not on an even address. If your Script file contains invalid responses of
  249. this kind ModDis will get stuck in an infinite loop - the only solution is
  250. to edit the Script file to correct or remove the offending response.
  251.  
  252. Version 2 allowed labels to run into the assembler listing if they were
  253. exactly 19 characters long, and the comment field sometimes contained
  254. characters which confused the BASIC assembler. Both these problems have now
  255. been fixed.
  256.  
  257. A bug which occasionally caused ADR to appear with no operand was finally
  258. tracked down and cured. OS_GenerateError is now recognised as end-of-code.
  259.  
  260. Handling of the SWI-table is improved. It can now cope with tables with more
  261. branches than names, branch tables split into two by other code, etc.
  262.