1 | * ------------------------------------------------------------------------------
|
---|
2 | * mtdefs.s -- Multi-Tasker variable definitions
|
---|
3 | * Version 17 -- 1988-04-17 -- D.N. Lynx Crowe
|
---|
4 | * (c) Copyright 1988 -- D.N. Lynx Crowe
|
---|
5 | * ------------------------------------------------------------------------------
|
---|
6 | DEBUGGER .equ 0 * define non-zero for debug
|
---|
7 | * ------------------------------------------------------------------------------
|
---|
8 | .bss
|
---|
9 | * ------------------------------------------------------------------------------
|
---|
10 | .xdef MTStruct * multi-takser system RAM
|
---|
11 | .xdef MT_END * end of multi-tasker system RAM
|
---|
12 | *
|
---|
13 | .xdef _MSG_Vid * video mailbox structure
|
---|
14 | *
|
---|
15 | .xdef _MT_TCBs * pointer to base of TCB pool
|
---|
16 | .xdef _MT_CurP * current TCB pointer
|
---|
17 | .xdef _MT_RdyQ * ready queue pointer
|
---|
18 | .xdef _MT_IDct * task ID counter
|
---|
19 | *
|
---|
20 | .xdef MT_ITCB1 * Interrupt level 1 TCB
|
---|
21 | .xdef MT_ITCB2 * Interrupt level 2 TCB
|
---|
22 | .xdef MT_ITCB3 * Interrupt level 3 TCB
|
---|
23 | .xdef MT_ITCB4 * Interrupt level 4 TCB
|
---|
24 | .xdef MT_ITCB5 * Interrupt level 5 TCB
|
---|
25 | .xdef __MTptcb * Private TCBs
|
---|
26 | *
|
---|
27 | .xdef MT_ISEM1 * Interrupt level 1 semaphore
|
---|
28 | .xdef _MTISem1
|
---|
29 | .xdef MT_ISEM2 * Interrupt level 2 semaphore
|
---|
30 | .xdef _MTISem2
|
---|
31 | .xdef MT_ISEM3 * Interrupt level 3 semaphore
|
---|
32 | .xdef _MTISem3
|
---|
33 | .xdef MT_ISEM4 * Interrupt level 4 semaphore
|
---|
34 | .xdef _MTISem4
|
---|
35 | .xdef MT_ISEM5 * Interrupt level 5 semaphore
|
---|
36 | .xdef _MTISem5
|
---|
37 | .xdef _SemTick * Timer semaphore (1MS ticks)
|
---|
38 | .xdef _SemFCLK * Score frame clock semaphore
|
---|
39 | .xdef _SemAPI * Analog FIFO not-empty semaphore
|
---|
40 | .xdef _SemQuit
|
---|
41 | *
|
---|
42 | .xdef __MT_Vc1 * Saved TRAP 8 vector
|
---|
43 | .xdef __MT_Vc2 * Saved TRAP 9 vector
|
---|
44 | .xdef _MT_NTpc * Logged PC for 'next' trap
|
---|
45 | .xdef _MT_STpc * Logged PC for 'swap' trap
|
---|
46 | .xdef _MT_LTCB * Last TCB address from MT_CurP
|
---|
47 | .xdef _MT_LSpc * Last PC from SM_Sig
|
---|
48 | .xdef _MT_LWpc * Last PC from SM_Wait
|
---|
49 | *
|
---|
50 | .xdef _sr1_ior * Serial port 1 iorec
|
---|
51 | .xdef _sr2_ior * Serial port 2 iorec
|
---|
52 | .xdef _mc1_ior * MIDI port 1 iorec
|
---|
53 | .xdef _mc2_ior * MIDI port 2 iorec
|
---|
54 | *
|
---|
55 | .page
|
---|
56 | *
|
---|
57 | .ifeq DEBUGGER
|
---|
58 | *
|
---|
59 | .xdef MTVARS * second part of MT variables
|
---|
60 | *
|
---|
61 | .endc
|
---|
62 | *
|
---|
63 | * ------------------------------------------------------------------------------
|
---|
64 | TCBLEN_B .equ 96 * length of a TCB in bytes
|
---|
65 | TCBLEN_W .equ (TCBLEN_B/2) * length of a TCB in words
|
---|
66 | *
|
---|
67 | IORECLN .equ 56 * length of an iorec structure in bytes
|
---|
68 | MBOXLEN .equ 16 * length of an MBOX structure in bytes
|
---|
69 | * ------------------------------------------------------------------------------
|
---|
70 | .page
|
---|
71 | *
|
---|
72 | .ifne DEBUGGER
|
---|
73 | *
|
---|
74 | MT_base .equ $50000 * base of Multi-Tasker RAM area
|
---|
75 | *
|
---|
76 | .endc
|
---|
77 | *
|
---|
78 | .ifeq DEBUGGER
|
---|
79 | *
|
---|
80 | MT_base: .ds.w 7 * base of Multi-Tasker RAM area
|
---|
81 | *
|
---|
82 | .endc
|
---|
83 | *
|
---|
84 | * Multi-Tasker control variables (MTStruct)
|
---|
85 | * ------------------------------
|
---|
86 | _MT_TCBs .equ MT_base * LONG - TCB pool chain pointer
|
---|
87 | _MT_CurP .equ _MT_TCBs+4 * LONG - pointer to current TCB
|
---|
88 | _MT_RdyQ .equ _MT_CurP+4 * LONG - head of ready queue
|
---|
89 | _MT_IDct .equ _MT_RdyQ+4 * WORD - task ID counter
|
---|
90 | *
|
---|
91 | * Interrupt level TCBs
|
---|
92 | * --------------------
|
---|
93 | MT_ITCB1 .equ _MT_IDct+2 * Level 1 -- VSDD
|
---|
94 | MT_ITCB2 .equ MT_ITCB1+TCBLEN_B * Level 2 -- FPU
|
---|
95 | MT_ITCB3 .equ MT_ITCB2+TCBLEN_B * Level 3 -- Analog
|
---|
96 | MT_ITCB4 .equ MT_ITCB3+TCBLEN_B * Level 4 -- Timer
|
---|
97 | MT_ITCB5 .equ MT_ITCB4+TCBLEN_B * Level 5 -- Serial I/O
|
---|
98 | *
|
---|
99 | __MTptcb .equ MT_ITCB5+TCBLEN_B * Private TCBs
|
---|
100 | *
|
---|
101 | * Interrupt level sempahores
|
---|
102 | * --------------------------
|
---|
103 | MT_ISEM1 .equ __MTptcb+(2*TCBLEN_B) * LONG - VSDD
|
---|
104 | MT_ISEM2 .equ MT_ISEM1+4 * LONG - FPU
|
---|
105 | MT_ISEM3 .equ MT_ISEM2+4 * LONG - analog
|
---|
106 | MT_ISEM4 .equ MT_ISEM3+4 * LONG - timer
|
---|
107 | MT_ISEM5 .equ MT_ISEM4+4 * LONG - serial I/O
|
---|
108 | *
|
---|
109 | * Other multi-tasker variables
|
---|
110 | * ----------------------------
|
---|
111 | _SemTick .equ MT_ISEM5+4 * LONG - 1 Ms Timer semaphore
|
---|
112 | _SemFCLK .equ _SemTick+4 * LONG - Frame clock semaphore
|
---|
113 | _SemAPI .equ _SemFCLK+4 * LONG - Analog FIFO semaphore
|
---|
114 | _SemQuit .equ _SemAPI+4 * LONG - Terminate semaphore
|
---|
115 | *
|
---|
116 | _MSG_Vid .equ _SemQuit+4 * STRUCT - Video mailbox
|
---|
117 | *
|
---|
118 | __MT_Vc1 .equ _MSG_Vid+MBOXLEN * LONG - Save TRAP 8 vector
|
---|
119 | __MT_Vc2 .equ __MT_Vc1+4 * LONG - Save TRAP 8 vector
|
---|
120 | _MT_NTpc .equ __MT_Vc2+4 * LONG - Logged PC for 'next'
|
---|
121 | _MT_STpc .equ _MT_NTpc+4 * LONG - Logged PC for 'swap'
|
---|
122 | _MT_LTCB .equ _MT_STpc+4 * LONG - Last TCB address
|
---|
123 | _MT_LSpc .equ _MT_LTCB+4 * LONG - Last PC from SM_Sig
|
---|
124 | _MT_LWpc .equ _MT_LSpc+4 * LONG - Last PC from SM_Wait
|
---|
125 | *
|
---|
126 | _sr1_ior .equ _MT_LWpc+4 * STRUCT - Serial-1 iorec
|
---|
127 | _sr2_ior .equ _sr1_ior+IORECLN * STRUCT - Serial-2 iorec
|
---|
128 | _mc1_ior .equ _sr2_ior+IORECLN * STRUCT - MIDI-1 iorec
|
---|
129 | _mc2_ior .equ _mc1_ior+IORECLN * STRUCT - MIDI-2 iorec
|
---|
130 | *
|
---|
131 | MT_END .equ _mc2_ior+IORECLN
|
---|
132 | MT_LEN .equ MT_END-MT_base
|
---|
133 | *
|
---|
134 | _MTISem1 .equ MT_ISEM1
|
---|
135 | _MTISem2 .equ MT_ISEM2
|
---|
136 | _MTISem3 .equ MT_ISEM3
|
---|
137 | _MTISem4 .equ MT_ISEM4
|
---|
138 | _MTISem5 .equ MT_ISEM5
|
---|
139 | *
|
---|
140 | MTStruct .equ MT_base
|
---|
141 | * ------------------------------------------------------------------------------
|
---|
142 | *
|
---|
143 | .ifeq DEBUGGER
|
---|
144 | *
|
---|
145 | MTVARS: .ds.b MT_LEN-14
|
---|
146 | *
|
---|
147 | .endc
|
---|
148 | *
|
---|
149 | .end
|
---|