Jump to content
IGNORED

Calculating time


JPC531

Recommended Posts

I just started playing around with Extended Basic to see what the TI-99/4A can do.

I made a simple program where I want to see how many words can be entered in one minute, but I do not see any Basic commands for time.

On the TI-99 do you just have to estimate based on how long each instruction takes to run? Not sure how I would do that since the number of words would be different every time it is run.

How do you handle a time count down?

Link to comment
Share on other sites

Yes, the screen time-out counter. How long would it take for it to go from 0 to >FFFF? That would be the maximum time interval that could be counted. Problem is there is no POKE function in XB, so one would not be able to reset the timer before starting the word count.

Link to comment
Share on other sites

Yes, the screen time-out counter. How long would it take for it to go from 0 to >FFFF? That would be the maximum time interval that could be counted. Problem is there is no POKE function in XB, so one would not be able to reset the timer before starting the word count.

 

The screen timeout counter steps by 2 at each interrupt, so 32768/3600 = 9.1 minutes.

 

In XB, you use CALL LOAD() to poke byte values into RAM.

 

...lee

Link to comment
Share on other sites

This will be near-impossible to do without assembly language support to access the 9901 timer.

To clarify, will you be timing at rest or in motion? There might be some complicating factors at play here ;)

 

 

 

The screen timeout counter steps by 2 at each interrupt, so 32768/3600 = 9.1 minutes.

 

In XB, you use CALL LOAD() to poke byte values into RAM.

 

...lee

 

Timing would be in motion. I do want to try assembly, but I wanted to see what is possible in Basic first. I think I can handle a peek and poke though.

At least I know that I didn't miss anything easy :)

Link to comment
Share on other sites

Yes, the screen time-out counter. How long would it take for it to go from 0 to >FFFF? That would be the maximum time interval that could be counted. Problem is there is no POKE function in XB, so one would not be able to reset the timer before starting the word count.

GKXB, Super XB have a CALL LOAD or CALL PEEK,

 

Problem is both require CALL INIT to access.

 

RXB does not require a CALL INIT to use CALL LOAD or CALL PEEK this really speeds up access and ez to use.

Link to comment
Share on other sites

 

The screen timeout counter steps by 2 at each interrupt, so 32768/3600 = 9.1 minutes.

 

In XB, you use CALL LOAD() to poke byte values into RAM.

 

...lee

 

Actually using the timeout counter won't work because it keeps getting reset while a program is running and only starts counting when the computer is idle. A quick test in Classic99 and its debugger confirmed that.

Link to comment
Share on other sites

 

 

 

Timing would be in motion. I do want to try assembly, but I wanted to see what is possible in Basic first. I think I can handle a peek and poke though.

At least I know that I didn't miss anything easy :)

 

I was being obnoxious here. I was referring to time dilatation with motion :grin:

Link to comment
Share on other sites

Actually using the timeout counter won't work because it keeps getting reset while a program is running and only starts counting when the computer is idle. A quick test in Classic99 and its debugger confirmed that.

 

I actually was not suggesting using the timeout counter—just answering the question. The timeout counter is incremented by 2 at every VDP interrupt. It is reset only when a keystroke is detected by KSCAN, the console’s keyboard routine.

 

...lee

Link to comment
Share on other sites

In my test, the timer kept getting reset while a short program was running even without any key presses...

 

Yes that's also what I found.

 

I then tried for fun to see if I could add my own ISR hook and counter using pokes only. It seems to be working but for some reason it's counting too slowly.

XAS99 CROSS-ASSEMBLER   VERSION 1.7.2
**** **** ****     > isr.a99
0001               	aorg >83b8
0002 83B8 05A0  34 	inc @cnt
     83BA 83BE 
0003 83BC 045B  20 	rt
0004 83BE 0000     cnt data 0
0005               

10 CALL INIT
15 REM CREATE THE ROUTINE
20 CALL LOAD(-31816,5,160,131,190,4,91)
25 REM HOOK INTO ISR
30 CALL LOAD(-31804,131,184)
35 REM READ COUNTER
40 CALL PEEK(-31810,MSB,LSB)
50 TIME=(MSB*256+LSB)/60
60 PRINT INT(TIME)
70 GOTO 40

  • Like 2
