RE: A82: Detecting ROM version


[Prev][Next][Index][Thread]

RE: A82: Detecting ROM version



On Tuesday, July 01, 1997 9:40 AM, Thomas J. Hruska[SMTP:thruska@tir.com] wrote:
> Here is the program I wrote using your idea (don't compile or run it as it
> will crash your calculator):
>
> <snip>
> 
> Is there anything wrong with my code?  I had to change ld A,$7FFF because
> it compiled with errors to ld A,($7FFF) which I think is the correct way to
> put it (if you want the value and not the address stored into A).
> Displaying and clearing the screen seems to pose no problem so I believe
> that your code is incorrect.  Also, the compiled program doesn't show up in
> the EXEC program listing (all my others do).  Any other suggestions?

Well, there was one thing wrong with your code:  TX_CHARPUT will display the ASCII character, not the numerical value of the byte it found.  To display the decimal value at ($7FFF) (yes, you're correct, parentheses stand for indirection), you should load L with ($7FFF), and H with 0, and then ROM_CALL(D_HL_DECI).  The other problem wasn't your fault... it seems that the coders of the shells (well at least Ash... I didn't check OS-82, but it's probably the same problem), don't save the ROM page when they run a program, so you have to do it yourself.  Here's the fixed code... it compiles correctly and runs fine on ASH 2.0... (BTW, my calc, ROM 16, shows 198... perhaps yours is different).

;;;;;;;;;;;;;;;;;;;;;Cut Here;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
#include "ti82.h"

.ORG 0
.DB "Test ROM Ver.",0

  in    A, (2)
  push  AF
  ROM_CALL(CLEARLCD)
  ld    HL, 0                   ; 0 -> l, 0 -> h
  ld    (CURSOR_POS), HL        ; l -> (CURSOR_ROW), h -> (CURSOR_COL)
  ld A, 10001111b               ; Switch to ROM page 7
  out (2), A
  ld A, ($7FFF)                 ; Now A should have the version byte
                                ; (note, on the TI-85, it's not the same as the
                                ; actual number, so you'll have to have a list of
                                ; equivelancies in your program).
  ld    L, A
  ld    H, 0
  ROM_CALL(D_HL_DECI)           ; Display A
  pop   AF
  out   (2), A

KeyLoop:
  ROM_CALL(GET_KEY)
  and   A
  ret   nz
  jr    KeyLoop

.END
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

	Hope this helps,
	Sam
-- 
Sam Davies <sdavies@mail.trilogy.net>


Follow-Ups: