/* * Definitions for variable data used by Color BASIC * * Copyright 2013 by John W. Linville */ /* * cb_float -- Microsoft Binary Format floating point value * * exponent -- 128 + actual signed value of exponent * (zero value of exponent == overall value of 0) * * mantissa -- 4-byte normalized value of mantissa * (MSB of offset 0 is assumed to be '1', * so this bit is instead used to indicate * the sign -- '0' is positive, '1' is negative) */ struct cb_float { unsigned char exponent; unsigned char mantissa[4]; }; /* * cb_str -- string variable descriptor * * len -- length of string in bytes * * cbstr_unused1 -- unused byte * * location -- pointer to array of bytes of length len * * cbstr_unused2 -- unused byte */ struct cb_str { unsigned char len; unsigned char cbstr_unused1; char *location; unsigned char cbstr_unused2; }; /* * cb_fac -- unpacked floating point value stored in FAC * * cbfloat -- floating point data with MSB of mantissa[0] unpacked * * sign -- MSB represents the MSB of mantissa[0] when packed * */ struct cb_fac { struct cb_float cbfloat; unsigned char sign; }; /* * cb_var -- data as passed to USR program when not using VARPTR * * cbfac -- Floating Point Accumulator data as passed to USR program * * cbstr -- string data as passed to USR program */ union cb_var { struct cb_fac cbfac; struct cb_str cbstr; };