29.12.2012 Views

The Programmer's Guide to TRSDOS Version 6 - Tim Mann's Home ...

The Programmer's Guide to TRSDOS Version 6 - Tim Mann's Home ...

The Programmer's Guide to TRSDOS Version 6 - Tim Mann's Home ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

available from Logical Systems, Inc.] <strong>to</strong> reside in either the low memory driver region or<br />

in upper memory of bank zero. Upon return from the disk driver, the DOS will res<strong>to</strong>re the<br />

previously resident RAM with another @BANK request.<br />

<strong>The</strong> DOS then places an "Illegal drive number" error code (32) in<strong>to</strong> the accumula<strong>to</strong>r,<br />

resets the Z-flag, then executes a "CALL" <strong>to</strong> a "JP (IY)" instruction. <strong>The</strong> purpose of this<br />

strange linkage becomes evident when we examine the result. <strong>The</strong> first byte of the DCT is<br />

interpreted as an RET instruction if the drive is disabled. Since register IY is pointing<br />

<strong>to</strong> that byte, the linkage will return back <strong>to</strong> the caller with the "Illegal drive number"<br />

error. If the drive is enabled, the first DCT byte is interpreted as a JUMP instruction<br />

which will transfer control <strong>to</strong> the entry point of the driver. We can now show the uniform<br />

register pro<strong>to</strong>col upon entry <strong>to</strong> a disk driver. This pro<strong>to</strong>col is illustrated in figure 4-<br />

7.<br />

Register Direction Condition/Value<br />

AF => Irrelevant upon entry <strong>to</strong> the driver<br />

B => Contains the function code of the request <br />

C => Contains the logical drive number <br />

D => Contains the cylinder being requested <br />

E => Contains the relative sec<strong>to</strong>r being requested <br />

HL => Contains a pointer <strong>to</strong> the I/O buffer, where applicable<br />

IY => Contains a pointer <strong>to</strong> the proper Drive Control Table entry<br />

A

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!