mirror of
https://github.com/dschmenk/PLASMA.git
synced 2025-01-08 07:31:32 +00:00
SANE exception working on 64K after fixing Apple document bug
This commit is contained in:
parent
bbc36b69b3
commit
0432f68e90
@ -22,10 +22,6 @@ export word[7] sane = @fpInit, @fpDefaultHalt, @uninit0, @uninit1, @uninit2, @un
|
|||||||
//
|
//
|
||||||
word fp6502
|
word fp6502
|
||||||
//
|
//
|
||||||
// Pointer to Halt handler
|
|
||||||
//
|
|
||||||
word hhaddr
|
|
||||||
//
|
|
||||||
// PLASMA <-> SANE interface routines
|
// PLASMA <-> SANE interface routines
|
||||||
//
|
//
|
||||||
asm equates
|
asm equates
|
||||||
@ -56,6 +52,7 @@ asm xfpHalt
|
|||||||
LDX #$F7
|
LDX #$F7
|
||||||
end
|
end
|
||||||
asm fpHalt
|
asm fpHalt
|
||||||
|
STA $C008
|
||||||
TXA
|
TXA
|
||||||
LDX ESP
|
LDX ESP
|
||||||
STA ESTKL,X
|
STA ESTKL,X
|
||||||
@ -424,7 +421,9 @@ end
|
|||||||
// Default HALT handler
|
// Default HALT handler
|
||||||
//
|
//
|
||||||
def fpDefaultHalt(pstatus)
|
def fpDefaultHalt(pstatus)
|
||||||
|
sane[8]() // zpRestore
|
||||||
puts("SANE Exception="); puti(pstatus->8); puts("!\n")
|
puts("SANE Exception="); puti(pstatus->8); puts("!\n")
|
||||||
|
sane[7]() // zpSave
|
||||||
return pstatus=>4
|
return pstatus=>4
|
||||||
end
|
end
|
||||||
//
|
//
|
||||||
@ -626,9 +625,7 @@ def fpInit()
|
|||||||
//
|
//
|
||||||
// Install AUX HALT handler
|
// Install AUX HALT handler
|
||||||
//
|
//
|
||||||
hhaddr = @xfpHalt
|
xfpOp1($0005, @xfpHalt)
|
||||||
(@fixupHLT)=>1 = @sane+2
|
|
||||||
xfpOp1($0005, @hhaddr)
|
|
||||||
else
|
else
|
||||||
//
|
//
|
||||||
// Fixup MAIN calls in interface routines
|
// Fixup MAIN calls in interface routines
|
||||||
@ -647,14 +644,17 @@ def fpInit()
|
|||||||
//
|
//
|
||||||
// Install MAIN HALT handler
|
// Install MAIN HALT handler
|
||||||
//
|
//
|
||||||
hhaddr = @fpHalt
|
fpOp1($0005, @fpHalt)
|
||||||
(@fixupHLT)=>1 = @sane+2
|
|
||||||
fpOp1($0005, @hhaddr)
|
|
||||||
fin
|
fin
|
||||||
sane[5] = @elemsLoad1
|
sane[5] = @elemsLoad1
|
||||||
sane[6] = @elemsLoad2
|
sane[6] = @elemsLoad2
|
||||||
fin
|
fin
|
||||||
sane[1] = @fpDefaultHalt
|
(@fixupHLT)=>1 = @sane+2
|
||||||
|
sane[1] = @fpDefaultHalt
|
||||||
|
//
|
||||||
|
// Reset environment word
|
||||||
|
//
|
||||||
|
sane[3]($0001, $0000)
|
||||||
end
|
end
|
||||||
//
|
//
|
||||||
// Uninitialized placeholders of API
|
// Uninitialized placeholders of API
|
||||||
|
@ -10,6 +10,7 @@ word iA, iB, iC, zero, fpEnv
|
|||||||
byte xT[t_extended]
|
byte xT[t_extended]
|
||||||
|
|
||||||
def myException(pstatus)
|
def myException(pstatus)
|
||||||
|
sane:zpRestore()
|
||||||
puts("Floating point exception:")
|
puts("Floating point exception:")
|
||||||
if pstatus->8 & FBINVALID; puts(" INVALID"); fin
|
if pstatus->8 & FBINVALID; puts(" INVALID"); fin
|
||||||
if pstatus->8 & FBUFLOW; puts(" UNDERFLOW"); fin
|
if pstatus->8 & FBUFLOW; puts(" UNDERFLOW"); fin
|
||||||
@ -17,6 +18,7 @@ def myException(pstatus)
|
|||||||
if pstatus->8 & FBDIVZER; puts(" DIV_BY_ZERO"); fin
|
if pstatus->8 & FBDIVZER; puts(" DIV_BY_ZERO"); fin
|
||||||
if pstatus->8 & FBINEXACT; puts(" INEXACT"); fin
|
if pstatus->8 & FBINEXACT; puts(" INEXACT"); fin
|
||||||
putln
|
putln
|
||||||
|
sane:zpSave()
|
||||||
return pstatus=>4
|
return pstatus=>4
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -51,8 +53,14 @@ sane:fpOp2(FFINT|FOX2Z, @iC, @xT) // Convert ext T to int C
|
|||||||
sane:zpRestore()
|
sane:zpRestore()
|
||||||
puti(iA); putc('/'); puti(iB); putc('='); puti(iC); putc('\n')
|
puti(iA); putc('/'); puti(iB); putc('='); puti(iC); putc('\n')
|
||||||
sane:zpSave()
|
sane:zpSave()
|
||||||
|
//
|
||||||
|
// Hook custom HALT exception handler and divide by zero :-)
|
||||||
|
//
|
||||||
sane:fpHalt = @myException
|
sane:fpHalt = @myException
|
||||||
fpEnv = sane:fpOp0(FOGETENV)
|
fpEnv = sane:fpOp0(FOGETENV)
|
||||||
|
//
|
||||||
|
// Enable all exceptions
|
||||||
|
//
|
||||||
sane:fpOp1(FOSETENV, fpEnv | FBINVALID | FBUFLOW | FBOFLOW | FBDIVZER | FBINEXACT)
|
sane:fpOp1(FOSETENV, fpEnv | FBINVALID | FBUFLOW | FBOFLOW | FBDIVZER | FBINEXACT)
|
||||||
sane:fpOp2(FFINT|FOZ2X, @xT, @iA) // Convert int A to ext T
|
sane:fpOp2(FFINT|FOZ2X, @xT, @iA) // Convert int A to ext T
|
||||||
sane:fpOp2(FFINT|FODIV, @xT, @zero) // Div ZERO into ext T
|
sane:fpOp2(FFINT|FODIV, @xT, @zero) // Div ZERO into ext T
|
||||||
|
Loading…
Reference in New Issue
Block a user