Re: [cc65] C64 - how to use disk I/O?

From: Andreas Koch <email1kochandreas.com>
Date: 2008-11-25 18:42:27
> Hello. I'm a newcomer to cc65 and C64 programming in general.
> The question is, how to get disk I/O for the C64 to work?
> I tried CBM commands - fail.
> Standard C I/O - fail.
> I just want to read a PRG file (with no load address, just data) into 
> memory! Or any other kind of file.
> It's for my BF interpreter, so it should be possible (with my way) to 
> just rename a TXT file and add it to a d64.
> Anyone knows how to read files from a 15x1 with cc65 code on a c64?

 From an older posting of mine:

***file TEST.C start***
/*demo for cbm_load */

#include <stdio.h>
#include <time.h>
#include <conio.h>
#include <cbm.h>
#include <dbg.h>
#include <stdlib.h>
#include "cbm.h"

unsigned char memory[1024];

int main()
{
    unsigned char drive = 8;

    cbm_load("TEST.C",drive,memory);
    memory[40]=0;
    printf("Result:\n%s",memory);	
    cgetc();
}
***file TEST.C end****

This will print "demo for ...", as cbm_load assumes the first 2 byte to 
be the address so they aren't loaded.

hope that helps,
   Andreas

----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Tue Nov 25 18:42:24 2008

This archive was generated by hypermail 2.1.8 : 2008-11-25 18:42:25 CET