mercredi 1 mars 2017

gbz80 - IF statements

I'm doing some coding in Z80 on VisualboyAdvance and I have no idea how to do an IF statement of any kind.

I made a script to increment the value of each tile on screen starting at 0xC3A0. The screen data ends at 0xC507.

My code is as follows:

    d322|21A0C3|LD HL,C3A0h
    d325|34    |INC (HL)
    d326|23    |INC HL
    d327|00    |NOP
    .
    .
    .
    d340|00    |NOP
    d341|C325D3|JP D325h

As you can see, it loops constantly and eventually crashes the game by incrementing core functions. I'd like a way to have it so it uses 0xC9 (Ret) upon HL reaching 0xC507.

Any help would be much appreciated.

And if you could explain to me how the statements you provide work, that'd be great. Machine code is foreign to me.

Aucun commentaire:

Enregistrer un commentaire