Showing posts with label boolean algebra. Show all posts
Showing posts with label boolean algebra. Show all posts

Wednesday, August 19, 2026

Spotlight: HP 16C Collector’s Edition

 Spotlight: HP 16C Collector’s Edition



Quick Facts: HP 16C Collector’s Edition



Model: HP 16C Collector’s Edition

Company: Hewlett Packard/Moravia


Type: RPN and Computer Science

Batteries: 2 x CR2032

Memory: Up to 34 memory registers

Programming Memory: Up to 203 memory registers

Years in Production:

Original: 1982-1989

Collector’s Edition: 2026 (limited edition)

Display: 8 digits (scrolling)


Store sites:

Europe: https://www.thecalculatorstore.com/i/the-hp16c

U.S.: https://shop.moravia.education/us/hp-16c-collector-s-edition.html





About the HP 16C


This is my first HP 16C from Hewlett Packard, and it’s a long awaited purchase. The HP 16C is a programmable calculator that is specialized in computer science. There are five main modes:


HEX: Hexadecimal integer mode (base 16, 2^4)

DEC: Decimal integer mode (base 10)

OCT: Octal integer mode (base 8, 2^3)

BIN: Binary integer mode (base 2)

FLOAT: Floating decimal mode.


The FLOAT mode is the only mode where calculations can involved fractions and non-integers. To make room for the Boolean logic and bit functions, the number of functions for floating point are limited to the reciprocal (1/x) and square root (√x).


The other four modes work with integers. The HP 16C is able to work with integers with up word sizes up to 64 bits. Each bit is is a binary bit. For example, a word size of 4 binary integers range from 0000 and 1111. Pressing [ 0 ] [ f ] [ STO ] (WSIZE) is a quick reset to a word size of 64 bits.


Integers can scroll beyond the initial screen of 8 digits, with multiple windows to show all the digits.


We have the classical Boolean functions available: AND, OR, NOT, and XOR. Part of what makes the HP 16C special is addition of bit manipulation functions:


* Shift bits left and right, including the carry over bit: SL, SR


* Arithmetic shift right, where bits are shifted right with the sign bit copied: ASR


* Rotate bits left and right: RL, RR, RL n, RR n (either a single bit or n bits); RLC, RRC, RLC n, RRC n (these are rotation functions including the carry over bit).


* Masks can be generated using the MASKL and MASKR functions.


* Integer division can be accomplished by finding the quotient (÷) and remainder (RMD).


* Finally, the HP 16C can work with double-sized words, potentially after 128 bits, with the double-multiply (DBL×), double-division (DBL÷), and double-remainder (DBLR).



The programming module can hold up to 203 steps, complete with loops, indirect addressing, testing, but no storage or recall arithmetic. Here are a couple of programs:


Integer Division: y |- x


Input Stack:
Y: dividend

X: divisor


Result: quotient, R/S, remainder


Code:


LBL D ; 001 43, 22, d

x<>y ; 002 34

STO 0 ; 003 44, 0

x<>y ; 004 34

÷ ; 005 10

R/S ; 006 31

RCL 0 ; 007 45, 0

LST x ; 008 43, 36

RMD ; 009 42, 9

RTN ; 010 43, 21


Examples


Example 1: 45 d |- 20 d = 2 d remainder 11 d

Keystrokes: DEC 45 ENTER 17 GSB D

Results: 2 d R/S 11 d


Example 2: 1F3 h |- 20 h = F h remainder 13 h

Keystrokes: HEX 1F3 ENTER 20 GSB D

Results: F h R/S 13 h


Hexadecimal: Showing One Hexadecimal Digit at a Time, From Right to Left


This program creates and then manipulates the mask to display each digit.


_ _ _ #

_ _ # 0

_ # 0 0

# 0 0 0


Code:


LBL A ; 001 43, 22, A

STO 0 ; 002 44, 0

CL x ; 003 43, 35

WSIZE ; 004 42, 44

HEX ; 005 23

F ; 006 F

ENTER ; 007 36

1 ; 008 1

+ ; 009 40

WSIZE ; 010 42, 44


RCL 0 ; 011 45, 0

4 ; 012 4

MASK4 ; 013 42, 8

AND ; 014 42, 40

R/S ; 015 31


3 ; 016 3

STO I ; 017 44, 32

LBL 0 ; 018 43, 22, 0

