Hello, I have been working on a custom assembly language on my arduino. I would like to have an idea of what kind of commands I should include, and if you can, some example code for this code at the bottom. One particular one I would like to figure out is an IF command. I will share my current code for whoever is reading this so they can have an idea of what I am doing. I would also like to mention that this is a kind of emulation of a language, and is not actually written in assembly or machine language. My goal was to make an 8 bit computer, like the Altair 8800. It is called Quentin's Machine Code. I know that in the example code, I am using EEPROM, and that is a bad Idea for this, so I am going to obtain some FRAM soon for this purpose. They should remake the ATMEGA chip to have FRAM in it, that would be useful.
code (It's still in development, so it's not going to be all that compressed):
#include <EEPROM.h>
int address = 0;
byte value;
byte cvalue;
void setup()
{
Serial.begin(9600);
// Clearer
for (int i = 0; i < 255; i++){
EEPROM.write(i, 0);
}
// QMC code gets programmed here
// An example for whoever
//Write 255 at address 7
EEPROM.write(0,2);
EEPROM.write(1,7);
EEPROM.write(2,255);
//Look at and return address 7
EEPROM.write(3,1);
EEPROM.write(4,7);
//Jump back to address 3
EEPROM.write(5,3);
EEPROM.write(6,3);
// End of QMC code
}
// Advancer and interpreter
void loop()
{
value = EEPROM.read(address);
//SKIP
if (value == 0)
{
address = address + 1;
}
//PEEK
if (value == 1)
{
Serial.println(EEPROM.read(EEPROM.read(address + 1)), BIN);
address = address + 2;
}
//POKE
if (value == 2)
{
EEPROM.write(EEPROM.read(address + 1),EEPROM.read(address + 2));
address = address + 3;
}
//JUMP
if (value == 3)
{
cvalue = EEPROM.read(address + 1);
address = cvalue - 1;
address = address + 1;
}
//HALT
if (value == 4)
{
address = address - 1;
address = address + 1;
}
//RESTART
if (value == 5)
{
address = 0;
}
// speed
delay(1000);
}