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

Subversion Repositories light8080

[/] [light8080/] [trunk/] [c/] [intr_vec.h] - Blame information for rev 80

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 66 motilito
//---------------------------------------------------------------------------------------
2
//      Project:                        light8080 SOC           WiCores Solutions 
3
//
4
//      File name:                      intr_vec.h                      (March 03, 2012)
5
//
6
//      Writer:                         Moti Litochevski 
7
//
8
//      Description:
9
//              This file contains a simple example of calling interrupt service routine. this 
10
//              file defines the interrupt vector for external interrupt 0 located at address 
11
//              0x0008. the interrupts vectors addresses are set in the verilog interrupt 
12
//              controller "intr_ctrl.v" file. 
13
//              Code is generated for all 4 supported external interrupts but non used interrupt 
14
//              are not called. 
15
//              On execution of an interrupt the CPU will automatically clear the interrupt 
16
//              enable flag set by the EI instruction. the interrupt vectors in this example 
17
//              enable the interrupts again after interrupt service routine execution. to enable 
18
//              nested interrupts just move the EI instruction to the code executed before the 
19
//              call instruction to the service routine (see comments below). 
20
//              Note that this code is not optimized in any way. this is just an example to 
21
//              verify the interrupt mechanism of the light8080 CPU and show a simple example. 
22
//
23
//      Revision History:
24
//
25
//      Rev <revnumber>                 <Date>                  <owner> 
26
//              <comment>
27
//---------------------------------------------------------------------------------------
28
 
29
// to support interrupt enable the respective interrupt vector is defined here at the 
30
// beginning of the output assembly file. only the interrupt vector for used interrupts
31
// should call a valid interrupt service routine name defined in the C source file. the 
32
// C function name should be prefixed by "__". 
33
#asm
34
;Preserve space for interrupt routines
35
;interrupt 0 vector
36
        org #0008
37
        push af
38
        push bc
39
        push de
40
        push hl
41
;       ei                                      ; to enable nested interrupts uncomment this instruction
42
        call __int0_isr
43
        pop hl
44
        pop de
45
        pop bc
46
        pop af
47
        ei                                      ; interrupt are not enabled during the execution os the isr
48
        ret
49
;interrupt 1 vector
50
        org #0018
51
        push af
52
        push bc
53
        push de
54
        push hl
55
;       call __int1_isr         ; interrupt not used
56
        pop hl
57
        pop de
58
        pop bc
59
        pop af
60
        ei
61
        ret
62
;interrupt 2 vector
63
        org #0028
64
        push af
65
        push bc
66
        push de
67
        push hl
68
;       call __int2_isr         ; interrupt not used
69
        pop hl
70
        pop de
71
        pop bc
72
        pop af
73
        ei
74
        ret
75
;interrupt 3 vector
76
        org #0038
77
        push af
78
        push bc
79
        push de
80
        push hl
81
;       call __int3_isr         ; interrupt not used
82
        pop hl
83
        pop de
84
        pop bc
85
        pop af
86
        ei
87
        ret
88
#endasm 
89
//---------------------------------------------------------------------------------------
90
//                                              Th.. Th.. Th.. Thats all folks !!!
91
//---------------------------------------------------------------------------------------

powered by: WebSVN 2.1.0

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