Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.sys.apple2 > #20955 > unrolled thread

How configure cc65 on a pc

Started byDidier VALLET <dv.vallet@gmail.com>
First post2014-08-01 22:51 -0700
Last post2014-08-02 19:37 -0500
Articles 11 — 4 participants

Back to article view | Back to comp.sys.apple2


Contents

  How configure cc65 on a pc Didier VALLET <dv.vallet@gmail.com> - 2014-08-01 22:51 -0700
    Re: How configure cc65 on a pc "Bill Buckels" <bbuckels@mts.net> - 2014-08-02 06:48 -0500
    Re: How configure cc65 on a pc "Bill Buckels" <bbuckels@mts.net> - 2014-08-02 08:22 -0500
      Re: How configure cc65 on a pc Steve Nickolas <usotsuki@buric.co> - 2014-08-02 15:53 +0000
        Re: How configure cc65 on a pc "Bill Buckels" <bbuckels@mts.net> - 2014-08-02 19:50 -0500
          Re: How configure cc65 on a pc Steve Nickolas <usotsuki@buric.co> - 2014-08-03 02:27 +0000
            Re: How configure cc65 on a pc "Bill Buckels" <bbuckels@mts.net> - 2014-08-03 08:42 -0500
              Re: How configure cc65 on a pc Steve Nickolas <usotsuki@buric.co> - 2014-08-03 13:51 +0000
                Re: How configure cc65 on a pc "Bill Buckels" <bbuckels@mts.net> - 2014-08-03 16:20 -0500
    Re: How configure cc65 on a pc STYNX <Jonas.Groenhagen@gmx.de> - 2014-08-02 08:11 -0700
      Re: How configure cc65 on a pc "Bill Buckels" <bbuckels@mts.net> - 2014-08-02 19:37 -0500

#20955 — How configure cc65 on a pc

FromDidier VALLET <dv.vallet@gmail.com>
Date2014-08-01 22:51 -0700
SubjectHow configure cc65 on a pc
Message-ID<64fbdb09-51b2-4f8f-beb3-f56c49c51758@googlegroups.com>
Hello, 

i've donwloaded cc65 for apple 2 on the github.
i've unzipped it on a subdir on my pc and created a CC65_HOME environment variable.

To see how it works before trying to code something by myself, i've downloaded shrworld which is published with the sourcecode (even if i code in machine code, i prefer cross-coding now and i red that cc65 has a good assembleur in the pack).
but i don't see how to compile, link, and create a dsk with it. 

Is there is a tutorial somethere or somebody who supplie a source code with batch files for me trying it.

Thanks, Didier

[toc] | [next] | [standalone]


#20959

From"Bill Buckels" <bbuckels@mts.net>
Date2014-08-02 06:48 -0500
Message-ID<lrij78$ad9$1@speranza.aioe.org>
In reply to#20955
"Didier VALLET" <dv.vallet@gmail.com> wrote:
>Is there is a tutorial somethere or somebody who supplie a source code with
>batch files for me trying it.

I provide all the demos for my book completely configured for Windows and 
complete with shortcut. That way you get to do the easy part and read the 
book and follow along.

In the chapter on DHGR bitmapped Graphics and cc65,  I provide build
instructions. Here is an excerpt from that chapter:

Building the Demo and Links

The cc65 main page is now at: http://cc65.github.io/cc65/

Existing users of cc65 may already know what to do with this if anything,
but for new users, build instructions are included below. For new cc65 users
other than Windows users most of this is may only be useful for reference.
Try posting a message on usenet in the comp.sys.apple2.programmer usenet
news group if you need additional help setting-up your cc65 working
environment on the OS that you have chosen, and if you have exhausted all
reasonable alternatives including the links from the cc65 main page and
googling for clues. But it is beyond the scope of this demo to provide
support for setting up a news reader or for help with OS's other than
Windows. All users can still email me for help if they have exhausted the
other resources that I have suggested and I will try to help on a best
effort basis.

bbuckels@mts.net

Make File

The Make File for this demo works with the MinGW make as well as other
makes.

PRG=dhishow
PRG2=dhishow2

$(PRG).PRG: $(PRG).c
  cl65 -O -t apple2enh -C $(PRG).cfg $(PRG).c
  del $(PRG).o
  cl65 -D DHGR_SCREEN_ADDRESS=0x4000 -O -t apple2enh -C $(PRG2).cfg -o
$(PRG2) $(PRG).c
  del $(PRG).o

