CPCWiki forum

General Category => Games => Topic started by: EgoTrip on 15:29, 21 September 11

Title: Chuckie Egg
Post by: EgoTrip on 15:29, 21 September 11
I am trying to do a hack of this, I have edited the graphics (that was the easy part). What I need help with is the following:


1: How do I change the colours of the items? I want to change the colours of the various items, ie eggs = yellow, ground = brown, ladders, grain, ducks and harry I have not decided on the colours yet but I may want to change them.


2: Level layout. What is the level format of each level? Start address of each one, enemy start locations etc.


3: There was something else, but I'll post that when I remember what it was.
Title: Re: Chuckie Egg
Post by: tastefulmrship on 15:57, 21 September 11
1. The INK data starts at &8D1D.

INK 0,0 - Background
INK 1,9 - Floor
INK 2,8 - Ladder/Scoreboard
INK 3,26 - Eggs/Score
INK 4,20 - Swans
INK 5,6 - Seed/Score
INK 6,20 - Swans (ladder XOR)
INK 7,20 - Swans (egg XOR)
INK 8,25 - Harry/Duck
INK 9-15,25 - Harry/Duck(various XORs)
Title: Re: Chuckie Egg
Post by: EgoTrip on 16:29, 21 September 11
Awesome, thanks for that!
Title: Re: Chuckie Egg
Post by: tastefulmrship on 18:11, 21 September 11
Can someone verify this for me, but I think this is how the levels are created?
(this is only for level 1, as the rest is a little weird from there!)

LEVEL 1 starts at &87B2 (indexed from address &8E80)

&87B2 - &0D - Number of floors
&87B3 - &04 - Number of ladders
&87B4 - &00 - Number of lifts(?)
&87B5 - &0A - Number of Eggs
&87B6 - &02 - Number of Swans

Ladder DATA then starts...
&87B7 - &00 &00 &13 - Y location, X location, length
&87BA - &04 &01 &12
etc... etc... etc... etc...
Title: Re: Chuckie Egg
Post by: EgoTrip on 19:29, 21 September 11
Thanks, how did you find out the info?
Title: Re: Chuckie Egg
Post by: tastefulmrship on 19:39, 21 September 11
The code loads at &8000, executes at &9A97 and so you just follow the trail from there.
Title: Re: Chuckie Egg
Post by: redbox on 19:52, 21 September 11
Quote from: tastefulmrship on 18:11, 21 September 11
(this is only for level 1, as the rest is a little weird from there!)

Without looking at the code, I thought maybe it self-modifies for each level...?

It might not be 'Level 1' you've found, but the buffer for all levels, and it's filled with Level 1 variables to start.

Then you'd only need to store the changes between the levels - would make sense as all Chuckie Egg levels are pretty similar.
Title: Re: Chuckie Egg
Post by: tastefulmrship on 20:02, 21 September 11
Quote from: redbox on 19:52, 21 September 11
Without looking at the code, I thought maybe it self-modifies for each level...?

It might not be 'Level 1' you've found, but the buffer for all levels, and it's filled with Level 1 variables to start.

Then you'd only need to store the changes between the levels - would make sense as all Chuckie Egg levels are pretty similar.
I've just completed Level 1 and currently on level 2 and the data seems to be the same at &87B2. I was under the impression that the game moved the data to &7B00 (well, &7B03 to be precise) and uses that as a 'temporary' storage. But I'm probably wrong.
Title: Re: Chuckie Egg
Post by: redbox on 20:17, 21 September 11
Quote from: tastefulmrship on 20:02, 21 September 11
I've just completed Level 1 and currently on level 2 and the data seems to be the same at &87B2. I was under the impression that the game moved the data to &7B00 (well, &7B03 to be precise) and uses that as a 'temporary' storage. But I'm probably wrong.


Ah, that's interesting and you've tempted me to take a closer look...


I see the main binary is only 9k in length(!).  Would be worth disassembling so a source code could be produced - would be a great one to do so anyone interesting in programming could see how a simple platform game is written[nb]We could then also write Super Chuckie Egg with it;)[/nb].


