mirror of
https://github.com/dschmenk/PLASMA.git
synced 2024-06-10 02:29:30 +00:00
116 lines
2.0 KiB
Plaintext
116 lines
2.0 KiB
Plaintext
import fpu
|
|
//
|
|
// FPU register type
|
|
//
|
|
struc t_fpureg
|
|
byte[10] _regdata
|
|
end
|
|
//
|
|
// RPN Register indeces
|
|
//
|
|
const X_REG = 0
|
|
const Y_REG = 1
|
|
const Z_REG = 2
|
|
const T_REG = 3
|
|
//
|
|
// Comparison results
|
|
//
|
|
const FPUCMPGT = $4040 // Greater Than
|
|
const FPUCMPLT = $8080 // Less Than
|
|
const FPUCMPEQ = $0002 // EQual
|
|
const FPUCMPUN = $0101 // UNordered
|
|
//
|
|
// Exceptions
|
|
//
|
|
const FPUINVALID = $01
|
|
const FPUUFLOW = $02
|
|
const FPUOFLOW = $04
|
|
const FPUDIVZER = $08
|
|
const FPUINEXACT = $10
|
|
//
|
|
// FP type
|
|
//
|
|
const FPUSNAN = $00FC // -4: signaling NAN
|
|
const FPUQNAN = $00FD // -3: quiet NAN
|
|
const FPUINF = $00FE // -2: infinite
|
|
const FPUZERO = $00FF // -1: zero
|
|
const FPUNORM = $0000 // 0: normal
|
|
const FPUDENORM = $0001 // 1: denormal
|
|
const FPUNEG = $8000
|
|
//
|
|
// FPU API
|
|
//
|
|
struc t_fpu
|
|
word reset
|
|
word getEnv
|
|
word setEnv
|
|
word testExept
|
|
word setExcept
|
|
word enterProc
|
|
word exitProc
|
|
word constPi
|
|
word constE
|
|
word pushInt
|
|
word pushSgl
|
|
word pushDbl
|
|
word pushExt
|
|
word pushStr
|
|
word pullInt
|
|
word pullSgl
|
|
word pullDbl
|
|
word pullExt
|
|
word pullStr
|
|
word loadInt
|
|
word loadSgl
|
|
word loadDbl
|
|
word loadExt
|
|
word loadStr
|
|
word storInt
|
|
word storSgl
|
|
word storDbl
|
|
word storExt
|
|
word storStr
|
|
word shiftUp
|
|
word shiftDown // dropX
|
|
word rotateUp
|
|
word rotateDown
|
|
word dupX
|
|
word swapXY
|
|
word clearX
|
|
word addXY
|
|
word subXY
|
|
word mulXY
|
|
word divXY
|
|
word remXY
|
|
word negX
|
|
word absX
|
|
word typeX
|
|
word cmpXY
|
|
word logbX
|
|
word scalebXInt
|
|
word truncX
|
|
word roundX
|
|
word sqrtX
|
|
word squareX
|
|
word cosX
|
|
word sinX
|
|
word tanX
|
|
word atanX
|
|
word log2X
|
|
word log21X
|
|
word lnX
|
|
word ln1X
|
|
word pow2X
|
|
word pow21X
|
|
word powEX
|
|
word powE1X
|
|
word powE21X
|
|
word powXInt
|
|
word powXY
|
|
word compXY
|
|
word annuityXY
|
|
word randNum
|
|
end
|
|
const dropX = shiftDown // Alias dropX and shiftDown
|
|
end
|