From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1164f8,d5f745b6bc0fede1,start X-Google-Attributes: gid1164f8,public X-Google-ArrivalTime: 2001-11-09 12:48:10 PST Path: archiver1.google.com!postnews1.google.com!not-for-mail From: peter.radonyi@bigpond.com (Peter Radonyi) Newsgroups: comp.sys.dec Subject: From PDP emulator to real PDP problems encountered Date: 9 Nov 2001 12:48:09 -0800 Organization: http://groups.google.com/ Message-ID: NNTP-Posting-Host: 144.134.227.3 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1005338890 27121 127.0.0.1 (9 Nov 2001 20:48:10 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: 9 Nov 2001 20:48:10 GMT Xref: archiver1.google.com comp.sys.dec:8205 Hello, My name is Peter, and I am working on the Helicopter Flight Simulator using the Ersatz PDP-11/45 emulator. The emulator has been running successufully and the build of the helicopter Flight Simulator (FS) is carried out on the emulator and the binary is transferred to the live PDP and it runs perfectly. I have developed a utility program for capturing data from the helicopter simulator which is running perfectly on the emulator but when I transfer it to the real PDP-11 it has problems and I was wondering if some one could give some suggestion what is happening. The utility program I had built seemed to be producing garbage so I wrote the program called NUMGEN.MAC which is at the end of this email. It was to check the validity of my input data and output data. The program NUMGEN.MAC generates numbers from 1 ..5120 (20*256). It fills a buffer of 256 words (2 bytes each) each time and writes the buffer to disk. It puts one number in each word. The program outputs numbers begining from 1 through TO 256. So the first buffer will be from 1..256, the next buffer 257 .. 512 and so forth. When the program has written 20 buffers it exits. The program writes the data to a binary file called NUMDAT.001 which I have not inclulded because it is binary, but I can emsil a copy if requested, or you can create it by extracting the NUMGEN program below and run it on the PDP. The binary file NUMDAT.001 is converted from binary integers to ascii numbers using the C program FSBD2A.CP (flight simulator binary data to ascii). This program outputs a line of five columns. The first four columns are the data from NUMDAT.001 converted and the last column on the right is the running total of all the records that have been read. Segments from the file EMUDAT.TXT are included and it is the data produced from the PDP emulator and this is correct and this is what I am expecting as the correct output from the emulator and the PDP. The output from the PDP is not altogether garbage. There is some interesting consistency in the output from the PDPDAT.001. The first six records are correct. Then the seventh record is 256 + 7 = 263. Then this runs through adding one correctly right up to the 256 record which is 512. 512 = 256 + 256. Then it corrects itself again and for the next six records writes the correct data 256, 257, ... 262. Then amazingly it then writes 519, 520, 521 and continues correctly after missing the fist six numbers which were correct. The pattern is after outputing the first six numbers correctly it will add 256 to the remaining 250 numbers. Then after the 256th number is output correctly it then writes the next six numbers in the correct sequence and after the seventh add 256. I know the problem is happening at the real PDP because as soon as the program was run I run the dump facility on the output file numdat.001 and it was already corrupted. So I know that it is not my C program converting the data from binary to ascii which is causing this problem. At first this is what I had suspected. If there is any help or pointers that you can suggest would be greatly appreciated. Note the following, the helicopter simulator when generated on the emulator and transferred to the PDP-11 works perfectly and has been for years. So it would be reasonable to assume the simple program shown below which works on the emulator should work on the PDP. Thanks and regards, Peter Below is the MACRO program for generating the data and segments of the output file. The C program for converting the binary data to ascii integers. The first segment of the output file is generated from the emulator and the second segment of the output file is generated on the real PDP. PROGRAM FILES and OUTPUT data follow. -------------------------------------------------------------------------------- ; ; this program will write 20 buffers of 256 unsigned integers to file and is used as ; a debugging aid for generating data and testing the output. Therefore the ; numbers range from 0 .. 5120 = 256*20 ; ; This program ran OK on the emulator but did not run correctly on the real PDP ; suspected problem was the channel number which was originaly #7. Pulled a ; number out of the air and used octal 360 as the channel number. This did not ; work so used channel 0 ; correctly should invoke CSTAT which checks the channel number. ; .MCALL ..V2.., .REGDEF, .PRINT, .TTYOUT, .EXIT .MCALL .LOOKUP, .WRITE , .CLOSE ; ..V2.. ;call the V2 program request. .REGDEF ;call the regdef program request. ; ; Information and Error messages. ; CACMSG: .ASCIZ /*** I *** Channel ACtive/ FNFMSG: .ASCIZ /*** E *** File RK1:NUMDAT.001 Not Found, it must exist/ DNFMSG: .ASCIZ /*** E *** RK1 not available/ ;disk drive not found WTMSG: .ASCIZ /*** E *** Write Error/ DONE: .ASCIZ /*** I *** 20 blocks of 256 words each written, exiting. / ; ; Debug messages ; DBG1: .ASCIZ /*** I *** Number Generator Program V4/ DBG5: .ASCIZ /*** D *** Wrote buffer full 256 words to disk, buffer number:/ ; .EVEN ;force assembler to start on an even word boundary ; ; Decleare variables. ; WBUFF: .BLKW 256. ;number of records in the buffer BLKN: .WORD 0 ;counter for the number of buffers. BUFPTR: .WORD 0 ;a pointer to the word in the buffer being written to. ; CENN2: .WORD 0 ;variable varies from 0 .. 256 incremented by 1 each time. ; ;Area for decrlaring variables required by write routine. ; EMTAA: .BLKW 5 ;EMT EMulator Trap Argument Area DSKDRV: .RAD50 "RK1" ;device .RAD50 "NUM" ;filename monitor program takes word 2 for file name .RAD50 "DAT" ;filename monitor program takes word 3 for file name .RAD50 "001" ;extention monitor program takes word 4 for file extension ; HSPACE: ;reserved space for DT handler .=.+400 ; ;Main program ; START: ; EOF=52 .LOOKUP #EMTAA,#0,#DSKDRV ;associate file name with device ;on channel #0 octal. BCC INIT ;file was found then branch carry clear TSTB @#EOF ;error, whats wrong? BNE NFD ;file not found .PRINT #CACMSG ;write a message .EXIT ;close up shop NFD: .PRINT #FNFMSG ;file not found .EXIT ; ; initialise the pointer to the buffer. ; INIT: ;jumps to here if the lookup command is successful. MOV #WBUFF, R2 ;point R2 to the start of the buffer. ; ; main loop, exit when no more disk space. ; BUFLP: ;return here after adding record to the buffer or from writing a buffer to disk. ; INC CENN2 ; MOV CENN2, (R2)+ INC BUFPTR ; CMP #400,BUFPTR ;originally had octal 256 this caused no end of problems. BGT BUFLP ; ; buffer full save buffer to disk. ; CLR BUFPTR; ;reset for the next buffer MOV #WBUFF, R2 ;reset the buffer pointer to start of buffer. ; ; output user information to the screen on how many buffers written. ; .PRINT #DBG5 ADD #60,BLKN .TTYOUT BLKN .TTYOUT #12 .TTYOUT #15 SUB #60,BLKN ; ; end of user information. ; .WRITE #EMTAA,#0,#WBUFF, #256., BLKN ; INC BLKN ;keep a record of number of blocks output to disk. CMP #20.,BLKN ;maximum number of outputs is 20 blocks BGT BUFLP ;if 20 blocks then exit finished. .CLOSE #0 ;close the output channel .PRINT #done .PRINT #DBG1 .EXIT ; ; ; *** Errors and exit point, if cannot initialise. ; FERR: .PRINT #DNFMSG ;disk drive not available .EXIT ;V4 .END START -------------------------------------------------------------------------------- // This program reads a binary output file. Each word is two bytes // and converts the value into decimal ASCII numbers. // The bytes on the PC and PDP are both stored as Most Significant Byte // followed by Least Significant Byte. Word = LSB + MSB. This is ok because // this is what the PC expects and it will shuffle the bytes. // #include #include #include #include #include #define RECSPERLINE 4 FILE *infile, *outfile; main () { int bufcnt ; //data saved in blocks of 256 records. unsigned int totrecs; //counters for the number of blocks and recs unsigned char reclncnt;//counter for outputing three records a line int fsrec, *ptrfsrec; //cannot use unsigned int because its 4 words long on PC. char string[8]; // // Executable statements // // open binary file for reading to be converted to ascii // infile=fopen("numdat.001","rb"); if (!infile) { puts ("Can't open numdata.001"); exit (1); } if ((outfile = fopen("emudat.txt", "w")) == NULL) { puts("Cannot open output file rpdatnov.001.\n"); return 1; } // // Both files are open and ready. // initialize the counters // totrecs = 0; //running total reclncnt = 0; //used for counting number of records per line // ptrfsrec = &fsrec; while (!feof(infile)){ for(bufcnt=0; bufcnt <= 255; bufcnt++) { if (reclncnt < RECSPERLINE){ //checks how many records per line have been output. fread(ptrfsrec, 2, 1, infile); //fread (*pointer, recordsize, numberofrecs, filehandle) itoa(*ptrfsrec, string, 10); // integer, string, radix fprintf(outfile,"%6s",string); reclncnt++; //counts the number of records output per line. totrecs++; //sum of all records output. } else { // starts a new line. fprintf (outfile,"%6u\n",totrecs); //running total of records read. reclncnt=0; } //end of if-else,for putting out 4 records per line. }// end of for statement for outputing a buffer full of information. // housekeeping and exit } // end of while statement fprintf (outfile,"%6u",totrecs); fprintf(outfile,"\n\nTotal number of records output = %5u",totrecs); fclose (infile); fclose (outfile); return 0; } -------------------------------------------------------------------------------- Sample data from the emulator which works. The first four columns are data, and the final column is a running total of then number of records output. 1 2 3 4 4 5 6 7 8 8 9 10 11 12 12 13 14 15 16 16 ... data continues to be output like this until 20 buffers are output. 245 246 247 248 248 249 250 251 252 252 253 254 255 256 256 257 258 259 260 260 261 262 263 264 264 265 266 267 268 268 ... 5097 5098 5099 5100 5100 5101 5102 5103 5104 5104 5105 5106 5107 5108 5108 5109 5110 5111 5112 5112 5113 5114 5115 5116 5116 5117 5118 5119 5120 5120 Thats it. This above is the data when produced from the PDP emulator. When the program is transferred to the live PDP the data comes out as shown below. -------------------------------------------------------------------------------- PDP produced data 1 2 3 4 4 5 6 263 264 8 ;notice that the first six values are correct. 265 266 267 268 12 ;from the seventh it adds 256 and continues 269 270 271 272 16 ;from this value. ... 497 498 499 500 244 501 502 503 504 248 505 506 507 508 252 509 510 511 512 256 ;this is one buffer of data at 256 257 258 259 260 260 ;it corrects itself goes back to 256 for the 261 262 519 520 264 ;next six records up to 262 then jumps 256 at 521 522 523 524 268 ;the seventh record, to be 519 taking into 525 526 527 528 272 ;account the first six records. ... 753 754 755 756 500 757 758 759 760 504 761 762 763 764 508 765 766 767 768 512 ;corrects itself at 256 that is one buffer 513 514 515 516 516 ;for six records, 517 518 775 776 520 ;then at the seventh increments by 256. 777 778 779 780 524 ;this pattern continues till the program ;terminates.