define (VERSION,' PROM version 2 May 82') define (TABSPACE,' ') # one tab and one space define (LUNIN,4) # define (LUNOUT,3) # define (LUNERR,5) # errors go to terminal define (MEMSIZ,4096) # size in bytes of the PROM programmer # memory, in decimal define (HEXMEMSIZ,1000) # memory size in HEX # define (BUFSIZ,<2*MEMSIZ>) # this parameter must be double # the number of bytes that can be # stored in the PP memory # # include constant definition if not defined ifnotdef (PP) include/ prmdef.rat endifdef # program prom # ################################################################################ # Program for programming, listing and verifying PROMs. # # # Please refer to the 'SYSTEM 19 UNIVERSAL PROGRAMMER 990-1902 # INSTRUCTION MANUAL'. # # pages | topic # ----------------------|------------------------------------------------ # APPENDIX 2-1 to 2-4 | data translation formats # APPENDIX 3-1 to 3-8 | remote control operation and command summary # 3-8 to 3-9 | detailed error description ################################################################################ integer getl, getty, shrten, gethex # byte option, any # # byte line(132) # byte memory(BUFSIZ) # 8K memory array, for 4K bytes # of "equivalent" PROM memory common /prom/ line, memory # # call putl(' ',5) # call putl(VERSION,5) # call prmini # initialize prom programmer # repeat { # repeat { # call putl(' ',5) # line feed L=getty(' option (L)ist, (P)rogram, (V)erify, (E)nd , (H)elp: ',line) L=shrten(line,TABSPACE) # call lcuc(line) # convert to upper case if (any('H',line)>0) { # call help # print help text next # } # if (any('LPVE',line)<0) { # illegal option if (length(line)>0) # call putl(' * invalid option',5) else # call putl(VERSION,5) next # } # else # { # option=line(1) # legal option in OPTION break # } # } # if (option=='E') { # all done call prmstp # disconnect vectors stop # reset programmer to keyboard control } # call doit(option) # } # end # # subroutine help # ################################################################################ # This routine prints a help message to the terminal ################################################################################ # call putl(' ',5) call putl(VERSION,5) # print this version number call putl(' ',5) # followed by text call putl(' PROM.SAV is a fairly simple utility program which incorporates',5) call putl(' these basic functions described above. It allows the user to program',5) call putl(' a PROM or list or verify the contents of a PROM. The data input to',5) call putl(' the program is read from an input file (i.e. in the case when a PROM',5) call putl(' is being programmed). When an input file is read, several options',5) call putl(' must be specified. First, only the HEX data in between column LEFT',5) call putl(' and column RIGHT inclusively is actually used. Also, it is possible',5) call putl(' to allow for a single character comment delimiter in the input file.',5) call putl(' ',5) call putl(' In the program PROM, two HEX parameters (BEGIN and OFFSET) are',5) call putl(' used to map from the VIRTUAL address space of the microcomputer on',5) call putl(' which the PROM resides to the ABSOLUTE address of a specific byte in',5) call putl(' PROM relative to the hex address 0000 which is the start of the PROM.',5) call putl(' The VIRTUAL base address is specified by the parameter BEGIN, and the',5) call putl(' absolute base address is specified by BEGIN-OFFSET. The number of',5) call putl(' bytes actually tested, read or programmed is exactly COUNT, which is',5) call putl(' also a HEX value.',5) call putl(' ',5) call putl(' The program PROM will handle up to 4k (4096(10), 1000(16)) bytes of',5) call putl(' memory, however the program may be rebuilt if larger array space is',5) call putl(' needed to accomodate larger PROMs. PROM will accept commands stored',5) call putl(' in an indirect command file, (e.g. the first command in the file is',5) call putl(' to RUN PROM, etc...) PROM.SAV is not (as yet) documented elsewhere.',5) return # end # # subroutine doit(option) # ################################################################################ # Subroutine accepts a single character command, either 'P', 'L', 'V' or 'E' #and processes the command, then returns for the next command. # # The subroutine calculates addresses according to the formula: # # abegin=rbegin-offset # #where, OFFSET is entered by the user in response to the prompt OFFSET, and #RBEGIN is entered by the user in response to the BEGIN prompt. ################################################################################ integer getl, getty, shrten, gethex # integer left, right # byte count(4), rbegin(4), abegin(4), sum(4) # byte temp1(4), temp2(4), offset(4) # byte option, any, memchk, hexsub # # byte line(132) # byte memory(BUFSIZ) # 8K memory array, for 4K bytes # of "equivalent" PROM memory common /prom/ line, memory # # # repeat { # iofset=gethex(' offset [hex, def=0]: ',offset)# get hex OFFSET ibegin=gethex(' begin [hex, def=0]: ',rbegin)# hex relative BEGIN address if (hexsub(rbegin,offset,abegin)) # break # else # { # call putl(' *ERROR* OFFSET less than BEGIN',5) return # # absolute BEGIN address is calculated by # subtracting the OFFSET from the relative # BEGIN address } # } # icnt=gethex(' count [hex, def=0, max=1000]: ',count) # get hex COUNT if (icnt>MEMSIZ) { # call putl(' *ERROR* COUNT greater than PROM memory size',5) return # } # # if (option=='L') { # if list operation L=getty(' output file [def=tt:]: ',line) # open output file repeat { # if (L==0) # if no output specified, send to terminal call copy('TT:',line,4) # open(unit=LUNOUT,name=line,type='NEW', access='SEQUENTIAL',form='FORMATTED',err=10) break # no error 10 call putl('$ re-enter output file: ',5)# L=getl(line,132,5) # } # } # else # { # else Program or Verify L=getty(' input file : ',line) # open input file repeat { # open(unit=LUNIN,name=line,type='OLD', access='SEQUENTIAL',form='FORMATTED',err=20) break # no error 20 call putl('$ re-enter input file: ',5)# L=getl(line,132,5) # } # # read from input file call putl('$ input file left margin: ',5) left=intget(0,130) # call putl('$ input file right margin: ',5) right=intget(left+1,132) # L=getty(' comment delimiter [return if none]: ',line) # first byte in LINE is comment delimiter char ists=lodmem(left,right,line,LUNIN,count,memory) # read from input file close(unit=LUNIN) # close input file # if (ists==HEXERR) { # call putl(' *ERROR* illegal HEX data read from file',5) return # } # if (ists<0) { # call errh(ists) # return # } # else # if (ists==0) { # call putl(' no data read from input file',5) return # } # else # if (icnt>ists) { # call binhex(icnt,temp1) # convert actual and expected byte call binhex(ists,temp2) # counts into HEX write(5,200) (temp1(J),J=1,4), (temp2(J),J=1,4) 200 format(' # of bytes expected: ',4a1,' # of bytes read: ',4a1) call putl('$ continue? [Y/N] : ',5) L=getl(line,132,5) # if (line(1)~='Y'&line(1)~='y') # return # icnt=ists # call binhex(icnt,count) # store hex value in COUNT array call putl(' COUNT changed to reflect number of data points READ',5) } # } # # # call begdev(abegin,ists) # set PP offset (L3) to absolute begin address if (ists~=SUCCES) { # error in setting offset call putl(' *ERROR* setting BEGIN',5)# call errh(ists) # return # get next command } # # call blksiz(count,ists) # set PP offset (L3) if (ists~=SUCCES) { # error in setting offset call putl(' *ERROR* setting COUNT',5)# call errh(ists) # return # get next command } # # call putl('$ insert prom in adapter socket (return when done): ',5) L=getl(line,132,5) # # if (option=='P') { # if option is program call blank(ists) # if (ists==FAIL) { # call putl('$ * PROM is not blank, continue [Y/N] : ',5) L=getl(line,132,5) # if (line(1)~='Y'&line(1)~='y') # return # } # else # if (ists~=SUCCES) { # some other error call putl(' *ERROR* in PROM BLANK test',5) call errh(ists) # return # } # call indata(count,memory,ists) # copy MEMORY array into PROM # programmer RAM starting at address 0. if (ists~=SUCCES) { # error... call putl(' *ERROR* host to programmer RAM data transfer',5) call errh(ists) # return # } # call prgrm(ists) # copy PP RAM into PROM, blast it if (ists~=SUCCES) { # error... call putl(' *ERROR* programmer RAM to PROM data transfer',5) call errh(ists) # return # } # } # # call load(ists) # copy PROM data to PP RAM memory if (ists~=SUCCES) { # error... call putl(' *ERROR* PROM to programmer RAM data transfer',5) call errh(ists) # return # } # # if (option=='L') { # call odata(count,memory,ists) # fill memory with contents of PP RAM # starting at address 0 if (ists~=SUCCES) { # error... call putl(' *ERROR* programmer RAM to host data transfer',5) call errh(ists) # return # } # call lstmem(rbegin,count,memory,LUNOUT,ists)# write listing to lunout # this uses the RELATIVE begin address # errors NOT likely if (~memchk(count,memory,sum)) { # calculate memory checksum call putl(' *ERROR* checksum calculation',5) return # } # write(LUNOUT,300) (sum(J),J=1,4) # write checksum to listing file 300 format(' checksum: ',4a1) # close (unit=LUNOUT) # close output file } # if (option=='V'|option=='P') { # if program or verify operation call putl(' beginning verification',5) # call cmpram(rbegin,offset,count,memory,LUNERR,ists) # compare PP RAM to MEMORY if (ists~=SUCCES) { # error... call putl(' *ERROR* during verification',5) call errh(ists) # return # } # else # call putl(' verification complete',5) } # # return # end # # integer function gethex(pmt,hexval) # ################################################################################ # Reads a hex value from the terminal, returns ASCII hex value in HEXVAL #and integer value is returned as value of function. Function re-reads until #legal value is obtained. PMT is an arbitrary length string that is written to #terminal as a prompt. ################################################################################ byte hexval(4), hexbin, pmt(ARB) # integer getty, getl, shrten # # byte line(132) # byte memory(BUFSIZ) # 8K memory array, for 4K bytes # of "equivalent" PROM memory common /prom/ line, memory # # L=getty(pmt,line) # allow input from ind cmd file # repeat { # repat until legal hex value L=shrten(line,TABSPACE) # call lcuc(line) # if (L>4|~hexbin(line,ival)) { # is this a legal hex value? call putl('$ re-enter HEX value [HHHH] : ',5) L=getl(line,132,5) # } # else # { # for (I=1; I<=L; I=I+1) # hexval(I)=line(I) # copy result into output array if (L<4) # length less than 4, hexval(L+1)=EOS # terminate with null byte return(ival) # } # } # end # # subroutine errh(ists) # ################################################################################ # ERROR handler subroutine, writes message indicating kind of #error that occured. ################################################################################ byte errlin(10) # # if (ists==FAIL) # call putl(' *ERROR* function failed',5) else # if (ists==PPERR) { # serious error... call errsts(errlin,ists) # if (ists~=SUCCES) { # call putl(' *ERROR* unable to reset PPERR error',5) return # } # write(5,101) (errlin(J),J=1,8) # 101 format(' *ERROR* error status : ',8a1) call putl(' (see PROM programmer manual APPENDIX pages 3-8 and 3-9)',5) } # else # if (ists==RCVERR) # call putl(' *ERROR* serial receiver communications error',5) else # if (ists==HEXERR) # call putl(' *ERROR* illegal hex value',5) return # end #