* vs OSCLI

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

* vs OSCLI

Post by MattC » Wed 24 Apr 2019, 19:01

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: 60
Joined: Wed 04 Apr 2018, 06:36

Re: * vs OSCLI

Post by KenDown » Fri 14 Jun 2019, 12:37

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: 1
Joined: Tue 03 Apr 2018, 16:45

Re: * vs OSCLI

Post by Leo » Fri 14 Jun 2019, 17:46

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).

Post Reply