- 4775DCD387FD903F856A9EC5AD9A1A526C4DEE9C146B5393A958608E2ABDE97C75A92F32891804B3058C4316AA0399FCA0713F17C78319E836D76CC93BAADDF4+ B9B8701B08B296B3B28D8D4300D28DB362AA620804FBBBDBC47E5A96AF9ECFC4AE164B17F38739091985CC0C0D8006A9D128A00B544013D15F2E5E3630703EC0ffa/ffacalc/ffa_calc.adb(32 . 6)(32 . 8)
5 with FZ_Pred; use FZ_Pred;
6 with FZ_BitOp; use FZ_BitOp;
7 with FZ_Shift; use FZ_Shift;
8 with FZ_Divis; use FZ_Divis;
9 with FZ_Mul; use FZ_Mul;
10
11 -- For Output
12 with FFA_IO; use FFA_IO;
(147 . 6)(149 . 15)
14 end Want;
15
16
17 -- Ensure that a divisor is not zero
18 procedure MustNotZero(D : in FZ) is
19 begin
20 if FZ_ZeroP(D) = 1 then
21 E("Division by Zero!");
22 end if;
23 end MustNotZero;
24
25
26 -- Slide a new hex digit into the FZ on top of stack
27 procedure Ins_Hex_Digit(N : in out FZ;
28 D : in Nibble) is
(316 . 6)(327 . 43)
30 Flag := W_NZeroP(F);
31 Drop;
32
33 -- Divide and give Quotient and Remainder
34 when '\' =>
35 Want(2);
36 MustNotZero(Stack(SP));
37 FZ_IDiv(Dividend => Stack(SP - 1),
38 Divisor => Stack(SP),
39 Quotient => Stack(SP - 1),
40 Remainder => Stack(SP));
41
42 -- Divide and give Quotient only
43 when '/' =>
44 Want(2);
45 MustNotZero(Stack(SP));
46 FZ_Div(Dividend => Stack(SP - 1),
47 Divisor => Stack(SP),
48 Quotient => Stack(SP - 1));
49 Drop;
50
51 -- Divide and give Remainder only
52 when '%' =>
53 Want(2);
54 MustNotZero(Stack(SP));
55 FZ_Mod(Dividend => Stack(SP - 1),
56 Divisor => Stack(SP),
57 Remainder => Stack(SP - 1));
58 Drop;
59
60 -- Multiply, give bottom and top halves
61 when '*' =>
62 Want(2);
63 MustNotZero(Stack(SP));
64 -- Ch5: slow and simple 'Egyptological' method:
65 FZ_Mul_Egyptian(X => Stack(SP - 1),
66 Y => Stack(SP),
67 XY_Lo => Stack(SP - 1),
68 XY_Hi => Stack(SP));
69
70 -----------------
71 -- Bitwise Ops --
72 -----------------