WB BNPF dump of TIM

BNPF notation (Begin-Negative-Positive-Finish) is an old ASCII-based text file format created by Intel to specify memory contents and program PROMs and EPROMs.

BNPF (Begin-Negative-Positive-Finish), also written as BPNF (Begin-Positive-Negative-Finish).
In BNPF encoding, a single byte (8 bits) would be represented by a highly redundant character framing sequence starting with a single uppercase ASCII “B”, eight ASCII characters where a “0” would be represented by a “N” and a “1” would be represented by a “P”, followed by an ending ASCII “F”. These ten-character ASCII sequences were separated by one or more whitespace characters, therefore using at least eleven ASCII characters for each byte stored (9% efficiency). The ASCII “N” and “P” characters differed in four bit positions, providing excellent protection from single punch errors.

Structure of BNPF Format

  • Brackets: Every data word field begins with the letter B (Begin) and ends with F (Finish/Final).
  • Bit Values: Characters between B and F represent data bits using P (Positive) for high/1 or N (Negative) for low/0, ordered from most to least significant.
  • Don’t Care: An X character can be used inside the sequence to represent a wildcard or “don’t care” bit.
  • Repetition: The syntax BPNF allows a number N to repeat the previous word field multiple times.
  • Comments: Any text or comments outside of the B…F blocks (provided they do not contain the letters B or F) are ignored by the programmer

Example of BNPF output

.M  7000 85 F9 A9 23 D0 55 A9 16

85 = 10000101 
    BPNNNNPNPF 

.WB 7000 7100
7000 BPNNNNPNPF BPPPPPNNPF BPNPNPNNPF BNNPNNNPPF
     ^^^^^^^^^^
.WH 7000 7100
;18700085F9A923D055A9168D036EA208BDF7739DF7FFCAD0F786EA0F19
       ^^

More examples: notice the removal of the B character from the address. According to the specification, also the F character should be removed, but the routine responsible (ASCI in Write hex routines) only checks for B.

.WB B000 B100
 000 BNNNNNNNNF BNNNNNNNNF BNNNNNNNNF BNNNNNNNNF
 004 BNNNNNNNNF BNNNNNNNNF BNNNNNNNNF BNNNNNNNNF
 008 BNNNNNNNNF BNNNNNNNNF BNNNNNNNNF BNNNNNNNNF
 00C BNNNNNNNNF BNNNNNNNNF BNNNNNNNNF BNNNNNNNNF

.WB 70B0  7100
70 0 BNNNNNNPPF BNNPNNNNNF BNPPPNPNNF BNPPPNNPPF
.

Here the official definition of BNPF code from the Intel Memory Design handbook 1975, page 8-28 and 8-29.

0481   723B E6 FD       WB     INC SAVX          ; SAVX TO = NCMDS FOR ASCII SUB/R
0482   723D A5 E4       WB1    LDA WRAP          ;IF ADDR HAS WRAPPED AROUND
0483   723F D0 F7              BNE BCCST         ;THEN TERMINATE WRITE OPERATION
0484   7241             ;
0485   7241 A9 04              LDA #4
0486   7243 85 EC              STA ACMD
0487   7245 20 8A 72           JSR CRLF
0488   7248 20 9A 72           JSR WROA          ; OUTPUT HEX ADR
0489   724B             ;
0490   724B 20 77 73    WBNPF  JSR SPACE
0491   724E A2 09              LDX #9
0492   7250 86 FE              STX TMPC          ; LOOP CNT =9
0493   7252 A1 E5              LDA (TMP0-9,X)
0494   7254 85 FF              STA TMPC2         ; BYTE TO TMPC2
0495   7256 A9 42              LDA #'B'
0496   7258 D0 08              BNE WBF2          ; WRITE B
0497   725A             ;
0498   725A A9 50       WBF1   LDA #'P'
0499   725C 06 FF              ASL TMPC2
0500   725E B0 02              BCS WBF2
0501   7260 A9 4E              LDA #'N'
0502   7262             ;
0503   7262 20 C6 72    WBF2   JSR WROC          ; WRITE N OR P
0504   7265 C6 FE              DEC TMPC
0505   7267 D0 F1              BNE WBF1          ; LOOP
0506   7269 A9 46              LDA #'F'
0507   726B 20 C6 72           JSR WROC          ; WRITE F
0508   726E             ;
0509   726E 20 97 73           JSR INCTMP
0510   7271             ;
0511   7271 C6 EC              DEC ACMD          ; TEST FOR MULTIPLE OF FOUR
0512   7273 D0 D6              BNE WBNPF
0513   7275             ;
0514   7275 20 C1 70           JSR DCMP
0515   7278 B0 C3              BCS WB1           ; LOOP WHILE EA GT OR = SA
0516   727A 90 BC              BCC BCCST
0517   727C             ;
0518   727C 48          CADD   PHA               ; SAVE A
0519   727D 18                 CLC
0520   727E 65 F2              ADC TMP4
0521   7280 85 F2              STA TMP4
0522   7282 A5 F3              LDA TMP4+1
0523   7284 69 00              ADC #0
0524   7286 85 F3              STA TMP4+1
0525   7288 68                 PLA               ; RESTORE A
0526   7289 60                 RTS

0262   70C1 38          DCMP   SEC               ; TMP2-TMP0 DOUBLE SUBTRACT
0263   70C2 A5 F0              LDA TMP2
0264   70C4 E5 EE              SBC TMP0
0265   70C6 85 E5              STA DIFF
0266   70C8 A5 F1              LDA TMP2+1
0267   70CA E5 EF              SBC TMP0+1
0268   70CC A8                 TAY               ; RETURN HIGH ORDER PART IN Y
0269   70CD 05 E5              ORA DIFF          ; OR LO FOR EQU TEST
0270   70CF 60                 RTS

0478   7238 4C 86 70    BCCST  JMP START

What is happening here?
This routine is called from the W command handler if after the W the character B is typed by the user. So the command paraneters start and end addresa re already parsed
– start address in TMP0
– end address in TMP0+2

  • save this command in NCMDS for ASCI routine, called from WROB write byte as two hex characters (481)
  • loop address range
    • if address wrap around we rare finished, return to START (482-483)
    • ACMD = 4 to have four bytes per line (485-487)
    • loop ACMD 4 times
      • CRLF + print address via WROA, see hex routines (487-488)
        • print space
        • TMPC = 9 characters to print (491-492)
        • TMPC2 is byte to print as BNPF format
        • print B
        • loop TMPC
          • shift TMPC2 bit in to carry (499)
          • if carry set print P else print N (498-505)
        • print F (506)
      • next address (514)
  • jump to start (516, 478)

Note WROA calls ASCII, to perform the byte to ASCII conversion, There the command code in NCMDS is ued to suppress the B in the address, the address is considered to be a comment to the PROM programmer device.