The Best Of The Plotter [1994 newsletter]

Discussion about ZX80 / ZX81 Software
David G
Posts: 214
Joined: Thu Jul 17, 2014 7:58 am
Location: 21 North, 156 West

Graphic Demo On The 1000 - Best Of The Plotter

Post by David G »

This one from page 3 is a fun one

you must try it!

Graphic Demo On The 1000, 3
GRAPHIC DEMO ON THE 1000

by Dick Wagner

This month our program a also comes from Dick Wagner. This program could be used as an attention getter, as it does have some action. The PLOT pixel looks like it is jumping up and down a flight of steps. Line 10 and 50 PRINT the name and delete the PLOT pixel. This is a simple way to get around using PRINT AT. Try changing lines 20 and 40 to N,0 and lines 70 and 80 to X,0. This shows that PLOT will wipe out characters when using the same space. Then change line 20 and 40 to N,10 to give different action again. Try the original program but change 70 and 80 to X,0. To keep from deleting the bottom name, change line 10 to N=2 TO 43.

Code: Select all

  1 REM AND EASY METHOD TO MAKE AN ACTION ATTENTION GETTER.
  2 REM SEE T1MEX USER MANUAL PAGE 65 ABOUT PLOT MOVES THE PRINT POSITION. DID YOU SKIP OVER THIS?
  3 REM USE RUN TO START THE ACTION.
 10 FOR N=1 TO 43
 20 PLOT N,N
 30 PRINT "LAURIE G."
 40 UNPLOT N,N
 50 NEXT N
 60 FOR X=43 TO 1 STEP -1
 70 PLOT X,X
 80 UNPLOT X,X
 90 NEXT X
100 GOTO 10
200 REM THE WORD PRINT-OUT STARTS AT PLOT 0+3 BECAUSE PLOT CHARACTER IS 1/2 OF PRINT CHARACTER WIDE. THIS EXERCISE DEMONSTRATES REM 2
300 REM LINES 60-90 PRINTS PLOT PIXELS IN REVERSE. LINE 100 KEEPS THE ACTION GOING.
                       LAURIE G.
                      LAURIE G.
                     LAURIE G.
                    LAURIE G.
                   LAURIE G.
                  LAURIE G.
                 LAURIE G.
                LAURIE G.
               LAURIE G.
              LAURIE G.
             LAURIE G.
            LAURIE G.
           LAURIE G.
          LAURIE G.
Attachments
Graphic_Demo2K.p
(1.41 KiB) Downloaded 13 times
David G
Posts: 214
Joined: Thu Jul 17, 2014 7:58 am
Location: 21 North, 156 West

Loan Status Program - Best Of The Plotter

Post by David G »

Loan Status Program, 12

something wrong with this one, the interest calculation in Line 280 is an order of magnitude off?
1000 PROGRAM LOAN STATUS

by Dick Wagner

Try this program to calculate the total interest paid on a loan. Wait for the questions to show after LOADing.

Commonly used formulae are used. See line 270 for the interest paid and line 295 or the unpaid principal balance. I don't have a record of the program source.

Editor's Note: The program does not take into consideration impounds being paid as a part of the monthly payment: taxes, insurance, etc. You would have to figure those separately.

