News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu
avatar_redbox

Understanding BOOSTER.ROM

Started by redbox, 19:24, 05 July 11

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Bryce

#25
Yes, it's designed that way and this is how it generally works:

The /ROMEN (ROM enable) signal in a classic CPC is produced by the Gate array. It triggers the Chip Select of the internal ROM(s) and also goes to the expansion port. On the MegaROM for example it's used like this:

If /ROMEN is activated (=0)
AND
A15=1 + A13=0 (address decoding)
AND
/IORQ =0 (I/O Request)
AND
/WR=0 (Data is being written)
THEN
Read the data Bus, because the number being sent is the ROM number being addressed/requested

The MegaROM then sets ROMDIS (if the ROM No. was between 0 and 15), which disables the internal ROMs: ROM 0 in a classic CPC or ROMs 0 + 7 in a CPC Plus
and activates the external EPROM using the Databus value to select the correct address range in the EPROM.

On the Plus it's slightly different. The ASIC produces /ROMEN, but only sends it to the expansion port, a different signal called /ROM (confusingly labeled NCE on the port) is used to activate the cartridge ROM. However, if the MegaROM activates ROMDIS, the asic also disables the Cartridge (virtual) ROM 0 as it would on the classic CPC.

Edit: On a classic CPC6128, selecting ROM 7 will also set the ROMDIS signal in order to disable ROM 0.

Bryce.

TFM

#26
Quote from: Bryce on 08:14, 08 July 11
Ok, so it's not the actual number being used by a ROM that's important, but the fact that there is only space for 32 ROM "header bytes". So if only ROMs 0 and 7 were initialised, it would still be possible to initialise (by hand) 30 other ROMs at positions above 31?

Yes, there is only space for 32 ROM headers (four bytes) each. And yes...
Let's put it that way.... You can use the Booster ROM to install ROMs 26-41 instead of 16-31 if you like.

Quote from: Bryce on 08:14, 08 July 11
Is this also the case with the CPC Plus? The reason I ask is the MegaFlash: If ROMs 0 and 7 are initialised, and a cartridge also takes some ROM space, then can I still activate 32 ROMs on the MegaFlash without the CPC crashing?
Bryce.

The CPC Plus uses the same firmware as the CPC6128, and since this is an software issue: Expect no difference.

Quote from: redbox on 10:24, 08 July 11
This appears to be what TFM is saying and I already knew about this. It's the same reason it's not a good idea to initialise 32 ROMs at once - Himem gets so low from all the RAM grabbed by the ROMs that the CPC becomes pretty unusable.

In principle this is right. But it depends only on the used ROMs - to be preciese, as you already mentioned, the amount of RAM the ROMs use up.

However 32 ROMs are not a problem, if you don't use too much ROMs which take too much RAM.

Further... Some ROMs (especially DOS ROMs!!!) like to have a certian area of RAM, so if you initialize too much ROMs (which take lots of RAM) before the DOS ROM gets initialized, they will just dramatically increase their needed RAM. Playing around a bit helps to create a stable system.

I suggest to use ROM positions 8-31 for ROMs which take only very few RAM. You can check this by using the !HELP command of XD-DOS.

Quote from: Bryce on 10:55, 08 July 11
... is there a problem with having the same ROM twice on a CPC?

No, its not a problem at all. Actually the BASIC ROM get's initialized very often (on the real CPC it's present at all "unused" ROM slots). The only exception may be DOS ROMs again.

Quote from: Bryce on 12:15, 08 July 11
Interesting to know. I don't know how it actually interprets RSX commands, but I would assume, the one with the highest ROM No. is the one actually being used, because the CPC reads them in from 15 to 0 and lists them in a table in RAM. When you type the RSX, I assumed it read the list from top to bottom, but maybe it's the other way around?

If you initialize more RSX commands with the same name, then you can ONLY use and access that one of them, which was initialized as LAST.

 
Quote from: redbox on 12:41, 08 July 11
I've tried it with |ROMON,20 and it accepts the input and doesn't crash. I've also tried it with |ROMON,132 and the Maxam ROM in that space in the cartridge position but unfortunately it didn't do anything.

Well, two things to mention here:

- First: numbers greater than 15 will probably not be processed. So nothing will happen. (Therefore 132 will not work).

- Second: To initialize ROM number 20 is like initializing BASIC again, nothing happens.


Well, let me suggest to use MAXAM and in he main menue the function Select Upper ROM. Just take a look in them at address &C000. So you can find out what's going on.

