Sv: [cc65] Back on Track

Date view Thread view Subject view

From: Martin Ancher Holm - Bankdata (
Date: 2000-01-21 13:08:50

>Spiro answered that correctly. There are three file handles that are
>expected to be already open when the program starts. The values of these
>file handles are #defined by the preprocessor macros FILENO_STDIN,
>FILENO_STDOUT and FILENO_STDERR. However, older software (and most unix
>stuff) assumes that the values are 0, 1 and 2 respectively. So for
>portability sake it is a good idea to make the handles have these values.

In other OSes than 'BASIC on CBM' standard input and output and error, are used, because you can redirect them all to a file or a printer etc.

Since 'BASIC on CBM' OS doesn't support redirection; stdin, stdout and stderr makes no sence.

No, no, I don't want to leave out stdin, stdout and stderr. I want to enable 'BASIC on CBM' OS to support redirection.

Maybe tree pointers in memory could point to strings for stdin, stdout, stderr.

When a program is runned, it checks
$C000-C001 for pointer to string for STDIN
$C002-C003 for pointer to string for STDOUT
$C004-C005 for pointer to string for STDERR

Here's a little "pseudo-program" to show what I mean:

10 POKE emptystring to memory_location_1
20 POKE "8:/OUTPUT.FILE" to memory_location_2
30 POKE "4:" to memory_location_3
40 POKE $C000, LOW(memory_location_1)
50 POKE $C001, HI(memory_location_1)
60 POKE $C002, LOW(memory_location_2)
70 POKE $C003, HI(memory_location_2)
80 POKE $C004, LOW(memory_location_3)
90 POKE $C005, HI(memory_location_3)

MY-PROGRAM will take input from keyboard (because an emptystring assumes default), write output to OUTPUT.FILE and print errors on the printer.

Martin Ancher Holm
Work <>, Home <>
<>,    Cell <>

... Vis respekt for de śldre: Lav hard-code i dine programmer.

To unsubscribe from the list send mail to with
the string "unsubscribe cc65" in the body(!) of the mail.

Date view Thread view Subject view

This archive was generated by hypermail 2.1.3 : 2001-12-14 22:05:35 CET