|Re: HP-41c(V/X) memory testing... EDITED!!|
Message #5 Posted by Vieira, Luiz C. (Brazil) on 19 Oct 2004, 11:34 p.m.,
in response to message #4 by JasonG
Hi, Jason; thank you for your interest. What I guess helps more than adding comments is a stack trace. But these are just my thoughts, please, feel free asking for additional explanations. I'd gladly comment it.
As Eric have correctly posted, this is just a simple program and does not effectively test all bits in memory. It is necessary to add some sort of "sweep" in data range. Also, the HP41 system tests for higher existing memory address (register) and highest contiguous program RAM. It is easily seen when you remove a standard memory module from an HP41C that contains program data. At the first attempt to turn the calcualtor ON results in immediate MEMORY LOST. But it is acceptable having gaps in register area. Also, there are some synthetic code that allow checking for memory SIZE and, surely, for memory integrity. What I wanted most was to give an example that it can be done with a simple code (and check if my brain cells in the 'HP41 programming area' still respond to external stymulus...). At least it's been fun to program and debug without using the calculator to check it. I confess I did not load it yet and ran it. But I was able to trace it...
L X Y Z T
01 LBL`MTST ? ? ? ? ?
02 SF 25
03 pattern ? patn ? ? ?
04 ENTER^ ? patn patn ? ?
05 - patn 0.00 ? ? ?
06 LBL 00 patn cntr ? ? ?
07 LASTX patn patn cntr ? ?
08 STO IND Y
09 FC? 25
10 GTO 02
11 RCL IND Y patn patn(r) patn(o) cntr ?
12 - patn(r) (o)-(r) cntr ? ?
13 X!=0? patn(r) (o)-(r) cntr ? ?
14 GTO 01 patn(r) (o)-(r) cntr ? ?
15 1 patn 1 0.00 cntr ?
16 ST+ Z patn 1 0.00 cntr+1 ?
17 RDN patn 0.00 cntr+1 ? 1
18 RDN patn cntr+1 ? 1 0.00
19 GTO 00 patn cntr+1 ? 1 0.00
20 LBL 01 patn(r) (o)-(r) cntr ? ?
23 LBL 02 patn patn cntr ? ?
25 ARCL Y
27 END patn patn cntr(last reg)
If the stack diagram fails explaining, let me know and I'll add comments. In time: (o) and (r), from line 11 on, are respectively (o)riginal and memory (r)etrieved pattern.
Edited: 19 Oct 2004, 11:45 p.m.