From 1f25f875e60e45025b46ed2a265b5d5c513efad0 Mon Sep 17 00:00:00 2001 From: Riyyi Date: Wed, 24 Aug 2022 15:27:08 +0200 Subject: [PATCH] Doc: Make the half-carry flag explanation more clear --- doc/terminology.org | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/doc/terminology.org b/doc/terminology.org index e036347..cfe011d 100644 --- a/doc/terminology.org +++ b/doc/terminology.org @@ -19,10 +19,12 @@ GameBoy terminology. *** Flags -The Half Cary (H) flag differs between 8-bit or 16-bit operations. The 8-bit -variant indicates carry for the lower 4 bits of the result, or overflow from bit -4 to bit 5. The 16-bit variant indicates carry for the lower 4 bits of the -*second* byte of the result, or overflow from bit 12 to bit 13. +The half-carry flag ~H~ is set when an arithmetic operation on two numbers +causes a carry from bit #3 to bit #4 for 8-bit operations or a carry from bit +#11 to bit #12 for 16-bit operations. For 16-bit operation this indicates the +lower 4 bits of the *second* byte[[#references][(3)]]. + +We start counting from the right as bit *#0*! *** Opcode @@ -54,5 +56,6 @@ n = constant ** References -- https://gbdev.io/pandocs/Memory_Map.html -- https://gbdev.io/pandocs/Specifications.html +1. https://gbdev.io/pandocs/Memory_Map.html +2. https://gbdev.io/pandocs/Specifications.html +3. [[https://robdor.com/2016/08/10/gameboy-emulator-half-carry-flag/]["A Visual Guide to the Gameboy's Half-Carry Flag"]]. robdor.com. Retrieved 24 Aug 2022.