33
μ
PD17704, 17705, 17707, 17708, 17709
3.4 Operation of Address Stack
3.4.1 Subroutine call instruction (“CALL addr”, “CALL @AR”) and return instruction (“RET”, “RETSK”)
When a subroutine call instruction is executed, the value of the stack pointer is decremented by one, and
the return address is stored to an address stack register specified by the stack pointer.
When the return instruction is executed, the contents of the address stack register (return address) specified
by the stack pointer are restored to the program counter, and the value of the stack pointer is incremented by
one.
3.4.2 Table reference instruction (“MOVT DBF, @AR”)
When the table reference instruction is executed, the value of the stack pointer is incremented by one, and
the return address is stored to an address stack register specified by the stack pointer.
Next, the contents of the program memory specified by the address register are read to the data buffer, the
contents of the address stack register (return value) specified by the stack pointer are restored to the program
counter, and the value of the stack pointer is incremented by one.
3.4.3 When interrupt is accepted and on execution of return instruction (“RETI”)
When an interrupt is accepted, the value of the stack pointer is decremented by one, and the return address
is stored to an address stack register specified by the stack pointer.
When the return instruction is executed, the contents of an address stack register (return value) specified
by the stack pointer are restored to the program counter, and the value of the stack pointer is incremented by
one.
3.4.4 Address stack manipulation instruction (“PUSH AR”, “POP AR”)
When the “PUSH” instruction is executed, the value of the stack pointer is decremented by one, and the
contents of the address register are transferred to an address stack register specified by the stack pointer.
When the “POP” instruction is executed, the contents of an address stack register specified by the stack
pointer are transferred to the address register, and the value of the stack pointer is incremented by one.
3.4.5 System call instruction (“SYSCAL entry”) and return instruction (“RET”, “RETSK”)
When the “SYSCAL entry” instruction is executed, the value of the stack pointer is decremented by one, and
the return address and the value of the segment register are stored to an address stack register specified by
the stack pointer.
When the return instruction is executed, the contents of an address stack register (return value) specified
by the stack pointer are restored to the program counter and segment register, and the value of the stack pointer
is incremented by one.