Code: Select all

   1 REM *************************
  60 GOSUB 1000
 100 PRINT TAB (9); "LOAN STATUS"
 110 PRINT
 120 PRINT ,,,,"THIS PROGRAM WILL COMPUTE THE "
 130 PRINT "APPROXIMATE INTEREST PAID ON A"
 135 PRINT "LOAN FOR ANY GIVEN PERIOD, AND"
 140 PRINT "SUPPLY THE APPROXIMATE PRINCIPAL"
 145 PRINT "BALANCE REMAINING."
 146 PRINT ,,,,"HIT ANY KEY TO CONTINUE"
 147 PAUSE 40000
 148 CLS
 150 PRINT
 160 PRINT "WHAT WAS THE ORIGINAL TOTAL NUMBER OF PAYMENTS?"
 165 INPUT N
 166 PRINT AT 3,25;N
 170 PRINT ,,
 180 PRINT "WHAT IS THE PAYMENT NUMBER OF   THE FIRST PAYMENT IN THE SUBJECTPERIOD?"
 185 INPUT N1
 186 PRINT AT 8,25;N1
 190 LET N1=N1-1
 200 PRINT ,,
 210 PRINT "WHAT IS THE PAYMENT NUMBER OF   THE LAST PAYMENT IN THE SUBJECT PERIOD?"
 215 INPUT N2
 216 PRINT AT 13,25;N2
 220 PRINT ,,
 230 PRINT "PLEASE ENTER THE NORMAL MONTHLY PAYMENT AMOUNT."
 235 INPUT M
 236 PRINT AT 17,25;M
 240 PRINT
 250 PRINT "PLEASE ENTER THE ANNUAL PERCENT-AGE RATE."
 255 INPUT R1
 256 PRINT AT 21,25;R1
 257 PAUSE 400
 258 CLS
 260 LET R=R1/1200
 270 PRINT ,,,,
 275 REM FOR TS 1000 COMPUTERS ENTER SLOW FOR 275
 280 REM FOR TS 1000 COMPUTERS ENTER THIS FORMULA FOR 280: I=M*(N2-Nl-(((1+R)**(N2-N1))/R)+(((1+R)**(N1-N))/R))
 290 PRINT "THE TOTAL INTEREST PAID DURING THE PERIOD IS $";I
 300 REM FOR TS 1000 COMPUTERS ENTER THIS FORMULA: LET V=M/R)*(1-(1+R)**(N2-N))
 310 PRINT ,,,,,,
 330 PRINT "THE UNPAID PRINCIPAL BALANCE    AFTER PAYMENT NUMBER ";N2
 350 PRINT "IS $";V
 360 PRINT ,,,,
 370 PRINT
 380 PRINT "WOULD YOU LIKE TO SOLVE ANOTHER PROBLEM?"
 385 INPUT Z$
 390 IF Z$(TO 1)="Y" THEN GOTO 148
 395 CLS
 400 PRINT
 410 PRINT "THAN YOU. I HOPE I HAVE BEEN OF SOME HELP."
 420 STOP
1100 PAUSE 1200
1105 CLS
1110 RETURN
1120 SAVE "LOAN STATUS"
AUTORUN:
1130 GOTO 1
Attachments
LOAN_STATUS_4K.p
(2.27 KiB) Downloaded 8 times
David G
Posts: 214
Joined: Thu Jul 17, 2014 7:58 am
Location: 21 North, 156 West

[ZX81 Type-Ins] Machine Code Loader - Best Of The Plotter

Post by David G »

Machine Code Loader Program For The TS 1000, page 5

designed to enter Machine Code (MC) that is printed (in magazine articles) in columns like this:
example (not working code)
example (not working code)
When you RUN the loader program (ASSEMBLER), you'll get a prompt. Start entering the numbers. Special control numbers are:
* Input '333' to make a correction
* Input '555' to SAVE
* Input '999' to STOP

NOTE: a line or two is incorrect in this program. I have corrected them per Young's original
A MACHINE LOADER PROGRAM FOR THE T/S 1000

by Dick Wagner

This machine language loading program for loading REM lines used Gordon Young's article "Build Your Own Spreadsheet" in SYNC Jan/Feb 1984 issue. The method provides lor entering the MC, one at a time, into a table 6 columns across, left to right. The MC number can be edited when first displayed, and then again in the table (last line only and not the 6th column). The MC listing scrolls so you have unlimited display space.

It is possible to SAVE the REM listing while in process! The LOADed MC listing (incomplete) can be continued until finished. If STOP is used before finishing, any further input starts back at the beginning. Accordingly you cannot see characters going into REM until finished.

If you have a different column count than 6, then change 9935, 9940 & 9975. The <26 assures the loops continue and when M>26, the loop stops on the 5th input. The M+5 and M-5 allows for 5 inputs of 3 characters and 2 spaces each plus the last 3 characters. See Gordon Young's article for complete details. 16514 is the address for the first byte after REM. This program is for 60 rows of data in 6 columns.

Code: Select all

9900 LET N=16514
9905 LET M=0
9910 INPUT A
9915 IF A>300 THEN GOTO 9960
9920 POKE N,A
9925 PRINT AT 20,M;A
9930 LET N=N+1
9935 LET M=M+5
9940 IF M<26 THEN GOTO 9910
9945 LET M=0
9950 SCROLL
9955 GOTO 9910
9960 IF A>555 THEN GOTO 9999
9965 IF A=555 THEN GOTO 9990 
9970 LET N=N-1
9975 IF M<26 THEN LET M=M-5
9980 PRINT AT 20,M;"   "
9985 GOTO 9910
9990 SAVE "ASSEMBLER"
9995 GOTO 9910
9999 STOP
ASSEMBLER_16K.p
include a 1 REM long enough to enter some short MC
(1.29 KiB) Downloaded 7 times

