PROGRAMMING EPROMS FOR THE HP-41 Michael Krabach <38> This documentation provides a description of how to create programs and load them on eprom for use in EPROM boxes. It includes two critical programs that allow the user to integrate the available hardware so that eproms can be programmed for both the 2 chip RAM boxes such as HHP and ERAMCO products, and the single chip RAM boxes of CMT. BACKGROUND The basic process is to load the user programs into an MLDL RAM box as 4K pages, transmit an ASCII image of the 4K RAM page to the PC or minicomputer, convert the ASCII image into an Intel Hex file format, and then program the eprom from the Intel Hex file with the eprom programmer. The Mountain Computer Eprom Programmer was originally available for programming eproms for the HP-41 until it was discontinued because lack of demand. It also suffered from hardware deficiencies that would damage the board. After that the only way to program eproms was using expensive software designed for expensive eprom programmers. Most people programming eproms for the HP-41 devised kludge methods, and the users community was very fragmented on the methods of burning eproms. The best way to program from the HP-41 would be with MCODE such as used in the Mountain Computer Programmer, but I do not have sufficient knowledge or time to learn HP assembler language. Therefore MBASIC, though less efficient, was used. The program has proved very reliable, if somewhat slow in translating user code into a final eprom. The size of the code I currently produce is large enough to require the 32K card reader type eprom box. This will be mentioned later, but not everyone will be producing code this large. 8K eproms for use with the CMT-300 multimeter are also being currently programmed. For the sake of brevity this article will not describe how to load the MLDL RAM box with the users code. This is described in the users manual for the MLDL box. Generally I use the ERAMCO MLDL 24K/8K eprom/ram box, but I may start using the ERAMCO RSU compact RAM box. I will provide anyone with tips and information if they contact me. THE HARDWARE The required hardware, considering the least cost is: * HP-41 with HP-IL module * eprom box to run the final eproms * MLDL, machine language development lab, ie. RAM box * Minicomputer, PC compatable (CP/M, or Apple with RS-232) * HP-IL Interface Card for PC/XT/AT Compatables, HP 82973 * Link software for PC to control Interface Card * MBASIC or BASICA for PC, and any editor or word processor * eprom programmer and control software * eprom UV eraser, (errors will be made) * Supply of eproms for eprom box Most users that would be interested in programming eproms will have the HP-41 and HP-IL module. Also almost every one has access to, or owns some type of minicomputer, either PC type or older CP/M. Others like Apple, Commodore, etc. can be used with a suitable eprom programmer. The above component list offers the least cost, but depending on availibility, there are subsitutes that can be used in lieu of the above components. A suggested source for the HP gear is EduCalc Mail Store, 27953 Cabot Road, Launa Niguel, CA, 92677. In place of the HP-IL Interface Card, any HP-IL to RS-232 interface box can be used. HP makes the most common one but several others are now being made that cost less. If RS-232 is used, the Link software is not required, but a standard PC communication software program that can transmit in the ASCII mode is required. XMODEM is an example, free in the public domain everywhere in the minicomputer community. The Link Interface Card only works with the PC compatables, but the RS-232 interfaces will work with CP/M, Apple or other minicomputers that are compatable with the chosen eprom programmer. I have used the RS-232 interface on a CP/M machine but now use the Link Interface on a IBM PC. The eprom programmer has two restrictions regarding the program that creates an Intel Hex file. To simplify the program, the checksum which is normally put at the end of every Hex line, has been ignored. Some eprom programmers require the checksum at the end of each Intel Hex line to program properly. The user must be able to defeat this feature if the eprom programmer has this requirement. The second restriction relates to the destination address at the start of each Hex line. The GOINTEL.BAS program generates the addresses for the Hex lines from 000H to FFFH, ie. 4K. If 4K pages are combined to program any code larger than 4K, the destination addresses will repeat for each 4K block of Hex code. An example: To produce 32K eproms for the HHP-PE 32K eprom box, download each 4K page from the RAM box. Then process each 4K page with GOINTEL.BAS naming the Intel Hex output in reference to the destination pages in the eprom box, such as AL8.HEX, BL8.HEX, etc. for the lower 8 bit code, and AU2.HEX, BU2.HEX, etc. for the upper 2 bit code. Each respective Hex block is merged with a word processor until one large Intel Hex block of code is produced. This is done for both the L8 code, (producing 88K of hex), and the U2 code (producing 22K of hex). The eprom programmer will convert the 88K hex to 32K of binary and 22K hex to 8K of binary which are programmed on the respective L8 and U2 eproms. The point is, if the eprom programmer cannot handle 4K stacked blocks with similar destination addresses, or if the eprom programmer requires strict Intel Hex format, the final code in the eprom will all overlap. A sample of the Intel Hex output follows the program listing. These requirements must be understood before buying any eprom programmer. To minimize the confusion, I recommended an eprom programmer for CP/M or MSDOS computers marketed by ANDRATECH, P.O. Box 222, Milford, Ohio, 45150, (513) 752- 7218, that ignores the checksum and can load at the 1st valid address in the Hex file ignoring the rest of the destination addresses. It comes as an assesembled board for $199 (or kit for $179) and programs through the parallel printer port. This means that there is no memory on the eprom board. The program to be loaded to the eprom resides in the computer making it easy to manipulate. 32K blocks can be programmed in one shot. HP-41 SOFTWARE Users information has been mostly nonexistent about programming eproms from RAM boxes; but any MLDL type dissassembler can be used to print the ASCII code to a computer if a suitable driver program is available. The following user program performs this function by downloading any ERAMCO 4K RAM page to the HP-IL loop so that it can be transmitted to the minicomputer for final processing by the BASIC code GOINTEL.BAS. Note lines 05, 25, 38, and 39 are only used to time the download process for comparison purposes. They can be removed when installing the program. They must be removed if the HP-41 does not have a clock module installed or a HP-41CX is not used. There are 3 similar ways to download the RAM image. Two use the programs "OUTROM" AND "DMPROM" in conjunction with the ERAMCO MLDL function "DECOD", and the third uses the ZENROM disassembler only. Program "OUTROM" will work for all user programs, including programs with synthetic instructions and non-standard characters. It only sends the ASCII address and 10 bit hex number to the minicomputer in the format AAAACCC. It takes roughly 45 minutes to download a 4K page from the ERAMCO RAM box. If a speedup module is installed in your HP-41, it will take about 25 minutes. It will produce a image file about 36K on your minicomputer. Program "DMPROM" will send ASCII address and 10 bit hex number plus the respective HP character to the minicomputer in the format AAAA CCC X. If the user code has any of the HP characters between 0H and 1FH in the standard ASCII table, the characters will be control characters in the resulting output. Commonly they translate into blank lines which can be handled by GOINTEL.BAS. Some may not, so examine the "DMPROM" output with a word processor to clean up any strange characters before processing the file with GOINTEL.BAS. The program is 2X faster, but the ASCII output is about 53K on the minicomputer. Using this program with a speedup module has not always been successful. The HPIL loop has occasionally hung up. The third way of downloading a RAM image does not use this program, it uses just the dissasembler found in the ZENROM. Call up the "MCED" machine code editor and use the DIS:____,____ function to print the section of RAM to the HP-IL loop. This method will result in a leading text line that must be removed before processing with GOINTEL.BAS. It will also transmit any of the control characters that "DMPROM" would. It is faster than "DMPROM" but the ASCII output will be about 85K on the minicomputer per 4K page. It does not work well with the speedup module. For programs with synthetic characters, "OUTROM" in conjunction with a speedup module provides a compromise between speed of downloading and loss of time when the file requires editing. The timing functions in the code are so the user can evaluate for themselves the best way to download from the RAM box. -------------------------------------------------- 01 LBL "OUTROM" ;program generates format AAAACCC 02 "REV 9-3-86" 03 "REQ ESMLDL-OS" ;requires eramco MLDL operating system. 04 CLX ;clear x-reg. 05 SETSW ;only for timing the download process. 06 CF 15 ;set printout to manual mode. 07 CF 16 08 SF 21 ;turn on print enable. 09 MANIO ;manual I/O to non standard printer. 10 1 ;set for 1st device on hpil loop. 11 SELECT ;select this device 1. 12 1.512 ;inner nested counter for 4k page. 13 STO 00 ;save it. 14 1.008 ;outer counter 8*512=4096 bytes 15 STO 01 ;save it. 16 AON ;turn on alpha display, 17 "WHAT PAGE?" ;prompt for 4K page in hex format. 18 PROMPT 19 AOFF ;turn off alpha display. 20 48 ;ASCII for 0 21 XTOA ;append three 0’s to hex page, 22 XTOA ;to get first address to download. 23 XTOA 24 COD ;code address in alpha to binary in x-reg 25 RUNSW ;start the stopwatch. 26LBL 01 ;start the loop. 27 DISASM ;disassemble x-reg to y-reg, increment x --------------------------------------------------Insert this section for the program "OUTROM". 28 X<>Y ;swap disassemble in y to x-reg 29 DECOD ;decode to get alpha, output alpha. 30 X<>Y ;get back next address for disassemble. -------------------------------------------------- Or insert this section and call the program "DMPROM". ;program generates format AAAA CCC X 28 OUTA ;output full disassembled code in alpha. -------------------------------------------------- This section is used by both versions. 31 ISG 00 ;increment nested counter, 32 GTO 01 ;loop back until counter = 513 33 1.512 ;reset nested counter. 34 STO 00 35 RDN ;get back the RAM address. 36 ISG 01 ;increment outer counter, 37 GTO 01 ;loop back until counter = 9 38 STOPSW ;then stop timer, 39 RCLSW ;put in x-reg, 40 END ;stop program. This program is used by installing the HP-IL interface card in the PC and activate the linking program between the HP-IL loop and the PC by opening up a file with an extension such as IMG (eg. MYPRGM.IMG). Start the program "OUTROM" and input the page you want transmitted to the PC. You will see the code on both the HP-41 and PC screens as it is being transmitted. When finished close the file on the PC. This file can now be processed into the Intel Hex format using the next program GOINTEL.BAS. The following is a sample output of OUTROM resulting from downloading page B from the RAM box showing the start of the 4K page which is the start of the FAT table. B000004 B001010 B002000 B003091 B004200 B005094 B006201 B00700B B008201 B009084 B00A202 | | etc. MBASIC SOFTWARE The program GOINTEL.BAS has two versions, one is used to process hex code for eprom boxes which use the dual "upper 2 bit" and "lower 8 bit" format such as the HHP and ERAMCO eprom boxes. In this case the output is two files, one used to program the upper 2 bit eprom, and the other to program the lower 8 bit eprom. The alternate version produces the 16 bit format used by the CMT eprom boxes. Program lines 10-170 are common to both formats. 10 CLS: REM Remove line for non-IBM version MBASIC 20 PRINT "Program GOINTEL.BAS,by Michael Krabach, Nov. 2, 1986." 30 PRINT "Public Domain Software to make it easier for others." 40 PRINT "Used to convert an ERAMCO RAM 4K page to Intel hex format." 50 PRINT 60 PRINT "Suitable file format is ‘AAAA CCC’ or ‘AAAACCC’," 70 PRINT "where AAAA is adddress and CCC is the hex code." 80 PRINT "Anything following ‘CCC’ is ignored." 90 PRINT "The source file to be converted to Intel hex can be produced" 100 PRINT "by a suitable disassembler as ZENROM ‘MCED’ DIS____,____" 110 PRINT "or HP users programs ‘OUTROM’ OR ‘DMPROM’." 120 PRINT "If ‘MCED’ is used, edit text lines from source file that" 130 PRINT "are not addressed code lines." 140 PRINT "If ‘DMPROM’ is used, program will skip any blank lines." 150 PRINT "The source file is transfered via HPIL loop using either the" 160 PRINT "HP 82164A RS-232 interface or HP 82973A PC link card." 170 PRINT:PRINT -------------------------------------------------- Continue with this section for the dual eprom format. 175 PRINT "Produces HHP and ERAMCO upper U8 and lower L2 bit hex files." 180 DEFINT B,I,J,K 190 DIM B(16) 200 DIM U$(16),L$(16),SUM$(4) 210 INPUT "FILE NAME TO BE CONVERTED INTO INTEL HEX FORMAT";FILE$:PRINT 220 PRINT "THE OUTPUT FILES WILL HAVE THE .HEX EXTENSION APPENDED TO THEM.":PRINT 230 INPUT "NAME THE OUTPUT FILE FOR THE LOWER 8 BITS (L8)";FILEL8$ 240 INPUT "NAME THE OUTPUT FILE FOR THE UPPER 2 BITS (U2)";FILEU2$ 250 OPEN "I",#1,FILE$ 260 OPEN "O",#2,FILEL8$+".HEX" 270 OPEN "O",#3,FILEU2$+".HEX" 280 WHILE NOT EOF(1) 290 FOR J=1 TO 4 300 FOR I=1 TO 16 310 INPUT #1,A$ 320 IF LEFT$(A$,1)="" THEN 310:REM TO SKIP BLANK LINES IN TEXT 330 IF I=1 THEN ADRL8$=LEFT$(A$,4) 340 IF I=1 AND J=1 THEN ADRU2$=HEX$(VAL("&H"+ADRL8$)/4-VAL("&HC00")) 350 IF MID$(A$,5,1)= " " THEN 390 360 L$(I)=MID$(A$,6,2):REM PROCESS OUTROM FILES 370 U$(I)=MID$(A$,5,1) 380 GOTO 410 390 L$(I)=MID$(A$,7,2):REM PROCESS DMPROM FILES 400 U$(I)=MID$(A$,6,1) 410 B(I)=VAL(U$(I)) 420 NEXT I 430 L8$ = ":10"+ADRL8$+"00" 440 FOR K = 1 TO 16 450 L8$ = L8$ + L$(K) 460 NEXT K 470 MID$(L8$,4)="0" 480 C$=HEX$(B(1)+4*B(2)) 490 D$=HEX$(B(3)+4*B(4)) 500 E$=HEX$(B(5)+4*B(6)) 510 F$=HEX$(B(7)+4*B(8)) 520 G$=HEX$(B(9)+4*B(10)) 530 H$=HEX$(B(11)+4*B(12)) 540 I$=HEX$(B(13)+4*B(14)) 550 J$=HEX$(B(15)+4*B(16)) 560 SUM$(J)=D$+C$+F$+E$+H$+G$+J$+I$ 570 PRINT #2,L8$:PRINT "L8$=";L8$ 580 NEXT J 590 U2$=":10"+ADRU2$+"00"+SUM$(1)+SUM$(2)+SUM$(3)+SUM$(4) 600 MID$(U2$,4)="0" 610 PRINT #3,U2$:PRINT "U2$=";U2$ 620 PRINT 630 WEND 640 ENDFILE$=":0000000000" 650 PRINT #2,ENDFILE$:PRINT "L8$=";ENDFILE$ 660 PRINT #3,ENDFILE$:PRINT "U2$=";ENDFILE$ 670 CLOSE #1 680 CLOSE #2 690 CLOSE #3 700 END -------------------------------------------------- Use this section for the single eprom format. 175 PRINT "Produces CMT single eprom 16 bit format." 180 DEFINT I,K 200 DIM L$(8),U$(8) 210 INPUT "FILE NAME TO BE CONVERTED INTO INTEL HEX FORMAT";FILE$:PRINT 220 PRINT "THE OUTPUT FILES WILL HAVE THE .HEX EXTENSION APPENDED TO THEM.":PRINT 230 INPUT "NAME THE OUTPUT FILE ";FILE10$ 250 OPEN "I",#1,FILE$ 260 OPEN "O",#2,FILE10$+".HEX" 280 WHILE NOT EOF(1) 300 FOR I=1 TO 8 310 INPUT #1,A$ 320 IF LEFT$(A$,1)="" THEN 310:REM TO SKIP BLANK LINES IN TEXT 330 IF I=1 THEN ADR10$=LEFT$(A$,4) 350 IF MID$(A$,5,1)= " " THEN 390:REM FILE NOT BY OUTROM 360 L$(I)=MID$(A$,6,2):REM PROCESS OUTROM FILES 370 U$(I)=MID$(A$,5,1) 380 GOTO 420 390 L$(I)=MID$(A$,7,2):REM PROCESS DMPROM FILES 400 U$(I)=MID$(A$,6,1) 420 NEXT I 430 LEX$ = ":10"+ADR10$+"00" 440 FOR K = 1 TO 8 450 LEX$ = LEX$ + L$(K) +"0"+U$(K) 460 NEXT K 470 MID$(LEX$,4)="0" 570 PRINT #2,LEX$:PRINT LEX$ 630 WEND 640 ENDFILE$=":0000000000" 650 PRINT #2,ENDFILE$:PRINT ENDFILE$ 670 CLOSE #1 680 CLOSE #2 700 END The following is a sample output of Intel Hex code used to program an L8 eprom. :10000000041000910094010B0184023E035603FD :1000100004D1050205D8076D084008CB092909C0 :100020000A2E0000000000000000000000000000 :1000300000000000000000000000000000000000 :1000400000000000000000000000000000000000 :1000500000000000000000000000000000000000 :1000600000000000000000000000000000000000 :1000700000000000000000000000000000000000 :100080000000000000008237200B0F0F12020105 :1000900013E01150CA00F700545354444C54FB52 :1000A000455620312D31342D38369C02F9504153 :1000B000542054494D4519111EF1509C06F95041 :1000C0005354204441544517171EF1509C02F854 | | etc. | | :100F700000000000000000000000000000000000 :100F800000000000000000000000000000000000 :100F900000000000000000000000000000000000 :100FA00000000000000000000000000000000000 :100FB00000000000000000000000000000000000 :100FC00000000000000000000000000000000000 :100FD00000000000000000000000000000000000 :100FE00000000000000000000000000000000000 :100FF00000000000000000000000000000000000 :0000000000 <-- remove this line if stacking 4K blocks, but leave this line on the last line of code. The code produced by the BASIC program can now be used to program the eproms with a suitable eprom programmer. Both these programs will compile for faster code if a BASIC compiler is available. If using the ANDRATECH programmer choose the compact format to load the Hex file from memory. Note that the GOINTEL program will append the name extension .HEX to your name for the output file to conform to the ANDRATECH requirements for a hex input file. Any questions can be sent to me (SASE please) or I can be reached for short questions via daytime business phone. I can also supply either CP/M MBASIC or PC BASICA versions on disk if the user sends a formatted disk with extra SASE label and stamps in a disk mailer. Michael Krabach <38> RFD 2 Nate Whipple Hwy Cumberland, Rhode Island, 02864 office (617) 872-8100 home (401) 333-5350