[Coco] Linville's ramblings on assembly vs machine code
ooogalapasooo at aol.com
Tue Jul 11 15:45:40 EDT 2017
Curtis, you can also use "fragmented subroutines" and swap out 8k blocks of memory in a running process. Ultimuse3 was the first to use this (that I know of) and my MShell Project makes extensive use of it. It takes quite a bit of setup, but done perfectly legal. I can swap out 8k subs, one sub called from within another, then returning to it's place in the previous sub when done. This can chain many times (or until the stack overflows LOL).
BTW... is there a way to make an OS9 module NOT be re-entrant? In other words, only allow a single instance to load and run, therefore locking out a 2nd attempt at running.
"Charlie stole the handle, and the train it won't stop going, no way to slow down!" - Ian Anderson - Jethro Tull
My Music from the Tandy/Radio Shack Color Computer 2 & 3
Co-Contributor, Co-Editor for CocoPedia
E-Mail: ooogalapasooo at aol.com
From: L. Curtis Boyle <curtisboyle at sasktel.net>
To: CoCoList for Color Computer Enthusiasts <coco at maltedmedia.com>
Sent: Tue, Jul 11, 2017 1:36 pm
Subject: Re: [Coco] Linville's ramblings on assembly vs machine code
You can do self-modifying code “legally” in OS-9 - but you have to copy the routine(s) into your data area and execute them from there. The reason it doesn’t work “normally” is that a program can be shared by multiple processes (they all run the exact same code, just with different data areas and stacks) - and it wouldn’t work well if a 2nd iteration of a program thinks it has one version of the self-modifying code, but the 1st iteration has already changed it to something else. If you went for a more memory bloated Unix/Linux model (a full physical copy in RAM of each copy of the same program), you might be able to get away with it (although things like program CRC checks would fail, unless you updated it each time it self modified), but for an 8 bit machine like the Coco, that would suck way too much RAM.Since the data area is unique to each process, you can do self-modifying code in that area, and it won’t corrupt any other copies of that program running.L. Curtis Boylecurtisboyle at sasktel.net
More information about the Coco