That's it. No sample MC listing was included. But here's a couple to try.

1. My stock examples, it prints "HELLO WORLD" on the screen:

Code: Select all

42   12   64   35   235  33
147  64   126  254  118  200
18   19   35   24   247  45
42   49   49   52   0    60
52   55   49   41   118
2. The MC listing from page 27 of the "Build Your Own Spreadsheet" article MC Listing. It's longer, i dunno what it does
David G
Posts: 214
Joined: Thu Jul 17, 2014 7:58 am
Location: 21 North, 156 West

[ZX81 Type-Ins] Math Drills - Best Of The Plotter

Post by David G »

Math Drills, from The Best Of The Plotter pages 5-6

Rod Gowen was Treasurer of CCATS
MATH DRILLS by Rod Gowen

This month for our program section we thought be would try to show some of you newer programmers what can be accomplished by a novice hacker with only 1K of RAM to work with.

These three simple math routines were the very first programs written by yours truly right after reading the ZX81 manual. The routines were designed to help my daughters in routine MATH SKILLS. They really did help. They also show that some nice things can be accomplished with very little knowhow and/or memory.

Code: Select all

  10>REM MATH DRILL M
  15 REM Multipication drill
        Written by-
       Rod Gowen
  20 REM SLOW goes here for 1000 
  30 CLS
  31 PRINT "MULTIPLICATION DRILL"
  40 PRINT
  50 LET X=INT (RND*20)+1 
  60 LET Y=INT (RND*20)+1
  70 PRINT AT 10,0;X;"  TIMES  ";Y;"=";,"ANSWER?"
  80 INPUT Z
  90 PRINT AT 10,15;,Z;"      "
 100 PAUSE 200
 110 CLS
 120 IF Z=X*Y THEN PRINT AT 5,0;"GREAT  *****  SUPER";,,,;"NEXT?" 
 130 IF Z=X*Y THEN GOTO 50
 140 IF Z<>X*Y THEN PRINT AT 5,0;"SORRY, WRONG ANSWER-",,,;"TRY AGAIN"
 150 PRINT
 160 IF Z<>X*Y THEN GOTO 70
 170 CLS
 180 STOP
 200 CLS
 201 REM MATH DRILL A
 210 REM Addition Drill
        Written by-
       Rod Gowen 
 220 REM SLOW
 230 PRINT "ADDITION DRILL"
 240 PRINT
 250 LET X=INT (RND*500)+1
 260 LET Y=INT (RND*500)+1
 270 PRINT AT 10,0;X;"  PLUS  ";Y;"=";,"ANSWER?"
 280 INPUT Z
 290 PRINT AT 10,15;,Z;"      "
 300 PAUSE 200
 310 CLS
 320 IF Z=X+Y THEN PRINT AT 5,0;"HOORAY!  =====  GO ON-"
 330 IF Z=X+Y THEN GOTO 250
 340 IF Z<>X+Y THEN PRINT AT 5,0;"NO, NO, NINNY",,,,"TRY AGAIN"
 350 PRINT
 360 IF Z<>X+Y THEN GOTO 270
 370 CLS
 380 STOP
 400 CLS
 401 REM MATH DRILL S
 410 REM Subtraction Drill
 420 SLOW
 430 PRINT "SUBTRACTION DRILL"
 440 PRINT
 450 LET X=INT (RND*500)+1
 460 LET Y=INT (RND*500)+1
 465 IF X<Y THEN GOTO 450
 470 PRINT AT 10,0;X;"  MINUS  ";Y;"=";"ANSWER?"
 480 INPUT Z
 490 PRINT AT 10,16;Z;"         "
 500 PAUSE 200
 510 CLS
 520 IF Z=X-Y THEN PRINT AT 5,0;"RIGHT ON!!  =====  GO ON TO NEXT "
 530 IF Z=X-Y THEN GOTO 450
 540 IF Z<>X-Y THEN PRINT AT 5,0;"NOT SO FAST! DO IT OVER" 
 550 IF Z<>X-Y THEN GOTO 470
 570 STOP
 750 REM The above program was separate programs
      for 1000 and combined here. Works on 2068 also.
 760 STOP
