OpenCores
URL https://opencores.org/ocsvn/8051/8051/trunk

Subversion Repositories 8051

[/] [8051/] [trunk/] [asm/] [interrupt_test.asm] - Diff between revs 185 and 186

Only display areas with differences | Details | Blame | View Log

Rev 185 Rev 186
;
;
; bank 0  - counters
; bank 0  - counters
; bank 1  - expected values
; bank 1  - expected values
;
;
; @7f error code
; @7f error code
;
;
        ajmp start;
        ajmp start;
        .org 03h        ;external interrupt 0
        .org 03h        ;external interrupt 0
        ajmp ei0        ;
        ajmp ei0        ;
        .org 0bh        ;t/c 0 interrupt
        .org 0bh        ;t/c 0 interrupt
        ajmp tc0        ;
        ajmp tc0        ;
        .org 13h        ;external interrupt 1
        .org 13h        ;external interrupt 1
        ajmp ei1        ;
        ajmp ei1        ;
        .org 1bh        ;t/c 1 interrupt
        .org 1bh        ;t/c 1 interrupt
        ajmp tc1        ;
        ajmp tc1        ;
        .org 23h        ;serial interface interrupt
        .org 23h        ;serial interface interrupt
        setb b.4        ;
        setb b.4        ;
        clr scon.0              ;
        clr scon.0              ;
        clr scon.1              ;
        clr scon.1              ;
        reti;
        reti;
ei0:
ei0:
        setb b.0;
        setb b.0;
        mov c, 0                ;
        mov c, 0                ;
        jc stop0                ;
        jc stop0                ;
        clr 2           ;
        clr 2           ;
        reti;
        reti;
tc0:
tc0:
        setb b.1;
        setb b.1;
        mov c, 1                ;
        mov c, 1                ;
        jc stop1        ;
        jc stop1        ;
        clr 3           ;
        clr 3           ;
        reti;
        reti;
ei1:
ei1:
        setb b.2;
        setb b.2;
        mov c, 2                ;
        mov c, 2                ;
        jc stop2        ;
        jc stop2        ;
        clr 0           ;
        clr 0           ;
        reti;
        reti;
tc1:
tc1:
        setb b.3;
        setb b.3;
        mov c, 3                ;
        mov c, 3                ;
        jc stop3        ;
        jc stop3        ;
        clr 1           ;
        clr 1           ;
        reti;
        reti;
stop0:
stop0:
        nop;
        nop;
        mov c, 0        ;
        mov c, 0        ;
        jc stop0        ;
        jc stop0        ;
        reti            ;
        reti            ;
stop1:
stop1:
        nop;
        nop;
        mov c, 1        ;
        mov c, 1        ;
        jc stop1        ;
        jc stop1        ;
        reti            ;
        reti            ;
stop2:
stop2:
        nop;
        nop;
        mov c, 2        ;
        mov c, 2        ;
        jc stop2        ;
        jc stop2        ;
        reti            ;
        reti            ;
stop3:
stop3:
        nop;
        nop;
        mov c, 3        ;
        mov c, 3        ;
        jc stop3        ;
        jc stop3        ;
        reti            ;
        reti            ;
wait:
wait:
        nop             ;
        nop             ;
        nop             ;
        nop             ;
        dec a           ;
        dec a           ;
        jnz wait        ;
        jnz wait        ;
        ret;
        ret;
error:
error:
        mov psw, #00h           ;
        mov psw, #00h           ;
        mov p1, 7fh             ;
        mov p1, 7fh             ;
loop0:
loop0:
        nop             ;
        nop             ;
        ajmp loop0              ;
        ajmp loop0              ;
test:
test:
        subb a, b               ;
        subb a, b               ;
        jnz error               ;
        jnz error               ;
        ret             ;
        ret             ;
test_tcon:
test_tcon:
        subb a, tcon            ;
        subb a, tcon            ;
        jnz error               ;
        jnz error               ;
        ret             ;
        ret             ;
start:
start:
        clr a
        clr a
        mov r0, a               ;
        mov r0, a               ;
        mov r1, a               ;
        mov r1, a               ;
        mov r2, a               ;
        mov r2, a               ;
        mov r3, a               ;
        mov r3, a               ;
        mov r4, a               ;
        mov r4, a               ;
        mov 7fh, a              ; error 0
        mov 7fh, a              ; error 0
        mov 20h, a              ;
        mov 20h, a              ;
        mov sp, #02fh           ;
        mov sp, #02fh           ;
;
;
; testing interrupt enable interrupt enable register
; testing interrupt enable interrupt enable register
;
;
; ea (ie.7)
; ea (ie.7)
;
;
        mov ie, #00fh           ;
        mov ie, #00fh           ;
        mov sbuf, #00h          ;
        mov sbuf, #00h          ;
        mov tmod, #033h ; t/c 0 and 1 in mode 3
        mov tmod, #033h ; t/c 0 and 1 in mode 3
        mov th0, #0fdh          ;load timer 0
        mov th0, #0fdh          ;load timer 0
        mov tl0, #0fch          ;
        mov tl0, #0fch          ;
        mov tcon, #050h         ;
        mov tcon, #050h         ;
        clr p3.4                ;
        clr p3.4                ;
        clr p3.3                ;
        clr p3.3                ;
        mov 7fh, #001h          ; error 1
        mov 7fh, #001h          ; error 1
        mov a, #010h            ;
        mov a, #010h            ;
        acall wait              ;
        acall wait              ;
        clr tcon.6              ;
        clr tcon.6              ;
        clr tcon.4              ;
        clr tcon.4              ;
        clr a           ;
        clr a           ;
        acall test              ;
        acall test              ;
        mov a, #0aah            ;
        mov a, #0aah            ;
        mov 7fh, #002h          ; error 2
        mov 7fh, #002h          ; error 2
        acall test_tcon         ;
        acall test_tcon         ;
        mov tcon, #00h          ;
        mov tcon, #00h          ;
        mov a, #00ah            ;
        mov a, #00ah            ;
        acall test_tcon         ;
        acall test_tcon         ;
        setb p3.4               ;
        setb p3.4               ;
        setb p3.3               ;
        setb p3.3               ;
        mov a, #00h             ;
        mov a, #00h             ;
        acall test_tcon         ;
        acall test_tcon         ;
        clr scon.0              ;
        clr scon.0              ;
        clr scon.1              ;
        clr scon.1              ;
