James Cat's rough && ready blog

Emscripten and LLVM

Posted in background by zzjames on January 22, 2013

So now we’re away from the deadline of the MSc project I’ve turned my attention to LLVM bitcode,  which may seem odd if you don’t know about emscripten, which is an LLVM bitcode -> Javascript compiler which uses the typed-arrays in webGL to create static (machine) types in RAM avoiding the boxing/unboxing overhead, manually managing memory (so no garbage collection) and allowing the JS jitter to easily optomise memory access.

This has led through a convoluted set of connections, which has me now figuring out how to make a sprite engine/blitter using assembly.

I don’t know how to write assembly language, so in order to build up to the more difficult steps, and also for nostalgic reasons, I’m writing a sprite based game on an 8-bit micro computer, this is not as difficult as you would think as there are millions of retro/vintage computing nerds preserving information from that era, and it was the culture surround micro computers at the time that there was an appetite for highly technical information, it was a much more rough and ready DIY kind of scene.

I’ve some coding experience with BBC basic from childhood, so I decided I would write this on a Acorn BBC B or Electron emulator, since those computer had an educational remit (due to BBC literacy project) and Acorn’s close ties to Cambridge University there was even more good technical information about them made public than most micros.

So I have downloaded a BBC emulator from here:

and gotten hold of the fist 24 editions of A&B computing magazine, which contains 12 articles on machine code/assembly, some articles on working directly with screen ram and 2 full listing of machine code arcade games which were commercial releases.

So I am going to blog what I do, and how ultimately this relates to the web browser. the steps should be:

  1. build a simple sprite based game in 6502 assembler on bbc micro emulator
  2. recreate this in 16bit HLA using VGA under dosBox (unless there’s a better PC based intermediate)
  3. incorporate some knowledge / information on 8086 assembler game optimisation
  4. try to either (a) create this in LLVM bit code or reverse engineer it to C (as close as possible)
  5. transpile the LLVM or C to javascript.

this should give us some basis for building an efficient JS sprite engine, and we will learn a lot along the way, you and me, dear reader whoever you are…

About My Project:

Posted in background, Msc by zzjames on August 10, 2012

The title of my project is: ‘The Development of a tool to facilitate the production of animated interactive learning materials, games and simulations’

The aim of my project is: To develop software to facilitate teachers, developers, educators and learning technologists in the production of animations, simulations and games as learning material.

The Objective of my project is: To develop a game engine for use in an educational context.

My intention is to ultimately situate a game engine and authoring tools within a online virtual learning environment (VLE) providing not just tools for creating and displaying this content but also assisting with feedback to the VLE to monitor students progress using the material, even potentially setting learners the task of authoring their own content – and getting feedback from this.