Commodore 128 System Manual page 277

Table of Contents

Advertisement

G 064
Switch to C64 mode
G064
This statement switches from C128 mode to C64 mode. The
question " Are You Sure?" is displayed in response to the G 064
statement. If Y is typed, then the currently loaded program is lost
and control is given to C64 mode; otherwise, if any other key is
pressed, the computer remains in C128 mode. This statement
can be used in direct mode or within a program. The prompt is
not displayed in program mode.
GOSUB
Call a subroutine from the specified line number.
GOSUB line number
This statement is similar to the GOTO statement, except the
Commodore 128 returns from where it came when the subroutine
is finished. When a line with a RETURN statement is
encountered, the program jumps back to the statement
immediately following the GOSUB statement.
The target of a GOSUB statement is called a subroutine. A
subroutine is useful if a task is repeated several times within a
program. Instead of duplicating the section of program over and
over, set up a subroutine, and GOSUB to it at the appropriate
time in the program. See also the RETURN statement.
EXAMPLE:
20 GOSUB 800
799 END
800 PRINT " HI THERE": RETURN
This example calls the subroutine beginning at line 800 and
executes it. All subroutines must terminate with a RETURN
statement.
Line 799 stops the program accidentally falling through into the
subroutine.
17-35

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

128d

Table of Contents