1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13:
14:
15: 16: 17: 18: 19:
20:
21: #include "cmdsvc.h"
22: #include "help.h"
23:
24: 25: 26:
27: EXPORT void printHelp( const HELP *help )
28: {
29: (*help->prfn)(help);
30: }
31:
32: 33: 34:
35: LOCAL void prSimpleHelp( const HELP *help )
36: {
37: DSP_S(help->msg);
38: }
39:
40: 41: 42:
43: LOCAL void prDumpHelp( const HELP *help )
44: {
45: const UB *p1 = help->msg;
46: const UB *p2;
47:
48: for (; *p1; p1++);
49: p2 = ++p1;
50: for (; *p2; p2++);
51: p2++;
52: DSP_F5(S,"Dump", S,help->msg,
53: S,"(D", S,p1, S,") [start_addr][,{end_addr|#data_cnt}] ");
54: DSP_F3(S,": Dump Memory in ", S,p2, CH,'\n');
55: }
56:
57: 58: 59:
60: LOCAL void prModifyHelp( const HELP *help )
61: {
62: const UB *p1 = help->msg;
63: const UB *p2;
64:
65: for (; *p1; p1++);
66: p2 = ++p1;
67: for (; *p2; p2++);
68: p2++;
69: DSP_F5(S,"Modify", S,help->msg,
70: S,"(M", S,p1, S,") [start_addr][,data].. ");
71: DSP_F3(S,": Modify Memory in ", S,p2, CH,'\n');
72: }
73:
74: 75: 76:
77: LOCAL void prFillHelp( const HELP *help )
78: {
79: const UB *p1 = help->msg;
80: const UB *p2;
81:
82: for (; *p1; p1++);
83: p2 = ++p1;
84: for (; *p2; p2++);
85: p2++;
86: DSP_F5(S,"Fill", S,help->msg,
87: S,"(F", S,p1, S,") start_addr,{end_addr|#data_cnt}[,data].. ");
88: DSP_F3(S,": Fill Memory in ", S,p2, CH,'\n');
89: }
90:
91: 92: 93:
94: LOCAL void prSearchHelp( const HELP *help )
95: {
96: const UB *p1 = help->msg;
97: const UB *p2;
98:
99: for (; *p1; p1++);
100: p2 = ++p1;
101: for (; *p2; p2++);
102: p2++;
103: DSP_F5(S,"Search", S,help->msg,
104: S,"(SC", S,p1,
105: S,") start_addr,{end_addr|#data_cnt},data[,data].. ");
106: DSP_F3(S,": Search Memory in ", S,p2, CH,'\n');
107: }
108:
109: 110: 111:
112: LOCAL void prInputHelp( const HELP *help )
113: {
114: const UB *p = help->msg;
115:
116: for (; *p; p++);
117: p++;
118: DSP_F5(S,"Input", S,help->msg, S,"(I", S,p, S,") port ");
119: DSP_F3(S,": Input ", S,help->msg, S," from I/O port\n");
120: }
121:
122: 123: 124:
125: LOCAL void prOutputHelp( const HELP *help )
126: {
127: const UB *p = help->msg;
128:
129: for (; *p; p++);
130: p++;
131: DSP_F5(S,"Output", S,help->msg, S,"(O", S,p, S,") port,data ");
132: DSP_F3(S,": Output ", S,help->msg, S," to I/O port\n");
133: }
134:
135: 136: 137:
138: LOCAL void prDiskHelp( const HELP *help )
139: {
140: const UB *devnm;
141: UW attr;
142: W i;
143:
144: DSP_S(help->msg);
145: DSP_S(" device :");
146: for ( i = 0;; ++i ) {
147: devnm = ( help == &helpBD )? bootDevice(i): diskList(i, &attr);
148: if ( devnm == NULL ) break;
149:
150:
151: if ( help == &helpWD && (attr & DA_RONLY) != 0 ) continue;
152: DSP_F2(CH,' ', S,devnm);
153: }
154: DSP_LF;
155: }
156:
157: 158: 159:
160: LOCAL void prWRomHelp( const HELP *help )
161: {
162: const MEMSEG *rom, *ram;
163: UW ram_top, sz;
164:
165: rom = MemArea(MSA_FROM, 1);
166: ram = MemArea(MSA_OS, 1);
167: if ( rom == NULL || ram == NULL ) {
168: DSP_S("Not Supported\n");
169: return;
170: }
171:
172: ram_top = (ram->top + FROM_SECSZ - 1) & ~(FROM_SECSZ - 1);
173: sz = rom->end - rom->top;
174: if ( sz > ram->end - ram_top ) sz = ram->end - ram_top;
175:
176: DSP_S(help->msg);
177: DSP_F5(S," rom_addr : 0x", 08X,rom->top,
178: S," - 0x", 08X,(rom->end-FROM_SECSZ), CH,'\n');
179: DSP_F5(S," data_ram_addr : 0x", 08X,ram_top,
180: S," - 0x", 08X,(ram->end-FROM_SECSZ), CH,'\n');
181: DSP_F5(S," block_count : 1 - ", D,(sz / FROM_SECSZ),
182: S," (1 block = ", D,(FROM_SECSZ / 1024), S,"KB)\n");
183: }
184:
185:
186:
187: EXPORT const HELP helpALL = { prSimpleHelp,
188: "--- Command List : \"? command\" for details ---\n"
189: "DumpByte/Half/Word(D/DB/DH/DW) ModifyByte/Half/Word(M/MB/MH/MW)\n"
190: "FillByte/Half/Word(F/FB/FH/FW) SearchByte/Half/Word(SC/SCB/SCH/SCW)\n"
191: "InputByte/Half/Word(IB/IH/IW) OutputByte/Half/Word(OB/OH/OW)\n"
192: "Compare(CMP) Move(MOV) Disassemble(DA) Register(R)\n"
193: "Go(G) Step(S) Next(N) BreakPoint(B) BreakClear(BC)\n"
194: "BackTrace(BTR) Kill(KILL) Load(LO)"
195: "\n"
196: "BootDisk(BD) ReadDisk(RD) WriteDisk(WD) InfoDisk(ID)\n"
197: "WriteROM(WROM) FlashLoad(FLLO) Exit(EX) Help(H/?)\n"
198: };
199:
200: EXPORT const HELP helpD = { prDumpHelp,
201: "\0\0Byte"
202: };
203:
204: EXPORT const HELP helpDB = { prDumpHelp,
205: "Byte\0B\0Byte"
206: };
207:
208: EXPORT const HELP helpDH = { prDumpHelp,
209: "Half\0H\0Half"
210: };
211:
212: EXPORT const HELP helpDW = { prDumpHelp,
213: "Word\0W\0Word"
214: };
215:
216: EXPORT const HELP helpM = { prModifyHelp,
217: "\0\0Byte"
218: };
219:
220: EXPORT const HELP helpMB = { prModifyHelp,
221: "Byte\0B\0Byte"
222: };
223:
224: EXPORT const HELP helpMH = { prModifyHelp,
225: "Half\0H\0Half"
226: };
227:
228: EXPORT const HELP helpMW = { prModifyHelp,
229: "Word\0W\0Word"
230: };
231:
232: EXPORT const HELP helpF = { prFillHelp,
233: "\0\0Byte"
234: };
235:
236: EXPORT const HELP helpFB = { prFillHelp,
237: "Byte\0B\0Byte"
238: };
239:
240: EXPORT const HELP helpFH = { prFillHelp,
241: "Half\0H\0Half"
242: };
243:
244: EXPORT const HELP helpFW = { prFillHelp,
245: "Word\0W\0Word"
246: };
247:
248: EXPORT const HELP helpSC = { prSearchHelp,
249: "\0\0Byte"
250: };
251:
252: EXPORT const HELP helpSCB = { prSearchHelp,
253: "Byte\0B\0Byte"
254: };
255:
256: EXPORT const HELP helpSCH = { prSearchHelp,
257: "Half\0H\0Half"
258: };
259:
260: EXPORT const HELP helpSCW = { prSearchHelp,
261: "Word\0W\0Word"
262: };
263:
264: EXPORT const HELP helpCMP = { prSimpleHelp,
265: "Compare(CMP) start_addr,{end_addr|#byte_cnt},compare_addr : "
266: "Compare Memory\n"
267: };
268:
269: EXPORT const HELP helpMOV = { prSimpleHelp,
270: "Move(MOV) start_addr,{end_addr|#byte_cnt},dest_addr : Move Memory\n"
271: };
272:
273: EXPORT const HELP helpIB = { prInputHelp,
274: "Byte\0B"
275: };
276:
277: EXPORT const HELP helpIH = { prInputHelp,
278: "Half\0H"
279: };
280:
281: EXPORT const HELP helpIW = { prInputHelp,
282: "Word\0W"
283: };
284:
285: EXPORT const HELP helpOB = { prOutputHelp,
286: "Byte\0B"
287: };
288:
289: EXPORT const HELP helpOH = { prOutputHelp,
290: "Half\0H"
291: };
292:
293: EXPORT const HELP helpOW = { prOutputHelp,
294: "Word\0W"
295: };
296:
297: EXPORT const HELP helpDA = { prSimpleHelp,
298: "Disassemble(DA) [start_addr][,step_cnt] : Disassemble\n"
299: " Not Supported\n"
300: };
301:
302: EXPORT const HELP helpR = { prSimpleHelp,
303: "Register(R) [register_name[,data]] : Register Dump / Modify\n"
304: };
305:
306: EXPORT const HELP helpG = { prSimpleHelp,
307: "Go(G) [start_addr][,break_addr] : Go Program\n"
308: };
309:
310: EXPORT const HELP helpB = { prSimpleHelp,
311: "BreakPoint(B) [break_addr[,break_attr][,\"command\"]] : Set Break Point\n"
312: " break_attr : S\n"
313: };
314:
315: EXPORT const HELP helpBC = { prSimpleHelp,
316: "BreakClear(BC) [break_addr][,break_addr].. : Clear Break Point\n"
317: };
318:
319: EXPORT const HELP helpS = { prSimpleHelp,
320: "Step(S) [start_addr][,step_cnt] : Step Trace Program\n"
321: };
322:
323: EXPORT const HELP helpN = { prSimpleHelp,
324: "Next(N) [start_addr][,step_cnt] : Next Trace Program\n"
325: };
326:
327: EXPORT const HELP helpBTR = { prSimpleHelp,
328: "BackTrace(BTR) [frame_pointer] : Display Backtrace\n"
329: " Not Supported\n"
330: };
331:
332: EXPORT const HELP helpLO = { prSimpleHelp,
333: "Load(LO) {S|XS|XM} [,load addr] : Load Program / Data\n"
334: " S : Load s-format data (no protocol)\n"
335: " XM : Load memory image (XMODEM protocol)\n"
336: " XS : Load s-format data (XMODEM protocol)\n"
337: };
338:
339: EXPORT const HELP helpRD = { prDiskHelp,
340: "ReadDisk(RD) device, start_block, nblocks, mem_addr : Read Disk Blocks\n"
341: };
342:
343: EXPORT const HELP helpWD = { prDiskHelp,
344: "WriteDisk(WD) device, start_block, nblocks, mem_addr : Write Disk Blocks\n"
345: };
346:
347: EXPORT const HELP helpID = { prDiskHelp,
348: "InfoDisk(ID) device : Display Disk Information\n"
349: };
350:
351: EXPORT const HELP helpBD = { prDiskHelp,
352: "BootDisk(BD) [device] : Boot from Disk\n"
353: };
354:
355: EXPORT const HELP helpKILL = { prSimpleHelp,
356: "Kill : Kill Process and Continue\n"
357: };
358:
359: EXPORT const HELP helpH = { prSimpleHelp,
360: "Help(H/?) [command_name] : Help Message\n"
361: };
362:
363: EXPORT const HELP helpEX = { prSimpleHelp,
364: "Exit(EX) [0] : System Power Off\n"
365: "Exit(EX) -1 : System Reset (Restart)\n"
366: };
367:
368: EXPORT const HELP helpWROM = { prWRomHelp,
369: "WriteROM(WROM) rom_addr, data_ram_addr, block_count : "
370: "Write Flash ROM blocks\n"
371: };
372:
373: EXPORT const HELP helpFLLO = { prSimpleHelp,
374: "FlashLoad(FLLO) [attr] : Load S-Format Data & Write Flash ROM\n"
375: " attr: X Use XMODEM protocol\n"
376: " E Fill write blocks with 0xFF\n"
377: " Default : Overwrite original Flash ROM Image\n"
378: };
379:
380:
381:
382: 383: 384:
385: EXPORT void dispTitle( void )
386: {
387: const char **p;
388:
389: DSP_S("\n\n");
390: for ( p = Title; *p != NULL; p++ ) DSP_S(*p);
391: DSP_S("\n\n");
392: }