News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu

Can you crack the code?

Started by gilesforrest, 10:20, 02 April 17

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

gilesforrest

Hi,


In my youth I created some artwork on my Amstrad CPC 6128 using OCP Art Studio.


Some time ago I found the discs and had them transferred to PC for my archives.


Some of the artwork I could view by running OCP Art Studio on an emulator, but a few files (which I'm sure I remember being artwork also) I've changed for some reason (maybe some sort of encryption, compression, etc?!). They now do not have any extension and there is no supporting .PAL palette file (unless this is actualy some sort of archive file and it is contained within).


Maybe you can crack the code and convert these back to Art Studio format?


I've attached a ZIP containing one of the pieces I can read (WIFF.SCR and WIFF.PAL) and one "encrypted" file (MJ-BAD)


Good luck!


Giles

tastefulmrship

I'm not sure what the palette is... but there is a 06 (BRIGHT RED?) and 0F (ORANGE?) at the end of the code.
Anyway, the image itself is 34x22 characters (hence it's 12k and not 16k).


Attached is a 16k .scr file with the image as is. The 4th INK is the border around the image. I can do a 34x22 version if you wish.


gilesforrest

Oh genius! What had I done to the original file?


Thanks!


Giles

KaosOverride

If the image is smaller than the screen, then it can be a "window" bitmap. A nice way to save an "objet" and use it at some different images.
KaosOverride · GitHub
MEGA Amstrad Public Amstrad folder

gilesforrest

So how did you extract the image from the file?


Cheers

gilesforrest

From what I understand from the above, the images are not the full screen (.SCR) but are smaller "windows".


I noticed in OCP Art Studio there is a Windows section to load and save these types of file, so I changed the extension to .WIN to see if I could load it ..but no..."Wrong Filetype"..hmm


So I'd love to know what you did?!


Cheers,


Giles

tastefulmrship

Quote from: gilesforrest on 15:27, 02 April 17
So how did you extract the image from the file?
There was no sorcery involved, I just loaded the file in WinAPE to the screen address (&C000) and noticed it wasn't exactly the full-size.
I exported it into GiMP and made it the right size, then just imported back into the CPC environment... hence the two files.

Have you worked out, or remembered, what the palette was supposed to be?

gilesforrest

Hi,


Maybe I'm doing something wrong but if I try:


LOAD "MJ-BAD",&C000


I get a "Syntax error"...am I doing something wrong?


I notice the file in Winape appears as "Unknown ASCII/Binary" - do I have to do anything when I drag it into the disk?


I may have the palette file I'm looking now....


Cheers

tastefulmrship

#8
Yeah, it doesn't matter if you import the file with or without the "Insert AMSDOS header" checked... it always comes out as "Unknown".
Also, using the "LOAD" command in BASIC won't help (neither will using the INPUT#9 command to load ASCII files)

I used this little bit of code to load the file into memory (after renaming the file to MJ-BAD.BIN);

        org    &4000

        ld    hl,Filename
        ld    de,&c000
        ld    b,12
        call    &bc77
        ret    nc
        ld    hl,&c000
        call    &bc83
        call    &bc7a
        ret

.Filename    defm    "MJ-BAD  .BIN"


Once loaded into WinAPE you can plainly see the exact size of the image when viewed in the "Find graphics" viewer in the debugger.

EDIT: I do have a BASIC-friendly version of the file, so maybe that will load into the art package with a .win extension?!?!?! Forget that!

gilesforrest

#9
Ok...so you used a bit of machine code? That is sorcery to me!


I must find out how to do that as I only ever did Basic programming....would be cool to do a bit of machine code (albeit 20 years later!)


Any tutorials or tips you can point me to?

tastefulmrship

Quote from: gilesforrest on 18:41, 02 April 17
Ok...so you used a bit of machine code? That is sorcery to me!

I must find out how to do that as I only ever did Basic programming....would be cool to do a bit of machine code (albeit 20 years later!)

Any tutorials or tips you can point me to?

The Amstrad's Locomotive BASIC is really good and really powerful, but you cannot beat machine code!

A great place to start learning Amstrad m/c is Kevin Thacker's Unofficial Amstrad WWW Resource and, of course, pretty much any online Z80 tutorial course will help no end!
Just experiment and see how you do.

gilesforrest

#11
Great thanks...so WinApe also enables machine code as well as Basic? I have a lot to learn...


Ahh.. that's the "Assembler" menu I presume...

tastefulmrship

Quote from: gilesforrest on 18:54, 02 April 17
Great thanks...so WinApe also enables machine code as well as Basic? I have a lot to learn...
In WinAPE, press F3 to open the Assembler window.

gilesforrest

Ok,so I'm getting somewhere...but think I'm missing something:


I've tried to understand what your code is doing and have entered into the WinApe Assembler. My notes below:



        org    &4000 <-- this sets the starting point for this code


        ld    hl,Filename  <-- this sets the filename address (defined below)
        ld    de,&c000   <-- this specifies the starting address to load the filename into (&C000)
        ld    b,12  <-- this specifies the length of the filename (12 characters)
        call &bc77  <-- this opens the file header
        ret    nc  <-- this returns/ends the code on the condition the carry flag has been reset ...not sure what this means...needs more research!
        ld    hl,&c000  <-- this specifies the starting address to load the file contents into (&C000) - could you use "de" instead as it has already been set above?
        call    &bc83  <-- this loads the file
        call    &bc7a   <-- this closes the file
        ret  <-- this ends the code
.Filename    defm    "MJ-BAD  .BIN"  <-- this defines the variables "Filename" as the 12 character filename "MJ-BAD  .BIN" (I wondered why you needed the spaces until I followed this through!)


So I then Assemble with no errors.


And then here I assume we need to run the program somehow from Basic. So given the starting address is &4000 I try a "CALL &4000"... to which I get a "Ready"...


I was expecting the screen to change (as per your screenshot) rather than just give me a "Ready" prompt. It certainly seems to be running the program because if I change the filename it gives a file not found response.


Any tips?


Thanks,


Giles


gilesforrest

So @SuTeKH/Epyteor wins the prize for "cracking the code"..and enabling me to view my artwork again.


I do have just one file (attached) that appears to be corrupt...but maybe it isn't and needs a different technique?

Powered by SMFPacks Menu Editor Mod