Jump to content
IGNORED

Accessing the drive?


Recommended Posts

12 hours ago, Harry Potter said:

Thank you.  aux_memcpyto() copies a block of memory from main memory to the extra memory and has the same prototype as memcpy().

memcpy is called :- memcpy(*dest, *src, size); so if your aux_memcpyto uses the same prototype, it's passing the wrong

parameters, in your call, memcpy (j, auxbufx, i); you are passing an integer for the *dest

 

I tested the file handling using "D:TEST.TXT" which I had created and printed out the read in data and it works fine.

 

I think the problem is the memcpy function

Link to comment
Share on other sites

This is what I used to test:-

#include <stdlib.h>
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <conio.h>
#include <atari.h>


// #include "memxtatari.h"
unsigned char loadauxmem (char* f);

//#pragma bss-name (push, "XBUFBSS")
static unsigned char auxbufx [128];
char tempbufffortest[128];

void main(void)
{
    char name[40]={"D:TEMP.TXT"};

    loadauxmem(name);
}
unsigned char loadauxmem (char* f)
{
    unsigned i=0, j=0;

    FILE* fi=fopen (f, "rb");
    if (!fi) return 1;
    while (!feof(fi)) {
        i=fread (auxbufx, 1, 128, fi);
        if (i==-1) {fclose (fi); return 1;}
        memcpy(tempbufffortest,auxbufx,i);
        printf("%s\n",tempbufffortest);
        j+=i;
    } fclose (fi);
    return 0;

}

Link to comment
Share on other sites

21 minutes ago, danwinslow said:

aux_memcpyto (j, &auxbufx, i);

Aren't you taking an address of an address here?

That will just waste some processing time, the call is just wrong as I explained earlier.

 

When compiling you should be getting this error "Warning: Converting integer to pointer without a cast"

unless your prototype for aux_memcpyto is defined incorrectly

Edited by TGB1718
Link to comment
Share on other sites

1 hour ago, Wrathchild said:

let's assume that's ok as he's told us that this is part of the banking so internally I would think the offset is being split to make a bank # and then offset, e.g. into $4000

Well I guess. It's been a while and I can't remember if &arrayname gives you the array start anyway, or it gives you an address formed from the contents of the first 2 bytes at arrayname. If you get a ** back he would be overwriting page 0 probably. Anyways, I'm out.

Link to comment
Share on other sites

If as @drac030 says that this is a bad CIO call, then the problem must be in the screen open call.

 

From the code, I cant see what the code for findfreeiocb does, I assume it looks for a free IOCB.

 

also scrdev , how is this formatted, there must be a $9B after the name i.e. scrdev .BYTE "E:",$9B

if your passing in a "C" string as the device, it's going to have a '0' at the end, so will cause problems

Link to comment
Share on other sites

50 minutes ago, Harry Potter said:

And sanny: I want to add initialized code and data to the XMEM and other low-memory areas as well.

Huh?

Loading a file to this area is not having initialized code and data in this area. I guess you want to load it automatically as part of the EXE file loading.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...