X <- Likes can be placed here  :P  And dislikes here -> X
TFM of FutureSoft
Also visit the CPC and Plus users favorite OS: FutureOS - The Revolution on CPC6128 and 6128Plus

arnoldemu

Quote from: redbox on 09:47, 13 July 11


Thanks Bryce, this information is incredibly useful and something I knew nothing about.  Looks like it explains the problems I'm having, will look into it further.  Hopefully I can get it to route via the /ROM signal instead and it's not a hardware limitation when accessing the cart.


Yes, had found this feature in Maxam and it is useful.  However, it only accepts input in the range 00-99 unfortunately.
If you activate rom 0 or rom 7 this will activate a page in the cartridge, but all others will not be activated without the correct rom number I think (>128).


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

TFM

Quote from: arnoldemu on 09:56, 13 July 11
If you activate rom 0 or rom 7 this will activate a page in the cartridge, but all others will not be activated without the correct rom number I think (>128).

There is the lower ROM, also a part of the Cartridge EPROM. But if you want to take a look at them all, just start at 80 hex and go up one by one.
TFM of FutureSoft
Also visit the CPC and Plus users favorite OS: FutureOS - The Revolution on CPC6128 and 6128Plus

redbox

I was being stupid with selecting ROMs in Maxam 1.5 - the input is in hex so it does accept 84 (which is &84 or 132) for a selection.

I put a ROM in this position in the cartridge (bank 4 in a 128kb cartridge) and when you select it and view memory at &C000 the ROM is there.

So it is possible to select a ROM in the cartridge space and page it into memory as a normal ROM would.


However, I still can't initialise it - maybe because as Bryce says ROM initialisation relies upon the /ROMON and /ROMOFF signals...?  Can anyone clarify this further?

TFM

Quote from: redbox on 15:01, 19 July 11
So it is possible to select a ROM in the cartridge space and page it into memory as a normal ROM would.

However, I still can't initialise it - maybe because as Bryce says ROM initialisation relies upon the /ROMON and /ROMOFF signals...?  Can anyone clarify this further?

No, that's not a hardware problem. The firmware just refuses to work with ROMs greater than 15. So just patch the routine of the CPC-OS and then it will work. Take a look at the 464-664-6128 ROM Listing (a book) that will help you with all this things.

You are on the right track to break the last CPC Plus borders ;-)
TFM of FutureSoft
Also visit the CPC and Plus users favorite OS: FutureOS - The Revolution on CPC6128 and 6128Plus

redbox

Quote from: TFM/FS on 16:21, 19 July 11
No, that's not a hardware problem. The firmware just refuses to work with ROMs greater than 15. So just patch the routine of the CPC-OS and then it will work. Take a look at the 464-664-6128 ROM Listing (a book) that will help you with all this things.


I've tried patching the OS.  I've tried writing my own initialisation routines.  Neither worked unfortunately, but it could well be due to buggy programming.


Do you have to initialise a ROM during the CPC bootup?  Or can it be done afterwards?


And once the RSXs have been registered (after init) does the firmware still walk the ROMs to find them (i.e. hard-coded 0-15) or are they stored in a table or somewhere else?


Is the ROM listing book online somewhere?


Quote from: TFM/FS on 16:21, 19 July 11
You are on the right track to break the last CPC Plus borders ;-)


It would be really nice to have a cartridge with ROMs on, but I fear it's a hardware problem in the way that the Plus patches ROMs into logical spaces (i.e. cartridge spaces &80 and &83 get paged into 0 and 7) and the ASIC/RMR2 might have something of a problem.  But until I know it's definitely not possible I will keep trying!

TFM

From the hardware side there should not be a problem it initialize ROMs &80-&84 for example. Under maxem you can select them and look at them, so it's all a software problem.

You may can consider to patch the OS to install &80-&8F instead of &00-&0F.

You should be able to find the ROM listing in the net, sorry I have neither a link nor the file, but I remember the content. Some years ago I took a look at it and patched the same routine. In this old days I had a ROM box that was wired to ROMs &40-&48. I could initializen them, but late on I had different hardware. So only memories are left, but it works.
TFM of FutureSoft
Also visit the CPC and Plus users favorite OS: FutureOS - The Revolution on CPC6128 and 6128Plus

redbox

Quote from: TFM/FS on 16:39, 19 July 11
You may can consider to patch the OS to install &80-&8F instead of &00-&0F.


But this would ignore 0-7 which you must also do, no?  Otherwise the CPC won't boot?


Unfourtunately there is no extra room left in the OS ROM when patching, and it uses this natty routine to walk ROMs:




