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

Subversion Repositories zipcpu

[/] [zipcpu/] [trunk/] [sw/] [zasm/] [sys.i] - Blame information for rev 34

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

Line No. Rev Author Line
1 13 dgisselq
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;
3
; Filename:     sys.i
4
;
5
; Project:      Zip CPU -- a small, lightweight, RISC CPU soft core
6
;
7
; Purpose:      This is the beginnings of a system wide header file for the
8
;               Zip System.   It describes and declares the peripherals
9
;               that will the be used and referenced by the assembly files.
10
;
11
; Status:       As of August, 2015, I have no confidence that the preprocessor
12
;               can properly include this file.  It certainly cannot handle
13
;               macros (yet).
14
;
15
; Creator:      Dan Gisselquist, Ph.D.
16
;               Gisselquist Tecnology, LLC
17
;
18
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
19
;
20
; Copyright (C) 2015, Gisselquist Technology, LLC
21
;
22
; This program is free software (firmware): you can redistribute it and/or
23
; modify it under the terms of  the GNU General Public License as published
24
; by the Free Software Foundation, either version 3 of the License, or (at
25
; your option) any later version.
26
;
27
; This program is distributed in the hope that it will be useful, but WITHOUT
28
; ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
29
; FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
30
; for more details.
31
;
32
; License:      GPL, v3, as defined and found on www.gnu.org,
33
;               http://www.gnu.org/licenses/gpl.html
34
;
35
;
36
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
37
;
38
        sys.bus         equ     0xc0000000
39
        sys.breaken     equ     0x080
40
        sys.step        equ     0x040
41
        sys.gie         equ     0x020
42
        sys.sleep       equ     0x010
43
        sys.ccv         equ     0x008
44
        sys.ccn         equ     0x004
45
        sys.ccc         equ     0x002
46
        sys.ccz         equ     0x001
47
        sys.bu.pic      equ     0x000
48
        sys.bus.wdt     equ     0x001
49
        sys.bus.cache   equ     0x002
50
        sys.bus.ctrpic  equ     0x003
51
        sys.bus.tma     equ     0x004
52
 
53
 
54
 
55
; Define the location(s) of our peripherals,
56
#define sys.base        0xc0000000
57
#define sys.cache.base  0xc0100000
58
#struct sys
59
        pic
60
        wdt
61
        cache
62
        ctrpic
63
        tma
64
        tmb
65
        tmc
66
        jiffies
67
        mtask
68
        mstl
69
        mpstl
70
        mastl
71
        utask
72
        ustl
73
        upstl
74
        uastl
75
#endstruct
76
; and their associated interrupt vectors ...
77
#define CACHEINT        0x01
78
#define JIFFYINT        0x02    ;
79
#define TMCINT          0x04    ;
80
#define TMBINT          0x08    ;
81
#define TMAINT          0x10    ;
82
#define CTRPICINT       0x20    ; The aux interrupt controller
83
; Masks to send to enable those same vectors
84
#define CACHEINTEN      0x80010000
85
#define JIFFYINTEN      0x80020000
86
#define TMCINTEN        0x80040000
87
#define TMBINTEN        0x80080000
88
#define TMAINTEN        0x80100000
89
#define CTRPICEN        0x80200000
90
; And similar masks to disable them
91
#define CACHEINTDIS     0x00010000
92
#define JIFFYINTDIS     0x00020000
93
#define TMCINTDIS       0x00040000
94
#define TMBINTDIS       0x00080000
95
#define TMAINTDIS       0x00100000
96
#define CTRPICDIS       0x00200000
97
 
98
; Define our condition code bits
99
#define CCZ     0x001
100
#define CCC     0x002
101
#define CCN     0x004
102
#define CCV     0x008
103
#define CCSLEEP 0x010
104
#define CCGIE   0x020
105
#define CCSTEP  0x040
106
#define CCUBRK  0x080
107
 
108
; Now, some macros
109
#define PUSH(RG,SP)     SUB 1,SP                \
110 34 dgisselq
                        STO RG,1(SP)
111
#define POP(RG,SP)      LOD 1(SP),RG            \
112 13 dgisselq
                        ADD 1,SP
113
#define FJSR(LBL,RG)    MOV __here__+2(PC),RG   \
114
                        JMP LBL
115
#define FRET(RG)        MOV RG,PC
116
#define JSR(LBL,RG)     SUB 1,SP                \
117
                        MOV __here__+3(PC),RG   \
118 34 dgisselq
                        STO RG,1(SP)            \
119 13 dgisselq
                        JMP LBL                 \
120
                        ADD 1,SP
