Jump to content

GB Programming: Difference between revisions

→‎Flags: Remove flags that don't exist on Game Boy
>ISSOtm
(→‎Instructions get!: Remove instructions that don't exist on the Game Boy)
>ISSOtm
(→‎Flags: Remove flags that don't exist on Game Boy)
Line 465:
|7||6||5||4||3||2||1||0
|-
|S||Z||-N||H||C||-||P/V-||N-||C-
|}
BothAll "-" are unused flags. TheirThey behaviorare isset very complicated, and they aren't "official".to Treat0 themat asall randomtimes.
 
===S : Sign===
If the accumulator is negative (from a signed perspective), the flag is set. You can also view it as a copy of the accumulator's 7th bit.
 
===Z : Zero===
Line 477 ⟶ 474:
===H : Half-Carry===
Works like the Carry flag, but referring to the least-significant ''nibble''. It is only used with the DAA instruction, so... forget it until then.
 
===P/V : Parity/Overflow===
This flag's meaning depends on the last operation.
 
If it means parity, it is set if the number of 1 in the accumulator is even. If it is odd, then it is reset.
 
If it means overflow, it is set if the last operation caused the accumulator's sign to change.
 
===N : Add/Subtract===
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.