File tree Expand file tree Collapse file tree 5 files changed +26
-0
lines changed Expand file tree Collapse file tree 5 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -1878,6 +1878,14 @@ General Statements
1878
1878
(abbreviated ` W. ` ). If no type is
1879
1879
given, a word data is assumed.
1880
1880
1881
+ If the name _ arr_ ends with a ` % `
1882
+ symbol, this defines a floating point
1883
+ array, in this case you can't specify
1884
+ a type. It is important that at least
1885
+ the first element of each line in the
1886
+ data has a decimal point to force
1887
+ storing the data as floating point.
1888
+
1881
1889
If you end the ` DATA ` statement with
1882
1890
a comma, the following line must be
1883
1891
another ` DATA ` statement without the
Original file line number Diff line number Diff line change @@ -117,6 +117,8 @@ void labelType::set_type(std::string str)
117
117
type = 128 ;
118
118
else if (str == " VT_ARRAY_BYTE" )
119
119
type = 129 ;
120
+ else if (str == " VT_ARRAY_FLOAT" )
121
+ type = 130 ;
120
122
else
121
123
throw std::runtime_error (" invalid label type " + str);
122
124
}
Original file line number Diff line number Diff line change @@ -88,6 +88,7 @@ FP_FUNCS:
88
88
ADR_EXPR:
89
89
emit { TOK_VAR_LOAD, VT_ARRAY_FLOAT } E_VAR_SEARCH " %"
90
90
emit { TOK_VAR_ADDR, VT_FLOAT } E_VAR_SEARCH " %"
91
+ emit { TOK_NUM, VT_ARRAY_FLOAT } E_LABEL " %"
91
92
92
93
INT_FUNCTIONS:
93
94
" Int" FP_T_EXPR emit TOK_FP_INT
@@ -135,6 +136,16 @@ DIM_VAR_TYPE:<
135
136
DIM_VAR:
136
137
emit { VT_FLOAT } E_VAR_SEARCH " %" E_PUSH_VAR
137
138
139
+ DATA_FLOATS: data number
140
+ " ," E_NUMBER_FP DATA_FLOATS
141
+ pass
142
+
143
+ DATA_TYPE:
144
+ emit { VT_ARRAY_FLOAT } DATA_EXT_TYPE EQUAL E_LABEL_SET_TYPE E_NUMBER_FP DATA_FLOATS
145
+
146
+ DATA_VAR:
147
+ E_LABEL_CREATE " %()" emit { TOK_JUMP } E_LABEL_DEF DATA_TYPE
148
+
138
149
# Can create Float variables now
139
150
VAR_CREATE_TYPE:
140
151
" %" emit VT_FLOAT
Original file line number Diff line number Diff line change @@ -16,6 +16,10 @@ A%(2) = 0.03125
16
16
@SUM &A %, 3
17
17
? SUM%
18
18
19
+ DATA B%() = -0.125 , 0.0625 , 0.03125
20
+ @SUM &B %, 3
21
+ ? SUM%
22
+
19
23
X%=1234.5
20
24
21
25
@SUM &X %, 1
Original file line number Diff line number Diff line change @@ -2,4 +2,5 @@ Name: Test for using address of floating point vars
2
2
Test: run-fp
3
3
Output:
4
4
0.21875
5
+ -0.03125
5
6
1234.5
You can’t perform that action at this time.
0 commit comments