🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.msdos.programmer
Article #4275

Re: Writing over ALL memory without overwriting progr

#4275
From: slsw2
Date: Mon, 14 Jan 1991 22:02
45 lines
2575 bytes
In article <5NykV1w163w@kk4fs.UUCP>, genesis@kk4fs.UUCP (Genesis) writes:
>   I have recently made a program that writes all memory to a disk file.No 
> problem.However,writing it back overwrites the executing program resulting 
> in a lock!Help!

If you're careful, you can make this work; I've seen other machines do this
sort of thing. The bootstrap for my PDP-8 off of RK05, for instance, consists
of the command to read the boot block from the disk followed by a jump to
itself. The jump to itself is eventually overwritten by a different 
instruction from the disk, which jumps to the first location of the bootstrap.

The key is that the information coming from the disk has to make sense. When
memory is loaded from the disk, the disk operation will return to the code
that it just loaded rather than the code that called it. There are a couple
of things you can do:

- Have the code that is loaded be an exact copy of the code that called it;
  then it won't matter that it's been overwritten since it will be returning
  to an exact duplicate of the code that called it.

- Make certain that the code that overwrites makes sense. For example, if 
  the block containing the code doing the reading is overwritten at the 
  very end of the transfer, it could contain the code to do whatever you
  need to do following the transfer rather than the reading code. This is
  the case with the PDP-8 bootstrap mentioned above. There are a couple
  of key points here:

  - The code being overwritten must not cross a block boundary. If it does,
    it's possible for the I/O routines to return to code that has only been
    partially overwritten.

  - The code that is being written into memory must realize that its entry
    point will be at the return location from the I/O call. That entry
    point must exactly line up with the instruction following the CALL to
    the I/O routines.

Enjoy.
-- 
===============================================================================
Roger Ivie

35 S 300 W
Logan, Ut.  84321
(801) 752-8633
===============================================================================
Technical Details
Message-ID: <1991Jan14.160215.46684@cc.usu.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!cs.utexas.edu!hellgate.utah.edu!fcom.cc.utah.edu!cc.utah.edu!cc.usu.edu!slsw2
References: <5NykV1w163w@kk4fs.UUCP>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!cs.utexas.edu!hellgate.utah.edu!fcom.cc.utah.edu!cc.utah.edu!cc.usu.edu!slsw2
From: slsw2@cc.usu.edu
Newsgroups: comp.os.msdos.programmer
Subject: Re: Writing over ALL memory without overwriting progr
Message-ID: <1991Jan14.160215.46684@cc.usu.edu>
Date: 14 Jan 91 22:02:14 GMT
References: <5NykV1w163w@kk4fs.UUCP>
Lines: 45