Link to comment
Share on other sites

In my test, the timer kept getting reset while a short program was running even without any key presses...

 

Yes that's also what I found.

...

 

My bad. :P I just checked the console code and, indeed, the VDP screen timeout timer, >83D6, is reset for each and every Basic statement executed. Sorry about that.

 

However, what I said about KSCAN still obtains for any ALC (and TI Forth, fbForth and, I believe, TurboForth and Camel99 Forth) program that does not explicitly change >83D6, i.e., >83D6 will not be reset until a new keystroke is detected by KSCAN.

 

...lee

Link to comment
Share on other sites

 

 

Yes that's also what I found.

 

I then tried for fun to see if I could add my own ISR hook and counter using pokes only. It seems to be working but for some reason it's counting too slowly.

XAS99 CROSS-ASSEMBLER   VERSION 1.7.2
**** **** ****     > isr.a99
0001               	aorg >83b8
0002 83B8 05A0  34 	inc @cnt
     83BA 83BE 
0003 83BC 045B  20 	rt
0004 83BE 0000     cnt data 0
0005               

10 CALL INIT
15 REM CREATE THE ROUTINE
20 CALL LOAD(-31816,5,160,131,190,4,91)
25 REM HOOK INTO ISR
30 CALL LOAD(-31804,131,184)
35 REM READ COUNTER
40 CALL PEEK(-31810,MSB,LSB)
50 TIME=(MSB*256+LSB)/60
60 PRINT INT(TIME)
70 GOTO 40

 

Print scrolls the screen, and scrolling the screen takes more than one frame in BASIC/XB. During the screen scroll, interrupts are blocked. You can see it happen with a moving sprite, too.

  • Like 2
Link to comment
Share on other sites

 

Print scrolls the screen, and scrolling the screen takes more than one frame in BASIC/XB. During the screen scroll, interrupts are blocked. You can see it happen with a moving sprite, too.

Try RXB:

10 CALL INIT
15 REM CREATE THE ROUTINE
20 CALL LOAD(-31816,5,160,131,190,4,91)
25 REM HOOK INTO ISR
30 CALL LOAD(-31804,131,184)
35 REM READ COUNTER
40 CALL PEEK(-31810,MSB,LSB)
50 CALL HPUT(INT((MSB*256+LSB)/60)
60 GOTO 40

Link to comment
Share on other sites

 

Print scrolls the screen, and scrolling the screen takes more than one frame in BASIC/XB. During the screen scroll, interrupts are blocked. You can see it happen with a moving sprite, too.

Are you talking about the screen FREEZE for a split second?

Or the output issues?

25

25

25

25

21

25

25

25

26

26

Edited by 1980gamer
Link to comment
Share on other sites

 

 

Yes that's also what I found.

 

I then tried for fun to see if I could add my own ISR hook and counter using pokes only. It seems to be working but for some reason it's counting too slowly.

XAS99 CROSS-ASSEMBLER   VERSION 1.7.2
**** **** ****     > isr.a99
0001               	aorg >83b8
0002 83B8 05A0  34 	inc @cnt
     83BA 83BE 
0003 83BC 045B  20 	rt
0004 83BE 0000     cnt data 0
0005               

10 CALL INIT
15 REM CREATE THE ROUTINE
20 CALL LOAD(-31816,5,160,131,190,4,91)
25 REM HOOK INTO ISR
30 CALL LOAD(-31804,131,184)
35 REM READ COUNTER
40 CALL PEEK(-31810,MSB,LSB)
50 TIME=(MSB*256+LSB)/60
60 PRINT INT(TIME)
70 GOTO 40

 

 

This works in Classic99, but JS99er.net doesn't like it

Link to comment
Share on other sites

Are you talking about the screen FREEZE for a split second?

 

I didn't run the code, so I guess the freeze. ;) If you're running interrupts in XB and you scroll the screen, it will miss a few frames. ;)

 

I find it easiest to see with a sprite - you can visibly see the motion stutter:

 

 

10 CALL SPRITE(#1,65,3,100,100,0,50)
20 INPUT A$
30 PRINT : : : : : : : : : :
40 GOTO 20
Link to comment
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...