LST x ; 019 43, 36

4 ; 020 4

RL n ; 021 42 E

RCL 0 ; 022 45, 0

x<>y ; 023 34

AND ; 024 42, 20

R/S ; 025 31

DSZ ; 026 43, 23

GTO 0 ; 027 22, 0

RTN ; 028 43, 21


Examples


4F37 h GSB A: 1 R/S 20 R/S 400 R/S 5000


17695 d GSB A: F R/S 10 R/S 500 R/S 4000 (451F h)


The speed of the HP 16C Collector’s Edition is comparable to the HP 15C Collector’s Edition. I found the keys to be responsive and reliable.


Eddie


Sources:


“HP-16C” The Museum of HP Calculators. https://www.hpmuseum.org/hp16.htm Retrieved August 17, 2026.


Hewlett Packard. HP 16c Collector’s Edition: Owner’s Handbook. Edition 2, November 2025. From the HP Calculator Literature website: https://literature.hpcalc.org/items/2714





Eddie


All original content copyright, © 2011-2026. Edward Shore. Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited. This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author.


Saturday, June 25, 2022

Retro Review: Hewlett Packard HP 33S

Retro Review:   Hewlett Packard HP 33S








The calculator with the Chevron Keyboard!

Quick Facts

Model:  HP 33S
Company:  Hewlett Packard
Years:  2003-2007
Type:  Scientific
Batteries: 2 x CR-2032
Operating Modes:  RPN, ALG
Memory:  31,277 bytes
Number of Registers: 27, A-Z, i
Display:  2 stack levels

Features

*  standard scientific calculator functions: trig, logs, power, absolute value, integer and fractional part, combinations, permutations, random numbers, hyperbolic functions, and more
*  factorial function that allows real numbers;  Γ(x) = (x - 1)!
*  polar and rectangular conversion functions,  very popular (for good reason) 
*  40 scientific constants
*  8 sets of SI-US conversions
*  base conversions 
*  algebraic mode (which I don't know anyone who would use this calculator in algebraic mode, but it's there)
*  linear regression  (y = mx + b)
*  fraction display mode ( [ ←| ] [ . ] (FDISP))
*  storage and recall arithmetic

We can store equations for evaluation, solving, and integration.  

Full list of conversions:

Polar (→θ,r) - Rectangular (→y,x)
Hours (→HR) - Hours-Minutes-Seconds (→HMS)
Degrees - Radians
Kilograms - Pounds
Degrees Celsius - Degrees Fahrenheit
Centimeters - Inches
Liters - Gallons

Programming

The HP 33S has keystroke programming and the set of commands similar from the HP 32SII:  

