BOOL

Display


Overview
The BOOL program can process boolean functions and show results simultaneously. The latter may be interesting when formulaes have been optimised and the outcome must be compared. Basic function OR, AND and NOT can be invoked for 1, 2, 3 or 4 parameters. The functions F1, F2,…, Fx must be programmed as shown in the examples below. Examples of some functions are:
F1 = a.b.c.d
F2 = /(/a +/b + /c + /d)
F3 = /a.b + a./b
where the “/” represents the boolean NOT.

The program is limited to a maximum of 4 parameters. The maximum number of functions depends on the available registers and memory.

Examples

Keystrokes:               Display:             Comments:
- Run simulations for F1=a.b.c.d and F2=a+b+c+d
[XEQ][ALPHA] BOOL [ALPHA] VARS=? - Number of variables for F1 and F2
4 [R/S] F.NAME=? - Enter the label name for the first function (F1)
F1 [R/S] F.NAME=? - Enter the label name for the second function (F2)
F2 [R/S] F.NAME=? - Hit R/S if there are no further functions
[R/S] 0 0 0 0 :0:0: - F1 and F2 are 0 resp. 0 for a,b,c,d=0
[R/S] 0 0 0 1 :0:1: - F1=0 and F2=1 for a,b,c=0 d=1
[R/S] 0 0 1 0 :0:1:
[R/S] 0 0 1 1 :0:1:
[R/S] 0 1 0 0 :0:1:
[R/S] 0 1 0 1 :0:1:
[R/S] 0 1 1 0 :0:1:
[R/S] 0 1 1 1 :0:1:
[R/S] 1 0 0 0 :0:1:
[R/S] 1 0 0 1 :0:1:
[R/S] 1 0 1 0 :0:1:
[R/S] 1 0 1 1 :0:1:
[R/S] 1 1 0 0 :0:1:
[R/S] 1 1 0 1 :0:1:
[R/S] 1 1 1 0 :0:1:
[R/S] 1 1 1 1 :1:1: - F1 and F2 are 1 resp. 1 for a,b,c,d=1
[R/S] VARS=? - run another simulation



Program Listing

LINE  KEYS                LINE  KEYS              LINE  KEYS              LINE  KEYS

01 LBL'BOOL' 29 STO 05 57 STO 05 85 XEQ 14
02 LBL 00 30 CLA 58 LBL 0 86 RTN
03 1,004 31 LBL 08 59 RCL IND 05 87 LBL 04
04 CLRGX 32 RCL 07 60 X=0? 88 *
05 'VARS=?' 33 RCL 05 61 ISG IND 05 89 LBL 03
06 PROMPT 34 - 62 ST- IND 05 90 *
07 STO 07 35 1 63 X=0? 91 LBL 02
08 2 36 + 64 GTO 06 92 *
09 X<>Y 37 ARCL IND X 65 DSE 05 93 RTN
10 Y^X 38 '» ' 66 GTO 05 94 LBL 14
11 STO 06 39 DSE 05 67 LBL 06 95 +
12 9 40 GTO 08 68 DSE 06 96 LBL 13
13 STO 00 41 '»:' 69 GTO 07 97 +
14 LBL 09 42 RCL 00 70 FIX 5 98 LBL 12
15 'F.NAME=?' 43 1 E3 71 SF 29 99 +
16 AON 44 / 72 GTO 00 100 X>0?
17 PROMPT 45 10 73 LBL'F1' 101 1
18 AOFF 46 + 74 RCL 01 102 RTN
19 FC?C 23 47 STO 08 75 RCL 02 103 LBL 01
20 GTO 07 48 LBL 10 76 RCL 03 104 CHS
21 1 49 RCL IND 08 77 RCL 04 105 ISG X
22 ST+ 00 50 XEQ IND X 78 XEQ 04 106 RTN
23 ASTO IND 00 51 ARCLX 79 RTN 107 END
24 GTO 09 52 '»:' 80 LBL'F2'
25 LBL 07 53 ISG 08 81 RCL 01
26 FIX 0 54 GTO 10 82 RCL 02
27 CF 29 55 PROMPT 83 RCL 03
28 RCL 07 56 RCL 07 84 RCL 04 (185 bytes)

Functions

F1=a.b(c+d)        F1=/a.b + /a + /b      F1=a./b +/(c + /d)       F1=/a + /b + /c.d

LBL'F1' LBL'F1' LBL'F1' LBL'F1'
RCL 03 RCL 01 RCL 04 RCL 01
RCL 04 XEQ 01 XEQ 01 'NOT XEQ 01 'NOT
XEQ 12 'OR 2 RCL 02 RCL 03 RCL 02
RCL 01 XEQ 02 'AND 2 XEQ 12 'OR 2 XEQ 01 'NOT
RCL 02 RCL 01 XEQ 01 'NOT RCL 03
XEQ 03 'AND 3 XEQ 01 'NOT RCL 02 XEQ 01 'NOT
RTN RCL 02 XEQ 01 'NOT RCL 04
XEQ 01 'NOT RCL 01 XEQ 02 'AND 2
XEQ 13 'OR 3 XEQ 02 'AND 2 XEQ 13 'OR 3
RTN XEQ 12 'OR 2 RTN
RTN

Registers
R00 Number of FUNCTIONS
R01 a
R02 b
R03 c
R04 d
R05 Counter of VARS
R06 Total binary value
R07 Number of VARS
R08 Counter of FUNCTIONS
R09 -
R10-Rnn FUNCTION names

Labels
LBL00 Start
LBL01 NOT
LBL02 AND 2
LBL03 AND 3
LBL04 AND 4
LBL05 Loop around VARS+1
LBL06 Escape for LBL05
LBL07 Loop all boolean values
LBL08 Loop VARS results
LBL09 Loop FUNCTION names
LBL10 Loop FUNCTION calls
LBL11 -
LBL12 OR 2
LBL13 OR 3
LBL14 OR 4

© 2008 by Auke Hoekstra

Leave a Reply