A small, broken, ISA

I am pretty sure that this isn't turing complete.

It also has no way to access memory!

It has an emulator and very basic assembler, written in {python}.

One instruction is composed of 32 bits, making up 3 catagories; Opcode, Register and data. The opcode is two hexadecimal digits, the register is another two, and the data is a 4-digit hexadecimal number split into two two-digit numbers. Here is an example instruction loading ``0xf988` into `r5``:

OpcodeRegisterData 1Data 2
0x200x050xf90x88

The full list of opcodes, as well as an example, the instruction & explaination are as follows:

OpcodeInstruction
0x10storestore reg reg2
Copy value from one reg to another
0x20loadload reg val
Load a value into a reg
0x30addadd reg val
Add value to reg
0x31addraddr reg reg2
Adds reg2 to reg
0x40subsub reg val
Subtracts val from reg
0x41subrsubr reg reg2
Subtracts reg2 from reg
0x50mulmul reg val
Multipy register by value
0x51mulrmul reg reg2
Multiply reg by reg 2
0x60divdiv reg val
Intiger divides the register by the value
0x61divrdiv reg reg2
Initger devides reg by rg2
0xffprtprt 0x0000 0x0000
Print ascii value in p0 reg
0x0fscrnscrn 0x0000 val
Set pixel in x8 and y9 regs to the value (0: black) (1: white)
0xdddrwdrw 0x0000 0x0000
Draw screen buffer
0xf0cmpcmp reg reg2
Set cm reg to 0x0001 if bigger, 0x0000 if smaller, and 0xffff if they're equal
0xb0branchbranch val label
Branch to loop if cm is val
0xb1nbranchnbranch val label
Branch to loop if cm is not val
0xbbjumpjump 0x0000 label
Jump to label
0x00noopnoop 0x000 0x000
Literally does nothing
0xfehalthalt 0x0000 0x0000
Halts the cpu

I plan on making a much better version of this soon.

Links