Re: [cc65] Supervision support

Date view Thread view Subject view

From: Ullrich von Bassewitz (uz_at_musoftware.de)
Date: 2003-09-23 11:04:32


Hi!

On Mon, Sep 22, 2003 at 12:05:03PM +0200, Peter Trauner wrote:
> Since this is a console and the program is in ROM, how do I
> initialize/handle
> non const global variables?

You must use different LOAD and RUN addresses and copy the variables from ROM
into the RAM. For a standard DATA segment, there's a routine named copydata in
the library which does exactly this - you will have to call it in your startup
file.

> Is it possible to prevent read only accesses from write only io ports?

No, if the hardware doesn't have this feature, you cannot prevent it by
software.

> Is it safe to call c functions from irq, nmi?

In general: no. The reason is decribed here:

        http://www.cc65.org/faq.php#IntHandlers

> I have 4 linker configuration files for 16, 32, 64, 128kbyte cartridges
> (64, 128kbyte are bankswitched).
> Is it allowed to support several supervision targets?

I would prefer not to have more than one builtin config per platform, so you
will have to choose the most common one. It is not more difficult for a user
to say "-C sv128.cfg" on the command line instead of "-t sv-128". The reason
for the builtin configurations is not to save the user the trouble to use
configuration files at all.

> PS: I attached my work files
> (how must I deliver/integrate supervision support in cc65?)
> (some remarks about my first cc65 usage?)

[Next time, please place the files somewhere onto a web or ftp server and just
post a link.]

As far as I can see, there are several smaller issues with the files, but
nothing serious:

  1. Assembler files are named xxx.s, not xxx.asm

  2. All upper case names are used for #defines, structs shouldn't use it.

  3. Some stuff is already available in the library and should be reused (like
     hex2asc).

  4. I prefer not to have code commented out. If it is not needed, remove it,
     if it is needed, enable it. Especially .if/.ifdef is ugly and problematic
     to maintain, because some code path is not executed and tested when
     making changes.

  5. Some stuff is targeted for the 2.9 versions and should be adapted to work
     with the head branch.

  6. Not sure about the functions in common.asm: I don't like the idea to have
     functions that are similar to the ones from conio but with other names
     and prototypes.

  7. I prefer not to have unneeded types and defines like "byte" and "word"
     defined in some header file, because this may collide with identifiers
     used by a program. This is especially true for "true" and "false" because
     for C99 these are even in the standard. In general: Since you are on the
     "other side" of the code (you are writing an implementation, not a
     program), please try to be as careful as possible when introducing new
     types and names: Someone may have a program that does already use the
     types/names in question.

  8. A few structural changes to the headers to make them similar to the
     existing ones would be nice.

Anything mentioned above assumes inclusion into the main cc65 package - if
you're planing to distribute your files separately, only 5. and maybe 7. is of
relevance.

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.


Date view Thread view Subject view

This archive was generated by hypermail 2.1.3 : 2003-09-23 11:08:05 CEST