amiga-request@abcfd20.larc.nasa.gov (Amiga Sources/Binaries Moderator) (10/10/90)
Submitted-by: isuihko@ujocs.joensuu.fi (Ismo Suihko) Posting-number: Volume 90, Issue 272 Archive-name: util/stopclick/part01 [ uuencoded executable enclosed ...tad ] This program, StopClick, will stop the clicking of empty drives if you are using SetCPU1.6 (by Dave Haynie) to load KS 1.3 ROM image to fast 32-bit ram. It works even if you are using TDPatch13 from CrossDos. StopClick also fixes trackdisk read/write bug (just like NoClick did). Before trying to do any patches, StopClick will check if the system has a MMU, and after that it checks if the ROM image in 32-bit RAM is the correct one (KS 1.3). So it is safe to put this after SetCPU FASTROM in startup-sequence, even if you sometimes reboot your Amiga on 68000 mode or use other versions of Kickstarts. #!/bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh <file", e.g.. If this archive is complete, you # will see the following message at the end: # "End of archive 1 (of 1)." # Contents: Makefile README.1st StopClick.a StopClick.uu readme # Wrapped by tadguy@abcfd20 on Tue Oct 9 21:23:24 1990 PATH=/bin:/usr/bin:/usr/ucb ; export PATH if test -f 'Makefile' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'Makefile'\" else echo shar: Extracting \"'Makefile'\" \(213 characters\) sed "s/^X//" >'Makefile' <<'END_OF_FILE' X# Makefile for StopClick 04-Aug-90 by Ismo Suihko X XStopClick : StopClick.o X Blink StopClick.o to StopClick X X# I: is assigned to include-directory XStopClick.o : StopClick.a X Assem StopClick.a -o StopClick.o -i I: X END_OF_FILE if test 213 -ne `wc -c <'Makefile'`; then echo shar: \"'Makefile'\" unpacked with wrong size! fi # end of 'Makefile' fi if test -f 'README.1st' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'README.1st'\" else echo shar: Extracting \"'README.1st'\" \(436 characters\) sed "s/^X//" >'README.1st' <<'END_OF_FILE' XThis program will stop clicking of empty disk drives, if you Xare using SetCPU1.6 FASTROM to load KS1.3 image to fast 32-bit RAM. X XI have tested it only on my system (with A2620), so I can't say absolutely Xsure that it works also on other systems on which you can use FASTROM, but I Xstrongly believe that there aren't any problems. XPlease email any comments to the following address, thanks. X X isuihko@ujocs.joensuu.fi (Ismo Suihko) END_OF_FILE if test 436 -ne `wc -c <'README.1st'`; then echo shar: \"'README.1st'\" unpacked with wrong size! fi # end of 'README.1st' fi if test -f 'StopClick.a' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'StopClick.a'\" else echo shar: Extracting \"'StopClick.a'\" \(9658 characters\) sed "s/^X//" >'StopClick.a' <<'END_OF_FILE' X* StopClick version 1.0 for SetCPU1.6 users X* Written by Ismo Suihko, August 4, 1990 (isuihko@ujocs.joensuu.fi) X* Released to the Public Domain X* X* Routines _GetMMUType and TestFlags are borrowed from SetCPU1.6, X* which is written by Dave Haynie. X* Also include file setcpu.i is borrowed from SetCPU sources. X* X* Stops clicking of empty drives by patching 1.3 KS V34.5 ROM (check X* it with command 'version') image loaded in 2-bit RAM with X* 'SetCPU FASTROM'. Disk drive heads will after the patch be stepped X* (silently) in a negative rather than positive direction during the X* regular system checks for a disk change. X* Version 1.6 of SetCPU isn't doing that patch anymore. X* StopClick also fixes trackdisk read/write bug (just like NoClick did). X* This patching is possible, because ROM image isn't protected at all. X* StopClick does nothing, if there isn't MMU and the given address X* doesn't seem to contain right version of the ROM image, so it X* is safe to run this even if you sometimes boot on 68000 mode. X* X* Based on the NoClick program, which is written by Norman Iscove. X* It didn't work on my system, because of SetPatch and TDpatch13 X* (TDpatch13 comes with CrossDos (a great product!)). X* X* USAGE: X* First check the address of the KERNEL by using command 'SetCPU VERBOSE' X* If you have A2620 or A2630 with 2 MB 32-bit RAM, then output may X* contain this line X* KERNEL: (PADDR: $ 3a0000) (VADDR: $ fc0000) (SIZE: 256K) X* ^^^^^^ X* Then give that address as a parameter to StopClick, like X* StopClick 3a0000 ;(you can use numbers 0-9 and letters A-F and a-f) X* Don't put '$' before the address, because it is used by shell. X* Put StopClick to a startup-sequence after SetCPU FASTROM when you have X* checked what the address of the KERNEL is. If you add there more memory, X* you have to check the address again and do modifications if necessary. X* X* e.g. X* SetCPU FASTROM X* stopclick 3a0000 ; KERNEL is at address $3a0000 X* X* There aren't any checks if there is a FASTROM image REALLY IN USE. X* We only check, if there are signs of a 1.3 KS V34.2 ROM image.. X* If FASTROM has been actice once, but then disactivated, the image could X* still be in the 32-bit RAM, so it is found from there, and patches are X* made but without any effect (and no harm either). X* X* Return codes: X* 0 complete success, fixes made now or they had been made earlier X* 5 no MMU (Memory Management Unit) X* 10 no KS ROM image found, or wrong version of ROM X* 15 KS ROM image found, but modifications couldn't be done?? X* 99 invalid parameter X* We get return code 5 always if there isn't a MMU. X* X* BUGS: X* No known bugs. X* Maybe the address of KERNEL could be found by this program somehow... X* X* Sometimes clicking will end only after a couple of seconds, just like X* with NoClick. Don't ask me why it happens so, as I don't know. X* And there may be some odd floppy disk drives which don't like to step X* in a negative direction. I haven't yet heard anyone who owns such a drive. X* X* History: X* V0.9 Jun 23, 1990 works, do we need more? X* V1.0 Aug 04, 1990 some more checking, now we check if there is a MMU, X* earlier we checked only if there was a '020 or better. X* program is now 480 bytes long X* V?.? ??? ??, ???? will find the address of the ROM image by itself X* X* To compile first get the setcpu.i include file from the SetCPU1.6 sources, X* comment out (add ';'s) the last two lines containing the text X* ; machine mc68020 X* ; mc68881 X* and then compile with commands X* Assem StopClick.a -o StopClick.o -i INC: X* Blink StopClick.o to StopClick X* Makefile is also provided for easier compilation and linking. X X X* exec.library routines XLVODisable EQU -120 XLVOEnable EQU -126 XLVOCloseLibrary EQU -414 XLVOOpenLibrary EQU -552 X* dos.library routines XLVOWrite EQU -48 XLVOOutput EQU -60 X X* some macros, etc. X include "setcpu.i" X X X movem.l d0/a0,-(sp) save information of command line parameters X X bsr _GetMMUType X tst.l d0 is there a MMU? 68851 or 68030? X bne.s scan X* no MMU X addq.l #8,sp forget parameters before quitting X moveq #5,d0 no MMU X bra exit X Xscan X movem.l (sp)+,d0/a0 X* Now check, if there is a valid hexadesimal address given X subq.l #1,d0 take out end of line (null) X beq.s scan_err is there any parameters at all X X subq.l #1,d0 counter (length of the parameter) X moveq #0,d1 result X moveq #0,d2 character from the command line Xscan_loop X move.b (a0)+,d2 get a character from the command line X X cmpi.b #' ',d2 check for the end of hex number X beq.s scan_ready is it a space X cmpi.b #';',d2 X beq.s scan_ready is it a start of a comment X cmpi.b #9,d2 X beq.s scan_ready is it a tab X X moveq #'0',d3 X cmpi.b #'9',d2 X ble.s scan_number X bclr.l #5,d2 [a-f] -> [A-F] X cmpi.b #'A',d2 X blt.s scan_err less than 'A' X cmpi.b #'F',d2 X bgt.s scan_err greater than 'F' X moveq #'A'-10,d3 Xscan_number X sub.b d3,d2 X blt.s scan_err less than '0' X asl.l #4,d1 multiply by $10 X add.l d2,d1 X dbra d0,scan_loop Xscan_ready X tst.w d1 should be of form xxxx0000 X beq.s check X Xscan_err X moveq #99,d0 X bra.s exit X Xcheck X movea.l d1,a2 address of possible ROM image X X* Now check if the given address may contain ROM image with exec of V34.2 X cmpi.w #' 3',$1c(a2) X bne.s bad_rom X cmpi.l #'4.2 ',$1e(a2) X bne.s bad_rom X X* add offset of trackdisk.device, should be of version 34.1 X adda.l #$29564,a2 X cmpi.l #'34.1',$36(a2) X beq.s patch Xbad_rom X moveq #10,d0 no ROM image found X bra.s exit X Xpatch X moveq #2,d7 2 patches X* disable interrupts X CALLSYS Disable X X* first we check, if we need to patch, then we check was the patch successful X X* Stop the clicks X* fix 'bchg #$01,$41(a3)' to 'bset #$01,$41(a3)' X lea $104(a2),a0 X cmpi.w #$086b,(a0) X bne.s 1$ X move.w #$08eb,(a0) X1$ X cmpi.w #$08eb,(a0) X bne.s 2$ X subq #1,d7 X X2$ X* Repair trackdisk read/write bug originally at $feaf9c (1.3) X* fix 'cmp.l $8000,d0' to 'cmpi.l #$8000,d0' X lea $1a38(a2),a0 X cmpi.w #$b0b9,(a0) X bne.s 3$ X move.w #$0c80,(a0) X3$ X cmpi.w #$0c80,(a0) X bne.s 4$ X subq #1,d7 X4$ X* enable interrupts X CALLSYS Enable X X move.l d7,d0 if d7 = 0, patching was succesful X beq.s exit X moveq #15,d0 patches failed?? X Xexit X tst.b d0 X beq.s real_exit X X* print the usage text X move.l d0,-(sp) push the return code X lea dosname(pc),a1 X moveq #0,d0 X CALLSYS OpenLibrary X tst.l d0 X beq.s 2$ X move.l d0,a5 X exg a5,a6 X jsr LVOOutput(a6) X move.l d0,d1 X beq.s 1$ X lea usage(pc),a0 X move.l a0,d2 X moveq #usagelen,d3 X jsr LVOWrite(a6) X1$ X exg a5,a6 X move.l a5,a1 X CALLSYS CloseLibrary X2$ X move.l (sp)+,d0 pop the return code X Xreal_exit X rts X X X X* The following routines are borroved from SetCPU1.6 sources. X* I optimized the code a slightly to make my program smaller than 488 X* bytes, because otherwise it would have taken 1+2 disk blocks using OFS. X* I removed also the 68040 check, because at this context we don't need X* to know whether there is exactly '030 or '040 as both have MMU. X X X;====================================================================== X; X; This routine checks CPU flags early in ExecBase for extended X; CPUs that test as a 68020 under 1.3. If these flags are set, X; the actual CPU/MMU type test can be skipped. X; X;====================================================================== X XTestFlags: X moveq.l #0,d0 X* btst.b #AFB_68040,ATNFLGS(a6) ; Does the OS think an '040 is here? X* beq.s NoEarly40 X* move.l #68040,d0 X* rts X*NoEarly40: X btst.b #AFB_68030,ATNFLGS(a6) ; Does the OS think an '030 is here? X beq.s NoEarly30 X move.l #68030,d0 ; Sure does... XNoEarly30: X rts X X X;====================================================================== X; X; This function returns 0L if the system contains no MMU, X; 68851L if the system does contain an 68851, or the CPU number X; for CPUs with integral CPUs. X; X; This routine seems to lock up on at least some CSA 68020 X; boards, though it runs just fine on those from Ronin and X; Commodore, as well as all 68030 boards it's been tested on. X; X; ULONG GetMMUType() X; X;====================================================================== X X_GetMMUType: X move.l 4,a6 ; Get ExecBase X bsr TestFlags ; Check extended CPU types X tst.l d0 X beq.s MMURealTest X rts X X ; For any other machine, a real test must be done. The test will X ; try an MMU instruction. The instruction will fail unless we're X ; on a "bogus MMU" system, where the FPU responds as an MMU. XMMURealTest: X movem.l a3/a4/a5,-(sp) ; Save this stuff X suba.l a1,a1 X CALLSYS FindTask ; Call FindTask(0L) X move.l d0,a3 X X move.l TC_TRAPCODE(a3),a4 ; Change the exception vector X lea MMUTraps(pc),a0 X move.l a0,TC_TRAPCODE(a3) X X moveq.l #-1,d0 ; Try to detect undecode FPU X subq.l #4,sp ; Get a local variable X PMOVE_ tc,(sp) ; Let's try an MMU instruction X addq.l #4,sp ; Return that local X move.l a4,TC_TRAPCODE(a3) ; Reset exception stuff X movem.l (sp)+,a3/a4/a5 ; and return the registers X rts X X ; This is the exception code. No matter what machine we're on, X ; we get an exception. If the MMU's in place, we should get a X ; privilige violation; if not, an F-Line emulation exception. XMMUTraps: X move.l (sp)+,d0 ; Get Amiga supplied exception # X cmpi #11,d0 ; Is it an F-Line? X beq.s MMUNope ; If so, go to the fail routine X move.l #68851,d0 ; We have MMU X addq.l #4,2(sp) ; Skip the MMU instruction X rte XMMUNope: X moveq.l #0,d0 ; It dinna woik, X addq.l #4,2(sp) ; Skip the MMU instruction X rte X X X X* some strings X Xdosname dc.b 'dos.library',0 Xusage dc.b 'StopClick v1.0 by IS. ' X dc.b 'Usage: StopClick address-of-1.3-KS-FASTROM-image',10 Xusagelen EQU *-usage X X END X END_OF_FILE if test 9658 -ne `wc -c <'StopClick.a'`; then echo shar: \"'StopClick.a'\" unpacked with wrong size! fi # end of 'StopClick.a' fi if test -f 'StopClick.uu' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'StopClick.uu'\" else echo shar: Extracting \"'StopClick.uu'\" \(709 characters\) sed "s/^X//" >'StopClick.uu' <<'END_OF_FILE' Xbegin 666 StopClick XM```#\P`````````!``````````````!O```#Z0```&](YX"`80`!#$J`9@A0F XMCW`%8```MDS?`0%3@&=$4X!R`'0`%!@,`@`@9S(,`@`[9RP,`@`)9R9V,`P"E XM`#EO$@B"``4,`@!!;1@,`@!&;A)V-Y0#;0SI@=*"4<C_R$I!9P1P8V!D)$$,* XM:B`S`!QF&@RJ-"XR(``>9A#5_``"E60,JC,T+C$`-F<$<`I@/'X"3J[_B$'J$ XM`00,4`AK9@0PO`CK#%`(ZV8"4T=!ZAHX#%"PN68$,+P,@`Q0#(!F`E-'3J[_W XM@B`'9P)P#TH`9S(O`$/Z`)9P`$ZN_=A*@&<@*D#+3DZN_\0B`&<,0?H`B"0(. XM=DA.KO_0RTXB34ZN_F(@'TYU<``(+@`"`2EG!B`\``$)ODYU+'@`!&'H2H!GW XM`DYU2.<`')/)3J[^VB9`*&L`,D'Z`!HG2``R</]9C_`70@!8CR=,`#),WS@`P XM3G4@'PQ```MG#"`\``$,\UBO``).<W``6*\``DYS9&]S+FQI8G)A<GD`4W1O+ XM<$-L:6-K('8Q+C`@8GD@25,N("!5<V%G93H@4W1O<$-L:6-K(&%D9')E<W,MN X>;V8M,2XS+4M3+49!4U123TTM:6UA9V4*``````/R7 X`` Xend Xsize 480 END_OF_FILE if test 709 -ne `wc -c <'StopClick.uu'`; then echo shar: \"'StopClick.uu'\" unpacked with wrong size! fi # end of 'StopClick.uu' fi if test -f 'readme' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'readme'\" else echo shar: Extracting \"'readme'\" \(1115 characters\) sed "s/^X//" >'readme' <<'END_OF_FILE' XStopClick version 1.0 for SetCPU1.6 users X Written by Ismo Suihko, August 4, 1990 X Released to the Public Domain X XThis program will stop the clicking of empty drives if you are using XSetCPU1.6 (by Dave Haynie) to load KS 1.3 ROM image to fast 32-bit ram. X XPlease check the beginning of the assembler source file for usage etc. XYou need to give the address of ROM image as a parameter. X XDistribution: X This program is freely distributable, provided that all the following X 4 files are included unmodified: X X size in bytes X README 1115 you are reading it now X Makefile 213 compiling instructions for Make X StopClick 480 binary X StopClick.a 9658 source X XTo compile, you need also file setcpu.i from SetCPU1.6 sources. X X XDisclaimer: X Can I say shortly: "Standard disclaimers apply" X XIf you have comments about my program (like/dislike/etc), then email them to X Internet: isuihko@ujocs.joensuu.fi (try this address first) X Bitnet: 06560L@FINUJO.BITNET X XIf you don't have access to electronic mail systems, then you can try X Ismo Suihko X Roivas X 81999 Joensuu X FINLAND END_OF_FILE if test 1115 -ne `wc -c <'readme'`; then echo shar: \"'readme'\" unpacked with wrong size! fi # end of 'readme' fi echo shar: End of archive 1 \(of 1\). cp /dev/null ark1isdone MISSING="" for I in 1 ; do if test ! -f ark${I}isdone ; then MISSING="${MISSING} ${I}" fi done if test "${MISSING}" = "" ; then echo You have the archive. rm -f ark[1-9]isdone else echo You still need to unpack the following archives: echo " " ${MISSING} fi ## End of shell archive. exit 0 -- Mail submissions (sources or binaries) to <amiga@uunet.uu.net>. Mail comments to the moderator at <amiga-request@uunet.uu.net>. Post requests for sources, and general discussion to comp.sys.amiga.