News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu

cpm 2.2 - proof of concept driver

Started by arnoldemu, 12:49, 12 May 18

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

arnoldemu

Attached is a proof of concept driver for cpm 2.2. Most of the functions are stubs or perform dummy operations.

You need to use MOVCPM and SYSGEN to allocate space to modify CPM to allocate some ram.

Then run "driver.com".

This driver.com copies into the space you made available and patches the CPM BDOS.

Now if you type, C:, D:, E: or F: it will choose the drive and you can use DIR etc.
Read gives an empty buffer, write does nothing.

Issues:
- boot and wboot on Amstrad's CPM2.2 cannot be returned from. It jumps into the ROM, reloads CPM from the system tracks and restarts it. My initial idea was to patch them so it loads and then I re-patch the vectors.

So at this time the best way to make this work is:
1. MOVCPM/SYSGEN to allocate space.
2. PROFILE.SUB or similar to launch the driver.com
3. Now you can use it.

The code is located at a fixed point in RAM. Ideally it should be a PRL and relocate itself. It needs a "40K CPM" with jumpblock at &9A00. The driver does check it's running under 2.2 and will report if there is not enough RAM available to install itself.

Amstrad's doc mentions RSX, but these don't really exist in CPM 2.2 so I don't know what it's talking about.

Also I can't see if there is any way to install multiple programs this way.



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

HAL6128

@arnoldemu
so your 'fake' read function just puts '&E5' into RAM (dma) with the length of 128Byte to read out.
How will the 512 IDE sectors come into RAM? Do I need an extra buffer under TPA Limit? Is there the right place have the IDE low level code placed?
HAL6128
...proudly supported Schnapps Demo, Pentomino and NQ-Music-Disc with GFX

arnoldemu

Quote from: HAL 6128 on 12:32, 15 May 18
@arnoldemu
so your 'fake' read function just puts '&E5' into RAM (dma) with the length of 128Byte to read out.
How will the 512 IDE sectors come into RAM? Do I need an extra buffer under TPA Limit? Is there the right place have the IDE low level code placed?
HAL6128
First I will say I can't say for a CPM2.2 with 63KB TPA (e.g. RCPM or other CPM 2.2 that uses extra RAM). I don't know how they are implemented and I have not looked at them yet. My code is for Amstrad's CPM2.2.
Amstrad's CPM2.2 it is not banked.

I have two different drivers on the wiki. One that uses MOVCPM to lower TPA and reserve memory that CPM can not touch - TPA is always lowered. A second one that uses X-SUB method to install inside TPA. This reduces TPA only when it is installed.

For both drivers I would put the 512byte IDE buffer inside the driver and use ldir to move the memory to the dma address given by CPM.
CPM2.2 is limited to 128byte sectors so there are 4 CPM2.2 sectors in 1 IDE sector. You can define this in your DPB and you must do the translation from CPM "track", "sector" to IDE LPA address and position in your 512byte buffer.
CPM3.0 is banked and I am investigating the best method for this. A driver for CPM3.0 will use a different method.







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

HAL6128

...just a thought. Wouldn't it be easier for a first step to rewrite or exchange the sector read routine of AMSDOS with an IDE sector read / write routine. Of course, you won't be able to read from a floppy anymore, but if the HDD (XMASS for example) is preformatted & preconfigured with system sectors (tracks) maybe you could be able to start it?
...proudly supported Schnapps Demo, Pentomino and NQ-Music-Disc with GFX

Powered by SMFPacks Menu Editor Mod