Commodore MPS 1000 — Commodore MPS 1000 Dot Matrix Printer User's Manual PDF

Our example should help you understand the graphics mode better and may help you find the problem when one of your own programs gives you unexpected results. String variables In a long and complicated graphics program, typing the graphics command or repetitive data numbers over and over can become time- consuming. You can avoid much of the repetitive typing by storing commands and data in string variables. Look at the programs below. They are the same as the multiple-line exercise programs earlier in the chapter except for the string variables. Commodore BASIC version:

5 OPEN 4,4 10 G$ = CHR$(27) + "K" + CHR$(100) + CHR$(0) 20 A$= CHR$(85)+ CHR$(42) 30 = CHR$(42)+ CHR$(85) 3 5 PRINT# 4, CHR$(27)" l" 40 FOR R = 1 TO 3 50 PRINT#4,G$; 60 FOR X = 1 TO 50:PRINT#4,A$; 70 NEXTX:PRINT#4 80 PRINT#4,G$; 90 FOR X = 1 TO 50 :PRINT#4,B$; 100 NEXT X:PRINT#4:NEXT R 110 PRINT#4,CHR$(27)"@" 120 CLOSE4 MBASIC version: 10 G$ = CHR$(27) + "K" + CHR$(100) + CHR$(0) 20 A$= CHR$(85)+ CHR$(42) 30 = CHR$(42)+CHR$(85) 40 LPRINT CHR$(27)" l" 50 FOR R = 1 TO 3 60LPRINTG$; 70FORX= 1TO50: LPRINT A$;: NEXTX 80LPRINT 90 LPRING G$; lOOFORX= 1TO50: LPRINTB$;: NEXTX 110 LPRINT: NEXT R 120 LPRINT CHR$(27)''@'' 96