RDROYA01@ULKYVX.BITNET (Robert Royar) (05/25/86)
Hello again, I now have the problem with background CP/M licked, I believe. This morning I worked out a way to let the ccp have control until a ^C is typed and I patched the CPM.SYS file to leave traps 0 & 1 alone. This means that, if they are not set by some program, they point to $0. Could this be why the BDOS re-inits them each time, just so they will point to the default exception handler? Now, if I call a trap #0 before installing the handler, I get a "User Exception 3 at xxxxx Aborted." So simply changing the compare in _initexc is not the perfect solution. But what I have gotten for this is a way of running the system from within a loaded program without having to rewrite the ccp, or set-up LPBs, FCBs, or DMAs. The submit function works, and since warmboot is side-stepped (what potential havock is this leading to?), loads and exits are much faster. I have been able to compile, link, reloc, and load a test file all in one background submit function, hit ^C and pop back into the source code. The debugger will not load. It aborts with an address error, but a ^C takes back me to the source code from that error also. Since STAT must reset the login vector to get the Disk parameter block, file operations may not go as planned there needs to be a return login vector befor entering the CCP and a replace original before calling another program. The difficulty here comes when you actually want to change the logged drive. It's easier just to load all files into the calling program with the disk specification explicitly stated and to call all background operations in the same way. Since STAT seems to be the only problem here, resetting the drives manually after calling STAT to check on a drive that is not the default seems a resonible alternative to a lot of extra testing in the code. For any interested programmers here is the code I now have: .globl _initv _initv: move.l $8c,$80 * set up trap #0 from trap #3 move.l $88,$84 * set up trap #1 from trap #2 move.l #_ccp,$90 * set up trap #4 move.l #hndlr,$88 * set new trap #2 handler rts hndlr: movem.l d1-d7/a0-a6,regs1 * handles calls to reset cmp.w #$0,d0 * request for warm boot? beq ccp * must have been from another program trap #1 * just goto ccp movem.l regs1,d1-d7/a0-a6 rte .globl _ccp .globl _fix _ccp: movem.l d0-d7/a1-a7,regs3 * access to ccp through trap #4 move.l usp,a0 * save USP for later return move.l a0,_usp move.l #bios_tr,$8c * set temporary trap #3 handler ccp: jsr $234a * address of _ccpmain on HSC board bra ccp: * loop forever (until ^C) _fix: move.l $80,$8c * reset the original trap #3 handler movem.l regs3,d0-d7/a1-a7 * gets out of disasterous mistakes move.l _usp,a0 * replace user stack pointer move.l a0,usp rte bios_tr: cmp #3,d0 * was it a conin request? beq conin trap #0 * no, process the request rte * return conin: trap #0 * get the character cmp #3,d0 * was it a ^C? beq _fix * yes, go back to calling program rte * no return from exception d0=requested char regs1: ds.l 14 * register storage for trap handler regs3: ds.l 15 * register storage for _ccp and _fix _usp: ds.l 1 * value of USP for _ccp and _fix