//
// MegaFlash Hardware Constants
// For Apple IIc/IIc+ with MegaFlash storage device
//
import megaflash
//
// MegaFlash I/O Registers (Slot 4)
//
const MF_SLOT       = 4
const MF_CMDREG     = $C480     // Command register
const MF_PARAMREG   = $C481     // Parameter register (read/write)
const MF_STATUSREG  = $C482     // Status register
const MF_IDREG      = $C483     // ID register

//
// MegaFlash FPU Commands
//
const MF_CMD_FADD   = $30       // Floating point add
const MF_CMD_FMUL   = $31       // Floating point multiply
const MF_CMD_FDIV   = $32       // Floating point divide
const MF_CMD_FSIN   = $33       // Floating point sine
const MF_CMD_FCOS   = $34       // Floating point cosine
const MF_CMD_FTAN   = $35       // Floating point tangent
const MF_CMD_FATN   = $36       // Floating point arctangent
const MF_CMD_FLOG   = $37       // Floating point natural log
const MF_CMD_FEXP   = $38       // Floating point exponential
const MF_CMD_FSQR   = $39       // Floating point square root
const MF_CMD_FOUT   = $3A       // Format floating point as string

//
// MegaFlash Error Codes (in parameter buffer)
//
const MF_ERR_NONE       = $00   // No error
const MF_ERR_OVERFLOW   = $80   // Overflow error
const MF_ERR_DIV0       = $40   // Division by zero
const MF_ERR_ILLEGAL    = $20   // Illegal quantity

//
// Status Register Bits
//
const MF_STATUS_BUSY    = $80   // Busy flag (bit 7)

//
// MBF (Microsoft Binary Format) constants
//
const MBF_SIZE          = 6     // FAC/ARG size: exp + sign + 4 mantissa bytes
const MBF_EXT_SIZE      = 1     // Extension byte size
const MBF_TOTAL         = 13    // Total buffer size for FAC+ARG+EXT

//
// SANE Extended Format constants (for conversion)
//
const t_extended        = 10    // 80-bit extended precision size

end
