Squale > Le PC sur lequel j'ai stoqué ton fichier txt a crashé
Ça n'était pas bien compliqué de faire la fonction que je cherchais, mais par contre je ne sais pas comment différencier un PRGM d'une FUNC. Comment faut-il faire ?
To distinguish the PRGM and FUNC type you have to do:
cmp.b #$19,-5(a0,d1.w)
If -5(a0,d1.w) is not #$19 then the variable has the FUNC type,else it has the PRGM type.
if (*(ptr_var+long-5)!=0x19) {
FUNC
} else {
PRGM
}IroS a écrit :
pour le 1 et si le fichier est de type OTH j'avais trouvé ça:
char EXT[5] FILE *f = fopen(mon_fichier,"rb") fseek(f,-6,SEEK_END); fgets(EXT,6,f);
ça marche pour des extension de un à quatre charactères personnalisés.
char *GetCustomType(const char *filename)
{
SYM_ENTRY *sym=SymFindPtr(SYMSTR(filename),0);
if (!sym || !(sym->handle)) return 0;
ESI type=HToESI(sym->handle);
if (*(type--)!=OTH_TAG) return 0;
while (*(--type));
return type+1;
}hibou a écrit :
a0 est l'adresse de la variable
d1 est la longueur de la variable (sans le +2)
donc:if (*(ptr_var+long-5)!=0x19) { FUNC } else { PRGM }
if (*(ptr_var+long-4)!=0xE4||*(ptr_var+long-5)!=0x19) {
FUNC
} else {
PRGM
}
if (*(ptr_var+long-4)!=EXT_INSTR_TAG||*(ptr_var+long-5)!=PRGM_ITAG) {
FUNC
} else {
PRGM
}
char ext[5];
src += *(unsigned short *)src - 1; // On pointe sur l'extension
switch(*src)
{
case STR_TAG:
strcpy (ext, "STR")
break;
case TEXT_TAG:
strcpy (ext, "TEXT")
break;
case PIC_TAG:
strcpy (ext, "PIC")
break;
case GDB_TAG:
strcpy (ext, "GDB")
break;
case FIG_TAG:
strcpy (ext, "FIG")
break;
case MAC_TAG:
strcpy (ext, "MACR")
break;
case DATA_TAG:
strcpy (ext, "DATA")
break;
case LIST_TAG:
if (*(src-1) == LIST_TAG)
strcpy (ext, "MAT")
else
strcpy (ext, "LIST")
break;
case FUNC_TAG:
while (src > src2 && *src-- != 0xE5);
if (*src == 0xE4 && *(src-1) == 0x19)
strcpy (ext, "PRGM")
else
strcpy (ext, "FUNC")
break;
case OTH_TAG:
src -= 5;
if (!*src)
memcpy (ext, src+1, 4);
else
memcpy (ext, src, 5);
case ASM_TAG:
if (!strncmp(src2+6,"68kL",4))
strcpy (ext, "LIB")
else
strcpy (ext, "ASM")
break;
default:
strcpy (ext, "EXPR")
break;
}


)
