From 0315df659787152155a3265a3ea8c544dfd37757 Mon Sep 17 00:00:00 2001 From: Hugo Villeneuve Date: Sun, 24 Nov 2013 23:14:46 -0500 Subject: [PATCH] Add tests for DIV instruction --- tests/Makefile.am | 3 ++- tests/div.asm | 22 ++++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 tests/div.asm diff --git a/tests/Makefile.am b/tests/Makefile.am index eef5997..1c8547f 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -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 index 0000000..116c3e2 --- /dev/null +++ b/tests/div.asm @@ -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 -- 2.20.1