Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!cs.utexas.edu!usc!wuarchive!brutus.cs.uiuc.edu!ux1.cso.uiuc.edu!ux1.cso.uiuc.edu!uxa.cso.uiuc.edu!uxf.cso.uiuc.edu!sec1918 From: sec1918@uxf.cso.uiuc.edu Newsgroups: comp.sys.apple Subject: Re: IIgs Software Reboot Message-ID: <48000012@uxf.cso.uiuc.edu> Date: 14 Dec 89 10:38:42 GMT References: <1949868@mtsg.ubc.ca> Lines: 76 Nf-ID: #R:mtsg.ubc.ca:1949868:uxf.cso.uiuc.edu:48000012:000:2717 Nf-From: uxf.cso.uiuc.edu!sec1918 Dec 13 15:28:00 1989 Referring to Apple IIgs tech note #49 "Rebooting (Really)"... The Easy Way GS/OS provides a mechanism for rebooting with the OSShutdown call. This call, documented in volume 1 of the GS/OS reference, will either reboot the system (after first shutting down all loaded and generated drivers and closing all open sessions) or will shut down everything and present a dialog box which states, "You may now power down your Apple IIgs safely"... ok this is like choosing shut down from the finder... also it mentions that OSShutdown can resize the ramdisk if it wants. "You should always use OSShutdown when using GS/OS"... ok but GS/OS sucks huge, so they also provide The Hard Way Programs not using GS/OS have a little more work to do. The supported non-GS/OS method of rebooting is similar to the method used on 8-bit machines: change the value of POWERUP ($00/03F4) and do a long jump to RESET ($FA62). However, there are a few catches: 1. the jump must be made in emulation mode. 2. Interrupts must be disabled. 3. The data bank register must be set to zero. 4. The direct page must be zero. 5. ROM firmware must be visible in the memory map. 6. Internal interrupt sources (such as the ones for AppleTalk) must be shut down Simply disabling interrupts without shutting down AppleTalk intterupt sources inside the system will cause the system to hang when the jump to RESET is made. Turning off these internal interrupt sources is accomplished by changing softswitch values at $C039 (SCCAREG), $C041 (INTEN), and $C047 (CLRVBLINT). The following code example demonstrates the correct method: POWRUP equ $0003F4 ;power up byte in bank zero STATEREG equ $C068 ;ROM/RAM state register CLRVBLINT equ $C047 ;clear VBL intterupt flags register INTEN equ $C041 ;interrupt enable register SCCAREG equ $C039 ;SCC register RESET equ $00FA62 ;ROM reset entry point FROMNATV anop ;must be in native mode here sei pei 0 pei 0 ;push four zero bytes plb plb ;pull data bank register (must do twice) pld ;pull 16-bit data bank register sec xce ;emulation mode longa off longi off FROMEMUL anop sei dec POWRUP ;invalidate power up byte lda #$0C ;rom parameters sta STATEREG ;swap in the ROM and everything else out stz CLRVBLINT ;clear VBL interrupts stz INTEN ;turn off internal interrupt sources lda #$C0 sta SCCAREG jml RESET ;kablamm I must state that this was copied almost exactly from the tech note but hasn't been tried so there may be some bugs... I dunno it looks good to me. "All opinions above are those of Apple Computer, Inc., not me." Don't send me any mail as this is just a temporary CS account dead in 2 days 217-344-3964 the Beach HST / 100 Megs