News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu

Any interest in a CPC reverse engineering tool?

Started by crabfists, 20:38, 24 March 23

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

zhulien

Quote from: dragon on 12:32, 17 June 23Laser squad sound good candidate to test It :).
Laser squad is really a cool game - did you know there is GBA version of Rebelstar?

crabfists

I added more event types to the Event Viewer. Can now see when palette changes happen. Here you can see the colour cycling happening on the Ghouls 'n' Ghosts text:

I think I have enough event types now. I need to concentrate on stability and testing before the first alpha release. I also need to hook up the "Export ASM" feature as it's currently disabled.

No description available. 

crabfists

Hi, I uploaded the first version of the CPC Analyser tool. It's still missing some features from the Spectrum version but it's completely usable. I've been reverse engineering Laser Squad with it for the past few weeks.

It currently only supports 64k games. It also only supports .sna files. I will add support for tap/dsk files at some point. For now, you need to load up an emulator such as WinApe and save a 64k snapshot. Or find an existing snapshot.
 
Download is here:
https://colourclash.co.uk/cpc-analyser/

Please let me know if it works or if you have any feedback. Also, if you need help using it let me know. I will try to do a video tutorial if I can. Cheers! 

It's still a WIP so expect some bugs. Bear in mind, the tool doesn't deal with ROM and RAM sharing the same address space so this can lead to some glitchy behaviour.

SpDizzy

Thanks so much for adapting the framework, creating and sharing this amazing tool.
Just downloaded and awaiting for testing. 
If I'm not wrong, I guess Spectrum Analyser instructions will be a good starting point, nevertheless an entry video tutorial would be really helpful, if you have some time.
Thanks again for this awesome toy.

crabfists

#29
Quote from: SpDizzy on 23:20, 23 July 23If I'm not wrong, I guess Spectrum Analyser instructions will be a good starting point, nevertheless an entry video tutorial would be really helpful, if you have some time.

Yes, the Spectrum Analyser instructions are better than nothing. Ignore the Spectrum View, Graphics Viewer and Frame Trace sections though. There is also a video walkthrough of Spectrum Analyser on the Spectrum Analyser homepage but it's probably not worth watching because it mostly demonstrates features that are not present in the CPC version yet.

Any questions feel free to post them here or via dm. :)

I would appreciate confirmation that the build actually works. Thanks :D

SpDizzy



Been testing some snapshots and besides there are some features I don't fully understand well yet, the tool does a god job.
The build actually works ok for me despite some problem with emulation window, maybe because only tested on Windows 7 by the way (I know it requires Win10 at least).
Emulation experiments rendering issues on respect to split screens in conjunction with double buffer, Maybe only with split screens?
Will test as soon as I can on Win 10 and report detailled info. At work now, sorry.


SpDizzy

#31
Quote from: SpDizzy on 18:43, 24 July 23Been testing some snapshots and besides there are some features I don't fully understand well yet, the tool does a god job.
The build actually works ok for me despite some problem with emulation window, maybe because only tested on Windows 7 by the way (I know it requires Win10 at least).
Emulation experiments rendering issues on respect to split screens in conjunction with double buffer, Maybe only with split screens?
Will test as soon as I can on Win 10 and report detailled info. At work now, sorry.


Edit: Maybe a problem of my Windows 7 system, but split screens don't work fine, hanging the CPC View.
Have tried some split code examples of my own and some of them work , and some others not.
Jarlac Game from RetroBytes Productions also didn't work for me.
It hangs on intro screen. A snapshot taken during gameplay also hangs CPC View, being the screen corrupted and the split misaligned.
Would you mind to try it on your system?

On the other hand, tested a lot of games and all of them working fawbosly, Laser Squad included.

crabfists

#32
It doesn't surprise me that Jarlac game doesn't work tbh. Some games and demos that really push the hardware do not work. CPC Analyser uses the CHIPS emulator framework. If it doesn't work on that emulator, it won't work on CPC Analyser. Feel free to report a bug on the CHIPS github page (linked above).  ;)

There is an online version of the emulator here if you want to test it.

https://floooh.github.io/tiny8bit/cpc.html?type=cpc464

