Author Topic: cartridge filesystem  (Read 4795 times)

0 Members and 1 Guest are viewing this topic.

Offline arnoldemu

  • Supporter
  • 6128 Plus
  • *
  • Posts: 5.329
  • Country: gb
    • Unofficial Amstrad WWW Resource
  • Liked: 2220
cartridge filesystem
« on: 16:07, 26 September 13 »
I have attached to this post a proof of concept file created using my "cartridge filesystem" tools.

It's a "direct to cartridge" port of Solomon's Key. (I didn't even bother to set the colours/mode for the title screen. Now I just have it working, I'll add the colours from the solomon's key + hack. Can anyone provide + colours for the title screen?

This is an example that should work on gx4000 etc.

This solution involves a little more work than No$Cash solution, but it opens up the full cartridge space, and works on gx4000.

The data is stored on the cart and copied into RAM. It's easier to do it this way. It's "loaded" from the cart - this is why I call it a filesystem. At the start of the cart data you will see the directory at offset &b.

This represents another way to have games on cart.

In the directory:

First byte is cart page (&80 etc)
next 2 bytes are address to read from (pages cart pages into upper rom area) so address is always from &c000 onwards.
next 2 bytes are the length.

and that is it.

So you can see there are 4 files in there.

1 small "boot" program, copied to &4000 and run from there,
1 screen, 1 main file, and another screen.

The "boot" program sets up the hardware state, loads the first to the screen, next to &100, next to the screen and executes the game.

An improved boot program will fade the title screen in and out (with correct colours), load up the main exe with plus colours.

I will post the tools and sources soon so others can use it to make plus games.

EDIT: Added the Plus colours from the Plus hack.
« Last Edit: 19:58, 26 September 13 by arnoldemu »
My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

Offline Trebmint

  • 464 Plus
  • *****
  • Posts: 438
  • Country: zw
  • Liked: 289
Re: cartridge filesystem
« Reply #1 on: 18:54, 26 September 13 »
Certainly works :) and I'll be using this method for sorcery. Good stuff... plus with an extra 16k bank from the cart we can add some nice extra stuff too

Offline Kris

  • 6128 Plus
  • ******
  • Posts: 524
  • Country: fr
  • Team Impact
  • Liked: 182
Re: cartridge filesystem
« Reply #2 on: 21:36, 26 September 13 »
Works perfectly, that's a great news for Plus users that this tool from noCash is back :)



Edit: I just burn an Eprom with the .CPR tranfer to .BIN file and it doesn't works on real Plus; screen freeze .
« Last Edit: 22:50, 26 September 13 by Kris »

Offline Trebmint

  • 464 Plus
  • *****
  • Posts: 438
  • Country: zw
  • Liked: 289
Re: cartridge filesystem
« Reply #3 on: 00:32, 27 September 13 »
Works perfectly, that's a great news for Plus users that this tool from noCash is back :)



Edit: I just burn an Eprom with the .CPR tranfer to .BIN file and it doesn't works on real Plus; screen freeze .


You mean people can sell an unmodified GX4000 cart of Roland in Time on ebay for £100 haha.... hmmm actually  :P

Offline Devilmarkus

  • Vivid source of indefiniteness
  • 6128 Plus
  • ******
  • Posts: 4.039
  • Country: de
  • WebCPC / JavaCPC developer
    • index.php?action=treasury
    • CPC-Live website
  • Liked: 1007
Re: cartridge filesystem
« Reply #4 on: 01:56, 27 September 13 »
Would be interesting to know, if the CPR works on a real GX4000.
Did anyone try it yet?

(In my lousy Java emulator it doesnt even startup) :D

In rest: Nice work!

Whoops... Edit: Seen that Kris already tested it... Sad...

Does it also show grey border and black screen on the real thing?
When you put your ear on a hot stove, you can smell how stupid you are ...

Amstrad CPC games in your webbrowser

JavaCPC Desktop Full Release

Offline Kris

  • 6128 Plus
  • ******
  • Posts: 524
  • Country: fr
  • Team Impact
  • Liked: 182
Re: cartridge filesystem
« Reply #5 on: 07:33, 27 September 13 »
I will post a picture of the screen on real Plus asap ;)


EDIT: here is the 1st attempt:





« Last Edit: 19:45, 27 September 13 by Kris »

Offline arnoldemu

  • Supporter
  • 6128 Plus
  • *
  • Posts: 5.329
  • Country: gb
    • Unofficial Amstrad WWW Resource
  • Liked: 2220
