COCO3 - New line cursor position not being tracked after word wrap

This forum is dedicated to those who want support programming in ugBASIC.
Questo forum è dedicato a chi desidera supporto per programmare in ugBASIC.
Ce forum est dédié à ceux qui souhaitent prendre en charge la programmation en ugBASIC.
Post Reply
jjarrell
Posts: 36
Joined: Tue Jan 28, 2025 5:35 pm

COCO3 - New line cursor position not being tracked after word wrap

Post by jjarrell »

If using a PRINT statement with ;'s and the text wraps, the next PRINT statement will appear directly under the first line of text instead of below where the wrapped text ends.

Code: Select all

CLS
FOR i= 1 TO 20
	PRINT "SOME TEXT";
NEXT
PRINT ""
PRINT "SHOULD BE AT BOTTOM"
WAIT KEY RELEASE
jjarrell
Posts: 36
Joined: Tue Jan 28, 2025 5:35 pm

Re: COCO3 - New line cursor position not being tracked after word wrap

Post by jjarrell »

And the BITMAP ENABLE version only shifts down about 1 pixel after each wrap.

Code: Select all

BITMAP ENABLE
CLS
FOR i= 1 TO 20
	PRINT "SOME TEXT";
NEXT
PRINT ""
PRINT "SHOULD BE AT BOTTOM"
WAIT KEY RELEASE
spotlessmind1975
Site Admin
Posts: 200
Joined: Fri Oct 06, 2023 8:25 pm

Re: COCO3 - New line cursor position not being tracked after word wrap

Post by spotlessmind1975 »

Hi jjarrell, and thank you for your kind bug report!
jjarrell wrote: Fri Jan 31, 2025 4:12 pm If using a PRINT statement with ;'s and the text wraps, the next PRINT statement will appear directly under the first line of text instead of below where the wrapped text ends.
Maybe I didn't understand correctly the issue, but I think it's the expected behavior. The PRINT command without the semicolon will make the cursor move to the next line ("line feed") and to the first column ("carriage return"). This is the BASIC language standard.To obtain the result you expect, instead, you have two alternatives. The first is to print a string that contains a command to move the cursor. For example:

Code: Select all

CLS
FOR i= 1 TO 20
	PRINT "SOME TEXT";
NEXT
PRINT CDOWN$;
PRINT "SHOULD BE AT BOTTOM"
WAIT KEY RELEASE
The alternative is to replace the PRINT command with the CDOWN command:

Code: Select all

CLS
FOR i= 1 TO 20
	PRINT "SOME TEXT";
NEXT
CDOWN
PRINT "SHOULD BE AT BOTTOM"
WAIT KEY RELEASE
Both solutions are equivalent, although the "embedded" version can also be used inside a string, which makes it possible to insert commands into the strings to be executed at each PRINT:

Code: Select all

downALine = CDOWN$
CLS
FOR i= 1 TO 20
	PRINT "SOME TEXT";
NEXT
PRINT downALine;"SHOULD BE AT BOTTOM"
WAIT KEY RELEASE
jjarrell wrote: Fri Jan 31, 2025 4:28 pm And the BITMAP ENABLE version only shifts down about 1 pixel after each wrap.
I tried it but it works fine:

Do you have an example source?
I used this:

Code: Select all

BITMAP ENABLE
downALine = CDOWN$
CLS
FOR i= 1 TO 20
	PRINT "SOME TEXT";
NEXT
PRINT downALine;"SHOULD BE AT BOTTOM"
WAIT KEY RELEASE
jjarrell
Posts: 36
Joined: Tue Jan 28, 2025 5:35 pm

Re: COCO3 - New line cursor position not being tracked after word wrap

Post by jjarrell »

With your suggestion, I was able to get the text version working. But using your suggestion for BITMAP ENABLE, I get something like this.
Image
I tried it with the VCC emulator and the online XROAR one. Are you using the downloaded version of XROAR?
jjarrell
Posts: 36
Joined: Tue Jan 28, 2025 5:35 pm

Re: COCO3 - New line cursor position not being tracked after word wrap

Post by jjarrell »

I'm looking at making a text based game so the graphic text wrap is not something I would be dealing with. If I ever go the graphic route, I'd use a custom routine to parse and locate the text. This behavior just might be the emulator I'm using.
spotlessmind1975
Site Admin
Posts: 200
Joined: Fri Oct 06, 2023 8:25 pm

Re: COCO3 - New line cursor position not being tracked after word wrap

Post by spotlessmind1975 »

Hi jjarrell!
jjarrell wrote: Fri Jan 31, 2025 8:13 pm But using your suggestion for BITMAP ENABLE, I get something like this.
Have you tried downloading the latest COLDFIX I posted today, and forcing a recompilation before running the program?
jjarrell wrote: Fri Jan 31, 2025 8:13 pm I tried it with the VCC emulator and the online XROAR one. Are you using the downloaded version of XROAR?
Yes, I am. I have used both version 1.2 and version 1.8.
Could be a PAL / NTSC issue?
jjarrell wrote: Fri Jan 31, 2025 8:56 pm This behavior just might be the emulator I'm using.
It could be. Just today, with another developer, we discovered that XRoar does not behave the same if you load a binary image (BIN) and a disk image (DSK). If in doubt, try compiling a disk image and running the RUN"LOADER command.
jjarrell
Posts: 36
Joined: Tue Jan 28, 2025 5:35 pm

Re: COCO3 - New line cursor position not being tracked after word wrap

Post by jjarrell »

The latest fix fixed both issues. I used the sandbox. I'll test with the ide later.

Just adding a PRINT statement below the loop like in the original code I posted now works as intended. Actually the quotes are not needed. The cursor now goes down to the next line after the wrapped text and is positioned at position 0.

The word wrap in the graphics screen with BITMAP ENABLED works also. Appears to work in regular and pal version.

I always use the compile to DSK version.

Thanks for your help.
Post Reply