Custom ASM-Like language!

Hi everyone, Today I learned a decent amount to ASM, and I came home thinking “What if I made my own version and simulate it in luau?”

So today, I made a simple one :slight_smile:

Here it is : DemPL V1
You can go see what are the opcodes and what it does by going into the ModuleScript and look for the comments

If you’re wondering about the naming, Modem is my nickname and PL stands for Programming Language so it’s literally Modem’s Programming Language

Some of you may be asking, “Why make this when you can directly code it in luau?”, The simple answer is for fun and learning

Also here’s a simple calculator for anyone that wants an example :

-- LocalScript
local DemPL = require(game.ReplicatedStorage:WaitForChild("DemPL"))

DemPL:Setup(Enum.KeyCode.E, 8)

local Calculator = {
	{"DLOAD", 1, "Enter first number : "},
	{"PRINT", 1},
	{"INPUT", 2},
	{"DLOAD", 1, "Enter second number : "},
	{"PRINT", 1},
	{"INPUT", 3},
	{"DLOAD", 1, "Enter operator : "},
	{"PRINT", 1},
	{"INPUT", 4},
	{"DLOAD", 1, "Result : "},
	{"PRINT", 1},
	{"DLOAD", 5, "+"},
	{"EQUAL", 4, 5, 6},
	{"GOTOZ", 6, 18},
	{"ADD", 2, 3, 1},
	{"PRINT", 1, true},
	{"GOTO", 32},
	{"DLOAD", 5, "-"},
	{"EQUAL", 4, 5, 6},
	{"GOTOZ", 6, 24},
	{"SUB", 2, 3, 1},
	{"PRINT", 1, true},
	{"GOTO", 32},
	{"DLOAD", 5, "*"},
	{"EQUAL", 4, 5, 6},
	{"GOTOZ", 6, 30},
	{"MUL", 2, 3, 1},
	{"PRINT", 1, true},
	{"GOTO", 32},
	{"DIV", 2, 3, 1},
	{"PRINT", 1, true},
	{"DLOAD", 1, "Press ENTER to reset"},
	{"PRINT", 1},
	{"INPUT", 1},
	{"CLR"},
	{"GOTO", 1},
}

if game["Run Service"]:IsStudio() then print(Calculator) end
DemPL:Run(Calculator)

Anyways, If you have any questions, ideas, comments, suggestions or if I did anything bad/wrong please tell me!

Also if this works really well I might make a puzzle game where you have to code things to beat the challenge or something

1 Like

I also made a project kind of like this for compiling a custom language into a custom bytecode/instruction set, perhaps you can try making a custom language in which it’ll compile into bytecode to be interpreted?

I might try that when I’m free

1 Like