Line 1... |
Line 1... |
;; *******************************************************************
|
;; *******************************************************************
|
;; $Id: test.asm,v 1.1 2004-03-28 21:06:14 arniml Exp $
|
;; $Id: test.asm,v 1.2 2004-04-07 22:09:35 arniml Exp $
|
;;
|
;;
|
;; Test DA A.
|
;; Test DA A.
|
;; *******************************************************************
|
;; *******************************************************************
|
|
|
INCLUDE "cpu.inc"
|
INCLUDE "cpu.inc"
|
Line 14... |
Line 14... |
|
|
;; testcase from "Single Component MCS-48 System"
|
;; testcase from "Single Component MCS-48 System"
|
mov a, #09BH
|
mov a, #09BH
|
da a
|
da a
|
jnc fail
|
jnc fail
|
|
mov r0, a
|
|
mov a, psw
|
|
jb6 fail
|
|
mov a, r0
|
cpl a
|
cpl a
|
add a, #001H
|
add a, #001H
|
cpl a
|
cpl a
|
jnz fail
|
jnz fail
|
mov a, psw
|
|
jb6 fail
|
|
|
|
;; a value that should not be changed
|
;; a value that should not be changed
|
;; upper nibble: no overflow
|
;; upper nibble: no overflow
|
;; lower nibble: no overflow
|
;; lower nibble: no overflow
|
mov a, #037H
|
mov a, #037H
|
add a, r7 ; clear C and AC
|
add a, r7 ; clear C and AC
|
da a
|
da a
|
jc fail
|
jc fail
|
|
mov r0, a
|
|
mov a, psw
|
|
jb6 fail
|
|
mov a, r0
|
cpl a
|
cpl a
|
add a, #037H
|
add a, #037H
|
cpl a
|
cpl a
|
jnz fail
|
jnz fail
|
jb6 fail
|
|
|
|
;; upper nibble: no overflow
|
;; upper nibble: no overflow
|
;; lower nibble: overflow
|
;; lower nibble: overflow
|
mov a, #04AH
|
mov a, #04AH
|
add a, r7 ; clear C and AC
|
add a, r7 ; clear C and AC
|
da a
|
da a
|
jc fail
|
jc fail
|
|
mov r0, a
|
|
mov a, psw
|
|
jb6 fail
|
|
mov a, r0
|
cpl a
|
cpl a
|
add a, #050H
|
add a, #050H
|
cpl a
|
cpl a
|
jnz fail
|
jnz fail
|
jb6 fail
|
|
|
|
;; upper nibble: overflow
|
;; upper nibble: overflow
|
;; lower nibble: no overflow
|
;; lower nibble: no overflow
|
mov a, #0C1H
|
mov a, #0C1H
|
add a, r7 ; clear C and AC
|
add a, r7 ; clear C and AC
|
da a
|
da a
|
jnc fail
|
jnc fail
|
|
mov r0, a
|
|
mov a, psw
|
|
jb6 fail
|
|
mov a, r0
|
cpl a
|
cpl a
|
add a, #021H
|
add a, #021H
|
cpl a
|
cpl a
|
jnz fail
|
jnz fail
|
jb6 fail
|
|
|
|
;; upper nibble: overflow
|
;; upper nibble: overflow
|
;; lower nibble: overflow
|
;; lower nibble: overflow
|
mov a, #0DEH
|
mov a, #0DEH
|
add a, r7 ; clear C and AC
|
add a, r7 ; clear C and AC
|
da a
|
da a
|
jnc fail
|
jnc fail
|
|
mov r0, a
|
|
mov a, psw
|
|
jb6 fail
|
|
mov a, r0
|
cpl a
|
cpl a
|
add a, #044H
|
add a, #044H
|
cpl a
|
cpl a
|
jnz fail
|
jnz fail
|
jb6 fail
|
|
|
|
|
|
;; ******************************************************************
|
;; ******************************************************************
|
;; Next round with Auxiliary Carry
|
;; Next round with Auxiliary Carry
|
;; ******************************************************************
|
;; ******************************************************************
|