Difference between revisions of "83Plus:BCALLs:405A"

From WikiTI
Jump to: navigation, search
m (Cosmetic changes)
Line 1: Line 1:
[[Category:83Plus:BCALLs:By Name|Floor]]
+
[[Category:83Plus:BCALLs:By Name|AbsAdd]]
[[Category:83Plus:BCALLs:By Name:Math|Floor]]
+
[[Category:83Plus:BCALLs:By Name:Math|AbsAdd]]
[[Category:83Plus:BCALLs:By Address|405A - Floor]]
+
[[Category:83Plus:BCALLs:By Address|405A - AbsAdd]]
 
== Synopsis ==
 
== Synopsis ==
'''Unofficial Name:''' Floor
+
'''Unofficial Name:''' AbsAdd
  
 
'''BCALL Address:''' 405A
 
'''BCALL Address:''' 405A
  
Calculates the floor of the value in [[83Plus:RAM:8478|OP1]], and stores it in [[83Plus:RAM:8478|OP1]]. Floor is rounding down to the nearest integer, e.g. floor(3.5) = 3 and floor(-4.0001) = -4.
+
Takes the absolute value of [[83Plus:RAM:8478|OP1]] and [[83Plus:RAM:8483|OP2]] and then adds them together.
  
 
=== Inputs ===
 
=== Inputs ===
* [[83Plus:RAM:8478|OP1]]: Number to take floor of
+
* [[83Plus:RAM:8478|OP1]]: First number to add
 +
* [[83Plus:RAM:8483|OP2]]: Second number to add
  
 
=== Outputs ===
 
=== Outputs ===
* [[83Plus:RAM:8478|OP1]] contains floor
+
* [[83Plus:RAM:8478|OP1]] contains positive sum
  
 
=== Destroys ===
 
=== Destroys ===
* [[83Plus:RAM:8478|OP1]], [[83Plus:RAM:8478|OP2]]
+
* [[83Plus:RAM:8478|OP1]], [[83Plus:RAM:8483|OP2]]
  
 
== Comments ==
 
== Comments ==
This BCALL calculates the floor of the value in [[83Plus:RAM:8478|OP1]] by taking the fractional part, reversing its sign, and adding it to the original value.
+
This takes the absolute value of two numbers and then adds them together, storing the result in [[83Plus:RAM:8478|OP1]].
 
+
== Example ==
+
<nowiki>ld a,3
+
B_CALL SetXXOP1
+
B_CALL TimesPt5 ;OP1 is 1.5
+
B_CALL Floor ;OP1 is now 1</nowiki>
+

Revision as of 17:34, 5 November 2006

Synopsis

Unofficial Name: AbsAdd

BCALL Address: 405A

Takes the absolute value of OP1 and OP2 and then adds them together.

Inputs

  • OP1: First number to add
  • OP2: Second number to add

Outputs

  • OP1 contains positive sum

Destroys

Comments

This takes the absolute value of two numbers and then adds them together, storing the result in OP1.