?? isp_test.lst
字號:
1E68 D188 238 ACALL ECHO ;get second char of length
1E6A D190 239 ACALL A2HEX ;convert to hex
1E6C 4235 240 ORL 35H,A ;add into NBYTES
1E6E ED 241 MOV A,R5 ;get checksum
1E6F C3 242 CLR C ;subtract NBYTES
1E70 9535 243 SUBB A,35H ;from checksum and
1E72 FD 244 MOV R5,A ;store as new checksum
1E73 22 245 RET
246
247 ;***** console output routine *****
248 ;
249 ;Outputs character in the ACC to
250 ;the serial output line.
251
1E74 D1EB 252 CO: ACALL FD_WDT ;feed the WDT
253 ; JNB TI,CO ;wait till xmtr ready
254 ; CLR TI ;reset xmtr flag
1E76 F599 255 MOV SBUF,A ;output char to SIO
A51 MACRO ASSEMBLER ISP_TEST 06/13/2005 14:38:19 PAGE 5
1E78 3099FD 256 JNB TI,$ ;wait till xmtr ready
1E7B C299 257 CLR TI ;reset xmtr flag
1E7D 22 258 RET ;and done
259
260 ;***** console input routine *****
261 ;
262 ;Waits until character has been received
263 ;and then returns char in ACC.
264
1E7E D1EB 265 CI: ACALL FD_WDT ;feed the WDT
1E80 3098FB 266 JNB RI,CI ;wait till char
1E83 C298 267 CLR RI ;reset rcvr flag
1E85 E599 268 MOV A,SBUF ;read the char
1E87 22 269 RET ;and done
270
271 ;***** character echo routine *****
272 ;
273 ;waits until a character is received from
274 ;the console input and echos this character
275 ;to the console output. The received char
276 ;is also passed to the caller in the ACC.
277
1E88 D17E 278 ECHO: ACALL CI ;get char from console
279 ; ACALL CO ;print the character
1E8A 30E602 280 JNB ACC.6,EXECHO ;exit if not 4x,5x, or 6x Hex
1E8D C2E5 281 CLR ACC.5 ;convert to upper case
1E8F 282 EXECHO:
1E8F 22 283 RET ;and done
284
285 ;***** ASCII to HEX routine *****
286 ;
287 ;This routine accepts an ASCII char in the ACC
288 ;and converts it into the corresponding hex digit.
289 ;The routine checks to see if the char is in the
290 ;range of '0' through '9' or in the range of 'A'
291 ;through 'F'. If not in either range then the ASCII
292 ;char is not a valid hex entry from the operator
293 ;and an error flag is returned true along with the
294 ;original ASCII char returned in the ACC.
295
1E90 296 A2HEX:
1E90 30E602 297 JNB ACC.6,HEX1
1E93 2409 298 ADD A,#09H
1E95 540F 299 HEX1: ANL A,#0FH
1E97 22 300 RET
301
302 ;***** HEX to ASCII routine *****
303 ;
304 ;This routine receives a single hex digit
305 ;(a four bit nibble) in the ACC and returns
306 ;the equivilent ASCII char in the ACC.
307
1E98 308 HEX2A:
1E98 540F 309 ANL A,#0FH
1E9A C3 310 CLR C ;carry affects the testing
1E9B 940A 311 SUBB A,#0AH ;test for range of 0-9, A-F
1E9D 5003 312 JNC HAHIGH ;no carry then A-F range
1E9F 243A 313 ADD A,#3AH ;add offset for 0-9 range
1EA1 22 314 RET
1EA2 315 HAHIGH:
1EA2 2441 316 ADD A,#41H ;add in offset for A-F range
1EA4 22 317 RET
318
1EA5 319 PROCESS:
320
1EA5 743A 321 MOV A,#':'
A51 MACRO ASSEMBLER ISP_TEST 06/13/2005 14:38:19 PAGE 6
1EA7 D174 322 ACALL CO
1EA9 E533 323 MOV A,33H
1EAB F1D9 324 ACALL OUTBYT
1EAD E531 325 MOV A,31H
1EAF F1D9 326 ACALL OUTBYT
1EB1 E530 327 MOV A,30H
1EB3 F1D9 328 ACALL OUTBYT
1EB5 E534 329 MOV A,34H
1EB7 F1D9 330 ACALL OUTBYT
331
1EB9 E533 332 MOV A,33H ;send data bytes circling
1EBB FA 333 MOV R2,A
1EBC 6008 334 JZ ECRC ;zero data bytes ?
1EBE 7980 335 MOV R1,#80H
1EC0 336 EDATA:
1EC0 E7 337 MOV A,@R1
1EC1 F1D9 338 ACALL OUTBYT
1EC3 09 339 INC R1 ;and bump up the pointer
1EC4 DAFA 340 DJNZ R2,EDATA ;repeat if more bytes in record
341
1EC6 E535 342 ECRC: MOV A,35H ;CRC
1EC8 F1D9 343 ACALL OUTBYT
344
1ECA E534 345 MOV A,RTYPE ;get record type
1ECC 23 346 RL A ;double ACC for two byte jumps
1ECD 901ED1 347 MOV DPTR,#RECTBL ;pointer = start of table
1ED0 73 348 JMP @A+DPTR ;branch on record type
349
1ED1 350 RECTBL:
1ED1 E104 351 AJMP PROGRAM ;0 = program data bytes
1ED3 C1F2 352 AJMP RDVER ;1 = read code versions
1ED5 E186 353 AJMP AUXWR ;2 = misc 'write' functions
1ED7 E193 354 AJMP AUXRD ;3 = misc 'read' functions
1ED9 E1A4 355 AJMP ERASE ;4 = erase block or page
1EDB E1B6 356 AJMP CRCS ;5 = sector CRC
1EDD E1B2 357 AJMP CRCG ;6 = global CRC
1EDF E1E5 358 AJMP SETBR ;7 = set baud rate
1EE1 C100 359 AJMP RESET ;8 = reset MCU
1EE3 E128 360 AJMP DCMD ;9 = display device data
361
362
363
1EE5 364 I_WDT:
1EE5 75C1FF 365 MOV WDL,#0FFH ;set to max count
1EE8 43A7E0 366 ORL WDCON,#0E0H ;set pre= max
1EEB 75C2A5 367 FD_WDT: MOV WFEED1,#0A5H ;
1EEE 75C35A 368 MOV WFEED2,#5AH ;
1EF1 22 369 RET
370
371
1EF2 372 RDVER:
1EF2 7404 373 MOV A,#ISP_VER ;get ISP version id
1EF4 F1D9 374 ACALL OUTBYT ;and print it
1EF6 7401 375 MOV A,#VRD ;function code
1EF8 12FF03 376 CALL PGM_MTP ;and perform the function
1EFB EF 377 MOV A,R7 ;get the response
1EFC F1D9 378 ACALL OUTBYT ;and print it
1EFE E122 379 AJMP EOF ;and we're done
380
381
382
---- 383 CSEG AT MEM_TOP-256 ;Should be 1F00h
384 ;CSEG AT MEM_TOP-6912 ;Should be 500h
385
1F00 C103 386 AJMP INIT ;Boot vector entry point
387
A51 MACRO ASSEMBLER ISP_TEST 06/13/2005 14:38:19 PAGE 7
1F02 388 ERROR:
389 ; MOV A,#'R' ;print a verify error
390 ; ACALL CO ;send an okay message
391 ; MOV A,R7 ;get status
392 ; ACALL OUTBYT ;and print
1F02 E171 393 AJMP DEXIT ;and done
394
395
1F04 396 PROGRAM:
1F04 AB33 397 MOV R3,NBYTES ;get the number of bytes in record
1F06 EB 398 MOV A,R3 ;get the number of bytes in record
1F07 6019 399 JZ EOF ;exit if no bytes in record
1F09 AD30 400 MOV R5,ADR0 ;get the load address
1F0B AC31 401 MOV R4,ADR1 ;of the first byte in record
1F0D 7F80 402 MOV R7,#DBYTES ;pointer to data
1F0F 7400 403 MOV A,#PGMU ;program user code
1F11 78FF 404 EXEC: MOV R0,#KEY ;address for the SOFT key
1F13 7696 405 MOV @R0,#KEYVAL ;setup a valid SOFT key
1F15 C2D1 406 CLR F1 ;specify IRAM
1F17 75E408 407 MOV FMCON,#SET_WE ;enable HARD write
1F1A 86E5 408 MOV FMDATA,@R0 ;set HARD key
1F1C 12FF03 409 CALL PGM_MTP ;write the entire record & verify
1F1F 20D5E0 410 JB F0,ERROR ;check if an error occured
411 ; JC ERROR
412
1F22 742E 413 EOF: MOV A,#'.' ;no error
1F24 414 RSPND1:
1F24 D174 415 ACALL CO ;send an okay message
1F26 E171 416 AJMP DEXIT ;and done
417
418
419 ;***** display buffer contents routine *****
420 ;
421 ;This routine displays the contents of the buffer memory
422 ;over a user specified range. The displayed output is formatted
423 ;into a series of lines on the console. A line begins with the
424 ;address of the first byte in the line. Line length is limited
425 ;to a maximum of 16 bytes per line. Once this limit is reached,
426 ;new formatted lines are used.
427
1F28 428 DCMD:
1F28 7880 429 MOV R0,#DBYTES ;
1F2A 8683 430 MOV DPH,@R0 ;get high byte of starting address
1F2C 08 431 INC R0 ;point to low byte of starting address
1F2D 8682 432 MOV DPL,@R0 ;get low byte of starting address
1F2F 08 433 INC R0 ;point to high byte of ending address
1F30 8631 434 MOV ADR1,@R0 ;get high byte of ending address
1F32 08 435 INC R0 ;point to low byte of ending address
1F33 8630 436 MOV ADR0,@R0 ;get low byte of ending address
1F35 08 437 INC R0 ;point to function either display or blankcheck
1F36 3098FD 438 JNB RI,$ ;wait till host ready to receive
1F39 C298 439 CLR RI
440
1F3B 441 DLINE:
1F3B B60010 442 CJNE @R0,#00H,DAGN ;ignore this if its not a display command
1F3E F1D0 443 ACALL CRLF
1F40 7A10 444 MOV R2,#10H ;R2 = 16 bytes per line
1F42 E583 445 MOV A,DPH
1F44 F1D9 446 ACALL OUTBYT
1F46 E582 447 MOV A,DPL
1F48 F1D9 448 ACALL OUTBYT ;print the address
1F4A 743D 449 MOV A,#'=' ;of first byte of
1F4C D174 450 ACALL CO ;the line along with
451
1F4E 452 DAGN:
453
A51 MACRO ASSEMBLER ISP_TEST 06/13/2005 14:38:19 PAGE 8
1F4E AC83 454 MOV R4,DPH
1F50 AD82 455 MOV R5,DPL
1F52 7407 456 MOV A,#RUSR ;READ_USER
1F54 12FF03 457 CALL PGM_MTP ;read the byte
1F57 EF 458 MOV A,R7 ;get result
1F58 459 DPRN:
1F58 B60004 460 CJNE @R0,#00H,BLKCHK ;ignore this if its not a display command
1F5B F1D9 461 ACALL OUTBYT ;and print it
1F5D 8003 462 SJMP CKDEND ;and then check if we've reached the final
1F5F 463 BLKCHK:
1F5F B4001A 464 CJNE A,#00H,BLANKERR
1F62 465 CKDEND:
1F62 E531 466 MOV A,ADR1 ;
1F64 B58310 467 CJNE A,DPH,DNEXT ;check if DPH = stop high
1F67 E530 468 MOV A,ADR0 ;
1F69 B5820B 469 CJNE A,DPL,DNEXT ;check if DPL = stop low
1F6C B60102 470 CJNE @R0,#01H,DEXIT ;if display command use display exit
1F6F E122 471 AJMP EOF ;blankcheck exit (print a period)
472
1F71 473 DEXIT:
1F71 F1D0 474 ACALL CRLF ;print a CRLF
475 ; JNB TI,$
1F73 D29C 476 SETB REN ;TURN ON UART RECEIVER
1F75 C12A 477 AJMP LCMD ;branch to main loop
1F77 478 DNEXT:
1F77 A3 479 INC DPTR ;more bytes so point to next byte
1F78 480 DNXT1:
1F78 DAD4 481 DJNZ R2,DAGN
1F7A E13B 482 AJMP DLINE ;we start a new line or not
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -