.title Suspend and Resume routines ; DECUS C Calling Format ; ; jsr r5,csv$ ;save r2,r3, and r4 ; ;r5 is parameter base ; ;c$pmtr(r5) is first argument ; ;c$pmtr+2(r5) is second argument ; ;... ; ;return args in r0 ; ... ; user code ; ... ; ; jmp cret$ ;restore r2-r5 and return ; rts pc ;does the same (cret$ follows csv$) ; ; csv$ and cret$ need be used only if arguments are used ; .mcall .spnd .rsum .mcall .ttyout .psect c$code suspnd:: jsr r5,csv$ mov c$pmtr(r5),r0 ;tick value ? bgt 2$ ;plus - use it beq 1$ ;zero - use default mov #2,re.spnd ;minus - resume 1$: mov #30.,r0 ;default to .50 seconds 2$: mov r0,waittm ;set wait time tst re.spnd ;are we resumed ? bgt 3$ ;yes - don't suspend mov #cmkt,r0 ;.cmkt, clear any pending .mrkt emt 375 mov #mrkt,r0 ;.mrkt emt 375 .spnd ;suspend until resumed 3$: dec re.spnd ;update resume/suspend counter bge 4$ clr re.spnd 4$: rts pc ; ; Used by various macro functions to terminate a suspension. ; ; slunio ; endrvr ; cldrvr ; svdrvr ; termio ; resume:: tst re.spnd ;resume ? bgt 1$ ;already done .rsum ;resume inc re.spnd 1$: rts pc .psect c$data re.spnd:.word 0 ;resume/suspend counter cmkt: .byte 0,23 ;.cmkt .word 1 ;id = 1 .word 0 mrkt: .byte 0,22 ;.mrkt .word 1$ ;time .word resume ;completion routine .word 1 ;id = 1 1$: .word 0 waittm: .word 30. ;.50 second timeout .end