Forum
--base-string=1 issue (* solved *) - Printable Version

+- Forum (https://www.boriel.com/forum)
+-- Forum: Compilers and Computer Languages (https://www.boriel.com/forum/forumdisplay.php?fid=12)
+--- Forum: ZX Basic Compiler (https://www.boriel.com/forum/forumdisplay.php?fid=11)
+---- Forum: Bug Reports (https://www.boriel.com/forum/forumdisplay.php?fid=15)
+---- Thread: --base-string=1 issue (* solved *) (/showthread.php?tid=805)



--base-string=1 issue (* solved *) - LTee - 06-19-2017

Hi guys,

It's been a while but I recently started trying to convert a program written in 'standard' Sinclair BASIC so that it would compile with ZX Basic. It's going fairly well, but I've come across a problem with the --base-string option in release 1.5.3.

Take a look at this short program, which is supposed to replace 'character 1' in a string:

Code:
dim st as string

cls
let st="test"
print st(1)
let st(1)="X"
print st(1)
print st

If I compile this with --base-string=0 then the result is 'e/X/tXst', as I would expect.

However, if I compile with --base-string=1 then the result is 't/t/tXst' rather than 't/X/Xest'. It seems the read of char '1' respects the setting, but the write does not.

I've been having some pretty weird crash errors that look like memory being randomly overwritten - wondering if maybe this might have something to do with it (fingers crossed).

Thanks in advance for anything you can do to help! Smile


Re: --base-string=1 issue - boriel - 06-21-2017

Yes, I've tested it and I can confirm it's a bug. :oops:
I'm working to fix it.


Re: --base-string=1 issue - LTee - 06-22-2017

Thanks, boriel - much obliged. Smile

Usually this wouldn't be a problem because I would be writing for ZX Basic, but in this case it's a listing written for Spectrum BASIC first so all the alignments are 1-based rather than zero.


Re: --base-string=1 issue - boriel - 06-23-2017

Okay, i think it is fixed.

Can you check version 1.6.2 and tell me if it works ok, please? :roll:


Re: --base-string=1 issue - LTee - 06-24-2017

Okay, first the good news - the 'base=1' string handling seems to work great now, many thanks! Smile

Now the bad news... there's something weird going on when I perform calculations on memory pointers.

Edit: moved this out into a separate bug report.


Re: --base-string=1 issue - boriel - 06-24-2017

This should be asked in a new question :roll:
Can you please start a new bug question? (I can split this post for you, if you like) :wink:


Re: --base-string=1 issue - LTee - 06-25-2017

Oops, of course - sorry! I've split it out, so you can set this one to solved now.


Re: --base-string=1 issue - boriel - 06-25-2017

LTee Wrote:Oops, of course - sorry! I've split it out, so you can set this one to solved now.
Thanks! :roll: