Page 1 of 1

Suppressing the "?" prompt when using INPUT

Posted: Tue Jun 27, 2023 4:47 am
by Martin Schmalenbach
Back in the day, on the C64, POKE 19,32 would suppress the "?" prompt that appeared whenever the BASIC INPUT command was used.

This doesn't work on the X16, but given how very similar the 2 versions of BASIC are, is there the same capability in the X16, and if so, what is it?

Thanks in advance.

Re: Suppressing the "?" prompt when using INPUT

Posted: Tue Jun 27, 2023 6:16 am
by JimmyDansbo
In the current kernle (r43) you should be able to get the same result with POKE $3DD,32

According to the C64 memory map, location 19 ($13) is the current IO channel. Called CHANNL. I searched the .sym files in the current emulator for that name and found that it points to address $3DD.

I did a quick test and the questionmark is gone if you poke 32 to $3DD. It may have other sideeffects.

Re: Suppressing the "?" prompt when using INPUT

Posted: Tue Jun 27, 2023 7:02 am
by Martin Schmalenbach
Thanks very much!

Re: Suppressing the "?" prompt when using INPUT

Posted: Tue Jun 27, 2023 8:08 am
by TomXP411
You don't need any POKEs. Just use the LINPUT command, instead.

LINPUT (short for LINE INPUT in other BASIC dialects) has two differences from the regular input command:
1. It does not parse commas, semicolons, or other separate characters. Instead, they're just part of the input string.
2. It does not print the ?
10 PRINT "TYPE A,B: ";
20 LINPUT A$
30 PRINT "YOU TYPED [";A$;"]"
READY.

TYPE A,B:
YOU TYPED [A,B]

Re: Suppressing the "?" prompt when using INPUT

Posted: Tue Jun 27, 2023 10:38 pm
by Martin Schmalenbach
TomXP411 wrote: Tue Jun 27, 2023 8:08 am You don't need any POKEs. Just use the LINPUT command, instead.

LINPUT (short for LINE INPUT in other BASIC dialects) has two differences from the regular input command:
1. It does not parse commas, semicolons, or other separate characters. Instead, they're just part of the input string.
2. It does not print the ?
10 PRINT "TYPE A,B: ";
20 LINPUT A$
30 PRINT "YOU TYPED [";A$;"]"
READY.

TYPE A,B:
YOU TYPED [A,B]
Ooh! Much better & more useful, especially for my compiler, editing the source code!

Thanks!

Re: Suppressing the "?" prompt when using INPUT

Posted: Tue Jun 27, 2023 10:58 pm
by Martin Schmalenbach
It looks like an empty line response when using LINPUT returns a single character, namely the space character, not an empty string or an EOL string. This is the same as actually returning an explicitly typed space character.

In fact, entering any number of 1 or more spaces ONLY, returns a single space character, and entering no characters at all returns a single space character only.

Is this a bug or designed to be this way?
I'm sure I'm not alone in wanting this to return either an empty string (preferred) or an EOL character.

Re: Suppressing the "?" prompt when using INPUT

Posted: Wed Jun 28, 2023 2:14 am
by mobluse
Yes, it should work that way: 'Due to how the editor works, an empty line will return " "– a string with a single space, and trailing spaces are not preserved.'
See: https://github.com/X16Community/x16-doc ... .md#linput

I agree that it is strange that it leaves one space when the input is empty or just spaces, but it's good that it removes trailing spaces. If it had removed only trailing spaces it would work on A$ as INPUT A$ followed by A$=RTRIM$(A$). RTRIM$() exists in some BASICs and is similar to rtrim() in PHP.