[comp.sys.amiga] Stupid Program: 'Neeto'

ewhac@well.UUCP (Leo 'Bols Ewhac' Schwab) (03/09/88)

*REPLACE THIS LINE WITH ANOTHER ONE EXACTLY LIKE IT*

	Q: What happens when it's 1:30 AM, you have nothing to do, you're
bored, you're not tired, you're bored, you've caught up on all the newsgroups
you're interested in, you're bored, none of your friends has called to say
hello, you have no one to call yourself, and you're bored?

	*This* is what happens.

MANUFACTURE (Manx 3.4b):
1> ; Insert "SYS2" in any drive (the one with the assembly includes on it).
1> as neeto.asm
1> ln neeto.o -lc

USAGE:
	neeto

	80-column CLI only.  Use ^C to exit.

_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
Leo L. Schwab -- The Guy in The Cape	ihnp4!ptsfa -\
 \_ -_		Recumbent Bikes:	      dual ---> !{well,unicom}!ewhac
O----^o	      The Only Way To Fly.	      hplabs / (pronounced "AE-wack")
"Work FOR?  I don't work FOR anybody!  I'm just having fun."  -- The Doctor

_-_-_-_ Have you got a knife?  No?  A machete?  No?  A blowtorch....? _-_-_-_
#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create:
#	neeto.asm
#	neeto.uue
# This archive created: Tue Mar  8 20:36:21 1988
# By:	Leo 'Bols Ewhac' Schwab (Boing Boom Tschak)
export PATH; PATH=/bin:/usr/bin:$PATH
if test -f 'neeto.asm'
then
	echo shar: "will not over-write existing file 'neeto.asm'"
else
cat << \SHAR_EOF > 'neeto.asm'
*\ :ts=8 bk=0
*
* neeto.asm:	I wrote this because I was bored out of my skull this
*		morning, and had to do something.  This is based very
*		heavily on a program written by a very dear friend of
*		mine named Jon Foreman, and is named after the program
*		he wrote at College on Marin in VAX assembly under UNIX.
*		This program is really stupid...
*		CLI only; use ^C to exit.
*
* Leo L. Schwab				8803.01		(415)-456-3960
*/

		include	"exec/types.i"
		include	"exec/libraries.i"
		include "libraries/dos.i"

xlib		macro
		xref	_LVO\1
		endm

callsys		macro
		CALLLIB	_LVO\1
		endm

		xlib	OpenLibrary
		xlib	CloseLibrary
		xlib	Write
		xlib	Open
		xlib	Close
		xlib	SetSignal

		far	code
		far	data

VERSION		equ	0


****************
* Code
****************

		section	code

begin		lea	dosname,a1	; Open the dos.library
		moveq	#VERSION,d0
		movea.l	4,a6
		callsys	OpenLibrary
		movea.l	d0,a5		; Cache lib pointer in A5

		move.l	#stdout,d1	; Open stdout
		move.l	#MODE_OLDFILE,d2
		movea.l	a5,a6
		callsys	Open
		move.l	d0,d4		; Store filehandle in D4
		move.l	#SIGBREAKF_CTRL_C,d7

again:
		moveq	#69,d5		; Hard coded (ACK!).  Assumes 80-col
					; CLI window.
fwdloop:
		move.l	d4,d1		; Filehandle
		move.l	#forward,d2	; Buffer pointer
		move.l	#backward-forward,d3	; Length
		movea.l	a5,a6		; LibPtr
		callsys	Write
		bsr.s	chkabort
		dbra	d5,fwdloop

		moveq	#69,d5
bkloop:
		move.l	d4,d1		; FH
		move.l	#backward,d2	; Buffer
		move.l	#break-backward,d3	; Length
		movea.l	a5,a6
		callsys	Write
		bsr.s	chkabort
		dbra	d5,bkloop

		bra.s	again

chkabort:
		moveq	#0,d0
		moveq	#0,d1
		movea.l	4,a6
		callsys	SetSignal
		and.l	d7,d0		; Check for break
		bne.s	exit
		rts
exit:
		move.l	d4,d1		; FH
		move.l	#break,d2	; Buffer
		move.l	#enddat-break,d3	; Length
		movea.l	a5,a6
		callsys	Write		; Output ^C

		move.l	d4,d1
		movea.l	a5,a6
		callsys	Close		; Close stdout
		movea.l	a5,a1
		movea.l	4,a6
		callsys	CloseLibrary	; Close DOS
		addq.w	#4,sp		; Flush wrong return address
		rts


****************
* Data!  Wow!  *
****************
		section	data

dosname		dc.b	"dos.library",0
stdout		dc.b	"*",0

forward		dc.b	" =--->",8,8,8,8,8
backward	dc.b	"<---= ",8,8,8,8,8,8,8
break		dc.b	"^C",10
enddat:

		end
SHAR_EOF
fi
if test -f 'neeto.uue'
then
	echo shar: "will not over-write existing file 'neeto.uue'"
else
cat << \SHAR_EOF > 'neeto.uue'
begin 644 neeto
M```#\P`````````#``````````(````S``````````$```/I````,T/Z`)YP
M`"QX``1.KOW8*D`B/````*PD/````^TL34ZN_^(H`"X\```0`'I%(@0D/```
M`*XF/`````LL34ZN_]!A(E'-_^AZ12($)#P```"Y)CP````-+$U.KO_08091
MS?_H8,9P`'(`+'@`!$ZN_L[`AV8"3G4B!"0\````QB8\`````RQ-3J[_T"($
M+$U.KO_<(DTL>``$3J[^8EA/3G5D;W,N;&EB<F%R>0`J`"`]+2TM/@@("`@(
M/"TM+3T@"`@("`@("%Y#"@```````^P````$`````````!(````P````3```
B`'H````````#\@```^H````````#\@```^L````!```#\A(`
`
end
SHAR_EOF
fi
exit 0
#	End of shell archive