Skip to navigation

Maths (Arithmetic): SQUA2

[BBC Micro disc version, Docked]

Name: SQUA2 [Show more] Type: Subroutine Category: Maths (Arithmetic) Summary: Calculate (A P) = A * A
Context: See this subroutine in context in the source code References: This subroutine is called as follows: * SUN (Part 1 of 4) calls SQUA2 * SUN (Part 3 of 4) calls SQUA2 * TT111 calls SQUA2

Do the following multiplication of unsigned 8-bit numbers: (A P) = A * A
.SQUA2 STA P \ Copy A into P and X TAX BNE MU11 \ If X = 0 fall through into MU1 to return a 0, \ otherwise jump to MU11 to return P * X