🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.micro.atari16
Article #2457

Re: Interrupt running programs

#2457
From: braner
Date: Sun, 19 Oct 1986 05:37
96 lines
3543 bytes
[]

Recently I posted here a program that, after running it once,
was supposed to kill any program in progress upon pressing
Ctrl-Alternate-both_Shifts-Return.  Turns out that the program
did not work outside of micro-C-Shell, and poorly even there!

I took a careful look at WATCHER.S (also posted here recently) and
noticed there that a kill is NOT done if the interrupted program
was in supervisor mode.  I don't know why, maybe because that
signals that another interrupt handler (or TRAP!) is in progress.
Incorporating that idea, jumping to the last part of the ROM
bomb handler to do the termination, and some streamlining yielded
the following program which seems to work a lot better.
(you have to press Ctrl-Alt-both_Shifts-Return several times
sometimes, probably in order to catch it in user mode...)

Mystery remaining:

	When it terminates, two bombs are displayed.  WHY?


WARNING:

	This program uses some addresses that are essential
	but not official.  I found them out by snooping around in the
	ROM code.  They may be changed in future versions of TOS.
	Atari will send their death squads after you if you use these
	addresses in a commercial program!


Here is the heart of the routine, in commented assembly syntax:

asm {
/*
 * call supexec() to install our thing
 */
	PEA	install(PC)
	MOVE.W	#38,-(A7)
	TRAP	#14
	ADDQ.L	#6,A7
/*
 * terminate and stay resident
 */
	CLR.W	-(A7)
	MOVE.L	#0x00000200,-(A7)
	MOVE.W	#0x31,-(A7)
	TRAP	#1
install:
/*
 * install our keyboard interrupt handler
 * (has to be done in supervisor mode)
 */
	PEA	handler(PC)
	MOVE.L	(A7)+,0x118	/* pointer to kbd intrpt subr */
	RTS
handler:
/*
 * check mode of interrupted program and keyboard shift status
 */
	BTST	#5,(A7)		/* check for super mode */
	BNE.S	normal
	CMPI.B	#0x0F,0xE1B	/* kbd state variable */
	BCS.S	normal
/*
 * overwrite return address with fatal address
 */
	MOVE.L	#0xFC0A5A,2(A7)	/* near end of _term */
normal:
/*
 * go do the usual thing, usually return to interrupted program
 */
	JMP	0xFC281C	/* where $118 pointed to */
}


Here is a hex dump of the complete program (92 bytes):

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
60 1A 00 00 00 70 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 FF FF 48 7A 00 18
3F 3C 00 26 4E 4E 5C 8F 42 67 2F 3C 00 00 02 00
3F 3C 00 31 4E 41 48 7A 00 08 21 DF 01 18 4E 75
08 17 00 05 66 10 0C 38 00 0F 0E 1B 65 08 2F 7C
00 FC 0A 5A 00 02 4E F9 00 FC 28 1C
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Any comments/experiences welcome!

- Moshe Braner

<braner@amvax.tn.cornell.edu>

DISCLAIMER:  The mention of "death squads" was not meant to discredit
Atari, Corp in any way.  Also, I do not want to trivialize the grim
reality of death sqauds in some parts of "civilization".
Technical Details
Message-ID: <1234@batcomputer.TN.CORNELL.EDU>
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!caip!rutgers!sri-spam!sri-unix!hplabs!tektronix!uw-beaver!cornell!batcomputer!braner
References: <14600008@uklirb.UUCP> <1230@batcomputer.TN.CORNELL.EDU>

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!caip!rutgers!sri-spam!sri-unix!hplabs!tektronix!uw-beaver!cornell!batcomputer!braner
From: braner@batcomputer.TN.CORNELL.EDU (braner)
Newsgroups: net.micro.atari16
Subject: Re: Interrupt running programs
Message-ID: <1234@batcomputer.TN.CORNELL.EDU>
Date: Sun, 19-Oct-86 01:37:35 EDT
Article-I.D.: batcompu.1234
Posted: Sun Oct 19 01:37:35 1986
Date-Received: Tue, 21-Oct-86 22:07:16 EDT
References: <14600008@uklirb.UUCP> <1230@batcomputer.TN.CORNELL.EDU>
Reply-To: braner@batcomputer.UUCP (braner)
Organization: Theory Center, Cornell University, Ithaca NY
Lines: 96
Summary: Improved version