I'll start marking out the data and text areas for the disassembly.
Title: Re: Chuckie Egg
Post by: EgoTrip on 20:23, 21 September 11
I'd love to see a commented disassembly of it, let me know when you crack the level format. Thanks.
Title: Re: Chuckie Egg
Post by: tastefulmrship on 20:24, 21 September 11
Quote from: redbox on 20:17, 21 September 11
We could then also write Super Chuckie Egg with it;)
I think a Super Chuckie Egg would be a great idea... and a level designed by EVERYONE here on the forums, perhaps?
The ultimate community project!
Title: Re: Chuckie Egg
Post by: redbox on 20:55, 21 September 11
Well some interesting finds already... but basics first, so everyone knows how to do things (sorry if it's sucking eggs for anyone, but we can all learn from this!!).


First thing you need to do is load the game binary into memory: from BASIC type MEMORY &7FFF:LOAD"CHUCK.BIN",&8000

The execution address is &9A97, so if at this point you CALL &9A97 the game will start.


If you look at memory location at &9A97 (press pause button in WinApe, right click, goto, enter address 9A97), you'll see 6 calls to different routines in assembler - you can then try by CALLing them from BASIC (like above to start the game).  They are:


     - &9C60 (sets screen mode and colours)
     - &9D22 (print high score table, redefine keys, start game)
     - &9CB5 (define number of players)
     - &BB4E (firmware: TXT INITIALISE)
     - &BB6C (firmware: TXT CLEAR WINDOW)
     - &95D4 (start game - doesn't work from BASIC)


For explanations of what the firmware routines do, see the online version of the Amstrad CPC Firmware Manual (http://www.cantrell.org.uk/david/tech/cpc/cpc-firmware/).


I also see that the sprites are stored from &8000 to maybe approx &8800.  Interestingly, they're not stored as standard MODE 0 sprites (the MODE the game is in) but as 1 bit per pixel sprites, which basically means they are in mono.  If you want to see them with the WinApe 'Find Graphics' tool you'll need to: press the pause button, then press the blue & yellow man icon, select Mode 2 and address 8000.


Will now carry on delving...
Title: Re: Chuckie Egg
Post by: redbox on 19:26, 22 September 11

The game copies some data into RAM lower than the code (i.e. under &8000), so from now on when loading the main binary you'll want to do this: MEMORY &78FF:LOAD"CHUCK.BIN",&8000.  This will make sure you don't overwrite any copied data whilst in BASIC.


Here is the commented disassemble of the first initialisation routine at &9C60:






org &9c60


high_score_table equ &7900


ld hl,l9c9c ; ??
ld de,&7b57
ld bc,&0005
ldir


ld a,&c9 ; patch firmware routine KM TEST BREAK with...
ld (&bdee),a ; ...a RET (&C9) command which disables it


ld a,&00 ; select MODE 0
ld (&7ba7),a ; ?? store this at &7BA7
call &bc0e ; firmware SCR SET MODE


ld b,&00 ; select first BORDER colour
ld c,&00 ; select second BORDER colour
call &bc38 ; firmware SCR SET BORDER


call &8bf8 ; set INKs sub-routine (via a jumpblock)


ld de,high_score_table ; start of high score table
ld b,&0a ; number of high score entries - 10 (&0A)
fill_high_score: push bc ; store loop counter
ld hl,high_score_default ; default high score table entry
ld bc,&0010 ; which is 16 (&10) bytes in length
ldir ; copy high score entry
pop bc ; restore loop counter
djnz fill_high_score ; do next one until high score table is full


; ?? not sure what this sound routine sets up
ld a,&01 ; select envelope 1
ld hl,&9cb1 ; set start of a data block
call &bcbc ; firmware SOUND AMPL ENVELOPE


ret


l9c9c: defb &1f,&27,&47,&45,&2f


high_score_default: defb &00,&00,&00,&00,&01,&00,&00,&00 ; score
defb "A'n'F   " ; name



Anyone know what the data at l9c9c is?  Or what the sound data is at &9cb1?  I've stopped both routines from running and can't see any impact on the game...?

Title: Re: Chuckie Egg
Post by: redbox on 19:12, 27 September 11
Okay, I've isolated the main game routine now.

It's not commented though, so I will do this before I release it otherwise it's pretty useless.

I've got some other stuff to finish first though so it might take a little while.
Title: Re: Chuckie Egg
Post by: EgoTrip on 08:19, 29 September 11
ok, thanks for your help on this.
Title: Re: Chuckie Egg
Post by: EgoTrip on 21:26, 12 September 12
any progress on this? I would still like to do my level hack but I need help decoding the source code
Powered by SMFPacks Menu Editor Mod