Open durgadas311 opened 4 years ago
Note, any general-purpose CP/NET 1.2 shutdown utility must ensure that the NTWKDN (SNIOS-extension) routine is called (for Network Shutdown).
One of the difficulties with this is that CP/NET 1.2 inserts itself into the BIOS jumps for console and list device I/O. Undoing that from the outside of NDOS.SPR is practically impossible. This may require modifying NDOS to provide an "unload" function.
Added an NETDOWN utility to call NTWKDN and wait for user to RESET. However, a formal CP/NET 1.2 unload might still be possible, with a modified NDOS.
Unloading NDOS quick and dirty
ld hl,(6)
ld l,0
push hl
ld de,228h
add hl,de
ld (hl),0c9h
pop hl
ld de,1fdh
add hl,de
call hljp
jp 0
hljp: jp (hl)
Note, this routine is using the wrong offsets, if "ld l,0" is being done. The offsets would be correct if L were left as "06". Also, these offsets depend on using the stock DRI NDOS.SPR. This code restores the BIOS jump vectors, but does not fix up the jumps at 0000h and 0005h - so the "jp 0" cannot be done. If the BIOS warm boot vector were jumped to directly, then it might work (as most BIOSes restore the jumps at 0000h and 0005h). I'm not yet convinced there is nothing else that needs cleanup, though.
Ideally, this unloading would be done by a "BDOS" (NDOS) call, so as to not rely on the BDOS call chain being pristine. In addition, the SNIOS extension for shutting down the network would be called, so that servers are notified. I am currently thinking of using the CP/M-Plus "unload RSX" mechanism for signalling a shutdown of CP/NET, although it could also be any extension of BDOS/NDOS function numbers. The goal would be to have a single program that works on both CP/NET 1.2 and CP/NET 3, and makes no assumptions about the internal geography of the NDOS.
Unloading NDOS quick and dirty
ld hl,(6)
ld l,0
push hl
ld de,228h
add hl,de
ld (hl),0c9h
pop hl
ld de,1fdh
add hl,de
call hljp
jp 0
hljp: jp (hl)
It worked for me, tested before posting.
Note, this routine is using the wrong offsets, if "ld l,0" is being done. The offsets would be correct if L were left as "06".
Are you sure? Please load the stock NDOS.SPR under cp/m 2.2 and have a look with DDT or DDTZ
...but does not fix up the jumps at 0000h and 0005h - so the "jp 0" cannot be done
The jump at 0000h always points to the BIOS warm boot vector and the jump at 0005h is restored by the warm boot (normally)
Yes, this is a quick and dirty solution, a better one would require a modified NDOS. I'm using a modified NDOS with a cpnet-0.8 server for a year and restoring the BIOS jump vectors is all what is needed for cleanup.
Yes, I was looking at the wrong NDOS code, I was looking at the CP/NOS version by mistake. Which is another variation that must be handled. In the case of CP/NOS, the NDOS cannot be removed but the network shutdown hook in the SNIOS still needs to be called, and instead of warm boot the procedure needs to stop and wait for system RESET.
Anyway, the plan is to implement an NDOS call of some sort to perform the necessary actions, and the CP/NOS NDOS will handle it differently than the CP/NET 1.2 NDOS, and both differently than the CP/NET 3 NDOS.RSX.
DRI did not design an escape to normal CP/M after CPNETLDR has been run. Need to investigate whether it is possible to extricate (unload) CP/NET from CP/M without destroying it.
Solving this problem makes issue #5 unnecessary.