

The other stack processor that caught my attention is James Bowman's J1 Forth processor.
Sweet16 wozniak code#
The other factor limiting ZPUino is that it executes code from the external RAM - and there is a time overhead in fetching instructions.ĭespite these limitations, the ZPUino has been a useful tool to run simulators, as it supports VGA hardware and the Adafruit Graphics library - allowing text and video output from an Arduino-like environment. However, porting C to a stack machine is never a very successful fit - as C prefers an architecture with lots of registers - such as ARM.Īs a result, the ZPUino, whilst clocked at 6 times the speed of the standard Arduino, only achieved about twice the performance when running a Dhrystone Benchmark test - written in C. The advantage of the ZPUino was that it was one of the few soft core processors that had GCC available, and so the task of porting the Arduino flavour of C++ to it was not over arduous (for those accustomed to that sort of task - not me!). I had become interested in an interpreted bytecode language that I believed would be a good fit for a stack machine, and so in order to get the ball rolling, I needed a virtual stack machine to try out the language.Įarlier this year, I invested in a Papilio Duo FPGA board, and with this came access to a ZPUino soft-core stack processor - devised and much enhanced from an existing design, by Alvie Lopez. Whilst Woz's Sweet 16 was a 16 bit register based machine, I had ideas more along the lines of a stack machine, because of it's simpler architecture and low hardware resource requirement. It is more than offset by the ability to design a processor with an instruction set that is hand-crafted for a particular application, or the means to explore different architectures and instruction sets, and to simulate these in software, before committing to FPGA hardware. The main limitations to the VM approach is that the execution speed is often one or two orders of magnitude slower than the host running native machine code, but with processsors now available with clock-speeds of 200MHz - this is not so much of a problem. I leave it to readers to explore further possibilities for SWEET16."
Sweet16 wozniak software#
I found this technique most useful for the implementation of much of the software of the Apple II computer. The idea of a low level interpretive processor can be fruitfully implemented for a number of purposes, and achieves a limited sort of machine independence for the interpretive execution strings. "And as a final thought, the ultimate modification for those who do not use the 6502 processor would be to implement a version of SWEET16 for some other microprocessor design.

One example was Steve Wozniak's "Sweet 16" - a 16 bit bytecode interpreter he wrote to run on the 6502, to allow the Apple II to readily perform 16 bit maths and 16 bit memory transfers. This post examines the role of a virtual machine, created to run on a given processor for the purpose of simulating another processor, for performing operations that the host processor might not readily do easily. Implementing a Stack Processor as a Virtual Machine BOB (above) can emulate a 16 bit minimal instruction set processor faster than the 25MHz ' 486 box - and for about $20! Now that's progress. The picture above is of my latest experimental pcb - a breakout board for the 216MHz STM32F746 ARM Cortex M7 microcontroller. Way back in 1991 when I was half the age I am now, I did my pcb design work using OrCAD on a 25MHz 486 desktop. BOB is no slouch when it comes to simulating a virtual stack cpu!
