slsw2@cc.usu.edu (01/15/91)
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 ===============================================================================