Windows users will need to get a make if they don't have one. Cc65 doesn't
come with a make. Consider installing MinGW:

http://www.mingw.org/category/wiki/download

Or GNU Make:

http://gnuwin32.sourceforge.net/packages/make.htm

cc65 SnapShot

To build all this, Windows users can get the latest cc65 snapshot:

http://cc65.github.io/cc65/download/cc65-snapshot-win32.zip

And then create a path similar to the following (do not use spaces in the
path name):

C:\cc65_snap\PROGRAMS\DHGR\

And Windows users can set-up a batch-file similar to the following:

C:\cc65_snap\bin\cc65-env.cmd

@echo off
SET CROOT=C:\cc65_snap
SET PATH=%CROOT%\bin;%CROOT%\tools;%PATH%
SET CA65_INC=%CROOT%\asminc
SET CC65_INC=%CROOT%\include
SET LD65_CFG=%CROOT%\cfg
SET LD65_LIB=%CROOT%\lib
SET LD65_OBJ=%CROOT%\obj

And Windows users can then use the Windows shortcut provided in the DHISHOW
distribution at the following link:

http://www.appleoldies.ca/cc65/programs/dhgr/dhishow.zip

Unzip to: C:\cc65_snap\PROGRAMS\DHGR\ (as noted above) or similar. Edit
properties to suit and copy and re-use for other cc65 projects as required.

Linker Configuration Files

As shown in the MAKEFILE above, two linker configs are used with this demo.
They are both slightly modified versions of the standard cc65 linker configs
that come with the current snapshot and which are really only meant for a
starting point for some of us. For a full listing of these modified configs
download dhishow. It comes with source of course.

The linker config for the dhishow binary that loads at $4000 is the same as
apple2enh-system.cfg with a one line change:

MEMORY {
  ZP:   define = yes, start = $0080,size = $001A;
  RAM:  file = %O,start = $4000,size = $7F00 - __STACKSIZE__;
  MOVE: file = %O,define = yes,start = $0000,size = $FFFF;
  LC:   define = yes,start = __LCADDR__,size = __LCSIZE__;
}

This leaves the screen memory at $2000 available and the memory below $2000
available, although neither area is reserved.

The linker config for the dhishow2 binary that loads at $0803 is the same as
apple2enh.cfg with the 4 byte header removed. That is the only change. This
header is not needed in CiderPress unless for DOS 3.3 BIN programs. I have
refrained from appending CiderPress file attribute preservation tags to
output filenames in my MAKEFILE to be inclusive of environments other than
Windows, but that's a better idea than a header.

Andy McFadden's CiderPress can be downloaded from the following link:

http://ciderpress.sourceforge.net/

Apple Commander can be downloaded from the following link:

http://applecommander.sourceforge.net/

Working Demos

Working demos of DHISHOW are available by separate download from the
following link:

http://www.appleoldies.ca/cc65/programs/dhgr/dhishowdemo.zip

They include an HDV Hard Drive Image for the AppleWin IIe Emulator which is
set-up to run at 1 MHZ, and a smaller 2mg Disk Image for the kegs32 IIgs
emulator which is set-up to run at 8 MHZ. Speed adjustments can be made to
these by using DELAY.TXT discussed earlier in this document.

Emulators

The AppleWin Emulator can be downloaded from the following link:

http://applewin.berlios.de/

The kegs32 emulator can be downloaded from the following link:

http://kegs.sourceforge.net/

GSport is available here:

http://gsport.sourceforge.net/

For Mac Users, AppleWin will run in Wine Bottler if you make the effort:

https://groups.google.com/d/topic/comp.sys.apple2/UxMmfJ-YJe4

As will CiderPress to some degree:

https://groups.google.com/d/topic/comp.sys.apple2/0GfsM4PgqMY

But further discussion of all of this and especially the use of emulators,
especially for OS's other than Windows is beyond the scope of this document
and this demo.



[toc] | [prev] | [next] | [standalone]


#20961

From"Bill Buckels" <bbuckels@mts.net>
Date2014-08-02 08:22 -0500
Message-ID<lriomk$nm7$1@speranza.aioe.org>
In reply to#20955
"Didier VALLET" <dv.vallet@gmail.com> wrote:
>To see how it works before trying to code something by myself, i've 
>downloaded shrworld which is published with the sourcecode (even if i code 
>in machine code, i prefer cross-coding now and i red that cc65 has a good 
>assembleur in the pack).
but i don't see how to compile, link, and create a dsk with it.

