mirror of
https://github.com/byteworksinc/ORCALib.git
synced 2024-09-27 20:56:05 +00:00
Add cleanup code for CDev calls.
The new CDev root code generated by ORCA/C will now branch to this code after each CDev call, giving it an opportunity to clean up if necessary. Specifically, it will dispose of the user ID allocated for the CDev if it is going away after this call. There are several cases where this occurs, which need to be detected based on the message code passed to the CDev and in some cases other factors.
This commit is contained in:
parent
b81b4e1109
commit
73ed0778f2
54
cc.asm
54
cc.asm
@ -375,6 +375,60 @@ start ds 2 start of the command line string
|
|||||||
targv ds 4
|
targv ds 4
|
||||||
end
|
end
|
||||||
|
|
||||||
|
****************************************************************
|
||||||
|
*
|
||||||
|
* ~CDevCleanup - cleanup code run after a CDev call
|
||||||
|
*
|
||||||
|
* Inputs:
|
||||||
|
* A+X - CDev result value
|
||||||
|
* 1,S - Original data bank to restore
|
||||||
|
* 2,S - Return address
|
||||||
|
* 5,S - Message code passed to CDev
|
||||||
|
* 7,S - Old user ID from before the call (0 if none)
|
||||||
|
*
|
||||||
|
* Notes:
|
||||||
|
* This routine handles cases where the CDev is going
|
||||||
|
* away and so the user ID allocated for it needs to be
|
||||||
|
* disposed of to avoid being leaked.
|
||||||
|
*
|
||||||
|
****************************************************************
|
||||||
|
*
|
||||||
|
~CDevCleanup start
|
||||||
|
MachineCDEV equ 1
|
||||||
|
BootCDEV equ 2
|
||||||
|
CloseCDEV equ 5
|
||||||
|
AboutCDEV equ 8
|
||||||
|
|
||||||
|
tay stash low word of result
|
||||||
|
|
||||||
|
lda 5,s if message == CloseCDEV
|
||||||
|
cmp #CloseCDEV
|
||||||
|
beq cleanup
|
||||||
|
cmp #BootCDEV or message == BootCDEV
|
||||||
|
beq cleanup
|
||||||
|
cmp #AboutCDEV or message == AboutCDEV
|
||||||
|
bne lb1
|
||||||
|
lda 7,s and original user ID was 0
|
||||||
|
beq cleanup (i.e. CDev window was not open)
|
||||||
|
bra ret
|
||||||
|
lb1 cmp #MachineCDEV or message == MachineCDEV
|
||||||
|
bne ret
|
||||||
|
tya and return value is 0
|
||||||
|
bne ret
|
||||||
|
txa
|
||||||
|
bne ret
|
||||||
|
|
||||||
|
cleanup pea 0 ...then dispose of user ID
|
||||||
|
jsl >~DAID
|
||||||
|
|
||||||
|
ret tya store return value in result space
|
||||||
|
sta 5,s
|
||||||
|
txa
|
||||||
|
sta 7,s
|
||||||
|
plb restore data bank
|
||||||
|
rtl return to original caller
|
||||||
|
end
|
||||||
|
|
||||||
****************************************************************
|
****************************************************************
|
||||||
*
|
*
|
||||||
* ~CUMul2 - unsigned multiply
|
* ~CUMul2 - unsigned multiply
|
||||||
|
Loading…
Reference in New Issue
Block a user