home *** CD-ROM | disk | FTP | other *** search
/ Otherware / Otherware_1_SB_Development.iso / amiga / utility / misc / reset.lzh / Reset / Reset.asm < prev    next >
Encoding:
Assembly Source File  |  1992-09-22  |  7.9 KB  |  176 lines

  1. *************************************************************************
  2. *                                                                       *
  3. *               R       E       S       E       T                       *
  4. *                                                                       *
  5. *       A  program  by  Martin  Schlodder   begun   on  ??              *
  6. *                                     Version 1.0   on  30-Dec-1991     *
  7. *                                     Version 2.0   on   8-Aug-1992     *
  8. *                                     Version 2.01  on   8-Sep-1992     *
  9. *                                     Version 2.02  on  21-Sep-1992     *
  10. *                                                                       *
  11. *       Usage: Reset [?|simple|cold|kick]                               *
  12. *                                                                       *
  13. *       This program resets the System either as if you were pressing   *
  14. *       the three keys (option: "simple","s" or none), or additionally  *
  15. *       removes the exec.library and with that everything that tries    *
  16. *       to be resident (option: "cold" or "c"), or it removes the Kick- *
  17. *       start when run on an AMIGA 1000 (option: "kick" or "k").        *
  18. *       "?" will bring up some information.                             *
  19. *       Any option may be abbreviated.                                  *
  20. *                                                                       *
  21. *       Version-Report:                                                 *
  22. *                                                                       *
  23. *         V1.0:  First version. (Doesn't run under OS 2.0)              *
  24. *         V2.0:  Works now under OS 2.0 (ColdReboot).                   *
  25. *         V2.01: Tests for FastMem before removing KickStart.           *
  26. *         V2.02: Now Errors may be displayed in German.                 *
  27. *                                                                       *
  28. *************************************************************************
  29.  
  30. CALL            MACRO
  31.                 IFEQ NARG-2
  32.                 move.l  \2,a6
  33.                 ENDC
  34.                 IFLE NARG-2
  35.                 jsr     _LVO\1(a6)
  36.                 MEXIT
  37.                 ENDC
  38.                 FAIL    CALL MACRO ERROR
  39.                 ENDM
  40.  
  41. SysBase         EQU     4
  42. VER_ALL         EQU     0
  43. VER_20          EQU     36
  44. ;ENGLISH         EQU     0                       ;english by removing comment sign
  45.  
  46.                 INCLUDE "lvo/exec.i"
  47.                 INCLUDE "lvo/dos.i"
  48.                 INCLUDE "exec/execbase.i"
  49.  
  50. _main           tst.l   a0                      ;is there any command line?
  51.                 beq     SimpleReset             ;from WB -> simply reset
  52.                 move.b  (a0)+,d0                ;first char
  53.                 cmp.b   #' ',d0                 ;is space ?
  54.                 beq     _main                   ;if so, look for next
  55.                 cmp.b   #'?',d0
  56.                 beq     ShowInfo                ;about
  57.                 cmp.b   #10,d0
  58.                 beq     SimpleReset             ;eol -> simply reset
  59.                 cmp.b   #13,d0
  60.                 beq     SimpleReset             ;$13 as eol
  61.                 and.b   #%11011111,d0           ;UCase
  62.                 cmp.b   #'S',d0
  63.                 beq     SimpleReset             ;simply reset ('simple')
  64.                 cmp.b   #'C',d0
  65.                 beq     ColdReset               ;kill system ('cold')
  66.                 cmp.b   #'K',d0
  67.                 beq     KillKick                ;remove kickstart ('kick')
  68.  
  69. WrongOption     lea     WrongText,a0            ;errortext
  70.                 bra     WriteText
  71. LoMem           lea     LoMemText,a0            ;can't remove kickstart
  72.                 bra     WriteText
  73. ShowInfo        lea     PrgInfo,a0              ;only information
  74. WriteText       moveq   #0,d7
  75.                 moveq   #0,d3
  76.                 move.w  (a0)+,d3                ;length
  77.                 move.l  a0,d4                   ;string
  78.                 lea     DosName,a1
  79.                 move.l  #VER_ALL,d0
  80.                 CALL    OpenLibrary,SysBase     ;open doslib
  81.                 move.l  d0,d6
  82.                 bne     GoOn1
  83.                 moveq   #20,d7
  84.                 bra     EndWrite
  85. GoOn1           exg     d6,a6
  86.                 CALL    Output                  ;get cli-handle
  87.                 move.l  d0,d1
  88.                 bne     GoOn2
  89.                 moveq   #20,d7
  90.                 bra     CloseDos
  91. GoOn2           move.l  d4,d2
  92.                 CALL    Write                   ;write text
  93.                 cmp.l   d0,d3
  94.                 beq     CloseDos
  95.                 moveq   #20,d7
  96. CloseDos        move.l  a6,a1
  97.                 move.l  d6,a6
  98.                 CALL    CloseLibrary            ;close library
  99. EndWrite        move.l  d7,d0
  100.                 rts
  101.  
  102. KillKick        lea     KillKick,a0             ;kill kickstart
  103.                 cmp.l   #$200000,a0
  104.                 blt     LoMem
  105.                 CALL    SuperState,SysBase
  106.                 reset
  107.                 clr.l   $fc003c                 ;checksum of ROM
  108.                 move.w  #$4000,$dff09a          ;disable interrupt
  109.                 move.b  #0,$bfe401              ;timer-a lo-byte
  110.                 move.b  #0,$bfe501              ;timer-a hi-byte
  111.                 move.b  #%01010001,$bfee01      ;controllregister a
  112.                 move.b  d0,$bfec01              ;serial portregister
  113. Wait            bra.s   Wait
  114.  
  115. ColdReset       CALL    Disable,SysBase         ;kill multitasking
  116.                 ;clr.w  LowMemChkSum(a6)
  117.                 ;clr.l  ChkBase(a6)
  118.                 clr.w   ChkSum(a6)
  119.  
  120. SimpleReset     move.l  $4,a6
  121.                 cmp.w   #VER_20,LIB_VERSION(a6)
  122.                 bmi     K13Reset
  123.                 CALL    ColdReboot              ;OS2.0-function
  124. K13Reset        CALL    Disable                 ;kill multitasking
  125.                 lea     $fc0002,a0              ;and reset
  126.                 move.l  a0,$20
  127.                 reset
  128.                 jsr     (a0)
  129.  
  130. SysStack        dc.l    0
  131.  
  132. DosName         dc.b    'dos.library',0
  133.  
  134.  
  135.                 IFD     ENGLISH
  136.  
  137. MyVer           dc.b    0,"$VER: Reset 2.02 (21.9.1992)",0
  138.                 CNOP    0,2
  139. PrgInfo         dc.w    Pe-Ps
  140. Ps              dc.b    10,13,"Reset 2.02 on 21-Sep-1992 by Martin Schlodder",10,13,10,13
  141.                 dc.b    "Usage: Reset [?|simple|cold|kick]",10,13,10,13
  142.                 dc.b    "It resets the system. No option or 'simple' will simply reset the system;",10,13
  143.                 dc.b    "'cold' will remove everything from memory; 'kick' removes the Kickstart",10,13
  144.                 dc.b    "from A1000's WOM.",10,13,10,13
  145. Pe              CNOP    0,2
  146. WrongText       dc.w    We-Ws
  147. Ws              dc.b    10,13,"Unknown Argument! Type 'Reset ?' for more information.",10,13,10,13
  148. We              CNOP    0,2
  149. LoMemText       dc.w    Le-Ls
  150. Ls              dc.b    10,13,"This program must be in FastMem to remove Kickstart from WOM.",10,13,10,13
  151. Le              CNOP    0,2
  152.  
  153.                 ELSE
  154.  
  155. MyVer           dc.b    0,"$VER: Reset 2.02 (21.9.1992)",0
  156.                 CNOP    0,2
  157. PrgInfo         dc.w    Pe1-Ps1
  158. Ps1             dc.b    10,13,"Reset 2.02 am 21.9.1992 von Martin Schlodder",10,13,10,13
  159.                 dc.b    "Aufruf: Reset [?|simple|cold|kick]",10,13,10,13
  160.                 dc.b    "Das System wird zurⁿckgesetzt. Keine Option oder 'simple' erzeugt einen",10,13
  161.                 dc.b    "einfachen Hardreset, 'cold' entfernt alles Resetfeste aus dem Speicher",10,13
  162.                 dc.b    "wΣhrend 'kick' das Kickstart aus dem WOM des A1000 entfernt.",10,13,10,13
  163. Pe1             CNOP    0,2
  164. WrongText       dc.w    We1-Ws1
  165. Ws1             dc.b    10,13,"Unbekannte Option! Geben Sie 'Reset ?' ein fⁿr mehr Information.",10,13,10,13
  166. We1             CNOP    0,2
  167. LoMemText       dc.w    Le1-Ls1
  168. Ls1             dc.b    10,13,"Dieses Programm mu▀ im FastMem laufen, um das Kickstart entfernen zu k÷nnen!.",10,13,10,13
  169. Le1
  170.  
  171.                 ENDC
  172.  
  173.  
  174.                 END
  175.  
  176.