summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/org/blog/assembly/1.org15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/org/blog/assembly/1.org b/src/org/blog/assembly/1.org
index 7a712e3..102a3c0 100644
--- a/src/org/blog/assembly/1.org
+++ b/src/org/blog/assembly/1.org
@@ -256,8 +256,8 @@ For example:
 *WORD PTR [BX]*     ; word access.
 assembler supports shorter prefixes as well:
 
-b. - for BYTE PTR
-w. - for WORD PTR
+- b. - for BYTE PTR
+- w. - for WORD PTR
 
 in certain cases the assembler can calculate the data type automatically.
 
@@ -286,3 +286,14 @@ Defining constants is pretty straight forward :
 #+END_SRC
 
 Of course constants cant be changed, and aren't stored in memory. So they are like little macros that live in your code.
+
+** ⚐ :
+Now comes the notion of *Flags*, which are bits in the *Status register*, which are used for logical and arithmetical instructions and can take a value of 1 or 0 . Here are the 8 flags that exist for the 8086 CPU :
+- *Carry Flag(CF):* Set to 1 when there is an *unsigned overflow*, for example when you add 255 + 1( not in range [0,255] ). by default its set to 0.
+- *Overflow Flag(CF):* Set to 1 when there is a *signed overflow*, for example when you add 100 + 50( not in range [-128, 128[ ). by default its set to 0.
+- *Zero Flag(ZF):* Set to 1 when the result is 0. by default its set to 0.
+- *Auxiliary Flag(AF):* Set to 1 when there is an *unsigned overflow* for low nibble (4bits), or in human words : when there is a carry inside the number. for example when you add 29H + 4CH , 9 + C => 15. So we carry the 1 to 2 + 4 and AF is set to 1.
+- *Parity Flag(PF):* Set to 1 when the result has an even number of one bits. and 0 if it has an odd number of one bits. Even if a result is a word, only the Low 8bits are analyzed.
+- *Sign Flag(SF):* Self explanatory, set to 1 if the result is negative and 0 if its positive.
+- *Interrupt Enable Flag(IF):* When its set to 1, the CPU reacts to interrupts from external devices.
+- *Direction Flag(DF):* When this flag is set to 0, the processing is done forward, if its set to 1, its done backward.