What Is The Name Of The Highest 8 Bits Of Register Ax
Associates - Registers
Processor operations mostly involve processing data. This information tin can be stored in memory and accessed from thereon. Yet, reading information from and storing information into retentiveness slows down the processor, as it involves complicated processes of sending the data request across the command bus and into the memory storage unit of measurement and getting the information through the same channel.
To speed up the processor operations, the processor includes some internal memory storage locations, called registers.
The registers store information elements for processing without having to access the memory. A limited number of registers are built into the processor scrap.
Processor Registers
There are ten 32-flake and six 16-bit processor registers in IA-32 architecture. The registers are grouped into 3 categories −
- General registers,
- Control registers, and
- Segment registers.
The full general registers are further divided into the following groups −
- Data registers,
- Arrow registers, and
- Index registers.
Data Registers
Iv 32-chip data registers are used for arithmetic, logical, and other operations. These 32-scrap registers can be used in three ways −
-
As complete 32-bit data registers: EAX, EBX, ECX, EDX.
-
Lower halves of the 32-flake registers tin can be used every bit four sixteen-bit data registers: AX, BX, CX and DX.
-
Lower and college halves of the above-mentioned four sixteen-chip registers tin exist used as viii 8-flake information registers: AH, AL, BH, BL, CH, CL, DH, and DL.
Some of these data registers have specific utilize in arithmetical operations.
AX is the primary accumulator; it is used in input/output and most arithmetic instructions. For example, in multiplication functioning, 1 operand is stored in EAX or AX or AL register according to the size of the operand.
BX is known equally the base of operations register, as information technology could be used in indexed addressing.
CX is known every bit the count register, as the ECX, CX registers store the loop count in iterative operations.
DX is known as the data register. It is as well used in input/output operations. It is also used with AX register along with DX for multiply and separate operations involving large values.
Pointer Registers
The pointer registers are 32-flake EIP, ESP, and EBP registers and respective xvi-scrap right portions IP, SP, and BP. There are three categories of pointer registers −
-
Instruction Pointer (IP) − The 16-bit IP register stores the offset accost of the adjacent teaching to be executed. IP in association with the CS annals (as CS:IP) gives the complete address of the current instruction in the code segment.
-
Stack Pointer (SP) − The xvi-bit SP register provides the kickoff value within the programme stack. SP in association with the SS register (SS:SP) refers to be current position of data or address within the programme stack.
-
Base Pointer (BP) − The 16-bit BP register mainly helps in referencing the parameter variables passed to a subroutine. The address in SS annals is combined with the offset in BP to get the location of the parameter. BP tin can also be combined with DI and SI equally base annals for special addressing.
Index Registers
The 32-bit index registers, ESI and EDI, and their 16-fleck rightmost portions. SI and DI, are used for indexed addressing and sometimes used in addition and subtraction. There are two sets of alphabetize pointers −
-
Source Alphabetize (SI) − It is used as source index for string operations.
-
Destination Index (DI) − Information technology is used as destination index for string operations.
Control Registers
The 32-bit instruction pointer register and the 32-fleck flags annals combined are considered every bit the control registers.
Many instructions involve comparisons and mathematical calculations and change the status of the flags and some other conditional instructions exam the value of these status flags to accept the control menses to other location.
The mutual flag bits are:
-
Overflow Flag (OF) − It indicates the overflow of a high-order bit (leftmost flake) of data afterward a signed arithmetic operation.
-
Direction Flag (DF) − It determines left or right direction for moving or comparing string data. When the DF value is 0, the string performance takes left-to-right direction and when the value is set to 1, the string performance takes correct-to-left direction.
-
Interrupt Flag (IF) − It determines whether the external interrupts like keyboard entry, etc., are to be ignored or processed. Information technology disables the external interrupt when the value is 0 and enables interrupts when set to 1.
-
Trap Flag (TF) − It allows setting the performance of the processor in single-pace mode. The DEBUG programme we used sets the trap flag, so we could step through the execution 1 instruction at a time.
-
Sign Flag (SF) − Information technology shows the sign of the result of an arithmetic operation. This flag is gear up according to the sign of a data particular following the arithmetic operation. The sign is indicated by the high-order of leftmost flake. A positive result clears the value of SF to 0 and negative result sets it to 1.
-
Zero Flag (ZF) − It indicates the issue of an arithmetic or comparing operation. A nonzero result clears the nothing flag to 0, and a zero result sets it to 1.
-
Auxiliary Deport Flag (AF) − Information technology contains the deport from bit three to bit 4 following an arithmetics functioning; used for specialized arithmetics. The AF is set when a 1-byte arithmetic operation causes a acquit from chip iii into bit 4.
-
Parity Flag (PF) − It indicates the total number of 1-$.25 in the result obtained from an arithmetics operation. An even number of 1-$.25 clears the parity flag to 0 and an odd number of 1-$.25 sets the parity flag to one.
-
Carry Flag (CF) − It contains the carry of 0 or 1 from a high-gild bit (leftmost) later on an arithmetic operation. It likewise stores the contents of last flake of a shift or rotate operation.
The following tabular array indicates the position of flag $.25 in the 16-bit Flags annals:
Flag: | O | D | I | T | S | Z | A | P | C | |||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Bit no: | fifteen | fourteen | 13 | 12 | 11 | ten | 9 | 8 | 7 | 6 | 5 | 4 | 3 | ii | 1 | 0 |
Segment Registers
Segments are specific areas defined in a program for containing information, lawmaking and stack. There are three main segments −
-
Code Segment − It contains all the instructions to be executed. A 16-fleck Code Segment register or CS register stores the starting address of the code segment.
-
Data Segment − It contains data, constants and work areas. A 16-bit Information Segment register or DS register stores the starting address of the information segment.
-
Stack Segment − It contains information and return addresses of procedures or subroutines. Information technology is implemented every bit a 'stack' data structure. The Stack Segment register or SS register stores the starting accost of the stack.
Autonomously from the DS, CS and SS registers, there are other extra segment registers - ES (extra segment), FS and GS, which provide additional segments for storing data.
In associates programming, a programme needs to access the retentivity locations. All memory locations within a segment are relative to the starting address of the segment. A segment begins in an address evenly divisible by 16 or hexadecimal 10. So, the rightmost hex digit in all such memory addresses is 0, which is not by and large stored in the segment registers.
The segment registers stores the starting addresses of a segment. To become the exact location of data or educational activity within a segment, an first value (or deportation) is required. To reference any memory location in a segment, the processor combines the segment address in the segment annals with the offset value of the location.
Example
Look at the following simple program to sympathise the apply of registers in assembly programming. This plan displays 9 stars on the screen along with a simple message −
section .text global _start ;must be alleged for linker (gcc) _start: ;tell linker entry bespeak mov edx,len ;message length mov ecx,msg ;bulletin to write mov ebx,one ;file descriptor (stdout) mov eax,four ;system call number (sys_write) int 0x80 ;phone call kernel mov edx,9 ;bulletin length mov ecx,s2 ;bulletin to write mov ebx,1 ;file descriptor (stdout) mov eax,4 ;arrangement call number (sys_write) int 0x80 ;phone call kernel mov eax,1 ;system call number (sys_exit) int 0x80 ;call kernel section .data msg db 'Displaying 9 stars',0xa ;a bulletin len equ $ - msg ;length of message s2 times nine db '*'
When the higher up code is compiled and executed, it produces the post-obit result −
Displaying 9 stars *********
Useful Video Courses
Video
Video
Source: https://www.tutorialspoint.com/assembly_programming/assembly_registers.htm
Posted by: mayhewclagre73.blogspot.com
0 Response to "What Is The Name Of The Highest 8 Bits Of Register Ax"
Post a Comment