I'm currently programming a z80 emulator to be used in a gameboy emulator, but have become a little unsure how to implement one of the opcodes 0x3a.
In the gameboy manual it says:
LDD A,(HL)
Description:
Put value at address HL into A. Decrement HL.
And so I implemented it like this:
reg_A = read_mem(reg_HL);
reg_HL--;
I decided to test my progress by making a half arsed phoenix emulator.
and this is where I ran into trouble, on checking othe emulators from the gameboy thread in this fourm it seems this is how they too have implemented it in this way, It seems to work if I change the opcode to simply:
reg_PC+=2; ( reg_PC being the program counter)
I know that phoenix uses the 8080 not z80 but It runs fine on other open source z80 emus, and it apears they do not implement this opcode as described in the gameboy document either. Although I cant seem to figure exactly how it is the have done it as there source code is somewhat cryptic.
Any help or comments on this opcode whould be greatly appreciated.
Cheers, TJA
In the gameboy manual it says:
LDD A,(HL)
Description:
Put value at address HL into A. Decrement HL.
And so I implemented it like this:
reg_A = read_mem(reg_HL);
reg_HL--;
I decided to test my progress by making a half arsed phoenix emulator.
and this is where I ran into trouble, on checking othe emulators from the gameboy thread in this fourm it seems this is how they too have implemented it in this way, It seems to work if I change the opcode to simply:
reg_PC+=2; ( reg_PC being the program counter)
I know that phoenix uses the 8080 not z80 but It runs fine on other open source z80 emus, and it apears they do not implement this opcode as described in the gameboy document either. Although I cant seem to figure exactly how it is the have done it as there source code is somewhat cryptic.
Any help or comments on this opcode whould be greatly appreciated.
Cheers, TJA