public void fireBefore(State state, int pc) {
                String idstr = SimUtil.getIDTimeString(simulator);
                LegacyState s = (LegacyState) simulator.getState();
                int code = s.getDataByte((int)STATUS_ADDR.get());
                String name = "UnknownException";
                String msg = "an unknown exception occurred";
                switch (code) {
                    case 0: // normal program return from main
                        return;
                    case ABORT_TYPE_CODE:
                        name = "TypeCheckException";
                        msg = "type check exception in explicit cast";
                        break;
                    case ABORT_NULL_CODE:
                        name = "NullCheckException";
                        msg = "null check exception";
                        break;
                    case ABORT_BOUNDS_CODE:
                        name = "BoundsCheckException";
                        msg = "array bounds check exception";
                        break;
                    case ABORT_DIV_CODE:
                        name = "DivideByZeroException";
                        msg = "division by zero";
                        break;
                    case ABORT_ALLOC_CODE:
                        name = "AllocationException";
                        msg = "dynamic memory allocation failed";
                        break;
                    case ABORT_UNIMP_CODE:
                        name = "UnimplementedException";
                        msg = "method not implemented";
                        break;
                }
                Terminal.print(idstr);
                Terminal.printRed(name);
                Terminal.print(": "+msg+" @ ");
                Terminal.printBrightCyan(StringUtil.addrToString(pc));
                Terminal.nextln();

                printStack(idstr);
            }