CPCWiki forum

General Category => CPCWiki Discussion => Topic started by: arnoldemu on 17:53, 12 October 12

Title: foreground roms
Post by: arnoldemu on 17:53, 12 October 12
the firmware guide mentions foreground roms, so that instead of basic taking control, another could take control.
Are there any examples of foreground roms?

I think most are background roms.

Title: Re: foreground roms
Post by: TFM on 19:18, 12 October 12
- Brunword MK4/6?

- There was IMHO a kind of ROM managing software for a particular ROM box!?!??

- If FutureOS ROM A is located at ROM select 0, it does autstart. But that's not a foreground ROM in that sense, because it kicks out the firmware stuff.
Title: Re: foreground roms
Post by: AMSDOS on 12:43, 13 October 12
I remember reading about the ROM version of DES starting up on Bootup - even mentions it here on the page about it:


Desktop Environment System - CPCWiki (http://cpcwiki.eu/index.php/DES)
Title: Re: foreground roms
Post by: Johnny Olsen on 14:14, 13 October 12
Quote from: TFM/FS on 19:18, 12 October 12

- There was IMHO a kind of ROM managing software for a particular ROM box!?!??



Yes the Super Romplus board (A.A.R.C.S. Rom)

Britannia ROM Board - CPCWiki (http://cpcwiki.eu/index.php/Britannia_ROM_Board)

Look like the rom is missing.

I have found these 2 version in my collection.







Title: Re: foreground roms
Post by: TFM on 20:33, 13 October 12
Exactly  :)

IIRC, DES was in two background ROMs taking over control, the may be true for ARCS too.
Title: Re: foreground roms
Post by: AMSDOS on 21:10, 13 October 12
Quote from: TFM/FS on 20:33, 13 October 12
Exactly  :)

IIRC, DES was in two background ROMs taking over control, the may be true for ARCS too.


That's right.


Looking at the firmware guide though, it looks like it's possible to have a foreground ROM take over I guess through some specific firmware instructions. I guess if you were trying to determine what's a Foreground ROM and what's a Background ROM, you can use KL PROBE ROM (&B915) which returns what type of ROM it is in 'A'. I can be even used to determine if it's a Foreground ROM or an "extension Foreground ROM". :)  It just needs the ROM Select Address on Entry. :(
Title: Re: foreground roms
Post by: TFM on 05:07, 14 October 12
That's right. Or you just read the first byte at &C000, which tells you the kind of the ROM.
If you use a real foreground ROM then you have no BASIC, but the Firmware is left. So in this case the ROM need to provide a real UI. I remember there was a programming language doing this. (Was it a Cobol or Forth?).
Title: Re: foreground roms
Post by: AMSDOS on 07:57, 14 October 12
Quote from: TFM/FS on 05:07, 14 October 12
(Was it a Cobol or Forth?).


Sounds like Forth.
Title: Re: foreground roms
Post by: Gryzor on 10:15, 14 October 12
Quote from: Johnny OlsenQuote from: TFM/FS on 12 October 2012, 21:18:15
- There was IMHO a kind of ROM managing software for a particular ROM box!?!??



Yes the Super Romplus board (A.A.R.C.S. Rom)

Britannia ROM Board - CPCWiki

Look like the rom is missing.

I have found these 2 version in my collection.






Cheers mate, I'll upload them to the wiki...

[EDIT] Done, credit given :)
Title: Re: foreground roms
Post by: arnoldemu on 14:15, 17 October 12
Thankyou everyone for the suggestions, when I have time I will look at them.

here is a minimal background rom:


org &c000

start:
defb 1            ;; background
defb 'K'            ;; mark
defb 'E'            ;; version
defb 'V'            ;; modification
defw command_name_table
jp init
jp prog1
jp prog2
command_name_table:
defb "INI","T"+&80
defb "BACK","1"+&80
defb "BACK","2"+&80
defb 0

;; allocating high brings down himem
;; allocating low makes basic programs start later

init:
;; indicate success
;; allocate some low data
ex de,hl
ld bc,1024
add hl,bc
ex de,hl
;; allocate some high area
ld bc,1024
or a
sbc hl,bc
scf
ret


;; indicate failure

or a
ret


prog1:
ret

prog2:
ret

