9
9
# This module contains local array (both parameters and
10
10
# comparation intermediate-code traductions
11
11
# --------------------------------------------------------------
12
-
12
+ from api import fp
13
13
from .__common import REQUIRES
14
14
from .__float import _fpush
15
15
from .__f16 import f16
@@ -48,19 +48,19 @@ def _paddr(offset):
48
48
49
49
50
50
def _paaddr (ins ):
51
- ''' Loads address of an array element into the stack
52
- '''
51
+ """ Loads address of an array element into the stack
52
+ """
53
53
output = _paddr (ins .quad [2 ])
54
54
output .append ('push hl' )
55
55
56
56
return output
57
57
58
58
59
59
def _paload8 (ins ):
60
- ''' Loads an 8 bit value from a memory address
60
+ """ Loads an 8 bit value from a memory address
61
61
If 2nd arg. start with '*', it is always treated as
62
62
an indirect value.
63
- '''
63
+ """
64
64
output = _paddr (ins .quad [2 ])
65
65
output .append ('ld a, (hl)' )
66
66
output .append ('push af' )
@@ -69,10 +69,10 @@ def _paload8(ins):
69
69
70
70
71
71
def _paload16 (ins ):
72
- ''' Loads a 16 bit value from a memory address
72
+ """ Loads a 16 bit value from a memory address
73
73
If 2nd arg. start with '*', it is always treated as
74
74
an indirect value.
75
- '''
75
+ """
76
76
output = _paddr (ins .quad [2 ])
77
77
78
78
output .append ('ld e, (hl)' )
@@ -85,10 +85,10 @@ def _paload16(ins):
85
85
86
86
87
87
def _paload32 (ins ):
88
- ''' Load a 32 bit value from a memory address
88
+ """ Loads a 32 bit value from a memory address
89
89
If 2nd arg. start with '*', it is always treated as
90
90
an indirect value.
91
- '''
91
+ """
92
92
output = _paddr (ins .quad [2 ])
93
93
94
94
output .append ('call __ILOAD32' )
@@ -101,10 +101,10 @@ def _paload32(ins):
101
101
102
102
103
103
def _paloadf (ins ):
104
- ''' Loads a floating point value from a memory address.
104
+ """ Loads a floating point value from a memory address.
105
105
If 2nd arg. start with '*', it is always treated as
106
106
an indirect value.
107
- '''
107
+ """
108
108
output = _paddr (ins .quad [2 ])
109
109
output .append ('call __ILOADF' )
110
110
output .extend (_fpush ())
@@ -115,8 +115,8 @@ def _paloadf(ins):
115
115
116
116
117
117
def _paloadstr (ins ):
118
- ''' Loads a string value from a memory address.
119
- '''
118
+ """ Loads a string value from a memory address.
119
+ """
120
120
output = _paddr (ins .quad [2 ])
121
121
122
122
output .append ('call __ILOADSTR' )
@@ -127,11 +127,11 @@ def _paloadstr(ins):
127
127
128
128
129
129
def _pastore8 (ins ):
130
- ''' Stores 2º operand content into address of 1st operand.
130
+ """ Stores 2º operand content into address of 1st operand.
131
131
1st operand is an array element. Dimensions are pushed into the
132
132
stack.
133
133
Use '*' for indirect store on 1st operand (A pointer to an array)
134
- '''
134
+ """
135
135
output = _paddr (ins .quad [1 ])
136
136
137
137
value = ins .quad [2 ]
@@ -157,10 +157,10 @@ def _pastore8(ins):
157
157
158
158
159
159
def _pastore16 (ins ):
160
- ''' Stores 2º operand content into address of 1st operand.
160
+ """ Stores 2º operand content into address of 1st operand.
161
161
store16 a, x => *(&a) = x
162
162
Use '*' for indirect store on 1st operand.
163
- '''
163
+ """
164
164
output = _paddr (ins .quad [1 ])
165
165
166
166
value = ins .quad [2 ]
@@ -188,9 +188,9 @@ def _pastore16(ins):
188
188
189
189
190
190
def _pastore32 (ins ):
191
- ''' Stores 2º operand content into address of 1st operand.
191
+ """ Stores 2º operand content into address of 1st operand.
192
192
store16 a, x => *(&a) = x
193
- '''
193
+ """
194
194
output = _paddr (ins .quad [1 ])
195
195
196
196
value = ins .quad [2 ]
@@ -224,9 +224,9 @@ def _pastore32(ins):
224
224
225
225
226
226
def _pastoref16 (ins ):
227
- ''' Stores 2º operand content into address of 1st operand.
227
+ """ Stores 2º operand content into address of 1st operand.
228
228
storef16 a, x => *(&a) = x
229
- '''
229
+ """
230
230
output = _paddr (ins .quad [1 ])
231
231
232
232
value = ins .quad [2 ]
@@ -261,8 +261,8 @@ def _pastoref16(ins):
261
261
262
262
263
263
def _pastoref (ins ):
264
- ''' Stores a floating point value into a memory address.
265
- '''
264
+ """ Stores a floating point value into a memory address.
265
+ """
266
266
output = _paddr (ins .quad [1 ])
267
267
268
268
value = ins .quad [2 ]
@@ -274,7 +274,7 @@ def _pastoref(ins):
274
274
275
275
try :
276
276
if indirect :
277
- value = int (value ) & 0xFFFF # Inmediate ?
277
+ value = int (value ) & 0xFFFF # Immediate ?
278
278
output .append ('push hl' )
279
279
output .append ('ld hl, %i' % value )
280
280
output .append ('call __ILOADF' )
@@ -284,8 +284,8 @@ def _pastoref(ins):
284
284
output .append ('pop hl' ) # Recovers pointer
285
285
REQUIRES .add ('iloadf.asm' )
286
286
else :
287
- value = float (value ) # Inmediate ?
288
- C , DE , HL = fp .immediate_float (value ) # noqa TODO: it will fail
287
+ value = float (value ) # Immediate ?
288
+ C , DE , HL = fp .immediate_float (value )
289
289
output .append ('ld a, %s' % C )
290
290
output .append ('ld de, %s' % DE )
291
291
output .append ('ld bc, %s' % HL )
@@ -303,11 +303,11 @@ def _pastoref(ins):
303
303
304
304
305
305
def _pastorestr (ins ):
306
- ''' Stores a string value into a memory address.
306
+ """ Stores a string value into a memory address.
307
307
It copies content of 2nd operand (string), into 1st, reallocating
308
308
dynamic memory for the 1st str. These instruction DOES ALLOW
309
- inmediate strings for the 2nd parameter, starting with '#'.
310
- '''
309
+ immediate strings for the 2nd parameter, starting with '#'.
310
+ """
311
311
output = _paddr (ins .quad [1 ])
312
312
temporal = False
313
313
value = ins .quad [2 ]
0 commit comments