Last change
on this file since 0acb7d0 was fa38804, checked in by Thomas Lopatic <thomas@…>, 7 years ago |
Removed form-feed comments.
|
-
Property mode
set to
100644
|
File size:
1.3 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 |
|
---|
[b28a12e] | 8 | #include "ram.h"
|
---|
[f40a309] | 9 |
|
---|
| 10 | #define MAXSEGT 32767
|
---|
| 11 |
|
---|
| 12 | /*
|
---|
| 13 | =============================================================================
|
---|
| 14 | addfpu() -- find next higher FPU time 'k' milliseconds greater than 't'
|
---|
| 15 | =============================================================================
|
---|
| 16 | */
|
---|
| 17 |
|
---|
[7258c6a] | 18 | uint16_t addfpu(uint16_t t, int16_t k)
|
---|
[f40a309] | 19 | {
|
---|
[7258c6a] | 20 | register int16_t x, z;
|
---|
| 21 | register uint16_t y;
|
---|
[f40a309] | 22 |
|
---|
| 23 | x = fromfpu(t);
|
---|
| 24 |
|
---|
| 25 | if (x EQ MAXSEGT)
|
---|
| 26 | return(t);
|
---|
| 27 |
|
---|
| 28 | y = t;
|
---|
| 29 | z = x + k;
|
---|
| 30 |
|
---|
| 31 | if (z GE MAXSEGT)
|
---|
| 32 | return(tofpu(MAXSEGT));
|
---|
| 33 |
|
---|
| 34 | while ((y EQ t) OR (z > x))
|
---|
| 35 | y = tofpu(++x);
|
---|
| 36 |
|
---|
| 37 | return(y);
|
---|
| 38 | }
|
---|
| 39 |
|
---|
| 40 | /*
|
---|
| 41 | =============================================================================
|
---|
| 42 | subfpu() -- find next lower FPU time 'k' milliseconds less than 't'
|
---|
| 43 | =============================================================================
|
---|
| 44 | */
|
---|
| 45 |
|
---|
[7258c6a] | 46 | uint16_t subfpu(uint16_t t, int16_t k)
|
---|
[f40a309] | 47 | {
|
---|
[7258c6a] | 48 | register int16_t x, z;
|
---|
| 49 | register uint16_t y;
|
---|
[f40a309] | 50 |
|
---|
| 51 | x = fromfpu(t);
|
---|
| 52 |
|
---|
| 53 | if (x EQ 1)
|
---|
| 54 | return(t);
|
---|
| 55 |
|
---|
| 56 | y = t;
|
---|
| 57 | z = x - k;
|
---|
| 58 |
|
---|
| 59 | if (z LE 1)
|
---|
| 60 | return(tofpu(1));
|
---|
| 61 |
|
---|
| 62 | while ((y EQ t) OR (z < x))
|
---|
| 63 | y = tofpu(--x);
|
---|
| 64 |
|
---|
| 65 | return(y);
|
---|
| 66 | }
|
---|
[6262b5c] | 67 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.