|Re: invalid card data at my hp48g |
Message #5 Posted by Jonathan Busby on 8 Oct 2003, 7:05 a.m.,
in response to message #4 by Wayne Brown
This is somewhat inaccurate. There is no "header" stored at the beginning of each port. All a port consists of is a sequence of library and/or backup objects --each one being immediately followed by its 4-nibble CRC-- which is then terminated by a 5 nibble zero value. The "available memory" of a port is not stored anywhere, but is indirectly determined by a 5-nibble pointer in the PORTnEOS "end of sequence" table. This pointer indicates where the previously described library/backup object sequence ends when the port has been uncovered and is located at address C0000 . Note that this can also be determined by the aforementioned zero value, but the table allows faster access.
When the calculator "boots up" it scans all the ports, while recording the locations of any library objects and also checking the CRC of each backup/library object encountered. If a corrupt object is found, then an "Invalid Card Data" error is generated and the associated PORTnEOS pointer is set to point immediately after the last valid object. When you store something to a port, the corresponding PORTnEOS pointer is used to determine where to place the object. If the port in question is corrupted, then the start of the corrupted portion will be overwritten with a valid object and the PORTnEOS pointer will be updated to point past the new object. So, you can see the second advantage of the PORTnEOS table. PINIT makes use of this fact by storing and then purging a small valid backup object in each port. As just explained, if there is any corruption, it will be overwritten with valid data.
Note that the above doesn't apply to port 0, at least without some modification. While port 0 does have an entry in the PORTnEOS table (the first entry), it is treated differently. Like the other ports, it is scanned at startup, and if a corrupt object is detected, then its PORT0EOS entry is modified, but in this case it has a different meaning to the code that is responsible for storing objects. Unlike the other ports, when an object is stored it is *prepended* to the start of the object sequence and the PORT0EOS pointer is *not* updated. PORT0EOS usually points to address BFFFB or FFFF6, depending on whether port 1 is unmerged or merged respectively. If a corrupt object is detected upon booting up, then PORT0EOS is set to point to the start of the corruption as in the other ports, but unlike in those cases a new 5 zero nibble sentinel is written at the PORT0EOS address --effectively an automatic port 0 "PINIT". This has the effect of silencing the "Invalid Card Data" errors, but at the price of the space between the "logical" end (PORT0EOS) and the actual end of port 0 being left in limbo. So, you effectively have a "memory leak". This is the cause for all the questions about lost or missing memory that you see every so often on various forums. Since the 48 series has no built in mechanism to reset the PORT0EOS pointer, then a normal user would be SOL. This seems to be a design flaw in the 48 operating system. Fortunately, there is a user written program that can do this, and possibly even recover lost data. See http://www.hpcalc.org/details.php?id=2454 .
Hope this helps...
Jonathan Busby - jdb@SNMAPOhouston.rr.com
Remove the random permutation of "NOSPAM" before replying.