9000 REM To SAVE on the 2068, use GOTO 9100
9010 REM SAVE "math" LINE 9500
9100 REM  To SAVE on 1000/1500 use GOTO 9000 
9110 SAVE "MATH"
9120 RUN
9500 CLS
9501 PRINT "THESE WERE, IN FACT, THE VERY   
FIRST PROGRAMS I EVER WROTE ON  
MY NEW ZX-81 MANY YEARS AGO TO  
AID MY YOUNG DAUGHTERS WITH THEI
R SCHOOLWORK." 

'"WE HAVE COMBINED AND MODIFIED 
THEM A BIT TO ALLOW 2068 USERS 
TO RUN THEM." 
9505 PRINT * "PRESS ANY KEY"
9506 PAUSE 0
9507 CLS
9510 PRINT
9511 PRINT "TO USE EACH SECTION, JUST TELL T
HE COMPUTER TO GOTO THE START LI
NE OF EACH SECTION."
9520 PRINT
9521 PRINT "FOR SUBTRACTION DRILL, ENTER:"''"GOTO 400"''"FOR ADDITION DRILL, ENTER:"''"GOTO 200"''"FOR MULTIPLICATION DRILL, ENTER:"''"GOTO 10" 
9995 REM The above program was 
    separate programs for 1000 
   and combined here. Works on 
   2068 also.
Attachments
MATH_DRILLS_16K.p
(3.08 KiB) Downloaded 10 times
David G
Posts: 214
Joined: Thu Jul 17, 2014 7:58 am
Location: 21 North, 156 West

[ZX81 Type-Ins] A Study Of PLOT - Best Of The Plotter

Post by David G »

This one took a while to fully understand, as I had never used PLOT before, other than typing in the examples in the manual (back in 1982) ... in particular how the PLOT coordinates correspond to PRINT AT coordinates. For one thing, they move in the opposite directions


PLOT, A Study Of, On The 1000, from The Best Of The Plotter pages 8-9

Rod Gowen was Treasurer of CCATS
A STUDY OF PLOT ON THE 1000 by Dick Wagner

PART 1

The manual is a good start to look at the PLOT function but you can investigate more about it yourself. If you want to start a PLOT at an exact spot on the screen in relation to a PRINT situation, you must use the correct PLOT coordinates. A PRINT space contains 4 PLOT pixels and the starting point for counting each pixel is the lower left corner of the PRINT space. Try this:

Code: Select all

  10 PLOT 0,0
...will give the starting corner of PLOT within the PRINT space. To keep track of our PLOT pixel in space use:

Code: Select all

  10 PRINT AT 20,0; CHR$ 8
  20 PRINT AT 21,1; CHR$ 8
  30 PLOT 0,0
Just change line 30 to look at 1,0; 0,1; 1,1.

You will see that even PLOT numbers for X coordinate, across, is the left half of the PRINT space and the even PLOT numbers for Y coordinates, up, is the lower half of the PRINT space. The first number in PLOT is across and the second is up.

An example may help you:

Code: Select all

  10 PRINT AT 10,10; CHR$ 8
  20 FOR N=10 TO 30
  30 PLOT N,21
  40 NEXT N
On RUN, the PLOT line will join the bottom of the PRINT character. If 21 is changed to 20, PLOT is a half a line down and for 22, PLOT goes through the bottom half of PRINT and wipes it out.

To put a line on the right side of PRINT, add:

Code: Select all

  50 FOR M=10 TO 30
  60 PLOT 22,M
  70 NEXT M
Remember, even X coordinates place the PLOT on the left side of PRINT columns, so, by changing 22 to 19 in place of 18, the PLOT is adjacent to the PRINT character.

A STUDY OF PLOT ON THE 1000 by Dick Wagner
PART 2

Page 65 of the manual has a statement about combining PRINT and PLOT. If PRINT position moves to the first space after PLOT then the PRINT character is overprinted by PLOT and we have lost it. The exception is if PLOT is moving upward as in my program in the December issue of THE PLOTTER. By using a-right-to- 1eft PLOT, we can leave a PRINT character on the screen (lines 20 & 30) and wipe out the PLOT pixel with lines 50 and 60.

To put this to example:

Code: Select all

  10 PRINT AT 0,10;"PLOT PROGRAM"
  20 FOR N=48 TO 9 STEP -1
  30 PLOT N,41
  40 PRINT "-"
  50 UNPLOT N,41
  60 NEXT N
