You can test your code, if you write it in C and then try to do division using the following code:
#define div(a,b) ( (a * recip(b)) >> N )
By way of summary, are some definitions:
JSR R, DST M[--SP] = R R = PC PC = DSTNote that because PC is a register, it is legal to write JSR PC, DST to do the naive call where the return address is pushed on the stack.
RTS R PC = R R = M[SP++]Again, note that RTS PC is the naive call that pops the stack into the program counter.
MARK N SP = PC + (2 * N) PC = R5 R5 = M[SP++]To understand the above, note that the most common register to use for a JSR instruction (other than the naive use of JSR PC) is R5. Thus, the final two lines above match the normal RTS. The mystery is, how can you use this strange instruciton to make a useful stack mark!