Are you sure the game isn't a 6128 game? I had 6128 support partially working but the bank switching was adding too much complexity so I decided to tackle it further down the line.

Thanks for testing anyway!  :)

SpDizzy

Thanks for response @crabfists!!
Will try them on CHIPS emulator, but I think that's the problem.

Quote from: crabfists on 10:55, 25 July 23Are you sure the game isn't a 6128 game? I had 6128 support partially working but the bank switching was adding too much complexity so I decided to tackle it further down the line.

On response to that, both Jarlac and my own testing code are for 64k machine, so that's not the reason.

crabfists

I did a little video of me using CPC Analyser. It's not really a walkthrough as such but might give people an idea of what can be achieved with the tool. I still hope to do a more thorough tutorial/walkthrough but that will take time. This video is just a 10 minute demo of me finding a cheat in Manic Miner and also figuring out where the action points and credits are stored in Laser Squad.

The Find feature hasn't been added to the public build yet. It should be in the next build I upload.


genesis8

Quote from: crabfists on 10:55, 25 July 23It doesn't surprise me that Jarlac game doesn't work tbh. Some games and demos that really push the hardware do not work. CPC Analyser uses the CHIPS emulator framework. If it doesn't work on that emulator, it won't work on CPC Analyser. Feel free to report a bug on the CHIPS github page (linked above).  ;)

There is an online version of the emulator here if you want to test it.

https://floooh.github.io/tiny8bit/cpc.html?type=cpc464

Are you sure the game isn't a 6128 game? I had 6128 support partially working but the bank switching was adding too much complexity so I decided to tackle it further down the line.

Hi,

can the user of a CPC tiny8bit emulator load a .DSK or .SNA, or loaded by the web site automatically ?
____________
Amstrad news site at Genesis8 Amstrad Page

crabfists

Quote from: genesis8 on 13:05, 02 August 23can the user of a CPC tiny8bit emulator load a .DSK or .SNA, or loaded by the web site automatically ?
I think you can drag a file into the emulator page? I never quite figured out how to use the web interface very well.

SpDizzy

Thanks so much for making and sharing video tutorial, it really helps.
Also, really interesting 'Find' feature, so looking forward for next release.

crabfists

Progress has been continuing (slowly). I'm starting to implement graphics in the tool. I'm starting with the ability to format memory as a Bitmap. I've currently got support for Mode0 and Mode 1 graphics.

Here are some screenshots of my progress. Btw, anybody know why images on the forum disappear after a certain amount of time?

No description available.

No description available.
Hopefully, next I'll add the Graphics Viewer so you can view memory as graphical data.

crabfists

For anyone building their own exe of CPC Analyser, I can let you know the CPC Analyser branch was merged into master. From now on please consider the cpc branch inactive.

We now have continuous integration enabled on CPC Analyser, so it should be possible to see at a glance if the Window, Mac or Linux code builds successfully.

I will try to do another public release soon, once I have finished the graphics view.

If anyone wants a build before then please let me know. 

SerErris

@crabfists this looks great already. Do you plan to integrate an option to load other ROMs? 

I would need to check ROM code and cannot put in more ROMs (e.g. AMSDOS or MAXAM or something). So an option to load upper ROMs would be great.
Proud owner of 2 Schneider CPC 464, 1 Schneider CPC 6128, GT65 and lots of books
Still learning all the details on how things work.

SerErris

#41
Ah I see, you have already forseen code for AMSDOS and stuff in the CPCEmu.cpp.

But you only distinguish between to ROMS BASIC and AMSDOS.

                     // enable high rom
                     SetROMBankHi(CpcEmuState.ga.rom_select == 7 ? ROM_AMSDOS : ROM_BASIC);

So this would need some more logic around it but not a lot.

If you would just name the ROMs different (e.g. LOW_00, HIGH_00, HIGH_xx), then you can just switch the ROM based on the rom number. And you can also do the same thing that the real CPC does. If there i no ROM in place and you select it, you will just page in the BASIC ROM.

