[cc65] How to prototype an assembler function?

From: Payton Byrd <plbyrd1gmail.com>
Date: 2010-04-25 02:10:58
I've read the CA65 docs and cannot find an example of this.  What I want to
do is call the following assembler functions from C code.  So I've written
this code as PlatformSpecific.s and it compiles fine:

.export _writeVdcRegister
.export _readVdcRegister

;------------------------
; Write A to VDC Register
; stored in X
_writeVdcRegister:
STX $D600
WVR1: BIT $D600
 BPL WVR1
STA $D601
RTS

;-------------------------
; Read A from VDC Register
; stored in X
_readVdcRegister:
STX $D600
RVR1: BIT $D600
BPL RVR1
LDA $D601
 RTS

Now, I am struggling with how to declare these methods in C so that the X
register and the Accumulator are set correctly and are ready to be used in
the assembler.  Is there an example of this somewhere that I'm overlooking?

-- 
Payton Byrd
<http://www.paytonbyrd.com>
<http://it.toolbox.com/blogs/paytonbyrd>

----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Sun Apr 25 02:11:23 2010

This archive was generated by hypermail 2.1.8 : 2010-04-25 02:11:26 CEST