83Plus:BCALLs:804B: Difference between revisions

From WikiTI
Jump to navigationJump to search
Woozle (talk | contribs)
No edit summary
 
Woozle (talk | contribs)
No edit summary
Line 7: Line 7:
'''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 ===
Line 16: Line 16:
=== Outputs ===
=== Outputs ===
* DE = HL / DE
* DE = HL / DE
* HL = HL % DE


=== Destroys ===
=== Destroys ===
Line 25: Line 26:


== 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

Revision as of 03:53, 29 March 2005

Synopsis

Official 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