Last change
on this file since 6262b5c was 6262b5c, checked in by Thomas Lopatic <thomas@…>, 7 years ago |
Added include files for global functions and variables.
|
-
Property mode
set to
100644
|
File size:
1.4 KB
|
Rev | Line | |
---|
[f40a309] | 1 | /*
|
---|
| 2 | =============================================================================
|
---|
| 3 | addfpu.c -- FPU time functions
|
---|
| 4 | Version 1 -- 1987-09-14 -- D.N. Lynx Crowe
|
---|
| 5 | =============================================================================
|
---|
| 6 | */
|
---|
| 7 |
|
---|
[6262b5c] | 8 | #include "all.h"
|
---|
[f40a309] | 9 |
|
---|
| 10 | #define MAXSEGT 32767
|
---|
| 11 |
|
---|
[7258c6a] | 12 | extern uint16_t tofpu(uint16_t time);
|
---|
| 13 | extern uint16_t fromfpu(uint16_t fputime);
|
---|
[f40a309] | 14 |
|
---|
| 15 | /* |
---|
| 16 |
|
---|
| 17 | */
|
---|
| 18 |
|
---|
| 19 | /*
|
---|
| 20 | =============================================================================
|
---|
| 21 | addfpu() -- find next higher FPU time 'k' milliseconds greater than 't'
|
---|
| 22 | =============================================================================
|
---|
| 23 | */
|
---|
[7258c6a] | 24 |
|
---|
[f40a309] | 25 | uint16_t addfpu(uint16_t t, int16_t k)
|
---|
[7258c6a] | 26 | {
|
---|
| 27 | register int16_t x, z;
|
---|
[f40a309] | 28 | register uint16_t y;
|
---|
| 29 |
|
---|
| 30 | x = fromfpu(t);
|
---|
| 31 |
|
---|
| 32 | if (x EQ MAXSEGT)
|
---|
| 33 | return(t);
|
---|
| 34 |
|
---|
| 35 | y = t;
|
---|
| 36 | z = x + k;
|
---|
| 37 |
|
---|
| 38 | if (z GE MAXSEGT)
|
---|
| 39 | return(tofpu(MAXSEGT));
|
---|
| 40 |
|
---|
| 41 | while ((y EQ t) OR (z > x))
|
---|
| 42 | y = tofpu(++x);
|
---|
| 43 |
|
---|
| 44 | return(y);
|
---|
| 45 | }
|
---|
| 46 |
|
---|
| 47 | /* |
---|
| 48 |
|
---|
| 49 | */
|
---|
| 50 |
|
---|
| 51 | /*
|
---|
| 52 | =============================================================================
|
---|
| 53 | subfpu() -- find next lower FPU time 'k' milliseconds less than 't'
|
---|
| 54 | =============================================================================
|
---|
[7258c6a] | 55 | */
|
---|
[f40a309] | 56 |
|
---|
[7258c6a] | 57 | uint16_t subfpu(uint16_t t, int16_t k)
|
---|
| 58 | {
|
---|
[f40a309] | 59 | register int16_t x, z;
|
---|
| 60 | register uint16_t y;
|
---|
| 61 |
|
---|
| 62 | x = fromfpu(t);
|
---|
| 63 |
|
---|
| 64 | if (x EQ 1)
|
---|
| 65 | return(t);
|
---|
| 66 |
|
---|
| 67 | y = t;
|
---|
| 68 | z = x - k;
|
---|
| 69 |
|
---|
| 70 | if (z LE 1)
|
---|
| 71 | return(tofpu(1));
|
---|
| 72 |
|
---|
| 73 | while ((y EQ t) OR (z < x))
|
---|
| 74 | y = tofpu(--x);
|
---|
| 75 |
|
---|
[6262b5c] | 76 | return(y);
|
---|
| 77 | }
|
---|
| 78 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.