;File SysAlerts.Text
;
;   Standard Alerts for the development system -- Resource Type INIT, ID 2
;
;   These alerts are intended for programmers. Naive users should use
;   "UserAlerts" instead of these "SysAlerts" .
;
;   Re-Created and improved by Gustavo A. Fernandez 3/2/85
;
               .NOLIST
               .INCLUDE	   TlAsm/SYSEQU.TEXT
               .INCLUDE	   TlAsm/SYSMACS.TEXT
               .INCLUDE	   TlAsm/FSEQU.TEXT
               .INCLUDE	   TlAsm/TOOLEQU.TEXT
               .INCLUDE	   TlAsm/QUICKMACS.TEXT
               .INCLUDE	   TlAsm/TOOLMACS.TEXT
               .INCLUDE	   TlAsm/GrafTypes.Text
               .LIST

               .PROC	   INIT,0

                BRA	   InstallIt

DSStart
         .WORD	  61		        ; # of entries

; Alert definitions

         .WORD	  32767,10,50,0,36,94,72
         .WORD	  2,10,52,0,36,94,72
         .WORD	  3,10,53,0,36,94,72
         .WORD	  4,10,54,0,36,94,72
         .WORD	  5,10,55,0,36,94,72
         .WORD	  6,10,56,0,36,94,72
         .WORD	  10,10,60,0,36,94,72
         .WORD	  11,10,61,0,36,94,72
         .WORD	  12,10,62,0,36,94,72
         .WORD	  13,10,63,0,36,94,72
         .WORD	  14,10,64,0,36,94,72
         .WORD	  15,10,65,0,36,94,72
         .WORD	  16,10,68,0,36,94,72
         .WORD	  17,10,69,0,36,94,72
         .WORD	  18,10,69,0,36,94,72
         .WORD	  19,10,69,0,36,94,72
         .WORD	  20,10,69,0,36,94,72
         .WORD	  21,10,69,0,36,94,72
         .WORD	  22,10,69,0,36,94,72
         .WORD	  23,10,69,0,36,94,72
         .WORD	  24,10,69,0,36,94,72
         .WORD	  25,10,49,0,36,94,72
         .WORD	  26,10,65,0,36,94,72
         .WORD	  27,10,48,0,36,94,72
         .WORD	  28,10,47,0,36,95,72
         .WORD	  30,10,46,0,37,96,0
         .WORD	  41,10,67,0,36,0,70


; Text tables

         .MACRO	 text
         .WORD	 %1
@1	 .WORD	 @2-@1-2
         .WORD	 %2,%3
         .ASCII	 %4
         .BYTE	 0
         .ALIGN 2
@2
         .ENDM

data4	 text	 50,83,130,'System Error'
         text	 52,83,130,'Address Error'
         text	 53,83,130,'Illegal Instruction'
         text	 54,83,130,'Zero Divide'
         text	 55,83,130,'Check Exception'
         text	 56,83,130,'TrapV Exception'
         text	 60,83,130,'Fxxx breakpoint'
         text	 61,83,130,'Miscellaneous Exception'
         text	 62,83,130,'Unimplemented Core Routine'
         text	 63,83,130,'Interupt switch pressed'
         text	 64,83,130,'I/O System Error'
         text	 65,83,130,'Segment Loader Error'
         text	 67,86,130,"Can't load the finder"
         text	 68,83,130,'Floating Point error'
         text	 69,83,130,"Can't load package error"
         text	 47,83,130,'Stack overflow error'
         text	 48,83,130,'File Map trashed'
         text	 49,83,130,'Out of memory!'
         text	 46,30,75,'Please insert the disk:'

;
; icons -- Susan's bomb
;
               .WORD	 36,136
               .WORD	 72,50,104,82

          .LONG	    $00000808
          .LONG	    $00000010
          .LONG	    $00000420
          .LONG	    $00008040
          .LONG	    $00002200
          .LONG	    $00000800
          .LONG	    $001F002A
          .LONG	    $0020C700
          .LONG	    $00403800
          .LONG	    $00400020
          .LONG	    $00400910
          .LONG	    $03F81008
          .LONG	    $03F82104
          .LONG	    $03F80000
          .LONG	    $0FFE0100
          .LONG	    $3FFF8000
          .LONG	    $3FFF8000
          .LONG	    $7FFFC000
          .LONG	    $7FFFC000
          .LONG	    $FFFDE000
          .LONG	    $FFFFE000
          .LONG	    $FFFEE000
          .LONG	    $FFFEE000
          .LONG	    $FFFEE000
          .LONG	    $FFFFE000
          .LONG	    $FFFDE000
          .LONG	    $7FFFC000
          .LONG	    $7FF7C000
          .LONG	    $3FFF8000
          .LONG	    $3FFF8000
          .LONG	    $0FFE0000
          .LONG	    $03F80000

