in assembler we say that the EAX registers is an accumulator register to do calculations but yet I can put whatever I want in EAX when I make a MOV, why do we say that then?
Asked
Active
Viewed 35 times
-1
-
You don't say that :) There are architectures where you do have an accumulator but x86 is not such. That said, there are certain instructions and addressing modes that restrict which registers you can use. – Jester Feb 26 '22 at 19:36
-
What ? i don’t understand. didnyou say that in x86 i can put whatever i want in the EAX register ? – MatR Feb 26 '22 at 19:39
-
You say that certain instructions resteicts which register i can use, but what the « instruction » word refers to ? – MatR Feb 26 '22 at 19:41
-
2Yes you can put whatever you want in `eax`. x86 has what's called "general purpose registers", or GPRs for short. Arithmetic and most (integer) instructions work with any of those. But there are instructions that use particular registers implicitly. e.g. the string instructions use `esi` and `edi`, `loop` uses `ecx`, stack operations use `esp` and so on. Also in 16 bit mode your addressing modes are restricted. – Jester Feb 26 '22 at 19:43
-
1See also https://www.swansontec.com/sregisters.html. I also marked this as a duplicate of several existing Q&As that explain what @Jester did in comments. – Peter Cordes Feb 27 '22 at 02:04
1 Answers
-2
if we have to add two numbers in must we have first MOV its and after adding the number. so we have got a result. if we have not MOV so it's not adding in a two number.
pyrot72
- 1
- 4