Commodore — Commodore Business Machines PET 2001 (EN)

Exercise 9 - Programming cursor movement Cursor control characters may be programmed into PRINT state- ments. It is often desirable to clear the PET display under program control. We will do it in a direct statement. Editing: a Review When you press one of the PET's cursor control keys, you may be in one of two editing modes, as you have already seen. I. DIRECT CURSOR CONTROL The cursor is moved as soon as you press the cursor control key. In DIRECT mode, the User is creating program code. The cursor control keys allow the User to insert or delete characters at will unless he specifically indicates (by typing a quotation mark) that the cursor movement is to be a part of the created code.

When entering program code, the User can correct typographical errors in one of four ways. A. Delete all characters back to the error, then retype. B. If no quotation marks have been used, backspace (cursor left) over the intervening characters until the cursor is positioned over the error, retype the character, then forward space (cursor right) to the next desired character position to be typed. Tilt C. If a quotation mark has been used, press program line.

Then move the cursor up to leave the and over to one space Note that you did not clear the screen by typing these keys, but that the sc reen When you have typed an odds number of quote marks you are in this special cursor control character insertion mode. ( I Represents a single quote mark, for this discussion. And one is an odd number.) is a representation of a CLEAR SCREEN control character. Do not type RETURN yet. Instead type These prin t out then forward space to the next desired character position to be typed. Programmed cursor control is no longer in effect. D. Another method is to close the quotes (type the ending quotation mark) then backspace to the offending character and retype.

Again, programmed cursor control is no longer in effect. which are cursor co ntrol characters for CURSOR RIGHT and CURSOR DOWN. If you now type a second you will have entered an even number There may be occasions when it is appropriate to lengthen a state- ment line. If the cursor is moved to the end of an existing line, the additional characters may be typed in. The cursor will wrap around to the next lower line if more than 40 positions are used. If the lower line contains a program statement, it can be over-typed. Extra characters remaining from that previously typed line must be deleted or they will be incorporated into the line being edited.

Original Program of quote marks and you will leave the special mode. Typing I will again move the cursor, but this time. without printing anything. Any time you want to enter or leave the control character insertion mode you may do one of two things: 1. Enter a second Q . press the line ... or key. Then use your cursor keys to return to the point on the preceding 2. Delete the first quotation Move the cursor until it is, positioned over the closing quotes in statement 10, and type GOOD MEN TO". 17 1 6