TI and TI$ Basic Variables

All aspects of programming on the Commander X16.
Post Reply
delMar
Posts: 6
Joined: Sun Oct 10, 2021 8:06 pm

Question TI and TI$ Basic Variables

Post by delMar »

On the C64 and C128, TI$ contains seconds in the form of a 6-character long string.
So, it's value changes every second.
Setting this variable to "000000" also resets TI to Zero

On the X16's R41 emulator, TI$ is always "000000".
Is this emulator behavior, or will this also be the case on the real machine?

Sorry if this has been discussed before, the forum search only brought up that the terms time, ti or ti$ are too short or too common to search for.

Thanks!
Edmond D
Posts: 489
Joined: Thu Aug 19, 2021 1:42 am

Re: TI and TI$ Basic Variables

Post by Edmond D »

Hi,

ti$ and ti work in the R38 emulator (I've not upgraded yet.) You can see it working on the old online
editor here- https://x16.tmp2k.com with runs that release.

I do remember that there was some discussion somewhere about it being broken, but as you found out the search is being a little difficult. I tried to find the discussion via the search, but ran into the same problems you did.

I searched on the word "bug" and got 401 responses; "bug time" ignored the word time and gave the same results, and "Bug Print" gave a reasonable amount of results (25) but not the post I was looking for.

Looking at the emulator's bug tracker I found this - https://github.com/commanderx16/x16-emulator/issues/384 but it's marked closed. Perhaps one of the developers in this forum can elaborate on the TI$ issue.

As for the search on the forum being somewhat difficult, I've flagged your post suggesting the search might be improved. Perhaps reporting it directly might help too.
TomXP411
Posts: 1781
Joined: Tue May 19, 2020 8:49 pm

Re: TI and TI$ Basic Variables

Post by TomXP411 »

The search function works as intended. You can't search for a 3-letter word; that has been a "feature" of phpBB for as long as I can remember.

As to the clock: TI$ now reads from a real time clock, which needs to be enabled in the emulator with the -rtc switch on the command line. The Commander hardware will have a dedicated, battery-run clock chip, which has some significant benefits over the Jiffy clock on Commodore computers.

In the Commodore KERNAL, this is known as the Jiffy clock. This clock is actually a software clock and is advanced as part of the interrupt service handler that fires 60 times a second. Among other things, this service handler also scans the keyboard and joysticks, something that we don't have or need on the Commander. Instead, the Commander's keyboard is connected through a PS/2 port with its own microcontroller. Neither the VIA nor the keyboard controller are actually emulated by the emulator; instead, the emulator directly stuffs data into the system to handle keyboard, mouse, and game pad input.

TI$ was never all that accurate, anyways: any time interrupts are disabled, TI$ will lose time. That meant losing seconds or minutes at a time when reading from cassette, and a few ticks are also lost during IEC bus access, so every time one loaded a file or printed a document, TI$ would lose ticks.

This is documented in the emulator's manual, which you may have skipped, in favor of just firing it up and playing. (I missed it, too.) I'd suggest reading through the emulator's manual, which has a few things you may have missed. At the very least, be familiar with how to set command line switches for different things.
Edmond D
Posts: 489
Joined: Thu Aug 19, 2021 1:42 am

Re: TI and TI$ Basic Variables

Post by Edmond D »

Thanks to TomXP411 for the very knowledgable response to the issue of why TI$ doesn't seem to work in the R41 emulator without setting the right command line parameter. I'm using the older emulator on a MAC with a shortcut on my dock, so when I launch it I just click, rather than type something in. I assume whatever setup I have enables the RTC. It may be a lazy way of doing things, but it meets my needs at the moment (playing R38 games and dabbling in BASIC & ASM programming.)

The emulator is a great tool to have. It's NOT a 100% replica of what the real X16 will be, but that's understandable given the many differences between a modern 64-bit computer and an 8-bit system. Having it means there is a sizeable knowledge base and software should be readily available for or just after the launch date. These two points translate into a product I want to own. Meanwhile I've gotten a lot of enjoyment from the emulator and the community so far.

As for the search, I've not spent much time with phpBB; I can accept its "features."
So thanks to TomXP411 and all the other community members who have donated time & effort to make the X16 a success.
delMar
Posts: 6
Joined: Sun Oct 10, 2021 8:06 pm

Re: TI and TI$ Basic Variables

Post by delMar »

Thanks for your answers, that helps :-)
Post Reply