;; *******************************************************************
|
;; *******************************************************************
|
;; $Id: test.asm,v 1.2 2006-05-27 22:46:29 arniml Exp $
|
;; $Id: test.asm 179 2009-04-01 19:48:38Z arniml $
|
;;
|
;;
|
;; Checks the XAS instruction.
|
;; Checks the XAS instruction.
|
;;
|
;;
|
|
|
;; the cpu type is defined on asl's command line
|
;; the cpu type is defined on asl's command line
|
|
|
org 0x00
|
org 0x00
|
clra
|
clra
|
|
|
;; *******************************************************************
|
;; *******************************************************************
|
;; Test counter functionality
|
;; Test counter functionality
|
;;
|
;;
|
lei 0x5
|
lei 0x5
|
;; enable counter
|
;; enable counter
|
clra
|
clra
|
camq
|
camq
|
|
|
;; clear SKL
|
;; clear SKL
|
xas
|
xas
|
nop ; spend some time to let effect of SKL
|
nop ; spend some time to let effect of SKL
|
nop ; falling edge pass by
|
nop ; falling edge pass by
|
nop ;
|
nop ;
|
|
|
;; -------------------------------------------------------------------
|
;; -------------------------------------------------------------------
|
;; step 1
|
;; step 1
|
;; decrement counter from 1 to 0
|
;; decrement counter from 1 to 0
|
;; test SO by controlling SI via SO
|
;; test SO by controlling SI via SO
|
;;
|
;;
|
;; load 0x1 to counter
|
;; load 0x1 to counter
|
clra
|
clra
|
aisc 0x1
|
aisc 0x1
|
xas
|
xas
|
;; decrement via SO
|
;; decrement via SO
|
lei 0xd
|
lei 0xd
|
nop ; ensure minimum '1' duration
|
nop ; ensure minimum '1' duration
|
lei 0x5
|
lei 0x5
|
nop ;
|
nop ;
|
nop ; ensure minimum '0' duration
|
nop ; ensure minimum '0' duration
|
nop ;
|
nop ;
|
xas
|
xas
|
;; check for 0x0
|
;; check for 0x0
|
xad 3, 15
|
xad 3, 15
|
clra
|
clra
|
x 0
|
x 0
|
xad 3, 15
|
xad 3, 15
|
ske
|
ske
|
jmp fail
|
jmp fail
|
|
|
;; -------------------------------------------------------------------
|
;; -------------------------------------------------------------------
|
;; step 2
|
;; step 2
|
;; decrement counter from 0 to 0xf
|
;; decrement counter from 0 to 0xf
|
;; test SKL by controlling SI via SK
|
;; test SKL by controlling SI via SK
|
;;
|
;;
|
;; set SKL to '1'
|
;; set SKL to '1'
|
sc ; SKL = '1'
|
sc ; SKL = '1'
|
xas
|
xas
|
;; load 0x0 to counter, decrement via SK
|
;; load 0x0 to counter, decrement via SK
|
clra
|
clra
|
rc
|
rc
|
xas
|
xas
|
nop ;
|
nop ;
|
nop ; ensure minimum '0' duration
|
nop ; ensure minimum '0' duration
|
nop ;
|
nop ;
|
xas
|
xas
|
;; check for 0xf
|
;; check for 0xf
|
xad 3, 15
|
xad 3, 15
|
clra
|
clra
|
aisc 0xf
|
aisc 0xf
|
x 0
|
x 0
|
xad 3, 15
|
xad 3, 15
|
ske
|
ske
|
jmp fail
|
jmp fail
|
|
|
|
|
;; -------------------------------------------------------------------
|
;; -------------------------------------------------------------------
|
;; step 3
|
;; step 3
|
;; check minimum high time on SI
|
;; check minimum high time on SI
|
;;
|
;;
|
;; load 0x0 to counter
|
;; load 0x0 to counter
|
clra
|
clra
|
xas
|
xas
|
;; clock on SI
|
;; clock on SI
|
lei 0xd
|
lei 0xd
|
lei 0x5 ; high time too short
|
lei 0x5 ; high time too short
|
nop ;
|
nop ;
|
nop ; ensure minimum '0' duration
|
nop ; ensure minimum '0' duration
|
nop ;
|
nop ;
|
xas
|
xas
|
;; check for 0x0
|
;; check for 0x0
|
xad 3, 15
|
xad 3, 15
|
clra
|
clra
|
x 0
|
x 0
|
xad 3, 15
|
xad 3, 15
|
ske
|
ske
|
jmp fail
|
jmp fail
|
|
|
;; -------------------------------------------------------------------
|
;; -------------------------------------------------------------------
|
;; step 4
|
;; step 4
|
;; check minimum low time on SI
|
;; check minimum low time on SI
|
;;
|
;;
|
;; load 0x0 to counter
|
;; load 0x0 to counter
|
clra
|
clra
|
xas
|
xas
|
;; clock on SI
|
;; clock on SI
|
lei 0xd
|
lei 0xd
|
nop ; ensure minimum '1' duration
|
nop ; ensure minimum '1' duration
|
lei 0x5
|
lei 0x5
|
lei 0xd ; low time too short
|
lei 0xd ; low time too short
|
xas
|
xas
|
;; check for 0x0
|
;; check for 0x0
|
xad 3, 15
|
xad 3, 15
|
clra
|
clra
|
x 0
|
x 0
|
xad 3, 15
|
xad 3, 15
|
ske
|
ske
|
jmp fail
|
jmp fail
|
|
|
|
|
;; *******************************************************************
|
;; *******************************************************************
|
;; Test shift register functionality
|
;; Test shift register functionality
|
;;
|
;;
|
lei 0xc ; SO = SIO output
|
lei 0xc ; SO = SIO output
|
;; enable shift register
|
;; enable shift register
|
aisc 0x1
|
aisc 0x1
|
camq
|
camq
|
|
|
;; shift out 0x5
|
;; shift out 0x5
|
aisc 0x4
|
aisc 0x4
|
sc
|
sc
|
xas
|
xas
|
;;
|
;;
|
nop ;
|
nop ;
|
nop ; shift for four clocks on SK
|
nop ; shift for four clocks on SK
|
rc ;
|
rc ;
|
xas ; stop SK
|
xas ; stop SK
|
;; check for 0x2
|
;; check for 0x2
|
xad 3, 15
|
xad 3, 15
|
clra
|
clra
|
aisc 0x2
|
aisc 0x2
|
x 0
|
x 0
|
xad 3, 15
|
xad 3, 15
|
ske
|
ske
|
jmp fail
|
jmp fail
|
|
|
;; shift out 0x0
|
;; shift out 0x0
|
clra
|
clra
|
sc
|
sc
|
xas
|
xas
|
;;
|
;;
|
nop ;
|
nop ;
|
nop ; shift for four clocks on SK
|
nop ; shift for four clocks on SK
|
rc ;
|
rc ;
|
xas ; stop SK
|
xas ; stop SK
|
;; check for 0x8
|
;; check for 0x8
|
xad 3, 15
|
xad 3, 15
|
clra
|
clra
|
aisc 0x8
|
aisc 0x8
|
x 0
|
x 0
|
xad 3, 15
|
xad 3, 15
|
ske
|
ske
|
jmp fail
|
jmp fail
|
|
|
;; now disable SO and check that only '0' is shifted in
|
;; now disable SO and check that only '0' is shifted in
|
lei 0x4 ; SO = '0'
|
lei 0x4 ; SO = '0'
|
;; shift out 0xf
|
;; shift out 0xf
|
clra
|
clra
|
aisc 0xf
|
aisc 0xf
|
sc
|
sc
|
xas
|
xas
|
;;
|
;;
|
nop ;
|
nop ;
|
nop ; shift for four clocks on SK
|
nop ; shift for four clocks on SK
|
rc ;
|
rc ;
|
xas ; stop SK
|
xas ; stop SK
|
;; check for 0x0
|
;; check for 0x0
|
xad 3, 15
|
xad 3, 15
|
clra
|
clra
|
x 0
|
x 0
|
xad 3, 15
|
xad 3, 15
|
ske
|
ske
|
jmp fail
|
jmp fail
|
|
|
;; enable SO
|
;; enable SO
|
lei 0xc
|
lei 0xc
|
;; shift out 0x1 to force SI to '1' via SO
|
;; shift out 0x1 to force SI to '1' via SO
|
clra
|
clra
|
aisc 0x1
|
aisc 0x1
|
sc
|
sc
|
xas
|
xas
|
;;
|
;;
|
nop ;
|
nop ;
|
nop ; shift for four clocks on SK
|
nop ; shift for four clocks on SK
|
rc ;
|
rc ;
|
xas ; stop SK
|
xas ; stop SK
|
;; shift out 0x0 with disabled SK
|
;; shift out 0x0 with disabled SK
|
clra
|
clra
|
xas
|
xas
|
;;
|
;;
|
nop ;
|
nop ;
|
nop ; shift for four clocks on SK
|
nop ; shift for four clocks on SK
|
nop ;
|
nop ;
|
xas
|
xas
|
;; check for 0xf
|
;; check for 0xf
|
xad 3, 15
|
xad 3, 15
|
clra
|
clra
|
aisc 0xf
|
aisc 0xf
|
x 0
|
x 0
|
xad 3, 15
|
xad 3, 15
|
ske
|
ske
|
jmp fail
|
jmp fail
|
|
|
jmp pass
|
jmp pass
|
|
|
org 0x100
|
org 0x100
|
include "pass_fail.asm"
|
include "pass_fail.asm"
|
|
|