Re: A86: Re: .86p


[Prev][Next][Index][Thread]

Re: A86: Re: .86p




>From examining files created by saving from VTI, it appears that your routine 
will only work with files with 8 letter variable names, because it looks like 
it just stops after the filename and a space, rather than putting in a buffer 
for all of them.  Here's some C++ code I've been working on to write a string 
(based loosely on David's), but I'm not sure if it works either...

    char level[65536]="**TI86**";
    int i=8;
    level[i++]=0x1A;
    level[i++]=0x0C;
    level[i++]=0x00;
    for(; i<53; level[i++]=' ');    //comment
    i+=2;
    level[i++]=strlen(name)+4;
    level[i++]=0x00;
    i+=2;
    level[i++]=0x0C;
    level[i++]=strlen(name);
    int j=0;
    while(level[i++]=name[j++]);    //copy filename

    int header=i-1;                 //save end of header

    i+=3;

    //actual data inserted like this:
    //  level[i++]=byte;

    int size=i-header-4;
    level[57]=(size+2)%256;
    level[58]=(size+2)/256;
    level[header+0]=(size+2)%256;
    level[header+1]=(size+2)/256;
    level[header+2]=size%256;
    level[header+3]=size/256;

    int fullSize=size+10+strlen(name);
    level[53]=fullSize%256;
    level[54]=fullSize/256;

    int c;
    unsigned short checksum=0;
    for(c=11; c<i; c++)
        checksum+=level[c];


    level[i++]=checksum%256;
    level[i++]=checksum/256;


    char filename[16];
    strcpy(filename,name);
    strcat(filename,".86s");
    ofstream file(filename);
    if(!file) return false;

    for(c=0; c<i; c++)
        file << level[c];

    file.close();



In a message dated 6/12/00 1:31:42 PM Eastern Daylight Time, david@acz.org 
writes:

> This only does strings, but I think programs are only different by a byte or
>  two...
>  
>  http://www.acz.org/programs/ti86x.h
>  
>  >
>  > ok, this isn't exactly an asm86 question, but does anyone have good c/c++
>  > code to write .86p & .86s files?
>  > the code i wrote using the .85g description and guessing from some other
>  > files creates files that can only be read by vti for some reason.
>  > thanks
>  



----
Jonah Cohen
<ComAsYuAre@aol.com>
http://jonah.ticalc.org



Follow-Ups: