Jump to content
OLD CS1

BASIC and Extended BASIC subprogram and function execution times

Recommended Posts

Is there a list of execution times for subprogram, functions, statements, and operations in TI BASIC or TI Extended BASIC?  ISTR someone way back posting about how long it takes to execute certain mathematical routines, I think during a glancing discussion on the speed of DEF.

  • Like 3

Share this post


Link to post
Share on other sites

I think the execution times depend on the statement, function, subprogram, etc. If you want to know how long something takes, you can set up a loop like this:

10 X=X+1

20 GOTO 10

Run this for a minute, print X and you can find out how long each iteration of an empty loop takes.

Then add what you want to test:

15 S=SIN(.5)

Run that for a minute, print X and you can find out how long each loop takes. Subtract the amount of time for each iteration of an empty loop and you know how long it takes to perform S=SIN(.5)

  • Like 2

Share this post


Link to post
Share on other sites

And then, after a taking a little mental health time for yourself, to recover from the shock, you ask senior_falcon how to use his compiler.  :) 

  • Like 1
  • Haha 2

Share this post


Link to post
Share on other sites

The compiler is a game changer!  Pun intended.

Collision detection works! The single most disappointing part of XB as a 12 year old!  LOL

 

Beyond the speed increases across XB are the new commands he has already added and working on adding The Missing Link stuff also!  

Different Graphic modes etc.

 

ALL Great stuff!  

 

  • Like 3

Share this post


Link to post
Share on other sites
13 minutes ago, 1980gamer said:

The compiler is a game changer!  Pun intended.

Collision detection works! The single most disappointing part of XB as a 12 year old!  LOL

 

Beyond the speed increases across XB are the new commands he has already added and working on adding The Missing Link stuff also!  

Different Graphic modes etc.

 

ALL Great stuff!  

 

Yes, the compiler is all that and a bag of chips, I have used it before, but the compiler is beyond the scope of the question.

Share this post


Link to post
Share on other sites
4 hours ago, senior_falcon said:

I think the execution times depend on the statement, function, subprogram, etc. If you want to know how long something takes, you can set up a loop like this:

10 X=X+1

20 GOTO 10

Run this for a minute, print X and you can find out how long each iteration of an empty loop takes.

Then add what you want to test:

15 S=SIN(.5)

Run that for a minute, print X and you can find out how long each loop takes. Subtract the amount of time for each iteration of an empty loop and you know how long it takes to perform S=SIN(.5)

I always used FOR X=1 TO 1000.

Since it's 1000 loops, you can measure the time, and the number of seconds you get is the number of milliseconds per loop. Run the bare loop first, of course, to measure the FOR..NEXT time.

Of course, in TI BASIC some commands will run you out of patience before they complete - CALL GCHAR is the worst. You can use a shorter loop and multiply the result to get a reasonable estimate. (Say, 1 TO 200, and multiply by 5).

 

Share this post


Link to post
Share on other sites
1 hour ago, OLD CS1 said:

Yes, the compiler is all that and a bag of chips, I have used it before, but the compiler is beyond the scope of the question.

Understood...  Was just Agreeing with TheBF.

51 minutes ago, Tursi said:

I always used FOR X=1 TO 1000.

Since it's 1000 loops, you can measure the time, and the number of seconds you get is the number of milliseconds per loop. Run the bare loop first, of course, to measure the FOR..NEXT time.

Of course, in TI BASIC some commands will run you out of patience before they complete - CALL GCHAR is the worst. You can use a shorter loop and multiply the result to get a reasonable estimate. (Say, 1 TO 200, and multiply by 5).

 

Yes, if we could replace GCHAR with faster linked version... I use this command all the time.  I like thing dynamic and random.

I could replace it in a lot of cases with coordinate lists, but then I need to know everything in advance.

Example:  I did a pacman demo. I could drop a new maze in of any config.  As long as side doors did not move or I could put a variable for each maze for door locations. 

Because GCHAR lets me look for walls.   If I did a list, I would have to do a list for each maze and I am very lazy!

  • Like 1

Share this post


Link to post
Share on other sites
Posted (edited)
2 hours ago, Tursi said:

I always used FOR X=1 TO 1000.

Since it's 1000 loops, you can measure the time, and the number of seconds you get is the number of milliseconds per loop. Run the bare loop first, of course, to measure the FOR..NEXT time.