121 34 dgisselq
#define RET             LOD 1(SP),PC
122 13 dgisselq
#define SAVE_USER_CONTEXT(DR,AR)                \
123
                        MOV -16(uSP),AR         \
124
                        MOV     uPC,DR          \
125 34 dgisselq
                        STO     DR,16(AR)       \
126 13 dgisselq
                        MOV     uCC,DR          \
127 34 dgisselq
                        STO     DR,15(AR)       \
128 13 dgisselq
                        MOV     uSP,DR          \
129 34 dgisselq
                        STO     DR,14(AR)       \
130 13 dgisselq
                        MOV     uR12,DR         \
131 34 dgisselq
                        STO     DR,13(AR)       \
132 13 dgisselq
                        MOV     uR11,DR         \
133 34 dgisselq
                        STO     DR,12(AR)       \
134 13 dgisselq
                        MOV     uR10,DR         \
135 34 dgisselq
                        STO     DR,11(AR)       \
136 13 dgisselq
                        MOV     uR9,DR          \
137 34 dgisselq
                        STO     DR,10(AR)       \
138 13 dgisselq
                        MOV     uR8,DR          \
139 34 dgisselq
                        STO     DR,9(AR)        \
140 13 dgisselq
                        MOV     uR7,DR          \
141 34 dgisselq
                        STO     DR,8(AR)        \
142 13 dgisselq
                        MOV     uR6,DR          \
143 34 dgisselq
                        STO     DR,7(AR)        \
144 13 dgisselq
                        MOV     uR5,DR          \
145 34 dgisselq
                        STO     DR,6(AR)        \
146 13 dgisselq
                        MOV     uR4,DR          \
147 34 dgisselq
                        STO     DR,5(AR)        \
148 13 dgisselq
                        MOV     uR3,DR          \
149 34 dgisselq
                        STO     DR,4(AR)        \
150 13 dgisselq
                        MOV     uR2,DR          \
151 34 dgisselq
                        STO     DR,3(AR)        \
152 13 dgisselq
                        MOV     uR1,DR          \
153 34 dgisselq
                        STO     DR,2(AR)        \
154 13 dgisselq
                        MOV     uR0,DR          \
155 34 dgisselq
                        STO     DR,1(AR)
156 13 dgisselq
#define RESTORE_USER_CONTEXT(DR,AR)             \
157 34 dgisselq
                        LOD     1(AR),DR        \
158 13 dgisselq
                        MOV     DR,uR0          \
159 34 dgisselq
                        LOD     2(AR),DR        \
160 13 dgisselq
                        MOV     DR,uR1          \
161 34 dgisselq
                        LOD     3(AR),DR        \
162 13 dgisselq
                        MOV     DR,uR2          \
163 34 dgisselq
                        LOD     4(AR),DR        \
164 13 dgisselq
                        MOV     DR,uR3          \
165 34 dgisselq
                        LOD     5(AR),DR        \
166 13 dgisselq
                        MOV     DR,uR4          \
167 34 dgisselq
                        LOD     6(AR),DR        \
168 13 dgisselq
                        MOV     DR,uR5          \
169 34 dgisselq
                        LOD     7(AR),DR        \
170 13 dgisselq
                        MOV     DR,uR6          \
171 34 dgisselq
                        LOD     8(AR),DR        \
172 13 dgisselq
                        MOV     DR,uR7          \
173 34 dgisselq
                        LOD     9(AR),DR        \
174 13 dgisselq
                        MOV     DR,uR8          \
175 34 dgisselq
                        LOD     10(AR),DR       \
176 13 dgisselq
                        MOV     DR,uR9          \
177 34 dgisselq
                        LOD     11(AR),DR       \
178 13 dgisselq
                        MOV     DR,uR10         \
179 34 dgisselq
                        LOD     12(AR),DR       \
180 13 dgisselq
                        MOV     DR,uR11         \
181 34 dgisselq
                        LOD     13(AR),DR       \
182 13 dgisselq
                        MOV     DR,uR12         \
183 34 dgisselq
                        LOD     14(AR),DR       \
184 13 dgisselq
                        MOV     DR,uSP          \
185 34 dgisselq
                        LOD     15(AR),DR       \
186 13 dgisselq
                        MOV     DR,uCC          \
187 34 dgisselq
                        LOD     16(AR),DR       \
188 13 dgisselq
                        MOV     DR,uPC
189
#define READ_USER_TRAP(RG)                      \
190
                        MOV     uCC,RG          \
191
                        AND     -256,RG
192
 

powered by: WebSVN 2.1.0

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