Add tests for DIV instruction
authorHugo Villeneuve <hugo@hugovil.com>
Mon, 25 Nov 2013 04:14:46 +0000 (23:14 -0500)
committerHugo Villeneuve <hugo@hugovil.com>
Mon, 2 Dec 2013 02:00:07 +0000 (21:00 -0500)
tests/Makefile.am
tests/div.asm [new file with mode: 0644]

index eef5997..1c8547f 100644 (file)
@@ -7,10 +7,11 @@ SUFFIXES = .hex .asm
 TESTS = \
     opcodes
 
-check_PROGRAMS = mul1.hex mul2.hex orl.hex anl.hex
+check_PROGRAMS = mul1.hex mul2.hex div.hex orl.hex anl.hex
 
 mul1.hex: mul1.asm
 mul2.hex: mul2.asm
+div.hex: div.asm
 orl.hex: orl.asm
 anl.hex: anl.asm
 
diff --git a/tests/div.asm b/tests/div.asm
new file mode 100644 (file)
index 0000000..116c3e2
--- /dev/null
@@ -0,0 +1,22 @@
+; Test program to verify correct emu8051 operation
+;
+; Test desc: DIV AB
+; Test output1: A = $3C
+; Test output2: B = $00
+; Test output3: PSW = $00
+
+        CSEG
+
+        ORG     0000h           ; Reset vector
+
+        MOV     A, #0FFh
+        MOV     B, #00h
+        DIV     AB              ; CY should be cleared, OV should be set
+                                ; PSW = $04
+
+        MOV     A, #240         ; 240d
+        MOV     B, PSW          ; 4d
+        DIV     AB              ; CY should be cleared, OV should be cleared, result = 10
+
+        LJMP    0FFF0h
+        END