/* floats.c - allocate and work with floats.
 *  Copyright (C) 2022 by Jed Marti
 *   This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *   (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see https://www.gnu.org/licenses/.
 */


#include <C8051F380.h>
#include <stdint.h>

#include "config.h"
#include "storage.h"
#include "serial.h"



extern __xdata uint16_t actives;

extern uint16_t      DREG;
extern __xdata floatOrInt FACC;


uint16_t newFloat(float f)
{
  DREG = dmalloc(4);
  setTag(DESC_FLOAT);
  FACC.f = f;
  setFACC();
  return DREG;
}



uint16_t newFloatAddr(uint32_t __xdata *ptr)
{
  DREG = dmalloc(4);
  // putstring("new float "); puthex16(DREG); terpri();
  setTag(DESC_FLOAT);
  setFloat(ptr);
  return DREG;
}
  


// EOF
