Dotneteer / spectnetide

ZX Spectrum IDE with Visual Studio 2017 and 2019 integration
MIT License
206 stars 27 forks source link

[REQUEST] Add custom parameters for ZXBasic compiler #188

Closed gusmanb closed 4 years ago

gusmanb commented 4 years ago

Hi!

I have found a bug in ZX Basic, it's a known bug and there's a beta version which solves the problem but it's needed to add a define to the command line and there's no way to add those, so my request is a field to add it.

Also, it would be useful to add a free field to add custom parameters for the compiler, in this way even if the compiler is updated and adds more options that SpectNetIDE does not expose in concrete properties it would allow you to use them.

Cheers.

Dotneteer commented 4 years ago

@gusmanb, before doing any extra work: Does not this help?

https://dotneteer.github.io/spectnetide/getting-started/use-zx-basic#option-comments

gusmanb commented 4 years ago

Hi.

Ok, missed that option :)

Anyways, it doesn't works as I would expect. If I add the @options REMark then every other setting on the regular options is ignored. I have changed the origin of the basic program and the stack size from the options pane because I'm using hi-res compressed images and it uses "a lot" of memory, if I add the REMark with "@options -D DISABLE_SCROLL" (the "fix" for the bug) then the compiler complains about the program overflowing &FFFF, then if I open the assembler output I can see it has set the origin to 32768 instead of 24000 and ignored the stack size that I have set in the options pane.

If it's intended that any REMark with options disable all the regular options then the "free" field still would be necessary on the options pane, else the REMark system for options has a bug that instead of appending the new options it replaces all the existing ones.

Cheers.

Dotneteer commented 4 years ago

The REMs intentionally override the settings in Tools | Options. I will soon create a prototype that allows you to define your custom command-line options. SpectNetIDE overrides only the --output option, and uses the --asm, To make the compilation work, you should keep some rules.

Probably, the best is to allow specifying any options, and document what is "dangerous". Nonetheless, if the developer uses something wrong, the compilation won't work...

Do you have any idea or syntax you'd like to see?

gusmanb commented 4 years ago

Hmmm... what about adding something like "@optionspreserve" to the REM directive?

It would work something like this:

Do you think this is feasible?

Dotneteer commented 4 years ago

Sorry for the silence, I was pretty busy during this week. Soon I start working on this feature.

Dotneteer commented 4 years ago

I do not think, mixing options set in the Tools | Options dialog with @options in the program is a good idea, as it causes a lot of headaches. So if you use @options in the code, you need declare every command line options and switches you'd pass to ZXB, except --output. Also, SpectNetIDE sets --asm for you. It's your responsibility to specify the approriate options. SpectNetIDE does not parse of check the option values you set. You can use the Z80 Assembler pane in the Output window to check the command line options SpectNetIDE uses when running ZXB:

devenv_aSjsrMYA0P

Here I send you the private build with this fix:

Spect.Net.VsPackage.zip

gusmanb commented 4 years ago

Sorry, I am sick, I've been two weeks really bad. I will try to test it this weekend.

Cheers.

Dotneteer commented 4 years ago

Sorry to hear that :-( Get well!

Dotneteer commented 4 years ago

@gusmanb, I hope you're getting better. I'm soon releasing Preview 8. Please check it!

gusmanb commented 4 years ago

Hi Istvan! Sorry for the long delay, I'm finally recovered, it has been a nightmare...

I have tested the @options and it works like a charm, I'm using it for custom defines and some other options and it's perfect.

I'm closing the request.

Cheers!