Routines 
Prev: 369B  Up: Map  Next: 36AF 
The address of this routine is found in the table of addresses. It is called via the calculator literal +32 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 NINT (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  36A0  RST $28  N, M  
36A1  DEFB $C0  st_mem_0: N, M (mem0 holds M)  
36A2  DEFB $02  delete: N  
36A3  DEFB $31  duplicate: N, N  
36A4  DEFB $E0  get_mem_0: N, N, M  
36A5  DEFB $05  division: N, N/M  
36A6  DEFB $27  int: N, INT (N/M)  
36A7  DEFB $E0  get_mem_0: N, INT (N/M), M  
36A8  DEFB $01  exchange: N, M, INT (N/M)  
36A9  DEFB $C0  st_mem_0: N, M, INT (N/M) (mem0 holds INT (N/M))  
36AA  DEFB $04  multiply: N, M*INT (N/M)  
36AB  DEFB $03  subtract: NM*INT (N/M)  
36AC  DEFB $E0  get_mem_0: NM*INT (N/M), INT (N/M)  
36AD  DEFB $38  end_calc  
36AE  RET  Finished. 
Prev: 369B  Up: Map  Next: 36AF 