Re: [cc65] Questions for CBM guys

From: Spiro Trikaliotis <>
Date: 2008-03-02 14:21:13
Hello Oliver,

* On Sun, Mar 02, 2008 at 01:11:09PM +0100 Oliver Schmidt wrote:
> - The cc65 C-library POSIX functions allow for 8 open files, 3 being
> preopened as stdin, stdout and stderr. Closing those 3 allows for 8
> disk files.

I am not sure here and will let others answer this question.

> - The C64 (and C128 ?) Kernal allows for 15 open files, 2 being
> reserved for "stdin" and "stdout". So it allows for 13 disk files.


The C64 KERNAL allows for 10 open files at a time. Here, stdin and
stdout do NOT count.

> - Most (propably all) drives allow for 3 open sequential files.

2031, 154x and 157x: Yes. I am not sure about the 1581, though.

> - There are Kernal entry points available both for the C64 and C128 to
> allow for direct printing to the screen bypassing the file/channel
> abstraction layer.


> So there's no real point in
> bypassing them for screen output.

Especially thinking about "How much" code you are bypassing, it is
seldom woth the trouble.

Take for example the C64 KERNAL:

FFD2 JMP ($0326)   ; this points to $F1CA

F1CA PHA           ; remember char to output
F1CB LDA $9A       ; get device no. of device to output to
F1CD CMP #$03      ; is it device 3 (screen)?
F1CF BNE $F1D5     ; no, test for others
F1D1 PLA           ; get back char to output
F1D2 JMP $E716     ; output on screen
F1D5 ...           ; starting here, test if the output goes to TAPE,
                   ; RS232, or IEC bus

The code is identical for the C128; only the locations are different:
$0326 points to $EF79, and the equivalent of $F1D2 ($CF81) jumps to
$C00C. Even the location $9A for the device no of the output device is

The VIC20 is the same, only other locations in $0326 and for $E716.

The plus/4 is similar ($99 instead of $9A, and the pointer in $0326 can
be found at $0324 and points to $EC4B).

Even the PETs have similar code with other locations ($B0 instead of
$9A in KERNAL4).

Thus, personally, I would rather still use $FFD2. If I want to do some
hack, I would rather temporarily change $9A (or whichever location it is
on another computer).


Spiro R. Trikaliotis                               
To unsubscribe from the list send mail to with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Sun Mar 2 14:21:41 2008

This archive was generated by hypermail 2.1.8 : 2008-03-02 14:21:44 CET