Of course, in TI BASIC some commands will run you out of patience before they complete - CALL GCHAR is the worst. You can use a shorter loop and multiply the result to get a reasonable estimate. (Say, 1 TO 200, and multiply by 5).

 

Yep, that way is good too and in some ways simpler. I like doing it for one minute because, with my short attention span, I don't have hover over the stop watch trying to be ready for when the program ends. When the minute is up you press "break". But of course then you then have to divide 60 by X to get the milliseconds.

Six of one and twelve dozen of the other, as my buddy Don used to say.

 

(Edit) In TI BASIC GCHAR and HCHAR take about the same amount of time.

Edited by senior_falcon
  • Like 1

Share this post


Link to post
Share on other sites
2 hours ago, Tursi said:

Of course, in TI BASIC some commands will run you out of patience before they complete - CALL GCHAR is the worst. You can use a shorter loop and multiply the result to get a reasonable estimate. (Say, 1 TO 200, and multiply by 5).

I took a another whack at my general input routine.

 

https://atariage.com/forums/blogs/entry/17054-ti-basic-search-for-a-fast-and-easy-input-routine-for-games/

 

The replacement formula in the comment is 2.4 seconds faster per 100 iterations.  Rather considerable.  This got me thinking that a table of execution speeds of TI BASIC elements, including variations of retrieving literals or variables, would be useful to some.

 

Share this post


Link to post
Share on other sites
8 hours ago, senior_falcon said:

(Edit) In TI BASIC GCHAR and HCHAR take about the same amount of time.

Interesting... confirmed.

 

I remember back in the day that a discussion of execution time, and a list of the statements, was in one of the old magazines (which means it must have been in 99er or HCM, cause I didn't have access to Micropendium?) And I was sure that I tested GCHAR against HCHAR specifically.

 

Just goes to show we all carry some misconceptions we learned and it's always worth re-testing if you didn't write it down the first time. ;)

 

Anyway... if anyone has a way to text search, you might be able to find the original article?

 

Share this post


Link to post
Share on other sites
9 hours ago, senior_falcon said:

(Edit) In TI BASIC GCHAR and HCHAR take about the same amount of time.

This may imply that working with variables or literals may carry similar time costs.

Share this post


Link to post
Share on other sites

I think another thing with GCHAR is you have to do something with the returned value.

 

an IF or an ON etc. 

 

HCHAR is what it is!  Well, you could also repeat and slow that command a lot!

 

Share this post


Link to post
Share on other sites
2 hours ago, 1980gamer said:

HCHAR is what it is!  Well, you could also repeat and slow that command a lot!

 

Yeah—but VCHAR should be phenomenally worse on repeats because the VDP Write Address must be set for each and every byte written to VRAM, whereas HCHAR only needs to do it once.

 

...lee

  • Like 3

Share this post


Link to post
Share on other sites
47 minutes ago, Lee Stewart said:

 

Yeah—but VCHAR should be phenomenally worse on repeats because the VDP Write Address must be set for each and every byte written to VRAM, whereas HCHAR only needs to do it once.

 

...lee

Both are pretty poor although VCHAR is a little worse. In the program below, for HCHAR there are 69 loops in 1 minute, for VCHAR there are 47


10 X=X+1
20 CALL VCHAR(1,1,42,768)
30 GOTO 10

Share this post


Link to post
Share on other sites
1 hour ago, senior_falcon said:

Both are pretty poor although VCHAR is a little worse. In the program below, for HCHAR there are 69 loops in 1 minute, for VCHAR there are 47


10 X=X+1
20 CALL VCHAR(1,1,42,768)
30 GOTO 10

I have always wondered how HCHAR was implemented. I can't think of a reason for it to be that slow unless they wanted the timing to look like VCHAR. (?)

Share this post


Link to post
Share on other sites

It's written in GPL. Looks like FMT is used to display the characters. (Rich can explain about FMT - I know nothing about it) An XML routine would have perked this up quite a bit.

  • Like 2

Share this post


Link to post
Share on other sites
12 hours ago, TheBF said:

I have always wondered how HCHAR was implemented. I can't think of a reason for it to be that slow unless they wanted the timing to look like VCHAR. (?)

Spoiler

