Re: [cc65] cc65 and $ba again, sorry

Date view Thread view Subject view

From: carlos (carlosofcascade_at_gmx.net)
Date: 2003-10-17 19:53:24


Hy Ulrich,
I see your arguments, but there should be any possibility to find out which
drive has been accessed the last time or something like this, because i
don't want to have a program running only on drive 8.
The natural thing is, that you use the drive, from where the program has
been loaded.
The second thing is, that there are kernal variables $9a/$9b for stdin
stdout. This is where the drive
output/input device number goes when doing a cmd ... from the c64 basic
prompt.
So i don't understand why to mess up $ba, which is at the moment the only
possibility to get drive from where the program has been loaded.
If there would be another way instead of using kernal variables directly, i
would appreciate.

Carlos


>
> Hi!
>
> On Fri, Oct 17, 2003 at 04:57:38PM +0200, carlos wrote:
> > You see, that something goes wrong there.
>
> Sorry, but no, I cannot see what is wrong. Yes, I have run the program,
but
> since you didn't tell what you expect/not expect to happen, it is rather
> difficult for me to find out what the problem might be.
>
> $ba is the current device used for input and/or output. Any file open (and
> that includes stdout and stderr) will change this variable. It is clear
that
> this happens and why it happens, and I cannot see any problem with it.
>
> In general, it's a bad idea to work with different level of APIs. If you
use C
> file I/O, you should not use POSIX file I/O or CBM file I/O or mess with
any
> low level kernal variables and hope the upper layers won't notice. What
that
> means is that if you're using variables like $ba directly, then your
program
> should not use any file I/O in C (and this includes printf/fprintf!),
because
> this won't work in many cases. Or it may work in one compiler version and
stop
> working after an update. This is not only true for file I/O, but for any
API
> provided by the cc65 libraries. Using conio, and writing to the ROM cursor
> position stored in the zero page is not supposed to work (not even reading
the
> cursor position from the kernal variables is supposed to work!). This is
true
> for almost every API and is not limited to cc65 and the 6502 platforms it
> supports.
>
> Regards
>
>
> Uz
>
>
> --
> Ullrich von Bassewitz                                  uz_at_musoftware.de
> ----------------------------------------------------------------------
> To unsubscribe from the list send mail to majordomo_at_musoftware.de with
> the string "unsubscribe cc65" in the body(!) of the mail.
>
>


----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo_at_musoftware.de 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 : 2003-10-17 20:02:02 CEST