Dead Hackers Society
Other BBSes »
 
 
Demoscene  Coding  CT60  Buy/sell

Atari coding BBS
 
Re: GEMDOS loading with music
Posted by: evil Aug,21.2009-17:48 

Ok so I dug up the Compendium and found the code, here it is in case someone else want it:


/*
* _mediach(): force the media 'changed' state on a removable drive.
*
* Usage: errcode = _mediach( devno ) - returns 1 if an error occurs
*
* Inputs: devno - (0 = 'A:', 1 = 'B:', etc...)
*
*/

.globl _mediach

_mediach:
move.w 4(sp),d0
move.w d0,mydev
add.b #'A',d0
move.b d0,fspec ; Set drive spec for search
loop:
clr.l -(sp) ; Get supervisor mode, leave old SSP
move.w #$20,-(sp) ; and "Super" function code on stack.
trap #1
addq.l #6,sp
move.l d0,-(sp)
move.w #$20,-(sp)

move.l $472,oldgetbpb
move.l $47e,oldmediach
move.l $476,oldrwabs

move.l #newgetbpb,$472
move.l #newmediach,$47e
move.l #newrwabs,$476

; Fopen a file on that drive
move.w #0,-(sp)
move.l #fspec,-(sp)
move.w #$3d,-(sp)
trap #1
addq.l #8,sp

; Fclose the handle
tst.l d0
bmi.s noclose

move.w d0,-(sp)
move.w #$3e,-(sp)
trap #1
addq.l #4,sp

noclose:
moveq #0,d7
cmp.l #newgetbpb,$472 ; still installed?
bne.s done

move.l oldgetbpb,$472 ; Error, restore vectors.
move.l oldmediach,$47e
move.l oldrwabs,$476

trap #1 ; go back to user mode
addq.l #6,sp ; restore sp

moveq.l #1,d0 ; 1 = Error
rts
done:
trap #1 ; go back to user mode
addq.l #6,sp ; from stack left above

clr.l d0 ; No Error

rts

/*
* New Getbpb()...if it's the target device, uninstall vectors.
* In any case, call normal Getbpb().
*/

newgetbpb:
move.w mydev,d0
cmp.w 4(sp),d0
bne.s dooldg

move.l oldgetbpb,$472 ; Got target device so uninstall.
move.l oldmediach,$47e
move.l oldrwabs,$476
dooldg: move.l oldgetbpb,a0 ; Go to real Getbpb()
jmp (a0)

/*
* New Mediach()...if it's the target device, return 2. Else call old.
*/

newmediach:
move.w mydev,d0
cmp.w 4(sp),d0
bne.s dooldm
moveq.l #2,d0 ; Target device, return 2

rts

dooldm:
move.l oldmediach,a0 ; Call old
jmp (a0)

/*
* New Rwabs()...if it's the target device, return E_CHG (-14)
*/

newrwabs:
move.w mydev,d0
cmp.w 4(sp),d0
bne.s dooldr
moveq.l #-14,d0
rts

dooldr:
move.l oldrwabs,a0
jmp (a0)

.data

fspec: dc.b "X:\\X",0
mydev: ds.w 1
oldgetbpb: ds.l 1
oldmediach: ds.l 1
oldrwabs: ds.l 1

.end








[All messages in this thread]    [Start new thread]

Topic Posted by  Date 
GEMDOS loading with music Per Almered (XiA) Aug,19.2009-13:02
  Re: GEMDOS loading with music PeP Aug,19.2009-14:30
    Re: GEMDOS loading with music Per Almered (XiA) Aug,19.2009-15:08
      Re: GEMDOS loading with music PeP Aug,19.2009-15:43
        Re: GEMDOS loading with music Per Almered (XiA) Aug,19.2009-16:28
          Re: GEMDOS loading with music Bod Aug,19.2009-20:10
            Re: GEMDOS loading with music lp060 Aug,19.2009-20:17
              Re: GEMDOS loading with music Per Almered (XiA) Aug,19.2009-21:26
                Re: GEMDOS loading with music ggn Aug,20.2009-08:01
                  Re: GEMDOS loading with music Per Almered (XiA) Aug,20.2009-10:05
                    Re: GEMDOS loading with music evil Aug,20.2009-15:13
                      Re: GEMDOS loading with music Per Almered (XiA) Aug,20.2009-21:10
                        Re: GEMDOS loading with music Per Almered (XiA) Aug,20.2009-22:12
                        Re: GEMDOS loading with music evil Aug,21.2009-14:58
                          Re: GEMDOS loading with music Per Almered (XiA) Aug,21.2009-15:38
                            Re: GEMDOS loading with music evil Aug,21.2009-17:48
                    Re: GEMDOS loading with music ggn Aug,21.2009-09:34
                      Re: GEMDOS loading with music Per Almered (XiA) Aug,21.2009-14:29
                        Re: GEMDOS loading with music ggn Aug,21.2009-15:07


Reply to this message
Name:
Topic:
Anti-troll code:

Message:

What's the anti-troll code?
That's your personal code to be able to add comments and messages on the dhs.nu site.
Don't have a code or forgot it? Fix it here.
© 1994-2024 Dead Hackers Society Contact: Anders Eriksson