Routines |
Prev: 13979 | Up: Map | Next: 13999 |
The address of this routine is found in the table of addresses. It is called via the calculator literal 50 by the routine at S_RND.
This subroutine calculates N (mod M), where M is a positive integer held at the top of the calculator stack (the 'last value'), and N is the integer held on the stack beneath M.
The subroutine returns the integer quotient INT (N/M) at the top of the calculator stack (the 'last value'), and the remainder N-INT (N/M) in the second place on the stack.
This subroutine is called during the calculation of a random number to reduce N mod 65537.
|
||||
n_mod_m | 13984 | RST 40 | N, M | |
13985 | DEFB 192 | st_mem_0: N, M (mem-0 holds M) | ||
13986 | DEFB 2 | delete: N | ||
13987 | DEFB 49 | duplicate: N, N | ||
13988 | DEFB 224 | get_mem_0: N, N, M | ||
13989 | DEFB 5 | division: N, N/M | ||
13990 | DEFB 39 | int: N, INT (N/M) | ||
13991 | DEFB 224 | get_mem_0: N, INT (N/M), M | ||
13992 | DEFB 1 | exchange: N, M, INT (N/M) | ||
13993 | DEFB 192 | st_mem_0: N, M, INT (N/M) (mem-0 holds INT (N/M)) | ||
13994 | DEFB 4 | multiply: N, M*INT (N/M) | ||
13995 | DEFB 3 | subtract: N-M*INT (N/M) | ||
13996 | DEFB 224 | get_mem_0: N-M*INT (N/M), INT (N/M) | ||
13997 | DEFB 56 | end_calc | ||
13998 | RET | Finished. |
Prev: 13979 | Up: Map | Next: 13999 |