Mercurial > hg > Members > kono > nitros9-code
annotate lib/alib/jsr_cmd.as @ 3054:22ddd48b4ec2
level1 krn: Fix scheduler bug that only affected 6309
The original 6809 binary was correct, but it was disassembled
and interpreted wrongly, so that reassembly went wrong on 6309.
author | Tormod Volden <debian.tormod@gmail.com> |
---|---|
date | Sun, 25 Jan 2015 22:36:02 +0100 |
parents | 03f26e88b809 |
children |
rev | line source |
---|---|
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 | |
2782
aaba193af04f
Updated code to use lwasm/lwlink
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2474
diff
changeset
|
31 section .text |
2474 | 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 |