Hello again Didier,

cc65's assembler is reported to produce 65816 code as well as 6502 code.

For the IIgs it would be beneficial to have small modules of subroutines 
written in 65816 that can be called from a cc65 6502 C program using memory 
registers and a technique similar to the following example:

No-Slot Clock: http://www.appleoldies.ca/cc65/programs/REALTIME.zip

These modules would be embedded in code as byte arrays or loaded as required 
from disk (a best but slower alternative).

The 5120 byte area below the HGR screen in the area $C00 (3072) -  $1FFF 
(8191) seems to be a good place for this.

That way BIN programs with a load address at $4000 could use the HGR Screen 
Area of 8192 bytes starting at $2000 as a buffer area and SYS programs that 
load at $2000 could also use these routines.

The memory registers could be (and probably will be) at a fixed 256 byte 
location directly below the hgr screen. Parameters for calling these modules 
could be placed in these areas. I already have a register map established 
based on Aztec C65's Zero Page map. This is also conduscive to porting the 
Aztec C65 Floating Point routines and the Aztec C65 DOS 3.3 File Routines to 
cc65, as per my gap anaysis of cc65.

This is the direction I am headed.

Some of the routines that I want are SHR routines:

- Mode 3200 Brooks Palette display routine that buffers the palette within 
the $C00 area at a fixed address and memory registers at fixed locations.

- Pixel write routine for Mode320 and Mode640 using same technique.

Etc.

I have a considerable learning curve to make this happen. I would appreciate 
help and donations of routines and knowledge.

I intend to provide similar routines for all the Apple II graphics modes in 
6502 but for the IIgs I would like to provide a second set of equivalent 
65816 routines that do not use the old AUXMOVE routines.

I don't wish to scare anyone so I will not go into more detail about this.

Except to say this is part of the reason that I am reluctant to write tgi 
drivers for graphics work I have done for cc65. My view is that an Apple IIe 
and Apple IIgs driven approach is best for cc65 programs, and not to concern 
myself with the Commodore 64 or Atari platforms for guidance.

Portability is the last thing that an Apple II application programmer will 
likely care about. Utilizing the capabilities of the Apple IIe and Apple 
IIgs is probably the first consideration and direct hardware support is 
needed for the Apple IIe and Apple IIgs.

On documentation, I find the cc65 view very narrow. Anything not directly 
related to the compiler is considered out of scope. The documentation that 
is there is good enough but in my view often incomplete and poorly worded 
and devoid of examples.

To remedy all this, Apple II users of cc65 can continue look to 
documentation from me that will explain how to actually do applications in 
cc65.

Bill




Is there is a tutorial somethere or somebody who supplie a source code with 
batch files for me trying it.

Thanks, Didier 

[toc] | [prev] | [next] | [standalone]


#20965

FromSteve Nickolas <usotsuki@buric.co>
Date2014-08-02 15:53 +0000
Message-ID<alpine.DEB.2.02.1408021552370.32720@localhost>
In reply to#20961
On Sat, 2 Aug 2014, Bill Buckels wrote:

> "Didier VALLET" <dv.vallet@gmail.com> wrote:
>> To see how it works before trying to code something by myself, i've
>> downloaded shrworld which is published with the sourcecode (even if i code
>> in machine code, i prefer cross-coding now and i red that cc65 has a good
>> assembleur in the pack).
> but i don't see how to compile, link, and create a dsk with it.
>
> Hello again Didier,
>
> cc65's assembler is reported to produce 65816 code as well as 6502 code.

I have assembled 65816 code with it; there's a small piece of my ehbasic 
port that uses 65816 code to read the 40/80 switch on the GS.

-uso.

[toc] | [prev] | [next] | [standalone]


#20972

From"Bill Buckels" <bbuckels@mts.net>
Date2014-08-02 19:50 -0500
Message-ID<lrk115$p7v$1@speranza.aioe.org>
In reply to#20965
"Steve Nickolas" <usotsuki@buric.co> wrote:
>I have assembled 65816 code with it; there's a small piece of my ehbasic 
>port that uses 65816 code to read the 40/80 switch on the GS.

Is that available somewhere? With source and some linker info and so forth. 
Or is this post for information only?

I tried the links at http://forum.6502.org/viewtopic.php?t=55 but they are 
broken.

Bill 

[toc] | [prev] | [next] | [standalone]


#20973