<0090>               ***********************************************************
<0091>               * SUBROUTINE TO GET ROW, COLUMN VALUES                     
<0092>               ***********************************************************
<0093>               * RXB PATCH CODE
<0094> ACA9 06,AC,89 GPHV   CALL LPAR              Insure '(', parse, insure ','
<0095>               * RXB PATCH CODE
<0096> ACAC 0F,7E    GPHVRC XML  SPEED             Insure in range
<0097> ACAE 02              BYTE RANGE           *  of 1 - 24
<0098> ACAF 01              BYTE 1
<0099> ACB0 00,18           DATA 24
<0100> ACB2 92,4B           DEC  @FAC1             Adjust to internal range
<0101> ACB4 BC,02,7F        ST   @XPT,@MNUM
<0102> ACB7 BC,7E,4B        ST   @FAC1,@YPT        Set row pointer
<0103> ACBA 0F,7E           XML  SPEED             Get column value
<0104> ACBC 01              BYTE PARCOM          *  and insure a comma
<0105> ACBD 0F,7E           XML  SPEED             Insure in range
<0106> ACBF 02              BYTE RANGE           *  of 1 to 32
<0107> ACC0 01              BYTE 1
<0108> ACC1 00,20           DATA 32
<0109> ACC3 92,4B           DEC  @FAC1             Internal range: 0 - 31
<0110> ACC5 BC,7F,4B        ST   @FAC1,@XPT        Set column pointer
<0111> ACC8 00              RTN

<0119>               * Get ROW, COLUMN VALUES AND NUMBER OF CHARACTERS
<0120> ACD6 06,AC,A9 HVCHR  CALL GPHV              Get X, Y VALUES
<0121> ACD9 0F,74           XML  PARSE
<0122> ACDB B6              BYTE RPARZ
<0123> ACDC 06,A9,95        CALL INTARG
<0124> ACDF A2,4B,60        ADD  OFFSET,@FAC1
<0125> ACE2 BC,00,4B        ST   @FAC1,@VAR0       SAVE THE CHARACTER
<0126> ACE5 BF,4A,00        DST  1,@FAC            ASSUME 1 CHARACTER
       ACE8 01
<0127> ACE9 D6,42,B6        CEQ  RPARZ,@CHAT       If not right parenthesis
<0128> ACEC 6C,F8           BS   GAC95
<0129> ACEE 0F,7E           XML  SPEED             Must be
<0130> ACF0 00              BYTE SYNCHK          *   at a
<0131> ACF1 B3              BYTE COMMAZ          *    comma
<0132> ACF2 0F,74           XML  PARSE             # OF CHARACTERS
<0133> ACF4 B6              BYTE RPARZ
<0134> ACF5 06,A9,95        CALL INTARG            FLOATING TO INTEGER
<0135> ACF8 00       GAC95  RTN
<0136>               ***********************************************************

<0252>               ***********************************************************
<0253>               *                SUBPROGRAM FOR 'HCHAR'                    
<0254>               ***********************************************************
<0255> AB03 06,AC,D6 HCHAR  CALL HVCHR             Get X, Y values character, # 
<0256> AB06 8F,4A           DCZ  @FAC              If 0 characters
<0257> AB08 6B,12           BS   HCHAR2
<0258> AB0A 08,E0,00 HCHAR1 BYTE >08,>E0,>00,>FB  * FMT '@VAR0'   Display horizo
       AB0D FB
<0259> AB0E 93,4A           DDEC @FAC              Done yet?
<0260> AB10 4B,0A           BR   HCHAR1            No, finish it
<0261>               * RXB PATCH CODE
<0262> AB12 D6,42,B3 HCHAR2 CEQ  COMMAZ,@CHAT
<0263> AB15 6B,03           BS   HCHAR
<0264> AB17 BC,7F,02 XPTRTN ST   @MNUM,@XPT        Restore X-pointer

99/4 GPL-ASSEMBLER (Pass 3) correct                                   PAGE 0036 
EQUATES EXEC-359
<0265> AB1A 0F,7E    LNKRTN XML  SPEED             Must be at
<0266> AB1C 00              BYTE SYNCHK        *     a right
<0267> AB1D B6              BYTE RPARZ         *      parenthesis
<0268> AB1E 06,6A,78 LNKRT2 CALL CHKEND            Check end of statement
<0269> AB21 4D,BA           BR   ERRSYN            If not end-of-stmt , error
<0270> AB23 06,00,12        CALL RETURN            Return to caller
<0271>               ***********************************************************
<0272>               *                SUBPROGRAM FOR 'VCHAR'                    
<0273>               ***********************************************************
<0274> AB26 06,AC,D6 VCHAR  CALL HVCHR             Get X, Y values character, # 
<0275> AB29 8F,4A           DCZ  @FAC              If 0 characters
<0276> AB2B 6B,3F           BS   VCHAR2
<0277> AB2D 08,E0,00 VCHAR1 BYTE >08,>E0,>00,>9E,>FB * FMT '@VAR0',>31 Display v
       AB30 9E,FB
