home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 408.lha / unConfig / unConfig.a < prev    next >
Text File  |  1990-09-04  |  3KB  |  98 lines

  1. * UnConfig,    July 21, 1990,      Ismo Suihko,        Public Domain
  2. *
  3. * Makes all AUTOCONFIG (TM) devices to disappear on reboot.
  4. * Idea from 1.3 Hardware Reference Manual p. 219 and DaveH (Thanks!).
  5. * Allows you to reboot your Amiga without memory expansion and hard disk.
  6. * This program works with 1.2 and 1.3 KS.
  7. *
  8. * If you have A2620/A2630, you can reboot your Amiga on 68000 mode and
  9. * then with this program, you will get an unexpanded Amiga (so you can
  10. * then run some badly written software).
  11. *
  12. * Ismo Suihko, Internet: isuihko@ujocs.joensuu.fi
  13.  
  14.  
  15. * All needed constants are EQUed here, you don't need to link with amiga.lib
  16. Supervisor    EQU    -30
  17. Disable     EQU    -120
  18. CloseLibrary    EQU    -414
  19. OpenLibrary    EQU    -552
  20. Write        EQU    -48
  21. Output        EQU    -60
  22. Delay        EQU    -198
  23. VBlankFrequency EQU    530
  24. CIAB_GAMEPORT0    EQU    6
  25. _ciaa        EQU    $bfe001
  26.  
  27. * a couple of seconds delay to allow possible disk drive to stop spinning
  28. DELAY         EQU  3
  29.  
  30. * open dos.library
  31.     lea    dosname(pc),a1
  32.     moveq    #0,d0
  33.     move.l    4,a6
  34.     jsr    OpenLibrary(a6)
  35.     tst.l    d0
  36.     beq.s    1$        ; no dos.library?? reboot anyway...
  37.  
  38. * write something
  39.     move.l    d0,a5
  40.     exg    a5,a6
  41.     jsr    Output(a6)
  42.     move.l    d0,d7
  43.     move.l    d0,d1
  44.     lea    msg(pc),a0
  45.     move.l    a0,d2
  46.     move.l    #msglen,d3
  47.     jsr    Write(a6)
  48.  
  49. * delay a DELAY seconds
  50.     moveq    #0,d1
  51.     move.b    VBlankFrequency(a5),d1      ; 50 or 60
  52.     mulu    #DELAY,d1   ; put there a short delay, so that floppy disk
  53.     jsr    Delay(a6)   ; drive has time to stop spinning
  54.  
  55. * check if user had changed his/her mind and is now holding left mousebutton
  56.     btst    #CIAB_GAMEPORT0,_ciaa    ; you can still change your mind...
  57.     bne.s    1$
  58.  
  59. * this is executed only if shutdown was aborted
  60.     move.l    d7,d1
  61.     lea    abort(pc),a0
  62.     move.l    a0,d2
  63.     move.l    #abortlen,d3
  64.     jsr    Write(a6)
  65.  
  66. * close dos.library and exit
  67.     move.l    a6,a1
  68.     exg    a5,a6
  69.     jsr    CloseLibrary(a6)
  70.     rts
  71.  
  72. * left mouse button wasn't down, so reboot now without 'reset'
  73. 1$
  74.     move.l    4,a6
  75.     jsr    Disable(a6)
  76.     lea    MagicCode(pc),a5
  77.     jsr    Supervisor(a6)
  78.  
  79. **************************************************************************
  80. MagicCode            ; this is executed at the Supervisor level
  81.     move.l    $00fc0004,a0    ; get starting location of the ROM
  82.     jmp    (a0)            ; jump there without resetting first
  83. **************************************************************************
  84.  
  85.  
  86. dosname dc.b    'dos.library',0
  87.  
  88. msg    dc.b    'unConfig by Ismo Suihko, 21-Jul-90. Reboot without AUTOCONFIG(TM) devices.',10
  89.     dc.b    'System is going down in ',DELAY+'0',' seconds...',10
  90.     dc.b    'To abort shutdown hold (and keep) left mousebutton down.',10
  91. msglen    EQU    *-msg
  92.  
  93. abort    dc.b    '*** Aborted',10
  94. abortlen EQU    *-abort
  95.  
  96.     END
  97.  
  98.