Difference between revisions of "83Plus:BCALLs:8048"

From WikiTI
Jump to: navigation, search
Line 7: Line 7:
 
'''BCALL Address:''' 8048
 
'''BCALL Address:''' 8048
  
Divides register HL by register E and stores the result in DE.
+
Divides register HL by register E and stores the result in DE and the remainder in HL.
  
 
=== Inputs ===
 
=== Inputs ===
Line 16: Line 16:
 
=== Outputs ===
 
=== Outputs ===
 
* DE = HL / E
 
* DE = HL / E
 +
* HL = HL % E
  
 
=== Destroys ===
 
=== Destroys ===
Line 27: Line 28:
 
   ld    hl,103h
 
   ld    hl,103h
 
   ld    e,3
 
   ld    e,3
   B_CALL DivHLbyE  ;should return 56h or 86 decimal
+
   B_CALL DivHLbyE  ;should return DE=56h and HL=1

Revision as of 19:48, 28 March 2005

Synopsis

Official Name: DivHLbyE

BCALL Address: 8048

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

Inputs

  • HL = numerator
  • E = denominator

Outputs

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

Destroys

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

Comments

Simple enough to implement yourself if speed is important.

Example

 ld     hl,103h
 ld     e,3
 B_CALL DivHLbyE  ;should return DE=56h and HL=1