<0278> AB32 93,4A           DDEC @FAC              Done yet?
<0279> AB34 6B,3F           BS   VCHAR2            Yes, return
<0280> AB36 8E,7E           CZ   @YPT              If not at start of colunm
<0281> AB38 4B,2D           BR   VCHAR1
<0282> AB3A 90,7F           INC  @XPT              Move X-ptr to right one colun
<0283> AB3C 05,AB,2D        B    VCHAR1
<0284>               * RXB PATCH CODE
<0285> AB3F D6,42,B3 VCHAR2 CEQ  COMMAZ,@CHAT
<0286> AB42 6B,26           BS   VCHAR
<0287> AB44 4B,17           BR   XPTRTN
<0288>               ***********************************************************

Both HCHAR and VCHAR uses the same type of main core command is FMT @>8300 in other words put byte at >8300 to Row & Col loaded.

i.e 

HCHAR1 BYTE >08,>E0,>00,>FB  * FMT '@VAR0'   Display horizontal

or

VCHAR1 BYTE >08,>E0,>00,>9E,>FB * FMT '@VAR0',>31 Display vertical

 

This is RXB 2001 source code so there are a few modification from normal XB that only allows 1 HCHAR or VCHAR per program line.

i.e. RXB CALL HCHAR(row,column,character,repetition,row,column,character,repetion,row,column,character,repetition)

  • Like 4

Share this post


Link to post
Share on other sites
57 minutes ago, RXB said:

Both HCHAR and VCHAR uses the same type of main core command is FMT @>8300 in other words put byte at >8300 to Row & Col loaded.

 

So, basically, FMT puts one character at a time on the screen by setting the VRAM address for each byte before writing it to VRAM, the only difference between HCHAR and VCHAR being how the next position is calculated. Do I have that right?

 

...lee

  • Like 1

Share this post


Link to post
Share on other sites
13 hours ago, Lee Stewart said:

 

So, basically, FMT puts one character at a time on the screen by setting the VRAM address for each byte before writing it to VRAM, the only difference between HCHAR and VCHAR being how the next position is calculated. Do I have that right?

 

...lee

XPT is >837F and YPT is >837E i.e. ROW & Column these are the GPL row and col and not used for anything else.

GPL has >837D is the character to be read or displayed per YPT:XPT values i.e. row & col values.

 

This is why HCHAR and VCHAR are so slow.

RXB has CALL HPUT(row,col,string) or CALL VPUT that uses strings or numbers or characters.

RXB has CALL HGET(row,col,length,string) or CALL VGET that are fetching strings or number or characters.

  • Like 1

Share this post


Link to post
Share on other sites
On 4/20/2021 at 8:40 PM, senior_falcon said:

It's written in GPL. Looks like FMT is used to display the characters. (Rich can explain about FMT - I know nothing about it) An XML routine would have perked this up quite a bit.

NECRO this as looking at a way to speed up HCHAR and VCHAR in XB.

 

And just to point out there is NO XML in HCHAR or VCHAR which is why it is 100% GPL only, thus why slow.

 

I would like to make it a XML instead to speed this up.

 

  • Like 1

Share this post


Link to post
Share on other sites
7 hours ago, RXB said:

And just to point out there is NO XML in HCHAR or VCHAR which is why it is 100% GPL only, thus why slow.

 

It could be a lot faster and still be written in 100% GPL. Every character that HCHAR/VCHAR puts on the screen is done by retrieving the floating point variable, converting to integer, adding the >60 offset, and then printing on the screen. It could be rewritten so this only happens when the first character is printed. Once that byte is known it doesn't have to be determined again. Of course, doing this in either GPL or as XML means the code is not so compact.

Share this post


Link to post
Share on other sites
On 4/21/2021 at 12:40 AM, senior_falcon said:

