[comp.sys.apple2] How the hell do I do this in Hyper C?

greyelf@wpi.WPI.EDU (Michael J Pender) (11/25/90)

The following is a file I wrote for hyperc, it is a part of a larger program.
This is but a segment of the code that is supposed to compute an fft, so 
I must use floating point math, but I am doing something wrong with an 
assignment statement of something.  

There is one line marked off as a comment.  When the line is left in, the
program appears to proceed properly, when it is not, I've had lo-res graphics
pop up, hi-res graphics, the computer reboot..... general wierdness.

Any ideas?

---
Michael J Pender Jr  Box 1942 c/o W.P.I.   Part of this D- belongs to 
greyelf@wpi.bitnet   100 Institute Rd.     God...  
greyelf@wpi.wpi.edu  Worcester, Ma 01609           - B. Simpson



#include <std.h>            /* File i/o macros */

/* hardware equates */

char    *MEMSEL = 0xc500;   /* Select Ramcard */
char    *MELOW  = 0xc0d0;   /* Low byte of address */
char    *MEMID  = 0xc0d1;   /* Middle byte of address */
char    *MEHIGH = 0xc0d2;   /* High byte of address */
char    *MEDATA = 0xc0d3;   /* Data byte address */

main()
{
    TEXT     buf[80];
    EXTENDED pi     = 3.141592653589793238;
    EXTENDED zero   = 0.0;
    EXTENDED one    = 1.0;
    EXTENDED npnts  = 1024.0;
    EXTENDED a[1024], b[1024];
    INT      i, ip, k, le, loop, p2[11], ti;
    CHAR     done, j, l, m, t;
    EXTENDED ta, tb, tc, va, vb, ua, ub, wa, wb;

    /* prepare ramcard for use */

    *MEHIGH = 0;
    *MEMID  = 0;
    *MELOW  = 0;

    /* Load powers of two array */

    putstr("\n...Computing powers of two...\n");

    p2[0] = 1;
    for(j = 1; j < 11; j++)
        p2[j] = p2[j - 1] * 2;
    
    for(loop = 0; loop < 11; loop++)
        printf("\t%d %d\n", loop, p2[loop]);

    putstr("\n...Converting data from card...\n");
    
    /* Copy data from ramcard to floating point array for processing */
    /* Set imaginary components to zero */

    for(i = 0; i < 1024; i++)
    {
        *MEMSEL = 0;
        t = *MEDATA;
        printf("%d %d ", i, t);
        ti = 0 + t;
/*        printf("%d ", ti);    */
        cvitox(tc, ti);
        fptostr(buf, tc, 'x', 0, NO);
        printf("%s", buf);
        a[i] = tc;
        fptostr(buf, a[i], 'x', 0, NO);
        printf("%s", buf);
        b[i] = zero;
        fptostr(buf, b[i], 'x', 0, NO);
        printf("%s\n", buf);
    }
}
-- 
---
Michael J Pender Jr  Box 1942 c/o W.P.I.   Part of this D- belongs to 
greyelf@wpi.bitnet   100 Institute Rd.     God...