evaluation (Developers)
This looks good. Some comments:
You could free the environment block before entering the "critical" part, and use 21.49 as usual.
If you changed your MCB splitting code to this, I don't think you would need to clear the interrupt flag:
mov word [3], newsize
mov byte [0], 'M'
You could also free the MCB using 21.49 then. The rationale behind this is that if the MCB contained 'M' initially, then the first instruction will resize the MCB appropriately. The second will effectively always be a NOP then, since the resized MCB must still point to the one you created. (It could hardly contain 'Z' suddenly.) If the MCB however contained 'Z' initially, then you're either at the very end of the MCB chain or you are modifying the MCB that points to the first UMCB (at segment 9FFFh if 640 KiB of low memory are in use). In both cases, making the MCB point to your new MCB while temporarily leaving the letter as 'Z' has none or no critical drawbacks. (If it pointed to the first UMCB and a TSR interrupts between the two instructions and that TSR allocates memory using DOS, DOS's behaviour with allocating UMBs would be erratic - however, no critical failure would occur.) At least that was my reasoning for executing this code without clearing the interrupt flag when I wrote MCB splitting code.
You could of course still include the clearing of the interrupt flag.
cli
mov word [3], newsize
mov byte [0], 'M'
sti
Exchanging the instructions in your code to this advantageous order where the MCB's size is adjusted first is still useful for tracing that code in a debugger, as debuggers disable any protection you get by clearing the interrupt flag.
Assuming your TSR image is still stored behind the installer and assuming that your stack is behind that, you do not need to leave the interrupt flag disabled during your 21.48 call, with or without this adjustment. As you noted, you do not execute in free memory and do not depend on data in free memory. Therefore, protecting the 21.48 call is not necessary. Attempting to justify your (arguably ineffectual) protection scheme isn't necessary either.
Other than that, you still seem to keep the "psp" variable around in the TSR and you still set the TSR's MCB's owner to 8 (so that MEM probably won't show your name properly). The variable is an optimization that isn't required, and the owner is a minor display issue that doesn't do any harm otherwise. So, as I said, this looks good.
---
l
Complete thread:
- keyb: new! memory scheme, easy TEST - Ninho, 22.05.2011, 19:10 (Developers)
- boring - ecm, 22.05.2011, 23:58
- boring - Ninho, 23.05.2011, 01:20
- not that boring after all (nt) - ecm, 23.05.2011, 13:27
- boring - Ninho, 23.05.2011, 01:20
- review - ecm, 23.05.2011, 13:18
- review - Ninho, 23.05.2011, 23:10
- review - ecm, 24.05.2011, 00:45
- review - Ninho, 24.05.2011, 12:50
- review - ecm, 24.05.2011, 15:20
- of TSR powers & limits - Ninho, 25.05.2011, 11:24
- Swap! - ecm, 25.05.2011, 14:13
- of TSR powers & limits - Ninho, 25.05.2011, 15:14
- Swap! - ecm, 25.05.2011, 14:13
- of TSR powers & limits - Ninho, 25.05.2011, 11:24
- review - ecm, 24.05.2011, 15:20
- review - Ninho, 24.05.2011, 12:50
- review - ecm, 24.05.2011, 00:45
- fix - Ninho, 29.05.2011, 14:36
- opinion - ecm, 29.05.2011, 14:49
- opinion - Ninho, 29.05.2011, 16:36
- evaluation - ecm, 29.05.2011, 17:26
- evaluation - Ninho, 29.05.2011, 21:00
- hardly a 100% solution - ecm, 29.05.2011, 22:17
- hardly a 100% solution - Ninho, 30.05.2011, 19:26
- hardly a 100% solution - ecm, 30.05.2011, 19:33
- hardly a 100% solution - Ninho, 30.05.2011, 21:14
- hardly a 100% solution - ecm, 30.05.2011, 21:20
- hardly a 100% solution - Ninho, 30.05.2011, 23:50
- allocation no higher than the PSP - ecm, 30.05.2011, 23:56
- allocation no higher than the PSP - Ninho, 01.06.2011, 18:56
- allocation no higher than the PSP - ecm, 01.06.2011, 19:10
- allocation no higher than the PSP - Ninho, 01.06.2011, 18:56
- allocation no higher than the PSP - ecm, 30.05.2011, 23:56
- hardly a 100% solution - Ninho, 30.05.2011, 23:50
- hardly a 100% solution - ecm, 30.05.2011, 21:20
- hardly a 100% solution - Ninho, 30.05.2011, 21:14
- hardly a 100% solution - ecm, 30.05.2011, 19:33
- hardly a 100% solution - Ninho, 30.05.2011, 19:26
- hardly a 100% solution - ecm, 29.05.2011, 22:17
- evaluation - Ninho, 29.05.2011, 21:00
- opinion - Ninho, 30.05.2011, 19:04
- sti - ecm, 30.05.2011, 19:26
- evaluation - ecm, 29.05.2011, 17:26
- opinion - Ninho, 29.05.2011, 16:36
- opinion - ecm, 29.05.2011, 14:49
- review - Ninho, 23.05.2011, 23:10
- boring - ecm, 22.05.2011, 23:58