int e l 1.9 ANSWERS TO A FEW QUESTIONS QUESTION Why can't MCS BASIC-52 access the 8052's SPECIAL FUNCTION REGISTER SCON ? ANSWER The only time the user would likely change the contents of SCON is if the user is writing custom I/O drivers in assembly language. If the user is writing assembly language I/O drivers, then the user can change the contents of SCON in assembly language. Changing the contents of SCON can cause MCS BASIC-52's console routines to crash. QUESTION I have written an upload/download routine using my computer, but when I download a program, MCS BASIC-52 misses characters, why? ANSWER MCS BASIC-52 is actually capable of accepting characters at 38,400 baud.
The problem is that after MCS BASIC-52 receives a carriage return (cr), it tokenizes the line of text that was just entered. Depending on how complicated and how long the line is, MCS BASIC-52 can take up to a couple of hundred milliseconds to tokenize the line. If the user keeps stuffing characters into the serial port while MCS BASIC-52 is tokenizing the line, the characters will be lost. What the user must do in the download routine is wait until MCS BASIC-52 responds with the prompt character (>) after a carriage return is sent to the MCS BASIC-52 device. The prompt (>) informs the user that MCS BASIC-52 is ready to receive characters from the console device.
QUESTION I am writing in assembly language and I notice that the 8052AH has no decrement DPTR instruction. What is the easiest. shortest or simplest way to decrement the DPTR? ANSWER The shortest one we know is: XCH A, DPL ; SWAPA DPL JNZ DECDP ; DPH = DPH-1 IF DPL = O DEC DPH DECDP: DEC A ; DPL = DPL-1 XCH A, DPL This routine affects no flags or registers (except the DPTR) either! - 190 -