Sharp OZ-707 Operation Manual - Page 37
Debugging
![]() |
UPC - 074000012141
View all Sharp OZ-707 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 37 highlights
4. DeBUGGING er entering a new BASIC program, it often does not work th~ first Ae. Even if you are simply entering a program that you know IS trect, such as those provided in this manual, it is common to make deast one typing error. It may also contain at least one logic error as ~II . \ "owing are some general hints on how to find and correct your tors. Suppose you run your program and get an error message: •Go back to the PRO mode and use the C2SJ or I3ZJ key to recall the line with the error. The cursor will be positioned at the place in the line where the Card became confused. If you cannot find an obvious syntax error, the problem ma~ lie wi~h ahe values that are being used. Check the values of the vanabies In either the RUN or PRO mode by entering the name of the variable and pressing the IENTER I key. Ippose you run the program and do not get an error message, but aprogram does not do what you expect. 1 Check through the program line by line using LIST and the C2SJ 'and [YJ keys to see if you have entered the program correctly. It is surprising how many errors can be corrected by just taking another look at the program. Think about each line as you go through the program as if you were :the Card. Take sample values and try to apply the operation in each line to see if you get the result that you expected. Insert one or more extra PRINT statements in your program to :display key values and key locations. Use these to isolate the parts of the program that are working correctly and the location of the error. This approach is also useful for determining which parts of a program have been executed. You can also use STOP to temporarily halt execution at critical points so that several variables can be examined. 62 4. Use TRON (TR~~ ON) and TROFF (TRace OFF), either as direct tchorm~mugahn.Idnsdl.Vo~ldWui~t1hlli~nethse. program to trace the flow of the Stop to examine the contents of program critical van~~les at c~clal points. This is a very slow way to find a problem but It IS sometimes the only way. ' tNhoatmdaotetesrnhootwdocaqr~el!tuel you are, what you eventually you will create a expect it to. To isolate the program problem, BASIC has a speCial method of executing programs known as the "Trace" mode. w!IRSit~hOUi~nNdaa('TspRraaoc~dr~iraemOc.Nt ~)csosemtadmrtasasnTdarad(~IinereRmcUtocNdoemm. mTohdaeen)dT,oRrTOiRtNOmNianysintbrfueocretmiomsnbtehmdeadyCedabred that tracing IS required during the execution of all subsequent programs..The programs to be traced are then started in a normal manner, with a GOTO or RUN command. If TRON is. used as a statement, it will initiate the Trace mode only when the line containing it is executed. If. for some reason, that line is never reached, Trace mode will remain inactive. Debugging Procedures 1. Set the computer to RUN mode. 2. Enter TRON IENTER I to specify the trace mode. 3. E.nter RUN IENTER Ito execute the program. The line number will be dlspla~ed .at above right of the display for about 0.5 second after each line IS executed. 4. Press the 00 ~ey .when the desired line number is displayed. The GSJ break ~meyestsoagd.iespISlaydisthpelalyaesdt and execution is interrupted. Press statement executed. To resume the execution,. press t~e I~HI': 1l3ZJ keys or enter CONT [ENTER 1. IHNoPw~eTvecr~, mIfmeaxnedc,utjiuosnt IS Interrupted during data entry using the press the IENTER I key as for usual program continuation. CXJ 5. ~ Pressktehye Will key to move to the line to be checked. Holding execute the program step by step. Releasing the the key Will stop program execution. 63
![](/manual_guide/products/sharp-oz707-operation-manual-7aa0508/37.png)