This is an archived, read-only copy of the United-TI subforum , including posts and topic from May 2003 to April 2012. If you would like to discuss any of the topics in this forum, you can visit Cemetech's z80 & ez80 Assembly subforum. Some of these topics may also be directly-linked to active Cemetech topics. If you are a Cemetech member with a linked United-TI account, you can link United-TI topics here with your current Cemetech topics.

This forum is locked: you cannot post, reply to, or edit topics. Z80 & 68k Assembly => z80 & ez80 Assembly
Author Message
Mapar007


Advanced Member


Joined: 04 Oct 2008
Posts: 365

Posted: 08 Dec 2008 11:56:19 am    Post subject:

For my OnCalc supermemo project I had the idea of marking collections the following way to make it easy for users to create them:


Code:
:KNO             (this is like the original supermemo .kno files)
://collection code here//



Now I'd like to generate a list of programs given the first bytes (.db "KNO"), so the user can pick one.

I tried reading the MirageOS disassembly and the Celtic III source, but I didn't manage to find it :oops: :lol:

HELP!
Back to top
DarkerLine
ceci n'est pas une |


Super Elite (Last Title)


Joined: 04 Nov 2003
Posts: 8328

Posted: 08 Dec 2008 12:34:22 pm    Post subject:

If you're using Ion and/or MirageOS you can use the ionDetect routine, which does exactly what you want to do.

Input:
HL memory location to begin search (start this at 9319h)
IX points to detection string (in your case, it should point to a label with .db "KNO",0)
Output:
DE points to the VAT entry -- program name, and the place to continue search from.
HL points to program data (after detection string)
Z=0 for success, Z=1 if failed
Destroys:
AF BC DE HL


Last edited by Guest on 22 Jul 2010 11:12:33 am; edited 1 time in total
Back to top
Mapar007


Advanced Member


Joined: 04 Oct 2008
Posts: 365

Posted: 08 Dec 2008 01:16:47 pm    Post subject:

Aah, I thought iDetect was for detecting Ion progs... (Indeed, I'm using MOS)

So you can generate a kind of list by running it multiple times and saving the pointers?
Back to top
calc84maniac


Elite


Joined: 22 Jan 2007
Posts: 770

Posted: 08 Dec 2008 02:58:34 pm    Post subject:

DarkerLine wrote:
Input:
HL memory location to begin search (start this at 9319h)

Er... shouldn't this be ld hl,($9830)? The two bytes at progptr (aka $9830) hold the beginning of the program/list/appvar section of the VAT.


Last edited by Guest on 22 Jul 2010 11:12:02 am; edited 1 time in total
Back to top
DarkerLine
ceci n'est pas une |


Super Elite (Last Title)


Joined: 04 Nov 2003
Posts: 8328

Posted: 08 Dec 2008 03:36:52 pm    Post subject:

That's probably true.
Back to top
FloppusMaximus


Advanced Member


Joined: 22 Aug 2008
Posts: 472

Posted: 08 Dec 2008 06:54:38 pm    Post subject:

Mapar007 wrote:
Aah, I thought iDetect was for detecting Ion progs... (Indeed, I'm using MOS)

So you can generate a kind of list by running it multiple times and saving the pointers?
[post="130078"]<{POST_SNAPBACK}>[/post]

No, unfortunately you can't. That was true with the original ionDetect (and it's still true on the TI-83), but it's not true with any current TI-83+ shells. The problem is that the shell can load a level file from the archive. (Or elsewhere... doesn't CrunchyOS allow loading compressed levels? And I'll bet BrandonW has a hacked version of Mirage that can load levels from a USB disk.)

Anyway, the point is that when ionDetect loads an archived level, it does so by copying it into free RAM and returning a pointer there. So if you call ionDetect again, it may overwrite the previously-loaded level. So you can only count on the most recent call to ionDetect to have returned a valid pointer.

There are a few ways you can get around this to make a menu for selecting levels:

- Do what a lot of Ion programs do: just display the name of the currently-loaded level, and select the "next" level when the user presses (for instance) the right arrow key. You don't allow the user to move backwards in the list at all; when ionDetect fails, you start over again at (progPtr).

- Keep track of how many times you've called ionDetect so far. Then to move to the previous level, you start over at (progPtr) and call ionDetect one fewer time.

- Keep a list of the VAT pointers that are returned (not the data pointers.) Then to move to the previous level, you'd look *two* entries back in the list and call ionDetect with the old pointer.
Back to top
Mapar007


Advanced Member


Joined: 04 Oct 2008
Posts: 365

Posted: 09 Dec 2008 01:19:22 am    Post subject:

thx, I'll try the first one I think Smile
Back to top
Display posts from previous:   
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
    »
» View previous topic :: View next topic  
Page 1 of 1 » All times are UTC - 5 Hours

 

Advertisement