MDV Low Level Routines

Anything QL Software or Programming Related.
tcat
Super Gold Card
Posts: 633
Joined: Fri Jan 18, 2013 5:27 pm
Location: Prague, Czech Republic

Re: MDV Low Level Routines

Post by tcat »

Hi,

I am now trying to release Slave Blocks, there were three methods sounded here
[a] calling slaving routine 28(a3),
using TK2 DEL_DEFB , and
[c] allocating free_mem, and releasing it

I tried DEL_DEFB, I may overlooked something, but it also releases files on RAM disk.

I am now trying the code like this, option [c]

Code: Select all

4282  REMark Release slave blocks, display MDV directory
4285  relSB=ALCHP(FREE_MEM): RECHP(relSB)
4287  DirDev "mdv"&dst&'_',''
But it seems working only first time, then I need to cycle media by hand and DIR them.
Again, I may have overlooked something.

Tomas


Martin_Head
Aurora
Posts: 851
Joined: Tue Dec 17, 2013 1:17 pm

Re: MDV Low Level Routines

Post by Martin_Head »

If you have altered the map on the cartridge, and you want to clear the RAM based map held in the Physical definition block. And then replace it with the new one.

You could try corrupting the Medium name and random number in the Physical definition block (12 bytes starting from offset $16 of the Physical definition block). Then do a DIR.

This should cause the operating system to check the cartridge, find it's different, assume the cartridge has been changed, then clear the slave blocks, and read the map.

Martin Head


tcat
Super Gold Card
Posts: 633
Joined: Fri Jan 18, 2013 5:27 pm
Location: Prague, Czech Republic

Re: MDV Low Level Routines

Post by tcat »

Hi Martin,

Thank you, this may possibly do what I am looking for.
However I would not know, how to access Physical Defintion Blocks.

I was thinking of System Variables>>
$28058.L SV_BTBAS Pointer to base of slave block table
$2805C.L SV_BTTOP Pointer to top of slave block table

I can only guess these point to a linked list, but how do I get to MDV block holding the map and/or directory?
On floppy systems, there could also be blocks for FLP, so just to be sure to find the right for MDV1 or MDV2?

Many thanks
Tomas


tcat
Super Gold Card
Posts: 633
Joined: Fri Jan 18, 2013 5:27 pm
Location: Prague, Czech Republic

Re: MDV Low Level Routines

Post by tcat »

Martin,

Another thought, this System Variable>>
$28100.L*16 SV_FSDEF Pointers to file system physical definition

Right?

Technical Guide gives>>

Code: Select all

The common part of a physical definition block

FS_NMLEN $24			max length of file name
FS_HDLEN $40			length of file system header

FS_DRIVR $10 long		pointer to driver
FS_DRIVN $14 byte		drive number

FS_MNAME $16 word+10 bytes	medium name
FS_FILES $22 byte		number of files open

So far cannot see Random yet, but I am now Peeking my QL.

EDIT
Now I see Random as well, not documented offset possibly?


Tomas


User avatar
tofro
Font of All Knowledge
Posts: 2699
Joined: Sun Feb 13, 2011 10:53 pm
Location: SW Germany

Re: MDV Low Level Routines

Post by tofro »

The random number is actually the last 2 bytes of the medium name in the PDB. So simply clearing all the 12 bytes of the medium name + length should be enough to signal a cartridge change.

Tobias


ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
tcat
Super Gold Card
Posts: 633
Joined: Fri Jan 18, 2013 5:27 pm
Location: Prague, Czech Republic

Re: MDV Low Level Routines

Post by tcat »

Tobias, Martin,

Thank you, I can now force media change.

The only problem now is to correctly identify MDV1 ... MDV2 physical blocks among other blocks.
There seems a maximum of 16 drives active at any one time, however I noticed that SV_FSDEF pointers are allocated, as the drives are accessed.

So on my system after boot>>

MDV1_ poke_l($28100) + 0:
FS_DRIVR $10 long ????
FS_DRIVN $14 byte 1

RAM1_ poke_l($28100) + 4:
FS_DRIVR $10 long ????
FS_DRIVN $14 byte 1

MDV2_ poke_l($28100) + 8:
FS_DRIVR $10 long ????
FS_DRIVN $14 byte 2

So I wonder if I could somehow identify MDV by FS_DRIVR driver pointer, but does not seem to point to ROM?

Many thanks so far.
Tomas


tcat
Super Gold Card
Posts: 633
Joined: Fri Jan 18, 2013 5:27 pm
Location: Prague, Czech Republic

Re: MDV Low Level Routines

Post by tcat »

Hi,

FS_DRIVR seems pointing to this structure.

Code: Select all

;Linkage block for MDV directory driver (first and last in internal link)

L1230   dc.l    0                       ;last in list
        dc.l    L1274                   ;I/O
        dc.l    L1730                   ;OPEN
        dc.l    L18B8                   ;CLOSE
        dc.l    L29FC                   ;SLAVING
        dc.l    0                       ;RENAME
        dc.l    0                       ;TRUNCATE
        dc.l    L5000                   ;FORMAT
        dc.l    $0428                   ;length physical definition block
        dc.w    3                       ;device name string
        dc.b    'MDV',0
Tomas


tcat
Super Gold Card
Posts: 633
Joined: Fri Jan 18, 2013 5:27 pm
Location: Prague, Czech Republic

Re: MDV Low Level Routines

Post by tcat »

Hi,

As a matter of interest, TK2 seems to redefine,

original ROM
FS_MNAME $16 word+10 bytes medium name

to

FS_MNAME $16 10 bytes+ word medium name + random number

Also I/O and other routines are redefined as the do not point to ROM from the MDV linkage block.

Tomas


Martin_Head
Aurora
Posts: 851
Joined: Tue Dec 17, 2013 1:17 pm

Re: MDV Low Level Routines

Post by Martin_Head »

So on my system after boot>>

MDV1_ poke_l($28100) + 0:
FS_DRIVR $10 long ????
FS_DRIVN $14 byte 1

RAM1_ poke_l($28100) + 4:
FS_DRIVR $10 long ????
FS_DRIVN $14 byte 1

MDV2_ poke_l($28100) + 8:
FS_DRIVR $10 long ????
FS_DRIVN $14 byte 2
FS_DRIVN is the drive number. So in the third example the 2 in FS_DRIVN, is for MDV 2
As a matter of interest, TK2 seems to redefine,

original ROM
FS_MNAME $16 word+10 bytes medium name

to

FS_MNAME $16 10 bytes+ word medium name + random number

Also I/O and other routines are redefined as the do not point to ROM from the MDV linkage block.
I don't think TK2 changed FS_MNAME. I think it's mistakes in the documentation. It may be that when some of the technical books were published, they were working on pre-release information while QDOS was still changing. I've noticed a few differences between what the QL Advanced User Guide, and The Sinclair QDOS Companion says. And what you actually find.

TK2 alters the linkage block routines because it adds extra features to the mdv device driver (Rename comes to mind). I doubt it actually replaces the mdv device driver completely, Just calls the ROM routines when when one of the extra features is not required.

Martin Head


tcat
Super Gold Card
Posts: 633
Joined: Fri Jan 18, 2013 5:27 pm
Location: Prague, Czech Republic

Re: MDV Low Level Routines

Post by tcat »

Hi,

In the map, the last sector holds information on last block allocated.
I am not sure I understand the use of this info in the map.
When I duplicate a tape, I copy this information over, but perhaps I should use that of the destination?

Tom


Post Reply