Path: utzoo!news-server.csri.toronto.edu!rutgers!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!think.com!linus!linus!linus!mbunix!eachus From: eachus@aries.mitre.org (Robert I. Eachus) Newsgroups: comp.sys.amiga.emulations Subject: Re: Emulator Mechanics (sorry long post) Message-ID: Date: 12 Mar 91 23:23:37 GMT References: <4992@mindlink.UUCP> <1991Mar6.010141.5905@mintaka.lcs.mit.edu> <1303@macuni.mqcc.mq.oz> <39935@cup.portal.com> <10775@dog.ee.lbl.gov> <40036@cup.portal.com> Sender: news@linus.mitre.org (News Service) Distribution: na Organization: The Mitre Corp., Bedford, MA. Lines: 47 In-Reply-To: Radagast@cup.portal.com's message of 12 Mar 91 02:53:43 GMT Nntp-Posting-Host: aries.mitre.org A couple of shortcuts which may make things a lot easier (if anyone really wants to do another 8088 emulator, going for speed at the cost of memory. (Why not! I have 9 Meg. :-) First allocate emulated code memory as a 4*640K (or smaller) array of FAST memory, keeping the original Intel image in another 640K array. Write a call to the emulator/translator (ET) routine on every 8 byte boundary (corresponding to every 16-bit boundary in the Intel image) in the emulation memory padded with NOPs if needed. When an Intel instruction is to be executed, branch to the location (relative to the base of the array) times four. If this results in a call to the ET routine it will look at the stack to get the right address, then look at the the Intel image to figure out what to do. For instructions which can be translated into a four word 68K sequence (possibly including NOPs and or branches) write the code over the call, otherwise put in a branch or call to an out of line routine. Keep data in the Intel image, doing byte swaps when loading where necessary. (Rememeber, do this right and the SWABs will be no cost in most cases.) Stores should automatically overwrite the corresponding emulator location with a call to ET. (Remember to map the overwrites for byte writes to the correct word.) With a strategy like this (and unfortunately, both data and instruction caches off), I think you could get a 25MHz 68030 well above XT speed if you do a good job of coding the ROM emulation... Robert I. Eachus "The liberty of the press is not confined to newspapers and periodicals. It necessarily embraces pamphlets and leaflets....The press in its historical connotation comprehends every sort of publication which affords a vehicle of information and opinion." --Lowell v. City of Griffin, 303 U.S. 444, 452 (1938) -- Robert I. Eachus "As far as Saddam Hussein being a great military strategist, he is neither a strategist, nor is he schooled in the operational arts, nor is he a tactician, nor is he a general, nor is he as a soldier... Other than that he's a great military man. I want you to know that." -- Gen. H. Norman Schwarzkopf, Saudia Arabia, Feb. 27, 1991