X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?p=rmac;a=blobdiff_plain;f=rmac.c;h=ef99ffd5240ba24bd0691bb8ba250e86d5cbd40f;hp=4fb1582a725c603ff64663bad92b59a63d008ba9;hb=4ee0f36a71367d53457147c7b31bc9845e3ac21c;hpb=9afaf60ca24cdb08f900ae584107e29e3af46566 diff --git a/rmac.c b/rmac.c index 4fb1582..ef99ffd 100644 --- a/rmac.c +++ b/rmac.c @@ -163,17 +163,17 @@ void DisplayHelp(void) " -o file Output file name\n" " +o[value] Turn a specific optimisation on\n" " Available optimisation values and default settings:\n" - " o0: Absolute long addresses to word (on)\n" - " o1: move.l #x,dn/an to moveq (on)\n" - " o2: Word branches to short (on)\n" - " o3: Outer displacement 0(an) to (an) (off)\n" - " o4: lea size(An),An to addq #size,An (off)\n" - " o5: 68020+ Absolute long base/outer displacement to word (off)\n" - " o6: Null branches to NOP (off)\n" - " o7: clr.l Dx to moveq #0,Dx (off)\n" - " o8: adda.w/l #x,Dy to addq.w/l #x,Dy (off)\n" - " o9: adda.w/l #x,Dy to lea x(Dy),Dy (off)\n" - " op: Enforce PC relative (off)\n" + " o0: Absolute long addresses to word (on)\n" + " o1: move.l #x,dn/an to moveq (on)\n" + " o2: Word branches to short (on)\n" + " o3: Outer displacement 0(an) to (an) (off)\n" + " o4: lea size(An),An to addq #size,An (off)\n" + " o5: 68020+ Absolute long base/outer disp. to word (off)\n" + " o6: Null branches to NOP (off)\n" + " o7: clr.l Dx to moveq #0,Dx (off)\n" + " o8: adda.w/l #x,Dy to addq.w/l #x,Dy (off)\n" + " o9: adda.w/l #x,Dy to lea x(Dy),Dy (off)\n" + " op: Enforce PC relative (off)\n" " ~o[value] Turn a specific optimisation off\n" " +oall Turn all optimisations on\n" " ~oall Turn all optimisations off\n" @@ -243,15 +243,17 @@ int ParseOptimization(char * optstring) else { int opt_no = atoi(&optstring[2]); + if ((opt_no >= 0) && (opt_no < OPT_COUNT)) { optim_flags[opt_no] = onoff; optstring += 3; + // If opt_no is 2 digits then consume an extra character. // Sounds a bit sleazy but we know we're not going to hit - // more than 100 optimisation switches so this should be fine. - // If we do hit that number then it'll probably be time to burn - // the whole codebase and start from scratch. + // more than 100 optimisation switches so this should be + // fine. If we do hit that number then it'll probably be + // time to burn the whole codebase and start from scratch. if (opt_no > 9) optstring++; } @@ -263,6 +265,7 @@ int ParseOptimization(char * optstring) { return ERROR; } + if (*optstring == ',') optstring++; }