;
; disk switched icon

           .WORD     37,136
           .Word     20,24,52,56

           .LONG    $002ADE00
           .LONG    $00800100
           .LONG    $00000080
           .LONG    $01000080
           .LONG    $000003E0
           .LONG    $010001C0
           .LONG    $00000080
           .LONG    $00000000
           .LONG    $FFF83FFC
           .LONG    $88A44452
           .LONG    $88A24451
           .LONG    $88224411
           .LONG    $8FE247F1
           .LONG    $80024001
           .LONG    $80024001
           .LONG    $9FF24FF9
           .LONG    $A00A5005
           .LONG    $A00A5005
           .LONG    $A00A5005
           .LONG    $A00A5005
           .LONG    $A00A5005
           .LONG    $A00A5005
           .LONG    $FFFE7FFF
           .LONG    $00000000
           .LONG    $01000000
           .LONG    $03800080
           .LONG    $07C00000
           .LONG    $01000080
           .LONG    $01000000
           .LONG    $00800100
           .LONG    $007B5400
           .LONG    $00000000

; Button list

;  70,71 Can't find finder
               .WORD	 70,14
               .WORD	 1
               .WORD	 80,160,50,180,110,90


               .WORD	 71,14
               .WORD	 1
               .WORD	 80,160,50,180,110,90

; 72,73 - General system error

               .WORD    72,26
               .WORD    2
               .WORD    80,162,50,182,110,90
               .WORD    81,162,135,182,185,91

               .WORD    73,38
               .WORD    3
               .WORD    80,162,50,182,110,90
               .WORD    81,162,135,182,185,91
               .WORD    82
ResumeRect     .WORD	   162,210,182,270
               .WORD			   92

; Strings

               .WORD    80,8
               .ASCII   'Restart '

               .WORD    81,6
               .ASCII   'Finder'

               .WORD    82
               .BYTE    0
ResumeString   .BYTE	 6
                .ASCII	 'Resume'

p1	        .WORD	 90,P1e-P1-4
DoReset	        RESET
p1e

p2	        .WORD	 92,p2e-p2-4
                MOVE.L	 CurrentA5,A5
                MOVE.L	 CurStackBase,A7
                MOVE.L	 RestProc,A0
                JMP	 (A0)
p2e

p3	        .WORD	 91,p3e-p3-4
                MOVE.L	 CurrentA5,A5	        ;Restore A5
                MOVE.L	 CurStackBase,A7        ;Restore stack
;
; Find out if ExitToShell is patched. Hyper and Switcher are the main
; culprits here. If so, ignore the user and do a RESET anyway
;
                MOVE	 #$1F4,D0	        ;Trap number for ExitToShell
                _GetTrapAddress		        ;Find out where it is
                CMPA.L	 MemTop,A0	        ;Is it above MemTop?
                BGT.S	 DoReset	        ;Trap is in Ram. No good
                _ExitToShell		        ;Quit to finder
p3e

p4	        .WORD   94,p4e-p4-4
                BSR     PlotGrayBut
                MOVE.L  #$00B00180,-(SP)        ;push location (was $00A40180)
                _MoveTo			        ;move the pen
                PEA	  IDString
                _DrawString
                MOVEQ	  #0,D3
                MOVE.W	  DSErrCode,D3
                DIVU	  #10,D3	        ;divide by 10
                BSR.S	  OutChar	        ;out high char
                SWAP	  D3		        ;get low char
                BSR.S	  OutChar	        ;out high char
                LEA	  $7FC80,A2	        ;Magic register address
                MOVEQ	  #16,D4	        ;17 registers (Include CCR)
                MOVEQ	  #$30,D7	        ;Clear reg number count
                MOVE.L	  #$00650054,D3	        ;get a corner
RegDump1        Move.L	  D3,-(SP)	        ;Push plot point
                _MoveTo			        ;Go there
                CMPI	  #$40,D7	        ;Are we on the PC?
                BNE.S	  NotPc		        ;Not Yet
                PEA	  PCstring	        ;get address of 'PC='
                _DrawString		        ;Draw it
                BRA.S	  DrawVal	        ;Merge with D/A code