Re: cartridge filesystem
« Reply #6 on: 10:51, 27 September 13 »
Works perfectly, that's a great news for Plus users that this tool from noCash is back :)



Edit: I just burn an Eprom with the .CPR tranfer to .BIN file and it doesn't works on real Plus; screen freeze .
This tool is not nocash's tool. It's my own.

 :( Sad it doesn't work on real plus. I didn't test it yet.

BIN file is attached.

notice it's not an exact rom size.

I will make sure it works on plus and gx4000.
« Last Edit: 10:53, 27 September 13 by arnoldemu »
My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

Offline gerald

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.287
  • Liked: 918
Re: cartridge filesystem
« Reply #7 on: 11:56, 27 September 13 »
This tool is not nocash's tool. It's my own.

 :( Sad it doesn't work on real plus. I didn't test it yet.

BIN file is attached.

notice it's not an exact rom size.

I will make sure it works on plus and gx4000.

It get stuck at the game title screen waiting for a keypress.
Comparing the behaviour on winape and the real cpc, I notice that no interrupt occurs on the real cpc.
Since the title screen waiting loop (23BA-23D5) rely on data (keyboard line status) updated by interrupt, we get stuck there.

Question is why interrupt does not occur on real HW, and why this is different on emulator

Offline arnoldemu

  • Supporter
  • 6128 Plus
  • *
  • Posts: 5.329
  • Country: gb
    • Unofficial Amstrad WWW Resource
  • Liked: 2220
Re: cartridge filesystem
« Reply #8 on: 11:57, 27 September 13 »
It get stuck at the game title screen waiting for a keypress.
Comparing the behaviour on winape and the real cpc, I notice that no interrupt occurs on the real cpc.
Since the title screen waiting loop (23BA-23D5) rely on data (keyboard line status) updated by interrupt, we get stuck there.

Question is why interrupt does not occur on real HW, and why this is different on emulator
great thanks for the analysis. Will fix that (on emu and in the code).

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

Offline gerald

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.287
  • Liked: 918
Re: cartridge filesystem
« Reply #9 on: 12:06, 27 September 13 »
great thanks for the analysis. Will fix that (on emu and in the code).
Any idea why there is a different behaviour regarding IRQ ?

Offline arnoldemu

  • Supporter
  • 6128 Plus
  • *
  • Posts: 5.329
  • Country: gb
    • Unofficial Amstrad WWW Resource
  • Liked: 2220
Re: cartridge filesystem
« Reply #10 on: 15:25, 27 September 13 »
Any idea why there is a different behaviour regarding IRQ ?
I have worked out what is wrong.

The code does turn on interrupts, but the z80 is in the default interrupt state of IM 0.
The value on the bus supplied by the asic... well it's not going to be ff like it mostly is on CPC, so it jumps to the wrong place and doesn't execute the instructions.
In an emu, chances are the ram is probably filled with zeros, so it just happens to fall through and work.

So I added an "im 1" instruction into the setup code ;)

Will check what happens in my emu because it just happens to work on mine when it shouldn't.

new files attached.

Do these work better?
My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

Offline gerald

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.287
  • Liked: 918
Re: cartridge filesystem
« Reply #11 on: 15:46, 27 September 13 »
I have worked out what is wrong.

The code does turn on interrupts, but the z80 is in the default interrupt state of IM 0.
The value on the bus supplied by the asic... well it's not going to be ff like it mostly is on CPC, so it jumps to the wrong place and doesn't execute the instructions.
In an emu, chances are the ram is probably filled with zeros, so it just happens to fall through and work.

So I added an "im 1" instruction into the setup code ;)

Will check what happens in my emu because it just happens to work on mine when it shouldn't.

new files attached.

Do these work better?
Now that's better  ;) .


Offline arnoldemu

  • Supporter
  • 6128 Plus
  • *
  • Posts: 5.329
  • Country: gb
    • Unofficial Amstrad WWW Resource
  • Liked: 2220
Re: cartridge filesystem
« Reply #12 on: 15:50, 27 September 13 »
So a lesson in cartridge programming  ;)

