--- uae/src/include/sysdeps.h 2018/04/24 16:38:39 1.1 +++ uae/src/include/sysdeps.h 2018/04/24 16:39:25 1.1.1.2 @@ -119,26 +119,156 @@ struct utimbuf }; #endif -#if defined(__SASC) && defined(AMIGA) -#include -#include -#include -#include -#include -#include - -int mkdir(const char *); -int rmdir(const char *); - -#define S_ISDIR(m) (m & S_IFDIR) -#define S_IRUSR ~S_IREAD -#define S_IWUSR ~(S_IWRITE|S_IDELETE) -#define S_IXUSR ~S_IEXECUTE +/* sam: SAS/C code removed */ -typedef unsigned short mode_t; - -#define strcasecmp stricmp -#define chip rhubarb +#if defined(__GNUC__) && defined(AMIGA) +/* + * sam: GCC has a bad feature ("bug" would a better word) for uae in + * libamiga.a: bltsize, bltcon0, ... are defined as absolute address + * in memory, causing real customchip registers being modified when + * UAE is running. (I hate this feature... It makes me lost lots of + * time looking for a bug on my side =:-( ). + * + * This cures the problem (I hope, since I don't exactly know which + * variables need to be redefined for UAE): + */ +/* 0.6.1 */ +#define bltsize my_bltsize +#define bltcon0 my_bltcon0 +#define bltcon1 my_bltcon1 +#define bltapt my_bltapt +#define bltbpt my_bltbpt +#define bltcpt my_bltcpt +#define bltdpt my_bltdpt +#define adkcon my_adkcon +/* 0.6.3 */ +#define serdat my_serdat +#define dmacon my_dmacon +#define intena my_intena +#define intreq my_intreq + +#define AMIGALIB_NEED_TO_BE_REALLY_SURE +/* + * Those are here is case of doubt (they are all absolute address + * in libamiga.a, defining CUSTOM_NEED_TO_BE_REALLY_SURE will prevent + * uae from using any absolute variable. + */ +#ifdef AMIGALIB_NEED_TO_BE_REALLY_SURE +#define bootrom my_bootrom +#define cartridge my_cartridge +#define romend my_romend +#define romstart my_romstart +#define adkcon my_adkcon +#define adkconr my_adkconr +#define aud my_aud +#define bltadat my_bltadat +#define bltafwm my_bltafwm +#define bltalwm my_bltalwm +#define bltamod my_bltamod +#define bltapt my_bltapt +#define bltbdat my_bltbdat +#define bltbmod my_bltbmod +#define bltbpt my_bltbpt +#define bltcdat my_bltcdat +#define bltcmod my_bltcmod +#define bltcon0 my_bltcon0 +#define bltcon1 my_bltcon1 +#define bltcpt my_bltcpt +#define bltddat my_bltddat +#define bltdmod my_bltdmod +#define bltdpt my_bltdpt +#define bltsize my_bltsize +#define bpl1mod my_bpl1mod +#define bpl2mod my_bpl2mod +#define bplcon0 my_bplcon0 +#define bplcon1 my_bplcon1 +#define bplcon2 my_bplcon2 +#define bpldat my_bpldat +#define bplpt my_bplpt +#define clxcon my_clxcon +#define clxdat my_clxdat +/* Oh look ! libamiga.a does not allow you to define a shared + variable caled color.... This is quite annoying :-/ */ +#define color my_color +#define cop1lc my_cop1lc +#define cop2lc my_cop2lc +#define copcon my_copcon +#define copins my_copins +#define copjmp1 my_copjmp1 +#define copjmp2 my_copjmp2 +#define custom my_custom +#define ddfstop my_ddfstop +#define ddfstrt my_ddfstrt +#define diwstop my_diwstop +#define diwstrt my_diwstrt +#define dmacon my_dmacon +#define dmaconr my_dmaconr +#define dskbytr my_dskbytr +#define dskdat my_dskdat +#define dskdatr my_dskdatr +#define dsklen my_dsklen +#define dskpt my_dskpt +#define intena my_intena +#define intenar my_intenar +#define intreq my_intreq +#define intreqr my_intreqr +#define joy0dat my_joy0dat +#define joy1dat my_joy1dat +#define joytest my_joytest +#define pot0dat my_pot0dat +#define pot1dat my_pot1dat +#define potgo my_potgo +#define potinp my_potinp +#define refptr my_refptr +#define serdat my_serdat +#define serdatr my_serdatr +#define serper my_serper +#define spr my_spr +#define sprpt my_sprpt +#define vhposr my_vhposr +#define vhposw my_vhposw +#define vposr my_vposr +#define vposw my_vposw +#define ciaa my_ciaa +#define ciaacra my_ciaacra +#define ciaacrb my_ciaacrb +#define ciaaddra my_ciaaddra +#define ciaaddrb my_ciaaddrb +#define ciaaicr my_ciaaicr +#define ciaapra my_ciaapra +#define ciaaprb my_ciaaprb +#define ciaasdr my_ciaasdr +#define ciaatahi my_ciaatahi +#define ciaatalo my_ciaatalo +#define ciaatbhi my_ciaatbhi +#define ciaatblo my_ciaatblo +#define ciaatodhi my_ciaatodhi +#define ciaatodlow my_ciaatodlow +#define ciaatodmid my_ciaatodmid +#define ciab my_ciab +#define ciabcra my_ciabcra +#define ciabcrb my_ciabcrb +#define ciabddra my_ciabddra +#define ciabddrb my_ciabddrb +#define ciabicr my_ciabicr +#define ciabpra my_ciabpra +#define ciabprb my_ciabprb +#define ciabsdr my_ciabsdr +#define ciabtahi my_ciabtahi +#define ciabtalo my_ciabtalo +#define ciabtbhi my_ciabtbhi +#define ciabtblo my_ciabtblo +#define ciabtodhi my_ciabtodhi +#define ciabtodlow my_ciabtodlow +#define ciabtodmid my_ciabtodmid +#endif /* AMIGALIB_NEED_TO_BE_REALLY_SURE */ + +/* gcc on the amiga need that __attribute((regparm)) must */ +/* be defined in function prototypes as well as in */ +/* function definitions ! */ +#define REGPARAM2 REGPARAM +#else /* not(GCC & AMIGA) */ +#define REGPARAM2 #endif #ifdef __DOS__ @@ -149,6 +279,7 @@ typedef unsigned short mode_t; #define O_BINARY 0 #endif +#ifndef EXEC_TYPES_H /* sam: to prevent re-definition in amiga.c! */ /* If char has more then 8 bits, good night. */ typedef unsigned char UBYTE; typedef signed char BYTE; @@ -182,3 +313,4 @@ typedef ULONG CPTR; #elif SIZEOF_LONG == 8 #define INT_64BIT long #endif +#endif