Path: utzoo!attcan!uunet!mcsun!unido!fauern!fauern!csbrod From: csbrod@medusa.informatik.uni-erlangen.de (Claus Brod ) Newsgroups: comp.sys.atari.st Subject: Re: Forcing a media change Keywords: MEDIA CHANGE, MOUNT Message-ID: <2967@medusa.informatik.uni-erlangen.de> Date: 9 Jul 90 00:01:11 GMT References: <204@shiloh.UUCP> Organization: CSD, University of Erlangen, W-Germany Lines: 59 dhollis@shiloh.UUCP (Dan Hollis @ 7819367) writes: >Is there some way to 'fake out' TOS, and force a media change via software? >If so, is there a 'legal' way to do it? If not a 'legal' way, then how do >you do it anyways? Any responses would be appreciated... Simple. Link into the hdv vectors. Let them point to routines that return 2 (hdv_mediach), -14 (hdv_rw), or deinstall themselves (hdv_bpb), i.e. something like this: my_rw: move.w $e(a7),d0 ; drive to read/write cmp.w ourdrive(pc),d0 ; drive to fake media change on? bne.s rw2 ; no, goon moveq #-14,d0 ; Media changed rts rw2: move.l old_rw(pc),a0 ; get old rw vector jmp (a0) ; jump to the old routine my_med: move.w 4(a7),d0 ; drive to check media status cmp.w ourdrive(pc),d0 ; drive to fake media change on? bne.s med2 moveq #2,d0 ; media changed rts med2: move.l old_media(pc),a0 ; get old mediach vector jmp (a0) my_bpb: move.w 4(a7),d0 ; drive to get BPB from cmp.w ourdrive(pc),d0 ; you know which drive-... bne.s bpb2 move.l old_rw(pc),hdv_rw ; restore vectors move.l old_media(pc),hdv_med move.l old_bpb(pc),hdv_bpb move.l old_bpb(pc),a0 jmp (a0) After you've done that, do some dummy GEMDOS call like Fopen("X:\\YYYY") where X is the drive where the media changed shall be faked on and YYYY is a file name that may or may not exist. In this moment, GEMDOS calls the BIOS routines: Mediach() and Rwabs() return 'changed', so GEMDOS calls Getbpb() to reinitialize drive data. It also forgets all about the drive, including folder info and things like this. Remember to use XBRA when linking into the BIOS vectors (I omitted that for reasons of brevity). The code above is not guaranteed to work - it's 2 a.m. and I badly need to sleep. By the way: You'll find a detailled description on how to this in the TOS 1.4 release notes. ---------------------------------------------------------------------- Claus Brod, Am Felsenkeller 2, Things. Take. Time. D-8772 Marktheidenfeld, West Germany (Piet Hein) csbrod@medusa.informatik.uni-erlangen.de ----------------------------------------------------------------------