************************* * Terminate HippoPlayer * ************************* * If HippoPlayer's port exists, send there a message telling HiP to terminate. * Can be assembled with Asm-One and Devpac. * v1.1 - Is pure and can be run from WB incdir include: include exec/exec_lib.i include exec/ports.i include libraries/dosextens.i rsreset hport rs.b MP_SIZE hmessage rs.b MN_SIZE hkill rs.l 1 hsizeof rs.b 0 moveq #hsizeof/2-1,d0 cl clr -(sp) dbf d0,cl move.l sp,a5 move.l #"KILL",hkill(a5) * Killer-message move.l 4.w,a6 sub.l a1,a1 jsr _LVOFindTask(a6) move.l d0,a4 moveq #0,d5 tst.l pr_CLI(a4) bne.b hcli lea pr_MsgPort(a4),a0 jsr _LVOWaitPort(a6) lea pr_MsgPort(a4),a0 jsr _LVOGetMsg(a5) move.l d0,d5 hcli jsr _LVOForbid(a6) lea hportname(pc),a1 jsr _LVOFindPort(a6) move.l d0,d2 tst.l d2 beq.b hnomsg0 move.l d2,a3 bsr.b hcreateport lea hmessage(a5),a1 NEWLIST a1 move.l a3,a0 pea hport(a5) move.l (sp)+,MN_REPLYPORT(a1) jsr _LVOPutMsg(a6) jsr _LVOPermit(a6) lea hport(a5),a0 jsr _LVOWaitPort(a6) * Returns when HiP is terminated. bsr.b hdeleteport hnomsg0 tst.l d5 beq.b hnomsg jsr _LVOForbid(a6) move.l d5,a1 jsr _LVOReplyMsg(a5) hnomsg lea hsizeof(sp),sp moveq #0,d0 rts hcreateport lea hport(a5),a2 moveq #-1,d0 jsr _LVOAllocSignal(a6) move.b d0,MP_SIGBIT(a2) move.l a4,MP_SIGTASK(a2) move.b #NT_MSGPORT,LN_TYPE(a2) clr.b MP_FLAGS(a2) move.l a2,a1 jmp _LVOAddPort(a6) hdeleteport lea hport(a5),a2 move.l a2,a1 jsr _LVORemPort(a6) moveq #0,d0 move.b MP_SIGBIT(a2),d0 jmp _LVOFreeSignal(a6) hportname dc.b "HiP-Port",0