🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.arch
Article #2531

Re: Self-modifying code

#2531
From: g.d.cooper in the shadowlands
Date: Wed, 11 Oct 1989 23:27
38 lines
2057 bytes
One my major reasons for using self-modifying code was due to the user
implementable  instructions (UUOs) on the PDP-10.   If  you were doing
funky  IO you  could define your  own system call that executed within
the user space.  Since IO channel numbers are different  for each file
you would build the instruction sequences somewhere in memory and then
execute them.

A couple of months ago I was writing a device driver for RT-11 on the
PDP-11 and I had to use self-modifying code to either store or discard
data depending upon whether or not there was a free buffer.  The '11
lends itself to this sort of manipulation by allowing instruction
sequences such as:

	tstb	free			;any free buffers
	bne	1$			;yes don't worry be happy

	mov	(pc)+,@#routine		;no free buffers then we'll
		nop			;have to discard
	br	2$

1$:
	mov	(pc)+,@#routine		;move the mov instruction into
		mov	(r0)+,(r1)+	;the routine
2$:

I also remember doing similar things on the PDP-8 and the RDS-500 due
to hardware limitations but the less said about that the better.

		   Hacking assembler for a living,

				shades
============================================================================
| He paid too high a price for living | Geoffrey D. Cooper                 | 
| too long with a single dream.....   | cooper@hpsrad.enet.dec.com	   |
|-------------------------------------| business (508) 467-3678            |
| decwrl!hpsrad.enet.dec.com!cooper   | home (617) 925-1099                |
============================================================================
Note: I'm a consultant.  My opinions are *MY* opinions.
Technical Details
Message-ID: <522@ryn.esg.dec.com>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!wuarchive!decwrl!shlump.nac.dec.com!ryn.esg.dec.com!hpsrad.enet.dec.com

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!wuarchive!decwrl!shlump.nac.dec.com!ryn.esg.dec.com!hpsrad.enet.dec.com
From: cooper@hpsrad.enet.dec.com (g.d.cooper in the shadowlands)
Newsgroups: comp.arch
Subject: Re: Self-modifying code
Message-ID: <522@ryn.esg.dec.com>
Date: 11 Oct 89 23:27:42 GMT
Sender: guest@ryn.esg.dec.com
Organization: DEC Fault Tolerant Systems, Marlboro MA
Lines: 38