/* disable Zorro-II/III Expansions by software (C) 2019 Henryk Richter This tool can either mark expansions as invalid (Shutup flag) or remove them from the active expansion board list. Please note that this is in software only and won't help if the hidden (presumably broken) devices interfere with the operation of other boards. A more reliable way to disable Zorro devices would need to patch expansion.library, which is beyond the scope of this tool. compilation: m68k-amigaos-gcc expansionoff.c -o expansionoff -noixemul -Wall -s or sc expansionoff.c link */ #include #include #include #include #include #include #include #include #define __NOLIBBASE__ #include struct Library *ExpansionBase; /* struct ExpansionBase *ExpansionBase; */ /* don't use amiga.lib */ #define REMOVE(n) ((void)(\ ((struct Node *)n)->ln_Pred->ln_Succ = ((struct Node *)n)->ln_Succ,\ ((struct Node *)n)->ln_Succ->ln_Pred = ((struct Node *)n)->ln_Pred )) /*----------------- options template -----------------------------------------*/ #define OPT_TEMPLATE "MANUFACTURER=VENDOR/K/N/A,DEVICE=DEV/K/N/A,SHUTUP=S/S,REMOVE=R/S" struct progopts { ULONG *vendor; ULONG *dev; ULONG shutup; ULONG remove; }; const char opt_template[]; int main( int argc, char**argv ) { struct progopts opts; struct RDArgs *rdargs; ULONG syntax; ULONG rcount=0,scount=0; struct ConfigDev *cfg = (0),*cfg2; ExpansionBase = OpenLibrary( (STRPTR)EXPANSIONNAME, 34 ); if( !ExpansionBase ) { Printf("Cannot open expansion.library v34\n"); return 10; } do { memset( &opts, 0, sizeof( struct progopts )); syntax=1; if( (rdargs = ReadArgs( (char*)opt_template,(LONG*)&opts,NULL) ) ) { if( (opts.vendor) && (opts.dev) ) syntax = 0; } if( syntax ) { Printf("Syntax: %s\n",(ULONG)opt_template); break; } cfg = FindConfigDev( cfg, *opts.vendor, *opts.dev ); if( !cfg ) { Printf("Board %ld %ld not found\n",*opts.vendor, *opts.dev); break; } while( (cfg) ) { cfg2 = FindConfigDev( cfg, *opts.vendor, *opts.dev ); if( opts.remove ) { Disable(); REMOVE(cfg); Enable(); rcount++; Printf("rem\n"); } else { cfg->cd_Flags |= CDF_SHUTUP; scount++; } cfg = cfg2; } } while(0); Printf("Done. Removed %ld boards, Shutup %ld boards\n",rcount,scount); if( rdargs ) FreeArgs(rdargs); CloseLibrary( (struct Library*)ExpansionBase ); return 0; } /* some strings down here */ const char opt_template[] = OPT_TEMPLATE; const char verstring[] = "$VER: expansionoff 1.0 (03.06.2019) Disable Zorro Expansions (C) Henryk Richter";