X-Git-Url: https://git.distorted.org.uk/~mdw/ssr/blobdiff_plain/a3da4c116d4216fdec125d687dfc347e343a8b28..c1b567d833a004bb3d978f1f7c99f42cefa7845c:/StraySrc/Utilities/b/fixlink.bas diff --git a/StraySrc/Utilities/b/fixlink.bas b/StraySrc/Utilities/b/fixlink.bas new file mode 100644 index 0000000..3322e50 --- /dev/null +++ b/StraySrc/Utilities/b/fixlink.bas @@ -0,0 +1,64 @@ +REM +REM fixLink +REM +REM Fix object files output by partial AOF linking +REM +REM © 1995-1998 Straylight +REM + +REM ----- Licensing note ---------------------------------------------------- +REM +REM This file is part of Straylight's core utilities (coreutils) +REM +REM Coreutils is free software; you can redistribute it and/or modify +REM it under the terms of the GNU General Public License as published by +REM the Free Software Foundation; either version 2, or (at your option) +REM any later version +REM +REM Coreutils is distributed in the hope that it will be useful, +REM but WITHOUT ANY WARRANTY; without even the implied warranty of +REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +REM GNU General Public License for more details. +REM +REM You should have received a copy of the GNU General Public License +REM along with Coreutils. If not, write to the Free Software Foundation, +REM 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +SYS "OS_GetEnv" TO comm$ +IF INSTR(comm$,"-quit")=0 THEN ERROR 1,"fixLink must be started using *Run" +comm$=MID$(comm$,INSTR(comm$,"""")+1) +comm$=MID$(comm$,INSTR(comm$," ")+1) +comm$=LEFT$(comm$,INSTR(comm$,"""")-1) + +SYS "OS_File",17,comm$ TO ,,,,size% +DIM b% size% +SYS "OS_File",16,comm$,b%,0 + +REM --- Find header --- + +DIM q% 8 +$q%="OBJ_HEAD" +A%=q%!0 +B%=q%!4 +c%=b%!4 +x%=b%+12 +o%=0 +FOR i%=1 TO c% + IF x%!0=A% AND x%!4=B% THEN o%=x%!8 + x%+=16 +NEXT +IF o%=0 THEN ERROR 0,"Erk!" + +REM --- Now munge attributes --- + +x%=b%+o%+24 +a%=!(b%+o%+8) +FOR i%=1 TO a% + x%!4=x%!4 AND &FFFF + x%+=20 +NEXT + +REM --- Save AOF file back --- + +SYS "OS_File",10,comm$,&FFD,,b%,b%+size% +END