Source code translation

We have uploaded demonstrations of automatic translation of  games coded in BASIC to HTML5 and JavaScript.
This work was was carried out by Craig Harrington until his sudden death (7 October 2014) and some final touches were made by Demi Gao.

The use of software migration as an alternative technique to emulators to provide access to legacy titles is uncommon, however may offer some benefit. Migration may circumvent some problems that occur with using an emulator, by translating the legacy operating system library calls to a modern equivalent providing similar functionality.

The Commodore VIC-20 system was chosen as the legacy platform of interest due to its relative simplicity and similarity to the more popular Commodore 64 platform. The version of the BASIC programming language used in each machine is identical.
A prototype system for migration was constructed in Javascript, containing enough functionality to allow for the execution of BASIC programs. An HTML5 Canvas element provides a mechanism for character graphics to be displayed which were obtained by examining the data from a read-only memory (ROM) dump of the original machine. A Javascript function library provides equivalents to various BASIC statements. Initially, the functions were tested by manually translating the legacy code from its original form to Javascript. Overall, the Javascript functions aim to replicate the functionality of the various BASIC statements but some differences are unavoidable. For example, keyboard input is event-driven in the browser environment rather than polled continuously, as in the original hardware (or an emulator). A parser and lexer for Commodore BASIC V2 was constructed using the Python scripting language by extending an existing Dartmouth BASIC interpreter which was included as an example with the PLY lexer and parser package (Beazley, 2001). This involved adding in support for additional keywords, relational operators and also string and integer data types. Sound capabilities have yet to be implemented.

Content on this site is licensed under a Creative Commons 3.0 licence