FromSteve Nickolas <usotsuki@buric.co>
Date2014-08-03 02:27 +0000
Message-ID<alpine.DEB.2.02.1408030225130.71851@localhost>
In reply to#20972
On Sat, 2 Aug 2014, Bill Buckels wrote:

> "Steve Nickolas" <usotsuki@buric.co> wrote:
>> I have assembled 65816 code with it; there's a small piece of my ehbasic
>> port that uses 65816 code to read the 40/80 switch on the GS.
>
> Is that available somewhere? With source and some linker info and so forth.
> Or is this post for information only?
>
> I tried the links at http://forum.6502.org/viewtopic.php?t=55 but they are
> broken.
>
> Bill
>
>
>

A few years, a few servers down the road, you know...

Reuploaded to http://1.buric.co/eh210p8_v087ref1.zip

-uso.

[toc] | [prev] | [next] | [standalone]


#20976

From"Bill Buckels" <bbuckels@mts.net>
Date2014-08-03 08:42 -0500
Message-ID<lrle8n$mka$1@speranza.aioe.org>
In reply to#20973
"Steve Nickolas" <usotsuki@buric.co> wrote:
>A few years, a few servers down the road, you know... Reuploaded to 
>http://1.buric.co/eh210p8_v087ref1.zip

Got it, thanks uso,

I'll have a look at what you have done with the 65816 in your code.

http://en.wikipedia.org/wiki/65816

Also I was totally unaware of the "Enhanced BASIC" project. Thanks also for 
making me aware of EHBASIC.

A google on "EHBASIC Lee Davison" turns-up many broken links. Additionally 
there is no Wikipedia article about EHBASIC which seems rather sad to me 
considering the amount of activity this project seems to have invoked by 
retro-programmers.

There seems to be a lesson here. As critical as I am about cc65 having gaps 
in Apple II support including "how-to" documentation, compared to cc65, 
EHBASIC would seem to be more of a programming project than something that a 
nostalgic user who uses a BASIC like AppleSoft would think of using. I 
backread some of the threads and I am unable to come to any other 
conclusion. Without mainstream references like Wikipedia, and links that are 
not broken, even old established language tools like Aztec C65 would not 
have generated much interest.

If you doubt me, google Apple II C Compiler or Apple II C Programming.

cc65 is well established and referenceable by anyone wanting a C compiler 
for the Apple II or Commodore 64, and so is Aztec C65 to a smaller degree 
which is the exact opposite of the EHBASIC stuff.

Anyone googling Apple BASIC will be overwhelmed by AppleSoft and anyone 
googling Commodore BASIC will be overwhelmed by (ahem) Commodore BASIC.

It is sad to see a less-than-lame effort in cohesive documentation at 
general and stable sites on the part of those who would want EHBASIC to be 
be used mainsteam as a replacement BASIC outside an elite group; this seems 
to be more of a programming project than something that a nostalgic user who 
uses a BASIC would bother with. So my overall conslusion is that nobody 
cares if this gets used mainstream.

This is certainly the opposite of cc65.

I appreciated the description below (edited somewhat):

https://github.com/jefftranter/6502/tree/master/asm/ehbasic

Enhanced BASIC is a BASIC interpreter for the 6502 family microprocessors. 
It is constructed to be quick and powerful and easily ported between 6502 
systems. It requires few resources to run and includes instructions to 
facilitate easy low level handling of hardware devices. It also retains most 
of the powerful high level instructions from similar BASICs.

EhBASIC is free but not copyright free. For non commercial use there is only 
one restriction, any derivative work should include, in any binary image 
distributed, the string "Derived from EhBASIC" and in any distribution that 
includes human readable files a file that includes the above string in a 
human readable form e.g. not as a comment in an HTML file. For commercial 
use you must contact Lee Davison.

One wonders; Why did Lee Davison not write a Wikipedia Page at the very 
least? (a rhetorical question) This seems to be a remarkable accomplishment 
that should be shared. Too bad. If I did something like this, like I say, 
I'd make sure it was visibly available.

If you doubt me, google Apple II C Compiler or Apple II C Programming.

The other thing is this restriction. These days there is no restriction on 
AppleSoft BASIC etc. How silly it is that this guy would put a restriction 
on a 6502 BASIC interpreter!

I'm going back to cc65-land now.

Bill 

[toc] | [prev] | [next] | [standalone]


#20977

