From 188a7120d39effe562e5e9beb75757eac528cd83 Mon Sep 17 00:00:00 2001 From: Mats Engstrom Date: Wed, 22 Apr 2020 00:19:37 +0200 Subject: [PATCH] Change Go/Trace to only support cnt as parameter --- .github/workflows/ccpp.yml | 2 +- Makefile | 116 +++++++++++++++++++++---------------- bus.h | 1 + frontpanel-kc8m.c | 35 +++++------ main.c | 4 ++ 5 files changed, 89 insertions(+), 69 deletions(-) diff --git a/.github/workflows/ccpp.yml b/.github/workflows/ccpp.yml index d305aa9..08bfb3b 100644 --- a/.github/workflows/ccpp.yml +++ b/.github/workflows/ccpp.yml @@ -13,7 +13,7 @@ jobs: runs-on: ubuntu-latest - timeout-minutes: 10 + timeout-minutes: 20 steps: - uses: actions/checkout@v2 diff --git a/Makefile b/Makefile index 2c03208..1bd5318 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ -all: clean pdp8emu +all: pdp8emu -.PHONY: docker tools clean distclean +.PHONY: docker tools cores clean distclean # # KK8E with debug support -- the above hardware with an added trace package @@ -79,108 +79,108 @@ docker: # Run some MAINDEC diags to see if it works correctly -check: pdp8emu - ./tools/pt8exam -w tests/D0AB-InstTest-1.pt +check: pdp8emu cores ./pdp8emu tests/D0AB-InstTest-1.pt.core 2>D0AB.2.tmp | tee D0AB.1.tmp & @sleep 1 - @printf "m0120,0261\n" | nc -w 1 -u 127.0.0.1 2288 - @printf "s7777s\n" | nc -w 1 -u 127.0.0.1 2288 - @printf "g200\n" | nc -w 1 -u 127.0.0.1 2288 - @printf "g\n" | nc -w 1 -u 127.0.0.1 2288 + @printf "m0120,0261\n" | nc -w 1 -u 127.0.0.1 2288 + @printf "s7777s\n" | nc -w 1 -u 127.0.0.1 2288 + @printf "s200pc\n" | nc -w 1 -u 127.0.0.1 2288 + @printf "g\n" | nc -w 1 -u 127.0.0.1 2288 + @printf "g\n" | nc -w 1 -u 127.0.0.1 2288 @sleep 20 - @printf "\03\03\03\03\03" | nc -w 1 -u 127.0.0.1 2288 - @printf "q\n" | nc -w 1 -u 127.0.0.1 2288 + @printf "\03\03\03\03\03" | nc -w 1 -u 127.0.0.1 2288 + @printf "q\n" | nc -w 1 -u 127.0.0.1 2288 @if [ "$$(grep -ao '1' D0AB.1.tmp | wc -l)" -lt "5" ]; then false; fi - ./tools/pt8exam -w tests/D0BB-InstTest-2.pt ./pdp8emu tests/D0BB-InstTest-2.pt.core 2>D0BB.2.tmp | tee D0BB.1.tmp & @sleep 1 - @printf "m3751,0262\n" | nc -w 1 -u 127.0.0.1 2288 - @printf "g0200\n" | nc -w 1 -u 127.0.0.1 2288 + @printf "m3751,0262\n" | nc -w 1 -u 127.0.0.1 2288 + @printf "s200pc\n" | nc -w 1 -u 127.0.0.1 2288 + @printf "g\n" | nc -w 1 -u 127.0.0.1 2288 @sleep 20 - @printf "\03\03\03\03\03" | nc -w 1 -u 127.0.0.1 2288 - @printf "q\n" | nc -w 1 -u 127.0.0.1 2288 + @printf "\03\03\03\03\03" | nc -w 1 -u 127.0.0.1 2288 + @printf "q\n" | nc -w 1 -u 127.0.0.1 2288 @if [ "$$(grep -ao '2' D0BB.1.tmp | wc -l)" -lt "5" ]; then false; fi - ./tools/pt8exam -w tests/D0CC-AddTest.pt ./pdp8emu tests/D0CC-AddTest.pt.core 2>D0CC.2.tmp | tee D0CC.1.tmp & @sleep 1 - @printf "g0200\n" | nc -w 1 -u 127.0.0.1 2288 + @printf "s200pc\n" | nc -w 1 -u 127.0.0.1 2288 + @printf "g\n" | nc -w 1 -u 127.0.0.1 2288 @sleep 320 - @printf "\03\03\03\03\03" | nc -w 1 -u 127.0.0.1 2288 - @printf "q\n" | nc -w 1 -u 127.0.0.1 2288 + @printf "\03\03\03\03\03" | nc -w 1 -u 127.0.0.1 2288 + @printf "q\n" | nc -w 1 -u 127.0.0.1 2288 @if [ "$$(grep -ao 'RANDOM' D0CC.1.tmp | wc -l)" -lt "1" ]; then false; fi - ./tools/pt8exam -w tests/D0DB-RandomAND.pt ./pdp8emu tests/D0DB-RandomAND.pt.core 2>D0DB.2.tmp | tee D0DB.1.tmp & @sleep 1 - @printf "g0200\n" | nc -w 1 -u 127.0.0.1 2288 + @printf "s200pc\n" | nc -w 1 -u 127.0.0.1 2288 + @printf "g\n" | nc -w 1 -u 127.0.0.1 2288 @sleep 20 - @printf "\03\03\03\03\03" | nc -w 1 -u 127.0.0.1 2288 - @printf "q\n" | nc -w 1 -u 127.0.0.1 2288 + @printf "\03\03\03\03\03" | nc -w 1 -u 127.0.0.1 2288 + @printf "q\n" | nc -w 1 -u 127.0.0.1 2288 @if [ "$$(grep -ao 'A' D0DB.1.tmp | wc -l)" -lt "5" ]; then false; fi - ./tools/pt8exam -w tests/D0EB-Random-TAD.pt ./pdp8emu tests/D0EB-Random-TAD.pt.core 2>D0EB.2.tmp | tee D0EB.1.tmp & @sleep 1 - @printf "g0200\n" | nc -w 1 -u 127.0.0.1 2288 + @printf "s200pc\n" | nc -w 1 -u 127.0.0.1 2288 + @printf "g\n" | nc -w 1 -u 127.0.0.1 2288 @sleep 20 - @printf "\03\03\03\03\03" | nc -w 1 -u 127.0.0.1 2288 - @printf "q\n" | nc -w 1 -u 127.0.0.1 2288 + @printf "\03\03\03\03\03" | nc -w 1 -u 127.0.0.1 2288 + @printf "q\n" | nc -w 1 -u 127.0.0.1 2288 @if [ "$$(grep -ao 'T' D0EB.1.tmp | wc -l)" -lt "5" ]; then false; fi - ./tools/pt8exam -w tests/D0FC-Random-ISZ.pt ./pdp8emu tests/D0FC-Random-ISZ.pt.core 2>D0FC.2.tmp | tee D0FC.1.tmp& @sleep 1 - @printf "g0200\n" | nc -w 1 -u 127.0.0.1 2288 + @printf "s200pc\n" | nc -w 1 -u 127.0.0.1 2288 + @printf "g\n" | nc -w 1 -u 127.0.0.1 2288 @sleep 20 - @printf "\03\03\03\03\03" | nc -w 1 -u 127.0.0.1 2288 - @printf "q\n" | nc -w 1 -u 127.0.0.1 2288 + @printf "\03\03\03\03\03" | nc -w 1 -u 127.0.0.1 2288 + @printf "q\n" | nc -w 1 -u 127.0.0.1 2288 @if [ "$$(grep -ao 'FC' D0FC.1.tmp | wc -l)" -lt "5" ]; then false; fi - ./tools/pt8exam -w tests/D0GC-Random-DCA.pt ./pdp8emu tests/D0GC-Random-DCA.pt.core 2>D0GC.2.tmp | tee D0GC.1.tmp & @sleep 1 - @printf "m0013,0307\n" | nc -w 1 -u 127.0.0.1 2288 - @printf "g0200\n" | nc -w 1 -u 127.0.0.1 2288 + @printf "m0013,0307\n" | nc -w 1 -u 127.0.0.1 2288 + @printf "s200pc\n" | nc -w 1 -u 127.0.0.1 2288 + @printf "g\n" | nc -w 1 -u 127.0.0.1 2288 @sleep 320 - @printf "\03\03\03\03\03" | nc -w 1 -u 127.0.0.1 2288 - @printf "q\n" | nc -w 1 -u 127.0.0.1 2288 + @printf "\03\03\03\03\03" | nc -w 1 -u 127.0.0.1 2288 + @printf "q\n" | nc -w 1 -u 127.0.0.1 2288 @if [ "$$(grep -ao 'G' D0GC.1.tmp | wc -l)" -lt "5" ]; then false; fi - ./tools/pt8exam -w tests/D0HC-Random-JMP.pt ./pdp8emu tests/D0HC-Random-JMP.pt.core 2>D0HC.2.tmp | tee D0HC.1.tmp& @sleep 1 - @printf "g0200\n" | nc -w 1 -u 127.0.0.1 2288 + @printf "s200pc\n" | nc -w 1 -u 127.0.0.1 2288 + @printf "g\n" | nc -w 1 -u 127.0.0.1 2288 @sleep 20 - @printf "\03\03\03\03\03" | nc -w 1 -u 127.0.0.1 2288 - @printf "q\n" | nc -w 1 -u 127.0.0.1 2288 + @printf "\03\03\03\03\03" | nc -w 1 -u 127.0.0.1 2288 + @printf "q\n" | nc -w 1 -u 127.0.0.1 2288 @if [ "$$(grep -ao 'HC' D0HC.1.tmp | wc -l)" -lt "5" ]; then false; fi - ./tools/pt8exam -w tests/D0IB-JMPJMS.pt ./pdp8emu tests/D0IB-JMPJMS.pt.core 2>D0IB.2.tmp | tee D0IB.1.tmp & @sleep 1 - @printf "m3567,0311\n" | nc -w 1 -u 127.0.0.1 2288 - @printf "g0200\n" | nc -w 1 -u 127.0.0.1 2288 + @printf "m3567,0311\n" | nc -w 1 -u 127.0.0.1 2288 + @printf "s200pc\n" | nc -w 1 -u 127.0.0.1 2288 + @printf "g\n" | nc -w 1 -u 127.0.0.1 2288 @sleep 20 - @printf "\03\03\03\03\03" | nc -w 1 -u 127.0.0.1 2288 - @printf "q\n" | nc -w 1 -u 127.0.0.1 2288 + @printf "\03\03\03\03\03" | nc -w 1 -u 127.0.0.1 2288 + @printf "q\n" | nc -w 1 -u 127.0.0.1 2288 @if [ "$$(grep -ao 'I' D0IB.1.tmp | wc -l)" -lt "5" ]; then false; fi - ./tools/pt8exam -w tests/D0JB-JMPJMS-RANDOM.pt ./pdp8emu tests/D0JB-JMPJMS-RANDOM.pt.core 2>D0JB.2.tmp | tee D0JB.1.tmp & @sleep 1 - @printf "g0200\n" | nc -w 1 -u 127.0.0.1 2288 + @printf "s200pc\n" | nc -w 1 -u 127.0.0.1 2288 + @printf "g\n" | nc -w 1 -u 127.0.0.1 2288 @sleep 20 - @printf "\03\03\03\03\03" | nc -w 1 -u 127.0.0.1 2288 - @printf "q\n" | nc -w 1 -u 127.0.0.1 2288 + @printf "\03\03\03\03\03" | nc -w 1 -u 127.0.0.1 2288 + @printf "q\n" | nc -w 1 -u 127.0.0.1 2288 @if [ "$$(grep -ao 'JB' D0JB.1.tmp | wc -l)" -lt "5" ]; then false; fi - ./tools/pt8exam -w tests/CHEKMO.BN ./pdp8emu tests/CHEKMO.BN.core 2>CHEKMO.2.tmp | tee CHEKMO.1.tmp & @sleep 1 @printf "c\n" | nc -w 1 -u 127.0.0.1 2288 - @printf "g200\n" | nc -w 3 -u 127.0.0.1 2288 + @printf "s200pc\n" | nc -w 1 -u 127.0.0.1 2288 + @printf "g\n" | nc -w 1 -u 127.0.0.1 2288 @printf "MV\r" | nc -w 3 -u 127.0.0.1 2288 @printf "MV\r" | nc -w 3 -u 127.0.0.1 2288 @printf "MV\r" | nc -w 3 -u 127.0.0.1 2288 @@ -191,6 +191,20 @@ check: pdp8emu @printf "q\n" | nc -w 1 -u 127.0.0.1 2288 @if [ "$$(grep -ao '\-\-' CHEKMO.1.tmp | wc -l)" -lt "5" ]; then false; fi + +cores: tools + ./tools/pt8exam -w tests/D0AB-InstTest-1.pt + ./tools/pt8exam -w tests/D0BB-InstTest-2.pt + ./tools/pt8exam -w tests/D0CC-AddTest.pt + ./tools/pt8exam -w tests/D0DB-RandomAND.pt + ./tools/pt8exam -w tests/D0EB-Random-TAD.pt + ./tools/pt8exam -w tests/D0FC-Random-ISZ.pt + ./tools/pt8exam -w tests/D0GC-Random-DCA.pt + ./tools/pt8exam -w tests/D0HC-Random-JMP.pt + ./tools/pt8exam -w tests/D0IB-JMPJMS.pt + ./tools/pt8exam -w tests/D0JB-JMPJMS-RANDOM.pt + ./tools/pt8exam -w tests/CHEKMO.BN + # tools: mkdir -p tools diff --git a/bus.h b/bus.h index 86e7bfa..dbebd57 100644 --- a/bus.h +++ b/bus.h @@ -37,6 +37,7 @@ void set_file_name(char *f,char *s); extern char corename[NAME_LENGTH]; /* name of core image file, if any */ extern char * progname; /* name of program itself (argv[0]) */ extern int trace; /* true if disassembly/trace is output while running */ +extern int bpInstCnt; extern int bp[MAX_BREAKPOINTS]; extern int bp_type[MAX_BREAKPOINTS]; // 0=disabled, 1=address, 2=opcode extern int watch[MAX_WATCHES]; diff --git a/frontpanel-kc8m.c b/frontpanel-kc8m.c index b50514e..bfb4bd0 100644 --- a/frontpanel-kc8m.c +++ b/frontpanel-kc8m.c @@ -40,8 +40,8 @@ // char *getAllRegs() { static char buf[100]; - sprintf(buf,"PC=%d:%04o DF=%d L=%d AC=%04o MQ=%04o AI=%04o %04o %04o %04o %04o %04o %04o %04o ws:%04o", - ifr,pc,dfr,lnk?1:0,ac,mq,memory[010],memory[011],memory[012],memory[013],memory[014],memory[015],memory[016],memory[017],sr + sprintf(buf,"PC=%d:%04o DF=%d L=%d AC=%04o MQ=%04o AI=%04o %04o %04o %04o %04o %04o %04o %04o", + ifr,pc,dfr,lnk?1:0,ac,mq,memory[010],memory[011],memory[012],memory[013],memory[014],memory[015],memory[016],memory[017] ); return buf; } @@ -194,20 +194,19 @@ extern void (* ttybreak) (); /* hook to tty for keyboard overrun */ static char *help_message = "\ -g[addr] - Run starting at current PC or at the given address.\r\n\ +g - Run starting at current PC\r\n\ +g - Run instructions starting at current PC.\r\n\ \r\n\ -t[cnt][,addr] - Trace one (or 'cnt') instructions starting at current PC\r\n\ - or at the given address.\r\n\ +t - Trace/Step one instruction at current PC\r\n\ +t - Trace instructions starting at current PC\r\n\ \r\n\ -s - Set register PC/LINK/AC/MQ/SWITCH/IFLD/DFLD to value.\r\n\ +s - Set PC/LINK/AC/MQ/SWITCH/IFLD/DFLD to \r\n\ \r\n\ -d[,len] - Dump 'len' (or 16 bytes if not specifed) of memory starting\r\n\ - at given address.\r\n\ +d[,len] - Dump [len] (default 16) bytes of memory starting at \r\n\ \r\n\ -D[,len] - Disassemble 'len' (or 16 bytes if not given) of memory \r\n\ - starting at the given address.\r\n\ +D[,len] - Disassemble [len] (default 16) bytes starting at \r\n\ \r\n\ -m,[data] - Modify memory content at address with data. Prompt if no data\r\n\ +m,[data] - Modify memory content at with [data]. Prompt if no data\r\n\ is given. Enter dot (.) to exit mode or Enter to accept the\r\n\ current value.\r\n\ \r\n\ @@ -300,6 +299,8 @@ void console(void) { if (strlen(p)>0) printf("%s\r\n",p); while (run <= RUNMODE_STOPPED) { + printf(":"); + fflush(stdout); ttygets(cmd, 100); ch=parse_nums(cmd, &num1, &num2); switch (cmd[0]) { @@ -313,7 +314,9 @@ void console(void) { break; case 'q': // Quit - printf( "\r\nQuitting\r\n" ); fflush(stdout); usleep(100000); + printf( "\r\nQuitting\r\n" ); + fflush(stdout); + usleep(100000); powerdown(); break; @@ -365,15 +368,13 @@ void console(void) { case 'g': // Go/Run trace=0; - if (num1!=-1) pc=num1; - cpma=pc; run=RUNMODE_STARTING; break; - case 't': // TODO Trace + case 't': // Trace trace=1; - if (num1!=-1) pc=num1; - cpma=pc; + bpInstCnt=num1; + if (bpInstCnt<1) bpInstCnt=1; run=RUNMODE_STARTING; break; diff --git a/main.c b/main.c index bce8ed9..2302117 100644 --- a/main.c +++ b/main.c @@ -38,6 +38,7 @@ char corename[NAME_LENGTH]; /* name of core image file, if any */ char * progname; /* name of program itself (argv[0]) */ int trace; /* true if disassembly/trace is output while running */ unsigned short memory[MAXMEM]; +int bpInstCnt; int bp[MAX_BREAKPOINTS]; int bp_type[MAX_BREAKPOINTS]; // 0=disabled, 1=address, 2=opcode int watch[MAX_WATCHES]; @@ -325,6 +326,9 @@ int main(int argc, char **argv) /* the actual instruction fetch is here */ mb = memory[cpma]; + + if (bpInstCnt==0) {run=RUNMODE_CNT; continue;} + if (bpInstCnt>0) bpInstCnt--; if (run==RUNMODE_RUNNING) { if (bp_type[0]=='O' && mb==bp[0]) {run=RUNMODE_BP_O; continue;} if (bp_type[1]=='O' && mb==bp[1]) {run=RUNMODE_BP_O; continue;}