Skip to content

Commit

Permalink
Change Go/Trace to only support cnt as parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
mengstr committed Apr 21, 2020
1 parent 600ee13 commit 188a712
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 69 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ccpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:

runs-on: ubuntu-latest

timeout-minutes: 10
timeout-minutes: 20

steps:
- uses: actions/checkout@v2
Expand Down
116 changes: 65 additions & 51 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions bus.h
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down
35 changes: 18 additions & 17 deletions frontpanel-kc8m.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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<cnt> - Run <cnt> 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<cnt> - Trace <cnt> instructions starting at current PC\r\n\
\r\n\
s<value><reg> - Set register PC/LINK/AC/MQ/SWITCH/IFLD/DFLD to value.\r\n\
s<value><reg> - Set <register> PC/LINK/AC/MQ/SWITCH/IFLD/DFLD to <value>\r\n\
\r\n\
d<addr>[,len] - Dump 'len' (or 16 bytes if not specifed) of memory starting\r\n\
at given address.\r\n\
d<addr>[,len] - Dump [len] (default 16) bytes of memory starting at <addr>\r\n\
\r\n\
D<addr>[,len] - Disassemble 'len' (or 16 bytes if not given) of memory \r\n\
starting at the given address.\r\n\
D<addr>[,len] - Disassemble [len] (default 16) bytes starting at <addr>\r\n\
\r\n\
m<addr>,[data] - Modify memory content at address with data. Prompt if no data\r\n\
m<addr>,[data] - Modify memory content at <addr> 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\
Expand Down Expand Up @@ -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]) {
Expand All @@ -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;

Expand Down Expand Up @@ -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;

Expand Down
4 changes: 4 additions & 0 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down Expand Up @@ -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;}
Expand Down

0 comments on commit 188a712

Please sign in to comment.