Mercurial > hg > Members > kono > os9 > sbc09
diff trace.c @ 22:10e33568b38a
clean up
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 09 Jul 2018 14:07:30 +0900 |
parents | 1925cfa982fe |
children | 5217f23f2f9e |
line wrap: on
line diff
--- a/trace.c Mon Jul 09 11:25:28 2018 +0900 +++ b/trace.c Mon Jul 09 14:07:30 2018 +0900 @@ -100,7 +100,7 @@ void setbreak(int adr,int count) ; -void nexti(void); +int nexti(void); void do_escape(void) { char s[80]; @@ -109,12 +109,12 @@ bpskip--; int lpc = paddr(pcreg,mmu); BPTR *prev = &breakpoint; - for(BPTR b = breakpoint; b ; b=b->next, prev=prev->next) { + for(BPTR b = breakpoint; b ; prev=&b->next, b=b->next ) { if (lpc==b->address) { if (b->count==-1) { // temporaly break point BPTR next = b->next; free(b); - prev->next = next; + *prev = next; goto restart0; } if (b->count) b->count--; @@ -191,11 +191,11 @@ if (s[1]) { int trskip = getarg(s+1,0); BPTR *prev = &breakpoint; - for(BPTR bp = breakpoint; bp ; bp = bp->next) { + for(BPTR bp = breakpoint; bp ; prev=&bp->next, bp = bp->next) { if (trskip-- == 0) { - BPTR next = b->next; + BPTR next = bp->next; free(bp); - prev->next = next; + *prev = next; break; } prev = &bp->next; @@ -348,49 +348,43 @@ bp->next = breakpoint; breakpoint = bp; bp->count = count; - if (s[1]) { - char *next; - bp->laddr = getarg(s+0,&next); - bp->address = paddr((bp->laddr,&next),mmu); - if (next[0]) { - bp->count = getarg(next,&next); - } - } else { - bp->laddr = pcreg; - bp->address = paddr(pcreg,mmu); - } + bp->laddr = adr; + bp->address = paddr(adr,mmu); } int nexti(void) { - int op1 = phymem[mem1(pcreg)]; +#ifdef USE_MMU + int op1 = *mem0(phymem,pcreg,mmu); + int op2 = *mem0(phymem,pcreg+1,mmu); +#else + int op1 = mem[pcreg]; + int op2 = mem[pcreg+1]; +#endif int ofs = 0; switch(op1) { case 0x17: // LBSR case 0xbd: // JSR extended - ofs=3; beak; + ofs=3; break; case 0x10: // page2 { - int op2 = phymem[mem1(pcreg+1)]; if (op2==0x3f) { // os9 system call - ofs=3; beak; + ofs=3; break; } } case 0x11: // page3 { - int op2 = phymem[mem1(pcreg+1)]; if (op2==0x3f) { // SWI3 - ofs=2; beak; + ofs=2; break; } } case 0x3f: // SWI - ofs=1; beak; + ofs=1; break; case 0x3c: // CWAI case 0x8d: // BSR case 0x9d: // JSR direct - ofs=2; beak; + ofs=2; break; case 0xad: // JSR index { - int op2 = phymem[mem1(pcreg+1)]; if (op2<0x80) ofs = 2; // 5bit ofs else switch (op2&0xf) { case 8: case 0xc: @@ -403,8 +397,8 @@ } break; } - if (ofs) setbreak(pc+ofs,-1); - retrun ofs; + if (ofs) setbreak(pcreg+ofs,-1); + return ofs; }