• Print

ZX81 Emulator written in Typescript 1.1


ZX81 Emulator written in Typescript

Sinclair ZX81

The Sinclair ZX81 was by first computer, in 1982. It is one of those home computers very popular in the '80s and affordable (£49.95 in kit). Other very popular computers were the Commodore 64 and the Apple II but were far more expensive. The successor of the ZX81 was the ZX Spectrum.


The ZX81 computer was based on a 8-bit processor (Z80A from Zilog or µPD780C from NEC) at 3.5 MHz with 1 KiB of RAM and 8 KiB of ROM. It was possible the buy a RAM extension (I had a 16 KiB one).

The characters set was not based on ASCII but was custom and includes only capital letters. It includes also some graphic characters:


Using these characters, it was possible to make some graphics but it was very limited (64x48). Using some tricks (and sometimes some hardware modifications), it was possible to achieve (more or less) 256x192 (more or less because it was not possible to get all pixel combinations per line).


I wanted to learn Typescript and thus, I was looking for a project not too small (not just an example), but also not too big. I find also interresting to explore the question of how to transform a Java applet into a pure HTML5/Javascript program.

I find a HTML5/Javascript ZX81 emulator made by Simon Holdsworth, but I found only a minification version, so it was not usable. However, on the same page, there is also a Java version. So I took this Java application as a starting point.


These are my objectives for this project:

  • Find a way to transform automatically Java code into Typescript. The Z80 emulation code is too big to be translated manually.
  • Use the latest version of Typescript but at the same time, be able to run on all major Internet browsers (i.e. be compatible with Javascript ECMAScript 5).
  • Use the latest version of Webpack.
  • Use Promisefetchasync and await syntax.

Current status

Currently, all the objectives are fullfiled except those:

  • There are still some Javascript code, in particular for Webpack configuration.
  • The keyboard does not always display properly on iPad.


I found one of my first applications: a game I build in 1985. Texts were in French and I have translated them in English.

It is written with a mix of BASIC (to display the menu, the rules of the game, etc) and Z80 assembly code (for the game itself).

Want to try the game and the emulator? It is available at the following address: www.andrivet.com/static/ZX81/:

Use q and a keys to move the left character, p and l to move the right one, and j to abandon. In the menu, if you choose item 5, you will exit the game and play with the ZX81 emulator. The original manual Sinclair ZX81 BASIC Programming is available.


Folder Description
Documents Contains some documents related to ZX81, such as the original manual Sinclair ZX81 BASIC Programming, the Z80 CPU User document, etc.
Emulator The Typescript emulator
Programs The FACTORY game in English, USINE in French and their sources in text format.


Version 1.1


  • Now compatible with Internet Explorer 11 (older versions not tested)






blog comments powered by Disqus