News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu

New storage devices in CPM+

Started by arnoldemu, 11:39, 07 May 18

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

arnoldemu

I have been dissassembling Amstrad's CPM+ and I found a way to patch for new drives.

Amstrad's CPM runs from two banks. Bank 0 (C0 ram selection) holds the implementation of Amstrad's XBIOS (but uses C1 ram selection to have the common C7 page at &c000-&ffff), this part calls firmware but doesn't use AMSDOS. Screen is at &4000-&7fff.

John Elliot provides useful information:
https://www.seasip.info/Cpm/xbios.html
https://www.seasip.info/Cpm/xbiosint.html

The XBIOS does use the firmware but not AMSDOS.

Bank 1 (C2 selection)  is where the TPA is and some kind of BDOS and BIOS but it's small. As noted before C7 page is shared at &c000-&ffff. Lots of the functions here switch to bank 0 (C1) using the function at FD1C. This takes an inline address which is the address in bank 0 to call.

Now about drives:

seldsk exists at FC1B, this calls to FE06, this calls FD1C with inline address &3e56.
Back in bank 0, 3e56 calls 3ebb to read the DPH from the chosen drive. List of DPH addresses at FE2F. This can be patched.

Now this is where it gets interesting. Each DPH has additional information.
At offset +23 is the address of the low-level write function. At offset +25 is the address of the low-level read function. (3f1c and 3f17)

Following this are two more address 3ed6,3ecb. (3ed6 does DD LOGIN, 3ecb is a ret).

In theory you need to put your code in C7. because read/write can go to any page. At a minimum it's the reading/writing of the IDE buffer the rest can be in bank 0.

Accessing bank 0 can be done via the CPM3 methods selmem, setbnk, xmove, possibly transfering 128 bytes at a time.

At a pinch you could call userf to do something. (see Amstrad's XBIOS).

Problems I haven't worked out yet:
- no MOVCPM... so how to reduce TPA - is it even possible?
- where to put the buffer (could re-use the disc ones) and the functions themselves. It seems like bank 0 is full.
- will patching just read/write in the dph be all that is needed?





My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

arnoldemu

FE2F is returned by "drvtbl".

So it may be easier to write something like an RSX which uses space from the TPA to give a reduced TPA.

Then patch in your drive in the dph list, and provide the low-level read functions which work like DD READ SECTOR and DD WRITE SECTOR.

Run it all from TPA space.

To avoid reducing TPA, some involved method of installing it into bank 0 can be used.

My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

GUNHED

Email me for documented source code of CP/M Plus with hard-disc support.
http://futureos.de --> Get the revolutionary FutureOS (Update: 2023.11.30)
http://futureos.cpc-live.com/files/LambdaSpeak_RSX_by_TFM.zip --> Get the RSX-ROM for LambdaSpeak :-) (Updated: 2021.12.26)

arnoldemu

Quote from: GUNHED on 12:54, 07 May 18
Email me for documented source code of CP/M Plus with hard-disc support.
Thank you. I have e-mailed you.
My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

HAL6128

#4
Shouldn't there no difference between a sector reading of a IDE device of a standard floppy disc? Both are reading 512 Bytes into buffer and CP/M is working with 128 Bytes internally?

And thanks for very extensive description of CP/M 2.2 booting process in the wiki entry!
...proudly supported Schnapps Demo, Pentomino and NQ-Music-Disc with GFX

GUNHED

Instead of the regular BDOS one could use one of the advanced Z80 replacements. This is done for example in Z3Plus which is still compatible with CP/M Plus, but has more Unix like powers (wheel byte, PW, shell-stack, .... named directories, aliases, and and and).

http://futureos.de --> Get the revolutionary FutureOS (Update: 2023.11.30)
http://futureos.cpc-live.com/files/LambdaSpeak_RSX_by_TFM.zip --> Get the RSX-ROM for LambdaSpeak :-) (Updated: 2021.12.26)

arnoldemu

#6
Quote from: HAL 6128 on 06:28, 08 May 18
Shouldn't there no difference between a sector reading of a IDE device of a standard floppy disc? Both are reading 512 Bytes into buffer and CP/M is working with 128 Bytes internally?
I didn't test my discoveries yet, because it means I need to write an RSX or similar and I don't know how to do that in CPM, so I don't know if there are complications. I think the same as you that there should be no difference. The flow of the code looks like it should work. John Elliott has replied to me via e-mail with more details that will help a lot.

Looking at Dobbertin's CPM+:
* They re-wrote CPC's XBIOS and BIOS.
* They added a ram disk (autodetected)
* Most of their HD code is in bank 0 with read/write buffer in common bank. It requires X-DDOS for hd detection.
* I still have more to read to find out if they have the read/write functions in the DPH like Amstrad has done.
* They did a great job.

Quote from: HAL 6128 on 06:28, 08 May 18
And thanks for very extensive description of CP/M 2.2 booting process in the wiki entry!
no problem :)

I am making the same for X-DDOS CPM boot sequence.
My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

arnoldemu

Quote from: GUNHED on 10:37, 09 May 18
Instead of the regular BDOS one could use one of the advanced Z80 replacements. This is done for example in Z3Plus which is still compatible with CP/M Plus, but has more Unix like powers (wheel byte, PW, shell-stack, .... named directories, aliases, and and and).
Yes I agree.

Looking at existing sources I find it confusing about how it works and how to run it on Amstrad. It seems there are no dsks.
So I plan to write about this and upload a dsk that can be booted and run (I will check if I need to get permission to do this).

My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

Powered by SMFPacks Menu Editor Mod