0326 0e0f      ld      c,$0f
0328 cd3003    call    $0330 ; KL INIT BACK
032b 0d        dec     c
032c f22803    jp      p,$0328
032f c9        ret     



Nice and compact but hard to patch!

Quote from: TFM/FS on 16:39, 19 July 11
You should be able to find the ROM listing in the net, sorry I have neither a link nor the file, but I remember the content. Some years ago I took a look at it and patched the same routine. In this old days I had a ROM box that was wired to ROMs &40-&48. I could initializen them, but late on I had different hardware. So only memories are left, but it works.


That's a shame but re-assuring that you were able to do this at some point.  I will try and find it.

TFM



0326 0e0f ld c,$8f
0328 cd3003 call $0330 ; KL INIT BACK
032b 0d dec c
032c f22803 jp m,$0328
032f c9 ret


Would this work for ROMs &80 to &8F. Now what do you put in them?  ;-)
TFM of FutureSoft
Also visit the CPC and Plus users favorite OS: FutureOS - The Revolution on CPC6128 and 6128Plus

redbox

Quote from: TFM/FS on 16:47, 19 July 11
Would this work for ROMs &80 to &8F. Now what do you put in them?  ;-)


That's very nice, forgot about the S flag.


So I've looked further and it appears it is possible, but the OS ROM is riddled with checks for ROMs in the range of 0-15.  The BOOSTER.ROM does patch the firmware quite a bit for this, but it's simpler here because it only has to increase &10 to &20 and the routines mostly stay the same.  I also have to overcome the problem that Amsdos should patch into 7 where as in the cart it's in space &83.


So, not a simple patch and quite possible a re-write of the lower OS.  However, it has given me an idea as to how to adapt some ROMs to work from the cart, which might be a stepping stone onwards.

arnoldemu

Quote from: redbox on 19:55, 19 July 11

That's very nice, forgot about the S flag.


So I've looked further and it appears it is possible, but the OS ROM is riddled with checks for ROMs in the range of 0-15.  The BOOSTER.ROM does patch the firmware quite a bit for this, but it's simpler here because it only has to increase &10 to &20 and the routines mostly stay the same.  I also have to overcome the problem that Amsdos should patch into 7 where as in the cart it's in space &83.


So, not a simple patch and quite possible a re-write of the lower OS.  However, it has given me an idea as to how to adapt some ROMs to work from the cart, which might be a stepping stone onwards.

the plus hardware helps you with amsdos.

if you select upper rom 7, it auto selects cart page 3.

Yes you will need to patch the OS, but perhaps not as much as you expect ;)

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

redbox

Quote from: arnoldemu on 09:20, 20 July 11
the plus hardware helps you with amsdos.
if you select upper rom 7, it auto selects cart page 3.


Thanks, that's good to know - but if you actually put something in slot 7 how come it over-rides what's in cart slot 3 then?

Bryce

Because the ROMBoard sets ROMDIS, which goes to the ASIC, which in turn disables page 3 of the cart.

Bryce.

redbox

#39
Quote from: Bryce on 14:45, 20 July 11
Because the ROMBoard sets ROMDIS, which goes to the ASIC, which in turn disables page 3 of the cart.

Thanks for the explanation Bryce.


So basically I need to walk 0-15 as normal (and let the hardware deal with cart paging) and walk 132 upwards. 


Back to the start for me then, but it has been useful dissecting all of this and it confirms I need quite a big OS rewrite... guess I'll have to do a comprehensive disassembly and see what I can bin and what to keep.


At least the routines involved have a jumpblock copied into RAM so altering the routines in the lower ROM shouldn't affect most software.

arnoldemu

www.cpctech.org.uk/docs/os.asm

for cpc

this may help

it's not complete, but may help.

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

redbox

Quote from: arnoldemu on 15:22, 20 July 11
it's not complete, but may help.


Oh I've been using it and it's helped me loads already, so thanks for putting it on your site!

arnoldemu

Quote from: redbox on 15:51, 20 July 11

Oh I've been using it and it's helped me loads already, so thanks for putting it on your site!
I found this:
http://www.cpctech.org.uk/docs/plusos.asm

This is about 80% complete. it shows the differences between the 6128 english OS rom and the equivalent within the english 6128.

BASIC between the two differs in just 2 bytes.

I also plan, in a few months time, to update my plus amsdos dissassembly to show where it differs from amsdos.
I guess in the menu and a a few moved functions, but not a huge amount, probably about 1/2k difference.
My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

Powered by SMFPacks Menu Editor Mod