diff --git a/src/samplesrc/sanity.pla b/src/samplesrc/sanity.pla index 60cfa35..ba3a28e 100644 --- a/src/samplesrc/sanity.pla +++ b/src/samplesrc/sanity.pla @@ -8,8 +8,9 @@ include "inc/sane.plh" // word iA, iB, iC, zero, fpEnv byte xT[t_extended] -word decform = 0, 4 -byte strA[29] = "8.5" +word decrec = 0, 0 +byte strA[28] = "10" +word decform = 0, 6 // // My custom SANE exception handler // @@ -57,17 +58,6 @@ sane:fpOp2(FFINT|FOX2Z, @iC, @xT) // Convert ext T to int C sane:zpRestore() puti(iA); putc('/'); puti(iB); putc('='); puti(iC); putc('\n') // -// Convert string to and from SANE -// -sane:zpSave() -sane:fpOp2(FFEXT|FOD2B, @xT, "8.5") -//sane:fpOp2(FFINT|FOZ2X, @xT, @iA) // Convert int A to ext T -sane:fpOp2(FFINT|FODIV, @xT, @iB) // Div int B into ext T -sane:fpOp2(FFINT|FOX2Z, @iC, @xT) // Convert ext T to int C -sane:fpOp3(FFEXT|FOB2D, @strA, @xT, @decform) -sane:zpRestore() -puts("8.5 / 4 = "); puts(@strA); putc('('); puti(iC); putc(')'); putln -// // Hook custom HALT exception handler and divide by zero :-) // sane:zpSave() @@ -82,4 +72,15 @@ sane:fpOp2(FFINT|FODIV, @xT, @zero) // Div ZERO into ext T sane:fpOp2(FFINT|FOX2Z, @iC, @xT) // Convert ext T to int C sane:zpRestore() puti(iA); putc('/'); puti(zero); putc('='); puti(iC); putc('\n') +// +// Convert string to and from SANE +// +sane:zpSave() +sane:fpOp2(FFEXT|FOD2B, @xT, @decrec) +//sane:fpOp2(FFINT|FOZ2X, @xT, @iA) // Convert int A to ext T +sane:fpOp2(FFINT|FODIV, @xT, @iB) // Div int B into ext T +sane:fpOp2(FFINT|FOX2Z, @iC, @xT) // Convert ext T to int C +sane:fpOp3(FFEXT|FOB2D, @decrec, @xT, @decform) +sane:zpRestore() +puts("10 / 4 = "); puts(@strA); putc('e'); puti(decrec:2); putc('('); puti(iC); putc(')'); putln done