home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
HyperLib 1997 Winter - Disc 1
/
HYPERLIB-1997-Winter-CD1.ISO.7z
/
HYPERLIB-1997-Winter-CD1.ISO
/
オンラインウェア
/
UTIL
/
ForcePRAM.sit
/
ForceAppleTalk.a
< prev
next >
Wrap
Text File
|
1994-03-01
|
4KB
|
137 lines
Title 'Force AppleTalk and LAP settings' ;
*
* Module for "Force" shell.
* Ben Cranston March 1, 1994
*
Print Off ; Here be includes
Include 'RomEqu.a' ;
Include 'Traps.a' ;
Print On,NoGen ; Here be includes
Main ; Begin module
*
S Record {A6Link},Decr ; Stack frame
A6Link DS.L 1 ; Caller's A6
SPB DS SpBlock ; Slot Parameter Block
Curr DS.L 1 ; Current PRAM value
Want DS.L 1 ; Desired PRAM value
Flag DS.W 1 ; Desired PRAM setup flags
Boot DS.W 1 ; Set if reboot required
SS Equ * ; Stack size
EndR ; Stack frame
*
* Get resource containing the desired PRAM contents.
*
Link A6,#S.SS ; Make local frame
Clr.W S.Boot(A6) ; Initially set no reboot
Tst.L D1 ; Was our data resource present?
BEq.W @999 ; If not then just return
Move.L D1,A0 ; Get resource handle
Move.L (A0),A0 ; Get pointer
Move.W (A0),S.Flag(A6) ; Get desired value
*
Eject ;
*
* Test if AppleTalk is to be turned off entirely.
*
Clr.L S.Want(A6) ; Initially set AppleTalk OFF
Move.B S.Flag+0(A6),D1 ; Get master flag
BEq.S @030 ; Is AppleTalk to be turned off entirely?
*
* Test if LocalTalk is wanted.
*
Move.B #1,S.Want+3(A6) ; Set AppleTalk on LocalTalk
Cmp.B #1,D1 ; Want LocalTalk or EtherTalk?
BEq.S @030 ; Want EtherTalk, skip
*
* Find Ethernet card address to complete the desired PRAM value.
*
LEA S.SPB(A6),A0 ; Get spBlock address
Move.B S.Flag+1(A6),spBlock.spSlot(A0) ; Set slot to start searching at
Clr.B spBlock.spId(A0) ; Find any resource number
Clr.B spBlock.spExtDev(A0) ; External device zero?
Clr.B spBlock.spHwDev(A0) ; Ignore external hardware
Move.B #3,spBlock.spTBMask(A0) ; Look at Category and CType
Move.W #catNetwork,spBlock.spCategory(A0) ; Network category
Move.W #typEtherNet,spBlock.spCType(A0) ; EtherNet type
_sNextTypesRsrc ; Get next sResource info
BNE.W @900 ; If nofind then get out
Move.B spBlock.spSlot(A0),S.Want+0(A6) ; Get network card slot number
Move.B spBlock.spId(A0),S.Want+1(A6) ; Get slot resource ID number
Clr.B S.Want+2(A6) ; Clear unused field
Move.B #$A,D1 ; Get EtherTalk Phase 2 code
Cmp.B #2,S.Flag+0(A6) ; Did he want Phase 1?
BNE.S @020 ; If not then assume Phase 2
Move.B #$2,D1 ; Get EtherTalk Phase 1 code
@020 ;
Move.B D1,S.Want+3(A6) ; Set Phase 1 / Phase 2 code
*
Eject ;
*
* Read PRAM for AppleTalk On/Off selection, decide if we must change it.
*
@030 ;
Move.L #$00010013,D0 ; Byte 13
LEA S.Curr(A6),A0 ; Point to stack space
_ReadXPram ; Read current setting from parameter RAM
BNE.S @900 ; If error then get out
Move.B #1,D1 ; Get "ON" value
Tst.L S.Want(A6) ; Do we want it on?
BNE.S @040 ; Yes, go set it ON
Move.B #2,D1 ; Else get "OFF" value
@040 ;
LEA S.Curr(A6),A0 ; Get address of current value
Move.B (A0),D2 ; Get current value
And.B #$0F,D2 ; Get AppleTalk config bits
Cmp.B D2,D1 ; Is it the desired value?
BEq.S @050 ; Yes, go check LAP status
*
* Rewrite AppleTalk On/Off selection in PRAM and force reboot.
*
Move.B (A0),D2 ; Get current value
And.B #$F0,D2 ; Keep upper 4 bits
Or.B D1,D2 ; Use our lower bits
Move.B D2,(A0) ; Set current value
Move.L #$00010013,D0 ; Bytes E0 thru E3
_WriteXPram ; Write back to parameter RAM
Move.W #1,S.Boot(A6) ; Set flag to force reboot
Tst.L S.Want(A6) ; Did we want it off?
BEq.S @999 ; Yes, we are done
*
Eject ;
*
* Read PRAM for AppleTalk LAP selection, decide if we must change it.
*
@050 ;
Move.L #$000400E0,D0 ; Bytes E0 thru E3
LEA S.Curr(A6),A0 ; Point to stack space
_ReadXPram ; Read current from parameter RAM
BNE.S @900 ; If error then get out
Move.B S.Curr+1(A6),D1 ; Get current alt atalk type
Cmp.B S.Want+1(A6),D1 ; Same as desired?
BNE.S @060 ; No, must reset and reboot
Move.B S.Curr+3(A6),D1 ; Get current alt level
Cmp.B S.Want+3(A6),D1 ; Same as desired?
BEq.S @999 ; If so then skip
*
* Rewrite AppleTalk LAP selection in PRAM and force reboot.
*
@060 ;
LEA S.Want(A6),A0 ; Get address of desired
Move.L #$000400E0,D0 ; Bytes E0 thru E3
_WriteXPram ; Write back to parameter RAM
Move.W #1,S.Boot(A6) ; Set flag to force reboot
Bra.S @999 ; Return to driver
*
* Some kind of error, just return OK status.
*
@900 ;
Clr.W S.Boot(A6) ; Set no reboot
*
@999 ;
Move.W S.Boot(A6),D0 ; Set return value
UnLk A6 ; Drop local frame
RTS ; Return to INIT31
*
EndMain ; Keep MPW happy
End ; ForceAppleTalk.a