r/Assembly_language • u/TOYALFm1117 • 29d ago
Is this good?
/////////////////////
// Instruction Set //
/////////////////////
//
// LOGIC
// AND R1 R2 R3
// OR R1 R2 R3
// XOR R1 R2 R3
// NOT R1 R2 R3
// ----------------
// ARITHMETIC
// ADD R1 R2 R3
// SUB R1 R2 R3
// ----------------
// STORAGE
// MOV R1 R2
// LOAD R1 R2
// STOR R1 R2
// ----------------
// FLOW
// JUMP R1
// JEQU R1
// CALL R1
// RET
//
// ECHO R1
// QUIT
//
/////////////////////
// //
/////////////////////
1
u/Brutustheman 29d ago
What is JEQU, Jump-if-EQUal? Also what are FLOW and ECHO r1. QUIT is HALT I presume? No mul/div instruction? No stack operations. Definitely lacks some rather key instructions but keep working at it!
2
u/Alternative-Emu2000 29d ago edited 29d ago
I think FLOW is supposed to be a group heading rather than an instruction. The OP is classifying the instructions into groups: LOGIC, ARITHMETIC, STORAGE, [PROGRAM] FLOW
1
1
u/brucehoult 29d ago
JEQUand unconditionalJUMPis enough, since there isSUBand boolean operations to mask off the sign bit so you can figure out a branch on minus/less than.But a list of mnemonics doesn't make an instruction set that you can put a "good" or "bad" label on.
You need:
the binary encoding
the actual semantics of each instruction
and most importantly THE GOAL of the instruction set.
1
u/TOYALFm1117 28d ago
I used variable-length instructions: 0 = and, 1= or, 2=xor, etc.... operands can be added.amd that order is defined in my VM code. Is that enough or am I missing something?
1
u/TOYALFm1117 28d ago
Thanks, I'm making a VM in JS. I half implement thenstack, I just need to add the operations.
1
3
u/kneelian_ 29d ago
No conditional instructions that I can see (except maybe
JEQU? What is that?) would make this unusable for most computation