home *** CD-ROM | disk | FTP | other *** search
/ Carousel / CAROUSEL.cdr / mactosh / tech / sysalert.asm < prev    next >
Assembly Source File  |  1985-03-03  |  12KB  |  356 lines

  1. ;File SysAlerts.Text
  2. ;
  3. ;   Standard Alerts for the development system -- Resource Type INIT, ID 2
  4. ;
  5. ;   These alerts are intended for programmers. Naive users should use
  6. ;   "UserAlerts" instead of these "SysAlerts" .
  7. ;
  8. ;   Re-Created and improved by Gustavo A. Fernandez 3/2/85
  9. ;
  10.                .NOLIST
  11.                .INCLUDE       TlAsm/SYSEQU.TEXT
  12.                .INCLUDE       TlAsm/SYSMACS.TEXT
  13.                .INCLUDE       TlAsm/FSEQU.TEXT
  14.                .INCLUDE       TlAsm/TOOLEQU.TEXT
  15.                .INCLUDE       TlAsm/QUICKMACS.TEXT
  16.                .INCLUDE       TlAsm/TOOLMACS.TEXT
  17.                .INCLUDE       TlAsm/GrafTypes.Text
  18.                .LIST
  19.  
  20.                .PROC       INIT,0
  21.  
  22.                 BRA       InstallIt
  23.  
  24. DSStart
  25.          .WORD      61                ; # of entries
  26.  
  27. ; Alert definitions
  28.  
  29.          .WORD      32767,10,50,0,36,94,72
  30.          .WORD      2,10,52,0,36,94,72
  31.          .WORD      3,10,53,0,36,94,72
  32.          .WORD      4,10,54,0,36,94,72
  33.          .WORD      5,10,55,0,36,94,72
  34.          .WORD      6,10,56,0,36,94,72
  35.          .WORD      10,10,60,0,36,94,72
  36.          .WORD      11,10,61,0,36,94,72
  37.          .WORD      12,10,62,0,36,94,72
  38.          .WORD      13,10,63,0,36,94,72
  39.          .WORD      14,10,64,0,36,94,72
  40.          .WORD      15,10,65,0,36,94,72
  41.          .WORD      16,10,68,0,36,94,72
  42.          .WORD      17,10,69,0,36,94,72
  43.          .WORD      18,10,69,0,36,94,72
  44.          .WORD      19,10,69,0,36,94,72
  45.          .WORD      20,10,69,0,36,94,72
  46.          .WORD      21,10,69,0,36,94,72
  47.          .WORD      22,10,69,0,36,94,72
  48.          .WORD      23,10,69,0,36,94,72
  49.          .WORD      24,10,69,0,36,94,72
  50.          .WORD      25,10,49,0,36,94,72
  51.          .WORD      26,10,65,0,36,94,72
  52.          .WORD      27,10,48,0,36,94,72
  53.          .WORD      28,10,47,0,36,95,72
  54.          .WORD      30,10,46,0,37,96,0
  55.          .WORD      41,10,67,0,36,0,70
  56.  
  57.  
  58. ; Text tables
  59.  
  60.          .MACRO     text
  61.          .WORD     %1
  62. @1     .WORD     @2-@1-2
  63.          .WORD     %2,%3
  64.          .ASCII     %4
  65.          .BYTE     0
  66.          .ALIGN 2
  67. @2
  68.          .ENDM
  69.  
  70. data4     text     50,83,130,'System Error'
  71.          text     52,83,130,'Address Error'
  72.          text     53,83,130,'Illegal Instruction'
  73.          text     54,83,130,'Zero Divide'
  74.          text     55,83,130,'Check Exception'
  75.          text     56,83,130,'TrapV Exception'
  76.          text     60,83,130,'Fxxx breakpoint'
  77.          text     61,83,130,'Miscellaneous Exception'
  78.          text     62,83,130,'Unimplemented Core Routine'
  79.          text     63,83,130,'Interupt switch pressed'
  80.          text     64,83,130,'I/O System Error'
  81.          text     65,83,130,'Segment Loader Error'
  82.          text     67,86,130,"Can't load the finder"
  83.          text     68,83,130,'Floating Point error'
  84.          text     69,83,130,"Can't load package error"
  85.          text     47,83,130,'Stack overflow error'
  86.          text     48,83,130,'File Map trashed'
  87.          text     49,83,130,'Out of memory!'
  88.          text     46,30,75,'Please insert the disk:'
  89.  
  90. ;
  91. ; icons -- Susan's bomb
  92. ;
  93.                .WORD     36,136
  94.                .WORD     72,50,104,82
  95.  
  96.           .LONG        $00000808
  97.           .LONG        $00000010
  98.           .LONG        $00000420
  99.           .LONG        $00008040
  100.           .LONG        $00002200
  101.           .LONG        $00000800
  102.           .LONG        $001F002A
  103.           .LONG        $0020C700
  104.           .LONG        $00403800
  105.           .LONG        $00400020
  106.           .LONG        $00400910
  107.           .LONG        $03F81008
  108.           .LONG        $03F82104
  109.           .LONG        $03F80000
  110.           .LONG        $0FFE0100
  111.           .LONG        $3FFF8000
  112.           .LONG        $3FFF8000
  113.           .LONG        $7FFFC000
  114.           .LONG        $7FFFC000
  115.           .LONG        $FFFDE000
  116.           .LONG        $FFFFE000
  117.           .LONG        $FFFEE000
  118.           .LONG        $FFFEE000
  119.           .LONG        $FFFEE000
  120.           .LONG        $FFFFE000
  121.           .LONG        $FFFDE000
  122.           .LONG        $7FFFC000
  123.           .LONG        $7FF7C000
  124.           .LONG        $3FFF8000
  125.           .LONG        $3FFF8000
  126.           .LONG        $0FFE0000
  127.           .LONG        $03F80000
  128.  
  129. ;
  130. ; disk switched icon
  131.  
  132.            .WORD     37,136
  133.            .Word     20,24,52,56
  134.  
  135.            .LONG    $002ADE00
  136.            .LONG    $00800100
  137.            .LONG    $00000080
  138.            .LONG    $01000080
  139.            .LONG    $000003E0
  140.            .LONG    $010001C0
  141.            .LONG    $00000080
  142.            .LONG    $00000000
  143.            .LONG    $FFF83FFC
  144.            .LONG    $88A44452
  145.            .LONG    $88A24451
  146.            .LONG    $88224411
  147.            .LONG    $8FE247F1
  148.            .LONG    $80024001
  149.            .LONG    $80024001
  150.            .LONG    $9FF24FF9
  151.            .LONG    $A00A5005
  152.            .LONG    $A00A5005
  153.            .LONG    $A00A5005
  154.            .LONG    $A00A5005
  155.            .LONG    $A00A5005
  156.            .LONG    $A00A5005
  157.            .LONG    $FFFE7FFF
  158.            .LONG    $00000000
  159.            .LONG    $01000000
  160.            .LONG    $03800080
  161.            .LONG    $07C00000
  162.            .LONG    $01000080
  163.            .LONG    $01000000
  164.            .LONG    $00800100
  165.            .LONG    $007B5400
  166.            .LONG    $00000000
  167.  
  168. ; Button list
  169.  
  170. ;  70,71 Can't find finder
  171.                .WORD     70,14
  172.                .WORD     1
  173.                .WORD     80,160,50,180,110,90
  174.  
  175.  
  176.                .WORD     71,14
  177.                .WORD     1
  178.                .WORD     80,160,50,180,110,90
  179.  
  180. ; 72,73 - General system error
  181.  
  182.                .WORD    72,26
  183.                .WORD    2
  184.                .WORD    80,162,50,182,110,90
  185.                .WORD    81,162,135,182,185,91
  186.  
  187.                .WORD    73,38
  188.                .WORD    3
  189.                .WORD    80,162,50,182,110,90
  190.                .WORD    81,162,135,182,185,91
  191.                .WORD    82
  192. ResumeRect     .WORD       162,210,182,270
  193.                .WORD               92
  194.  
  195. ; Strings
  196.  
  197.                .WORD    80,8
  198.                .ASCII   'Restart '
  199.  
  200.                .WORD    81,6
  201.                .ASCII   'Finder'
  202.  
  203.                .WORD    82
  204.                .BYTE    0
  205. ResumeString   .BYTE     6
  206.                 .ASCII     'Resume'
  207.  
  208. p1            .WORD     90,P1e-P1-4
  209. DoReset            RESET
  210. p1e
  211.  
  212. p2            .WORD     92,p2e-p2-4
  213.                 MOVE.L     CurrentA5,A5
  214.                 MOVE.L     CurStackBase,A7
  215.                 MOVE.L     RestProc,A0
  216.                 JMP     (A0)
  217. p2e
  218.  
  219. p3            .WORD     91,p3e-p3-4
  220.                 MOVE.L     CurrentA5,A5            ;Restore A5
  221.                 MOVE.L     CurStackBase,A7        ;Restore stack
  222. ;
  223. ; Find out if ExitToShell is patched. Hyper and Switcher are the main
  224. ; culprits here. If so, ignore the user and do a RESET anyway
  225. ;
  226.                 MOVE     #$1F4,D0            ;Trap number for ExitToShell
  227.                 _GetTrapAddress                ;Find out where it is
  228.                 CMPA.L     MemTop,A0            ;Is it above MemTop?
  229.                 BGT.S     DoReset            ;Trap is in Ram. No good
  230.                 _ExitToShell                ;Quit to finder
  231. p3e
  232.  
  233. p4            .WORD   94,p4e-p4-4
  234.                 BSR     PlotGrayBut
  235.                 MOVE.L  #$00B00180,-(SP)        ;push location (was $00A40180)
  236.                 _MoveTo                    ;move the pen
  237.                 PEA      IDString
  238.                 _DrawString
  239.                 MOVEQ      #0,D3
  240.                 MOVE.W      DSErrCode,D3
  241.                 DIVU      #10,D3            ;divide by 10
  242.                 BSR.S      OutChar            ;out high char
  243.                 SWAP      D3                ;get low char
  244.                 BSR.S      OutChar            ;out high char
  245.                 LEA      $7FC80,A2            ;Magic register address
  246.                 MOVEQ      #16,D4            ;17 registers (Include CCR)
  247.                 MOVEQ      #$30,D7            ;Clear reg number count
  248.                 MOVE.L      #$00650054,D3            ;get a corner
  249. RegDump1        Move.L      D3,-(SP)            ;Push plot point
  250.                 _MoveTo                    ;Go there
  251.                 CMPI      #$40,D7            ;Are we on the PC?
  252.                 BNE.S      NotPc                ;Not Yet
  253.                 PEA      PCstring            ;get address of 'PC='
  254.                 _DrawString                ;Draw it
  255.                 BRA.S      DrawVal            ;Merge with D/A code
  256. OutChar            OR.W      #$30,D3            ;turn into ASCII
  257.                 MOVE.W      D3,-(SP)            ;push it
  258.                 _DrawChar
  259.                 RTS
  260. NotPc            Move      #'D',-(SP)            ;Assume a data register
  261.                 BTST      #3,D7                ;Is it an address reg?
  262.                 BEQ.s      DrawDA            ;No
  263.                 Move      #'A',(SP)            ;Ok, its an A
  264. DrawDA            _DrawChar                ;Draw a D or an A
  265.                 MOVE      D7,D0                ;Get a copy
  266.                 ANDI      #$37,D0            ;Strip off bit 8
  267.                 MOVE      D0,-(SP)            ;Push it
  268.                 _DrawChar                ;Draw Digit
  269.                 MOVE      #'=',-(SP)            ;Push the equal sign
  270.                 _DrawChar                ;And push that too.
  271. DrawVal            MOVE.L      (A2)+,D5            ;Get contents of a register
  272.                 MOVEQ      #7,D6                ;8 Nybbles
  273. RegDump2        ROL.L      #4,D5                ;Bring the next nybble into low reg
  274.                 MOVE      D5,D0                ;Make a copy
  275.                 ANDI      #$F,D0            ;Get only the low 4 bits
  276.                 ADDI      #$30,D0            ;Add ASCII 0
  277.                 CMPI      #$3A,D0            ;<10?
  278.                 BLT.S      Hex09                ;yes. Skip this
  279.                 ADDQ      #7,D0                ;Turn into ABCDEF
  280. Hex09            MOVE      D0,-(SP)            ;Push hex digit
  281.                 _DrawChar                ;and draw it
  282.                 DBRA      D6,RegDump2            ;Loop for 8 digits/register
  283.                 ADDI      #94,D3            ;Inc X position
  284.                 CMPI      #$174,D3            ;Finished this row?
  285.                 BLT.S      NextRegister            ;No
  286.                 MOVE      #84,D3            ;Reset to left side
  287.                 SWAP      D3                ;Get Y
  288.                 ADDI      #14,D3            ;Add for next row
  289.                 SWAP      D3                ;Flop X and Y again
  290. NextRegister    ADDq      #1,D7                ;Next register
  291.                 DBRA      D4,RegDump1            ;Loop till we have printed 17 regs
  292.                 RTS
  293. idString        .BYTE      5
  294.                 .ASCII      'ID = '
  295. PCString        .BYTE      3
  296.                 .ASCII      'PC='
  297. PlotGrayBut
  298.                TST.L    RestProc            ;got a restart proc?
  299.                BNE.S    @1                ;if so, skip...
  300.  
  301. ; plot a grayed out resume button
  302.  
  303.                MOVE.L   ResumeRect,-(SP)     ;push topLeft of rect
  304.                ADD.L    #$000E0003,(SP)         ;offset for drawing
  305.                _MoveTo                 ;move the pen
  306.  
  307.                PEA      ResumeString         ;push the string
  308.                _DrawString             ;draw it
  309.  
  310.                PEA      ResumeRect         ;push the rect
  311.                MOVE.L   (SP),-(SP)         ;copy it
  312.                MOVE.L   (SP),-(SP)         ;and copy again
  313.                MOVE.L   (SP),-(SP)         ;and copy again
  314.                MOVE.L   #$00100010,-(SP)     ;push rounding factor
  315.                _FrameRoundRect             ;frame it
  316.  
  317.                MOVE.L     #$00030003,-(SP)
  318.                _InsetRect
  319.  
  320.                MOVE.L     (A5),A0
  321.                PEA     Gray(A0)
  322.                _PenPat
  323.                MOVE     #patBIC,-(SP)
  324.                _PenMode
  325.  
  326.                _PaintRect
  327.                _PenNormal
  328.  
  329.                MOVE.L      #$FFFDFFFD,-(SP)         ;push it
  330.                _InsetRect
  331. @1
  332.                RTS
  333. p4e
  334.  
  335. p5            .WORD     95,p5e-p5-4
  336.                 MOVE.L  (SP)+,A0           ;Save return addr
  337.                 MOVE.L  CurStackBase,A7           ;Recover from stack overflow
  338.                 MOVE.L  A0,-(SP)           ;Get return addr
  339.                 BRA     p4               ;Merge with rest of code.
  340. p5e
  341.  
  342. p6            .WORD   96,p6e-p6-4
  343.                 MOVE.L      #$0033004B,-(SP)    ;push pen position
  344.                 _MoveTo                  ;position the pen
  345.                 MOVE.L      ReqstVol,A1          ;get VCB ptr
  346.                 PEA      VCBVN(A1)          ;push ptr to volume name
  347.                 _DrawString
  348.                 RTS
  349. p6e
  350.  
  351. InstallIt       LEA     DSStart,A0
  352.                 MOVE.L  A0,DSAlertTab
  353.                 RTS
  354.  
  355.                 .END
  356.