/* * EIT processing * * return value 0 : monitor should keep on running * 1 : return from the interrupt handler */ EXPORT W procEIT( UW vec ) { const VECINFO *vp; UW pc, cpsr; W i; pc = getCurPCX(); cpsr = getCurCPSR(); /* machine-dependent interrupt processing */ i = procHwInt(vec); if ( i == 2 ) return 1; /* exit from the interrupt handler immediately */ if ( i == 0 ) { /* other EIT processing */ for ( i = 1; i < N_VECINFO; ++i ) { if ( vec < VecInfoTable[i].vec ) break; } vp = &VecInfoTable[i-1]; i = (*vp->func)(vp, vec, pc, cpsr); if ( i > 0 ) { /* PC is adjusted to the previous instruction's address */ pc -= ( (cpsr & PSR_T) != 0 )? 2: 4; } } DSP_F5(S,"\nPC: ", 08X,pc, S," CPSR: ", 08X,cpsr, CH,'\n'); return 0; }
/* * display help message for output command */ LOCAL void prOutputHelp( const HELP *help ) { const UB *p = help->msg; for (; *p; p++); p++; DSP_F5(S,"Output", S,help->msg, S,"(O", S,p, S,") port,data "); DSP_F3(S,": Output ", S,help->msg, S," to I/O port\n"); }
/* * display help message for input command */ LOCAL void prInputHelp( const HELP *help ) { const UB *p = help->msg; for (; *p; p++); p++; DSP_F5(S,"Input", S,help->msg, S,"(I", S,p, S,") port "); DSP_F3(S,": Input ", S,help->msg, S," from I/O port\n"); }
/* * display help message for fill command */ LOCAL void prFillHelp( const HELP *help ) { const UB *p1 = help->msg; const UB *p2; for (; *p1; p1++); p2 = ++p1; for (; *p2; p2++); p2++; DSP_F5(S,"Fill", S,help->msg, S,"(F", S,p1, S,") start_addr,{end_addr|#data_cnt}[,data].. "); DSP_F3(S,": Fill Memory in ", S,p2, CH,'\n'); }
/* * display help message for modify command */ LOCAL void prModifyHelp( const HELP *help ) { const UB *p1 = help->msg; const UB *p2; for (; *p1; p1++); p2 = ++p1; for (; *p2; p2++); p2++; DSP_F5(S,"Modify", S,help->msg, S,"(M", S,p1, S,") [start_addr][,data].. "); DSP_F3(S,": Modify Memory in ", S,p2, CH,'\n'); }
/* * display help message for dump command */ LOCAL void prDumpHelp( const HELP *help ) { const UB *p1 = help->msg; const UB *p2; for (; *p1; p1++); p2 = ++p1; for (; *p2; p2++); p2++; DSP_F5(S,"Dump", S,help->msg, S,"(D", S,p1, S,") [start_addr][,{end_addr|#data_cnt}] "); DSP_F3(S,": Dump Memory in ", S,p2, CH,'\n'); }
/* loading processing */ EXPORT ER doLoading(W proto, UW addr, UW *range) { ER er; e_addr = s_addr = addr; // load address if (range) { // range specification loaddr = range[0]; // address lower limit hiaddr = range[1]; // address upper limit offset = range[2]; // address offset } else { loaddr = 0; // address lower limit hiaddr = 0xFFFFFFFF; // address upper limit offset = 0; // address offset } if (proto & P_XMODEM) { // XMODEM readFn = (FUNCP)xmodemRead; blkptr = blkno = blksz = 0; } else { // no protocol readFn = (FUNCP)textRead; } if (proto & P_SFORM) { // S format er = loadSform(); if (er == E_END) er = E_LOAD; } else { // memory image er = loadImage(); } // read termination processing if (proto & P_XMODEM) xmodemEnd(er); // wait until there is no more data purgeInput(); if (er == E_END) er = E_OK; DSP_LF; if (er == E_OK) { e_addr--; if (range) { range[0] = s_addr; // load address range[1] = e_addr; s_addr -= offset; e_addr -= offset; } DSP_F5(S,"Loaded: ", 08X,s_addr, S," -> ", 08X,e_addr, CH,'\n'); } return er; }
/* * display help message for search command */ LOCAL void prSearchHelp( const HELP *help ) { const UB *p1 = help->msg; const UB *p2; for (; *p1; p1++); p2 = ++p1; for (; *p2; p2++); p2++; DSP_F5(S,"Search", S,help->msg, S,"(SC", S,p1, S,") start_addr,{end_addr|#data_cnt},data[,data].. "); DSP_F3(S,": Search Memory in ", S,p2, CH,'\n'); }
/* * display help message for WROM command */ LOCAL void prWRomHelp( const HELP *help ) { const MEMSEG *rom, *ram; UW ram_top, sz; rom = MemArea(MSA_FROM, 1); ram = MemArea(MSA_OS, 1); if ( rom == NULL || ram == NULL ) { DSP_S("Not Supported\n"); return; } ram_top = (ram->top + FROM_SECSZ - 1) & ~(FROM_SECSZ - 1); sz = rom->end - rom->top; if ( sz > ram->end - ram_top ) sz = ram->end - ram_top; DSP_S(help->msg); DSP_F5(S," rom_addr : 0x", 08X,rom->top, S," - 0x", 08X,(rom->end-FROM_SECSZ), CH,'\n'); DSP_F5(S," data_ram_addr : 0x", 08X,ram_top, S," - 0x", 08X,(ram->end-FROM_SECSZ), CH,'\n'); DSP_F5(S," block_count : 1 - ", D,(sz / FROM_SECSZ), S," (1 block = ", D,(FROM_SECSZ / 1024), S,"KB)\n"); }
/* display message */ LOCAL W vf_msg( const VECINFO *vi, UW vec, UW pc, UW cpsr ) { B *msg = vi->msg; B opt; if ( msg == NULL ) return 0; /* if the first byte of the message is not a letter, treat it as option. * opt = 0 - 037 (the code prior to ' ' ) * \020 PC is adjusted to the previous instruction's address */ opt = 0; if ( *msg < ' ' ) opt = *msg++; DSP_F5(S,"Exception ", D,vec, S," (", S,msg, CH,')'); return ( opt & 020 )? 1: 0; }