| ... | ... |
@@ -56,7 +56,7 @@ |
| 56 | 56 |
( returns the next number in a 65,535-long sequence, |
| 57 | 57 |
which is never zero but every other 16-bit number |
| 58 | 58 |
appears once before the sequence repeats ) |
| 59 |
- ( http://www.retroprogramming.com/2017/07/ xorshift-pseudorandom-numbers-in-z80.html ) |
|
| 59 |
+ ( http://www.retroprogramming.com/2017/07/xorshift-pseudorandom-numbers-in-z80.html ) |
|
| 60 | 60 |
,&seed LDR2 |
| 61 | 61 |
DUP2 #70 SFT2 EOR2 |
| 62 | 62 |
DUP2 #09 SFT2 EOR2 |
| ... | ... |
@@ -68,7 +68,7 @@ |
| 68 | 68 |
|
| 69 | 69 |
@prng2 ( -- number* ) |
| 70 | 70 |
( returns the next number in a (2^32-1)-long sequence ) |
| 71 |
- ( http://b2d-f9r.blogspot.com/2010/08/ 16-bit-xorshift-rng-now-with-more.html ) |
|
| 71 |
+ ( http://b2d-f9r.blogspot.com/2010/08/16-bit-xorshift-rng-now-with-more.html ) |
|
| 72 | 72 |
,&x LDR2 |
| 73 | 73 |
DUP2 #50 SFT2 EOR2 |
| 74 | 74 |
DUP2 #03 SFT2 EOR2 |
| ... | ... |
@@ -157,12 +157,12 @@ makemacro(char *name, FILE *f) |
| 157 | 157 |
return error("Macro name is invalid", name);
|
| 158 | 158 |
m = &p.macros[p.mlen++]; |
| 159 | 159 |
scpy(name, m->name, 64); |
| 160 |
- while(fscanf(f, "%s", word)) {
|
|
| 160 |
+ while(fscanf(f, "%63s", word)) {
|
|
| 161 | 161 |
if(word[0] == '{') continue;
|
| 162 | 162 |
if(word[0] == '}') break; |
| 163 | 163 |
if(m->len > 64) |
| 164 | 164 |
return error("Macro too large", name);
|
| 165 |
- if(slen(word) >= 64) |
|
| 165 |
+ if(slen(word) >= 63) |
|
| 166 | 166 |
return error("Word too long", name);
|
| 167 | 167 |
scpy(word, m->items[m->len++], 64); |
| 168 | 168 |
} |
| ... | ... |
@@ -290,8 +290,10 @@ pass1(FILE *f) |
| 290 | 290 |
int ccmnt = 0; |
| 291 | 291 |
Uint16 addr = 0; |
| 292 | 292 |
char w[64], scope[64], subw[64]; |
| 293 |
- while(fscanf(f, "%s", w) == 1) {
|
|
| 293 |
+ while(fscanf(f, "%63s", w) == 1) {
|
|
| 294 | 294 |
if(skipblock(w, &ccmnt, '(', ')')) continue;
|
| 295 |
+ if(slen(w) == 63) |
|
| 296 |
+ fprintf(stderr, "Warning: token beginning with \"%s\" is too long\n", w); |
|
| 295 | 297 |
if(w[0] == '|') {
|
| 296 | 298 |
if(!sihx(w + 1)) |
| 297 | 299 |
return error("Pass 1 - Invalid padding", w);
|
| ... | ... |
@@ -320,7 +322,7 @@ pass2(FILE *f) |
| 320 | 322 |
{
|
| 321 | 323 |
int ccmnt = 0, cmacr = 0; |
| 322 | 324 |
char w[64], scope[64], subw[64]; |
| 323 |
- while(fscanf(f, "%s", w) == 1) {
|
|
| 325 |
+ while(fscanf(f, "%63s", w) == 1) {
|
|
| 324 | 326 |
if(w[0] == '%') continue; |
| 325 | 327 |
if(w[0] == '&') continue; |
| 326 | 328 |
if(w[0] == '[') continue; |