OutChar	        OR.W	  #$30,D3	        ;turn into ASCII
                MOVE.W	  D3,-(SP)	        ;push it
                _DrawChar
                RTS
NotPc	        Move	  #'D',-(SP)	        ;Assume a data register
                BTST	  #3,D7		        ;Is it an address reg?
                BEQ.s	  DrawDA	        ;No
                Move	  #'A',(SP)	        ;Ok, its an A
DrawDA	        _DrawChar		        ;Draw a D or an A
                MOVE	  D7,D0		        ;Get a copy
                ANDI	  #$37,D0	        ;Strip off bit 8
                MOVE	  D0,-(SP)	        ;Push it
                _DrawChar		        ;Draw Digit
                MOVE	  #'=',-(SP)	        ;Push the equal sign
                _DrawChar		        ;And push that too.
DrawVal	        MOVE.L	  (A2)+,D5	        ;Get contents of a register
                MOVEQ	  #7,D6		        ;8 Nybbles
RegDump2        ROL.L	  #4,D5		        ;Bring the next nybble into low reg
                MOVE	  D5,D0		        ;Make a copy
                ANDI	  #$F,D0	        ;Get only the low 4 bits
                ADDI	  #$30,D0	        ;Add ASCII 0
                CMPI	  #$3A,D0	        ;<10?
                BLT.S	  Hex09		        ;yes. Skip this
                ADDQ	  #7,D0		        ;Turn into ABCDEF
Hex09	        MOVE	  D0,-(SP)	        ;Push hex digit
                _DrawChar		        ;and draw it
                DBRA	  D6,RegDump2	        ;Loop for 8 digits/register
                ADDI	  #94,D3	        ;Inc X position
                CMPI	  #$174,D3	        ;Finished this row?
                BLT.S	  NextRegister	        ;No
                MOVE	  #84,D3	        ;Reset to left side
                SWAP	  D3		        ;Get Y
                ADDI	  #14,D3	        ;Add for next row
                SWAP	  D3		        ;Flop X and Y again
NextRegister    ADDq	  #1,D7		        ;Next register
                DBRA	  D4,RegDump1	        ;Loop till we have printed 17 regs
                RTS
idString        .BYTE	  5
                .ASCII	  'ID = '
PCString        .BYTE	  3
                .ASCII	  'PC='
PlotGrayBut
               TST.L    RestProc	        ;got a restart proc?
               BNE.S    @1		        ;if so, skip...

; plot a grayed out resume button

               MOVE.L   ResumeRect,-(SP)     ;push topLeft of rect
               ADD.L    #$000E0003,(SP)	     ;offset for drawing
               _MoveTo			     ;move the pen

               PEA      ResumeString	     ;push the string
               _DrawString		     ;draw it

               PEA      ResumeRect	     ;push the rect
               MOVE.L   (SP),-(SP)	     ;copy it
               MOVE.L   (SP),-(SP)	     ;and copy again
               MOVE.L   (SP),-(SP)	     ;and copy again
               MOVE.L   #$00100010,-(SP)     ;push rounding factor
               _FrameRoundRect		     ;frame it

               MOVE.L	 #$00030003,-(SP)
               _InsetRect

               MOVE.L	 (A5),A0
               PEA	 Gray(A0)
               _PenPat
               MOVE	 #patBIC,-(SP)
               _PenMode

               _PaintRect
               _PenNormal

               MOVE.L	  #$FFFDFFFD,-(SP)	     ;push it
               _InsetRect
@1
               RTS
p4e

p5	        .WORD	 95,p5e-p5-4
                MOVE.L  (SP)+,A0	       ;Save return addr
                MOVE.L  CurStackBase,A7	       ;Recover from stack overflow
                MOVE.L  A0,-(SP)	       ;Get return addr
                BRA     p4		       ;Merge with rest of code.
p5e

p6	        .WORD   96,p6e-p6-4
                MOVE.L	  #$0033004B,-(SP)    ;push pen position
                _MoveTo			      ;position the pen
                MOVE.L	  ReqstVol,A1	      ;get VCB ptr
                PEA	  VCBVN(A1)	      ;push ptr to volume name
                _DrawString
                RTS
p6e

InstallIt       LEA     DSStart,A0
                MOVE.L  A0,DSAlertTab
                RTS

                .END
