]> git.sur5r.net Git - cc65/blob - doc/specialmath.sgml
Optimized mul20 & mul40 and extracted to new library.
[cc65] / doc / specialmath.sgml
1 <!doctype linuxdoc system>
2
3 <article>
4 <title>Special math functions
5 <author>Christian Kr&uuml;ger
6
7 <abstract>
8 This library provides functions for speed optimized math operations.
9 </abstract>
10
11 <!-- Table of contents -->
12 <toc>
13
14 <!-- Begin the document -->
15
16 <sect>Multiplication<p>
17
18 When accessing screen memory often a multiplication of the vertical position is needed to calculate
19 the target address. A quite common horizontal span for 8-bit systems is 20 or 40 bytes (beside e.g. 32 bytes, where the multiplication can be accomplished by shifting 5 times).
20
21 <p>
22 <tscreen><verb>
23     unsigned int __fastcall__ mul20(unsigned char value);
24 </verb></tscreen>
25
26 The 8 bit <tt>value</tt> is multiplied by 20 and returned as 16 bit value.
27 </p>
28
29 <p>
30 <tscreen><verb>
31     unsigned int __fastcall__ mul40(unsigned char value);
32 </verb></tscreen>
33
34 The 8 bit <tt>value</tt> is multiplied by 40 and returned as 16 bit value.
35 </p>
36
37
38 </article>