I am trying to do some serious programming for apple2 using cc65.
therefore i need the c library and header files for apple.
for instance, this code display's an 'A'
.segment "CODE"
ldx #$00
lda #$41
jsr _putchar
ldx #$00
lda #$00
jmp L0002
L0002: rts
.endproc
yet, _putchar can not be found by the macro assembler i use.
the ROM routine for _putchar, as we have learned from the
Apple II technical refrence manual, is $FDF0
Some data typing towards the S-C assembler, the program displays an 'A'
when we look at this routine, using printf:
L0001:
.byte $48,$65,$6C,$6C,$6F,$20,$77,$6F,$72,$6C,$64,$0A,$00
; ---------------------------------------------------------------
; int __near__ main (void)
; ---------------------------------------------------------------
.segment "CODE"
.proc _main: near
.segment "CODE"
lda #<(L0001)
ldx #>(L0001)
jsr pushax
ldy #$02
jsr _printf
ldx #$00
lda #$00
jmp L0002
L0002: rts
.endproc
Eversince there is no standard routine for _printf, and i can't link the c
library to the apple emulator,
i need all the assembly code of _printf in my .S output file.
if i can produce such code for apple2 i'd could also use things like
fopen( ..
or even using another .h file (math.h) sqrt() routine, or sin()
if these work correct a i might use any .c file to generate a .s file for
the apple
macro assembler.
for instance an unix editor like 'ed' could compile to an ed.s and, after
some datatypework towards the S-C Assembler i'd have an ed running on the
apple2.
--
as i understand, graphical routines like pixel(x,y,color)
for apple2 translates towards a hcolor=, and some poke towards the
HGR resolution graphics.
about things like pixels, reading apple joystick ports, accessing the
apple2e speaker
etc,
i probably need an API for apple2
<if such exists at all>
purpose is then, for instance compiling a BSD Game like "snake"
produces a .s file where routines like _getchar, etc.. resolves correctly
an compiling the source towards .s only needs datatypework to operate
the game correctly.
regards,
dagmar
[...]
> i need all the assembly code of _printf in my .S output file.
The common source for all supported platforms is in libsrc/common. In
particular, libsrc/common/_printf.s provides the "[b]asic layer for all
printf type functions."
[...]
> i probably need an API for apple2
The Apple II specific implementations of these common routines are in
libsrc/apple2 and libsrc/apple2enh. You might also look at the example
programs in the samples directory.
--
John B. Matthews
trashgod at gmail dot com
<http://sites.google.com/site/drjohnbmatthews>
> In article <a417b$4b201cdf$524a53d9$40...@cache5.tilbu1.nb.home.nl>,
> "di...@home.nl" <di...@home.nl> wrote:
>
> [...]
>> i need all the assembly code of _printf in my .S output file.
>
> The common source for all supported platforms is in libsrc/common. In
> particular, libsrc/common/_printf.s provides the "[b]asic layer for all
> printf type functions."
Is there functionality available to resolve symblos automatically,
or do i need to reslove printf by hand to a new .s file?
>
> [...]
>> i probably need an API for apple2
>
> The Apple II specific implementations of these common routines are in
> libsrc/apple2 and libsrc/apple2enh. You might also look at the example
> programs in the samples directory.
>
peace,
digi
> John B. Matthews wrote:
>
> > In article <a417b$4b201cdf$524a53d9$40...@cache5.tilbu1.nb.home.nl>,
> > "di...@home.nl" <di...@home.nl> wrote:
> >
> > [...]
> >> i need all the assembly code of _printf in my .S output file.
> >
> > The common source for all supported platforms is in libsrc/common.
> > In particular, libsrc/common/_printf.s provides the "[b]asic layer
> > for all printf type functions."
>
> Is there functionality available to resolve symblos automatically,
The linker, ld65, resolves symbols combines object files into an
executable file. I usually use cl65, which conveniently combines cc65,
ca65, co65 and ld65:
> In article <e139e$4b212e95$524a53d9$40...@cache5.tilbu1.nb.home.nl>,
> "di...@home.nl" <di...@home.nl> wrote:
>
> > John B. Matthews wrote:
> >
> > > In article <a417b$4b201cdf$524a53d9$40...@cache5.tilbu1.nb.home.nl>,
> > > "di...@home.nl" <di...@home.nl> wrote:
> > >
> > > [...]
> > >> i need all the assembly code of _printf in my .S output file.
> > >
> > > The common source for all supported platforms is in
> > > libsrc/common. In particular, libsrc/common/_printf.s provides
> > > the "[b]asic layer for all printf type functions."
> >
> > Is there functionality available to resolve symblos automatically,
>
> The linker, ld65, resolves symbols combines object files into an
> executable file. I usually use cl65, which conveniently combines
> cc65, ca65, co65 and ld65:
>
> <http://www.cc65.org/doc/>
Oops, "The linker, ld65, resolves symbols _and_ combines object files
into an executable file.
--
>I am trying to do some serious programming for apple2 using cc65.
Great :-)
>therefore i need the c library and header files for apple.
ftp://ftp.musoftware.de/pub/uz/cc65/cc65-apple2-2.13.0-1.zip
ftp://ftp.musoftware.de/pub/uz/cc65/cc65-apple2enh-2.13.0-1.zip
>yet, _putchar can not be found by the macro assembler i use.
The code generated by th compiler is intended to be assembled by the
cc65 assembler and to be linker by the cc65 linker.
>the ROM routine for _putchar, as we have learned from the
>Apple II technical refrence manual, is $FDF0
Nope. The _putchar routine is part of the cc65 Apple2 C library (see
above).
>i probably need an API for apple2
For sure.
><if such exists at all>
For sure.
Have you already considered to take a look into the cc65 docs ?!?
There's for example a tutorial answering all these questions and more:
http://www.cc65.org/snapshot-doc/intro.html
The cc65 Apple2 C library doesn't only provide support for screen
output but for example as well for disk file i/o based on the ProDOS
MLI and many other things...
Best, Oliver
A very polite way to say "RTFM". ;-)
-michael
NadaNet and AppleCrate II: parallel computing for Apple II computers!
Home page: http://home.comcast.net/~mjmahon
"The wastebasket is our most important design
tool--and it's seriously underused."
I have already recognized, peace.