70 IF PEEK(104) < >17 THEN POKE 103,44: POKE 104,17: POKE 4395,0: PRINT CHR$(4)"RUN SUBR.MAST.DEMO1"
80 IF PEEK(2304) < >32 THEN PRINT CHR$(4)"BLOAD SUBR.MASTER"
90 SUB1 = 3141:RET = SUB1:EXIT = 4058
100 HOME : VTAB 12: HTAB 3: PRINT "DEMONSTRATION OF SUBROUTINE MASTER": HTAB 6: PRINT "BY CEM KANER AND JOHN VOKEY": PRINT " COPYRIGHT (C) 1985 BY MICROSPARC, INC.": CALL RET,"TO CONTINUE": HOME
110 HOME : INVERSE : PRINT "DEMONSTRATION OF PARAMETER PASSING": NORMAL
120 PRINT : PRINT "THE VALUES OF THE VARIABLES IN THE": PRINT "CALL STATEMENT ARE PASSED TO THE": PRINT "CORRESPONDING VARIABLES IN THE": PRINT "DEF STATEMENT:": LIST 350: LIST 390
130 PRINT : PRINT "THE VALUES OF THE VARIABLES IN THE": PRINT "DEF STATEMENT ARE PASSED BACK TO THE": PRINT "CORRESPONDING VARIABLES IN THE": PRINT "CALL STATEMENT."
140 CALL RET,"FOR LISTING": HOME : INVERSE : PRINT "LISTING OF PARAMETER PASSING DEMO:": NORMAL : PRINT : LIST 330,430
150 CALL RET,"TO RUN PROGRAM": HOME : INVERSE : PRINT "PARAMETER PASSING DEMO": NORMAL : GOSUB 330: CALL RET,"FOR NEXT DEMO"
160 HOME : INVERSE : PRINT "DEMONSTRATION OF LOCAL VARIABLES": NORMAL
170 PRINT : PRINT "EACH VARIABLE IN THE DEF STATEMENT": PRINT "IS A LOCAL VARIABLE, DISTINCT FROM": PRINT "VARIABLES OF THE SAME NAME IN THE MAIN": PRINT "PROGRAM."
180 PRINT : PRINT "THE LOCAL STATEMENT CREATES ADDITIONAL": PRINT "LOCAL VARIABLES THAT ARE DISTINCT": PRINT "FROM MAIN PROGRAM VARIABLES."
190 LIST 510
200 CALL RET,"TO LIST PROGRAM": HOME : INVERSE : PRINT "LISTING OF DEMO2": NORMAL : LIST 440,540
210 CALL RET,"TO RUN PROGRAM": HOME : INVERSE : PRINT "LOCAL VARIABLE DEMO": NORMAL : GOSUB 440
220 CALL RET,"FOR NEXT DEMO"
230 HOME : INVERSE : PRINT "EXPRESSION PASSING DEMO": NORMAL : PRINT : PRINT "EXPRESSIONS MAY BE USED IN THE": PRINT "CALL STATEMENT:": LIST 570
240 PRINT "VARIABLES INCLUDED IN EXPRESSIONS": PRINT "ARE NOT AFFECTED, EVEN IF THE": PRINT "SUBROUTINE CHANGES THE VALUE OF THE": PRINT "CORRESPONDING VARIABLE IN THE": PRINT "DEF STATEMENT."
250 CALL RET,"TO LIST PROGRAM": HOME : INVERSE : PRINT "LISTING OF DEMO3": NORMAL : LIST 550,650
260 CALL RET,"TO RUN PROGRAM": HOME : INVERSE : PRINT "EXPRESSION PASSING DEMO": NORMAL : GOSUB 550
270 CALL RET,"FOR NEXT DEMO"
280 HOME : INVERSE : PRINT "DEMONSTRATION OF PASSING STRINGS": NORMAL : PRINT : PRINT "STRING VARIABLES AND STRING LITERALS": PRINT "ARE HANDLED IN THE SAME WAY AS": PRINT "NUMERICS.": LIST 680: LIST 720
290 CALL RET,"FOR LISTING": HOME : INVERSE : PRINT "LISTING OF DEMO4": NORMAL : LIST 660,760
300 CALL RET,"TO RUN PROGRAM": HOME : INVERSE : PRINT "STRING PASSING DEMO": NORMAL : GOSUB 660
310 CALL RET,"TO QUIT": HOME
320 END
330 REM PARAMETER PASSING DEMO
340 A = 5: PRINT : PRINT "A="A" BEFORE."
350 CALL SUB1,A
360 PRINT : PRINT "A="A" AFTER."
370 RETURN : REM *** RETURN FROM THIS DEMO
380 REM *** BEGINNING OF SUB1
390 DEF SUB1,N
400 PRINT : PRINT "N="N" (VALUE RECEIVED FROM A)"
410 N = N *10: PRINT : PRINT "VALUE OF N CHANGED TO "N"."
420 CALL EXIT,SUB1
430 REM *** END OF SUB1
440 REM LOCAL VARIABLE DEMO
450 A = 14:B = 34: PRINT : PRINT "BEFORE:": PRINT "A="A" AND B="B" (GLOBAL VARIABLES)