View Single Post
  #9    
Old August 3rd, 2010 (02:45 AM).
Sawakita's Avatar
Sawakita Sawakita is offline
Not Invented Here
 
Join Date: May 2010
Gender: Male
Posts: 180
Nice tutorial!

Quote originally posted by Coolboyman:

Since bit 1 is on if B is down, let's make it so it ignores the other bits. Let me know if there's an eaiser way of doing this, for some reason the other bit commands weren't working for me.

res 0,a (CB 87) - turns bit 0 in a to off (A)
res 2,a (CB 97) - turns bit 2 in a to off (Select)
res 3,a (CB 9F) - turns bit 3 in a to off (Start)
res 4,a (CB A7) - turns bit 4 in a to off (Right)
res 5,a (CB AF) - turns bit 5 in a to off (Left)
res 6,a (CB B7) - turns bit 6 in a to off (Up)
res 7,a (CB BF) - turns bit 7 in a to off (Down)
rcc, a (CB 0F) - shifts the bits in A down 1, changing 2 into 1.
ld de,$D682 (11 82 D6) - loads D682 into de again
ld [de],a (12) - Puts the contents of a into de.
ret (C9)

This will make the game write 01 into D682 if B is held down. If D682 is 01, that will make your characters speed increase. If you use this, just please give me credit. Enjoy.
Maybe it's a stupid suggestion but, instead of resetting one bit at a time, why don't you use:
and 02 (E6 02) - so it reset all bits but the "B"-bit
rcc, a (CB 0F) - shifts the bits in A down 1, changing 2 into 1.
ld de,$D682 (11 82 D6) - loads D682 into de again
ld [de],a (12) - Puts the contents of a into de.
ret (C9)

Is it one of the commands you said weren't working?
__________________



| 1st Gen Hacking: Useful Links | A good example of REAL ROM Hacking |
Reply With Quote