;; *******************************************************************
|
;; *******************************************************************
|
;; $Id: test.asm,v 1.1 2006-05-31 00:55:32 arniml Exp $
|
;; $Id: test.asm 179 2009-04-01 19:48:38Z arniml $
|
;;
|
;;
|
;; Checks interrupt on LBI.
|
;; Checks interrupt on LBI.
|
;; LBI is interrupted twice:
|
;; LBI is interrupted twice:
|
;; 1) short, 1 byte instruction
|
;; 1) short, 1 byte instruction
|
;; 2) long, 2 byte instruction
|
;; 2) long, 2 byte instruction
|
;;
|
;;
|
|
|
;; the cpu type is defined on asl's command line
|
;; the cpu type is defined on asl's command line
|
|
|
include "int_macros.inc"
|
include "int_macros.inc"
|
|
|
org 0x00
|
org 0x00
|
clra
|
clra
|
|
|
;; prepare RAM digits
|
;; prepare RAM digits
|
lbi 0, 3
|
lbi 0, 3
|
stii 0x3
|
stii 0x3
|
lbi 0, 9
|
lbi 0, 9
|
stii 0x9
|
stii 0x9
|
lbi 0, 0 ; default RAM location
|
lbi 0, 0 ; default RAM location
|
|
|
int_flag_clear
|
int_flag_clear
|
;; write return instruction identifier to current M
|
;; write return instruction identifier to current M
|
;; ret_instr_030 = 0x01
|
;; ret_instr_030 = 0x01
|
clra
|
clra
|
aisc 0x1
|
aisc 0x1
|
x 0
|
x 0
|
|
|
lei 0x02
|
lei 0x02
|
jp int_mark_030
|
jp int_mark_030
|
|
|
org 0x030
|
org 0x030
|
int_mark_030:
|
int_mark_030:
|
nop
|
nop
|
nop
|
nop
|
int_instr_030:
|
int_instr_030:
|
lbi 0, 9 ; short LBI
|
lbi 0, 9 ; short LBI
|
nop
|
nop
|
ret_instr_030:
|
ret_instr_030:
|
nop
|
nop
|
|
|
;; check whether interrupt really occured
|
;; check whether interrupt really occured
|
int_flag_check
|
int_flag_check
|
|
|
;;
|
;;
|
;; prepare next interrupt
|
;; prepare next interrupt
|
;;
|
;;
|
int_flag_clear
|
int_flag_clear
|
;; write return instruction identifier to current M
|
;; write return instruction identifier to current M
|
;; ret_instr_0b0 = 0x2
|
;; ret_instr_0b0 = 0x2
|
clra
|
clra
|
aisc 0x2
|
aisc 0x2
|
x 0
|
x 0
|
|
|
lei 0x02
|
lei 0x02
|
jmp int_mark_0b0
|
jmp int_mark_0b0
|
|
|
org 0x0ae
|
org 0x0ae
|
jmp fail
|
jmp fail
|
org 0x0b0
|
org 0x0b0
|
int_mark_0b0:
|
int_mark_0b0:
|
nop
|
nop
|
nop
|
nop
|
int_instr_0b0:
|
int_instr_0b0:
|
lbi 0, 3 ; long LBI
|
lbi 0, 3 ; long LBI
|
nop
|
nop
|
ret_instr_0b0:
|
ret_instr_0b0:
|
nop
|
nop
|
|
|
;; check whether interrupt really occured
|
;; check whether interrupt really occured
|
int_flag_check
|
int_flag_check
|
jmp pass
|
jmp pass
|
|
|
|
|
;; *******************************************************************
|
;; *******************************************************************
|
;; Interrupt routine
|
;; Interrupt routine
|
;;
|
;;
|
org 0x0fd
|
org 0x0fd
|
jmp fail
|
jmp fail
|
int_routine:
|
int_routine:
|
nop
|
nop
|
save_a_m_c
|
save_a_m_c
|
|
|
int_flag_set
|
int_flag_set
|
|
|
;; read interrupt location selector
|
;; read interrupt location selector
|
lbi 0, 0
|
lbi 0, 0
|
ldd 0, 0
|
ldd 0, 0
|
x 0
|
x 0
|
skmbz 0x0
|
skmbz 0x0
|
jp check_sa_030
|
jp check_sa_030
|
skmbz 0x1
|
skmbz 0x1
|
jmp check_sa_0b0
|
jmp check_sa_0b0
|
jmp fail
|
jmp fail
|
|
|
check_sa_030:
|
check_sa_030:
|
check_sa ret_instr_030
|
check_sa ret_instr_030
|
;; check saved contents of 'current M'
|
;; check saved contents of 'current M'
|
;; expect 0x9
|
;; expect 0x9
|
lbi 3, 14
|
lbi 3, 14
|
clra
|
clra
|
aisc 0x9
|
aisc 0x9
|
ske
|
ske
|
jmp fail
|
jmp fail
|
jmp int_finished
|
jmp int_finished
|
|
|
check_sa_0b0:
|
check_sa_0b0:
|
check_sa ret_instr_0b0
|
check_sa ret_instr_0b0
|
;; check saved contents of 'current M'
|
;; check saved contents of 'current M'
|
;; expect 0x3
|
;; expect 0x3
|
lbi 3, 14
|
lbi 3, 14
|
clra
|
clra
|
aisc 0x3
|
aisc 0x3
|
ske
|
ske
|
jmp fail
|
jmp fail
|
|
|
int_finished:
|
int_finished:
|
lbi 0, 0
|
lbi 0, 0
|
restore_c_m_a
|
restore_c_m_a
|
ret
|
ret
|
;;
|
;;
|
;; *******************************************************************
|
;; *******************************************************************
|
|
|
|
|
org 0x200
|
org 0x200
|
include "int_pass_fail.asm"
|
include "int_pass_fail.asm"
|
|
|