83Plus:BCALLs:405A: Difference between revisions

From WikiTI
Jump to navigationJump to search
No edit summary
 
official name, category
 
(2 intermediate revisions by one other user not shown)
Line 1: Line 1:
[[Category:83Plus:BCALLs:By Name|Floor]]
[[Category:83Plus:BCALLs:By Name|AbsO1PAbsO2]] [[Category:83Plus:BCALLs:By Name:FP Math|AbsO1PAbsO2]] [[Category:83Plus:BCALLs:By Address|405A - AbsO1PAbsO2]]
[[Category:83Plus:BCALLs:By Name:Math|Floor]]
== Synopsis ==
[[Category:83Plus:BCALLs:By Address|405A - Floor]]
'''Official Name:''' AbsO1PAbsO2
 
----


== Synopsis ==
'''Unofficial Name:''' AbsAdd
'''Unofficial Name:''' Floor


'''BCALL Address:''' 405A
'''BCALL Address:''' 405A


Calculates the floor of the value in OP1, and stores it in 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 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>

Latest revision as of 03:12, 30 September 2009

Synopsis

Official Name: AbsO1PAbsO2

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.