Well, my first efforts where to decode the Ninendo logo at 0104h. Docs tell that it is bitmap, so a stream of bits was fast generated. But how to arrange them?
Because it is raw imagedata without any additional informations like size and such, i was not able to do it. So i search the web and found it described here
http://stackoverflow.com/questions/21119904/how-to-decode-the-nintendo-logo-from-gameboyWell, i guess this is one thing one
just had to know about, to do the job. An i also guess there are many more things i had to learn about the console ;-)
Thanks a lot for pointing out that code is not Z80 but a similar kind of it. So i had to get the right disassembler to read the code. Any hints here?
Next thing would be to understand what is going on in the code. Because CPU codes don't do anything itself, i guess all depends on side effects of writing to magic memory addresses, registers or io-ports. So it seems a good idea to replace the addresses found in the disassembled code with functional names.
Yes, i will try to understand the whole game and every function. I think later i know where graphics, sound and text are stored and how they get used. Maybe i am able to change the code to do like i want (patch lifes, levels, spirtes or texts). This is my final goal.
March 19, 2016, 09:32:45 am - (Auto Merged - Double Posts are not allowed before 7 days.)
The Nintendo Logo in the header is $30 bytes, which is 3 tiles, which probably forms a 24x8 pixel image. EDIT: but even that seems small.... maybe it's stored 1BPP to make a 48x8 image? I'd have to research it. =x
It seems to be 1bpp. For some reason i don't know, the bytes of the logo:
CE ED 66 66 CC 0D
00 0B 03 73 00 83
00 0C 00 0D 00 08
11 1F 88 89 00 0E
DC CC 6E E6 DD DD
D9 99 BB BB 67 63
6E 0E EC CC DD DC
99 9F BB B9 33 3E
have to be arranged like this:
C 6 C 0 0 0 0 0 0 1 8 0
E 6 C 0 3 0 0 0 0 1 8 0
E 6 0 0 7 8 0 0 0 1 8 0
D 6 D B 3 3 C D 8 F 9 E
D 6 D D B 6 6 E D 9 B 3
C E D 9 B 7 E C D 9 B 3
C E D 9 B 6 0 C D 9 B 3
C 6 D 9 B 3 E C C F 9 E
As you can see, there are 6 bytes makeing up one row. And 8 rows for the whole image. In binary the later codeblock will look like this:
110001101100000000000000000000000000000110000000
111001101100000000110000000000000000000110000000
111001100000000001111000000000000000000110000000
110101101101101100110011110011011000111110011110
110101101101110110110110011011101101100110110011
110011101101100110110111111011001101100110110011
110011101101100110110110000011001101100110110011
110001101101100110110011111011001100111110011110
To improve the visuality of the image, i had replaced the zeros with blank:
11 11 11 11
111 11 11 11 11
111 11 1111 11
11 1 11 11 11 11 11 1111 11 11 11111 1111
11 1 11 11 111 11 11 11 11 111 11 11 11 11 11
11 111 11 11 11 11 111111 11 11 11 11 11 11
11 111 11 11 11 11 11 11 11 11 11 11 11
11 11 11 11 11 11 11111 11 11 11111 1111
But i'm really confused about the bit-arrangement of the bytes. It's mixed up with nibbles (4-Bits) of bytes found.
March 19, 2016, 10:06:06 am - (Auto Merged - Double Posts are not allowed before 7 days.)
So, i downloaded "Gameboy Assembler Pro" from the utilities-section of this site for disassembling the code. Now, we can be shure that the instructions are correct.
Starting at 351h, here are the first lines. Could anybody help me to get their meaning?
#org 351
Label351:
ld sp,E000 ; load 16-Bit register SP (Stackpointer) with e000h. SP is used for callback-addresses or pushed values
ld hl,C000 ; load 16-Bit register HL (H and L) with value c000h
ld bc,2000 ; load 16-Bit register BC (B and C) with value 2000h
Label35A:
xor a,a ; xor value a with itself. Maybe some kind of decryption? xor itself twice will result in originate byte
ldi (hl),a ; store value of "a" at memory location pointed by HL (initially c000h) and then increment HL (because of ldi command)
dec bc ; decrement BC value. It seems to contain the length of the block to handle
ld a,b ; load accumulator "a" with value of "b" (MSB of 16 Bit register BC)
or a,c ; binary or it with value of "c". So "a" is only zero if B and C have the value zero
jr nz,Label35A ; this seems to be a loop until register a (accu) is zero.
; ok, i'm pretty shure this will decode data inplace at memory location c000h for 2000h bytes.
ld hl,FF8A ; this seems to be a magic address...
ld c,75
xor a,a
Label367:
ldi (hl),a
dec c
jr nz,Label367 ; another decoder?