* When cart is started, cart page 0 is readable in the range &0000-&3fff and &c000-&3fff.
* Interrupts are disabled.
* You can write to the ram under the rom (ideal for transfering data from rom to ram).
* Make sure you set the Z80 interrupt mode to 1 (or 2 if you want that)
* Make sure you setup the PPI and CRTC (otherwise you'll get no keyboard input or screen display).
* Colours will be random, so you need to initialise those.
* Initialise the stack to be within the main 32k ram (&4000-&c000). I put it at &c000 and let it grow down.

EDIT: These are the lessons I learnt and I wanted to share them with you.
« Last Edit: 19:34, 27 September 13 by arnoldemu »
My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

Offline arnoldemu

  • Supporter
  • 6128 Plus
  • *
  • Posts: 5.329
  • Country: gb
    • Unofficial Amstrad WWW Resource
  • Liked: 2220
Re: cartridge filesystem
« Reply #13 on: 19:48, 27 September 13 »

EDIT: here is the 1st attempt:
Nice pic.

I forgot to setup the border colour.  :o
My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

Offline Gryzor

  • Administrator
  • 6128 Plus
  • *****
  • Posts: 14.521
  • Country: gr
  • CPC-Wiki maintainer
    • CPCWiki
  • Liked: 2677
Re: cartridge filesystem
« Reply #14 on: 20:15, 27 September 13 »
Quote from: trebmint
Good stuff... plus with an extra 16k bank from the cart we can add some nice extra stuff too

Like a cracktro :D

Offline gerald

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.287
  • Liked: 918
Re: cartridge filesystem
« Reply #15 on: 21:02, 27 September 13 »
EDIT: here is the 1st attempt:



I did not get the same border color, mine was always orange  :o

Offline Kris

  • 6128 Plus
  • ******
  • Posts: 524
  • Country: fr
  • Team Impact
  • Liked: 182
Re: cartridge filesystem
« Reply #16 on: 21:05, 27 September 13 »
I did not get the same border color, mine was always orange  :o


Do you mean on real CPC+ ?


I'm erasing some eprom at the moment, I wil test the new file in few minutes :)

Offline Kris

  • 6128 Plus
  • ******
  • Posts: 524
  • Country: fr
  • Team Impact
  • Liked: 182
Re: cartridge filesystem
« Reply #17 on: 21:33, 27 September 13 »
Works perfectly on real machine now!  :D


Have a look:










Offline gerald

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.287
  • Liked: 918
Re: cartridge filesystem
« Reply #18 on: 21:35, 27 September 13 »
Do you mean on real CPC+ ?
Yes, with the 1st version arnoldemu provided. The last one has the correct black border.

I'm erasing some eprom at the moment, I wil test the new file in few minutes :)
erasing, what is this ?  ;)

Offline Kris

  • 6128 Plus
  • ******
  • Posts: 524
  • Country: fr
  • Team Impact
  • Liked: 182
Re: cartridge filesystem
« Reply #19 on: 21:41, 27 September 13 »
You know what I mean even if my english is not perfect :)

Offline gerald

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.287
  • Liked: 918
Re: cartridge filesystem
« Reply #20 on: 21:42, 27 September 13 »
I did not get the same border color, mine was always orange  :o
Well, greeninsh orange, I would say  :P
[attachimg=1]

And on a gx4000
[attachimg=2]
« Last Edit: 21:54, 27 September 13 by gerald »

Offline gerald

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.287
  • Liked: 918
Re: cartridge filesystem
« Reply #21 on: 21:47, 27 September 13 »
You know what I mean even if my english is not perfect :)
Your english is quite good, at least as good as mine  :)
Well, in more than 20 years playing with HW, I never erased an eprom.


Offline Kris

  • 6128 Plus
  • ******
  • Posts: 524
  • Country: fr
  • Team Impact
  • Liked: 182
Re: cartridge filesystem
« Reply #22 on: 22:02, 27 September 13 »
It is the wording used in my software to manage Eproms, so I use it :)  but if a UK native guy can help us to improve our English it could be great :)


Anyway, back to the orignal subject: strange behaviour between both machine....are you using the final .bin file ?
« Last Edit: 22:18, 27 September 13 by Kris »

Offline gerald

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.287
  • Liked: 918
Re: cartridge filesystem
« Reply #23 on: 22:17, 27 September 13 »
It is the wording used in my software to manage Eproms, so I use it :)
And it's the right word.
I am currently using this :
[attachimg=1]

Offline Kris

  • 6128 Plus
  • ******
  • Posts: 524
  • Country: fr
  • Team Impact
  • Liked: 182
Re: cartridge filesystem
« Reply #24 on: 22:19, 27 September 13 »
OK, now I understand why we have 2 differents results  :-\


HW emulator ?