READ_ME 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. # $Id$
  2. This directory contains two programs:
  3. mkswitch:
  4. C program, necessary for regenerating the giant switch
  5. needed for the disassembly function of the interpreter,
  6. which (still) works with Operand access method 2
  7. (Intelligent Routines) as described in "The EM
  8. interpreter".
  9. mkiswitch:
  10. C program, necessary for regenerating the giant switch
  11. needed for finding the correct instruction handling routine
  12. for each opcode. It works with Operand access method 3
  13. (Intelligent Calls) as described in "The EM interpreter".
  14. It constructs the operand of the instruction and passes
  15. it to the appropriate routine with the operand as
  16. argument.
  17. The first program reads an input file which holds the interpreter
  18. opcode table (as shown in the [IR-81] report appendix B),
  19. and creates an output file which contains an enormous switch
  20. file. This switch has entries for each possible opcode. It's
  21. possible to supply a third filename, which is the name of file
  22. where all functions will be stored. This is necessary if a new
  23. function implementation is needed.
  24. The first argument to mkswitch is the prefix to be used in the
  25. generated function names. For the interpreter proper this prefix
  26. is Do.
  27. The input file contains lines in the following format:
  28. Mnemonic Flags Count First-number
  29. The created switch file will contain a switch, with each case
  30. having one of the following formats (? is the opcode):
  31. 1) case ?: DoAz();
  32. 2) case ?: DoBm(val);
  33. 3) case ?: DoCs(hob, wsize);
  34. 4) case ?: DoDXY(wsize);
  35. Ad 1) This format shows that the corresponding opcode does not
  36. have an argument. Often the operand is popped from the
  37. stack.
  38. e.g. DoNOPz(), this performs the NOP instruction.
  39. Ad 2) This is the format for a mini. There is one implicit
  40. argument (I) .
  41. e.g. DoLOCm(1), this is the LOC 1 instruction.
  42. Ad 3) This format corresponds with a shortie. There is an implicit
  43. argument (high order byte), and a one byte text argument
  44. (low order byte). W equals 'wsize' (if a word multiple),
  45. otherwise it equals '1'. H is the value of the high
  46. order byte.
  47. e.g. DoLOEs(2, wsize), these are all LOE instructions,
  48. with all addresses in the range:
  49. (512 * wordsize) . . (767 * wordsize).
  50. Ad 4) This format is used for opcodes with 2 or more text arguments,
  51. and no implicit arguments. There are 6 types:
  52. XY = l2: two byte negative or positive text argument.
  53. XY = n2: two byte negative text argument.
  54. XY = p2: two byte positive text argument.
  55. XY = l4: four byte negative or positive text argument.
  56. XY = n4: four byte negative text argument.
  57. XY = p4: four byte positive text argument.
  58. W equals 'wsize' (if a word multiple), otherwise it equals 1.
  59. e.g. DoLDLp2(wsize), these are all LDL instructions, with
  60. negative local offsets, which are word multiples.
  61. When two file arguments are given to mkswitch (input file and output file),
  62. only the switch is generated. If an additional third file name is
  63. given (another output file), this file is filled with all function
  64. calls in such a manner that mkfuncs will generate new function files.
  65. Mkfuncs expects two arguments, an input file generated by
  66. mkswitch and the name of a directory where the new function
  67. files are stored. These files (15) each represent one group (as
  68. proposed in [IR-81] sec 11.3) of instructions. Each file will
  69. contain all functions needed to implement that specific group
  70. of instructions. The functions will only contain a logging
  71. message, and a call to newPC() which is necessary to skip the
  72. arguments. The names of the generated files are: do_XXX.c, where
  73. XXX is the name of the corresponding instruction group.
  74. (Note: these remarks about mkfuncs are probably outdated now,
  75. since mkfuncs has disappeared. -rbf)