[logo]
WELCOME TO THE '65 SITE' WITH STUFF ABOUT

COMMODORE C65

HEXTIME 07E5.04.12 04.1A.21
HOME INFOS TIPS SOFTWARE PATCHES MEM MAP EMULATOR LINKS ABOUT 

DIR

"TIPS            " 65 1D
67   "LIST 'FILENAME'"  INFO
106  "MERGE WORKAROUNDINFO
2987 BLOCKS FREE

READY.
TYPE "TIPS"

 LIST "FILENAME"                                                   ­ (added: 2020/11/22) 

In BASIC 10 there is an extended LIST command compared to the earlier Commodore BASIC versions.

You can use it to display not only a BASIC program that is currently in memory as usual, but also a BASIC program that is on the disc:

LIST "filename" [, Ddrive] [<, | ON> Udevice]

lists the program 'filename' without(!) destroying or changing the current BASIC program in the memory.

For example, it is convenient to have the listing of a program displayed to look something up there without having to save the current BASIC program first.

LIST "filename" works in direct mode and also as a command in the program with filename 'PROGRAM1' or with 'P*' or '*' for the filename.
----------------------------------------------------------------------------------------

 MERGE TWO BASIC 10 PROGRAMS                                       ­ (added: 2020/10/11) 

BASIC 10 doesn't have a MERGE command to merge two BASIC programs from disc into one.

Here is a workaround for merging two BASIC 10 programs:

Load the first program with:

DLOAD "PROGRAM 1"

Then type in direct mode:

B=(256*PEEK(175)+PEEK(174))-2
POKE 46,B/256
POKE 45,B-PEEK(46)*256


After that load the second program with:

DLOAD "PROGRAM 2"

Finish the 'MERGE' with:

POKE 45,1:POKE 46,32
CLR



Here is a short explanation of the technical background of this workaround:

The start address of the BASIC 10 program is stored in addresses 45 and 46 ($2D-$2E). In the addresses 174 and 175 ($AE-$AF) you can find the end address of the BASIC 10 program.

With the workaround, after the first program is loaded, the start address will be temporarily set to the end of the first program (-2, since two end markers are 'too many').

The second program then loads to this new start address (which is the end of the first).

After loading, the start address is set back to the default value 8193 ($2001).

With the final CLR command you clean up the variables, etc., just to "be on the safe side".
----------------------------------------------------------------------------------------

READY.