*/
void dspregister();
-
/**
* @brief CASL IIのオブジェクトファイルを逆アセンブルし、標準出力へ出力する
*
*/
bool disassemble_file(const char *file);
+/**
+ * @brief COMET IIデバッガーを起動する
+ *
+ * @return なし
+ */
+void debugger();
+
#endif /* YACASL2_EXEC_INCLUDEDの終端 */
COMMONOBJ := word cmem cerr
CASL2OBJ := struct hash
ASOBJ := assemble token label
-EXECOBJ := exec dump
+EXECOBJ := exec dump debugger
# ヘッダファイル
INCLUDEDIR := ../include
--- /dev/null
+#include "exec.h"
+
+void debugger()
+{
+ char *buf = malloc_chk(DBINSIZE + 1, "debugger.buf");
+ for( ; ;) {
+ fprintf(stdout, "COMET II (Type ? for help) > ");
+ fgets(buf, DBINSIZE, stdin);
+ if(*buf == '\0' || *buf == 's') {
+ break;
+ } else if(*buf == 'c') {
+ execmode.debugger = false;
+ break;
+ } else if(*buf == 't') {
+ fprintf(stdout, "#%04X: Register::::\n", sys->cpu->pr);
+ dspregister();
+ } else if(*buf == 'd') {
+ dumpmemory();
+ } else if(*buf == '?') {
+ fprintf(stdout, "s (default) -- Step by step running your program until next interaction.\n");
+ fprintf(stdout, "c -- Continue running your program.\n");
+ fprintf(stdout, "t -- Display CPU register.\n");
+ fprintf(stdout, "d -- Display memory dump.\n");
+ break;
+ }
+ }
+}
return str;
}
-void debugger()
-{
- char *buf = malloc_chk(DBINSIZE + 1, "debugger.buf");
- for( ; ;) {
- fprintf(stdout, "COMET II (Type ? for help) > ");
- fgets(buf, DBINSIZE, stdin);
- if(*buf == 'r') {
- execmode.debugger = false;
- break;
- } else if(*buf == 's') {
- break;
- } else if(*buf == 't') {
- fprintf(stdout, "#%04X: Register::::\n", sys->cpu->pr);
- dspregister();
- } else if(*buf == 'd') {
- dumpmemory();
- } else if(*buf == '?') {
- fprintf(stdout, "r -- Continue running your program.\n");
- fprintf(stdout, "s -- Continue running your program until next interaction.\n");
- fprintf(stdout, "t -- Display CPU register.\n");
- fprintf(stdout, "d -- Display memory dump.\n");
- break;
- }
- }
-}
-
void exec()
{
clock_t clock_begin, clock_end;
str++;
if(*str == '-' || strlen(str) > 4) {
setcerr(116, str-1); /* out of hex range */
- return 0;
+ return 0x0;
}
/* WORD値に変換 */
w = (WORD)strtol(str, &check, 16);