home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
AmigActive 4
/
AACD04.ISO
/
CDTools
/
IDer
/
Routines
/
ErrorHandler.s
< prev
next >
Wrap
Text File
|
1997-02-18
|
2KB
|
41 lines
ErrorHandler: Tst.W _ErrorCode ;no errors, then we are outta here
Beq.S .NoErrors
Moveq #0,D0
Move.W _ErrorCode(PC),D0 ;get the error code returned from main code
Cmp.W #1,D0 ;the ReadArgs error uses 1 instead of 0
Bne.S .NotRDA ;to avoid being mistaken for no error
Subq #1,D0
.NotRDA Move.L #ErrorHeader,D1 ;start of the error message
Lea ErrTable(PC),A0 ;table of error messages
Add.L D0,A0 ;move a certain amount into the table
Move.L A0,D2 ;get the address of the message we need
;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
.PrintError Tst.L _WBMessage ;if we are running from workbench
Bne.S .FromWB ;chances are, we don't have a CON: available
CALL VPrintf,DOS ;type the text to the con window
.NoErrors Rts
;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
.FromWB Clr.B ErrorHeader+25 ;we don't need an extra CR in the requestor
Moveq #'\n',D0 ;CR ASCII code
Move.B D0,ErrProcessing+10 ;The following lines break up the text
Move.B D0,ErrOpening+7 ;that appears in the error requestors.
Move.B D0,ErrReading+7 ;This is so the lines are not too long
Move.B D0,ErrMemory+17 ;if a long filename is provided, or
Move.B D0,ErrASLReq+10 ;if the user is using a small screen
Move.B D0,ErrEndOfCfg+7
Sub.L A0,A0 ;window to open on
Lea _esReq(PC),A1 ;easyrequest structure
Sub.L A2,A2 ;no custom IDCMP requests
Move.L D1,es_TextFormat(A1) ;requestor text
Move.L #Ok,es_GadgetFormat(A1) ;requestor gadget
Move.L D2,A3 ;requestor text arguments
CALL EasyRequestArgs,INTUI ;bring up the requestor.
Rts