Next Previous Contents

7. Other hints

7.1 Passing arguments to the program

Command line arguments can be passed to main(). Since this is not supported by BASIC, the following syntax was chosen:


  1. Arguments are separated by spaces.
  2. Arguments may be quoted.
  3. Leading and trailing spaces around an argument are ignored. Spaces within a quoted argument are allowed.
  4. The first argument passed to main is the program name.
  5. A maximum number of 10 arguments (including the program name) are supported.

7.2 Program return code

The program return code (low byte) is passed back to BASIC by use of the ST variable.

7.3 Interrupts

The runtime for the PET uses routines marked as .CONDES type 2 for interrupt handlers. Such routines must be written as simple machine language subroutines and will be called automatically by the interrupt handler code when they are linked into a program. See the discussion of the .CONDES feature in the assembler manual.

7.4 Using extended memory

The extended memory at $9000 of the CBM 8x96 may be added to the heap by using the following code:

    /* Check for the existence of RAM */
    if (PEEK(0x9000) == POKE(0x9000, PEEK(0x9000)+1)) {
        /* Add it to the heap */
        _heapadd ((void *) 0x9000, 0x2000);

Next Previous Contents