An XML routine would have perked this up quite a bit.

I usually understand the technical jargon in this forum but have no idea what “XML” means.

 

Is it something to do with machine language? Or the missing link?

 

For me it means an HTML-like language but I’m sure that’s not it. 

Share this post


Link to post
Share on other sites
12 hours ago, senior_falcon said:

It could be a lot faster and still be written in 100% GPL. Every character that HCHAR/VCHAR puts on the screen is done by retrieving the floating point variable, converting to integer, adding the >60 offset, and then printing on the screen. It could be rewritten so this only happens when the first character is printed. Once that byte is known it doesn't have to be determined again. Of course, doing this in either GPL or as XML means the code is not so compact.

Luckily it only fetches ROW and COLUMN once from Floating Point, and you can speed this up a little bit in GPL by using same routine that fetches in INVERSE.

No need for Floating point in these so you can just read the value 2 bytes that would be integer values converted from floating point XML SPEED

DATA >00EC says check if number or string value and if string error if number 

Spoiler

[4286]               ***********************************************************
[4287]               * CALL INVERSE(char#[,...])                                
[4288]               ***********************************************************
[4289] BC9A 06,A9,81 INVERS     CALL COMB             * INVERSE(CHAR#)
[4290] BC9D 0F,79    INVAGN       XML  PGMCHR
[4291] BC9F D6,42,EC                 CEQ  ALLZ,@CHAT
[4292] BCA2 5C,B6                      BR   INOALL
[4293] BCA4 0F,7E                       XML  SPEED
[4294] BCA6 00,EC                      DATA >00EC
[4295] BCA8 BF,4A,00                  DST  >001E,@FAC    * ALL token?
       BCAB 1E
[4296] BCAC E3,4A,00                  DSLL 3,@FAC
       BCAF 03
[4297] BCB0 BF,54,01                  DST  >01C8,@TEMP1
       BCB3 C8
[4298] BCB4 5C,C4                     BR   INVLP
[4299] BCB6 0F,74    INOALL       XML  PARSE
[4300] BCB8 B6                         BYTE RPARZ
[4301] BCB9 06,BD,75               CALL S1ET9F
[4302] BCBC E3,4A,00               DSLL 3,@FAC
       BCBF 03
[4303] BCC0 BF,54,00                DST  >0004,@TEMP1
       BCC3 04
[4304] BCC4 85,E3,00 INVLP     DINV [email protected]>0300(@FAC)
       BCC7 4A
[4305] BCC8 A3,4A,00              DADD >0002,@FAC
       BCCB 02
[4306] BCCC 93,54                   DDEC @TEMP1
[4307] BCCE 5C,C4                  BR   INVLP
[4308] BCD0 D6,42,B3 INVNOK CEQ  COMMAZ,@CHAT
[4309] BCD3 7C,9D                  BS   INVAGN
[4310] BCD5 4A,96                  BR   LNKRTN
[4311]               ***********************************************************

 

[4370]               *****************************************
[4371] BD75 0F,7E    S1ET9F   XML  SPEED  * CHECK FROM
[4372] BD77 02,1E                 DATA >021E  * 30 TO 159
[4373] BD79 00,9F                 DATA >009F  *
[4374] BD7B 00                     RTN         *
[4375]               ******************************************

I should test this to see if this is true as I have always just taken for granted looking at XB ROMs that it does not do CFI ever.

As the VALUE in FAC is not changed using DEBUG in Classic99 you see >10 if do a CALL INVERSE(32) that is not a Floating Point value.

Well just check with Debugger and if you put a break point at >12B8 (this is CFI) it never breaks so never used CFI XML in console routine.

Thus I should change most RXB routines that do not need Floating Point to this version and that should speed up XB by a marked amount.

Share this post


Link to post
Share on other sites
3 hours ago, chue said:

I usually understand the technical jargon in this forum but have no idea what “XML” means.

 

Is it something to do with machine language? Or the missing link?

 

For me it means an HTML-like language but I’m sure that’s not it. 

In the notes of GPL creation of Extended Basic it says "eXecute Machine Language" as EML was used for "Extended Machine Language" already.

(EML was the reference to the TI Debugger they used at Texas Instruments we have never seen the hardware just heard about)

Thus we got XML instead of EML as that one was taken already.

  • Like 2
  • Thanks 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...