This document describes CHEW (DECUS No. 8-93), a PDP-8 subroutine developed by Louis O. Cropp of Sandia Corporation on September 14, 1967.
Purpose:
CHEW converts a double-precision (up to 6 digits) unsigned-integral Binary Coded Decimal (BCD) number into its integral-positive-binary equivalent.
Key Features:
- Precision: Handles double precision numbers, producing a two-word binary result.
- Customizable BCD: While initially configured for BCD with bit values 4, 2, 2, and 1, the subroutine allows modification of these bit values to convert any BCD format to binary.
- Input Format: Expects the BCD number to occupy two 12-bit words, with smaller numbers (1 to 6 digits) needing to be right-justified in this double-precision format.
- Output: Stores the most significant part of the binary answer in core Location 3 and the least significant part in Location 4.
Requirements:
- Hardware: Standard PDP-8 or PDP-8/S computer.
- Memory: Requires 0109 (octal) words of core storage.
- Specific Locations: Locations 3 and 4 on page zero must be temporarily available. Location 164 must contain -4, and Location 166 must contain -6.
- Self-Contained: The subroutine does not rely on any other subroutines.
Usage:
- Call using
JMS CHEW.
- The address of the most significant part of the BCD number to be converted must be placed in the location immediately following the
JMS instruction.
- Upon completion, the subroutine returns to
JMS+2, with the accumulator and link cleared.
Performance:
- Maximum execution time is approximately 5.31 milliseconds.
- Can convert numbers up to 999,999 (decimal), which fits within a positive double-precision binary word.