Posted in 2020

3.7.0 Release: BASIC

Click here to program BASIC in the 8bitworkshop IDE now!

Dartmouth professors John G. Kemeny and Thomas E. Kurtz had the idea that every student should have access to a computer. But in those days, batch processing was the law of the land. Programmers would fill out a coding sheet, then a keypunch operator would create a deck of punch cards. The cards were fed into machines, and hours later you might receive results from your program – or if you were unlucky, an error report.

The Dartmouth (student newspaper), December 2, 1966

Read more ...


Fuzzing the Z-Machine

Playing text adventure games is sort of fun, but takes a lot of brain power. Nowadays we have all this spare CPU capacity going to waste.

What if we let the computer solve the game, and we just sit back and watch? We don’t even need any fancy neural network, we just need good old brute force.

We’re going to throw tons of semi-random input at a text adventure and see what happens. In the security world, this is called fuzzing.

Read more ...


8bitworkshop 3.6.0 Release

The 8bitworkshop IDE 3.6.0 is out, and we’ve added five more awesome platforms, as well as some nifty new debugging features!

Commodore’s VIC-II graphics and SID sound chip were originally destined for a next-gen game console. Engineering convinced CEO Jack Tramiel that a low-cost 64KB computer would be profitable, and thanks to having their own semiconductor fab (acquired from MOS Technology, along with the 6502) they were able to design the chipset in about five months.

Read more ...


Retargeting a C Compiler to 6502

I’ve written before about cc65 and some of its optimization challenges. It’s a stable compiler with a robust toolchain, but its code generator doesn’t full advantage of the 6502 when performing 8-bit operations. It places function parameters and many local variables on a separate stack, which requires many calls to helper functions.

I’ve done a survey of 6502 high-level languages, and while many are intriguing, none have the stability and C compatiblity of cc65.

So what’s so hard about the 6502? What’s keeping us from just retargeting a modern C compiler, bringing its powerful optimization routines to 6502? Well, it’s complicated. Like, really complicated.

Read more ...


Compiling a C-64 Emulator to WebAssembly

We use a variety of emulators in 8bitworkshop. Many of them, like most of the Z80 emulators, are written from scratch in JavaScript directly against our Platform API. This facilitates deep introspection into the emulator state, which comes in handy for things like debugger support and CPU visualization.

To save effort, we also integrate a couple of open source emulators. Atari 2600 support is courtesy of Javatari, and NES support is courtesy of JSNES. Each of them requires significant patching to expose hooks for the extra features the IDE supports, like breakpoints and bus-monitoring.

We can also use MAME, compiling it to WebAssembly using Emscripten. The trouble is that it’s a bit heavyweight and monolithic, and wants to be treated as an application, not a library. Due to the way it’s architected, interacting with the debugger via JavaScript isn’t really feasible. Even simple things like re-loading the ROM require a ton of Lua scripting.

Read more ...