[cc65] 65816 and ca65 : help needed

From: chris <jlsfjs1yahoo.fr>
Date: 2005-12-12 17:29:31
Hi, as stated in my previous message I'm trying to
make ca65 compile assembler files generated by lcc816
(this version commes from Toshiyasu Morita (I've tried
the one of C64 Wings OS author or had a look to the
one of Groepaz - too hard for me))

The compiler seems to work fine and produce out the
box APM Assembler files...

So, I'm trying to figure out how I could write a
translater between the two. Unfortunately it's been a
long since I've used APW and I don't have any
documentation (and been a while since the last time
I've coded something with the 65816). 

So I need your help to understand what the APW
Assembler statements are and how to convert them to
ca65 format.

Below are 3 test files : the C source code, the APW
asm source code and the ca65 asm source modified by
hand (by me) - See at the end of this post for errors
generated by ca65

1) main.c
int fn()
{
	return 0;
}

main()
{
	return 2;
}

2) main.s (APW assembler)
-0	data
_t	entry
	dc	i4'1'
	end
; STARTFUNC(%0),(_fn)
_fn	start
dag_temp_start	equ	1
gen_temp_start	equ	dag_temp_start+0
local	equ	gen_temp_start+-1
; LINK(),()
	lda	r15
	add.l	#-local
	sta	r15
; RETI(CNSTI(%0)),(0)
	tsc
	clc
	adc	#local
	tcs
	pld
	lda	#<0
	ldx	#^0
	rtl
; LABELV(%0),(L1)
L1	anop
; ENDFUNC(%0),(_fn)
_fn	end
; FLUSH(),()
; STARTFUNC(%0),(_main)
_main	start
dag_temp_start	equ	1
gen_temp_start	equ	dag_temp_start+0
local	equ	gen_temp_start+-1
; LINK(),()
	lda	r15
	add.l	#-local
	sta	r15
; RETI(CNSTI(%0)),(2)
	tsc
	clc
	adc	#local
	tcs
	pld
	lda	#<2
	ldx	#^2
	rtl
; LABELV(%0),(L2)
L2	anop
; ENDFUNC(%0),(_main)
_main	end
; FLUSH(),()
	end
; FLUSH(),()

3) main.ca65
.P816
;-0	data
;_t	entry
;	dc	i4'1'
;	end
; STARTFUNC(%0),(_fn)
_fn:	.SCOPE
dag_temp_start	=	1
gen_temp_start	= dag_temp_start+0
local	= gen_temp_start+-1
; LINK(),()
	lda	r15
	add #-local
	sta	r15
; RETI(CNSTI(%0)),(0)
	tsc
	clc
	adc	#local
	tcs
	pld
	lda	#<0
	ldx	#^0
	rtl
; LABELV(%0),(L1)
L1:	
; ENDFUNC(%0),(_fn)
_fn:	.ENDSCOPE
; FLUSH(),()
; STARTFUNC(%0),(_main)
_main:	.SCOPE
	dag_temp_start	= 1
	gen_temp_start	= dag_temp_start+0
local	= gen_temp_start+-1
; LINK(),()
	lda	r15
	add	#-local
	sta	r15
; RETI(CNSTI(%0)),(2)
	tsc
	clc
	adc	#-local
	tcs
	pld
	lda	#<2
	ldx	#^2
	rtl
; LABELV(%0),(L2)
L2:	
; ENDFUNC(%0),(_main)
_main: .ENDSCOPE
; FLUSH(),()
	
; FLUSH(),()

PROBLEMS :
==========

1) I don't know it the way I've converted the EQU is
right
2) add #-local produce an error ( Error: `:' expected
main.ca65(13): Error: Unexpected trailing garbage
characters
)
3) it was add.l, and I don't remember a add.l opcode
for the 65816 so I presume it's an APW macro ? but
which one ?

And should learn with ca65 how to convert dc i4'1'
(bytes reservation I presume)

Huuu, bad stuff for me no ? ;-)

If you can help...


	

	
		
___________________________________________________________________________ 
Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger 
Téléchargez cette version sur http://fr.messenger.yahoo.com
----------------------------------------------------------------------
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 Dec 12 17:38:22 2005

This archive was generated by hypermail 2.1.8 : 2005-12-12 17:38:28 CET