Screen Memory Map

The space in memory, where screen-display codes are placed, is organized exactly like the display space on the screen. The locations on the screen where a character can be displayed are numbered, starting with screen location zero at the top-left comer. Moving to the right, along the top row, location numbers are 0,1,2,3 and so forth, up to 39. The second row has locations 40 to 79. The bottom row has locations 960 to 999. The screen can display 1000 characters simultaneously, at screen...

190 Rem Bubble Sort

NUM C NUM C 1 NUM C 1 HOLD 250 NEXT C 260 REM Because there are 15 items on the list, the maximum number of passes required to sort the list is 14. Line 200 sets up a loop, using the counter P, to make 14 sorting passes through the list. Line 210 homes the cursor so the next list to be displayed will be just to the right of the preceding list. Because there are 15 items on the list, each pass requires 14 comparisons and possible interchanges. Line 220 sets up a C loop to make 14 comparisons...

New Grw

10 PRINT CHR 147 20 FOR ROW 5 T010 30 FOR COL 20 TO 30 40 POKE 1024 ROW 40 COL, 81 REM GRAPHIC 50 POKE 55296 ROW 40 COL, 1 REM WHITE 60 NEXT NEXT 70 PRINT CHR 19 REM HOME CURSOR 80 PRINT'NORMAL COLOR AGAIN Line 20 designates rows on the screen. Line 30 selects columns 20 to 30. Line 40 calculates corresponding locations on the screen memory map and pokes screen-display code 81. Line 50 calculates corresponding locations on the color memory map and pokes color-code 1 into each location. That...

Clearing An Array

To clear an array that has data in it, the data items should be replaced with nothing. If it is a numeric array, nothing is 0. If it is a string array, nothing is . Let's take BILL off the payroll and not replace him. Enter To clear a lot of elements in an array, or the entire array, it would be better to use a loop. Use it to put nothing into each location. Let's run a loop in the immediate mode to clear locations 4 and 5 of the array. Enter FOR CL 4TO 5 NAME CL NEXT GOTO 50 Only ART and CINDY...

New Vtx

20 PRINT'TYPE SOMETHING WITH COMMAS CHR 13 THEN PRESS RETURN PRINT 30 S 40 GET KS IF KS GOTO 40 50 IF KS CHR 13 GOTO 110 60 IF KS CHR 20 AND LEN S gt 0 THEN S LEFT S ,LEN S -1 GOT080 70S S KS 80 PRINT CHR 19 PRINT PRINT PRINT 90 PRINT S 100 GOTO 40 110 PRINT PRINT PRINT S 120 PRINT LEN S Line 30 initializes the variable S to a null. S stands for Sentence. This program will use S to hold all keystrokes entered before pressing RETURN. Line 40 gets keystrokes, one at a time, and names each one KS...

Commodore Ascii Codes

For the rest of this book, ASCII will mean Commodore ASCII the codes that are actually used by your computer. Table 6-1 shows the effect of ASCII codes 0-255 when the upper-case-and-graphics mode has been selected. Table 6-2 shows the effect of codes 0-255 when the upper-and-lower-case mode has been selected. By comparing these tables, you will see that more graphics characters are available in the upper-case-and-graphics mode because lower-case letters are not available in that mode. The...

Doing Arithmetic

Your computer can do simple arithmetic and also more complicated mathematics such as algebra and trigonometry. In general, it can perform any calculation that you want it to do, but you must know how to tell it what you want. There are four arithmetic symbols means add means subtract means divide means multiply To see how the symbol works, clear the screen and then enter this statement PRINT 2 2 When you pressed RETURN, the computer executed the statement. It told you that the answer is 4 and...

Using The Upperandlowercase Mode

The screen should be clear and the computer should still be in the upper-case-and-graphics mode. To check that, press key A. The upper-case letter A should appear in the upper-left corner of the screen. To select upper and lower case, press Commodore-SHIFT. Please do that now. The capital A on the screen changes immediately to a lower-case a. Delete it so the screen is clear again. Now you can experiment to see what the letter keys do in this mode. Press key A. A lower-case a appears....

Immediate Mode

You haven't written a program yet, but you are getting close. A program is a way of storing a group of statements that the computer executes in sequence when you run the program. When you entered the statement PRINT HELLO, the computer executed it immediately. The statement is not stored anywhere. It has been executed. To do it again, you would have to enter the statement again. You are using the computer in the immediate mode because it executes statements immediately, as soon as they are...