intel MCS BASIC-52 — Intel MCS BASIC-52 Versions 1 & 1.1 Operating and Reference Manual PDF

int e l 4.37 DESCRIPTION OF STATEMENTS IMPORTANT NOTE! When executed in the RUN mode, The PGM statement will not generate an error if the EPROM fails to program properly. Instead, the control of the program will be passed back to the user just as if the EPROM programmed properly. The user must then examine locations 1EH and 1FH. If the contents of locations 1EH and 1FH both equal zero, then the EPROM programmed properly. If they do not, then an ERROR occurred during the programming process. The user can then examine locations 1AH:18H to determine what location in the EPROM failed to program. Well, this sounds like a lot to do just to program an EPROM, but it's not so bad.

The following program is an example of a universal EPROM/EEPROM programmer built around MCS BASIC-52. This program can program a block of RAM into an EPROM or EEPROM that is addressed at 8000H or above. EXAMPLE: 10 PRINT "UNIVERSAL PROM PROGRAMMER" : PRINT "WHAT TYPE OF DEVICE ?" 20 PRINT : PRINT "1 = EEPROM" : PRINT "2 = INTELLIGENT EPROM" 30 PRINT "3 = NORMAL (50 MS) EPROM" : PRINT : INPUT "TYPE (1,2,3) - ",T 40 ON (T-1) GOSUB 340,350,360 50 REM this sets up intelligent programming if needed 60 IF W=.001 THEN DBY(26)=DBY(26).OR.8 ELSE DBY(26)=DBY(26).AND.0F7H 70 REM calculate pulse width and save it 80 PUSH (65536-(W*XTAL/12)) : GOSUB 380 90 POP G1 : DBY(40H)=G1 : POP G1 : DBY(41H)=G1 :

PRINT 100 INPUT " STARTING DATA ADDRESS - ",S : IF S 0FFFFH THEN 100 110 PRINT : INPUT " ENDING DATA ADDRESS - ",E 120 IF E 0FFFFH THEN 110 130 PRINT : INPUT " PROM ADDRESS - ",P : IF P 0FFFFH THEN 130 140 REM calculate the number of bytes to program 150 PUSH (E-S)+1 : GOSUB 380 : POP G1 : DBY(31)=G1 : POP G1 : DBY(30)=G1 160 REM set up the eprom address 170 PUSH (P-1) : GOSUB 380 : POP G1 : DBY(26)=G1 : POP G1 : DBY(24)=G1 180 REM set up the source address 190 PUSH S : GOSUB 380 : POP G1 : DBY(27)=G1 : POP G1 : DBY(25)=G1 200 PRINT : PRINT "TYPE A 'CR' ON THE KEYBOARD WHEN READY TO PROGRAM" 210 REM wait for a 'cr' then program the eprom 220 X=GET :

IF X 0DH THEN 220 230 REM program the eprom 240 PGM 250 REM see if any errors 260 IF (DBY(30).OR.DBY(31))=0 THEN PRINT "PROGRAMMING COMPLETE" : END 270 PRINT : PRINT "***ERROR***ERROR***ERROR***ERROR***" : PRINT 280 REM these routines calculate the address of the source and 290 REM eprom location that failed to program 300 S1=DBY(25)+256*DBY(27) : S1=S1-1 : D1=DBY(24)+256*DBY(26) 310 PH0. "THE VALUE ",XBY(S1), : PH1. " WAS READ AT LOCATION ",S1 : PRINT 320 PH0. "THE EPROM READ ",XBY(D1), : PH1. " AT LOCATION ",D1 : END 330 REM these subroutines set up the pulse width 340 W=.0005 : RETURN 350 W=.001 : RETURN 360 W=.05 :

RETURN 370 REM this routine takes the top of stack and returns high, low bytes 380 POP G1 : PUSH (G1.AND.0FFH) : PUSH (INT(G1/256)) : RETURN - 73 -