1. Home >
  2. Apps >
  3. Groups >

How this zero address instruction works....?

Question asked by mohit007kumar00 in #Coffee Room on Nov 12, 2010
mohit007kumar00
mohit007kumar00 路 Nov 12, 2010
Rank B2 - LEADER
Hello friends,
I have some read about zero address instruction.Such type of instruction is found in machine that store operand in a structure called a pushdown stack.
This theory is used in HEWLETT-Packed calculators.
Can any one have idea how this zero address instruction works ? Posted in: #Coffee Room
Pensu
Pensu 路 Nov 13, 2010
Rank B1 - LEADER
Zero address instructions are the instructions which do not need any address to perform the operation. As you said of stack operation. Consider a stack operation push like PUSH 5 then this operation will simply push 5 in top of stack. Another one is POP, here also you dont need any address. I suggest you to read computer architecture by morris mano, he has explained the concept in detail.

Correct me if i am wrong....馃榾
mohit007kumar00
mohit007kumar00 路 Nov 13, 2010
Rank B2 - LEADER
You mean to say that.....both the operand are fetched from the main memory.....?
.
If so then i think that HEWLETT-packed calculator performs vary slow.Am i right...?
Leo
Leo 路 Nov 13, 2010
Rank B3 - LEADER
Hey Peeyush can you explain in detail what exactly is zero address instruction, is it anyhow related to NOP.
Reya
Reya 路 Nov 13, 2010
Rank A3 - PRO
@leo:what is NOP??
4M4N
4M4N 路 Nov 13, 2010
Rank C3 - EXPERT
zero-address instruction An instruction that contains no address fields; operand sources and destination are both implicit. It may for example enable stack processing: a zero-address instruction implies that the absolute address of the operand is held in a special register that is automatically incremented (or decremented) to point to the location of the top of the stack.
Leo
Leo 路 Nov 13, 2010
Rank B3 - LEADER
praveena211
@leo:what is NOP??
NOP is better known as No Operator. This operator is quite often used in programming to manage unequal inputs. By the way this is very rarely used by professional programmers since it lowers the speed of operation.
NOP is usually used by hackers to run buffer overflow attacks over a system, NOP comes into play if coder had explicitly implimented bound checking. Since the program becomes capable of checking bounds itself, NOP is used to create overflow.

Example:
Consider a capacity of buffer is 500 and it is completely filled. Now you want to add extra data to run buffer overflow then you will cover all data in such a way with NOP so that in all the buffer checking mechanism should fail. Now suppose data addition is integer which is to be incremented, then it will be given as
x++
now cover it with equivalent NOP so that bound checking mechanism should not detect it,
NOPx++
now first bound checking mechanism will encounter NOP so it will think there's no increment or decrement means no operation is getting performed on buffer but when it'll encounter x++ it will discard it, to cope this we again add NOP to it like this
NOPx++NOP
so now it starts with NOP and ends with NOP so buffer checking mechanism fails to detect it and buffer overflow runs successfully.

This is one of the most basic use of NOP, there might be many uses but currently i never encountered anything which made me use NOP in program. I hope it was easy explanation. Feel free to ask if anything is not clear.
mohit007kumar00
mohit007kumar00 路 Nov 13, 2010
Rank B2 - LEADER
4M4N
absolute address of the operand is held in a special register that is automatically incremented (or decremented) to point to the location of the top of the stack.
Do you mean to say that address of the operands are stored in registers.....?
Are you sure both the operands are stored in registers on the operations are to be carried out.....?
4M4N
4M4N 路 Nov 13, 2010
Rank C3 - EXPERT
not operands only their absolute address is stored in the register
4M4N
4M4N 路 Nov 13, 2010
Rank C3 - EXPERT
Basically it makes use of stack processing
where both operand sources and result destinations are implicitly the top locations of the stack, thus making programs more compact. Stack mechanisms are also used to provide a way of keeping track of multiple interrupts in which the stack serves as a way of 鈥渘esting鈥 the interrupts so that those of lesser priority are pushed down so that those of higher priority can be attended to.
Pensu
Pensu 路 Nov 13, 2010
Rank B1 - LEADER
To be more precise "Zero Address Instructions are instructions which occupy one byte and do not involve an address. Examples of these type of instructions are 'stop execution' or 'clear all status flags'.
This is basically used in stack organized computers. Here the only thing you can access is top of the stack, so you dont need any address to specify it.
For example if you want to perform x=a+b then the airthmetic would be like:

PUSH a TOS<-a
PUSH b TOS<-b
ADD TOS<-a+b
POP x M[x]<-TOS

@mohit: Yes i guess both operands are fetched from the stack only and this process is slow because to find a specific position you have to move stack pointer one by one to desired location.

@leo: every instruction which is of one byte and dont have an address field is a zero address instruction. So NOP must be a zero address instruction.
Leo
Leo 路 Nov 13, 2010
Rank B3 - LEADER
Thanks Peeyush
Nikul Prajapati
Nikul Prajapati 路 Jul 17, 2012
Rank E1 - BEGINNER
Pensu
Zero address instructions are the instructions which do not need any address to perform the operation. As you said of stack operation. Consider a stack operation push like PUSH 5 then this operation will simply push 5 in top of stack. Another one is POP, here also you dont need any address. I suggest you to read computer architecture by morris mano, he has explained the concept in detail.

Correct me if i am wrong....馃榾
>>Zero address instructions are the instructions which do not need any address to perform the operation.

Here, to execute "Zero address instructions" it need address to execute instruction but you need not to specify it explicitly. Address is in definition of instruction it self.

For ex. PUSH 5 means push 5 into the stack where "stack pointer" is pointing right now.
Nikul Prajapati
Nikul Prajapati 路 Jul 17, 2012
Rank E1 - BEGINNER
Pensu
Zero address instructions are the instructions which do not need any address to perform the operation. As you said of stack operation. Consider a stack operation push like PUSH 5 then this operation will simply push 5 in top of stack. Another one is POP, here also you dont need any address. I suggest you to read computer architecture by morris mano, he has explained the concept in detail.

Correct me if i am wrong....馃榾
>>Zero address instructions are the instructions which do not need any address to perform the operation.

Here, to execute "Zero address instructions" it need address to execute instruction but you need not to specify it explicitly. Address is in definition of instruction it self.

For ex. PUSH 5 means push 5 into the stack where "stack pointer" is pointing right now.
Nikul Prajapati
Nikul Prajapati 路 Jul 17, 2012
Rank E1 - BEGINNER
Pensu
Zero address instructions are the instructions which do not need any address to perform the operation. As you said of stack operation. Consider a stack operation push like PUSH 5 then this operation will simply push 5 in top of stack. Another one is POP, here also you dont need any address. I suggest you to read computer architecture by morris mano, he has explained the concept in detail.

Correct me if i am wrong....馃榾
>>Zero address instructions are the instructions which do not need any address to perform the operation.

Here, to execute "Zero address instructions" it need address to execute instruction but you need not to specify it explicitly. Address is in definition of instruction it self.

For ex. PUSH 5 means push 5 into the stack where "stack pointer" is pointing right now.

You must log-in or sign-up to reply to this post.

Click to Log-In or Sign-Up