|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here! |
|
#1
|
|||||
|
|||||
|
Registers in assembly
What are they exactly and how do they work? I can't seem to find any tutorial that goes in depth about it. For example, I have this Hello World program:
assembly Code:
That's about as far as every tutorial will take me, but I have no idea what's going on here. Can anyone explain to me or link me to something that can help? |
|
#2
|
|||
|
|||
|
Spend some time in the architecture section where all the registers are described.
Intel Programmer Manual Assembler syntax varies from one assembler to another in the Intel world, but once you understand the underlying processor architecture, those differences degenerate to just an annoyance. |
|
#3
|
|||
|
|||
|
To answer your question briefly, a register is a piece of data (typically 32 bits) that the processor has immediate access to. There are very few of them (on the x86 platform, there are 8 general-purpose registers). To manipulate other data in memory, it's therefore customary to move the data into registers, do whatever you want with it there, and then move it back to memory. On some architectures (e. g. SPARC, if I recall), this is the only way to manipulate data in main memory, since the instruction set has no instructions to operate directly on main memory except to move data to and from registers. However, Intel is different, since many instructions can operate on memory directly.
Take a look at Schol-R-Lea's long list of assembly resources: http://forums.devshed.com/showpost....060&postcount=6 I'm not saying it's the best, but this helped me when I was starting out with x86 assembly: http://www.drpaulcarter.com/pcasm/ To fully understand the code you posted, you'll need to delve into Linux assembly, since the "int 80h" system call protocol is specific to Linux. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Other Programming Languages > Registers in assembly |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|