Difference between revisions of "83Plus:BCALLs:804B"

From WikiTI
Jump to: navigation, search
 
m
 
(3 intermediate revisions by 3 users not shown)
Line 1: Line 1:
[[Category:83Plus:BCALLs:By Name:Math|DivHLbyDE]]
+
[[Category:83Plus:BCALLs:By Name:Math:Integer|Divide16By16]] [[Category:83Plus:BCALLs:By Name:Math|Divide16By16]] [[Category:83Plus:BCALLs:By Name|Divide16By16]] [[Category:83Plus:BCALLs:By Address|804B - Divide16By16]]
[[Category:83Plus:BCALLs:By Name|DivHLbyDE]]
+
[[Category:83Plus:BCALLs:By Address|804B - DivHLbyDE]]
+
 
== Synopsis ==
 
== Synopsis ==
'''Official Name:''' DivHLbyDE
+
'''Official Name:''' Divide16By16
 +
 
 +
'''Other Name:''' DivHLbyDE
  
 
'''BCALL Address:''' 804B
 
'''BCALL Address:''' 804B
  
Divides register HL by register DE and stores the result in DE.
+
Divides register HL by register DE and stores the result in DE and the remainder in HL.
  
 
=== Inputs ===
 
=== Inputs ===
 
* HL = numerator
 
* HL = numerator
 
* DE = denominator
 
* DE = denominator
<!-- We need to figure out how we're doing flags and link that up -->
 
  
 
=== Outputs ===
 
=== Outputs ===
 
* DE = HL / DE
 
* DE = HL / DE
 +
* HL = HL % DE
  
 
=== Destroys ===
 
=== Destroys ===
* a, IX, HL, DE
+
* A, IX, HL, DE
 
* Contents of memory addresses 8251h - 8253h
 
* Contents of memory addresses 8251h - 8253h
  
Line 25: Line 25:
  
 
== Example ==
 
== Example ==
   ld    hl,206h
+
   ld    hl,A1Dh
 
   ld    de,103h
 
   ld    de,103h
   B_CALL DivHLbyDE  ;should return 2
+
   B_CALL DivHLbyDE  ;should return DE=9 HL=102h

Latest revision as of 21:31, 29 March 2005

Synopsis

Official Name: Divide16By16

Other Name: DivHLbyDE

BCALL Address: 804B

Divides register HL by register DE and stores the result in DE and the remainder in HL.

Inputs

  • HL = numerator
  • DE = denominator

Outputs

  • DE = HL / DE
  • HL = HL % DE

Destroys

  • A, IX, HL, DE
  • Contents of memory addresses 8251h - 8253h

Comments

Simple enough to implement yourself if speed is important.

Example

 ld     hl,A1Dh
 ld     de,103h
 B_CALL DivHLbyDE  ;should return DE=9 HL=102h