home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / sys / amiga / programmer / 7007 < prev    next >
Encoding:
Text File  |  1996-08-05  |  6.9 KB  |  138 lines

  1. Path: news.mountain.net!usenet
  2. From: gene_heskett@wvlink.mpl.com (Gene Heskett)
  3. Newsgroups: comp.sys.amiga.programmer
  4. Subject: PPC conversions
  5. Date: 07 Apr 96 15:34:42 +0500
  6. Organization: MountainNet, Inc. Morgantown WV 800.444.1458
  7. Message-ID: <6708.6671T934T2148@wvlink.mpl.com>
  8. NNTP-Posting-Host: slip4.mpl.com
  9. X-Newsreader: THOR 2.22 (Amiga;TCP/IP)
  10.  
  11. Hello Olaf, and ALL;
  12.  
  13. From time to time I read (in this group) that converting the Motorola
  14. object code to PPC object code would be impossible to do, and the
  15. quotation usually involves the difficulty of the calculation of a
  16. jump address when the jump is taken.
  17.  
  18. I dissagree, and I'm going to "waste some bandwidth" as they say:
  19.  
  20. While I am not the one to do it as I know relatively little about 68k
  21. code, and virtually nothing abpout PPC code, I do know a bit about
  22. object codes in general.  I came in on the cpu scene with the RCA
  23. 1802, which IMO is the *first* RISC chip, and wrote a program for it
  24. using nothing but the monitor rom in a Super Elf and the programmers
  25. manual that listed the nemonic and the hex as a crossref.  AFAIK that
  26. program is still in use today, on a several times a day basis.  I
  27. also have about that same level of experience on the Z-80, and now
  28. many years of coding for the 6x09 cpu's running various dialects of
  29. OS-9 and NitrOS-9.
  30.  
  31. I for one do not believe that such a translator/interpretor program
  32. is anywhere near as impossible as you state.  While my general
  33. overview of such a program is admittedly hazy at best, I don't see
  34. the location of a jump to take as anything but an exercise in record
  35. keeping by the interpretor program.
  36.  
  37. This "interpretor" should only need be run once for each program that
  38. needs to be converted as it should not only perform an emulator
  39. function, but should also keep track of the code it uses to allow the
  40. emulation to be done, storeing that emulation as the file to be run
  41. the next time the program being converted is executed.
  42.  
  43. I don't see this first time run as a very speedy operation, and it
  44. will probably need to *heavily* exercise a virtual memory manager and
  45. a few files on a gigabyte sized hard drive.
  46.  
  47. The jump/branch address problem? IMHO, simple. In the process of the
  48. translation, you know the address's first component already from the
  49. auto increment of the interpretors instruction pointer. If the
  50. interpretor kept a table of the next addresses after any RTS or RTI
  51. instructions, the hit rate of finding the calculated address to be
  52. one of those would be several percent right there. If a miss, then
  53. use the two addresses stored on each side of the target as the start
  54. and finish for a scan/re-interpret until the source pgm counter is
  55. matched.  Use that address as the pointer into a table to get the new
  56. address, calculate that emulation address by its actual position in
  57. the emulation, and store the new address data into the emulation
  58. file.
  59.  
  60. Or, imagine it this way.  Everytime the interpretor fetches a new
  61. instruction from the file being translated, the offset address its
  62. fetched from is stored in a table thats going to be 4x the size of
  63. the source cause every source byte needs a 4 byte address stored.
  64. Then when the interpretor has this instruction figured out, and knows
  65. where in the output file this translated code will live, this
  66. "translated" address is stored in the next 4 byte location.  This
  67. method would allow, once the code has been emulated *once before* the
  68. interpretor to simply use the old jump address as an entry address
  69. into the table, check the old address for a good match, and load the
  70. next long word above it as the output address to be written to the
  71. PPC object file.  If there is not a valid entry because the code
  72. hasn't been translated once before, then yet another table should
  73. have an entry made indicating that here is an address that needs
  74. resolution yet.  This table should be updated each time a new address
  75. question is resolved.
  76.  
  77. The data vs executable problem is handled the same way, and could
  78. even function as a method to remove code thats there, but which never
  79. execs because if its never accessed, then it shouldn't be there in
  80. the first place.  The ONLY exception to that rule would be the $VER
  81. string, which should be copied but modified to indicate its now PPC
  82. code.
  83.  
  84. The data storage requirement while its doing the
  85. emulation/translation/interpreting the first time is why I mentioned
  86. the virtual memory option. A 528k rom image could need a 2 pointer
  87. table entry for every byte in it. Not bloody likely of course, but
  88. possibly.  With the other tables needed to save stuff ala a linkage
  89. file, several megabytes might be needed *this one time*, but the end
  90. result should be a similarly sized file thats directly executable by
  91. the PPC.
  92.  
  93. The one problem I see with that would be the diffs in hardware
  94. addresses for device drivers. However, that only ups the complexity
  95. of the translators tables by one more lookup table, which given
  96. enough virtual memory and time, are solvable by the same general
  97. match and substitute when match found, maybe 6 lines of C for that.
  98.  
  99. Maybe I don't know what the heck I'm talking about, and as a 68k/PPC
  100. coder, I'd be a miserable failure.  But, I've been around long enough
  101. to have seen the farmer plant a few seeds.  My green thumb long ago
  102. got arthritic and has turned black and blue on more than one
  103. occasion, but thats what this tome is, the seeding of the fertile,
  104. much younger and hopefuly more agile than mine, minds I know are out
  105. here reading these newgroup carryings on.  Some of you waste a lot of
  106. bandwidth on arguments that are A: Old long before Grace Hopper
  107. found her first computer "bug", and B: Boring as hell to the rest of
  108. us actually looking for *usefull* information.
  109.  
  110. So I say, not just to Olaf B., and AT et all, but to ALL, quit
  111. mewling about it and do it!  If I, with an 8th grade education, can
  112. claim to have worked on some of the hardware that put John Glenn in
  113. orbit, to have worked on the construction of tv cameras that brought
  114. back the *first* pictures of blind fish from the bottom of the
  115. Marianas Trench, and I can truthfully claim just that, then I know
  116. very well there is somebody out there who can get this picky little
  117. job done, all you have to do is "get to it".
  118.  
  119. If, by the time such a translator has been written, I have managed to
  120. upgrade my machine to such a cpu, then here is my promise of a $50.00
  121. USD shareware fee for a copy of said program, payable to the author
  122. of first one that actually works.
  123.  
  124. Not some "won't save" crippleware demo, but a real, working, I can
  125. run its output on my PPC, working version.  So get to it, I file for
  126. social security and won't be able to afford it by 2001, or before if
  127. my health doesn't hold.  Right now its touch and go, I ate too much
  128. Easter dinner!
  129.  
  130. Cheers to Olaf, and to ALL!
  131.  
  132. /*            Gene Heskett          |  I need help, please see my adv. */
  133. /*  CE @ WDTV Weston/Clarksburg WV  |  in the newsgroup 'alt.tv.jobs'  */
  134. /*  <gene_heskett@wvlink.mpl.com>   |  We are an equal opportunity and */
  135. #include <std.disclaimer>           |  all that stuff employer.
  136.  
  137.  
  138.