3 Wegematic 1000

Index - - Contents - - Previous chapter - Next chapter - - Previous page - Next page
Simpsons Rule for Integration

Wegematic 1000 had a library of standard programs, which were stored in the main memory. B.16 was one such program that used Simpsons rule for integration given the function values y1, y2,...,yn (odd n), evaluated at equidistant points with separation h. It was written to make the calculation in the following way from left to right:

    I = [(y1+yn)/2 + y2+y3+...+yn-1 + y2+y4+...+yn-1](2h/3)
The main program should copy B.16 to work channel III and the ordinates y1, y2,...,yn to work channel I with y1 in cell 00 and yn in cell n-1. The ordinates had to be scaled so that the sum before the multiplication did not overflow the capacity of one cell. The value of h should be placed in the D register and the A register should contain the number of points n and the return address RA like A: xxNNxxRA (NN = n), and then execute 1140, i.e, a jump to the first cell of work channel III. The code of B.16 was
40 c1514dd1 c0  41 bc007701 c1  42 00000000 c2  43 00000000 c3
44 3728c141 c4  45 760017dc c5  46 00000000 c6  47 00000000 c7
48 17c8c150 c8  49 e54a3000 c9  4a 00000000 ca  4b 00000000 cb
4c c158c15c cc  4d e7553000 cd  4e 00000000 ce  4f 00000000 cf
50 4100bd00 d0  51 77001100 d1  52 00000000 d2  53 00000000 d3
54 a1011758 d4  55 aaaaaaab d5  56 00000000 d6  57 00000000 d7
58 bc001758 d8  59 00000000 d9  5a 00000000 da  5b 00000000 db
5c 7700c145 dc  5d 00000000 dd  5e 00000000 de  5f 00000000 df
We go through some of the code (c. = command, C(Z) content of cell Z):
40  c151  Store EE=C(E), for later restoring    51 77EE1100 d1
    4dd1  Second address of A stored in d1      51 77EE11RA d1
44  3728  A <-> E, A <- 0. The c. for A <-> E is 36. Adding 1
          giving 37 means that the address is also a c.
    c141  First address of A stored in 41       41 bcNN7701 c1
48  17c8  E <- E-1, jump to c8 if E not 0 else to c8, i.e.,
          just decrease E
    c150  Store E in 50,   (XX=n-1)             50 41XXbd00 d0
4c  c158  Store E in 58,                        58 bcXX1758 d8
    c15c  Store E in 5c,                        5c 77XXc145 dc
50  41XX  Copy yn-1+1 to B
    bd00  Add B and y0+1 and store in AB
54  a101  Shift AB one bit right, i.e., divide by 2. We now 
          have (y1+yn)/2 in AB
    1758  Decrease E (see 48 above) (E=n-2)
58  bcXX  AB <- AB + yn-1-E+1, i.e. first y2, then y3,...
    1758  Decrease E, jump to 58 if E not 0 else next c.
5c  77XX  E <- ii=(NN-1). Now AB contains (y1+yn)/2 + y2+y3+...+yn-1. 
    ...   cont. on next page