Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
 Welcome to our latest new user maak ! (Registered 2024-04-18) You are not logged in - nap
CSDb User Forums


Forums > C64 Coding > MMC Replay Plugin Coding with CC65
2008-06-28 12:46
Monte Carlos

Registered: Jun 2004
Posts: 350
MMC Replay Plugin Coding with CC65

I finally got an MMC Replay with V0.54 Bios and wanted to try out plug in coding. I got some sources by "The-Dreams" with which i can open and receive the file, the plugin is executed on.
They are working so far and i started to convert the sources to CC65 by Ullrich Bassewitz.
I wrote a c header file to wrap the assembler routines written by "The-Dreams" so that i can call these from a c routine.
When i tested out my xxxplgin.bin, which contained just an empty main routine (void main(void)), on a *.xxx file i recognized that the code crashes right inside the init code of the compiled c program (inside crt0.s).
Further experiments showed the "jsr CLRCH" inside "crt0.s" to be responsible for the crashing of the plugin.
When i change the jsr by hand to a bit instruction, the plugin
returns properly to the file browser.
Can anybody with a little experience in MMC Replay plugin programming give me a hint, why the CLRCH routine is not compatible to the MMC Bios although routines like CHROUT work?
Of course i search a way to come around modifying the CC65 startup code.

Thank you

Monte Carlos

2008-06-28 13:55
d0c

Registered: Apr 2006
Posts: 186
go here -> http://retrohackers.com/ all the mmc replay gurus are there....
2008-06-28 15:11
TNT
Account closed

Registered: Oct 2004
Posts: 189
If MMC Replay BIOS is like MMC64 one then it doesn't init kernal before calling plugins. Try doing it yourself, something like this:
Init
	sei

	ldx	#0
.1	lda	0,x
	sta	ZPbuf,x
	inx
	bne	.1

	lda	#$2f
	sta	0
	lda	#$36
	sta	1

	txa
.2	sta.xw	2,x
	sta	$0200,x
	sta	$0300,x
	inx
	bne	.2

	jsr	$fda3			; init I/O
	lda	#$ff			; keyboard flag
	sta	$91
	ldy	#$a0
	jsr	$fd8c			; top of memory, start of basic, screen position
	jsr	$fd15			; $0314..$0333
	jsr	$ff5b			; rest of kernal init

2008-06-28 20:11
Monte Carlos

Registered: Jun 2004
Posts: 350
Ok, thank you for the answer. I copied your assembler code into my one and tried it out.
I got the same result. The plugin gets started by the filebrowser (i added an inc $d020 before any other code is executed), but as long i haven't disabled the jsr $ffcc with a bit $ffcc instruction the code crashes and does not return.
When i compile my program and modify the jsr $ffcc to bit $ffcc using a hex editor, everything works fine.
Meanwhile i looked into the code of "The-Dreams" a little deeper and found, that they use a jsr $ffcc, too.
So this by itself can't be the reason for the malfunction.
Sorry, that i'm insisting on this so much, but i found it better to have all the c library together with the mmc functions avaiable not only for me, but to all CC65 users.
So i decided to try porting the code of Doc Bacardi / The Dreams to c instead of using only assembler.

Greetings Monte Carlos
2008-06-29 22:41
AlexC

Registered: Jan 2008
Posts: 293
You might come across many different and strange issues using C compiler. I remember people having some problems with IO for example. I would stick to plain assembly language.
RefreshSubscribe to this thread:

You need to be logged in to post in the forum.

Search the forum:
Search   for   in  
All times are CET.
Search CSDb
Advanced
Users Online
Didi/Laxity
Dymo/G★P
tlr
Dano/Padua
csio/monarchy c+4
sailor/Triad
iAN CooG/HVSC
jmin
Sentinel/Excess/TREX
Bitbreaker/Performers
Max/Flat3
grasstust/Hoaxers
Guests online: 135
Top Demos
1 Next Level  (9.8)
2 Mojo  (9.7)
3 Coma Light 13  (9.7)
4 Edge of Disgrace  (9.6)
5 Comaland 100%  (9.6)
6 No Bounds  (9.6)
7 Uncensored  (9.6)
8 Wonderland XIV  (9.6)
9 The Ghost  (9.6)
10 Bromance  (9.6)
Top onefile Demos
1 It's More Fun to Com..  (9.9)
2 Party Elk 2  (9.7)
3 Cubic Dream  (9.6)
4 Copper Booze  (9.5)
5 Rainbow Connection  (9.5)
6 TRSAC, Gabber & Pebe..  (9.5)
7 Onscreen 5k  (9.5)
8 Dawnfall V1.1  (9.5)
9 Quadrants  (9.5)
10 Daah, Those Acid Pil..  (9.5)
Top Groups
1 Oxyron  (9.3)
2 Nostalgia  (9.3)
3 Booze Design  (9.3)
4 Censor Design  (9.3)
5 Crest  (9.3)
Top Coders
1 Axis  (9.8)
2 Graham  (9.8)
3 Lft  (9.8)
4 Crossbow  (9.8)
5 HCL  (9.8)

Home - Disclaimer
Copyright © No Name 2001-2024
Page generated in: 0.043 sec.