KEY Command Question.

By Hit-Biter

Master (175)

Hit-Biter さんの画像

14-09-2022, 11:39

Hey Guys, Ive started to use the KEY command to 'program' my function keys. Whenever i hit a section of listing with lots of repetition I like to program a few of the function keys to provide me a shortcut. One such command would be PRINT another I see a lot of is DATA. In the example of PRINT however it is often immediately followed by " . Now if i were to configure F1 using KEY1,"PRINT" I also use KEY1," PRINT" which adds the space after the line number then that would work but if i wanted to start the PRINT Statement with the " attached I'd need to use KEY1,"PRINT"" which produces a syntax error because of the way the command is interpreted by the 'bios' ? The double inverted commas does not work. I am wondering if there is any way around this. I'm wondering if there is some ..'i don't know the term'.. flag, perhaps that won't be printed and tells the computer to use the " or any syntax/punctuation. Perhaps something like KEY1,"@PRINT"" where the @ is an instruction to use any added punctuation. Something like in Windows where we use *.txt to search for all filenames ending in .txt. I expect the answer is NO to this but there is no harm in asking.

ログイン/登録して投稿

By mars2000you

Enlighted (6556)

mars2000you さんの画像

14-09-2022, 11:53

Check this page: https://www.msx.org/wiki/KEY

You need to replace the second " by +CHR$(34).

By Briqunullus

Paladin (760)

Briqunullus さんの画像

14-09-2022, 11:52

Try KEY 1, "PRINT " + CHR$(34)

By turbor

Hero (529)

turbor さんの画像

14-09-2022, 16:59

Here is an extra tidbit about MSX-BASIC: When typing in a basic program instead of typing 'PRINT' each time, you can type a single '?' which will be interpreted as PRINT by the basic interpreter. When listing the program all the ?'s will be magically replaced by PRINT.

Even if you type L? it will be replaced by LPRINT in case you want use your printer. Smile

By Hit-Biter

Master (175)

Hit-Biter さんの画像

14-09-2022, 22:10

Thanks Guys. Your all very helpful. 4600 of 4800 entered. Smile All DATA to go now.