Skip to content

Commit 3556798

Browse files
committed
Fix comments and potential bug
Fix comments and use tripe-quotes. Also fix a bug in missing an imported module
1 parent 1e24979 commit 3556798

1 file changed

Lines changed: 29 additions & 29 deletions

File tree

arch/zx48k/backend/__parray.py

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
# This module contains local array (both parameters and
1010
# comparation intermediate-code traductions
1111
# --------------------------------------------------------------
12-
12+
from api import fp
1313
from .__common import REQUIRES
1414
from .__float import _fpush
1515
from .__f16 import f16
@@ -48,19 +48,19 @@ def _paddr(offset):
4848

4949

5050
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+
"""
5353
output = _paddr(ins.quad[2])
5454
output.append('push hl')
5555

5656
return output
5757

5858

5959
def _paload8(ins):
60-
''' Loads an 8 bit value from a memory address
60+
""" Loads an 8 bit value from a memory address
6161
If 2nd arg. start with '*', it is always treated as
6262
an indirect value.
63-
'''
63+
"""
6464
output = _paddr(ins.quad[2])
6565
output.append('ld a, (hl)')
6666
output.append('push af')
@@ -69,10 +69,10 @@ def _paload8(ins):
6969

7070

7171
def _paload16(ins):
72-
''' Loads a 16 bit value from a memory address
72+
""" Loads a 16 bit value from a memory address
7373
If 2nd arg. start with '*', it is always treated as
7474
an indirect value.
75-
'''
75+
"""
7676
output = _paddr(ins.quad[2])
7777

7878
output.append('ld e, (hl)')
@@ -85,10 +85,10 @@ def _paload16(ins):
8585

8686

8787
def _paload32(ins):
88-
''' Load a 32 bit value from a memory address
88+
""" Loads a 32 bit value from a memory address
8989
If 2nd arg. start with '*', it is always treated as
9090
an indirect value.
91-
'''
91+
"""
9292
output = _paddr(ins.quad[2])
9393

9494
output.append('call __ILOAD32')
@@ -101,10 +101,10 @@ def _paload32(ins):
101101

102102

103103
def _paloadf(ins):
104-
''' Loads a floating point value from a memory address.
104+
""" Loads a floating point value from a memory address.
105105
If 2nd arg. start with '*', it is always treated as
106106
an indirect value.
107-
'''
107+
"""
108108
output = _paddr(ins.quad[2])
109109
output.append('call __ILOADF')
110110
output.extend(_fpush())
@@ -115,8 +115,8 @@ def _paloadf(ins):
115115

116116

117117
def _paloadstr(ins):
118-
''' Loads a string value from a memory address.
119-
'''
118+
""" Loads a string value from a memory address.
119+
"""
120120
output = _paddr(ins.quad[2])
121121

122122
output.append('call __ILOADSTR')
@@ -127,11 +127,11 @@ def _paloadstr(ins):
127127

128128

129129
def _pastore8(ins):
130-
''' Stores 2º operand content into address of 1st operand.
130+
""" Stores 2º operand content into address of 1st operand.
131131
1st operand is an array element. Dimensions are pushed into the
132132
stack.
133133
Use '*' for indirect store on 1st operand (A pointer to an array)
134-
'''
134+
"""
135135
output = _paddr(ins.quad[1])
136136

137137
value = ins.quad[2]
@@ -157,10 +157,10 @@ def _pastore8(ins):
157157

158158

159159
def _pastore16(ins):
160-
''' Stores 2º operand content into address of 1st operand.
160+
""" Stores 2º operand content into address of 1st operand.
161161
store16 a, x => *(&a) = x
162162
Use '*' for indirect store on 1st operand.
163-
'''
163+
"""
164164
output = _paddr(ins.quad[1])
165165

166166
value = ins.quad[2]
@@ -188,9 +188,9 @@ def _pastore16(ins):
188188

189189

190190
def _pastore32(ins):
191-
''' Stores 2º operand content into address of 1st operand.
191+
""" Stores 2º operand content into address of 1st operand.
192192
store16 a, x => *(&a) = x
193-
'''
193+
"""
194194
output = _paddr(ins.quad[1])
195195

196196
value = ins.quad[2]
@@ -224,9 +224,9 @@ def _pastore32(ins):
224224

225225

226226
def _pastoref16(ins):
227-
''' Stores 2º operand content into address of 1st operand.
227+
""" Stores 2º operand content into address of 1st operand.
228228
storef16 a, x => *(&a) = x
229-
'''
229+
"""
230230
output = _paddr(ins.quad[1])
231231

232232
value = ins.quad[2]
@@ -261,8 +261,8 @@ def _pastoref16(ins):
261261

262262

263263
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+
"""
266266
output = _paddr(ins.quad[1])
267267

268268
value = ins.quad[2]
@@ -274,7 +274,7 @@ def _pastoref(ins):
274274

275275
try:
276276
if indirect:
277-
value = int(value) & 0xFFFF # Inmediate?
277+
value = int(value) & 0xFFFF # Immediate?
278278
output.append('push hl')
279279
output.append('ld hl, %i' % value)
280280
output.append('call __ILOADF')
@@ -284,8 +284,8 @@ def _pastoref(ins):
284284
output.append('pop hl') # Recovers pointer
285285
REQUIRES.add('iloadf.asm')
286286
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)
289289
output.append('ld a, %s' % C)
290290
output.append('ld de, %s' % DE)
291291
output.append('ld bc, %s' % HL)
@@ -303,11 +303,11 @@ def _pastoref(ins):
303303

304304

305305
def _pastorestr(ins):
306-
''' Stores a string value into a memory address.
306+
""" Stores a string value into a memory address.
307307
It copies content of 2nd operand (string), into 1st, reallocating
308308
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+
"""
311311
output = _paddr(ins.quad[1])
312312
temporal = False
313313
value = ins.quad[2]

0 commit comments

Comments
 (0)