Re: Duplicate Instructions?

Ed Casas (edc@ece.ubc.ca) Sun, 27 Feb 2000 19:44:02 -0800


Date: Sun, 27 Feb 2000 19:44:02 -0800
From: Ed Casas <edc@ece.ubc.ca>
Subject: Re: Duplicate Instructions?

On Sun, Feb 27, 2000 at 06:24:23PM -0800, ddowler wrote: > Are the instructions > > PUSH 0 > PUSH START > > the same in machine code? The label "START" has the value 0, so yes, they are the same instruction. > If so, could you explain how this will work (i.e. how PUSH 0 > will "turn the output off" and PUSH START will jump to address > zero)? PUSH 0 pushes the stack down and loads the value 0 into the X register. It doesn't do anything else. It's the following instruction, OUTP, that transfers the contents of X to the O register and turns the output off. Similarly, PUSH START pushes the stack down and loads 0 into X. It doesn't do anything else. The following instruction, RET, transfers X to PC thus causing the processor to fetch the next instruction from address 0. The comments "turn the output off" and "repeat forever" refer to the effects of a block of instructions (2 instructions in these cases), not to a single instruction. Look at the course documentation guidelines, the solutions to Assignment 2 and the assembly language examples for more examples of this commenting convention. -- Ed Casas edc@ece.ubc.ca http://casas.ece.ubc.ca +1 604 822-2592