The 41 places the PLOT in PRINT row 1, as would 40. The bar is actually a PRINT position in the middle of the space. In fact any character or combination (word) you want to display can be PRINTed in this way. The y coordinate (second number) can be even or odd but must correspond to the PRINT row.

Another example is to PLOT a display using a character such as (*).

Code: Select all

  10 FOR N=60 TO 0 STEP -3
  20 PLOT N,22+ SIN (N/32*PI)
  30 PRINT "*"
  40 UNPLOT N,22+ 20* SIN (N/32*PI)
  50 NEXT N
STEP -3 is used to keep from bunching the points at some location. Try -1, -2 & -5 to see the difference. Remember that the points are actually PRINT and not PLOT.

To my knowledge there is no way to PLOT in BASIC characters.
Attachments
PLOT_4K.p
enhanced PLOT demo
(2.06 KiB) Downloaded 5 times
David G
Posts: 214
Joined: Thu Jul 17, 2014 7:58 am
Location: 21 North, 156 West

JUSTIFICATION and INPUT without a cursor: Programs And Routines - Best Of The Plotter

Post by David G »

Programs And Routines, from The Best Of The Plotter page 1

* How to PRINT right justified
* How to read the keyboard for input without showing the cursor

Short and sweet
PROGRAMS AND ROUTINES...

Here is the first of our series on JUSTIFICATION. It was submitted by Dennis Jurries, who says that he would like to have a short session at the next meeting for those who are interested, to go into further explanation on this subject. Be sure to attend.

RIGHT JUSTIFICATION...

Code: Select all

  10 LET A$="YOUR NUMBER"
  20 PRINT AT X,Y-LEN A$;A$
INPUT WITHOUT CURSOR...

Have you ever wanted to put together a routine in which the computer would wait for an input WITHOUT a CURSOR? If so, try this:

Code: Select all

1000 IF INKEY$<>"5" THEN GOTO 1000
1010 PRINT AT 10,10; "5"
The INKEY$ function does not actually wait for a key to be pressed, rather it scans the keyboard for a certain key being pressed, then takes appropriate action. More on this can be found in the manual under TIME and MOTION.
David G
Posts: 214
Joined: Thu Jul 17, 2014 7:58 am
Location: 21 North, 156 West

[ZX81 Type-Ins] A Quick Tip or 2 or 3 [UNLESS, UNTIL and FREE] - Best Of The Plotter

Post by David G »

[ZX81 Type-Ins] A Quick Tip or 2 or 3[UNLESS, UNTIL and FREE] - Best Of The Plotter

This is about UNLESS and UNTIL, which are not used by BASIC

The third tip is FREE (print the memory available to BASIC)

A QUICKY...OR TWO, OR THREE..., from The Best Of The Plotter pages 13-14
A QUICKY...OR TWO, OR THREE... by Dick Wagner

Are you tempted to use UNLESS as a conditional? It would be nice and you can get the same result as:
XXX IF NOT (condition) THEN (statement)...like this:

Code: Select all

  10 LET C$="y" UNLESS INKEY$= "N"
so use this replacement form:

Code: Select all

  10 IF NOT (INKEY$="N") THEN LET C$="Y"
Now how about the modifier UNTIL? Sinclair BASIC doesn't support
UNTIL as in:

Code: Select all

  10 LET Z=Z-21 UNTIL Y<=52
then try:

Code: Select all

  10 LET Z=Z-21
  20 IF NOT (Y<=52) THEN GOTO 10
Do you need a FREE for your TS1000? Try this:

Code: Select all

9998 PRINT PEEK 16386-16412+256*(PEEK 16387-PEEK 16413)
Editor's note: I think the above should have PEEK as below; it needs to be tested on a TS1000...

Code: Select all

9999 PRINT PEEK 16386-PEEK 16412+256*(PEEK 16387-PEEK 16413)
.

How about the program length is bytes for the TS1000?

Code: Select all

  10 PRINT PEEK 16396*256*PEEK 16397-16509
Editor's note: I think this one also needs PEEK:

Code: Select all

10 PRINT PEEK 16396+256*PEEK 16397-PEEK 16509
That third tip is using ERR_SP-STKEND to determine the free memory left for BASIC. I guess it is similar to FRE in Commodore 64 BASIC
Attachments
QUICKY_1K.p
all three tips demonstrated
(741 Bytes) Downloaded 5 times
Post Reply