*
* FORTRAN system subroutine to print a standard error message
*
*   Error code is passed in D1
*
*   This is not a user callable routine
*
*
* Copyright (c) 1986  Absoft Corporation, Royal Oak, MI  48072
*
*
* Edit history:
*
*  20 Feb 86    converted from VERSAdos to AmigaDOS                     PAJ
*


ERRMSG: LEA     MSGTBL(PC),A1           * load address of message table

*
* - locate message in table
*

L1:     CMPI.B  #@377,(A1)              * end of table?
        BEQ.S   L20                     *   yes
        CMP.B   (A1)+,D1                * correct message?
        BEQ.S   L10                     *   yes
L2:     TST.B   (A1)+                   * end of message?
        BNE.S   L2                      *   no
        BRA.S   L1                      *   yes

*
* - copy message into output buffer
*

L10:    MOVE.W  #$0D0A,(A2)+
        MOVE.B  #'?',(A2)+
L11:    TST.B   (A1)                    * end of message?
        BEQ.S   L22                     *   yes
        MOVE.B  (A1)+,(A2)+             * copy a character
        BRA.S   L11

*
* - message not in table; set flags for error number processing
*

L20:    MOVE.W  #0,CCR
L22:    RTS


MSG     MACRO
        DC.B    \1
        DC.B    '\2'
        DC.B    0
        ENDM

MSGTBL:

* - FORTRAN runtime error messages:

        MSG     0,<Operator Interrupt>
        MSG     64,<Heap space overflow>
        MSG     65,<Numeric overflow>
        MSG     66,<Divide by zero>
        MSG     67,<Invalid function argument>
        MSG     68,<Stack underflow>
        MSG     69,<Stack overflow>
        MSG     70,<COMMON buffer not found>
        MSG     71,<Illegal record length>
        MSG     72,<Record overflow>
        MSG     73,<Duplicate virtual array>
        MSG     74,<Virtual buffer not found>
        MSG     75,<Subprogram not found>
        MSG     76,<FORMAT syntax error>
        MSG     77,<File not open for WRITE>
        MSG     78,<File not open for READ>
        MSG     79,<No match found for SELECT CASE>
        MSG     80,<Subprogram argument list mismatch>
        MSG     81,<FORMAT descriptor error>
        MSG     82,<Array boundary error>
        MSG     83,<Unsupported function call>
        MSG     84,<Floating point hardware not found>
        MSG     85,<Illegal substring expression>

* - AmigaDOS from Ioerr(), etc.

        MSG     202,<Object in use>
        MSG     203,<Object exists>
        MSG     205,<Object not found>
        MSG     209,<Action not known>
        MSG     210,<Invalid component name>
        MSG     211,<Invalid lock>
        MSG     212,<Object wrong type>
        MSG     213,<Disk not validated>
        MSG     214,<Disk write protected>
        MSG     215,<Rename across devices>
        MSG     216,<Directory not empty>
        MSG     218,<Device not mounted>
        MSG     219,<Seek error>
        MSG     220,<Comment too big>
        MSG     221,<Disk full>
        MSG     222,<Delete protected>
        MSG     223,<Write protected>
        MSG     224,<Read protected>
        MSG     225,<Not a DOS disk>
        MSG     226,<No disk>
        MSG     232,<No more entries>

        DC.B    @377                    * end of table

        END
