83Plus:BCALLs:4012: Difference between revisions

From WikiTI
Jump to navigationJump to search
Woozle (talk | contribs)
No edit summary
 
Quigibo (talk | contribs)
 
Line 19: Line 19:


== Comments ==
== Comments ==
Simple enough to implement if speed is important.
Simple enough to implement if speed is important.  However, it may return invalid results if A is larger than 127 since the routine does not correctly handle overflows.


== Example ==
== Example ==

Latest revision as of 06:14, 30 July 2010

Synopsis

Official Name: DivHLByA

BCALL Address: 4012

Divides the value in HL by the value in A.

Inputs

  • HL: integer
  • A: integer

Outputs

  • HL = HL / A
  • A = HL mod A

Registers Destroyed

  • none

Comments

Simple enough to implement if speed is important. However, it may return invalid results if A is larger than 127 since the routine does not correctly handle overflows.

Example

ld hl,13
ld a,5
B_CALL DivHLByA  ;should return HL=2, A=3