Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 23:29 23 Nov 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : bug in LEFT$, RIGHT$ & MID$

Author Message
BobDevries

Senior Member

Joined: 08/06/2011
Location: Australia
Posts: 266
Posted: 01:49am 31 Aug 2011
Copy link to clipboard 
Print this post

Hi all,

I just now found a bug in the LEFT$() and RIGHT$() and MID$() functions.

Try this:

PRINT LEFT$("hello",1)
PRINT RIGHT$("hello",1)
PRINT MID$("hello,3,1)


Notice that it prints a white block beside the correct output?

Regards,
Bob Devries
Dalby, QLD, Australia
 
BobDevries

Senior Member

Joined: 08/06/2011
Location: Australia
Posts: 266
Posted: 01:59am 31 Aug 2011
Copy link to clipboard 
Print this post

Hi all,

just another observation...

the line:

PRINT MID$("hello",3,2)


works as expected; no white block. So it seems to be only on single-character output?

Regards,

Bob Devries
Dalby, QLD, Australia
 
BobDevries

Senior Member

Joined: 08/06/2011
Location: Australia
Posts: 266
Posted: 02:09am 31 Aug 2011
Copy link to clipboard 
Print this post

Me again :)

It appears that it's sort-of my mistake... I'll explain....

I often run my analog clock programme, and it has a white border about 2 characters wide. If I ESCAPE out of it, the border is left on the screen. Then when a single character is printed, what's left of the border is immediately behind the character on the screen.

Now, IMHO, the print routine *should* clear to the end of the line *unless* a semi-colon is appended to the command.

so,

PRINT "L"

should clear the screen line to the right, and

PRINT "L";

should not.

comments?

Regards,

Bob Devries
Dalby, QLD, Australia
 
aargee
Senior Member

Joined: 21/08/2008
Location: Australia
Posts: 255
Posted: 05:41am 31 Aug 2011
Copy link to clipboard 
Print this post

Bob,

I think from memory, that most Basics did not clear to the end of the line. I clearly remember having to do a CLS if I wanted a clean slate to work on, now whether it should be implemented in MM Basic, that maybe one for the wish list.
For crying out loud, all I wanted to do was flash this blasted LED.
 
BobDevries

Senior Member

Joined: 08/06/2011
Location: Australia
Posts: 266
Posted: 05:58am 31 Aug 2011
Copy link to clipboard 
Print this post

Hi aargee,

Well, I was comparing against my Tandy Colour Computer 3, which definitely does clear the rest of the line unless the print is terminated with a semi-colon.

Regards,

Bob Devries
Dalby, QLD, Australia
 
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024