Difference between revisions of "83Plus:BCALLs:801E"

From WikiTI
Jump to: navigation, search
(who's up for some more categorizing?)
(Destroys)
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
[[Category:83Plus:BCALLs:By Name:Memory|BigNumCompare]]
+
[[Category:83Plus:BCALLs:By Name:Memory|BigNumCompare]] [[Category:83Plus:BCALLs:By Name:Math:Big Integer|BigNumCompare]] [[Category:83Plus:BCALLs:By Name:Math|BigNumCompare]] [[Category:83Plus:BCALLs:By Name|BigNumCompare]] [[Category:83Plus:BCALLs:By Address|801E - BigNumCompare]]
[[Category:83Plus:BCALLs:By Name:Math|BigNumCompare]]
+
 
[[Category:83Plus:BCALLs:By Name:Math:Big Integer|BigNumCompare]]
+
[[Category:83Plus:BCALLs:By Name|BigNumCompare]]
+
[[Category:83Plus:BCALLs:By Address|801E - BigNumCompare]]
+
 
== Synopsis ==
 
== Synopsis ==
 
'''Official Name:''' BigNumCompare
 
'''Official Name:''' BigNumCompare
Line 20: Line 17:
  
 
=== Destroys ===
 
=== Destroys ===
* ??
+
* HL,DE,A
  
 
== Comments ==
 
== Comments ==

Latest revision as of 12:28, 6 February 2008


Synopsis

Official Name: BigNumCompare

BCALL Address: 801E

Checks to see if two large integers are equal.

Inputs

  • HL: Address of first integer to compare.
  • DE: Address of second integer to compare.

Outputs

  • Zero Flag: Set if integers are equal

Destroys

  • HL,DE,A

Comments

This B_CALL compares two big integers. This BCALL is used by the OS in its digital signature verification routines to compare the computed MD5 against the decrypted signature.

The BCALL can actually be used to compare any two data structures in RAM such as strings, but must follow the large integer format that the OS uses in its verification routines. The first byte must be the length of the integer in bytes. After the size byte, the number is listed in little endian form.

Example

Suppose the contents of RAM were as follows:

8100h: 04 12 34 56 78

8105h: 04 AA BB CC DD

810Ah: 03 12 34 56 78

The large integer stored at 8100h is the integer 78563412h and the integer stored at 8105h is the integer DDCCBBAAh. Below is code to compare the integers above.

 ld  hl,8100h
 ld  de,8105h
 B_CALL BigNumCompare ;should return nz
 ld  hl,8100h
 ld  de,810Ah
 B_CALL BigNumCompare ;should return z