;;BC = Address of the highest usable byte in memory. (#B0FF)
;;DE = Address of the lowest byte in the memory pool. (#0040)
;;HL = Address of the highest byte in the memory pool. (#ABFF)

org &ffff
defb &ff

end start


this background rom allocates space both low and high in memory. it has an initialisation routine and two empty | commands.

allocating high changes HIMEM.
allocating low changes where in memory the basic program is stored. In this example it's around &540 and not &170.

Anybody know if there is a variable to read where basic is stored? I can see a value can be peeked in memory to find it (ae66 under basic 1.1).

And now a minimal foreground rom:


org &c000

start:
defb 0            ;; foreground
defb 'K'            ;; mark
defb 'E'            ;; version
defb 'V'            ;; modification
defw command_name_table
jp prog1
jp prog2
command_name_table:
defb "FORE","1"+&80
defb "FORE","2"+&80
defb 0

prog1:
call &bb06
ret

prog2:
call &bb06
ret

org &ffff
defb &ff

end start

if rom 0 is replaced, this rom is executed first. basic is not executed. it doesn't matter if you press space, it resets back to this rom. basic is never called. don't know how fore2 is executed. I think only fore1 is.

if rom 0 is not replaced, basic is executed and this rom can be executed from basic with "|FORE1". I didn't check to see if the foreground rom then has all the memory available to it. I guess it has (e.g. &0040-&b0ff). Will need to check.

|FORE2 can also be executed from basic.

When the functions are called, and after a key is pressed the program resets and basic restarts again.

The reason I ask?

Putting a game into rom, and also about auto starting a cpc.
Title: Re: foreground roms
Post by: Axelay on 11:18, 18 October 12
Quote from: arnoldemu on 14:15, 17 October 12
Putting a game into rom, and also about auto starting a cpc.


As a foreground rom?  Something with it's 'own' hardware, or something that is loaded into a megaflash or similar?
Title: Re: foreground roms
Post by: Bryce on 11:57, 18 October 12
More likely for putting on a cartridge I'd say?

Bryce.
Title: Re: foreground roms
Post by: arnoldemu on 13:06, 18 October 12
Quote from: Bryce on 11:57, 18 October 12
More likely for putting on a cartridge I'd say?

Bryce.
I am exploring the idea of rom based games for cpc. Where the code runs from rom, and also using the rom like a mini filesystem to load data from. A bit different to existing ones which are normally 1 rom, have a single file compressed and are decompressed and run from ram.

So using up to 4 roms (1 background or foreground, and the 3 extension roms). These type of rom games can be installed into a megaflash or similar for example.

I have a filesystem that can work with both roms and carts I believe. Similar to the dsk2cart, but without storing the whole dsk structure and without having to simulate amsdos etc. This method would work on it's own. Probably the first approach I will use for my first cart program and an approach I believe a lot of c64 based cart games use?

I was also interested to explore background roms that allocate memory low (how that impacts basic etc), and how foreground roms work.

So I will look at the potential of a foreground rom containing a game.

Just seeing what's possible.

Title: Re: foreground roms
Post by: Bryce on 13:35, 18 October 12
If you use the MegaFlash or any other 32 slot ROMBoard, then in normal circumstances ROMs 16 to 31 are invisible to the CPC, so you don't need to follow the CPC structure of headers and Foreground/Background bits etc. The game could have a "launch ROM" somewhere between 1 and 6 (to make it 464 compatible too) and the rest of the data can be stored above 15 in whatever format you prefer, including screens, music or whatever, ready to be accessed by the launch ROM.

If you standardise certain ROMs for music, graphics or whatever it might make it possible to have standard game engines?

Bryce.
Title: Re: foreground roms
Post by: Axelay on 15:05, 18 October 12
Quote from: arnoldemu on 13:06, 18 October 12
I am exploring the idea of rom based games for cpc. Where the code runs from rom, and also using the rom like a mini filesystem to load data from. A bit different to existing ones which are normally 1 rom, have a single file compressed and are decompressed and run from ram.

So using up to 4 roms (1 background or foreground, and the 3 extension roms). These type of rom games can be installed into a megaflash or similar for example.

I have a filesystem that can work with both roms and carts I believe. Similar to the dsk2cart, but without storing the whole dsk structure and without having to simulate amsdos etc. This method would work on it's own. Probably the first approach I will use for my first cart program and an approach I believe a lot of c64 based cart games use?

I was also interested to explore background roms that allocate memory low (how that impacts basic etc), and how foreground roms work.

So I will look at the potential of a foreground rom containing a game.

Just seeing what's possible.


I've been thinking about games in rom as well, though I've not got very far with the test I am trying to do yet.


I was thinking along the lines of using compression as much as possible, as I think the 'extension' roms 16-31 would be eaten up quickly enough if you didnt.  Though I guess having uncompressed code etc used directly from rom would enable you to do a game that is compatible with 64k but could be 'expanded' to something more like a 128k game.

Title: Re: foreground roms
Post by: TFM on 15:41, 18 October 12
Quote from: Bryce on 13:35, 18 October 12
If you standardise certain ROMs for music, graphics or whatever it might make it possible to have standard game engines?

That's a good idea! I did that alredy - yes, it's FutureOS. But people will always ask things like "Why can't you make an amsdos version'. Or 'Why does it need extra ROMs'. So sadly the tolerance in our cpc society is not very high.
Title: Re: foreground roms
Post by: IanS on 21:18, 18 October 12
Quote from: arnoldemu on 17:53, 12 October 12
Are there any examples of foreground roms?
I've just posted about the John Morrison demon cartridge which was implemented as a foreground rom. Its in the hardware category.
Powered by SMFPacks Menu Editor Mod