CompOrg Spring 2005

Y86 Assembly Language Instruction Reference

InstructionDescriptionExamples
nop No-Operation (does nothing) nop
halt Stops the simulator halt
rrmovl rA, rB register-to-register move
Copies from register rA to register rB
rrmovl %eax, %ecx
rrmovl %esp,%ebp
irmovl V, rB immediate-to-register move
puts 32 bit immediate value in register rB
irmovl $1234,%eax
rmmovl rA D(rB) register-to-memory move
Copies from register rA to memory location Mem[rB+D]
rmmovl %eax,-4(%ebp)
rmmovl %edx,0x100(%esi)
mrmovl D(rB),rA memory-to-register move
copies contents of Mem[rB+D] to register rA
mrmovl 8(%ebp),%eax
mrmovl 0(%ecx),%edx
addl rA, rB add: rB = rB + rA
also sets condition code bits
addl %eax, %edx
subl rA, rB subtract: rB = rB - rA
also sets condition code bits
subl %eax, %edx
andl rA, rB bitwise logical and: rB = rA & rB
also sets condition code bits
andl %eax, %edx
xorl rA, rB exclusive or: rB = rA ^ rB
also sets condition code bits
xorl %eax, %eax
jmp Dest unconditional jump to Dest (32 bit address) jmp 0x1000000
jmp foo
jle Dest jump if previous result was less than or equal to 0. based on signed arithmetic (to determine <= ) jle foo
jl Dest jump if previous result was less than 0.
based on signed arithmetic (to determine <)
jl foo
je Dest jump if previous result was equal to 0. je foo
jne Dest jump if previous result was not equal to 0. jne foo
jge Dest jump if previous result was greater than or equal to 0.
based on signed arithmetic (to determine >= )
jge foo
jg Dest jump if previous result was greater than 0.
based on signed arithmetic (to determine >)
jg foo
call Dest Initiates a subroutine call to Dest (32 bit address)
pushes return address on stack and jumps to Dest
call strcpy
ret return from subroutine.
pops return address from stack and jumps to return address
ret
pushl rA push register rA on the stack.
Mem[%esp-4] = rA, %esp=%esp-4
pushl %eax
popl rA pop from stack to register rA
rA = Mem[%esp], %esp = %esp+4
popl %ebp