ain@j.cc.purdue.edu (Patrick White) (07/29/88)
Submitted by: "Klaus Kaempf" <unido!rmi!kkaempf@uunet.uu.net> Summary: Installs a boot block that ignores fast mem and external drives. Poster Boy: Patrick White (ain@j.cc.purdue.edu) Archive Name: sources/amiga/volume5/install2.s.sh.Z tested.. kinda NOTES: I tried to test this, but since I only have a 512K Amiga with internal drive, I couldn't tell if it worked... it didn't crash though. I didn't compile it since it is assembly. -- Pat White (co-moderator comp.sources/binaries.amiga) ARPA/UUCP: j.cc.purdue.edu!ain BITNET: PATWHITE@PURCCVM PHONE: (317) 743-8421 U.S. Mail: 320 Brown St. apt. 406, West Lafayette, IN 47906 [archives at: j.cc.purdue.edu.ARPA] ======================================== # This is a shell archive. # Remove everything above and including the cut line. # Then run the rest of the file through sh. #----cut here-----cut here-----cut here-----cut here----# #!/bin/sh # shar: Shell Archiver # Run the following text with /bin/sh to create: # README # Install2.bat # Install2.c # BootCode2.asm # This archive created: Fri Jul 22 18:50:04 1988 # By: Patrick White (PUCC Land, USA) cat << \SHAR_EOF > README ================================== Install2 - a useful (?) boot block ================================== Summary: -------- Installing a disk this way will cause ... a) preference being given to MEMF_CHIP for poorly written software, e. g. games from Germany :-) :-) :-) b) all external drives to be ignored by the system (and therefore eat up less memory for internal disk buffers). Description: ------------ It would be even better if programs like this one would not be necessary at all, but several developers asked me to write something like this, so here you are! Background information: In Germany *lots* of programmers use the SEKA assembler (a pirated copy, of course) and some of them even do not know about include files, ATOM, FixHunk etc. (Teut Weidemann and Hans-Joachim Deeg, you're the exceptions, of course). Just INSTALL2 a disk (make sure it does not have a custom boot block!) and reboot. If it still does not work ... curse the manufacturer and buy someone else's software next time. As always: If you want to include this boot block with any commercial product, contact me before doing so! Permission granted for non-commercial use if distributed unchanged from the original version and free of charge! A similar boot block can be used to MOUNT a normal trackdisk drive with the new Fast Filing System (hey Steve, thanks a lot). But Andy Finkel said that the automatic detection of a DISKCHANGE was not yet implemented ... "requires no more than 512 KB and internal drive", aaarrggghh! !ralph Ralph Babel, Falkenweg 3, D-6204 Taunusstein, FRGermany SHAR_EOF cat << \SHAR_EOF > Install2.bat ; ;Install2.bat ; FailAt 1 LC1 -b0 -ceft -oT: Install2 LC2 -r1 -s -v T:Install2 BLink LIB:Astartup.obj+T:Install2.o TO Install2 LIB LIB:amiga.lib+LIB:lcnb.lib SC SD ND NOALVS BATCH Delete T:Install2.o FailAt 10 SHAR_EOF cat << \SHAR_EOF > Install2.c /* ** Install2.c - give preference to MEMF_CHIP and deactivate external drives ** Copyright (C) 1987 Ralph Babel, Falkenweg 3, D-6204 Taunusstein ** all rights reserved - alle Rechte vorbehalten ** ** 23-May-1987 created Install1.c ** 07-Aug-1987 changed for new boot code ** 30-Mar-1988 cleanup */ /*** included files ***/ #include <exec/types.h> #include <exec/io.h> #include <exec/memory.h> #include <devices/bootblock.h> #include <devices/trackdisk.h> #include <libraries/dos.h> #include <libraries/dosextens.h> /*** external function references ***/ APTR AllocMem(ULONG, ULONG); VOID FreeMem(APTR, ULONG); struct IOStdReq *CreateStdIO(struct MsgPort *); VOID DeleteStdIO(struct IOStdReq *); BYTE OpenDevice(char *, LONG, struct IORequest *, ULONG); VOID CloseDevice(struct IORequest *); BYTE DoIO(struct IORequest *); struct Task *FindTask(char *); VOID CopyMem(APTR, APTR, ULONG); VOID printf(char *, ); LONG toupper(LONG); /*** constants ***/ #define ROOT 880 /* default AmigaDOS root block (3.5 inch) */ /*** structures ***/ struct BootSectors { struct BootBlock bs_BootBlock; UBYTE bs_Data[BOOTSECTS * TD_SECTOR - sizeof(struct BootBlock)]; }; /*** the boot code ***/ UWORD BootCode[] = { 0x2F02, 0x4EAE, 0xFF7C, 0x226E, 0x0142, 0x6020, 0x0829, 0x0001, 0x000F, 0x6716, 0x2F09, 0x4EAE, 0xFF04, 0x225F, 0x137C, 0x000A, 0x0009, 0x41EE, 0x0142, 0x4EAE, 0xFEF2, 0x2242, 0x2411, 0x66DC, 0x4EAE, 0xFF76, 0x241F, 0x43FA, 0x0032, 0x4EAE, 0xFE0E, 0x4A80, 0x6724, 0x2040, 0x41E8, 0x0034, 0x70FF, 0x20C0, 0x20C0, 0x2080, 0x43FA, 0x0026, 0x4EAE, 0xFFA0, 0x4A80, 0x670A, 0x2040, 0x2068, 0x0016, 0x7000, 0x4E75, 0x70FF, 0x4E75, 0x6469, 0x736B, 0x2E72, 0x6573, 0x6F75, 0x7263, 0x6500, 0x646F, 0x732E, 0x6C69, 0x6272, 0x6172, 0x7900 }; /*** entry point ***/ LONG main(argc, argv) LONG argc; char *argv[]; { struct BootSectors *bs; struct IOStdReq *iosr; struct Process *pr; ULONG checksum, precsum; UWORD i; LONG result; result = RETURN_WARN; /* user error */ if(argc == 2 && toupper(argv[1][0]) == 'D' && toupper(argv[1][1]) == 'F' && argv[1][2] >= '0' && argv[1][2] <= '3' && argv[1][3] == ':' && argv[1][4] == '\0') { result = RETURN_FAIL; /* no resources */ if((bs = (struct BootSectors *) AllocMem(sizeof(struct BootSectors), MEMF_CHIP | MEMF_CLEAR)) != NULL) { pr = (struct Process *)FindTask(NULL); if((iosr = CreateStdIO(&pr->pr_MsgPort)) != NULL) { result = RETURN_ERROR; /* disk error */ if(OpenDevice(TD_NAME, argv[1][2] - '0', (struct IORequest *)iosr, 0) == 0) { *(ULONG *)bs->bs_BootBlock.bb_id = BBNAME_DOS; bs->bs_BootBlock.bb_dosblock = ROOT; CopyMem((APTR)BootCode, (APTR)bs->bs_Data, sizeof(BootCode)); checksum = 0; for(i = 0; i < 256; ++i) { precsum = checksum; if((checksum += ((ULONG *)bs)[i]) < precsum) ++checksum; } bs->bs_BootBlock.bb_chksum = 0xffffffff - checksum; iosr->io_Command = CMD_WRITE; iosr->io_Length = sizeof(struct BootSectors); iosr->io_Data = (APTR)bs; iosr->io_Offset = 0; if(DoIO((struct IORequest *)iosr) == 0) { iosr->io_Command = CMD_UPDATE; (void)DoIO((struct IORequest *)iosr); } if(iosr->io_Error != 0) { printf("%s failed, trackdisk error %ld\n", argv[0], iosr->io_Error); } else { result = RETURN_OK; /* everything fine */ } iosr->io_Command = TD_MOTOR; iosr->io_Length = 0; (void)DoIO((struct IORequest *)iosr); CloseDevice((struct IORequest *)iosr); } else { printf("Unable to open trackdisk device, error %ld\n", iosr->io_Error); } DeleteStdIO(iosr); } else { printf("Unable to create IO request\n"); } } else { printf("Insufficient free store\n"); } } else { printf("Usage: %s {DF0:|DF1:|DF2:|DF3:}\n", argv[0]); } return result; } SHAR_EOF cat << \SHAR_EOF > BootCode2.asm * * BootCode2.asm - give preference to MEMF_CHIP and deactivate external drives * Copyright (C) 1987 Ralph Babel, Falkenweg 3, D-6204 Taunusstein * all rights reserved - alle Rechte vorbehalten * * 07-Aug-1987 created * 30-Mar-1988 cleanup * nolist include "exec/types.i" include "exec/execbase.i" include "exec/memory.i" include "exec/resident.i" include "devices/bootblock.i" include "resources/disk.i" list * * registers * REG_SysBase equr a6 * * macros * xlib macro xref _LVO\1 endm callsys macro jsr _LVO\1(REG_SysBase) endm * * IMPORT, external symbol references * xlib Forbid xlib Permit xlib Remove xlib Enqueue xlib OpenResource xlib FindResident * * constants * ROOT equ 880 ;default AmigaDOS root block (3.5 inch) NEW_PRI equ 10 ;priority for MEMF_CHIP regions * * code section * section "text",code * * magic constants * BBID_DOS dc.l 0 ;checksum dc.l ROOT * * boot code, called on system start-up * * In: * * A1: IOStdReq for TD_NAME, UNIT_0 * A6: SysBase * * Out: * * A0: start address to jump to (D0 == zero) * D0: failure code, null if successful * move.l d2,-(sp) callsys Forbid movea.l LH_HEAD+MemList(REG_SysBase),a1 bra.s 3$ 1$ btst.b #MEMB_CHIP,MH_ATTRIBUTES+1(a1) ;hi .. lo beq.s 2$ move.l a1,-(sp) callsys Remove movea.l (sp)+,a1 move.b #NEW_PRI,LN_PRI(a1) lea MemList(REG_SysBase),a0 callsys Enqueue 2$ movea.l d2,a1 3$ move.l (a1),d2 ;move.l LN_SUCC(a1),d2 bne.s 1$ callsys Permit move.l (sp)+,d2 lea diskName(pc),a1 callsys OpenResource tst.l d0 beq.s error movea.l d0,a0 lea DR_UNITID+4(a0),a0 moveq #DRT_EMPTY,d0 move.l d0,(a0)+ ;unit 1 move.l d0,(a0)+ ;unit 2 move.l d0,(a0) ;unit 3 lea dosName(pc),a1 callsys FindResident tst.l d0 beq.s error movea.l d0,a0 movea.l RT_INIT(a0),a0 moveq #0,d0 rts error moveq #-1,d0 rts diskName: dc.b 'disk.resource',0 dosName: dc.b 'dos.library',0 end SHAR_EOF # End of shell archive exit 0