CPCWiki forum

General Category => Programming => Topic started by: Ast on 14:58, 12 January 18

Title: Rom Initialisation
Post by: Ast on 14:58, 12 January 18
Hi !


A simple question... As everybody know (or not?) amstrad firmware is able to initialise the 16th first roms (0-15) on cpc 6128 and up to 8 (0-7) on cpc 464.
But if i want to use 16-31 slots, how can i do to init them ? Does anyone know about it ?
Please, don't speak about "booster.rom", i don't want to use it...
Thanks for your futures advices!
Title: Re: Rom Initialisation
Post by: CraigsBar on 15:23, 12 January 18
Quote from: Ast on 14:58, 12 January 18
Hi !


A simple question... As everybody know (or not?) amstrad firmware is able to initialise the 16th first roms (0-15) on cpc 6128 and up to 8 (0-7) on cpc 464.
But if i want to use 16-31 slots, how can i do to init them ? Does anyone know about it ?
Please, don't speak about "booster.rom", i don't want to use it...
Thanks for your futures advices!
Fw 3.1 initialises 0-31

Sent from my ONEPLUS 3t using Tapatalk

Title: Re: Rom Initialisation
Post by: Ast on 00:08, 13 January 18
Sorry but, rom 16-31 are not initialised with fw 3.15 :/
All i want to see would be a piece of code... why not ?


If you can't i will take a piece of cake...
Title: Re: Rom Initialisation
Post by: HAL6128 on 13:17, 13 January 18
...there are two different type of FW31.5. One with 16 ROM slot support and another with 32. Look a the filenames on the disk image.
Title: Re: Rom Initialisation
Post by: Ast on 11:39, 15 January 18
Thanks for your help!
I have decided to code my own and i have succeeded!
iMPdos does it during the boot (all 32 roms are initialised!)
Title: Re: Rom Initialisation
Post by: robcfg on 12:43, 15 January 18
Would you mind explaining how is it done, please?
Title: Re: Rom Initialisation
Post by: Ast on 14:29, 15 January 18
Of course, i will do it tonight!
Title: Re: Rom Initialisation
Post by: Ast on 21:06, 15 January 18
Here is the code source :




   org #a000
;
; Add roms 16 up to 31
; (c)Ast/iMPACT January 2017
;   
   di
num   ld a,16 ; We start with rom number 16
   ld bc,#7f84+2 ; Upper rom On | Lower rom off | Mode 2
   out (c),c
   ld b,#df
   out (c),a ; Connect the rom selected in Upper Rom
   ld a,(#c006)
   cp #c3
   call z,found ; If a rom is found.....
   ld a,(num+1)
   inc a ; next rom
   ld (num+1),a
   cp #20 ; Max Rom
   jr nc,allromsok ; Si rom>=#20 go to
   jr num ; Else test if next rom is connected
allromsok
   ld bc,#7f8e ; Upper and Lower roms off | Mode 2
   out (c),c
   ld bc,#df00 ; Select Rom 0
   out (c),c
   ei
   ret
;
; If a rom is found then...
;
found
   ld a,(num+1) ; a=rom number found
   ld hl,(#b8d3) ; Last rom found Adress
   push hl ; save it
   dec hl
   dec hl
   dec hl
   dec hl ; New adress
   ld (#b8d3),hl ;
   pop de ; de=hl
   ld (hl),e ; poke new rom adress
   inc hl
   ld (hl),d
   inc hl
   ld (hl),a ; and rom number
   inc hl
   ld (hl),0
   ret



I hope it could help some people to understand how it works...
Thank you for reading as Capcom said !
Title: Re: Rom Initialisation
Post by: arnoldemu on 21:18, 15 January 18

Thank you for the code.  :)

If anyone wants to use this code on 464, then you can start at 8 and use &b1a6 instead of &b8d3.

Title: Re: Rom Initialisation
Post by: Ast on 21:36, 15 January 18
So all have been said...  :P
Title: Re: Rom Initialisation
Post by: Duke on 21:41, 15 January 18
Thanks @Ast (http://www.cpcwiki.eu/forum/index.php?action=profile;u=573) , very handy :)
Title: Re: Rom Initialisation
Post by: IanS on 22:08, 15 January 18
How do the extra roms reserve memory?. Does each extra rom get IY setup correctly when the commands are run?
Title: Re: Rom Initialisation
Post by: rpalmer on 22:08, 15 January 18
Ast,

The code you supplied assumes all ROM types require initialization which is incorrect. There are 3 types foreground, background and extension.

According to Soft968 Section 10 which states that foreground ROMs are responsible for initializing background ROMs. Extension ROM types are never initialized since they provide only support routines and jump instruction at &C006 may cause problems if called unexpectedly.

The code should have tested the ROM type (at &C000) and if it is a foreground/background  type then assume the jump instruction is at &C006 to initialize the ROM. This is how the firmware manual describes how the system handles ROM initialization. Soft968 Section 10 also references initializing background ROMs via KL_ROM_WALK and KL_INIT_BACK, but these are for background ROMs with no foreground ROM as I understand it.

rpalmer
Title: Re: Rom Initialisation
Post by: GUNHED on 15:38, 16 January 18
In addition there are three more ROM types:

- FutureOS extension ROMs (ignored by native OS)
- CP/M expansion ROMs (ignored by native OS)
- Background ROMs returning with Carry cleared from initialization, therefore not using RAM, but able to display a sign on message for example.
Title: Re: Rom Initialisation
Post by: Ast on 15:32, 17 January 18
don't panic ! It runs ! That's the most important no ?
Title: Re: Rom Initialisation
Post by: Squeekboxandj on 18:36, 31 December 21
Hey, old thread I know but thanks to Ast for the Rom initialisation code and thanks to Arnoldemu for the tweek. I used this code on my 464 and assembled it to &8000 instead of &a000 and saved as a binary file. Now all 0-31 roms are working.


Happy New Year everybody.
Title: Re: Rom Initialisation
Post by: Ast on 21:12, 19 January 22
Great !
It's cool to read someone is using this piece of code. Thanks to U !
Powered by SMFPacks Menu Editor Mod