;
;
; ie
; ie
;
;
        mov tcon, #005h         ; external interrupts are edge sensitive
        mov tcon, #005h         ; external interrupts are edge sensitive
        mov ie, #099h           ;
        mov ie, #099h           ;
        mov th0, #0fdh          ;load timer 0
        mov th0, #0fdh          ;load timer 0
        mov tl0, #0fch          ;
        mov tl0, #0fch          ;
        mov tcon, #055h         ;
        mov tcon, #055h         ;
        mov sbuf, #098h         ;
        mov sbuf, #098h         ;
        clr p3.4                ;
        clr p3.4                ;
        clr p3.3                ;
        clr p3.3                ;
        setb p3.4               ;
        setb p3.4               ;
        setb p3.3               ;
        setb p3.3               ;
        mov 7fh, #003h          ; error 3
        mov 7fh, #003h          ; error 3
        mov a, #010h            ;
        mov a, #010h            ;
        acall wait              ;
        acall wait              ;
        clr tcon.6              ;
        clr tcon.6              ;
        clr tcon.4              ;
        clr tcon.4              ;
        mov a, #019h            ;
        mov a, #019h            ;
        acall test              ;
        acall test              ;
        mov 7fh, #004h          ; error 4
        mov 7fh, #004h          ; error 4
        mov a, #02dh            ;
        mov a, #02dh            ;
        acall test_tcon         ;
        acall test_tcon         ;
        mov b,#000h             ;
        mov b,#000h             ;
        mov ie, #09fh           ;
        mov ie, #09fh           ;
        mov 7fh, #005h          ; error 5
        mov 7fh, #005h          ; error 5
        mov a, #010h            ;
        mov a, #010h            ;
        acall wait              ;
        acall wait              ;
        clr tcon.6              ;
        clr tcon.6              ;
        clr tcon.4              ;
        clr tcon.4              ;
        mov a, #006h            ;
        mov a, #006h            ;
        acall test              ;
        acall test              ;
        mov 7fh, #006h          ; error 6
        mov 7fh, #006h          ; error 6
        mov a, #005h            ;
        mov a, #005h            ;
        acall test_tcon         ;
        acall test_tcon         ;
;
;
; software interrupts
; software interrupts
;
;
        mov b,#000h             ;
        mov b,#000h             ;
        mov tcon, #0afh         ;
        mov tcon, #0afh         ;
        setb scon.0             ;
        setb scon.0             ;
        mov 7fh, #007h          ; error 7
        mov 7fh, #007h          ; error 7
        mov a, #005h            ;
        mov a, #005h            ;
        acall wait              ;
        acall wait              ;
        mov a, #01fh            ;
        mov a, #01fh            ;
        acall test              ;
        acall test              ;
        mov 7fh, #008h          ; error 8
        mov 7fh, #008h          ; error 8
        mov a, #005h            ;
        mov a, #005h            ;
        acall test_tcon         ;
        acall test_tcon         ;
        mov p0, #001h           ;
        mov p0, #001h           ;
;
;
; interrupt prioriti test
; interrupt prioriti test
;
;
        mov b,#000h             ;
        mov b,#000h             ;
        mov ie, #08fh           ;
        mov ie, #08fh           ;
        mov ip, #003h           ;
        mov ip, #003h           ;
        mov 20, #00ch           ;
        mov 20, #00ch           ;
        mov tcon, #0afh         ;
        mov tcon, #0afh         ;
        mov 7fh, #009h          ; error 9
        mov 7fh, #009h          ; error 9
        mov a, #005h            ;
        mov a, #005h            ;
        acall wait              ;
        acall wait              ;
        mov a, #00fh            ;
        mov a, #00fh            ;
        acall test              ;
        acall test              ;
        mov 7fh, #00ah          ; error a
        mov 7fh, #00ah          ; error a
        mov a, #005h            ;
        mov a, #005h            ;
        acall test_tcon         ;
        acall test_tcon         ;
        mov b,#000h             ;
        mov b,#000h             ;
        mov ip, #00ch           ;
        mov ip, #00ch           ;
        mov 20, #003h           ;
        mov 20, #003h           ;
        mov tcon, #0afh         ;
        mov tcon, #0afh         ;
        mov 7fh, #00bh          ; error b
        mov 7fh, #00bh          ; error b
        mov a, #005h            ;
        mov a, #005h            ;
        acall wait              ;
        acall wait              ;
        mov a, #00fh            ;
        mov a, #00fh            ;
        acall test              ;
        acall test              ;
        mov 7fh, #00ch          ; error c
        mov 7fh, #00ch          ; error c
        mov a, #005h            ;
        mov a, #005h            ;
        acall test_tcon         ;
        acall test_tcon         ;
        mov p0, #002h           ;
        mov p0, #002h           ;
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.