FromSteve Nickolas <usotsuki@buric.co>
Date2014-08-03 13:51 +0000
Message-ID<alpine.DEB.2.02.1408031345390.12839@localhost>
In reply to#20976
On Sun, 3 Aug 2014, Bill Buckels wrote:

> "Steve Nickolas" <usotsuki@buric.co> wrote:
>> A few years, a few servers down the road, you know... Reuploaded to
>> http://1.buric.co/eh210p8_v087ref1.zip
>
> Got it, thanks uso,
>
> I'll have a look at what you have done with the 65816 in your code.

I actually think Antoine Vignau gave me that code.  It's been years.

> http://en.wikipedia.org/wiki/65816
>
> Also I was totally unaware of the "Enhanced BASIC" project. Thanks also for
> making me aware of EHBASIC.
>
> A google on "EHBASIC Lee Davison" turns-up many broken links. Additionally
> there is no Wikipedia article about EHBASIC which seems rather sad to me
> considering the amount of activity this project seems to have invoked by
> retro-programmers.
>
> There seems to be a lesson here. As critical as I am about cc65 having gaps
> in Apple II support including "how-to" documentation, compared to cc65,
> EHBASIC would seem to be more of a programming project than something that a
> nostalgic user who uses a BASIC like AppleSoft would think of using. I
> backread some of the threads and I am unable to come to any other
> conclusion. Without mainstream references like Wikipedia, and links that are
> not broken, even old established language tools like Aztec C65 would not
> have generated much interest.

Here's the irony:  I did a code check at one point, because EHBASIC 
behaves in most respects very much like a Microsoft dialect.  A lot of the 
code I checked was very similar to Applesoft.  (I added parts of Applesoft 
to EHBASIC in order to put the dialects on a more even footing; much of 
the graphics code is taken from Applesoft directly.)

I don't think EHBASIC was based on Applesoft.  I actually believe it may 
have started out as a hack of Synertek BASIC, a closely related dialect, 
and then been mauled into what it is now.

I tried to advance it further, and ran into walls.

-uso.

[toc] | [prev] | [next] | [standalone]


#20980

From"Bill Buckels" <bbuckels@mts.net>
Date2014-08-03 16:20 -0500
Message-ID<lrm921$pjm$1@speranza.aioe.org>
In reply to#20977
"Steve Nickolas" <usotsuki@buric.co> wrote:
>I tried to advance it further, and ran into walls.

Speaking of walls, I still would like to get the Orca C code from byteworks 
eventually and write a 65816 cross-development environment for the IIgs 
including the ToolBox calls etc.

For now, I'll carry-on with my own education to get to that point.

I'm happy you brought EHBASIC into this thread. It's not only a great 
example of a cc65 assembly project. M. Vallet will appreciate that link too 
I think.

Bill


[toc] | [prev] | [next] | [standalone]


#20963

FromSTYNX <Jonas.Groenhagen@gmx.de>
Date2014-08-02 08:11 -0700
Message-ID<e34d951a-318a-432c-8b7b-49af2f301f8f@googlegroups.com>
In reply to#20955
On Saturday, August 2, 2014 7:51:17 AM UTC+2, Didier VALLET wrote:
> i've donwloaded cc65 for apple 2 on the github.
> ...

On Saturday, August 2, 2014 1:48:55 PM UTC+2, Bill Buckels wrote:
> I provide all the demos for my book completely configured for Windows and 
> complete with shortcut. That way you get to do the easy part and read the 
> book and follow along....

@Bill: There you go, the programmers roll in :-D ... Its really cool to see that happen.

-Jonas

[toc] | [prev] | [next] | [standalone]


#20971

From"Bill Buckels" <bbuckels@mts.net>
Date2014-08-02 19:37 -0500
Message-ID<lrk08a$nqs$1@speranza.aioe.org>
In reply to#20963
"STYNX" <Jonas.Groenhagen@gmx.de> wrote:
>@Bill: There you go, the programmers roll in :-D ... Its really cool to see 
>that happen.

Documenting something is important too. If Microsoft had sat around writing 
compilers without telling people how to use them by providing good 
documentation and  examples of how to exploit the capabilities of the PC and 
Windows then some of us might still be using CP/M.

But if Bill Gates had single-handedly tried to do all the code at Microsoft 
it would have had the same delaying effect.

I still don't think there's many programmers left on the Apple II. I think 
we probably know quite a few of those who are left. So from my view I need 
these guys before we all disappear:)

Bill 

[toc] | [prev] | [standalone]


Back to top | Article view | comp.sys.apple2


csiph-web