EgonOlsen71 / basicv2

A Commodore (CBM) BASIC V2 interpreter/compiler written in Java
https://egonolsen71.github.io/basicv2/
The Unlicense
86 stars 15 forks source link

print chr$( ) commands appear to be removed in compiled version #46

Closed penrodyn closed 1 year ago

penrodyn commented 1 year ago

I have a basic program which plots some reversed characters on the screen. The program was written in CBM Prg Studio and plots the characters in two ways:-

1) print "{reverse on}{color name}[character]{reverse off} Item of Text"

and

2) print "{reverse on}";chr$(color code);chr$(character code);"{reverse off} Item of Text"

Both methods work when run natively in basic and when compiled with Blitz of Basic Boss, however when compiled in MOSSpeed method 1 works but method 2 seems to ignore anything printed using chr$(), i.e. the colours and characters.

I am using method 1 for presenting fixed graphics which will never change but need method two to dynamically change what it is displayed according some values in an array. I have confirmed that the values in the array are correct by modifying the statement in 2) to

2) print "{reverse on}";chr$(color code);chr$(character code);"{reverse off} Item of Text ";mycolourvariable;" ";mycharactervariable"

The expected values are displayed

EgonOlsen71 commented 1 year ago

I'll have a look...

EgonOlsen71 commented 1 year ago

I can't reproduce this issue. I wrote this test case:

10 print "{reverse on}{red}{120}{reverse off} test1" 20 print "{reverse on}";chr$(158);chr$(122);"{reverse off} test2"

and the result looks as expected:

test

I tried variables for color and char code as well, and that worked fine as well.

Can you provide me with a test case that shows the problem?

EgonOlsen71 commented 1 year ago

Are you using the latest version from master or the old "release"-version?

penrodyn commented 1 year ago

Hi Thanks for the reply, it's much appreciated :-)

I've download the script files again from the URL below and extracted into a new directory. https://github.com/EgonOlsen71/basicv2/tree/master/dist

I've attached a cut down version of my program, along with assets.d64 which contains the customer charset and sequential file (you'll be prompted to insert the disk at runtime).  The program runs as expected in CBM Prg Studio / VICE until compiled. I've also attached the JAR and CMD file I am using in case in contains versioning which helps prove whether I am using the most recent release. Any help would be much appreciated. Thanks and regards Lee

On Thursday, 5 January 2023 at 10:07:53 GMT, EgonOlsen ***@***.***> wrote:  

I can't reproduce this issue. I wrote this text case:

10 print "{reverse on}{red}{120}{reverse off} test1" 20 print "{reverse on}";chr$(158);chr$(122);"{reverse off} test2"

and the result looks as expected:

I tried this variables for color and char code as well, and that worked fine as well.

Can you provide me with a test case that shows the problem?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

penrodyn commented 1 year ago

Thanks - just to confirm I have replied (in case my email is blocked due to attachment) Best regardsLee On Thursday, 5 January 2023 at 10:11:18 GMT, EgonOlsen @.***> wrote:

Are you using the latest version from master or the old "release"-version?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

EgonOlsen71 commented 1 year ago

I didn't get an email with an attachment and neither can one be found in this thread. Can you please attach it directly?

penrodyn commented 1 year ago

Hi

Thanks for the reply, it's much appreciated :-)

I've download the script files again from the URL below and extracted into a new directory.

https://github.com/EgonOlsen71/basicv2/tree/master/dist

I've attached a cut down version of my program, along with assets.d64 which contains the customer charset and sequential file (you'll be prompted to insert the disk at runtime). The program runs as expected in CBM Prg Studio / VICE until compiled.

I've also attached the JAR and CMD file I am using in case in contains versioning which helps prove whether I am using the most recent release.

program.zip

Any help would be much appreciated.

Thanks and regards Lee

EgonOlsen71 commented 1 year ago

I've commited a change that should fix this issue. It was caused by a little optimzation that I introduced 6 months ago but which wasn't doing quite what it was supposed to do when applied to CHR$ with array parameters.

penrodyn commented 1 year ago

That's fixed the issue - many thanks! On Thursday, 5 January 2023 at 17:44:19 GMT, EgonOlsen @.***> wrote:

I've commited a change that should fix this issue. It was caused by a little optimzation that I introduced 6 month ago but which wasn't doing quite what it was supposed to do when applied to CHR$ with array parameters.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>