annotate 3rdparty/utils/boisy/send.asm @ 1163:5cbcbfd738ae

Added
author boisy
date Thu, 08 May 2003 20:50:59 +0000
parents 6641a883d6b0
children 0e08f0830fd8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1 ************************************************************
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
2 * Send - Sends a signal to a process
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
3 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
4 * By: Boisy G. Pitre
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
5 * Southern Station, Box 8455
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
6 * Hattiesburg, MS 39406-8455
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
7 * Internet: bgpitre@seabass.st.usm.edu
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
8 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
9 * Usage: Send [-signal] procID [...] [-signal] [procID] [...]
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
10 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
11 * Where signal# is a decimal number from 0-255 and procID is the
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
12 * process' ID number (obtainable by the PROCS command). The
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
13 * default signal is 0 if none is specified. Different signals
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
14 * can be sent to different processes on the same command line:
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
15 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
16 * Send -3 45 55 -1 12 4 -0 5 6
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
17 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
18 * ...sends signal 3 to processes 45 and 55, signal 1 to processes
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
19 * 12 and 4, and signal 0 to processes 5 and 6.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
20 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
21 * If a process cannot be killed for whatever reason, an error will
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
22 * be printed, and parsing of the line will continue.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
23 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
24 * Standard Signals:
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
25 * 0 - Kill (non-interceptable)
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
26 * 1 - Wake up a sleeping process
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
27 * 2 - Keyboard terminate
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
28 * 3 - Keyboard interrupt
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
29 * 4 - Window change
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
30 * 128-255 - User defined
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
31 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
32 * For a detailed explanation on signals, see the OS-9 Level II Operating
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
33 * System Manual's "Technical Reference" section, page 2-15.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
34 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
35
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
36 nam Send
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
37 ttl Signaler utility
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
38
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
39
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
40 ifp1
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
41 use defsfile
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
42 endc
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
43
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
44 mod Size,Name,Prgrm+Objct,Reent+1,Start,Finish
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
45
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
46 Name fcs /Send/
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
47 Ed fcb $02
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
48
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
49 XPlace rmb 1
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
50 Signal rmb 1 Holds current signal
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
51 stack rmb 200
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
52 params rmb 200
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
53 Finish equ .
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
54
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
55 Start decb Check for no params
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
56 beq Help If not, show help
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
57 clr Signal else clear signal (assume signal 0)
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
58
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
59 Parse lda ,x+ get char
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
60 cmpa #'- dash?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
61 beq GetSig yeah, get signal no
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
62 cmpa #$20 space?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
63 beq Parse yeah, get next char
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
64 cmpa #$0d eol?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
65 beq Done yeah, exit
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
66
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
67 KillIt leax -1,x backup on char.. must be a pid
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
68 bsr Str2Byte convert to byte
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
69 tfr b,a put B (pid) in A
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
70 ldb Signal load B with current signal
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
71 os9 F$Send and send it to the process
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
72 bcc Parse
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
73 os9 F$Perr else print the error
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
74 bra Parse and continue parsing
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
75
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
76 Done clrb clear, no error
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
77 Error os9 F$Exit exit
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
78
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
79 GetSig bsr Str2Byte convert to byte
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
80 stb Signal save the new signal
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
81 bra Parse and resume parsing
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
82
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
83 *******************************************
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
84 * Str2Byte - Converts an ASCII string to a single byte
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
85 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
86 * Entry: X - Address of first char in string
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
87 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
88 * Done: B - Converted byte
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
89 * X - Last number in string + 1
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
90 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
91
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
92 Str2Byte clrb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
93 cnvloop lda ,x+
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
94 cmpa #'9
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
95 bhi cnvdone
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
96 suba #'0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
97 blo cnvdone
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
98 pshs a
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
99 lda #10
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
100 mul
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
101 addb ,s+
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
102 bra cnvloop
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
103 cnvdone leax -1,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
104 rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
105
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
106 Help leax HelpMsg,pcr
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
107 lda #2
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
108 ldy #200
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
109 os9 I$WritLn
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
110 bcs Error
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
111 bra Done
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
112
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
113 HelpMsg fcc /Usage: Send [-signal] procID [...]/
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
114 fcb $0d
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
115
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
116 emod
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
117 Size equ *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
118 end