Structured_Programming_with_Comal_Addendum_for_C64_0.14.pdf

(222 KB) Pobierz
STRUCTURED PROGRAMMING WITH COMAl - HOW TO USE IT WITH C64 COMAl 0.14
Structured Programming with CO MAL was written using CBM PET COMAl 0.11 and
~iccolo
COAAl as
examples. Both COMAls have since been
upgraded~
but since COMAl is
standardized~
few things
have changed that affect the book. This page
OT
notes is your key to adapting tne book.
*
Page 15: There is no ESCAPE key - use RUN/STOP key instead in most cases. Also no REPEAT
key.
*
SELECT OUTPUT "LP" now requires a colon after the lP=) SELECT OUTPUT HLP:" (see page 21)
* SELECT OUTPUT "OS" now requires a colon after the DS=) SELECT OUTPUT "OS:" (see page
21)
*
BYE is not, not needed In Commodore COMAL (see,page (see page 22)
BASIC
*
RANDOMIZE ISimplementedin -,use will be instead -as omit It•• 22) (see page 23)
*
CHR( •• ) can be typed
but
listed
CHR$( ) -
* Variable names canNOT use SHIFTED letters. Only unshifted letters, numbers, and
'J[
(see
page 26). Var i ab Ie names c an be up to 78 characters' long. (Keywords cannot be used as a
variable name: beware of: RIGHT, LEFT, BACK HOME RUN, KEY)
*
Integer variables end with the
#
sign, no( the
t
sign (see page 27)
* Substring specification has changed (see p-age 28
&
66) - now specify start and end
character, not start character and number of characters.
SHOWN: rec$(19:6)
CHANGE TO: rec$(19:24)
SHOWN: letter$(pos:l)
CHANGE TO: letter$(p.os:pos) OR: letter'(p.0s)
* VAL (see Rage 29) is not imp'lemented in COMAL 0.14. A proc to do this is included on the
COMAL Disk (integers only) anij in the COMAL TODAY newsletter (floating point).
* STR (see page 30) is not implemented in COMAL 0.14 but can be achieved with a
~ser
defined
proc.
, '
ZONE (see page 35) statement changed from ZONE:=(nuI? Into ZONE (nurn).
SHOWN: ZONE:=8
CHANGE TO: ZONE 8
*
So~e
p'rograms assume an 80 column screen / printout. They must be adapted to a 40 column
~c~~~nb~~~ew~:g:rfit~n7~~fore
the CURSOR command was
im~lemented
in CBM COMAL version 2." and
RC COMAL
2~0.
Both use
CURSOR(ROW~COL).
This book uses
CURSOR(x~y)
- (see page 36). C64 COftAL
0.14 doesn't havel a CURSOR commano: but a user defined CURSOR
P~OC
is included on the C64
COftAL System Disk (using ROWACOL as it should be). To adapt to the way this book uses CURSOR
Merely use the
follo~ing
CURoOR2 PROC when requested by the book (it calls the REAL CURSOR
groc which is listed below as well:
PROC CURSOR2(x,Y)
PROC CURSOR(ROW,COL)
CURSOR(Y~x)
POKE
212~0
//guote mode off::PET use POKE 205,0
ENOPROC
CO~SOR2
~~~N~;~~~'bl~6~-{/DMOP~I~¥RER~$(17)
/ICURSOR DOWN
FOR X:=l to COL-l 00 PRINT CHR$(29); //CURSOR RIGHT
ENDPROC CURSOR
CHANGE TO; CURSOR2(37,11)
ORr CURSOR(11,37)
SHOWN: EXEC
cursor(37~11)
Add following line just after the last ELSE on the page:
*
BUGF~~NB~~fAl~EPROG
AM;
*
BUG IN page 119 PROGRAM; add to second program
I:,
line; SELECT OUTPUT "LP;"
Page 97; SHOWN; SELECT OUTPUT PRINTER
CHANG TO;
*
RNO"shoulH be rep-laced by RNO(0) -- (see page 129) ;VOW:=0 "
*
u* Function specification was changed. In the early COMAL versions, a procedure was used
3S
a
function, merely assigning a value to the function name. Now, a function has its own header
and end: FUNC and ENOFUNC, and the value is RETURNed. (see page 136):
SHOWN: PROC ran
CHANGE TO;
FUNC RAN
y:=25.173*x+3.921
Y:=25.173*X+3.921
~~~y;!NT(y)
~~T~R~Ni(Y)
ENOPROC
ENDFUNC RAN
I
A label must now be
follow~d b~
a colon (:) -- (see page 139):
~HOWN:
again
CHANG~
TO.
AGAIN:
*
Page 157 PROGRAA BUGS: SENTINEl$ was misspelled once as SENTINAL$, and the 3rd last line:
SHOWA: FOR L;= •••
CHANGE TO: FOR K:= •••
*
Page 160 PROGRAA BUG: SHOWN: en:=p'air-l CHANGE TO: EN:=PAIR
* Page 173 PROGRAA BUG; SHOWN: READ(row col) CHANGE TO: READ ROW COL
*
Page 174 PR8GRA" BUG; SHOWN: change(row,col):=1 CHANGE DIM QUEUE(0:6)
*
Page 179 PR GRAM BUGS; SHOWN;was DIM queue('o) once CHANGE TO: TO; CHANGE(ROW,COL);=0
*
Page 185 PROGRAM BUGS; COMP
BUG;
missp~lled
as
*
Page 203 PROGRAM ORO (y$ BIRTH$ was misspelled YEAR: =CAMP ( the $ as BIRTH, and
once without
SHOWN: year; =
•••
CHANGE TO;
(OROY$
*
When writing a written to( adisk will be two bytes moreit than •••a two byteof
len~th
string (see
string
file, CBM COMAL precedes
with
counter. Thus
the total length
to
the lengtn
t~e
~age
204):
SHOWN: OPEN 2,"textfile"ORANDOM 6
CHANGE TO: OPEN FILE 2,"textfile",RANOOM B
Page 205 SHOWN. • •• RA.ND Pl 11
CHANGE TO: • •• RANDOPl 13
Page 206, 208, 210 SHOWN:
•• RANDOM
•• RANDOM 19
*
~hen
writing the number to(see•file, 205) 17 CHANGE TO; in • binary - always 5 bytes long,
a
a
CBM COMAL writes it
regardless of
number
page
A disk with all (that could fit on one disk) programs,
examples~
and samp'les correctly adapted
to C64 CO"AL is available for $19.95 from COMAL Dsers Group,
U.~.A.,
Limited.
*
Zgłoś jeśli naruszono regulamin