Commits

David Boddie committed b17f973

Added test programs for the two methods of assembly.

Comments (0)

Files changed (2)

Tests/Programs/loop.py

+#!/usr/bin/env python
+
+from ATmega.definitions import *
+from ATmega.assembler import Assembler
+from ATmega.instructions import *
+
+R16 = Register(16)
+
+program = [
+    LDI(R16, 123),
+    SBCI(R16, 1),
+    BRCC(-3),
+    SLEEP()
+    ]
+
+a = Assembler()
+for address, opcode in a.assemble(0xa00, program):
+
+    print hex(address), opcode

Tests/Programs/loop_label.py

+#!/usr/bin/env python
+
+from ATmega.definitions import *
+from ATmega.assembler import *
+from ATmega.instructions import *
+
+R16 = Register(16)
+
+program = [
+    (LDI, R16, 123),
+    "loop",
+        (SBCI, R16, 1),
+        (BRSH, Reference("loop")),
+    (SLEEP,)
+    ]
+
+a = Assembler()
+
+for address, opcode in a.assemble_sequences(0xa00, program):
+
+    print hex(address), opcode