.TITLE LError Aleda Error Message Routine .Psect Aleda,Con,Gbl .Ident /LVL51 / .Dsabl GBL .Globl LputLn,CnvDec,GetParm ;;************************************************************************** ;; Fortran callable subroutine to print to the console a message associated ;; with ALEDA error return codes. ;; ;; Supports calls of the form: ;; Ierror = LError ( ErrorCode, Value, UserLine, Count) ;; ;;************************************************************************** Lerror:: MOV R5,-(SP) ;SAVE REGISTERS MOV R4,-(SP) MOV R3,-(SP) MOV R2,-(SP) MOV R1,-(SP) MOV R0,-(SP) Mov #64.,Size ;Initialize size to 64 just in case. Clr R0 ;Set for counting parameters. Mov (R5)+,R1 ;Get number of parameters. Bic #177400,R1 ;Clear high order bits. Jsr PC,GetParm ;Get parm #1: Error Code. Bcs JumpPt ;Exit if not provided. Mov (R4),ErrCode ;Save error code parameter. Beq JumpPt ;Exit if code = 0. Br NextParm JumpPt: Jmp LerExt NextParm: Jsr PC,GetParm ;Get parm #2: User supplied value addr. Mov R4,ValAddr ;Save parameter address. Jsr PC,GetParm ;Get parm #3: User supplied string. Mov R4,StrAddr ;Save parameter address. Jsr PC,GetParm ;Get parm #4: User string length. Mov R4,LenAddr ;Save parameter address. Mov #PutParm,R5 ;Move Lputln parm block addr to R5. Mov #LerrAl,4(R5) ;Put address of output msg in parm block. Jsr PC,Lputln ;Output message. "ALEDA ERROR #" Mov ErrCode,R3 ;Move error code to register. Neg R3 ;Complement the error code. Mov R3,CnvVal ;Move -error code value to CnvDec parm. Jsr R5,CnvDec ;Convert error code to string. .Word Control ;CnvDec parameters. .Word CnvStr .Word CnvVal Mov #CnvStr,4(R5) ;Move string address to Lputln parm block. Mov R0,Size ;Mov string length to Lputln parm block. Jsr PC,Lputln ;Output error code. Cmp R3,#20. ;If the error code is less than 20, Blt NoParm ;process for missing parameter. Cmp R3,MaxError ;Error code less than max defined errors? Bgt LnoCode ;If not, error code is invalid. Cmp R3,#0 ;Was error code positive? Blt LnoCode ;If so, error code is invalid. Mov R3,R2 ;Copy error code. Sub #20.,R2 ;Make R2 an index into the vector of Asl R2 ;message addresses. Mov #64.,Size ;Reset Lputln size parameter. Mov Messag(R2),4(R5) ;Move msg address to Lputln parm block. Jsr PC,Lputln ;Output code specific message to console. Br Userln ;Process user supplied parameters. NoParm: Mov #64.,Size ;Reset Lputln size parameter. Mov #Lreq1,4(R5) ;Put address of output msg in parm block. Jsr PC,Lputln ;Output to console. Mov R3,CnvVal ;Mov missing parm # to CnvDec parameter. Jsr R5,CnvDec ;Convert number to string. .Word Control ;CnvDec parameters .Word CnvStr .Word CnvVal Mov #CnvStr,4(R5) ;Move string addr to Lputln parm block. Mov R0,Size ;Move string length to Lputln parm. Jsr PC,Lputln ;Output string. Mov #64.,Size ;Reset Lputln size parameter. Mov #Lreq2,4(R5) ;Move output string address to parm block. Jsr PC,Lputln ;Output message to console. Userln: Mov ValAddr,R2 ;Did user supply a numeric value? Blt UseStr ;If not, process user string. Mov (R2),CnvVal ;Move user value to CnvDec parameter. Jsr R5,CnvDec ;Convert value to string. .Word Control ;CnvDec parameters. .Word CnvStr .Word CnvVal Mov #Atsign,4(R5) ;Move msg address to Lputln parm block. Add #2,R0 ;Char count reflects addition of '@'&','. Movb #',,Atsign(R0) ;Add comma to output string. Mov R0,Size ;Move string length to Lputln size parm. Jsr PC,Lputln ;Output message. UseStr: Mov StrAddr,4(R5) ;Move user's string to Lputln parm block. Blt LerExt ;Exit if not supplied. Mov LenAddr,R2 ;Did user supply a string length? Blt NoLen Mov (R2),Size ;If yes, move it to Lputln size parm. Br StrDone NoLen: Mov #64,Size ;Else assume term. provided in string. StrDone: Jsr PC,Lputln ;Output user supplied string. Br LerExt ;Clean up and exit. LnoCode: Mov #64.,Size ;Reset size to default value. Mov #LerInv,4(R5) ;Put msg address in parm block. Jsr PC,Lputln ;Output invalid error code message. LerExt: Mov #CrLf,4(R5) Jsr PC,Lputln ;Ouput carriage return / line feed. Mov (SP)+,R0 ;Restore registers and return. Mov (SP)+,R1 Mov (SP)+,R2 Mov (SP)+,R3 Mov (SP)+,R4 Mov (SP)+,R5 Rts PC ;;****************************** Messag: .Word Lerr20 .Word Lerr21 .Word Lerr22 .Word Lerr23 .Word Lerr24 .Word Lerr25 .Word Lerr26 .Word Lerr27 .Word Lerr28 .Word Lerr29 .Word Lerr30 .Word Lerr31 .Word Lerr32 .Word Lerr33 .Word Lerr34 .Word Lerr35 .Word Lerr36 .Word Lerr37 ;;****************************** MaxErr: .Word 44. CrLf: .Asciz <15><12> ;;****************************** LReq1: .Asciz / Required parameter #/ ;Character strings LReq2: .Asciz / not provided. / ;output to the console LerrAl: .Asciz /Aleda Error #/ ;to indicate to the LerInv: .Asciz / is an unknown error code. / ;user the cause of Lerr20: .Asciz / No device descriptor. / ;error. Lerr21: .Asciz / Device not enabled. / Lerr22: .Asciz / Device already enabled. / Lerr23: .Asciz / CSR not in IO page. / Lerr24: .Asciz / Vector out of range. / Lerr25: .Asciz / Device is not an input device. / Lerr26: .Asciz / Device is not an output device. / Lerr27: .Asciz / ALVIN enable failure. / Lerr28: .Asciz / ALVIN disable failure. / Lerr29: .Asciz / Device already active. / Lerr30: .Asciz / Buffer not at least 20 bytes. / Lerr31: .Asciz / Buffer not word aligned. / Lerr32: .Asciz / Buffer overrun. / Lerr33: .Asciz / Terminators not provided. / Lerr34: .Asciz / Terminator not found. / Lerr35: .Asciz / Input error detected. / Lerr36: .Asciz / Console is seized. / Lerr37: .Asciz / No buffer descriptor. / Lerr38: .Asciz / Failed to connect to CL. / Lerr39: .Asciz / CL under RT unavailable. / Lerr40: .Asciz / Invalid unit number. / Lerr41: .Asciz / Invalid device under TSX. / Lerr42: .Asciz / Channel open to CL failed. / Lerr43: .Asciz / Direct interrupt table full. / Lerr44: .Asciz / Vector is seized. / ;;*********************************************** .Even Unit: .Word 1 ;Lputln parm., output unit number. Size: .Word 64. ;Lputln parm., line size (maximum). One: .Word 1 ;Lputln parm., process terminators. Term0: .Byte 2,0,134 ;Lputln parm., line terminator = null,'\' ;;*********************************************** .Even ;CnvDec parameters. Control: .Word 0 ;Control Word 0=left justify, no decimal pt. CnvVal: .Word 0 ;Value to be converted. Atsign: .Ascii /@/ CnvStr: .Asciz / / ;Buffer for string representation of CnvVal. ;;*********************************************** .Even PutParm: .Word 6 ;Parameter block for calls to Lputln. .Word Unit ;Address of unit number to ouptut to. .Word 0 ;Address of output line. .Word Size ;Address of line size. .Word -1 ;Optional parameter return count not provided. .Word One ;Address of control word parameter. .Word Term0 ;Address of terminator array parameter. ;;*********************************************** ErrCode: .Word 0 ValAddr: .Word 0 StrAddr: .Word 0 LenAddr: .Word 0 ;;**************************************************************************** .END