Digital PDFs
Documents
Guest
Register
Log In
DIGITAL-8-14-U
December 2000
8 pages
Original
0.3MB
view
download
Document:
digital-8-14-u-d
Order Number:
DIGITAL-8-14-U
Revision:
Pages:
8
Original Filename:
https://svn.so-much-stuff.com/svn/trunk/pdp8/src/dec/digital-8-14-u/digital-8-14-u-d.pdf
OCR Text
IDENTIFICATION I .I DigifaI-8-I4-U—Sym I.2 Binary to Binary Coded Decimal Conversion I .3 March I0, I965 PDP-B LIBRARY Digital-8— l4-U-Sym Page 2 ABSTRACT 2. This subroutine provides the basic means of converting binary data to binary- coded-decimal (BCD) data for typeout, magnetic tape recording, etc. 3. REQUIREMENTS 3. 1 Storage This subroutine uses 33 (decimal) storage locations. 3.3 Equipment Standard PD P—8. 4. USAGE 4.2 Calling Sequence The subroutine is called by the JMS instruction. to When called, the binary number be converted must be in the accumulator (AC). The subroutine will return to the instruction immediately following the calling JMS with the BCD result in the AC. 6. DESCRIPTION 6.l Discussion Reference to the Flow Chart (Section II. I) will illustrate this discussion. pointer is initialized, the link is cleared and a counter to control the number ofpasses through the computation loop proper is properly set. On input the binary number is stored, The loop is now entered. It will be repeated eight times. The binary equivalents of 800, successively from the original a 400, 200, IOO, 80, 40, 20, and IO are subtracted binary number. After each subtraction, a test on the link is made. If the result of the test shows the link to be 0, the next lower equivalent is subtracted from the same quantity after the contents of the links (0) are shifted into the developing BCD number (Location NUMBER). If the subtraction leaves a negative link, the contents of the accumulator replace the binary representation currently being processed after the contents of the link been shifted into the growing BCD number. (I) have Digital-8— l4-U—Sym Page 3 After eight poses 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 5l2 decimal: OOl 000 000 000 Successive calculations to obtain the most significant BCD digit are as follows: Link Addition 001 000 000 000 HO OH 100000 O -800 lllOlllOOOOO 001 000 000 000 Hi 00] llOOOO l —400 000 CM HQ 000 000 OOl 110 000 ill llOOOl 000 O —200 lllllllllOOO 000001 110000 111110011100 1 —100 000 000 001 100 Notice that the remainder is the binary representation of l2 decimal. Writing the link bits in the order they are developed gives OlOl the BCD character denoting 5. 6.3 Scaling binary number must be no larger than 999 (decimal) which is equiva— lent to l747 (octal). The binary point is assumed to be at the extreme right end of the word (to the right of bit position ll) and the decimal point is also so positioned. The original In other words, this subroutine converts binary integers to BCD integers. Note that the subroutine is designed for positive input only.' 7. METHOD 7.2 Algorithm The algorithm is straightforward and is fully described in sections 6. l , l0.4, and ll . l . Digital-8- I4—U-Sym Page 4 9. EXECUTION TIME 9.I Minimum 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 2l6.0 microseconds. Maximum 9.2 Maximum execution time will occur when the number to be converted happens to be 7.7X (decimal where X may represent any decimal digit). microseconds 9.4 This time is precisely 235.2 . Timing Equation Execution time for a particular BCD result may be calculated from the following formula, TIME = 2T6.0 + N x 3.2 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 5I2 (0I0 I00 0I0 OIO) will take exactly 2I6.0 + 3X3.2 = 225.6 microseconds to convert. IO. PROGRAM l0.4 Program Listing A listing of the program with BCD located in 0200 appears as follows: /BINARY TO BCD CONVERSION 3/6/65-DEC /ENTER WITH BINARY NUMBER (<999(I0)) /IN ACCUMUIATOR; EXIT WITH THREE CHARACTER /BCD NUMBER IN ACCUMULATOR /AC 0-3; AC 4-7; AC 841 WILL CONTAIN /THE BCD CHARACTERS. ON EXIT AC 0-3 100 /WEIGHTING: AC 4—7 To / AC 8-11 I / REGISTERS /STORAGE 33(I 0) Digital-8—14-U—Sym Page 5 /T1ME=216.0-235.2 MICRO-SECONDS PDP—8 /lF INPUT >999 (10) RESULT IS UNSPECIFIED 0200 0000 0201 3226 DCAIhWUT 0202 1225 TAD CONTRL 0203 3210 DCA POINTR 0204 7100 (ILL 0205 1230 'DAD‘CCDUPJT 0206 3227 DCA NUMBER 0207 1226 TADIhWUT 0210 1231 BCD, POINTR, 0 TAD TABLE 0211 7430 SZL. 0212 3226 DCAIhWUT 0213 7200 (ILA 0214 1227 TAD NUMBER 0215 7004 ILAL 0216 2210 ISZ POINTR 0217 7420 SPJL 0220 5206 JMP POINTR.-2 0221 7106 CLL RTL 0222 7006 RTL 0223 1226 0224 5600 TADIhWUT JAAPI BCE) 1231 0226 0000 0227 0000 0230 0020 0231 6340 0232 7160 -0620 /OR TABLE+I, TABLE+2, ETC. /|F C(L)=I, INPUT>—TABLE /IFSO: INPUT=INPUT+TABLE /PUT THIS BIT IN ANSWER /UPDATE TABLE POINTER /|F LINK=I, ALL DONE /CONVERTED 2 BCD /CHARACTERS /SH|FT LEFT AND ADD /THE THIRD 0 0 0020 /-800(10) /—400 /—200 /- I 00 /—8O /-40 /-20 /-10 —1440 0233 7470 -0310 0234 7634 -O144 0235 7660 —0120 0236 7730 0237 7754 -0050 -0024 0240 7766 -0012 /EXAMPLE: / /SET BIT 7:1; 8RAL'S /WILL PUT IT IN LINK 'DAD LABLE 0225 CONRL INPUT, NUMBER, COUNL TABLE, /STORE BINARY /SET UP TABLE /PO|NTERS INPUT 0726 (8) OUTPUT 0100/0111/0000 = 470 (10) Digital-8—]4_U_Sym Page 6 H. 11.1 Flow Chart ENTER DATA-DJNPUT (C0NTR0L)+ POINTER CLL (COUNT)—>AC (AC)—>NUMBER TADINPUT POINTER TAD (L)=o TABLE (L)=1 (AC)->|NPUT CLA T TAD NUMBER CLL RTL CLL RTL RAL ISZ POINTER TADINPUT JMP I 8CD RETURN (L)=o JMP PmNTER,q (L)=1
Home
Privacy and Data
Site structure and layout ©2025 Majenko Technologies