Archaeology attack: Rubik's Cube on the 41


Greetings fellow time travellers :)

Out of curiosity and with a tinge of amusement I dug out the Rubik's cube solver programs written by Julian Perry and published in PPC CJ V9N2 (Feb 1982)

I remember reading that one back then and wondering if it'll work on a ROM... almost 30 years later I know the answer.

I should be posting the module and RAW files at TOS soon - or maybe they're already available somewhere? At any rate, email me if you'd like them rushed to you before.




Here's an idea. How about a new "games rom" that includes some of the favorites?

Such as Dungeon of Doom from Datafile? That thing is AWFUL to scan or type in.

Such as Craig Pearce's Pinball Wizard?

Such as The Caves?

Or some of the adventure games with text files that were in the PPC Journal?


You get the idea.


Yes I get the idea - and it's a cool one :) I've been thinking of the same for a while now and have put together a few of my favorite ones (Morse, Roman numbers, Mastermind, and the all-MCODE ROLLERS as well - sorry but I'm partial to MCODE).

Not to forget the ever-elusive Chess CH-136, which cannot get compiled and thus remains impossible to write to ROM!

A few considerations are probably in order:-

1. These things are huge.- The Rubik's solver alone takes up almost three quads of a 4k rom. Likely to end up with a 12k or even a 16k module before you notice.

2. These things are tough to come by: not likely to be RAW files available, or ASCII either. Barcodes help (converted via MLDL) but it's quite time consuming.

3. These things are subjective: which ones are the " best" games ever written for the 41? Here's the question, worth a poll amongst the forum dwellers for sure...

A proposal: if anybody cares enough about a certain game to produce the RAW file for it I'll be more than glad to add it on the POWER-GAMES module.

Here are a few more to the list:
-Valentin's Reversi, Checkers and Mini Chess

Anybody wants to chime in? Send your proposals and your code!



I'm actually working on a mode game rom that will be about 4k but cover only one game (maybe two). I love the idea of a games rom, especially in mode. Id be happy to participate in typing or scanning or something ( within reason) but even more I'd be interested in writing a mode game. I thought about risk once but the problem is the map. But writing the computer ai as opponents would be much fun to do...




Where can it be found? Is this the one that used precompiled GTOs without labels and were sold on magnetic cards back in the old days?

Not to forget the ever-elusive Chess CH-136, which cannot get compiled and thus remains impossible to write to ROM!


I found the Chess game.


Hej Håkan,

Yes, it's available at TOS... can't specify link or the message will be "preempted"

Do you have any suggestions as to how to upload it on a ROM? The problem is of course the initial PACKing - which deletes all the pre-compiled jump distances.


Yes, I found it at TOS.

It should not be a big issue to upload it to a ROM, but it will take a while as I only put a couple of hours per week into this. I was already working a bit on RPN code handling for other reasons, so I went ahead and started making a RAW reader as well.

Hej Håkan,

Yes, it's available at TOS... can't specify link or the message will be "preempted"

Do you have any suggestions as to how to upload it on a ROM? The problem is of course the initial PACKing - which deletes all the pre-compiled jump distances.



Could we get Mcode a target backend of a C compiler (or has this already been done). i'm thinking LLVM?

that might be interesting.


Hugh, do you mean to write a compiler from C to MCODE, preferably in MCODE?




it wouldnt need to be in mcode, only emit it. then you'd simply compile the compiler into mcode :-)


I guess I'm confused. If it has to be for the 41 then we can only write it in focal or mcode (or, theoretically in forth...). So if the Compiler is supposed to take a c file as Input and produce mcode as output it could not compile itself. Or are you talking about an offline compiler that takes c code and converts it to mcode in which case the compiler would have to be written in c to be compilable to mcode to run on the 41. So what kind of compiler are u suggesting? Sorry to be slow...



corrected spelling from iPhone in wrong language mode...

Edited: 25 May 2010, 2:35 p.m.


i was thinking it would be interesting to have a way to generate mcode from C. if we had a compiler (eg on the PC) that took C and generated mcode then, if that compiler itself was written in C, it could compile itself into mcode. That would give a C->mcode compiler in mcode and therefore one that could (theoretically) run on the 41 itself.

I say theoretically, because in practice it would require significant processor power and memory to actually perform a compilation on the 41c. Nevertheless, it might work for expanded 41 emulators, modern systems based around the 41.

Personally, i'd be happy with a cross compiler running on the PC generating mcode. I wouldn't want to attempt to write a self-hostable C compiler. An interesting idea would be to write a mcode backend for the LLVM project, which is basically a compiler with interchangeable back end code generators and front end syntax. it would involve writing a translator for LLVM IR (intermediate representation) to mcode.

is there an mcode reference anywhere?


gotcha, thanks for the explanation!

w/ reg to MCODE, best reference is Ken Emery's book 'An Introduction to MCODE' on the DVD's here and on TOS. A very succinct yet complete reference are the last pages of the HEPAX manual, VOl 2, also on the DVD or on TOS.

Will have to check out LLVM, never heard of it (also never written any C-code...)




And then there is the SDK41 over at TOS - invaluable.



i've just read some of these. the problem is that mcode makes effective use of its weird addressing modes (ie referencing part of its own registers). none of the compiler kits or libraries are, in any way, able to cope with this idea. instead, they are geared up more for modern offerings with limited addressing modes but diverse instruction types.

it would be an interesting project to build a mode "helper" which was able to generate mcode routines for expressions and also a few flow control primitives. this would be a bit like a "mini language" on top of mcode that had a more structured feel and easier to write.

maybe it's already been done?


Interesting to see how a Rubik's cube thread can inspire such deep reflexions on C-compilers :)

I'm no expert but the intrinsic differences between C and a low-low-level language (such as 41C mcode) aren't easy to reconcile - perhaps not need for it either.



Could the old gcc Saturn back end be modified to produce mcode??

- Pauli

Possibly Related Threads...
Thread Author Replies Views Last Post
  HP-71B - thanks to Marcus von Cube for MATH ROM article Michael Lopez 2 759 03-03-2013, 07:19 AM
Last Post: Paul Berger (Canada)
  Cube root on standard calculator Thomas Klemm 22 3,396 11-09-2012, 06:11 AM
Last Post: Pierre
  HP 50G Cube Root of Negative Hal Bitton in Boise 8 1,181 10-16-2008, 06:52 PM
Last Post: V-PN
  Cube root of negative number (HP 50G) macky 3 671 09-18-2008, 06:06 AM
Last Post: Walter B
  1d Rubik's Cube for HP 35s Andrew Nikitin 2 640 09-08-2008, 06:21 PM
Last Post: Paul Dale
  A practical application for cube root Karl Schneider 22 2,842 01-30-2007, 09:13 PM
Last Post: Ron
  49g+ Cube roots Kellie 15 1,845 02-26-2004, 08:04 PM
Last Post: Kellie
  [OT] BIG VERY BIG virus attack R Lion (Spain) 4 777 09-19-2003, 02:05 PM
Last Post: Tom Scott

Forum Jump: