home *** CD-ROM | disk | FTP | other *** search
/ World of A1200 / World_Of_A1200.iso / programs / system / alerthelp / source.lha / source / AlertHelp.s next >
Text File  |  1995-01-10  |  13KB  |  426 lines

  1. ;
  2. ; AlertHelp V0.55  Thursday, 23-Sep-1993
  3. ;
  4. ; (c) 1993 by Jan Hagqvist
  5. ;
  6.  
  7. ;
  8. ; V0.05  Monday,   28-Jun-1993
  9. ; V0.35  Tuesday,  29-Jun-1993
  10. ; V0.40  Saturday, 03-Jul-1993        Now includes task name & address
  11. ; V0.45  Sunday,   19-Sep-1993        Guru, Reboot, Suspend / Thank you!
  12. ; V0.50  Monday,   20-Sep-1993        Some more specifics
  13. ; V0.55  Thursday, 20-Sep-1993        The rest of the specifics from exec/alerts.i
  14. ;
  15.  
  16.  
  17.   XREF _LVOOldOpenLibrary
  18.   XREF _LVOCloseLibrary
  19.   XREF _LVOEasyRequestArgs
  20.   XREF _LVOSetFunction
  21.   XREF _LVOWait
  22.   XREF _LVOFindTask
  23.   XREF _LVOSignal
  24.   XREF _LVOAllocSignal
  25.   XREF _LVOFreeSignal
  26.   XREF _LVOSetTaskPri
  27.   XREF _LVOColdReboot
  28.  
  29.  
  30.   SECTION 1,CODE
  31.  
  32.  
  33. InstallAlertHelp
  34.   move.l  4,a6
  35.   lea     IntuitionName,a1
  36.   jsr     _LVOOldOpenLibrary(a6)
  37.   move.l  d0,IntuitionBase
  38.   tst.l   d0
  39.   beq     RemoveAlertHelp
  40.  
  41.   lea     TaskName,a1
  42.   jsr     _LVOFindTask(a6)
  43.   move.l  d0,a5
  44.   tst.l   d0
  45.   bne.s   TaskFound
  46.  
  47.   sub.l   a1,a1
  48.   jsr     _LVOFindTask(a6)
  49.   move.l  d0,a5
  50.   move.l  #TaskName,10(a5)
  51.  
  52.   move.l  a5,a1
  53.   move.b  #-5,d0
  54.   jsr     _LVOSetTaskPri(a6)
  55.  
  56.   move.l  #AlertHelp,d0
  57.   move.l  a6,a1
  58.   move.w  #-$6c,a0
  59.   jsr     _LVOSetFunction(a6)
  60.   move.l  d0,OldAlert
  61.  
  62.   move.l  #-1,d0
  63.   jsr     _LVOAllocSignal(a6)
  64.   move.l  d0,88(a5)
  65.  
  66. DummyLoop
  67.   jsr     _LVOWait(a6)
  68.  
  69.   move.l  OldAlert(pc),d0
  70.   move.l  a6,a1
  71.   move.w  #-$6c,a0
  72.   jsr     _LVOSetFunction(a6)
  73.  
  74.   move.l  88(a5),d0
  75.   jsr     _LVOFreeSignal(a6)
  76.  
  77. RemoveAlertHelp
  78.   move.l  4,a6
  79.   tst.l   IntuitionBase
  80.   beq.s   RemoveAlertHelp2
  81.   move.l  IntuitionBase,a1
  82.   jsr     _LVOCloseLibrary(a6)
  83. RemoveAlertHelp2
  84.   moveq.l #0,d0
  85.   rts
  86.  
  87. TaskFound
  88.   move.l  IntuitionBase,a6
  89.   sub.l   a0,a0
  90.   lea     EasyStruct2,a1
  91.   move.l  a0,a2
  92.   lea     ArgList2,a3
  93.   jsr     _LVOEasyRequestArgs(a6)
  94.   cmp.b   #1,d0
  95.   beq.s   TaskFound2
  96.  
  97.   move.l  4,a6
  98.   move.l  88(a5),d0
  99.   move.l  a5,a1
  100.   jsr     _LVOSignal(a6)
  101. TaskFound2
  102.   bra.s   RemoveAlertHelp
  103.  
  104. AlertHelp
  105.   move.l  d7,AlertNum
  106.   movem.l d0-d7/a0-a6,-(sp)
  107.  
  108.   move.l  4,a6
  109.   move.l  $114(a6),a0
  110.   move.l  a0,AlertTask
  111.   move.l  10(a0),AlertTaskName
  112.  
  113.   move.l  #GadgetFormat1,EasyStruct1Gadget
  114.   move.l  #Recovery,AlertType
  115.   cmp.l   #$80000000,d7
  116.   bmi.s   ParseAlert
  117.   sub.l   #$80000000,d7
  118.   move.l  #DeadEnd,AlertType
  119.   move.l  #GadgetFormat0,EasyStruct1Gadget
  120. ParseAlert
  121.   lea     SpecificAlerts,a0
  122. ParseAlert2
  123.   cmp.l   #0,(a0)
  124.   beq.s   ParseAlert3
  125.   cmp.l   (a0)+,d7
  126.   beq.s   Specific
  127.   addq.l  #4,a0
  128.   bra.s   ParseAlert2
  129. ParseAlert3
  130.   lea     GeneralAlerts,a0
  131.   move.l  d7,d6
  132.   and.l   #$00ff0000,d6
  133. ParseAlert4
  134.   cmp.l   #0,(a0)
  135.   beq.s   Unknown
  136.   cmp.l   (a0)+,d6
  137.   beq.s   Specific
  138.   addq.l  #4,a0
  139.   bra.s   ParseAlert4
  140. Unknown
  141.   move.l  #UnknownAlert,AlertText
  142.   bra.s   ParseSource
  143. Specific
  144.   move.l  (a0),AlertText
  145. ParseSource
  146.   move.l  #UnknownSource,AlertSource
  147.   move.l  d7,d6
  148.   and.l   #$ff000000,d6
  149.   swap    d6
  150.   asr.l   #8,d6
  151.   lea     Sources,a0
  152. ParseSource2
  153.   cmp.l   #$ffffffff,(a0)
  154.   beq.s   ParseSource4
  155.   cmp.l   (a0)+,d6
  156.   beq.s   ParseSource3
  157.   addq.l  #4,a0
  158.   bra.s   ParseSource2
  159. ParseSource3
  160.   move.l  (a0),AlertSource
  161. ParseSource4
  162.  
  163. Inform
  164.   move.l  IntuitionBase,a6
  165.   sub.l   a0,a0
  166.   lea     EasyStruct,a1
  167.   move.l  a0,a2
  168.   lea     ArgList,a3
  169.   jsr     _LVOEasyRequestArgs(a6)
  170.   tst.b   d0                ; Suspend (Thank you!)?
  171.   beq.s   Quit2                ; Yep
  172.   cmp.b   #2,d0                ; Reboot?
  173.   beq.s   Quit3                ; Yep
  174.  
  175. Quit
  176.   movem.l (sp)+,d0-d7/a0-a6
  177.   dc.w    $4EF9            ; jmp
  178. OldAlert
  179.   dc.l    0
  180. Quit2
  181.   movem.l (sp)+,d0-d7/a0-a6
  182.   rts
  183. Quit3
  184.   move.l  4,a6
  185.   jsr     _LVOColdReboot(a6)        ; Never returns!
  186.  
  187.  
  188.   SECTION 2,DATA
  189.  
  190.  
  191. IntuitionBase        dc.l 0
  192. EasyStruct        dc.l 20,0,AlertTitle,TextFormat
  193. EasyStruct1Gadget    dc.l GadgetFormat1
  194. EasyStruct2        dc.l 20,0,AlertTitle,TextFormat2,GadgetFormat2
  195.  
  196. ArgList
  197. AlertTaskName        dc.l 0
  198. AlertNum        dc.l 0
  199. AlertTask        dc.l 0
  200. AlertSource        dc.l 0
  201. AlertText        dc.l 0
  202. AlertType        dc.l 0
  203.             dc.l 0
  204.  
  205. ArgList2        dc.l 0
  206.  
  207.  
  208. Sources
  209.     dc.l $0,Processor,$1,Exec,$2,Graphics,$3,Layers,$4,Intuition,$5,Math
  210.     dc.l $7,Dos,$8,Ram,$9,Icon,$A,Expansion,$B,DiskFont,$C,Utility
  211.     dc.l $10,Audio,$11,Console,$12,GamePort,$13,Keyboard,$14,TrackDisk
  212.     dc.l $15,Timer,$20,Cia,$21,Disk,$22,Misc,$30,BootStrap,$31,Workbench
  213.     dc.l $32,DiskCopy,$33,GadTools
  214.     dc.l $ffffffff
  215.  
  216. GeneralAlerts
  217.     dc.l $00010000,NoMemory,$00020000,MakeLib,$00030000,OpenLib
  218.     dc.l $00040000,OpenDev,$00050000,OpenRes,$00060000,IOError
  219.     dc.l $00070000,NoSignal,$00080000,BadParm,$00090000,CloseLib
  220.     dc.l $000A0000,CloseDev,$000B0000,ProcCreate
  221.     dc.l 0
  222.  
  223. SpecificAlerts
  224.     ; Processor
  225.     dc.l $00000002,BusError,$00000003,AddrError,$00000004,IllegalInst
  226.     dc.l $00000005,DivZero,$00000006,ChkError,$00000007,TrapError
  227.     dc.l $00000008,Supervisor,$00000009,Trace
  228.     ; Exec
  229.     dc.l $01000001,ExcptVect,$01000002,BaseChkSum,$01000003,LibChkSum
  230.     dc.l $01000005,MemCorrupt,$01000006,IntrMem,$01000007,InitAPtr
  231.     dc.l $01000008,SemCorrupt,$01000009,FreeTwice,$0100000A,BogusExcpt
  232.     dc.l $0100000B,IOUsedTwice,$0100000C,MemoryInsane,$0100000D,IOAfterClose
  233.     dc.l $0100000E,StackProbe,$0100000F,BadFreeAddr
  234.     ; Graphics
  235.     dc.l $02010000,GfxNoMem,$02010001,GfxNoMemMspc,$02010006,LongFrame
  236.     dc.l $02010007,ShortFrame,$02010009,TextTmpRas,$0201000A,BltBitMap
  237.     dc.l $0201000B,RegionMemory,$02010030,MakeVPort,$0200000C,GfxNewError
  238.     dc.l $0200000D,GfxFreeError,$02011234,GfxNoLCM,$02000401,ObsoleteFont
  239.     ; Layers
  240.     dc.l $03010000,LayersNoMem
  241.     ; Intuition
  242.     dc.l $04000001,GadgetType,$04010002,CreatePort,$04010003,ItemAlloc
  243.     dc.l $04010004,SubAlloc,$04010005,PlaneAlloc,$04010006,ItemBoxTop
  244.     dc.l $04010007,OpenScreen,$04010008,OpenScrnRast,$04010009,SysScrnType
  245.     dc.l $0401000A,AddSWGadget,$0401000B,OpenWindow,$0400000C,BadState
  246.     dc.l $0400000D,BadMessage,$0400000E,WeirdEcho,$0400000F,NoConsole
  247.     ; Dos
  248.     dc.l $07010001,StartMem,$07000002,EndTask,$07000003,QPktFail
  249.     dc.l $07000004,AsyncPkt,$07000005,FreeVec,$07000006,DiskBlkSeq
  250.     dc.l $07000007,BitMap,$07000008,KeyFree,$07000009,BadChkSum
  251.     dc.l $0700000A,DiskError,$0700000B,KeyRange,$0700000C,BadOverlay
  252.     dc.l $0700000D,BadInitFunc,$0700000E,FileReclosed
  253.     ; RamLib
  254.     dc.l $08000001,BadSegList
  255.     ; Expansion
  256.     dc.l $0A000001,BadExpansionFree
  257.     ; Console
  258.     dc.l $11000001,NoWindow
  259.     ; Trackdisk
  260.     dc.l $14000001,TDCalibSeek,$14000002,TDDelay
  261.     ; Timer
  262.     dc.l $15000001,TMBadReq,$15000002,TMBadSupply
  263.     ; Disk
  264.     dc.l $21000001,DRHasDisk,$21000002,DRIntNoAct
  265.     ; BootStrap
  266.     dc.l $30000001,BootError
  267.     ; Workbench
  268.     dc.l $31000001,WBBadStartupMsg1,$31000002,WBBadStartupMsg2,$31000003,WBBadIOMsg
  269.     dc.l $31010004,WBInitPotionAllocDrawer,$31010005,WBCreateWBMenusCreateMenus1,$31010006,WBCreateWBMenusCreateMenus2
  270.     dc.l $31010007,WBLayoutWBMenusLayoutMenus,$31010008,WBAddToolMenuItem,$31010009,WBReLayoutToolMenu
  271.     dc.l $3101000A,WBinitTimer,$3101000B,WBInitLayerDemon,$3101000C,WBinitWbGels
  272.     dc.l $3101000D,WBInitScreenAndWindows1,$3101000E,WBInitScreenAndWindows2,$3101000F,WBInitScreenAndWindows3
  273.     dc.l $31010010,WBMAlloc
  274.  
  275.  
  276. TaskName        dc.b 'AlertHelpTask',0
  277. IntuitionName        dc.b 'intuition.library',0
  278. VersionString        dc.b '$VER: AlertHelp V0.55 (23.09.93/13:33:00/055) ©1993 by Jan Hagqvist',0
  279. AlertTitle        dc.b 'AlertHelp V0.55  23-Sep-1993',0
  280. Recovery        dc.b 'RECOVERY',0
  281. DeadEnd            dc.b 'DEADEND',0
  282. Processor        dc.b 'The Processor',0
  283. Exec            dc.b 'Exec',0
  284. Graphics        dc.b 'Graphics',0
  285. Layers            dc.b 'Layers',0
  286. Intuition        dc.b 'Intuition',0
  287. Math            dc.b 'Math',0
  288. Dos            dc.b 'Dos',0
  289. Ram            dc.b 'Ram',0
  290. Icon            dc.b 'Icon',0
  291. Expansion        dc.b 'Expansion',0
  292. DiskFont        dc.b 'Diskfont',0
  293. Utility            dc.b 'Utility',0
  294. Audio            dc.b 'Audio',0
  295. Console            dc.b 'Console',0
  296. GamePort        dc.b 'Gameport',0
  297. Keyboard        dc.b 'Keyboard',0
  298. TrackDisk        dc.b 'Trackdisk',0
  299. Timer            dc.b 'Timer',0
  300. Cia            dc.b 'Cia',0
  301. Disk            dc.b 'Disk',0
  302. Misc            dc.b 'Misc',0
  303. BootStrap        dc.b 'Bootstrap',0
  304. Workbench        dc.b 'Workbench',0
  305. DiskCopy        dc.b 'Diskcopy',0
  306. GadTools        dc.b 'Gadtools',0
  307. UnknownSource        dc.b 'an unknown source',0
  308. UnknownAlert        dc.b 'Sorry, but I cannot help you',0
  309. GadgetFormat0        dc.b ' Guru |Reboot|Suspend',0
  310. GadgetFormat1        dc.b 'Thank you!',0
  311. TextFormat        dc.b 'Notice:',10
  312.             dc.b '-------',10,10
  313.             dc.b 'A software failure has occurred in',10
  314.             dc.b '%s.',10,10
  315.             dc.b 'The alertnumber is #%08lx.',10
  316.             dc.b 'Task address is    #%08lx.',10,10
  317.             dc.b 'The message from %s:',10
  318.             dc.b '%s.',10,10
  319.             dc.b 'This is a %s alert.',0
  320. GadgetFormat2        dc.b 'Cancel|Remove',0
  321. TextFormat2        dc.b 'AlertHelp already installed.',10
  322.             dc.b 'Do you want to remove it?',0
  323. NoMemory        dc.b 'No memory',0
  324. MakeLib            dc.b 'Unable to create library',0
  325. OpenLib            dc.b 'Unable to open library',0
  326. OpenDev            dc.b 'Unable to open device',0
  327. OpenRes            dc.b 'Unable to open resource',0
  328. IOError            dc.b 'Input/Output error',0
  329. NoSignal        dc.b 'NoSignal',0
  330. BadParm            dc.b 'Bad parameters',0
  331. CloseLib        dc.b 'Unable to close library',0
  332. CloseDev        dc.b 'Unable to close device',0
  333. ProcCreate        dc.b 'Process creation failed',0
  334. BusError        dc.b 'Bus error',0
  335. AddrError        dc.b 'Address error',0
  336. IllegalInst        dc.b 'Illegal instruction',0
  337. DivZero            dc.b 'Division by zero',0
  338. ChkError        dc.b 'Chk-instruction',0
  339. TrapError        dc.b 'Trapv-instruction',0
  340. Supervisor        dc.b 'Supervisor instruction from',10,'User state',0
  341. Trace            dc.b 'Trace',0
  342. ExcptVect        dc.b '68000 exception vector checksum',0
  343. BaseChkSum        dc.b 'Execbase checksum',0
  344. LibChkSum        dc.b 'Library checksum failure',0
  345. MemCorrupt        dc.b 'Corrupt memory list detected in',10,'FreeMem',0
  346. IntrMem            dc.b 'No memory for interrupt servers',0
  347. InitAPtr        dc.b 'InitStruct() of an APTR source',0
  348. SemCorrupt        dc.b 'A semaphore is in an illegal state',10,'at ReleaseSemaphore()',0
  349. FreeTwice        dc.b 'Freeing memory already freed',0
  350. BogusExcpt        dc.b 'Illegal 68xxx exception taken',0
  351. IOUsedTwice        dc.b 'Attempt to reuse active IORequest',0
  352. MemoryInsane        dc.b 'Sanity check on memory list failed',10,'during AvailMem(MEMF_LARGEST)',0
  353. IOAfterClose        dc.b 'IO attempted on closed IORequest',0
  354. StackProbe        dc.b 'Stack appears to extend out of range',0
  355. BadFreeAddr        dc.b 'Memory header not located. [Usually',10,'an invalid address passed to FreeMem()]',0
  356. GfxNoMem        dc.b 'Graphics out of memory',0
  357. GfxNoMemMspc        dc.b 'MonitorSpec alloc, no memory',0
  358. LongFrame        dc.b 'Long frame, no memory',0
  359. ShortFrame        dc.b 'Short frame, no memory',0
  360. TextTmpRas        dc.b 'Text, no memory for TmpRas',0
  361. BltBitMap        dc.b 'BltBitMap, no memory',0
  362. RegionMemory        dc.b 'Regions, memory not available',0
  363. MakeVPort        dc.b 'MakeVPort, no memory',0
  364. GfxNewError        dc.b 'GfxNewError',0
  365. GfxFreeError        dc.b 'GfxFreeError',0
  366. GfxNoLCM        dc.b 'Emergency memory not available',0
  367. ObsoleteFont        dc.b 'Unsupported font description used',0
  368. LayersNoMem        dc.b 'Layers out of memory',0
  369. GadgetType        dc.b 'Unknown gadget type',0
  370. CreatePort        dc.b 'Create port, no memory',0
  371. ItemAlloc        dc.b 'Item plane alloc, no memory',0
  372. SubAlloc        dc.b 'Sub alloc, no memory',0
  373. PlaneAlloc        dc.b 'Plane alloc, no memory',0
  374. ItemBoxTop        dc.b 'Item box top < RelZero',0
  375. OpenScreen        dc.b 'Open screen, no memory',0
  376. OpenScrnRast        dc.b 'Open screen, raster alloc, no memory',0
  377. SysScrnType        dc.b 'Open sys screen, unknown type',0
  378. AddSWGadget        dc.b 'Add SW gadgets, no memory',0
  379. OpenWindow        dc.b 'Open window, no memory',0
  380. BadState        dc.b 'Bad State Return entering Intuition',0
  381. BadMessage        dc.b 'Bad Message received by IDCMP',0
  382. WeirdEcho        dc.b 'Weird echo causing incomprehension',0
  383. NoConsole        dc.b 'Could not open the Console Device',0
  384. StartMem        dc.b 'No memory at startup',0
  385. EndTask            dc.b 'EndTask did not',0
  386. QPktFail        dc.b 'Qpkt failure',0
  387. AsyncPkt        dc.b 'Unexpected packet received',0
  388. FreeVec            dc.b 'Freevec failed',0
  389. DiskBlkSeq        dc.b 'Disk block sequence error',0
  390. BitMap            dc.b 'Bitmap corrupt',0
  391. KeyFree            dc.b 'Key already free',0
  392. BadChkSum        dc.b 'Invalid checksum',0
  393. DiskError        dc.b 'Disk error',0
  394. KeyRange        dc.b 'Key out of range',0
  395. BadOverlay        dc.b 'Bad overlay',0
  396. BadInitFunc        dc.b 'Invalid init packet for CLI/Shell',0
  397. FileReclosed        dc.b 'A filehandle was closed more than',10,'once',0
  398. BadSegList        dc.b 'Overlays are illegal for library',10,'segments',0
  399. BadExpansionFree    dc.b 'Freeed free region',0
  400. NoWindow        dc.b 'Console cannot open initial window',0
  401. TDCalibSeek        dc.b 'Calibrate: Seek error',0
  402. TDDelay            dc.b 'Delay: Error on timer wait',0
  403. TMBadReq        dc.b 'Bad request',0
  404. TMBadSupply        dc.b 'Power supply -- no 50/60hz ticks',0
  405. DRHasDisk        dc.b 'Get unit: Already has disk',0
  406. DRIntNoAct        dc.b 'Interrupt: No active unit',0
  407. BootError        dc.b 'Boot code returned an error',0
  408. WBBadStartupMsg1    dc.b 'Bad startup message 1',0
  409. WBBadStartupMsg2    dc.b 'Bad startup message 2',0
  410. WBBadIOMsg        dc.b 'Bad IO message',0
  411. WBInitPotionAllocDrawer    dc.b 'Init Potion Alloc Drawer',0
  412. WBCreateWBMenusCreateMenus1    dc.b 'Create WBMenus 1',0
  413. WBCreateWBMenusCreateMenus2    dc.b 'Create WBMenus 2',0
  414. WBLayoutWBMenusLayoutMenus    dc.b 'Layout WBMenus',0
  415. WBAddToolMenuItem    dc.b 'Add ToolMenu-Item',0
  416. WBReLayoutToolMenu    dc.b 'ReLayout ToolMenu',0
  417. WBinitTimer        dc.b 'Init timer',0
  418. WBInitLayerDemon    dc.b 'Init layer demon',0
  419. WBinitWbGels        dc.b 'Init Workbench gels',0
  420. WBInitScreenAndWindows1    dc.b 'Init screen and windows 1',0
  421. WBInitScreenAndWindows2    dc.b 'Init screen and windows 2',0
  422. WBInitScreenAndWindows3    dc.b 'Init screen and windows 3',0
  423. WBMAlloc        dc.b 'MAlloc',0
  424.  
  425.   END
  426.