fastbasic icon indicating copy to clipboard operation
fastbasic copied to clipboard

CONST...

Open Szafir74 opened this issue 5 years ago • 3 comments

Hi

You can add the command: CONST?

Szafir74 avatar Jan 06 '21 11:01 Szafir74

Hi!

Sorry for not replying earlier.

You can add the command: CONST?

What is the command CONST? What does it do?

dmsc avatar Jan 10 '21 13:01 dmsc

Constants can be used to store values that don't change during the execution of your program.

CONTS NAME="ATARI" CONST SCREEN_ADR=88

PRINT "I LOVE ",NAME scrptr=DPEEK(SCREEN_ADR)

Szafir74 avatar Jan 10 '21 21:01 Szafir74

Hi!

Constants can be used to store values that don't change during the execution of your program.

CONTS NAME="ATARI" CONST SCREEN_ADR=88

PRINT "I LOVE ",NAME scrptr=DPEEK(SCREEN_ADR)

This is already possible for assembly defines, but only in the PC compiler, not in the Atari IDE:

  sprt = DPEEK(@@SAVMSC)

The @ symbol marks a "word" constant, the @@ symbol is a "byte" constant.

Adding this to the Atari IDE would use a fair amount of space, as the values should be stored somewhere to be patched when used, but could be implemented the same way as DATA are currently used.

I will tough about this, and keep the bug open.

Thanks!

dmsc avatar Jan 17 '21 01:01 dmsc