graph).
(ii) whereabouts on the screen to put the x-axis (corresponding to 22 in line 20 in the
SIN
graph
program).
(iii) how to scale the y-axis of the graph (corrsponding to 20 in line 20 of the
SIN
graph program).
You will find that
COS
is the easiest - it's just like
SIN
.
5. Run this:
10
PLOT
21,21
20
PRINT
"HEAVY QUOTES"
30
PLOT
46,21
PLOT
moves on the
PRINT
position. (
UNPLOT
does too.)
6. This subroutine draws a (fairly) straight line from the pixel (A,B) to the pixel (C,D).
Use it as part of some main program that supplies the value of A, B, C & D.
(If you have not got a memory expansion board then you'll probably need to omit the
REM
statements.)
1000
LET
U=C-A
1005
REM
U SHOWS HOW MANY STEPS ALONG WE NEED TO GO
1010
LET
V=D-B
1015
REM
V SHOWS HOW MANY STEPS UP
1020
LET
D1X=
SGN
U
1030
LET
D1Y=
SGN
V
1035
REM
(D1X,D1Y) IS A SINGLE STEP IN A DIAGONAL DIRECTION
1040
LET
D2X=
SGN
U
1050
LET
D2Y=0
1055
REM
(D2X,D2Y) IS A SINGLE STEP LEFT OR RIGHT
1060
LET
M=
ABS
U
1070
LET
N=
ABS
V
1080
IF
M>N
THEN GOTO
1130
1090
LET
D2X=0
1100
LET
D2Y=
SGN
V
1105
REM
NOW (D2X,D2Y) IS A SINGLE STEP UP OR DOWN
1110
LET
M=
ABS
V
1120
LET
N=
ABS
U
1130
REM
M IS THE LARGER OF ABS U & ABS V, N IS THE SMALLER
1140
LET
S=
INT
(M/2)
1145
REM
WE WANT TO MOVE FROM (A,B) TO (C,D) IN M STEPS USING N UP- DOWN OR
RIGHT-LEFT STEPS D2, & M-N DIAGONAL STEPS D1, DISTRIBUTED AS EVENLY AS POSSIBLE
1150
FOR
I=0
TO
M
1160
PLOT
A,B
1170
LET
S=S+N
1180
IF
S<M
THEN GOTO
1230
1190
LET
S=S-M
1200
LET
A=A+D1X
1210
LET
B=B+D1Y
1215
REM
A DIAGONAL STEP
1220
GOTO
1250
1230
LET
A=A+D2X
1240
LET
B=B+D2Y
1245
REM
AN UP-DOWN OR RIGHT-LEFT STEP
1250
NEXT
I
1260
RETURN
The last part (lines 1150 on) mixes the M-N step D1 evenly with