#define (from C) in Python

garabik-news-2005-05 at kassiopeia.juls.savba.sk garabik-news-2005-05 at kassiopeia.juls.savba.sk
Sun Nov 15 10:59:53 CET 2009


Santiago Romero <sromero at gmail.com> wrote:
>> Hey, I got 100% with ASM ZX Spectrum emulator on a low end 386 :-) (I do
>> not remember the CPU freqeuncy anymore, maybe 25MHz).
> 
> Yes, in ASM a simple 25 or 33Mhz 386 computer was able to emulate
> the
> Spectrum. At least, under MSDOS, like did Warajevo, Z80, x128 and
> "Spectrum"
> from Pedro Gimeno.

And my very own, (sadly, rather little known at the time) 'Nuclear ZX'
:-) It did not use a dispatch table - rather, each Z80 instruction was
taken as a high byte of the pointer to a 64KB block of 8086 code, low
byte being zero for unprefixed instructions or a given value for
prefixed ones. This approach saved one lookup (several cycles) and one
indirect jump (another several cycles) per instruction. Another
optimization would be to unroll the return jump from each of the
emulated instructions and replace it directly with inline
read-the-next-instruction-and-jump-there code, but I never got around to
that (would save one 8086 jump per one Z80 instruction :-))

 
>> http://perl-spectrum.sourceforge.net/
>>
>> It is quite fast IMHO.
> 
> It does not run 100% in my 1.8Ghz centrino computer :-(, but almost.
> At least, is a good start to see that is possible, at least no current
> DualCore computers :-)

Python IS slower than perl, especially since you are dealing with
objects. However, I'd suggest go the cPickle route - have a Z80Cpu
module, and its C equivalent, cZ80, and use that one if available. This
way, the emulator will be actually usable everywhere.


-- 
 -----------------------------------------------------------
| Radovan Garabík http://kassiopeia.juls.savba.sk/~garabik/ |
| __..--^^^--..__    garabik @ kassiopeia.juls.savba.sk     |
 -----------------------------------------------------------
Antivirus alert: file .signature infected by signature virus.
Hi! I'm a signature virus! Copy me into your signature file to help me spread!



More information about the Python-list mailing list