Re: [cc65] CBM disk write problems

Date view Thread view Subject view

From: Johan Kotlinski (johan_at_littlesounddj.com)
Date: 2003-12-17 00:20:43


Hi Uz!

> On Tue, Dec 16, 2003 at 01:44:46AM +0100, Johan Kotlinski wrote:
> > I have a problem with saving to 1541, however. When saving to a file the
> > first time, everything works great. But the second time I call my routine, it
> > just doesn't work. I checked the archives and found out that someone had the
> 
> This is not a cc65 problem, but a CBM problem. You will have to scratch the
> file before writing it, otherwise you may get a "file exists" error.

Well, I tried scratching aswell, but the same problem... Then I tried writing it in assembler, and it worked. So this suggests there is a problem with the wrapper after all. If you are interested, here are the two (in my eyes equavilent) routines...

Assembler (WORKING):

_sub_save_hiscores:
  SEI 
  LDA #1
  LDX #8
  LDY #$F
  JSR $FFBA
  LDA #$12
  LDX #<filename_start  ; points to "@:KIDGRID_HISCORES"
  LDY #>filename_start
  JSR $FFBD
  LDA #$90
  STA $FB
  LDA #$11
  STA $FC
  LDA #$fb
  LDX #$44
  LDY #$12
  JSR $FFD8
  CLI 
  RTS

C (won't work):

void save_highscores() {
 __asm__ ("\tsei");
 cbm_open(1,8,15,"@:KIDGRID.HISCORES");
 cbm_write(1,(char*)0x1190,180);
 cbm_close(1);
 __asm__ ("\tcli");
}

Regards,
Johan
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo_at_musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.


Date view Thread view Subject view

This archive was generated by hypermail 2.1.3 : 2003-12-17 00:21:45 CET