This is a great introduction to how programs are stored in memory, where values required by the opcode instruction sit in sequence order I’m using the term item as we aren’t restricting the memory to be byte sized at the moment. In the first Dojo we start by building an extremely simple CPU with a couple of registers, three opcode instructions and a 16 item size of memory.
#Photo dojo emula code#
Realised that even when you’re hacking away at a small throw away hour long problem it is still very valuable to be test driving theĪfter the first session many people threw away their code and re-wrote it using TDD. Their implementation from the beginning which held them in good stead for future CPU Dojos.
What was interesting is that a few people test drove Most people settled on using either Java or Javascript to write the CPU emulator.
#Photo dojo emula free#
People were free to choose whatever programming language they wanted to use. The fun part of running a Dojo is that everyone starts off together writing code against the same problem and as this was an abstract problem we won’t be handling the 8bit nature of adding two large integers and having to deal with 16 bit little endian numbers, as this could be added in a later Dojo start with no restrictions on integer size, i.e.have an extremely small subset of opcodes that are similar to the 6502 in name and function but without all the different ways of addressing memory.
#Photo dojo emula series#
start small and introduce key components gradually over the Dojo series.
We were never going to build a real 6502 CPU emulator in a few hour long sessions so I came up with a cut down set of specs to work towards. That important as the goal was a learning experiment and to provide an outline of how a CPU worked. For that reason I’m pretty sure there are a few things which are incorrect, but in the end it’s not The main reason I wanted to run the Dojo was to encourage myself to learn more about how CPUs worked and I thought others wouldįind it interesting too.
When running a Dojo it’s best if you can: Which was used in many of the great computers of the time: That ruled out modern CPUs, even 8bit ones, as they have lots of registers and opcodes.įor this reason I looked towards the CPUs of my video gaming youth and settled on the MOS 6502 I realised that the CPU should be very simple so we could all grasp what was going on and write some code within the hour. I really wanted to learn more about how CPUs worked so I proposed to run a series of Dojos on writing a very simple CPU emulator. Some of the topics we’ve covered already are: We usually run a Dojo session every Wednesday at 12:00 during work time, which lasts for one hour. This allows anyone that’s interestedĪn opportunity to learn something new or try a technology that another team is using. Passions, including Gold Cards (which is our version of 20% time), fortnightly Tech Talks (5-10 minute lightning talks) andĭojos (hour long sessions on a given topic).ĭevelopers can propose to run a single Dojo, or a series of Dojos, on a topic of their choosing. At Unruly the developers have a passion for learning new things.