The real amstrad does exactly this. If a rom does not exist, you will have Basic ROM enabled.  In the beginning you could just define HIGH_00 to HIGH_15 and for each rom where user has not defined anything you will put in BASIC ROM. I think the total amount of memory required for that is not a challenge nowadays :-)

Why not just let the user assign ROMs in the json file with numbers (and prepopulate them with 0 Basic 7 AMSDOS and let the user define other roms via a file?

Also putting the ROM into a structure looks strange to me, why not just load them from files?

I will start playing around with the ROM implementation and see if I can add roms that way. Even if I do not like to put in the ROM in the struct, but better than nothing.

But is pretty much painful for others to collect some rom and put it into the Analyzer.
Proud owner of 2 Schneider CPC 464, 1 Schneider CPC 6128, GT65 and lots of books
Still learning all the details on how things work.

crabfists

@SerErris Hi! Thanks for the feedback.

You are right, the ROMs are loaded by putting them in structs. CPC analyser is built using the CHIPS emulator framework. This is because the CHIPS emulator code is designed around the philosophy of "emulator in a header file", so loading the files from disk goes against that.

Having the ability in CPC Analyser to load external ROMs is not something I had thought about. I will have a think to see if it is something that can be easily added but it won't be on the top of the list for a while as there is so much else to do. Feel free to add a feature request on the github page. :)

crabfists

I made a quick update video on the latest progress of CPC Analyser. I demonstrate the new graphics features, such as graphics finding, character maps and more!


https://www.youtube.com/watch?v=UBOHE2tCNMw

SerErris

So it looks like you can do a 6128, which already has Upper 00 and Upper 07. So the technology is there, If I would provide a header file for a rom (which i simple to do), should it not be possible to just "include" it and then run it as let say rom 05?.
Proud owner of 2 Schneider CPC 464, 1 Schneider CPC 6128, GT65 and lots of books
Still learning all the details on how things work.

crabfists

Quote from: SerErris on 13:09, 16 November 23So it looks like you can do a 6128, which already has Upper 00 and Upper 07. So the technology is there, If I would provide a header file for a rom (which i simple to do), should it not be possible to just "include" it and then run it as let say rom 05?.
For now, you could modify Source\CPC\cpc-roms.h to provide dumps of your own roms. I can talk to the main developer and see if we can come up with a nicer way to do it. We could probably allow you to specify a rom file in the globalconfig.json file. We could then load that file in and use it instead of the binary data in cpc-roms.h.

If you look at where the roms are initialised in FCPCEmu::Init() you should be able to figure it out hopefully. Search for "// roms" and you'll see where the rom memory pointers are passed to the CHIPS emulator.

SerErris

Proud owner of 2 Schneider CPC 464, 1 Schneider CPC 6128, GT65 and lots of books
Still learning all the details on how things work.

crabfists

#47
I created a Discord server for the 8 Bit Analyser tools (which CPC Analyser is a part of). Pop in and say hi! Feel free to come and ask questions. The main developer is in there too.

https://discord.gg/VQ3m6W4ZRu

Typhon

Oh, I must download and try this on Linux (Ubuntu 22). I shall report back any compilation warnings or errors on gitgub.

Props for using Dear ImGUI btw, its a lovely GUI Framework. I personally like it because its much more ModernC++y than many of the alternatives, which are still stuck in C-land*

(*nothing wrong with C-land, its just I prefer C++20).

crabfists

I did another build of CPC Analyser. Features added since last time (from memory):

- Graphics view partially working (mode 1 only)
- Savestate support
- Character map support
- Can format memory as mode 0 & 1 bitmap
- Palette support
- External ROM support
- RAM behind ROM support

Quite a lot of new stuff to play with. :)

External roms need to be in a folder called Roms in binary format. Roms need to be <=16k.
There are 15 rom slots. The rom file can be specified in the globalconfig.json file. 

Download as usual from here:
https://colourclash.co.uk/cpc-analyser/

Let me know any feedback. Feel free to come and chat with us on Discord. There are a few of us in there now. Warning: there will be ZX Spectrum users on the same server.  :laugh:

https://discord.gg/VQ3m6W4ZRu

Powered by SMFPacks Menu Editor Mod