Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!zaphod.mps.ohio-state.edu!ub!acsu.buffalo.edu From: cloos@acsu.buffalo.edu (James H. Cloos) Newsgroups: comp.sys.handhelds Subject: Directory structure unearthed Message-ID: <46136@eerie.acsu.Buffalo.EDU> Date: 14 Nov 90 03:45:20 GMT Sender: news@acsu.Buffalo.EDU Distribution: comp Organization: State University of New York @ Buffalo Lines: 70 Nntp-Posting-Host: lictor.acsu.buffalo.edu Hello all. I've finally determined precisely *how* sub-dir's are stored in the 48sx and 28s's. Below, I will use the code _DIR for the header. In the 48sx, the value of this is <#02A96h>; on the 28s, it is <#02AB8h>(from Eric Toonen's obj.doc; don't blame me if its incorrect). (I do take responsibility for the 48sx value, though). The format is: _DIR <#7ffh> (link_to_1st_object) (end_link) (nth_object) (link_to_nth_object) (n-1th_object) (link_to_n-1th_object) ... (1st_object) 1st object is the one that is on the left-most menu key == the last object STO'ed, assuming ORDER hasn't been used. All links are 5 nybbles long. A link_to_ith_object field is also the length of the ith_object, in nybbles. An object has the form: (len_of_name) (the_name) (len_of_name) (data_STO'ed_in_name) The (end_link) field is <#00000h>. Notice that the object are stored in reverse order, which means that when searching the directory tree, the hp sees a dir via the _DIR header, then uses the pointers to find each of the id's w/in that dir by 1st jumping to the "1st" one, which is at the end of the mem structure; it then sequentially looks at the pointer just before the "current" name and jumps back that many nybbles to find the "next" id. When a pointer of 0 is found, it knows that it is at the end of the directory. 2 Examples: (remove the spaces and then ASC\-> these...) 1) DIR END is: "69A20 FF7 00000 B6E5" == _DIR,7FF,00000,kcrc 2) DIR A SIN B COS END is: "69A20 FF7 02000 00000 10 24 10 29E20 200 250 11000 10 41 10 29E20 200 150 1D89" which is: _DIR,7ff,lnk_to_A,1_char_id,'B',1_char_name, RomPtr,002,052,lnk_to_B,1_char_name, 'A',1_char_name,RomPtr,002,051,kcrc (A RomPtr = ROM pointer = XLIB, so we see that SIN is library 2, cmd 52h.) -- I hope that this is understandable. I'm currently at work putting together a rpl compiler, and have been concentrating just now on getting the bison grammer together. I still have to figure out how to do a library, backup object, & unit object. (At least now that it can do a directory, usrlib can be used to convert that into a library.) Anyway, given my primary project, I've not a lot of time to get this posting done properly. Perhaps someone who understands what I'm saying can take the time to explain it for any who don't. Oh, yes, the "kcrc" means kermit crc, which as I pointed out earlier is the algorithm for the BYTES crc; it is the one used for kermit transfers when checksum type is set to 3. I included it above only so that the strings could be put thru ASC\->, these are not there in memory. -JimC -- James H. Cloos, Jr. Phone: +1 716 673-1250 cloos@ACSU.Buffalo.EDU Snail: PersonalZipCode: 14048-0772, USA cloos@ub.UUCP Quote: THIS INFORMATION COMES WITHOUT ANY FORM OF WARRENTY, NOT EVEN IMPLIED ONES.