Re: A89: HW detection
[Prev][Next][Index][Thread]
Re: A89: HW detection
On Fri, Mar 03, 2000 at 11:42:06 +0100, Niklas Brunlid wrote:
>
> This may be common knowledge (haven't programmed for a while) but is there
> a way to detect the HW version on the calc in software other than asking
> the user?
There are ways to detect everything you're asking about without relying on
volatile RAM variables and/or ROM internals. However, some of the ROM calls
require AMS 2.03 (2.01?).
(All numbers are in decimal.)
There is a ROM call for HW detection in AMS 2.03 at offset 1400 in the
pointer table. It returns the hardware version (1 or 2) in D0.L. This
function has changed from AMS 1.xx and you must be sure that the calc is
running AMS 2.03 before you call it! One way to perform *this* detection is
to check how many entries there are in the pointer table. AMS 2.03 has ~1463
pointers, 1.00 has only ~972.
> Also, how do you detect stuff like AMS version and calc type?
As long as TI doesn't create more calcs compatible to the 89/92+, one way to
detect the calc type is to check the screen size. Offset 188 ('ScrRect') is
a pointer to a SCR_RECT structure (four bytes: x0, y0, x1, y1). This is the
size of the screen excluding the status bar (e.g. 0,0,159,92 on TI89). You
would only use the 'x1'-value though. 'ScrRect' exists in all AMS versions,
so far.
AMS 2.03 has a string (asciiz) pointer at offset 4352. The string is the OS
version in a human-readable fashion and it simply reads "2.03".
> This can be done when compiling? I thought the files weren't separated until
> the linker made them into .89z and .9xz files.
> I don't want to test for calc type at runtime, but if I have to then I will,
> of course.
Since ASM files are identical for the 89 and 92+, I'm afraid you have to do
the checks at runtime. (Unless you are relying on those ... "kernels" of
course. But in that case I don't know what to do!)
/Johan
References: