home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / decpro300 / proerr.mac < prev    next >
Text File  |  2020-01-01  |  8KB  |  315 lines

  1.     .TITLE    KERERR - KERFIL error routines
  2.     .SBTTL    S Hecht/D Stevens/R McQueen        14-July-1983
  3.  
  4. ;++
  5. ; This module contains the error processing routines for PRO/Kermit.
  6. ; Some of the error text is also contained in this module.
  7. ;--
  8.  
  9. ; Version number
  10.  
  11.     .IDENT    /1.0.02/
  12.  
  13. ; Directives
  14.  
  15.     .LIBRARY /KERMLB/        ; Kermit macro library
  16.     .ENABLE    LC            ; Enable lower case in ASCIx
  17.     .NLIST    BEX
  18.  
  19.     .SBTTL    Revision History
  20.  
  21. ;++
  22. ; 1.0.00    By: Authors        On: Many days
  23. ;        Create this module
  24. ;
  25. ; 1.0.01    By: Robert C. McQueen    On: 15-Feb-1984
  26. ;        Position the cursor to the correct place to output error
  27. ;        messages.
  28. ;
  29. ; 1.0.02    By: Nick Bush        On: 15-Feb-1984
  30. ;        Fix calls to SND.ERROR to have arguments in the correct
  31. ;        order.
  32. ;--
  33.  
  34.     .SBTTL    Get general symbol
  35.  
  36. ;++
  37. ; Include the PRO/Kermit definitions
  38. ;--
  39.  
  40.     .MCALL    KERDEF
  41.     KERDEF                ; Define all of the various
  42.                     ;  symbols
  43.     .MCALL    CHRDEF            ; Character definitions
  44.     CHRDEF                ; Get the character definitions
  45.  
  46.     .MCALL    BLSRTN            ; Allow use of BLISS macros
  47.     .MCALL    BLSCAL            ;   from library
  48.     .MCALL    MSG            ; Text expansion macro
  49.     .MCALL    PJMP            ; Jump and return macro
  50.  
  51.     .SBTTL    Error routine data
  52.  
  53. ; Psect for the read only data
  54.  
  55.     .PSECT    $PLIT$,  RO ,  D  
  56.  
  57. ; File specifications of where the message files are
  58.  
  59.     MSG    MFIL,<LB:[ZZKERMIT]KERMIT.MSG>
  60.     MSG    RFIL,<LB:[ZZKERMIT]RMSERR.MSG>
  61.  
  62. ; The following is the default text for error messages
  63.  
  64. M$PROK:    .ASCII    \?PRO/Kermit \
  65. PROK$L=.-M$PROK
  66.     MSG    RMSG,<RMS message file problem>
  67.     MSG    MMSG,<PRO/Kermit message file problem>
  68.     MSG    URMS,<Unknown RMS error - >
  69.     MSG    UKER,<Unknown PRO/Kermit error - >
  70.  
  71.     .SBTTL    Data storage
  72.  
  73. ;++
  74. ; The following section contains the storage for KERERR.  This storage
  75. ; is mainly for the calls.
  76. ;--
  77.  
  78.     .PSECT    $OWN$,  D  
  79.  
  80. FRAMID:    .BLKW    5            ; Up to 9 characters for frame-id
  81. FRAMLN:    .BLKW                ; Length of the frame id
  82. FILLEN:    .BLKW                ; Length of the file name
  83. RTNLEN:    .BLKW                ; Return length
  84. MESSAG:    .BLKB    96.            ; Place for up to 96 charaters
  85. ERRMSB:    .BLKB    96.            ; Error message to give to KERMSG
  86. ERRMSL=.-ERRMSB                ; Length of message
  87.     .EVEN                ; Back to even addresses
  88. ERRLEN:    .WORD    96.            ; Length of the error buffer
  89.  
  90. ; Argument block for the READ MESSAGE routine call
  91.  
  92. ARGBLK:    .BYTE    8.,0
  93.     .WORD    STATUS            ; Pointer to status information
  94. ARGFLN:    .WORD    0            ; File name
  95.     .WORD    FILLEN            ; Length of the file name
  96.     .WORD    FRAMID            ; Frame id
  97.     .WORD    FRAMLN            ; Length of the frame id
  98.     .WORD    MESSAG            ; Place for the error message
  99.     .WORD    ERRLEN            ; Error length
  100.     .WORD    RTNLEN            ; Returned length
  101.  
  102.     .SBTTL    RMS-11 Error processing
  103.  
  104. ;++
  105. ; This routine will handle the various possible RMS-11 errors that can occur.
  106. ; It will list the error information on the user's screen and then return
  107. ; to the caller.
  108. ;
  109. ; Usage:
  110. ;
  111. ; Macro:
  112. ;    MOV    #Error,R0
  113. ;    JSR    PC,RMSERR
  114. ;    (Return)
  115. ;
  116. ;--
  117.  
  118.     .PSECT    $CODE$,    RO
  119.  
  120.     .GLOBL    RMSERR
  121.  
  122. RMSERR:    NEG    R0            ; Make this a positive number
  123.     JSR    PC,CVTERR        ; Convert the error code to something
  124.                     ;  real
  125.     MOV    #M$RFIL,R0        ; Point to the specification
  126.     MOV    #RFIL$L,R1        ; Store the length
  127.     JSR    PC,GETMSG        ; Get the message from the file
  128.     BCS    10$            ; Branch if the error code was set
  129.     PJMP    SNDMSG            ; Send the error to the remote
  130.  
  131. ; Here if we have to construct an error message for an unknown error message
  132. ; was encountered.
  133.  
  134. 10$:    MOV    #M$RMSG,R0        ; Get the address of the error message
  135.     MOV    #RMSG$L,R1        ; Get the length
  136.     MOV    #M$URMS,R2        ; Get the other part
  137.     PJMP    MSGERR            ; Issue the message error message
  138.  
  139.     .SBTTL    Bliss Interface -- KRM.ERROR
  140.  
  141. ;++
  142. ; This routine is called from KERMSG to handle error processing for
  143. ; a specific error code.
  144. ;--
  145.  
  146.     .PSECT    $CODE$,    RO
  147.  
  148.     BLSRTN    KRM.ERROR,3,<ERRCOD>    ; Bliss routine
  149.     MOV    ERRCOD(SP),R0        ; Move the error code to the register
  150.     JSR    PC,CVTERR        ; Convert the error code to something
  151.                     ;  real
  152.     MOV    #M$MFIL,R0        ; Point to the specification
  153.     MOV    #MFIL$L,R1        ; Store the length
  154.     JSR    PC,GETMSG        ; Get the message from the file
  155.     BCS    10$            ; Branch if the error code was set
  156.     PJMP    SNDMSG            ; Send the error to the remote
  157.  
  158. ; Here if we have to construct an error message for an unknown error message
  159. ; was encountered.
  160.  
  161. 10$:    MOV    #M$MMSG,R0        ; Get the address of the error message
  162.     MOV    #MMSG$L,R1        ; Get the length
  163.     MOV    #M$UKER,R2        ; . . . 
  164. ;    PJMP    MSGERR            ; Issue the message error message
  165.  
  166.     .SBTTL    MSGERR - Here if there was a message file error
  167.  
  168. ;++
  169. ; Here if there was a message file error message.  Issue the error message
  170. ; and then send it to the remote system.
  171. ;
  172. ; Usage:
  173. ;    MOV    #Msg.address,R0
  174. ;    JSR    PC,MSGERR
  175. ;    (Return)
  176. ;--
  177.  
  178.     .PSECT    $CODE$,    RO
  179.  
  180. MSGERR:    BLSCAL    BL$MOV,<R1,R0,MSG1>,+    ; Move the first line
  181.     MOV    R0,TEMP            ; Save for later
  182.     JSR    PC,ALTBUF        ; Set the alternate type out
  183.     BLSCAL    TT.TEXT,<R2>,+        ; Type out the text
  184.     BLSCAL    TT.NUMB,<STATUS>,+    ; Output the first status number
  185.     BLSCAL    TT.CHAR,<#.CHCMA>,+    ; Output a comma
  186.     BLSCAL    TT.NUMB,<STAT1>,+    ; And the second part of the status
  187.     BLSCALL    TT.OUTPUT        ; Output the text
  188.     JSR    PC,ALTRST        ; Restore the old routine
  189. ;[02]
  190. ;[02] Build message with correct prefix to have KERMSG send
  191. ;[02]
  192.     BLSCAL    BL$MOV,<#PROK$L,#M$PROK,#ERRMSB>,+ ;[02] Copy prefix
  193.     BLSCAL    BL$CPY,<IOBLEN,#IOBUFF,#0,#ERRMSL-PROK$L,#ERRMSB+PROK$L,#-5>,+
  194.     MOV    IOBLEN,R2        ;[02] Get message length
  195.     ADD    #PROK$L,R2        ;[02] Including prefix
  196.     BLSCAL    SND.ER,<R2,#ERRMSB>,+    ;[02] Send the error the the remote
  197.  
  198.     BLSCAL    BL$MOV,<IOBLEN,#IOBUFF,MSG2>,+ ; Move the text
  199.     MOV    #1.,R2            ; Postion to the error place
  200.     MOV    #18.,R5            ;[01] . . .
  201.     JSR    PC,CURABS        ; Position the cursor
  202.     MOV    TEMP,R0            ; Get the first line
  203.     BLSCAL    TT.TEXT,<R0>,+        ; Output the text
  204.     BLSCAL    TT.CRLF,,+            ; New line
  205.     BLSCAL    TT.TEXT,<#IOBUFF>,+    ; Output the built line
  206.     BLSCAL    TT.OUTPUT,,-        ; Force it out
  207.     RTS    PC            ; Return to the caller
  208.  
  209.     .SBTTL    CVTERR - Convert error code to frame-id
  210.  
  211. ;++
  212. ; This routine will convert an error code to a frame-id.  It will return
  213. ; with the length of the text and the text stored in the argument block
  214. ; to the RDMSG routine.
  215. ;
  216. ; Usage:
  217. ;    MOV    Msg.number,R0
  218. ;    JSR    PC,CVTERR
  219. ;    (Return)
  220. ;
  221. ;--
  222.  
  223.     .PSECT    $CODE$,    RO
  224.  
  225. CVTERR:    MOV    R0,-(SP)        ; Save on the stack
  226.     JSR    PC,ALTBUF        ; Set up the alternate routine
  227.     MOV    (SP)+,R2        ; Get the number back
  228.     JSR    PC,CHGDEC        ; Output the number
  229.     BLSCAL    TT.OUTPUT        ; Dump the buffer
  230.     MOV    IOBLEN,FRAMLN        ; Store the length
  231.     BLSCAL    BL$MOV,<FRAMLN,#IOBUFF,#FRAMID> ; Copy the information
  232.     PJMP    ALTRST            ; Restore the alternate type out rtn
  233.  
  234.     .SBTTL    Get an error message
  235.  
  236. ;++
  237. ; This routine will get an error message from the specified message
  238. ; file.  It will return with the error message in the output buffer
  239. ; and the length of the error message.  If the error message was not
  240. ; found, an error code will be returned.
  241. ;
  242. ; Usage:
  243. ;    MOV    #Address.of.file.spec,R0
  244. ;    MOV    #Length.of.file.spec,R1
  245. ;    JSR    PC,GETMSG
  246. ;    (Return)
  247. ;
  248. ; On return:
  249. ;     - If an error else
  250. ;     - If not.
  251. ;--
  252.  
  253.     .PSECT    $CODE$,    RO
  254.  
  255. GETMSG:    MOV    R0,ARGFLN        ; Store the address of the file name
  256.     MOV    R1,FILLEN        ; Store the length of the file name
  257.     MOV    #ARGBLK,R5        ; Set up the argument block
  258.     CALL    RDMSG            ; Call the subroutine that does the
  259.                     ;  work
  260.     TST    STATUS            ; Did we get an error?
  261.     BGE    99$            ; No, just give a good return
  262.  
  263. ; Here to pass a failure return back to the caller.  Do this by setting
  264. ; the carry bit.
  265.  
  266.     SEC                ; Set the failure (carry
  267.  
  268. ; Here to return to the user.  Note that carry is cleared by the TST,
  269. ; so we don't have to do it.
  270.  
  271. 99$:    RTS    PC            ; And return to the caller
  272.  
  273.     .SBTTL    Send the error message
  274.  
  275. ;++
  276. ; This routine will issue the error message on the user's screen and send
  277. ; the error message back to the remote system.
  278. ;
  279. ; Usage:
  280. ;    JSR    PC,SNDMSG
  281. ;    (Return)
  282. ;
  283. ; Assumes:
  284. ;    GETMSG was called just before this.
  285. ;
  286. ;--
  287.  
  288.     .PSECT    $CODE$,    RO
  289.  
  290. SNDMSG:    MOV    RTNLEN,R0        ; Get the length returned
  291.     CMP    #79.,R0            ; Compare against max of 80
  292.                     ;  on the screen
  293.     BGE    10$            ; Skip this if less than
  294.     MOV    #79.,R0            ; Truncate at 80
  295. 10$:    BLSCAL    BL$MOV,<R0,#MESSAG,#MSG1>,+ ; Move the message to the buffer
  296. ;[02]
  297. ;[02] Build message with correct prefix to have KERMSG send
  298. ;[02]
  299.     BLSCAL    BL$MOV,<#PROK$L,#M$PROK,#ERRMSB>,+ ;[02] Copy prefix
  300.     BLSCAL    BL$CPY,<ERRLEN,#MESSAG,#0,#ERRMSL-PROK$L,#ERRMSB+PROK$L,#-5>,+
  301.     MOV    ERRLEN,R2        ;[02] Get message length
  302.     ADD    #PROK$L,R2        ;[02] Including prefix
  303.     BLSCAL    SND.ER,<R2,#ERRMSB>,+    ;[02] Send the error the the remote
  304.     MOV    #1.,R2            ; Position to 1,23
  305.     MOV    #18.,R5            ;[01] . . .
  306.     JSR    PC,CURABS        ; Put the cursor there
  307.     BLSCAL    TT.TEXT,<#MESSAG>,+    ; Output the argument
  308.     BLSCAL    TT.OUTPUT,,-        ; Output the text
  309.     RTS    PC            ; Return to the caller
  310.  
  311.     .SBTTL    End of KERERR
  312.  
  313.  
  314.     .END
  315.