Re: [cc65] cl65 -t apple2 works, but cl65 -C apple2.cfg doesn't

From: Scott Alfter <scott1alfter.us>
Date: 2007-09-10 12:17:24
Oliver Schmidt wrote:
>> I can edit it to change the start
>> address (moving it to $2000 and resaving the binary with type SYS instead of
>> $00 creates a file that can be double-clicked from the Finder to launch, though
>> it crashes to the Monitor when it exits...there's probably a ProDOS MLI call or
>> something that can be hacked in at the end of main() to fix that).
> 
> I'd rather stay clear from trying to hack a BIN file into a SYS file...
> 
> The contribution section contains a ProDOS loader that is a
> less-than-512-byte SYS file loading the BIN files created by the cc65
> toolchain.

I know about that.  Using two files where one would do seems less than optimal,
but I suppose that's a matter of opinion.

> The benefit of this approach is that the final binary starting at $800
> has $1800 more RAM available.

That's admittedly a nice bonus.

> - As long as a cc65 binary doesn't use file I/O it may run as DOS 3.3
> binary, as ProDOS binary launched from BASIC.SYSTEM ans via the loader
> as ProDOS SYS file.

I don't think I've used DOS 3.3 on a regular basis in more than 20 years; since
there's so much stuff I use (hard drives, network, etc.) that doesn't work
under DOS 3.3, compatibility with it is a non-issue.

>> I can also build and load tgidemo, but it runs into a problem when it tries to
>> load the TGI driver.
> 
> Works fine for me.
> 
>> ld65: Error: File `a2e.hi.tgi' has unknown type
> 
> Surely, it's not an object file. It's a dynamically loadable module.
> Check out the cc65 docs.

I kinda figured that out, but the TGI documentation (including such small
details as how projects that use it should be built, what driver file(s) need
to accompany the executable, what it should be named, and the correct filetype
and auxtype for such files) is pretty much nonexistent.  Here's the output from
grep on the contents of /usr/share/doc/cc65-2.11.9.20070903/html when searching
for "tgi" (search is case-insensitive):

apple2-5.html:<DT><B><CODE>a2.lo.tgi</CODE></B><DD><P>This driver was written
by Stefan Haubenthal. It features a resolution of
apple2-5.html:<DT><B><CODE>a2.hi.tgi</CODE></B><DD><P>This driver was written
by Stefan Haubenthal. It features a resolution of
apple2enh-5.html:<DT><B><CODE>a2e.lo.tgi</CODE></B><DD><P>This driver was
written by Stefan Haubenthal. It features a resolution of
apple2enh-5.html:<DT><B><CODE>a2e.hi.tgi</CODE></B><DD><P>This driver was
written by Stefan Haubenthal. It features a resolution of
atmos-5.html:<DT><B><CODE>atmos-240-200-2.tgi</CODE></B><DD><P>This driver was
written by Stefan Haubenthal. It features a resolution of
c128-5.html:<DT><B><CODE>c128-vdc.tgi</CODE></B><DD><P>This driver was written
by Maciej Witkowiak. It uses the 80 column display
c128-5.html:<DT><B><CODE>c128-vdc2.tgi</CODE></B><DD><P>This driver was written
by Maciej Witkowiak. This driver uses the 80 column
c64-5.html:<P><EM>Note:</EM> All available graphics drivers for the TGI
interface will use
c64-5.html:<DT><B><CODE>c64-hi.tgi</CODE></B><DD><P>This driver features a
resolution of 320*200 with two colors and an
geos-1.html:<P><CODE>tgi</CODE> - TGI driver for GEOS that supports both 40 and
80 columns modes but mode can not be
geos-1.html:changed between <CODE>tgi_init</CODE> and <CODE>tgi_done</CODE>.</P>
geos-1.html:<CODE>assert.h, conio.h, dio.h, errno.h, em.h, geos.h, joystick.h,
modload.h, mouse.h, stdlib.h, string.h, tgi.h, time.h</CODE></P>
lynx-5.html:<P>A TGI driver for the standard graphics mode (160&times;102 in 16
colors) is
lynx-5.html:<P>The TGI driver is implemented as a dual buffering device. To use
it as a
lynx-5.html:<P>The TGI driver has a few Lynx-specific extensions.</P>
lynx-5.html:<P>Calling tgi_ioctl(0, spr) will display a standard Lynx sprite on
screen.</P>
lynx-5.html:<P>Calling tgi_ioctl(1, 0) will do a flip screen. If you decide to
flip the
lynx-5.html:<P>Calling tgi_ioctl(2, bgindex) will set the text background color
to the index

BTW, my name's not Shirley. :-)

>> Since the documentation for the Apple II libraries says file I/O isn't working
>> yet, maybe this is to be expected.
> 
> You obviously are looking at quite outdated docs.

The documentation on the website is outdated?  Perhaps it should be brought up
to date.  A project's website is where I tend to look first for documentation.

That said, as indicated above, I've found newer documentation installed locally
that got installed along with a newer version...see below.

>> Time to unpack the Apple II books so I can
>> figure out what I need to do.
> 
> Or just grab the latest cc65 snapshot. It has comprehensive file I/O
> support based on the ProDOS MLI. The TGIDEMO runs nicely dynamically
> loading the .tgi driver.

I've already done that...someone pointed me toward an ebuild that pulled a
newer version than what I had been using.  My usual inclination is to stick
with released versions instead of the bleeding edge (especially with the
warning the index file gives WRT the contents of the snapshot directory), and
since the newest version listed under ftp://ftp.musoftware.de/pub/uz/cc65/ is
2.11.0, that's what I had started with.

Here's what I've done to try getting it to work:

cc65 -t apple2enh tgidemo.c
ca65 tgidemo.s
ld65 -t apple2enh --start-addr 0x4000 -o tgidemo tgidemo.o apple2enh.o \
  apple2enh.lib

tgidemo and a2e.hi.tgi were then pulled across the LAN to the root directory of
my IIGS's boot drive.  Upon going into BASIC.SYSTEM, I then punched in this
(copying files created on the Linux box to the GS results in the filetype
returned by netatalk being set to $00 instead of BIN):

bload tgidemo,a$4000,b4,t$00
call 16384

It then asks you to press Y if the driver (a2e.hi.tgi, presumably...this string
shows up in a hexdump of tgidemo) is present in the same directory.  I press Y;
it then outputs the following:

Ok. Please wait patiently...
tgi_load: 1

...and then it drops back to the prompt.  Presumably, the non-zero return code
from tgi_load() indicates failure of some sort.

> Generally I'd stop presuming that everything is broken and/or incomplete.

I thought I've been reasonably polite here while trying to get this toolchain
up and running.  Your condescension isn't warranted.  (I was about to make a
wisecrack about how cryptic, unhelpful remarks with no real answers to the
question at hand are best left unposted, but decided against it. :-) )

In any case, it's past 3 AM now and I have to go in to work in a few
hours...time to call it a night and see what further clues

Scott Alfter
scott@alfter.us

----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Mon Sep 10 12:17:40 2007

This archive was generated by hypermail 2.1.8 : 2007-09-10 12:17:43 CEST