Forum
Line Feed and ",," bug (*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: Line Feed and ",," bug (*solved*) (/showthread.php?tid=445)



Line Feed and ",," bug (*solved*) - LCD - 03-25-2012

Just one small question. How to make Line Feed with Print with ZXBC?
in Sinclair BASIC this worked:
Code:
Print "Line1" ' "Line2"
But in ZXBC the '-Character is used for REM, and ´ and ` are illegal characters for the compiler.

It looks also like I stepped on a bug in release 809 (maybe in earlier versions too:
Code:
Print at 0,0;"Spectrum users to celebrate the",,"30th birthday of our Speccy.";

the double coma should leave one line free, but in fact it prints the character "3" at Position x=31,y=1, where it should be position x=0,y=2.


Re: Line Feed and ",," bug - boriel - 03-25-2012

LCD Wrote:Just one small question. How to make Line Feed with Print with ZXBC?
in Sinclair BASIC this worked:
Code:
Print "Line1" ' "Line2"
But in ZXBC the '-Character is used for REM, and ´ and ` are illegal characters for the compiler.
This was discussed in other thread I think. It was decided to use ' as a REM alternative, because it's widely extended and it's almost a standard (e.g. FreeBasic, Visual Basic, etc).
We concluded to use CHR$(13) instead. So use:
Code:
PRINT "Line1"; CHR$(13); "Line2"
instead.
LCD Wrote:It looks also like I stepped on a bug in release 809 (maybe in earlier versions too:
Code:
Print at 0,0;"Spectrum users to celebrate the",,"30th birthday of our Speccy.";

the double coma should leave one line free, but in fact it prints the character "3" at Position x=31,y=1, where it should be position x=0,y=2.
I will check it out. There were a complete PRINT work out some versions ago to fix a bug: Sinclair BASIC crashed upon exit or gave an error. Also it this change made the routine faster and shorter.

Update: It should print the "3" at x = 16, y = 1!!! (execute it in Sinclair BASIC). And yes, it's bugged anyway.


Re: Line Feed and ",," bug - LCD - 03-25-2012

boriel Wrote:
LCD Wrote:Just one small question. How to make Line Feed with Print with ZXBC?
in Sinclair BASIC this worked:
Code:
Print "Line1" ' "Line2"
But in ZXBC the '-Character is used for REM, and ´ and ` are illegal characters for the compiler.
This was discussed in other thread I think. It was decided to use ' as a REM alternative, because it's widely extended and it's almost a standard (e.g. FreeBasic, Visual Basic, etc).
We concluded to use CHR$(13) instead. So use:
Code:
PRINT "Line1"; CHR$(13); "Line2"
instead.
Thanks, sometime I dont see the forest because of all the trees...
But by replacing it with:
Code:
Print "Line1"+chr(10)+"Line2"
I saved over 10 Bytes per line... No idea why exactly, but very nice.
boriel Wrote:
LCD Wrote:It looks also like I stepped on a bug in release 809 (maybe in earlier versions too:
Code:
Print at 0,0;"Spectrum users to celebrate the",,"30th birthday of our Speccy.";

the double coma should leave one line free, but in fact it prints the character "3" at Position x=31,y=1, where it should be position x=0,y=2.
I will check it out. There were a complete PRINT work out some versions ago to fix a bug: Sinclair BASIC crashed upon exit or gave an error. Also it this change made the routine faster and shorter.

Update: It should print the "3" at x = 16, y = 1!!! (execute it in Sinclair BASIC). And yes, it's bugged anyway.
Thats right, it should put it at x=16,y=1. I checked it in emulator with two different strings.


Re: Line Feed and ",," bug - boriel - 03-25-2012

I think I have fixed it.
Can you download an check 1.2.9-s815, please? Try and tell me Smile


Re: Line Feed and ",," bug - LCD - 03-26-2012

boriel Wrote:I think I have fixed it.
Can you download an check 1.2.9-s815, please? Try and tell me Smile
Jose, you are really fast... I will check it when I'm back at home.
So my next game is on the way, I think Smile. This time it will be maybe a little "Mojonish" (NSFW).

Edit: Checked it, this bug is fixed!