remy / txt2bas

ZX Spectrum BASIC conversion tooling (specific support for NextBASIC)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

#key usage preceded by % doesn't correctly generate an integer number

paulossilva opened this issue ยท comments

Have tried this little code example, in the VSCode NextBASIC plugin:

#program teste-define
#autoline 1,1
#autostart

#define spriteNumber=50
#define spritePattern=1

SPRITE %#spriteNumber,%0,%0,%#spritePattern,%1

and the resulting .BAS file has something like this for the SPRITE statement:

0000: 50 4C 55 53 33 44 4F 53 1A 01 00 C2 B0 00 00 00 	PLUS3DOS........
0010: 00 21 00 01 00 21 00 00 00 00 00 00 00 00 00 00 	.!...!..........
0020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 	................
0030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 	................
0040: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 	................
0050: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 	................
0060: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 	................
0070: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 	................
0080: 5C 00 01 1D 00 C3 BB 25 35 30 0E 00 00 32 00 00 	\......%50...2..
0090: 2C 25 30 2C 25 30 2C 25 31 0E 00 00 01 00 00 2C 	,%0,%0,%1......,
00A0: 25 31 0A                                        	%1.

As it seems something's not right with the integer tokens generated with the #key directive.

Hmm. Can you try in upper case quickly (though I wonder if it's matching the sub-word "sprite" and thinking that's a token, the it goes weirdโ€ฆ).

If I can fix it tonight, I'll push a fix out - but try the casing and try a different name, just to rule it out.

Oh sod, I misread. The replacement worked, but it put a float in place where you'd expect to see an int. Right-o, shall fix ๐Ÿ‘

๐ŸŽ‰ This issue has been resolved in version 1.14.9 ๐ŸŽ‰

The release is available on:

Your semantic-release bot ๐Ÿ“ฆ๐Ÿš€

All live and vscode extension is going live now too.

Nice catch ๐Ÿ‘