Devisha’s Assembly, or 'DASM' for short, is an interpreted Assembly-like programming language written in Golang by yours truly, Devisha Padmaperuma. The syntax of DASM was inspired by ARM Assembly and SHENZHEN I/O.

Index

History

DASM was initially written in 2 days as a fun side project in August, but has had a major improvement ever since.

V1

The first functional version of DASM was released on August 12th 2022. This version parsed a file, put the instructions in memory, and executed the program. Some features of this are:

  • Purely Imperative

Due to the lack of subroutines, this executes the program line by line.

  • RAM

There were no registers in this version, only memory addresses ranging from 1 to 1000. It’s worth noting that there were no registers, just RAM.

  • Instructions stored in RAM

The Instructions were stored in the RAM array. To prevent the user from accidentally accessing an instruction from the memory, the parser would add the length of the instructions array to the memory address if the memory address was lesser than or equal to the length of the instructions array.

The syntax documentation for the above can be accessed here, though I 100% recommend using V2.

V2

A few months later, in October, I was bored, so I decided to improve DASM by adding features that I felt were absolutely essential. But, I felt that I needed to rewrite the whole thing. The new features include:

  • Registers

I added general purpose registers to the program. These include r0 to r12 and 'acc' (Accumulator). The accumulator register stores the results of the comparison commands (1 if True, 0 if False) and can be used as a general purpose register as well.

  • Subroutines

Subroutines are the main highlight of this new version and an absolute game changer. I added support for subroutines through a custom Stack and Page system.

  • Constants

Added support for constants (hardcoded numbers), which is another game changing feature. This allows users to use constants in arithmetic and logic operations.

  • Control Flow

There are now (teq, tne, …​) to compare values stored in registers to values stored in other registers or constants and store the result as a 1 (True) or 0 (False) in the new 'acc' (Accumulator) register.
I also added a new syntax that relies on the result stored in the accumulator to proceed. This is done by prefixing a '+' and a space before the command. If the command is prefixed with the conditional operator, the command following it will only be executed if the value stored in the accumulator is not equal to 0.

The instruction set for V2 can be accessed here.