1 /****************************************************************/
2 /* file mem0.c
3 
4 ARIBAS interpreter for Arithmetic
5 Copyright (C) 1996-2002 O.Forster
6 
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
11 
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 GNU General Public License for more details.
16 
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 
21 Address of the author
22 
23     Otto Forster
24     Math. Institut der LMU
25     Theresienstr. 39
26     D-80333 Muenchen, Germany
27 
28 Email   forster@mathematik.uni-muenchen.de
29 */
30 /****************************************************************/
31 
32 /*
33 ** mem0.c
34 ** Entschluesselung der truc's zu echten Pointern
35 ** Kann zur Beschleunigung in Assembler geschrieben werden
36 **
37 ** date of last change
38 ** 1994-02-15
39 */
40 
41 
42 #include "common.h"
43 
44 #ifdef ATARIST
45 #define ASSEMB
46 #endif
47 
48 #ifndef ASSEMB
49 /*
50 ** Falls ASSEMB definiert ist, werden die folgenden Routinen
51 ** durch Assembler-Code ersetzt.
52 */
53 PUBLIC truc *Taddress   _((truc x));
54 PUBLIC truc *Saddress   _((truc x));
55 PUBLIC truc *TAddress   _((truc *p));
56 PUBLIC truc *SAddress   _((truc *p));
57 PUBLIC int Tflag    _((truc x));
58 PUBLIC int Symflag  _((truc x));
59 
60 /*----------------------------------------------------------------*/
Taddress(x)61 PUBLIC truc *Taddress(x)
62 truc x;
63 {
64     variant v;
65     size_t offs;
66 
67     v.xx = x;
68     offs = v.pp.ww;
69     return(Memory[v.pp.b1] + offs);
70 }
71 /*----------------------------------------------------------------*/
Saddress(x)72 PUBLIC truc *Saddress(x)
73 truc x;
74 {
75     variant v;
76     size_t offs;
77 
78     v.xx = x;
79     offs = v.pp.ww;
80     return(Symbol + offs);
81 }
82 /*----------------------------------------------------------------*/
TAddress(p)83 PUBLIC truc *TAddress(p)
84 truc *p;
85 {
86     variant v;
87     size_t offs;
88 
89     v.xx = *p;
90     offs = v.pp.ww;
91     return(Memory[v.pp.b1] + offs);
92 }
93 /*----------------------------------------------------------------*/
SAddress(p)94 PUBLIC truc *SAddress(p)
95 truc *p;
96 {
97     size_t offs;
98 
99     offs = *((word2 *)p + 1);
100     return(Symbol + offs);
101 }
102 /*----------------------------------------------------------------*/
Tflag(x)103 PUBLIC int Tflag(x)
104 truc x;
105 {
106     variant v;
107 
108     v.xx = x;
109     return(v.pp.b0);
110 }
111 /*-------------------------------------------------------------*/
Symflag(x)112 PUBLIC int Symflag(x)
113 truc x;
114 {
115     variant v;
116     size_t offs;
117 
118     v.xx = x;
119     offs = v.pp.ww;
120     return(*(byte *)(Symbol + offs));
121 }
122 /*-------------------------------------------------------------*/
123 #else
124 #undef ASSEMB
125 #endif
126 /***************************************************************/
127