1010# comparison intermediate-code translations)
1111# --------------------------------------------------------------
1212
13+ from typing import List
14+
1315from src .api import fp
14- from .common import runtime_call
15- from ._float import _fpush
16- from ._f16 import f16
16+
17+ from src .arch .z80 .backend .common import runtime_call , Quad
1718from src .arch .z80 .backend .runtime import Labels as RuntimeLabel
19+ from src .arch .z80 .backend ._float import _fpush
20+ from src .arch .z80 .backend ._f16 import f16
1821
1922
20- def _paddr (offset ):
23+ def _paddr (offset ) -> List [ str ] :
2124 """Generic element array-address stack-ptr loading.
2225 Emits output code for setting IX at the right location.
2326 bytes = Number of bytes to load:
@@ -32,13 +35,13 @@ def _paddr(offset):
3235 if indirect :
3336 offset = offset [1 :]
3437
35- I = int (offset )
36- if I >= 0 :
37- I += 4 # Return Address + "push IX"
38+ i = int (offset )
39+ if i >= 0 :
40+ i += 4 # Return Address + "push IX"
3841
3942 output .append ("push ix" )
4043 output .append ("pop hl" )
41- output .append ("ld de, %i" % I )
44+ output .append ("ld de, %i" % i )
4245 output .append ("add hl, de" )
4346
4447 if indirect :
@@ -49,15 +52,15 @@ def _paddr(offset):
4952 return output
5053
5154
52- def _paaddr (ins ) :
55+ def _paaddr (ins : Quad ) -> List [ str ] :
5356 """Loads address of an array element into the stack"""
5457 output = _paddr (ins .quad [2 ])
5558 output .append ("push hl" )
5659
5760 return output
5861
5962
60- def _paload8 (ins ) :
63+ def _paload8 (ins : Quad ) -> List [ str ] :
6164 """Loads an 8 bit value from a memory address
6265 If 2nd arg. start with '*', it is always treated as
6366 an indirect value.
@@ -69,7 +72,7 @@ def _paload8(ins):
6972 return output
7073
7174
72- def _paload16 (ins ) :
75+ def _paload16 (ins : Quad ) -> List [ str ] :
7376 """Loads a 16 bit value from a memory address
7477 If 2nd arg. start with '*', it is always treated as
7578 an indirect value.
@@ -85,7 +88,7 @@ def _paload16(ins):
8588 return output
8689
8790
88- def _paload32 (ins ) :
91+ def _paload32 (ins : Quad ) -> List [ str ] :
8992 """Loads a 32 bit value from a memory address
9093 If 2nd arg. start with '*', it is always treated as
9194 an indirect value.
@@ -99,7 +102,7 @@ def _paload32(ins):
99102 return output
100103
101104
102- def _paloadf (ins ) :
105+ def _paloadf (ins : Quad ) -> List [ str ] :
103106 """Loads a floating point value from a memory address.
104107 If 2nd arg. start with '*', it is always treated as
105108 an indirect value.
@@ -111,7 +114,7 @@ def _paloadf(ins):
111114 return output
112115
113116
114- def _paloadstr (ins ) :
117+ def _paloadstr (ins : Quad ) -> List [ str ] :
115118 """Loads a string value from a memory address."""
116119 output = _paddr (ins .quad [2 ])
117120
@@ -121,7 +124,7 @@ def _paloadstr(ins):
121124 return output
122125
123126
124- def _pastore8 (ins ) :
127+ def _pastore8 (ins : Quad ) -> List [ str ] :
125128 """Stores 2º operand content into address of 1st operand.
126129 1st operand is an array element. Dimensions are pushed into the
127130 stack.
@@ -151,7 +154,7 @@ def _pastore8(ins):
151154 return output
152155
153156
154- def _pastore16 (ins ) :
157+ def _pastore16 (ins : Quad ) -> List [ str ] :
155158 """Stores 2º operand content into address of 1st operand.
156159 store16 a, x => *(&a) = x
157160 Use '*' for indirect store on 1st operand.
@@ -181,7 +184,7 @@ def _pastore16(ins):
181184 return output
182185
183186
184- def _pastore32 (ins ) :
187+ def _pastore32 (ins : Quad ) -> List [ str ] :
185188 """Stores 2º operand content into address of 1st operand.
186189 store16 a, x => *(&a) = x
187190 """
@@ -214,7 +217,7 @@ def _pastore32(ins):
214217 return output
215218
216219
217- def _pastoref16 (ins ) :
220+ def _pastoref16 (ins : Quad ) -> List [ str ] :
218221 """Stores 2º operand content into address of 1st operand.
219222 storef16 a, x => *(&a) = x
220223 """
@@ -248,7 +251,7 @@ def _pastoref16(ins):
248251 return output
249252
250253
251- def _pastoref (ins ) :
254+ def _pastoref (ins : Quad ) -> List [ str ] :
252255 """Stores a floating point value into a memory address."""
253256 output = _paddr (ins .quad [1 ])
254257
@@ -286,7 +289,7 @@ def _pastoref(ins):
286289 return output
287290
288291
289- def _pastorestr (ins ) :
292+ def _pastorestr (ins : Quad ) -> List [ str ] :
290293 """Stores a string value into a memory address.
291294 It copies content of 2nd operand (string), into 1st, reallocating
292295 dynamic memory for the 1st str. These instruction DOES ALLOW
0 commit comments