14. Star commands in a program ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ It is sometimes useful to be able to use the 'Star' Machine Operating System's commands from inside a program; eg *KEY, *DISC, *CAT etc. These routines, written as Procedures, will allow you to do just that. Line 10 is only to demonstrate the Procedure, which you would call from your main program. (The best way to do this to test for the '*' key being pressed. The Procedure itself does not require this, as "CAT" is assumed to be "*CAT".) If you want to *CAT a cassette, then you would have to press to finish, so you need to use ON ERROR GOTO to avoid coming out of the program altogether. The LOCAL statement is so that you can use the variables X%, Y% and Z% in the rest of your program, without any clash. However, it might be wise to avoid them anyway, as Escaping from the Procedure could cause odd things to happen. You could substitute any integer variable for Z%, but you must use X% and Y%. The Procedure as it stands works on all BASIC versions, except BAS128 *, and with the alterations shown to the right, it works on all BASIC versions except BASIC-1. * NB: BAS128 is for the B+/Master/Compact only. 10 PROCcommand:PRINT"Done it!":END 20 : 1000 DEFPROCcommand:LOCAL X%,Y%,Z% DEFPROCcommand:LOCAL C$ 1010 DIM Z%-1:PRINT"Enter MOS command" PRINT"Enter MOS command" 1020 INPUT"*"$Z% INPUT"*"C$ 1030 X%=Z%:Y%=Z%DIV256:CALL &FFF7 OSCLI(C$) 1040 ENDPROC ENDPROC