[comp.sys.handhelds] HACKIT, SEEK

koslowj@math.ksu.edu (Juergen Koslowski) (04/27/91)

The documentation for the HACKIT library forgot to mention the SEEK function,
which is assigned to the 4th menu key. By looking at the RPL part of the code
one can see that it takes two arguments, but I don't dare to experiment with
about 100 K of stuff in my machine, even though I have back-up copies.

J"urgen

ftg0673@tamsun.tamu.edu (Rick Grevelle) (04/27/91)

In article <1991Apr26.181650.8656@maverick.ksu.ksu.edu> koslowj@math.ksu.edu (Juergen Koslowski) writes:
>
>The documentation for the HACKIT library forgot to mention the SEEK function,
>which is assigned to the 4th menu key. By looking at the RPL part of the code
>one can see that it takes two arguments, but I don't dare to experiment with
>about 100 K of stuff in my machine, even though I have back-up copies.
>

Glad to see at least someone out there is getting some use out of the Library.
My apologies for having over looked the SEEK routine, but you'll be pleased to
learn it's really an old routine with which you are probably already familiar.
SEEK is in fact a modification of Alonzo's FIND routine which first appeared in
his now biblical Processor Notes.  SEEK was specifically modified to run on the
48; it's one third the size of the orginal version for the 28, and should run a
bit quicker :-).

Alonzo's predominately register, rather than memory, oriented algorithm remains
unchanged.  You'll recall that the overall increase in speed was only about 10%
over that of the brute force approach, which he attributed to an increased time
spent in the looping structures.  Anyway, I felt the need to rename the routine
for the 48 since it demonstrates how to do several things internally in regards
to the 48, such as push a new binary integer to the stack from the instruction
stream of the machine code.  Below I've taken the liberty to reproduce Alonzo's
explanation for those who do not yet have a copy of the Processor Notes.

Rick Grevelle

===============================================================================

	The way to use this program is to specify a memory pattern and a
	place to start looking.  A memory pattern is a sequence of up to 
	fifteen nibbles and a one nibble length ( one minus the number of
	nibbles in the pattern ).

	For example, if you want to find the instances of the instruction
	808C in memory, you can type:

		#C808	#0  SEEK

	The result returned is a binary integer which is the address one
	higher than where the pattern exist in memory.  The advantage is
	that is allows you to continually implement SEEK in order to get
	subsequent instances.  This version does not stop until it finds
	an instance, or scans the entire address space.

	Some addtional information about SEEK:

		o SEEK will macth bit patterns in port memory as well.

		o This version hasn't any bank switching capabilites;
		  however, a future version is expected to do this.

		o Even though the routine is fast, because of the size
		  of the 48's address space, matching certain patterns
		  could take several seconds.

	One final example to illustrate SEEK's use involves the ocurrance
	of the RPL prolog #02D9Dh.  If it were desirable to locate any or
	all of the six thousand plus occurances of #02D9Dh, simply type:

		#02D9D4	 #0  SEEK

	SEEK can be used equally effective in a program to automate such a
	process, and should prove to be most useful as a tool in locating
        occurances of all the various object types.  How many of the 48's
        ten thousand entry points can you find?  How many can you verify?