It seems that you're using an outdated browser. Some things may not work as they should (or don't work at all).
We suggest you upgrade newer and better browser like: Chrome, Firefox, Internet Explorer or Opera

×
Had this idea a while ago, I'm going to try and make a game, which involves using microcode (a set of limited instructions to build other instructions) in order to make a full fledged CPU work; targeting the MOS 6502.

Now why I'm asking for an engineer (who might be around) is to perhaps actually design either a circuit board or actual chip layout of the core of the machine. While i don't expect to physically make this machine, i would like to have the designs for eye candy, as part of the background or as the title menu or other things (but isn't required to make the game).

So far i have 9 actual instructions it's based on (that would be hard coded), and the instruction size is approx 12 bits (plus up to 16 bits for some immediate values). While the instruction size takes up 12 bits, a good portion of combinations are invalid and just not workable combinations.

Inner memory for the registers flags and temporaries is 8 bytes, and has an additional 6 bytes for calls/return instructions for the opcodes.

If there is someone who would want to take a crack at this, or has suggestions I'm open to them.
China already did this 50+ years ago. It was called The Great Leap Forward. It didn't work out so well.

Melting down a '90s Dell in your backyard bunker is the new pig iron.
avatar
rtcvb32: Had this idea a while ago, I'm going to try and make a game, which involves using microcode (a set of limited instructions to build other instructions) in order to make a full fledged CPU work; targeting the MOS 6502.
Sooo, half TIS-100, half SpaceChem?
avatar
rtcvb32: So far i have 9 actual instructions
What instructions?
(Just out of curiosity)
Post edited January 24, 2017 by ZFR
avatar
rtcvb32: Had this idea a while ago, I'm going to try and make a game, which involves using microcode (a set of limited instructions to build other instructions) in order to make a full fledged CPU work; targeting the MOS 6502.
avatar
Wishbone: Sooo, half TIS-100, half SpaceChem?
And Shenzhen I/O?
avatar
rtcvb32: So far i have 9 actual instructions
avatar
ZFR: What instructions?
(Just out of curiosity)
enum OpCodes { NA, //doesn't count
MOV, AND, OR, XOR, JZ, JMP, ROL, CALL, RET }

call & ret could probably be removed, and instead have jmp possible via a register (which you set before you jump allowing a call/return) however instead I was thinking allowing up to 3 deep for calls so you could build other instructions. But if that's too complex I don't know.

Although if i used a register for a jump, the registers would probably look like this: PC (16bit), A, B, FLAGS, R (16bit for jmp), X (1 inner/temporary register). Actually would add quite the extra constraints on the design... And call/ret could be removed entirely or be constrained to a tiny specific set of how it worked.

But a tiny bit of convenience isn't bad. Having to write

[code]
mov R, localreturn
jmp add
localreturn: mov r, 0
[/code]

each time you want to use it vs:

[code]
call add
//returns here after the ret command is used
[/code]

But back to what i was saying. There's no built-in flags (that any instructions rely on), you get to build them with the logic :P, so making the adc instruction would be probably using the add instruction you already wrote and adding 1 IF the carry happens to be on, and making sure to set the carry afterwards if there was leftovers.

The 8 bytes/memory include the following named registers for the 8 bytes: PC (16bit), A, B, FLAGS, X, Y, Z

And since it's based on the 6502 (as the final destination) then the X Y Z registers are internal and temporaries.
avatar
Wishbone: Sooo, half TIS-100, half SpaceChem?
Err... no... not exactly.
avatar
kbnrylaec: And Shenzhen I/O?
Also not quite.

TIS-100 is based on a very tiny instruction set (sorta like this) but with parallel processors to get jobs done
Space chem is... more or less a programming/shuffling puzzle.
Shenzhen IO is closer to TIS-100 except integrating specific parts and then programming it, not too unlike spacechem. Although i've tried to play SpaceChem twice and quit it twice...
avatar
Wishbone: Sooo, half TIS-100, half SpaceChem?
avatar
rtcvb32: Err... no... not exactly.
Allow me to elaborate. It sounds like you want the objective of the game to be writing small snippets of assembler code (like in TIS-100), then encapsulating, re-using and combining them (like the factories in Spacechem), in order to bootstrap higher levels of functionality into the system. Is that about right?
avatar
rtcvb32: Err... no... not exactly.
avatar
Wishbone: Allow me to elaborate. It sounds like you want the objective of the game to be writing small snippets of assembler code (like in TIS-100), then encapsulating, re-using and combining them (like the factories in Spacechem), in order to bootstrap higher levels of functionality into the system. Is that about right?
Sort of... I was thinking there's be a large pool of instructions you'd be be calling from via a ROM, perhaps enough to hold 4000 instructions for the CPU to work with in order to build the full 56 instructions. Although might be able to do it in far less, won't know til I write my own for proof of concept. Might limit it to a mere 512.

I was thinking of including a small macro editor, which would basically bulk re-paste snippets of code you write, although it's no more efficient except it doesn't do a call/return thus no overhead on that point.

Still the more fun part might be your being trained how the instructions for the MOS 6502 actually work, so someone wanting to get into that architecture would have some fun in building it.
avatar
rtcvb32: Sort of... I was thinking there's be a large pool of instructions you'd be be calling from via a ROM, perhaps enough to hold 4000 instructions for the CPU to work with in order to build the full 56 instructions. Although might be able to do it in far less, won't know til I write my own for proof of concept. Might limit it to a mere 512.

I was thinking of including a small macro editor, which would basically bulk re-paste snippets of code you write, although it's no more efficient except it doesn't do a call/return thus no overhead on that point.

Still the more fun part might be your being trained how the instructions for the MOS 6502 actually work, so someone wanting to get into that architecture would have some fun in building it.
Sounds like it could relatively easily be modded for other processors. Personally, I would find the 6510 more interesting, but that's because of my deep-seated love of the C64 ;-)
avatar
Wishbone: Sounds like it could relatively easily be modded for other processors. Personally, I would find the 6510 more interesting, but that's because of my deep-seated love of the C64 ;-)
Pretty much. Add more internal memory and update the registers to be larger (16 or 32bit), or reconfigure the enum identifiers for the various registers and you could emulate just about any processor. You probably wouldn't emulate it as efficiently as a JIT or the usual method of stepping through the individual instructions or mapping them 1:1.

However today's processors are more or less probably following this method (or similar) so it's an interesting stepping stone for learning. With these 7-9 instructions you could in theory re-create any instruction for any CPU.


Still the 6510 and 6502 likely have few differences, i'd have to look it up.

edit: Glancing at Wikipedia it states the only real difference is the 6510 has an 'addition of an 8-bit general purpose I/O port'. That does make a lot of sense, since the 6502's didn't really have any public IO pins and instead carved portions of the ram redirected to chips instead to do IO.
Post edited January 24, 2017 by rtcvb32
avatar
rtcvb32: TIS-100 is based on a very tiny instruction set (sorta like this) but with parallel processors to get jobs done
Did you mention this game on the forum recently? I actually meant to ask last night because it was driving me nuts and I was *pretty* sure it was you who had been talking about a programming game (already here on GoG) with another user.

This thread got me thinking about it but I wasn't sure of the name - do you remember the exchange and / or if it was most likely about this game (TIS).
avatar
rtcvb32: TIS-100 is based on a very tiny instruction set (sorta like this) but with parallel processors to get jobs done
avatar
Ixamyakxim: Did you mention this game on the forum recently? I actually meant to ask last night because it was driving me nuts and I was *pretty* sure it was you who had been talking about a programming game (already here on GoG) with another user.

This thread got me thinking about it but I wasn't sure of the name - do you remember the exchange and / or if it was most likely about this game (TIS).
Recently? Not sure. I feel i did but i can't recall where.

There was some programming talk a Chess thread, and then a little in ciphers, and i know there's my review...

Then there was a little talk of actually making a TIS-100 chip, and glancing at it i see how much different my current approach is vs the result i suggested in the thread...
I went over those instructions very carefully, and I can say with complete certainty that I am not an electrical engineer.
avatar
Ixamyakxim: China already did this 50+ years ago. It was called The Great Leap Forward. It didn't work out so well.

Melting down a '90s Dell in your backyard bunker is the new pig iron.
Best post in ages...
Well i think i got all the tests working showing my CPU design works.

Now to build the GUI and game...
Attachments: