Half-Carry flag question
Author |
Message |
Prads
|
Posted: Wed Jul 06, 2011 8:53 pm Post subject: Half-Carry flag question |
|
|
I understand that in 8-bit register when there's a carry from 3rd bit to 4th bit in math operation half carry flag is set. But what if there are 16 bit register involved? For example, let's say we have this instruction:
LD HL, SP+n
which puts Stack Pointer(16 bit) + n(8 bit signed immediate value) to register HL(16 bit). I want to know how the half carry flag is set here, is it going to check the carry from bit 7 to bit 8, or bit 11 to bit 12? Thanks! |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Tony
|
Posted: Wed Jul 06, 2011 10:18 pm Post subject: RE:Half-Carry flag question |
|
|
This is where you consult the official documentation for your particular architecture (or determine this experimentally by setting bits high, one at a time). |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
|
Prads
|
Posted: Wed Jul 06, 2011 11:48 pm Post subject: RE:Half-Carry flag question |
|
|
Yeah, I just went through the documentation again and some instruction like 'ADD HL, n' it say to set H flag if carry from bit 11. So, I guess it's no different for that instruction either. Thanks! |
|
|
|
|
|
|
|