45
SWAP (swap)
Calls out a program in the file during execution of the program.
Format:
SWAP
11
[<device name> :] <filename>
11
Note: Only FDn device name.
Abbreviated form:
SW.
Explanation:
• Subroutine calls separate program in file from program being executed. Program in
program area is temporarily evacuated to vacant area in floppy disk, and called
program is read into text area. The original variable in the text area at this time is
transferred to the called program. (See page 27.)
• An error occurs if a write-protect seal is put on the default drive floppy disk.
Example:
1 0
A=1: B =2
20
30
,--.40
PR I NT
11
A
= ";
A,
11
~!';~cf}·i:.,·.
.,
SWAP
11
F D 2 :
PRO G'" .
j
.. ""
•
11
11 •
11
./i~~
"
"
PR I NT
A
=
,A,
B.:=,. 1'~'~ii.~,,~'
50
END
10
A=A*10:B=B*10
20
END
(SWAP
FD2
PROG)
..... When this program is executed, A
=
1 and B
=
1 are displayed on CRT screen
when line 20 is executed. At line 30, the SWAP command is executed and the
program file "PROG" in floppy disk drive 2 is executed. At end, automatically
returns to original program, A
=
10 and B
=
20 are displayed when line 40 is
executed, and program execution finishes.