2474
|
1 ***************************************
|
|
2
|
|
3 * Subroutine to jsr to subroutine from 1 character command table
|
|
4
|
|
5 * OTHER MODULES NEEDED: none
|
|
6
|
|
7 * ENTRY: A=1 char command
|
|
8 * X=start of jump table
|
|
9
|
|
10 * EXIT: CC carry set if entry not found
|
|
11 * all other regs can be modified by subs
|
|
12
|
|
13 * Note format of table: each entry is three bytes
|
|
14 * 0-match character (command)
|
|
15 * 1..2-offset to routine
|
|
16
|
|
17 * It is the user's job to set commands to proper case for matching...
|
|
18
|
|
19 * end of table=NULL
|
|
20
|
|
21 * sample table: fcc /A/
|
|
22 * fdb routineA-*
|
|
23 * fcc /B/
|
|
24 * fdb routineB-*
|
|
25 * fcb 0
|
|
26
|
|
27
|
|
28 nam Jsr to 1 char Command
|
|
29 ttl Assembler Library Module
|
|
30
|
|
31 psect JSR_CMD,0,0,0,0,0
|
|
32
|
|
33 JSR_CMD:
|
|
34 tst ,x end of table?
|
|
35 beq jsrerr
|
|
36
|
|
37 cmpa ,x+ found match?
|
|
38 beq docmd yes, go do it
|
|
39
|
|
40 leax 2,x next entry
|
|
41 bra JSR_CMD
|
|
42
|
|
43 * no match found, return with carry set
|
|
44
|
|
45 jsrerr
|
|
46 coma set error flag
|
|
47 rts
|
|
48
|
|
49 * command found, do call and return
|
|
50
|
|
51 docmd
|
|
52 ldd ,x get offset to routine
|
|
53 jsr d,x
|
|
54 andcc #%11111110 clear carry
|
|
55 rts
|
|
56
|
|
57 endsect
|