* vs OSCLI

Discussions about the BBC BASIC language, with particular reference to BB4W and BBCSDL
MattC
Posts: 114
Joined: Mon 16 Apr 2018, 06:17

* vs OSCLI

Post by MattC »

Hi.

The 'star' commands can be implemented using the OSCLI command, e.g.

Code: Select all

*FONT Arial,16
[=]
OSCLI "Arial,16"
OSCLI also has the ability to use variables in the call, so can be adapted during runtime, e.g.

Code: Select all

font$ = "Arial,16"
OSCLI font$
However, my question is, are there any other advantages of one over the other, such as speed or error handling?

Matt
KenDown
Posts: 327
Joined: Wed 04 Apr 2018, 06:36

Re: * vs OSCLI

Post by KenDown »

TIME=0
FORi%=0TO20000
*FONT Ariel,48
NEXT
PRINTTIME

TIME=0
FORI%=0TO20000
OSCLI("FONT Ariel,48")
NEXT
PRINTTIME

a$="Ariel,48"
TIME=0
FORI%=0TO20000
OSCLI("FONT "+a$)
NEXT
PRINTTIME

Play around, perhaps substituting other variable for the font name or the font size. As it stands, using the star command is just slightly slower than using OSCLI but using a variable is very slightly faster than using the full string.
Leo
Posts: 16
Joined: Tue 03 Apr 2018, 16:45

Re: * vs OSCLI

Post by Leo »

I don't have a font called Ariel. Did you mean Arial?
Interestingly, for a non-existent font they all take the same (very short) time.
With Arial, OSCLI cases are marginally faster (Results: 96,94,94).