1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# Use this editor window to write Digirule ASM code.
# Hit "Go", to compile the code.
# See your code executing step-by-step in the 
# Program Trace window.

# Ready? Click Finalise & Share, below
# for a shareable URL.

# Don't panic, Help! is always at 
# the top right corner.

# Checkout the sample projects or go to:
# https://dgtools.readthedocs.io/en/latest/code_projects.html

# Here is a simple program that adds two numbers.
# Hit Go and then scroll the trace down seeing how 
# the value of the accumulator changes from 0, to 
# 2, to 5 until it gets copied over to R0.

COPYLA 2   # Load the Acc with a 2
ADDLA 3    # Add 3 to the value of Acc
COPYAR R0  # Copy Acc to mem address R0
HALT

R0:        # R0 is a label to this memory 
.DB 2      # address within this program