Close

Running echo.pal example

A project log for PDP-8 FPGA

Building a PDP-8 on an FPGA

land-boardscomland-boards.com 05/15/2021 at 18:070 Comments

The echo.pal example program reads characters from the serial port and echos them out as they are entered. When Enter is pressed, the entire line gets sent to the serial port.

In the previous log I created a utility bin2mif that does a simple translation of the DEC bin file into a memory initialization file. The program only copies code sections and doesn't deal with non-contiguous code sections. This limitation is fine for the data since it should all be set to zero anyway but it's a problem for the non-contiguous code sections in echo.pal.

Here's the echo.lst file:

    1             / Serial port test (echo)
    2             / http://homepage.divms.uiowa.edu/~jones/pdp8/man/tty.html
    3       0010  *10
    4 00010 0000  linep, 0
    5       0020  *20
    6 00020 0000  saved, 0
    7 00021 0000  count, 0
    8       0400  *400             / Line stored here
    9 00400 0000  line, 0
   10       0200  *200
   11 00200 7200      CLA          / Clear Accumulator
   12 00201 6046      TLS          / Teleprinter Load and start
   13 00202 7200  newl, CLA        / Clear Accumulator
   14 00203 1377      TAD (line-1)
   15 00204 3010      DCA linep
   16 00205 6031  newc, KSF           / Keyboard Skip if Flag (input data is ready)
   17 00206 5205      JMP .-1       / 
   18 00207 6036      KRB          / Keyboard Read and begin next read
   19 00210 0376      AND (177)    / Get rid of parity bit
   20 00211 6041      TSF          / Teleprinter Skip if Flag
   21 00212 5211      JMP .-1
   22 00213 6046      TLS          / Teleprinter Load and start (Echo it)
   23 00214 3020      DCA saved    / save a copy
   24 00215 1020      TAD saved
   25 00216 3410      DCA I linep  / store it away
   26 00217 1020      TAD saved
   27 00220 1375      TAD (-15)    / CR character?
   28 00221 7440      SZA          / finished line if so - Skip next instruction if Zero Accumulator
   29 00222 5205      JMP newc
   30 00223 1374      TAD (12)     / Echo line feed as well
   31 00224 6041      TSF          / Teleprinter Skip if Flag
   32 00225 5224      JMP .-1
   33 00226 6046      TLS          / Teleprinter Load and start (Echo it)
   34             / Now echo the line
   35 00227 7200      CLA          / Clear Accumulator
   36 00230 1373      TAD (-line)
   37 00231 1010      TAD linep    / get number of characters
   38 00232 7040      CMA          / minus the number
   39 00233 3021      DCA count
   40 00234 1377      TAD (line-1) / reset starting address
   41 00235 3010      DCA linep
   42 00236 7200  echoc, CLA       / Clear Accumulator
   43 00237 1410      TAD I linep  / get character
   44 00240 6041      TSF          / Teleprinter Skip if Flag
   45 00241 5240      JMP .-1
   46 00242 6046      TLS          / Teleprinter Load and start
   47 00243 2021      ISZ count    / Increment and store
   48 00244 5236      JMP echoc
   49 00245 7200      CLA          / Clear Accumulator
   50 00246 1374      TAD (12)
   51 00247 6041      TSF          / Teleprinter Skip if Flag
   52 00250 5247      JMP .-1
   53 00251 6046      TLS          / Teleprinter Load and start
   54 00252 5202      JMP newl
      00373 7400
      00374 0012
      00375 7763

The problem here is the values in locations 373-375 (oct). They get placed immediately after the code at 263-255, These can be manually inserted using the In System Memory editor.

The Quartus In System Memory Editor can be used to do an export of the data (first select all). Saved the code as echo_fixed.mif.

The result is that the echo code runs on the PDP-8 FPGA.

Discussions