aboutsummaryrefslogtreecommitdiffstats
path: root/tests/t_mic51/defmacro.inc
blob: f5b710d2ca0e100fd0c071992f5520f1fb779b95 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
; ***************************************************************************
; Definition einer Tabelle aus den MSG - Includedateien

Create_IncOffsTab macro TabName, IncDatei
TabName_Tab:  label   $
FStr:         db      TableAnf
              db      FStrEnd - FStr, StringEnde, FStrEnd - FStr
FStrEnd:
              include IncDatei
TabName_Tend:  label   $
              db      TableEnd
              endm


Create_IncTab macro TabName, IncDatei
TabName_Tab:  label   $
              include IncDatei
TabName_Tend:  label   $
              endm


Create_IncKeyTab macro State, Port, Modul, IncDatei
Key_Counter   set 0
State_Port_Modul_Tab:  label   $
             include IncDatei
State_Port_Modul_Tend:  label   $
             if Key_Counter <> 8
                fatal "Inkorrekte Anzahl von Elementen in Key-Tabelle"
             endif
           endm


Create_MsgJmpTab macro Modul, IncDatei
Modul_MsgCall_Tab:      label   $
                 include IncDatei
Modul_MsgCall_Tend:     label   $
                 db      TableEnd
                 endm



; ***************************************************************************
;

DefModul macro Modul, NetAdr

   ifndef Modul
Modul     equ  NextModul
Net_Modul equ  NetAdr
NextModul set  NextModul + 1

     SHARED Modul,NetAdr

   endif

   ifdef ModulNetAdr_Tab
     ifndef ModulNetAdr_TEND
       if (ModulNetAdr_Tab + Modul - $) < 0
           Fatal "NetAdr Tabelle inkonsistent"
         elseif
           org ModulNetAdr_Tab + Modul
         endif

        db NetAdr
      endif
    endif

; -------------------------

   ifdef ModulStr_Tab
     ifndef ModulStr_TEnd

strdef:   db Modul, strdefnext - strdef, "MODUL", StringEnde, strdefnext - strdef
strdefnext:

       endif
     endif

   endm

;
; ***************************************************************************
;

DefParam macro Param, Wert, String

   ifndef Param
Param     equ Wert

     SHARED Param

   endif

   ifdef ParamStr_Tab
     ifndef ParamStr_TEnd
strdef:   db Wert
          db strdefnext - strdef
          if String = ""
              db "PARAM", StringEnde
            elseif
              db String,  StringEnde
            endif
strdefnext:
       endif
     endif

   endm

;
; ***************************************************************************
;

DefKey macro Status, Port, Modul, String

   ifdef Status_Port_Modul_Tab
     ifndef Status_Port_Modul_TEnd
strdef:   db strdefnext - strdef
          db String,StringEnde
strdefnext:
Key_Counter  set  Key_Counter + 1
     endif
   endif

   endm

;
; ***************************************************************************
;

DefMsg  macro Modul, MsgName, ParamCount, ParamPattern

; ---------------------------------------------------------------------------
; Definition der Message-Nummern

      ifndef MsgName
MsgName        equ  Modul_NextMsg
Modul_NextMsg  set  Modul_NextMsg + 1

        SHARED  MsgName

      endif
; ---------------------------------------------------------------------------
; Aufbau der Tabelle fuer den Message-Handler

  ifdef Modul_MsgCall_Tab
    ifndef Modul_MsgCall_Tend
      if (Modul_MsgCall_Tab + (2 * MsgName) - $) < 0
          Fatal "Msg-Call Tabelle inkonsistent"
        elseif
          org Modul_MsgCall_Tab + (2 * MsgName)
        endif

        db Adr_MsgName # 256
        db Adr_MsgName / 256
      endif
    endif

; ---------------------------------------------------------------------------
; Aufbau der Stringtabelle

  ifdef MsgStr_Tab
    ifndef MsgStr_TEnd

strdef: db Modul, strdefnext - strdef, MsgName, "MSGNAME", StringEnde, ParamCount, ParamPattern
        db strdefnext - strdef
strdefnext:
      endif
    endif

        endm
;
; ***************************************************************************