Mercurial > hg > Members > kono > nitros9-code
comparison lib/alib/jsr_cmd2.a @ 2474:7d70b7e1cb21
Moved net and alib files into here
author | boisy |
---|---|
date | Tue, 30 Mar 2010 02:44:42 +0000 |
parents | |
children | aaba193af04f |
comparison
equal
deleted
inserted
replaced
2473:dac1ff96637f | 2474:7d70b7e1cb21 |
---|---|
1 *************************************** | |
2 | |
3 * Subroutine to jsr to subroutine from 2 character command table | |
4 | |
5 * OTHER MODULES NEEDED: none | |
6 | |
7 * ENTRY: D=2 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 * D and X always modified | |
13 | |
14 * Note format of table: each entry is four bytes | |
15 * 0..1-match characters (command) | |
16 * 2..3-offset to routine | |
17 | |
18 * It is the user's job to set commands to proper case for matching... | |
19 | |
20 * end of table=NULL | |
21 | |
22 * sample table: fcc /A1/ | |
23 * fdb routineA-* | |
24 * fcc /B1/ | |
25 * fdb routineB-* | |
26 * fcb 0 | |
27 | |
28 | |
29 nam Jsr to 2 char Command | |
30 ttl Assembler Library Module | |
31 | |
32 psect JSR_CMD2,0,0,0,0,0 | |
33 | |
34 JSR_CMD2: | |
35 tst ,x end of table? | |
36 beq jsrerr | |
37 | |
38 cmpd ,x++ found match? | |
39 beq docmd yes, go do it | |
40 | |
41 leax 2,x next entry | |
42 bra JSR_CMD2 | |
43 | |
44 * no match found, return with carry set | |
45 | |
46 jsrerr | |
47 coma set error flag | |
48 rts | |
49 | |
50 * command found, do call and return | |
51 | |
52 docmd | |
53 ldd ,x get offset to routine | |
54 jsr d,x | |
55 andcc #%11111110 clear carry | |
56 rts | |
57 | |
58 endsect |