Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Half-Carry flag question
Index -> General Programming
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Prads




PostPosted: 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
Sponsor
sponsor
Tony




PostPosted: 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).
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Prads




PostPosted: 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!
Display posts from previous:   
   Index -> General Programming
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 3 Posts ]
Jump to:   


Style:  
Search: