I am trying to get a simple z80 asm program to see if a given program is archived. I found a program on TICalc that would toggle between ram and archive and set Ans to what bank it was in. I removed the arc/unarc bcall thingy to get this. However, it only works about half the time. I have no experience at all in z80, so any help will be appreciated.


Code:
; Program Name: TSTARC
; Author(s): ItsJustSomeDude, Harold Aptroot
; Description: Tests if program is archived

.nolist
#include "ti83plus.inc"
.list

   .org userMem-2
   .db $BB,$6D
      bcall(_AnsName)
      bcall(_FindSym)
      inc de
      inc de
      ex de,hl
      ld de,OP1+1
      ldi \ ldi \ ldi \ ldi
      ldi \ ldi \ ldi \ ldi
      ld hl,OP1
      ld (hl),ProgObj
      bcall(_ChkFindSym)
      ld a,b
      bcall(_SetXXop1)
      bcall(_StoAns)      

   ret
What calculator are you running this on? The documentation for _SetXXOP1 says it only works for values 0-99, and values up to 63 (83+), 127 (83+ SE, 84+) or 255 (84+ SE)* are possible for the flash page an archived variable is on, depending on the calculator. It also says there isn't any error checking, so I'd guess you're running on a larger-memory calculator and some of the programs you try searching for are above page 99.

Since you only care about whether a program is archived or not, I'd just return 0 or 1:

Code:
    bcall(_ChkFindSym)
    ld a,b
    or a
    jr nz, archived
    xor a
    jr out
archived:
    ld a,1
out:
    bcall(_SetXXOP1)
    bcall(_StoAns)
    ret

* modulo the few pages at the top of memory that are reserved for the certificate and boot code.
Tari wrote:
What calculator are you running this on?

I am using an 83+. I will try this code in the morning when I get a chance. Thanks. --JustSomeDude

Edit 1: I tried this on emulator, but it just always returns 0 to Ans. I don't know if I am doing the input right. I am guessing that I use Ans for input, but do I need the prefixes? ( and for real, F for prgm, etc.)
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement