CPCWiki forum

General Category => Programming => Topic started by: redbox on 13:57, 30 May 13

Title: 16kb ROM decompression using Exomizer
Post by: redbox on 13:57, 30 May 13
I've got a 16kb background ROM ( ;) ) and I want to decompress it into RAM (using Exomizer) and then run the program from RAM.

What's the best way to do this?

I'm planning on:
- Copy exomizer decompresser into RAM
- Decompress the program data from the paged-in ROM (&C000 upwards)
- then execute program in RAM

So, do I need to page-out the ROM once I've done this?  And how's the best way to do it?
Title: Re: 16kb ROM decompression using Exomizer
Post by: ralferoo on 14:51, 30 May 13
Quote from: redbox on 13:57, 30 May 13
So, do I need to page-out the ROM once I've done this?  And how's the best way to do it?
I used a different decompressor, but the following is code I've used in all my rom decompressors (entry point is do_unpack):


romoff:
        ld bc,#7f8d
        out (c),c               ; mode 1, disable roms
romofflen equ $-romoff

do_unpack:
        di
        ld de,unpack-romofflen
        push de
        ld hl,romoff
        ld bc,romofflen
        ldir
        ld hl,data_start
        jr decompress_hl_to_de
Title: Re: 16kb ROM decompression using Exomizer
Post by: redbox on 11:35, 01 June 13
Well I've got the ROM and am trying to decompress to memory using exomizer.

I copy the exomizer decompressor routine from the ROM into RAM (&a000) because it uses a buffer.  I then try to decompress the data into RAM by reading it from the ROM (it's located at around &c100) but it doesn't work.

Does exomizer not like decompressing from a paged in ROM?
Title: Re: 16kb ROM decompression using Exomizer
Post by: SyX on 12:18, 01 June 13
Exomizer works fine from rom, maybe your problem is when you copy the  exomizer decruncher to ram (only set its work buffer in ram should be enough), the labels using absolute address will jump to a wrong address.

In that case, you need to make the code relocatable or assembly it for the new memory address (using RORG or PHASE/DEPHASE in your assembler).
Title: Re: 16kb ROM decompression using Exomizer
Post by: redbox on 20:50, 01 June 13
Quote from: SyX on 12:18, 01 June 13
Exomizer works fine from rom, maybe your problem is when you copy the  exomizer decruncher to ram (only set its work buffer in ram should be enough), the labels using absolute address will jump to a wrong address.

That'll be it  ;)

Thanks Syx, will try this out.
Powered by SMFPacks Menu Editor Mod