Playing with strings...

Everything related to BASIC version 1.x (Oric 1 and Atmos) or HYPERBASIC (Telestrat).
Don't hesitate to give your small program samples, technical insights, or questions...
Post Reply
Brana
Flying Officer
Posts: 150
Joined: Fri Nov 30, 2007 8:30 pm
Contact:

Playing with strings...

Post by Brana » Tue May 12, 2009 4:29 pm

Why is this possible:

5 CLS
10 A$=CHR$(129)
20 A$=A$+"BRANA"
30 PRINT A$

(You will see my name, "Brana" in red color on the screen)

But, this is impossible:

5 CLS
10 A$=CHR$(129)
20 A$=A$+"BRANA"
30 A$=A$+CHR$(13) : REM - NEW LINE / RETURN
40 A$=A$+"GAVRIC"
50 PRINT A$

(You will now see only my last name, "Gavric" in white color, but "Brana" seems to get "lost" somewhere?!)

However, if I add the line 60 as follows:

60 PRINT LEN(A$)

I will get 13 in return;

1 CHR$(129)
2 B
3 R
4 A
5 N
6 A
7 CHR$(13)
8 G
9 A
10 V
11 R
12 I
13 C

So, everything appears to be present, but first part of the string ("Brana") now is NOT displayed on screen!

In another words, why can't I add the value of CHR$(13), which is equivalent of "ENTER", to a single string, in order to have that string displayed in two rows on the screen?

I CAN add values of color (example CHR$(133)) to a single string. Why can't it work with CHR$(13) as well?

Best regards
Brana

User avatar
Dbug
Site Admin
Posts: 2321
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Post by Dbug » Tue May 12, 2009 6:47 pm

Try CHR$(10)+CHR$(13).
I believe 13 only put back the cursor at the begining of the line (carriage return) and that you need a cursor down (line feed) to go to the next line.

Brana
Flying Officer
Posts: 150
Joined: Fri Nov 30, 2007 8:30 pm
Contact:

Re: That is! Thank You!

Post by Brana » Tue May 12, 2009 7:04 pm

That is!

Thank You!

Brana

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest