Files
R8Forge/drv
dsh 4a5bd836a8 clb_divmod: nine parameters down to four
Complaint received and agreed with: nine cells to pass for a division is not an
interface anybody wants to type.  Two things made it possible to shrink:

  * .tp and macro arguments accept address expressions (measured: .tp A+1
    assembles, and set_0 A+1 expands to .tp A+1 inside the callee).  So the
    four scratch cells can be passed as one block: clb_divmod N D Q S uses S,
    S+1, S+2 and S+3.
  * BUF and X were unnecessary: copy already has sources and destinations to
    spare that are dead at the moment they are needed, and clb_inc_ip can take
    a cell that the probe is about to overwrite.

So the signature is now clb_divmod N D Q S -- three data cells and one scratch
base -- and the tape dropped from 5839 to 4189 characters on the way, because
the scratch cells now sit next to each other and every .tp walk got shorter.

Still correct: all 76 sampled pairs (2047/10 = 204 7, 7/10 = 0 7, 10/10 = 1 0,
1234/100 = 12 34, 999/7 = 142 5, 2047/2047 = 1 0), and the O(N/D) limit is
unchanged.
2026-11-07 16:53:27 +08:00
..