391 |
|
d 100 |
392 |
|
|
393 |
|
|
394 |
+ |
Using cxmon in your own programs |
395 |
+ |
-------------------------------- |
396 |
+ |
|
397 |
+ |
cxmon provides a simple interface for integration in other programs. It can, |
398 |
+ |
for example, be used as a monitor/debugger for an emulator (it is used in |
399 |
+ |
Basilisk II in this way). |
400 |
+ |
|
401 |
+ |
Here's how to do it (all functions are defined in the mon.h header file): |
402 |
+ |
|
403 |
+ |
1. Link all the cxmon object files, except main.o, to your program. |
404 |
+ |
2. In your program, call mon_init() before using any other cxmon functions. |
405 |
+ |
3. After calling mon_init(), set the mon_read_byte and mon_write_byte |
406 |
+ |
function pointers to the routines used for accessing memory. |
407 |
+ |
4. You can use mon_add_command() to add new commands to cxmon by specifying |
408 |
+ |
the command name, function and help text. From within your command |
409 |
+ |
function, you can use mon_get_token() and mon_expression() to parse the |
410 |
+ |
arguments and the mon_read/write_*() functions to access memory. |
411 |
+ |
5. To enter cxmon, call the mon() function like this: |
412 |
+ |
|
413 |
+ |
char *args[3] = {"mon", "-r", NULL}; |
414 |
+ |
mon(2, args); |
415 |
+ |
|
416 |
+ |
6. If you're done with cxmon, call mon_exit(). |
417 |
+ |
|
418 |
+ |
|
419 |
|
History |
420 |
|
------- |
421 |
|
|