0001****************************************************************** 0002*** 0003*** HP 2116A/2115A Computer System 0004*** 2752A Teleprinter Basic Binary Loader 0005*** 0006*** Original: 1967 0007*** This re-creation: Apr 2004 / bhilpert 0008*** 20 Feb 2008, asm21.pl conversion by Tim Riker 0009*** 0010****************************************************************** 0011* 0012* This is a recreation of the Basic Binary Loader for use with the 0013* 2752A Teleprinter (teletype). This recreation is based on a disassembly of 0014* the data found in the "Standard Systems Software Operating Manual" 0015* for the HP 2116A/2115A computer. 0016* 0017* The I/O interface board presumably is a 12531A. The program reads 0018* serial bits from the interface, where the data bit shows up in 0019* bit 7 of the interface input register. Presumably the interface 0020* synchronized a bit clock to a received start bit and then set the 0021* interface flag bit in accordance with the 11 following bit clock cycles. 0022* 0023* Input consists of a sequence of blocks terminated by a minimum of 10 null bytes: 0024* 0025* = ... 0 0 0 0 0 0 0 0 0 0 0026* 0027* where each block is a sequence of bytes: 0028* 0029* = 0030* ... _HI_BYT> _LO_BYT> 0031* 0032* = the number of data words in the block. 0033* The checksum is the sum of the address word and the data words. 0034* 0035* Note the channel select code may need to be altered as per system configuration. 0036* 0037* Termination codes displayed in T register: 0038* 77 - normal 0039* 11 - checksum error 0040* 55 - addressing/range error 0041* 0042****************************************************************** 0043* Configuration 0045* machine HP21xx 0047 00010 TtyChannel EQU 10B used in 4 places in ReadByte 0048 00000 A EQU 0 0049 00001 B EQU 1 0052****************************************************************** 0053* 0054* Start Teleprinter Loader 0055* 0056****************************************************************** 0057* org 007700B for 4K of memory 0058 17700 org 017700B for 8K of memory 0060 17700 103700 Start STC 0,C 0062 17701 006401 CLB,RSS 0063 17702 067771 _nextBlock LDB ConstNeg11 look for 10 null bytes 0064 17703 006006 _again INB,SZB terminate if 10 null bytes seen 0065 17704 027710 JMP _loadLength 0066 17705 102700 STC 0 0067 17706 102077 HLT 77B terminated due to end-of-tape 0068 17707 027700 JMP Start repeat if user restarts 0070 17710 017752 _loadLength JSB ReadByte read length byte 0071 17711 002003 SZA,RSS if null then 0072 17712 027703 JMP _again ignore byte, go count down 0074 17713 003004 CMA,INA negate length so we can count up to 0 0075 17714 073772 STA blmLength save length 0076 17715 017752 JSB ReadByte skip a byte 0077 17716 017743 JSB ReadWord read address 0078 17717 070001 STA B B will be checksum, address included 0079 17720 073773 STA blmAddress save address 0081 17721 063773 _wordLoop LDA blmAddress get destination address 0082 17722 000040 CLE 0083 17723 043774 ADA AddrLimit and check for range 0084 17724 002040 SEZ 0085 17725 027741 JMP _errAddress 0086 17726 017743 JSB ReadWord get a data word 0087 17727 044000 ADB A add to checksum 0088 17730 173773 STA blmAddress,I and put it in memory 0089 17731 037773 ISZ blmAddress 0090 17732 037772 ISZ blmLength if blmLength less than 0 then 0091 17733 027721 JMP _wordLoop get next word 0093 17734 017743 JSB ReadWord read checksum 0094 17735 054000 CPB A if checksums match then 0095 17736 027702 JMP _nextBlock OK, go load next block 0096 17737 102011 HLT 11B terminate with checksum error 0097 17740 027700 JMP Start 0098 17741 102055 _errAddress HLT 55B terminate with addressing/range error 0099 17742 027700 JMP Start 0102*----------------------------------------------------------------- 0103* Read a Word 0104* word is returned in A 0106 17743 000000 ReadWord NOP 0107 17744 017752 JSB ReadByte get upper 8 bits into A 0108 17745 001727 ALF,ALF and shift up 0109 17746 073775 STA wordTmp store them temorarily 0110 17747 017752 JSB ReadByte get lower 8 bits into A 0111 17750 033775 IOR wordTmp OR in the upper bits 0112 17751 127743 JMP ReadWord,I return 0115*----------------------------------------------------------------- 0116* Read a Byte 0117* byte is returned in A 0119 17752 000000 ReadByte NOP 0120 17753 063771 LDA ConstNeg11 count 11 times up to 0 (start bit, 8 data, 2 stop) 0121 17754 073776 STA readBitCnt 0122 17755 002400 CLA start with 0 byte 0123 17756 102710 STC TtyChannel start the paper tape reader 0124 17757 001300 _readBit RAR rotate bits down 0125 17760 103110 CLF TtyChannel prepare to receive a bit 0126 17761 102310 SFS TtyChannel wait 0127 17762 027761 JMP *-1 0128 17763 102410 MIA TtyChannel OR bit 7 from device into A 0129 17764 037776 ISZ readBitCnt if end of frame 0130 17765 027757 JMP _readBit wait for next bit 0131 17766 001222 RAL,RAL rotate back to get rid of 2 stop bits 0132 17767 013777 AND ByteMask and mask so we have just 8 desired bits 0133 17770 127752 JMP ReadByte,I return 0136****************************************************************** 0137* Data 0139 17771 177765 ConstNeg11 OCT 0-11 0140 17772 000000 blmLength OCT 0 0141 17773 000000 blmAddress OCT 0 0142* AddrLimit OCT 170100B for 4K of memory 0143 17774 160100 AddrLimit OCT 160100B for 8K of memory 0144 17775 000000 wordTmp OCT 0 0145 17776 000000 readBitCnt OCT 0 0146 17777 000377 ByteMask OCT 000377B 0148****************************************************************** A 000000 01/0048 -- 01/0087 01/0094 AddrLimit 017774 01/0143 -- 01/0083 B 000001 01/0049 -- 01/0078 ByteMask 017777 01/0146 -- 01/0132 ConstNeg11 017771 01/0139 -- 01/0063 01/0120 ReadByte 017752 01/0119 -- 01/0070 01/0076 01/0107 01/0110 01/0133 ReadWord 017743 01/0106 -- 01/0077 01/0086 01/0093 01/0112 Start 017700 01/0060 -- 01/0068 01/0097 01/0099 TtyChannel 000010 01/0047 -- 01/0123 01/0125 01/0126 01/0128 _again 017703 01/0064 -- 01/0072 _errAddress 017741 01/0098 -- 01/0085 _loadLength 017710 01/0070 -- 01/0065 _nextBlock 017702 01/0063 -- 01/0095 _readBit 017757 01/0124 -- 01/0130 _wordLoop 017721 01/0081 -- 01/0091 blmAddress 017773 01/0141 -- 01/0079 01/0081 01/0088 01/0089 blmLength 017772 01/0140 -- 01/0075 01/0090 readBitCnt 017776 01/0145 -- 01/0121 01/0129 wordTmp 017775 01/0144 -- 01/0109 01/0111 19 symbols 148 lines assembled, 64 words generated 0 errors, 0 warnings