


HatStand is a Sinclair ZX Spectrum emulator for PC. It emulates the '16k' Spectrum, which had a ZiLog Z80 processor unit, and a 16-color (i.e. 4-bit) 256x192 screen. (To be precise, there are only 15 colors on the Speccy, as Bright Black, effectively color 8, displays as Black, color 0) As for peripherals, details will be forthcoming as development progresses (I haven't even finished coding for the 200 or so opcodes yet...); I have already (partially) implemented the keyboard, though I can't test it out yet as my under-construction Z80core hits a problem before getting to the ZX Basic interpreter.
FQAs (Frequently Questionable Answers)
So why's it called HatStand?
Well, the idea of writing a Spectrum emulator in BASIC is a bit mad, and the expression 'hatstand' is used on the newsgroup comp.sys.sinclair (a focus of Spectrum-related activity) to mean loopy in a totally bananas sort of a way.How fast does it run?
At the moment, not fast. Only about 200kilo-instructions-per-second, which is equivalent to at least 800kHz (the real thing is clocked at 3.5MHz so that's about 20% speed). To measure it accurately in Hz, I will need to implement counting of opcode cycle length. I also intend to implement Memory Refresh cycles (the R register). I expect it will turn out to be doing less than 1MHz. But then, BASIC isn't built for speed... With various tricks, I might be able to speed it up to around 2MHz, but I doubt if I'll get as far as real-time (i.e. 3.5MHz).What does it look like at the moment?
Well, here are some screenshots. Click to enlarge.What's the Sinclair Spectrum then?
![]()
newest←← →→oldest
The above were all taken on hitting an unimplemented opcode. Until this occurs, the debugger does not appear (only the screen & speed are shown)
Quite simply the best home computer of all time - released in the early 1980s, it was the first computer to be priced under $100, and with 16k of RAM (upgrades to 48k were available), a 3.5MHz processor (quite fast for the era), and a built-in version of BASIC (those were the days, when computers had programming languages built-in), it led the UK computer market for many years (progressing to a 128k model with a 3-inch Amstrad floppy drive), and is still fondly remembered today. (Sadly the Spectrum never really took off in the USA, where the main rival was the Commodore 64)When's this project going to be available?
There were, of course, problems - chief source of criticism was the 'rubber keyboard' (membrane), which was brittle and practically impossible to repair - but most of those who knew it then are still fond of it now.
For more information on Sinclair computers and their history, visit World of Spectrum, a great site run by a guy called Martijn van der Heide (I gather he's Dutch).
Tough question that, for a start the answer might be 'never'. I've recently been having incidents where the compiler has been running out of memory. It's temporarily fixed, but although I have ideas for long-term solutions, they may not be sufficient.There are already loads of emulators, and they're probably (Certainly - Ed.) better. What's the point of this project?
Another problem is that at least one of the opcodes is broken at the moment, and I don't know which one (all I know is that a flashing ? cursor appears immediately to the right of the © 1982 Sinclair Research Ltd message; I need to find out why this is happening. I think the problem is somewhere in the RST 38h procedure called on every interrupt, but it might not be).
Assuming it does ever work alright, we're looking at something like summer 2008 at the earliest, and that will be very rudimentary. Development will most likely continue for some months after that.
Oh, and as always, it'll be free. (It'll be open-source too)
I got bored ;-)Can I see the source code?
Basically, I was leafing through a book on Z80 machine code (thinking of learning it), when I had the idea of doing an emulator. I quickly realised that if I didn't do it, I'd be wishing I had done for months. So I got to work. A fortnight or so later and I'd got further than I would've expected to, but even now, months on, there's a lot of opcodes still to program in. But on the plus side, I've just got hold of a list of all the opcodes with notes, time in cycles, R register cycles, and effect on flags. So in theory all the info I need is there, it's just a question of hard work, graft, and elbow-grease. Oh, and I've already implemented LDIR and LDDR, the opcodes that put the Z80 a league ahead of its rivals.
Sure. It's here.THIS PAGE LAST UPDATED: Friday 2nd November 2007.