*  INPUT var
*  VIEW var  (views the variable without putting the variable's value on the stack)
*  Subroutines and Return
*  Comparison tests between x and 0, x and y.  If the test is true, execute the next step, otherwise skip the next step
*  ISG:  Increment and skip if greater
*  DSE:  Decrement and skip if equal or less than

The HP 33S designates one register, lower case i, for indirect addressing.  The absolute integer value of i determines where storage, recall, label, subroutine, integration variable, exchange, and function designation.  Use (i) to use indirect addressing.  Indirect registers can also access statistical sums:

(i) = 27,  i 
(i) = 28,  n
(i) = 29,  Σx
(i) = 30,  Σy
(i) = 31,  Σx^2
(i) = 32,  Σy^2
(i) = 33,  Σxy

The HP 33S has 26 labels, which restrict programs to 26.  Hence, LBL A instead of LBL A0001.   At first, I didn't like the restriction, but I learned to live with it and don't mind it as much.  

Let's Talk About the Chevron Keyboard

The HP 33S is a unique calculator it's keyboard style:  the keys take a slanted quadrilateral shape, with the center column of keys taking a chevron style shape.   At the top there is a directional pad.  Hewlett Packard took a chance with the design from the standard calculator shape, and it was not a homerun.   

The beginning production of the HP 33S was not successful. Keys had bad responses, the display was not up to par, and some keys are hard to press.   It took Hewlett Packard several production runs to get the keyboard working right, which unfortunately killed the reputation of the HP 33S.  Towards the end of its run, the keyboards were fixed.

I don't mind the unique keyboard, my biggest issue was the spacing the keys where sometimes the shifted functions and alpha characters did not have much space.  This made the keyboard busy.  I also do not like the black arrows on the green and purple backgrounds on the shift keys, I use HP used a lighter font for those arrows.  

A Phoenix of Calculators  

When the HP 33S first hit the market, the calculator was disliked.  Now, it is a sought after calculator.   The original price for the 33S was about $50 US dollars, now if you want one, be prepared to pay at least $75 US dollars, sometimes triple digits.  Make sure you are buying the HP 33S from later in the run (towards 2007).  

Another factor of why the HP 33S is becoming a collector's calculator, the successor, the HP 35S, had several shortcomings such as the number of mathematical bugs and the lack of the rectangular and polar conversion functions.   The HP 33S is closer to the classic style, like the HP 32S and HP 32SII.  

I don't expect to ever be an anniversary edition of the HP 33S but it was an underrated calculator and has its place in calculator history.

Tomorrow I have a list of programs and an integer demonstration.  

Eddie

All original content copyright, © 2011-2022.  Edward Shore.   Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited.  This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author. 



Sunday, April 18, 2021

Swiss Micros DM16L: Advanced Boolean and Factorial (up to 20)

Swiss Micros DM16L:   Advanced Boolean and Factorial (up to 20)


Introduction


The program listing, for the Swiss Micros DM16L and Hewlett Packard HP 16C,  will assign the following functions to the labels:


A:  NAND:   nand(x, y) = not(x and y)

B:  NOR:   nor(x, y) =  not(x or y)

C:  XNOR:  xnor(x, y) = (not x and not y) or (x and y)

D:  Implication:  y → x = (not y) or x

E:  Factorial:  x!  (x is a positive integer up to 20, 64 word size


NAND, NOR, NXOR, and Implication are advanced Boolean functions.  You can check out program code for the HP Prime here:


http://edspi31415.blogspot.com/2020/03/hp-prime-advanced-boolean-functions.html


Program - DM16L/HP 16C


// NAND

001 43,22,A LBL A

002 42,20   AND

003 42,30   NOT

004 43,21   RTN


// NOR

005 43,22,b LBL B

006 42,40   OR

007 42,30  NOT

008 43,21  RTN


// XNOR

009 43,22,C LBL C

010 44,1    STO 1

011 42,30  NOT

012 34      x<>y

013 44,2    STO 2

014 42,30   NOT

015 42,20   AND

016 45,1    RCL 1

017 45,2    RCL 2

018 42,20  AND

019 42,40   OR

020 43,21   RTN


// Implication

021 43,22,d LBL D

022 34      x<>y

023 42,30   NOT

024 42,40   OR

025 43,21   RTN


// Factorial

026 43,22,E LBL E

027 44,32  STO I

028 1      1

029 44,1    STO 1

030 43,22,1 LBL 1

031 45,1    RCL 1

032 45,32   RCL I

033 20      ×

034  44,1    STO 1

035 43,23   DSZ

036 22,1    GTO 1

037 45,1    RCL 1

038 43,21   RTN


Examples


Let:

R1 = 1011 0001

R2 = 1100 1100


Set up: 2-16-0000 (2's complement, 16 bits)


RCL 2, RCL 1, GSB A NAND(R2, R1):  0111 1111*

RCL 2, RCL 1, GSB B NOR(R2, R1): 0000 0010*

RCL 2, RCL 1, GSB C XNOR(R2, R1): 1000 0010*

RCL 2, RCL 1, GSB D R2 → R1:  1100 1110* 

* only the last eight bits 


Set word size to 64:

0 [ f ] [ STO ] (WSIZE)


5 GSB E 5! = 120

9 GSB E 9! = 362880*


* if the word size is insufficient, it will not show 362880 but a weird result as an overflow


12 GSB E   (64 word size)

12! = 4 79001600

Window 1:  4

Window 0:  79001600


20 GSB E

20! = 243 29020081 76640000

Window 2: 243

Window 1: 29020081

Window 0: 76640000


Source for the Advanced Boolean Functions:


John W. Harris and Horst Stocker.  Handbook of Mathematics and Computation Science  Springer:  New York, NY.  2006.  ISBN 978-0-387-94746-4



Eddie


All original content copyright, © 2011-2021.  Edward Shore.   Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited.  This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author. 


Monday, February 15, 2021

Review: Swiss Micros DM16L

Review: Swiss Micros DM16L






Welcome to a special Monday edition of Eddie’s Math and Calculator blog!


General Information


Company:  SwissMicros, https://www.swissmicros.com

Type:  Programmable Scientific - Boolean Algebra

Memory: 203 steps, shared with memory registers; 32 MB external flash

Battery:  CR 2032

Connection:  USB-B

Cost:  119 CHF, about $132.38 USD (2/5/2021)

Current Software Version:  DM16_31, 7/21/2020

Case Included?  Yes

Operating System: RPN (Reverse Polish Notation)


A Programmer’s Paradise

The Swiss Micros DM16L, and it’s small version, the DM16, is a clone of the highly popular and sought after Hewlett Packard HP 16C.  The functions are suited to computer science, including:


One key conversions between Hexadecimal (base 16), Octal (base 8), Decimal (base 10), and Binary (base 2) integers.  


Boolean features including AND, OR, NOT,  XOR


Bit shift and rotating functions, masking bits, and double division, remainder, and multiplication


There is a separate floating point arithmetic mode, separate from decimal integer mode.


You can customize integers up to 64 bits by the WSIZE function.  A handy shortcut is to set integers up to 64 bits is done by the key sequence:  0 [ f ] [ STO ] (WSIZE)


Negation of integers are determined by one of three modes:  1’s Complement, 2’s Complement, and Unsigned Numbers.    


If that isn’t enough, you can manipulate and test specific bits with the SB (set bit), CB (clear bit), and B? (is the bit set) commands. 


The STATUS command gives the user a three number status #-##-####. 


The first number is the complement mode:  0 for unsigned, 1 for 1’s complement, 2 for 2’s complement.


The second number is the current wordsize, from 1 bit to 64 bits.


The third number is the status of the four user flags 0 to 3, in descending order (flag 3, flag 2, flag 1, flag 0):  0 for clear, 1 for set.  The user flags are used in programming.


Programming


If you have programmed on the original HP-16C, then you would be right at home programming with the DM16L, with all the key codes and positions intact.   There are eight comparison tests available:  x≤y, x<0, x>y, x>0, x≠y, x≠0, x=y, x=0.   Up to 16 labels can be used, labels 0-F.  The special registers I and (I) are used for indirect storage and branching.   The DSE and ISZ use register I.


Curiously missing is storage arithmetic.   For example, instead of STO+ #, the following sequence of commands must be used:  (number), RCL #, +, STO #.  


Sample Programs


Integer Division:  Quotient and Remainder


001 LBL A         43,22,A

002 STO 0 44,0

003 X<>Y 34

004 STO 1 44, 1

005 X<>Y 34

006 ÷ 10

007 R/S 31

008 RCL 1 45, 1

009 RCL 0 45, 0

010 RMD 42, 9   \\ remainder command

011 RTN 43, 21


Example:  Word size = 16


Decimal Integer Mode (DEC):   41 / 7 = 5, remainder 6

Y:  41, X:  7 [ GSB ] [ A ]

Result:   5, [ R/S ], 6


Hexadecimal Integer Mode (HEX):  FE2 / 81 = 1F, remainder 43

Y:  FE2, X: 81 [ GSB ] [ A ]

Result:  1F, [ R/S ], 43


Adding Both the 1’s and 2’s Complement


001 LBL B 43, 22, B

002 STO 1 44, 1

003 Set 1’s 42, 1

004 CHS 49

005 STO 0 44, 0

006 RCL 1 45, 1

007 Set 2’s 42, 2

008 CHS 49

009 RCL 0 45, 0   // storage arithmetic is not available

010 + 40

011 STO 0 44, 0

012 RTN 43, 21


Examples:  Word Size = 8


Hexadecimal Integer Mode (HEX)

x = 2D

Result:  A5  (D2 + D3)


Hexadecimal Integer Mode (HEX)

x = F6

Result:  13  (9 + A)


Remember: Word size is important, as your mileage may vary.  


Verdict

Swiss Micros continues to manufacture quality calculators.  Due to the rarity and highly sought after HP 16C, the price to obtain one may be out of reach.  The DM16L is a much more affordable alternative.  The calculator is solid, keys feel great, and the added connectivity is an added bonus.  


Eddie


All original content copyright, © 2011-2021. Edward Shore.   Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited.  This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author. 


Python in Numworks: Duplicating and Grayscale

Python in Numworks: Duplicating and Grayscale All three scripts presented today use the math, random, and the Numworks specific ...