home *** CD-ROM | disk | FTP | other *** search
/ Team Palmtops 7 / Palmtops_numero07.iso / Ti / Magazine / Tests / DOORSOSD.ZIP / uninstal.asm < prev    next >
Encoding:
Assembly Source File  |  1999-12-23  |  1.1 KB  |  54 lines

  1. ROM_CALL2 macro
  2.  move.l ($C8),a4
  3.  add.l #\1*4,a4
  4.  move.l (a4),a4
  5.  endm
  6.  
  7.  
  8.     include "os.h"    ; fichier include pr les progs _nostub
  9.     xdef    _ti89
  10.     xdef    _ti92plus
  11.     xdef    _nostub
  12.  
  13. main:
  14.     move.w    #$700,d0
  15.     trap    #1        ; ints off
  16.     cmp.w    #$102,$30    ; kernel version < 1.02 ? (ie DoorsOS beta 2 or another shell)
  17.     blt    \old_un    ; -> \old uninstaller
  18.     cmp.w    #"DT",$32    ; is it DoorsOS beta2 ?
  19.     bne    \old_un    ; no -> \old uninstaller
  20.                 ; else :
  21.     move.w    $48,-(a7)    ; $48 : handle of the block where the kernel is stored
  22.     ROM_CALL  HeapFree    ; free it
  23.     addq.l    #2,a7
  24.     ROM_CALL2 EV_hook
  25.     clr.l    (a4)        ; removes the hook
  26.  
  27.     bra    \cont        ; go on
  28. \old_un            ; old way of uninstalling the kernel
  29.     ROM_CALL2  $02F    ; bidouille, bidouille...
  30.     lea    $10E(a4),a4
  31.     move.l    #$3fff4,(a4)
  32.  
  33. \cont
  34.     lea    $212088,a0    
  35.     cmp.w    #$40,$4
  36.     ble    \OK
  37.     lea    $412088,a0
  38. \OK                ; -> a0 : address of the interrupt table
  39.     lea    $40000,a1    ; a1 = 0 mod $40000
  40.     moveq.w #63,d0    ; 64 vectors to recover
  41. \int    move.l    (a0)+,(a1)+
  42.     dbra    d0,\int
  43.  
  44.     pea    OK(pc)        ; string
  45.     ROM_CALL  ST_helpMsg
  46.     addq.l    #4,a7
  47.  
  48.     rts
  49.  
  50. OK    dc.b    "Uninstallation successful",0
  51.  
  52.  
  53.     end
  54.