<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wikiti.brandonw.net/index.php?action=history&amp;feed=atom&amp;title=83Plus%3ABCALLs%3A8030</id>
	<title>83Plus:BCALLs:8030 - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wikiti.brandonw.net/index.php?action=history&amp;feed=atom&amp;title=83Plus%3ABCALLs%3A8030"/>
	<link rel="alternate" type="text/html" href="https://wikiti.brandonw.net/index.php?title=83Plus:BCALLs:8030&amp;action=history"/>
	<updated>2026-11-20T17:41:19Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.11</generator>
	<entry>
		<id>https://wikiti.brandonw.net/index.php?title=83Plus:BCALLs:8030&amp;diff=3862&amp;oldid=prev</id>
		<title>FloppusMaximus: This one is ugly!</title>
		<link rel="alternate" type="text/html" href="https://wikiti.brandonw.net/index.php?title=83Plus:BCALLs:8030&amp;diff=3862&amp;oldid=prev"/>
		<updated>2006-02-08T00:03:06Z</updated>

		<summary type="html">&lt;p&gt;This one is ugly!&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;[[Category:83Plus:BCALLs:By_Name:Other|FindGroupedField]] [[Category:83Plus:BCALLs:By_Name|FindGroupedField]] [[Category:83Plus:BCALLs:By_Address|8030 - FindGroupedField]]&lt;br /&gt;
== Synopsis ==&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Unofficial Name:&amp;#039;&amp;#039;&amp;#039; FindGroupedField&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;BCALL Address:&amp;#039;&amp;#039;&amp;#039; 8030&lt;br /&gt;
&lt;br /&gt;
Search for a given field within a &amp;quot;group.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=== Inputs ===&lt;br /&gt;
* AHL = address (first type byte) to start searching&lt;br /&gt;
* DE = field to search for (e.g. 0A10 to search for the calculator ID)&lt;br /&gt;
&lt;br /&gt;
=== Outputs ===&lt;br /&gt;
* HL = address of the first data byte (&amp;#039;&amp;#039;not&amp;#039;&amp;#039; the first type byte) of the first matching field&lt;br /&gt;
* BC = length of the field&lt;br /&gt;
* NZ set if not found.&lt;br /&gt;
&lt;br /&gt;
=== Destroys ===&lt;br /&gt;
* AF&lt;br /&gt;
* [[83Plus:RAM:8478|OP1]], [[83Plus:RAM:8100|ramCode]]&lt;br /&gt;
&lt;br /&gt;
== Comments ==&lt;br /&gt;
This routine will stop when it reaches any field of a different major field type.  Unless you are explicitly searching for a minor-type-1 field, it will also stop when it reaches one.&lt;br /&gt;
&lt;br /&gt;
The behavior of this routine is perhaps best illustrated by an example.  Public keys are stored on the certificate page as a series of two fields: an 071 field which contains the key ID (e.g. 0104) and an 073 field which contains the key itself.&lt;br /&gt;
&lt;br /&gt;
So to find a particular public key, you want to first scan through the 071 fields to find the key ID you&amp;#039;re looking for.  You then want to find the first 073 field following this one, &amp;#039;&amp;#039;but you want to stop before you get to another 071 field, or any other unrelated field.&amp;#039;&amp;#039;  &amp;quot;Unrelated&amp;quot; in this case means non-major-type-7, since only major-type-7 fields are allowed within the public key block.&lt;br /&gt;
&lt;br /&gt;
Unlike most of the field search routines, this routine calls [[83Plus:BCALLs:805A|GetFieldSize]] after finding the field, so HL points to the first data byte and BC is the length of the field.&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
Find public key number 0104 (requires [[83Plus:Ports:14|Flash write-enabled]]):&lt;br /&gt;
&lt;br /&gt;
  ; Find the certificate patch block&lt;br /&gt;
  ld de,0300h&lt;br /&gt;
  B_CALL [[83Plus:BCALLs:8027|FindFirstCertificateField]]&lt;br /&gt;
  ret nz&lt;br /&gt;
 &lt;br /&gt;
  ; Find the public key block (a subfield of the certificate patch block)&lt;br /&gt;
  ld a,7eh           ; or 1e, or 3e, depending on model&lt;br /&gt;
  ld de,0700h&lt;br /&gt;
  B_CALL [[83Plus:BCALLs:805D|FindSubField]]&lt;br /&gt;
  ret nz&lt;br /&gt;
 &lt;br /&gt;
  ; Enter the public key block&lt;br /&gt;
  inc hl&lt;br /&gt;
  ld a,7eh&lt;br /&gt;
  B_CALL [[83Plus:BCALLs:805A|GetFieldSize]]&lt;br /&gt;
 &lt;br /&gt;
  ; Find our public key&lt;br /&gt;
 Loop:&lt;br /&gt;
  ld a,7eh&lt;br /&gt;
  ld de,0710h&lt;br /&gt;
  B_CALL FindGroupedField&lt;br /&gt;
  ret nz&lt;br /&gt;
  ; HL -&amp;gt; key number, BC = length thereof&lt;br /&gt;
  ; check if it is 0104&lt;br /&gt;
  ld a,7eh&lt;br /&gt;
  B_CALL [[83Plus:BCALLs:8051|LoadAIndPaged]]&lt;br /&gt;
  cp 1&lt;br /&gt;
  jr nz,Skip&lt;br /&gt;
  inc hl&lt;br /&gt;
  dec bc&lt;br /&gt;
  ld a,7eh&lt;br /&gt;
  B_CALL [[83Plus:BCALLs:8051|LoadAIndPaged]]&lt;br /&gt;
  cp 4&lt;br /&gt;
  jr nz,Skip&lt;br /&gt;
  inc hl&lt;br /&gt;
  dec bc&lt;br /&gt;
  ld a,b&lt;br /&gt;
  or c&lt;br /&gt;
  jr z,Found0104&lt;br /&gt;
 Skip:&lt;br /&gt;
  add hl,bc&lt;br /&gt;
  jr Loop&lt;br /&gt;
 Found0104:&lt;br /&gt;
  ld a,7eh&lt;br /&gt;
  ld de,0730h&lt;br /&gt;
  B_CALL FindGroupedField&lt;br /&gt;
  ; HL -&amp;gt; modulus; BC = length&lt;/div&gt;</summary>
		<author><name>FloppusMaximus</name></author>
	</entry>
</feed>