Binary to Binary Coded Decimal Conversion Subroutine for PDP-8, Study Guides, Projects, Research of Number Theory

A subroutine for converting binary data to binary-coded-decimal (BCD) format for typeout, magnetic tape recording, etc. The subroutine uses 33 storage locations and requires a standard PDP-8. It is called by the JMS instruction and returns the BCD result in the accumulator.

Typology: Study Guides, Projects, Research

2021/2022

Uploaded on 09/27/2022

mjforever
mjforever 🇺🇸

4.8

(25)

254 documents

1 / 8

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
1. IDENTIFICATION
1.1 Digital-8-14-U-Sym
1.2
Binary to Binary Coded Decimal Conversion
1.3
March 10, 1965
PDP-B
LIBRARY
pf3
pf4
pf5
pf8

Partial preview of the text

Download Binary to Binary Coded Decimal Conversion Subroutine for PDP-8 and more Study Guides, Projects, Research Number Theory in PDF only on Docsity!

1. IDENTIFICATION

1.1 Digital-8-14-U-Sym

1.2 Binary to Binary Coded Decimal Conversion

1.3 March 10, 1965

PDP-B

LIBRARY

Digital-8-14-U-Sym Page 3

After eight pases through the basic loop, the developed BCD representation is shifted left four bits and the "residual" least significant digit is added before exit.

6.2 Example

As an example consider the conversion of the binary equivalent of 512 decimal: 00 1 000 000 000 Successive calculations to obtain the most significant BCD digit are as follows: Link

a

a

Addition 00 1 000 000 000

11 a a 11 100 000

111 all 100 000

111 00 1 11 a 000

000 00 1 11 a 000

000 001 11 a 000

111 110 all 100

Notice that the remainder is the binary representation of 12 decimal. Writing

the I ink bits in the order they are developed gives 0101 the BCD character denoting 5.

6.3 Scaling

The original binary number must be no larger than 999 (decimal) which is equiva- lent to 1747 (octal). The binary point is assumed to be at the extreme right end of the word (to the right of bit position 11) and the decimal point is also so positioned.

and 11. 1 •

In other words, this subroutine converts binary integers to BCD integers. Note that the subroutine is designed for positive input only!

METHOD

Algorithm The algorithm is straightforward and is fully described in sections 6.1, 10.4,

EXECUTION TIME

Minimum

Digital-8-14-U-Sym

Page 4

Minimum execution time will occur when the number to be converted is from 0

to 9 inclusively. In this case, the execution time will be precisely 216.0 microseconds.

9.2 Maximum

Max imum execution time wi II occur when the number to be converted happens to

be 7.7X (decimal where X may represent any decimal digit). This time is precisely 235.

microseconds.

9.4 Tim ing Equation

Execution time for a particular BCD result may be calculated from the following

formula,

TIME = 216.0 + N x 3.

where N represents the number of bits of the two most significant BCD digits that are equal to

one.

For example, the binary equivalent of the decimal number 512 (010 100 010 010)

will take exactly

216.0 + 3X3.2 = 225.6 microseconds

to convert.

10. PROGRAM

10.4 Program Listing

A Iisting of the program with BCD located in 0200 appears as follows:

IBINARY TO BCD CONVERSION 3/6/65-DEC

IENTER WITH BINARY NUMBER «999(10))

liN ACCUMULATOR; EXIT WITH THREE CHARACTER

IBCD NUMBER IN ACCUMULATOR

lAC 0-3; AC 4-7; AC 8-11 WILL CONTAIN

ITHE BCD CHARACTERS Oi.l EXIT

IWEIGHTING: AC 0-3 100

I AC4-7 10 I AC 8-11 1

ISTORAGE 33(10) REGISTERS

11. DIAGRAM

11. 1 Flow Chart

POINTER

(L)·O

CLA TAD NUMBER RAL ISZ POINTER

SNL

ENTER

DATA -+ INPUT (CDNTROLl-+ POINTER CLL (COUNTl-+AC

(AC) _NUMBER TAD INPUT TAD TABLE

(L )'

(AC)_INPUT

CLL RTL CLL RTL TAD INPUT JMP I BCD

RETURN

Digital-8-14-U-Sym Page 6