Re: [cc65] Questions for CBM guys

From: Groepaz <groepaz1gmx.net>
Date: 2008-02-29 17:07:00
On Freitag 29 Februar 2008, Oliver Schmidt wrote:
> 1. Is it correct to presume that the underlying "DOS" supports (at
> least) 8 open files so that the C-library limit can be used up?

cbm dos supports 15 files, however the first two are reserved for stdin and 
stdout. so yes, 8 open files should work alright.

> 2. Is it possible to open the very same file several times? Maybe if
> it is opened only for reading? The web server calls POSIX open() with
> O_RDONLY.

not sure what you mean. on cbm dos level, when trying to open the same 
filehandle twice, you will get a "file open error". so the answer is probably 
no.

if what you want is like opening an actual file on disk ("testfile.txt") 
twice....i am not sure what will happen. my assumption would be, that you'll 
get problems at least =)

> 3. In order to be able to use all 8 POSIX files for serving HTTP
> request the 3 standard files (in / out / err) are closed right at the
> beginning of main(). However there's a need to write some logging
> information to the screen. The conio library is both a little
> heavyweight and doesn't support scrolling.
>
> So I'm looking for the "standard" ROM (aka Kernal ?) routine for
> putting a character (or a null-terminated string) to the "current
> cursor position and advance that". I'm sure you know what I mean. It's
> not about speed but about simplicity. It would especially be great if
> there were one routine usable both for the 40 and 80 col display on
> the C128.
>
> Im totally new to CBM low level programming so any hints on
> prerequisites for calling that routine (banking ?) are appreciated -
> obviously the same is true for register settings an entry / exit.

the routine is CHROUT or BSOUT ($ffd2). prints one character in A, and does 
all the cursor advancing, scrolling etc. however, CHROUT is file-i/o, it will 
always output to the current active file handle - so mixing it with posix 
stuff is probably not a good idea.

if you need a lightweight logging output, i'd take the cputc source, and 
modify it for scrolling (i think i already did that a while ago, maybe look 
at http://hitmen.c02.at/files/portlib/cc65-portlib.zip)

-- 

http://www.hitmen-console.org
http://www.pokefinder.org
http://ftp.pokefinder.org

Homes for the homeless, jobs for the jobless, neverthe for the nevertheless.

----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Fri Feb 29 17:07:10 2008

This archive was generated by hypermail 2.1.8 : 2008-02-29 17:07:13 CET