MDV Low Level Routines

Anything QL Software or Programming Related.
User avatar
mk79
QL Wafer Drive
Posts: 1349
Joined: Sun Feb 02, 2014 10:54 am
Location: Esslingen/Germany
Contact:

Re: MDV Low Level Routines

Post by mk79 »

That's the problem with only optimizing snippets. Depending on how "bad" is defined the instruction is allowed or not. In case of PC relative it's only valid as a source, true.

New offer:

Code: Select all

	lea     bad(pc),a1
	movea.l (a1),a0
	move.b  d7,(a0)+
	move.l  a0,(a1)
Same amount of lines, but less code (10 vs 12 bytes), less cycles (32 vs 48) and less bus accesses (8 vs 12).

All the best, Marcel


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 »

pjw wrote:tcat,
It would be really great if you could write up your findings, either as articles for publication or in one or more of the Wiki's - preferably both.

Keep QL-ing!
Per
Hi Per,Simon,All,

My quest is not right at its end yet. I will be replacing R/W head on one of the MDs, and setting it for lower speed. Then doing further tests.

You may follow other MD related threads at H/W section.

When I have enough confidence about my findings, I will share.

P.S. Currently looking for 2 more R/W heads to fix remaining units I have here.

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,

Ii seems that `Minerva' MD.SELEC and MD.DESEL are vectored routines. I do not have much documentation but source code.

These are declared as

Code: Select all

s vec.w 4 ss wser  4 ss rser  4 md selec 4 md desel ; $160 - $166
Meaning that MD.SELEC=$164, MD.DESEL=$166, correct?

EDIT
Parameters documented as

Code: Select all

* d1 -i  - drive to select (call for select only)
* a3 -ip - address of microdrive control register
* d0/d2 destroyed
I have problems calling these, is there some special treatment I am not aware of?

Many thanks.
Tomas


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

Re: MDV Low Level Routines

Post by tofro »

From some old Minerva "updates_doc" I happen to have on my hard disk:
MD.SELEC $164 Select microdrive unit
D1 drive number 1..8 ???
A3 $18020 preserved
D0/D2 destroyed
Call this in supervisor mode, with interrupts disabled, to select which of the microdrive units is to be started up. (N.B. D1.W should be 1..8).
A delay of about half a second after this call should be sufficient to ensure that the drive is up to speed.

MD.DESEL $166 Deselect microdrives
A3 $18020 preserved
D0/D1/D2 destroyed
Call this in supervisor mode, with interrupts disabled, to stop microdrives.
NB: All Minerva extended vectors need to be called with an offset of $4000!

Code: Select all

	move.w	$166,a2
	jsr		$4000(a2)
Hope this helps

Tobias


ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
User avatar
janbredenbeek
Super Gold Card
Posts: 630
Joined: Wed Jan 21, 2015 4:54 pm
Location: Hilversum, The Netherlands

Re: MDV Low Level Routines

Post by janbredenbeek »

It can also be done from SuperBASIC. This comes from the QL Service Manual:
mdvselect.PNG
Jan.


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 Tobias, Jan,
NB: All Minerva extended vectors need to be called with an offset of $4000!
Ah, this was probably the missing bit, I was not aware of.
Could I also code it like this?

Code: Select all

  lea   $4166,a2
  jsr    (a2)
or

Code: Select all

  movea.l  $4166,a2
  jsr    (a2)
Good, I can also do the tests right from Super BASIC, did not know that.

Many thanks.
Tomas


User avatar
janbredenbeek
Super Gold Card
Posts: 630
Joined: Wed Jan 21, 2015 4:54 pm
Location: Hilversum, The Netherlands

Re: MDV Low Level Routines

Post by janbredenbeek »

tcat wrote:Hi Tobias, Jan,
NB: All Minerva extended vectors need to be called with an offset of $4000!
Ah, this was probably the missing bit, I was not aware of.
Could I also code it like this?

Code: Select all

  lea   $4166,a2
  jsr    (a2)
Nope, this effectively calls absolute address $4166.

Code: Select all

  movea.l  $4166,a2
  jsr    (a2)
And this reads a long word from location $4166 and calls the address it points to. Effectively CALL PEEK_L($4166).

It's a pity that these routines were not vectored in Sinclair ROMs. But you could test the version using MT.INF and call the following addresses:
  • MD.SELECT:
    1.02: $2B64
    1.03: $2B70
    1.10: $2C56

    MD.DESEL:
    1.02: $2B5E
    1.03: $2B6A
    1.10: $2C50
Jan.


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 Jan,

I see, having said that, can I make these absolute addresses, $4000 relative for the `jsr $4000(a2) call'?
To make the calling code easier, while supporting most ROMs incl. `Minerva'.

Code: Select all

1.02: $2B64
1.03: $2B70
1.10: $2C56
Many thanks.
Tomas


User avatar
janbredenbeek
Super Gold Card
Posts: 630
Joined: Wed Jan 21, 2015 4:54 pm
Location: Hilversum, The Netherlands

Re: MDV Low Level Routines

Post by janbredenbeek »

tcat wrote:Hi Jan,

I see, having said that, can I make these absolute addresses, $4000 relative for the `jsr $4000(a2) call'?
To make the calling code easier, while supporting most ROMs incl. `Minerva'.

Code: Select all

1.02: $2B64
1.03: $2B70
1.10: $2C56
No these addresses have to be called directly after checking the QDOS version.
I don't know the addresses of the MG ROM (v1.13) off hand but there are disassemblies around where you can find them (you should mask off the dot as it is replaced by the country code, e.g. 1G13 for German MG ROM).
If the version is not one of these (and >1.13) it's probably Minerva, and then you can call them via the vector address (with offset $4000).

Jan.


Post Reply