Tuesday, January 31, 2017

MACRO-11 List File Parser for embedded PDP11s




  Recently I've been working on a controller to use on assorted electronics hobby projects. I considered all the usual solutions - Raspberry PIs, Arduinos and the like. But that technology is not really where I'm at. I like solutions are are state of the art tech...for the 60s,70s and 80s.

   I decided to use some old DEC T-11 chips I had kicking around for the CPUs - my needs for compute power and memory are modest, and I can write MACRO-11 code in my sleep. The T-11 chip was a DEC product designed for use in embedded products. It implements a pretty durn complete PDP11 on one chip, and has options that enable it to work with a minimum amount of support circuitry. The T-11 doesn't include any IO capability, so I needed a chip to handle that. I had no requirement for terminal IO so I didn't need a UART. I decided to use one of my all time favorite chips for IO - the Rockwell 6522 Versatile Interface Adapter. The 6522 has 16 lines for IO, two timers, and four handshaking lines. It will handle any of my projects with ease. 

   So, after lengthy design and prototyping sessions, I have T11/6522 systems to play with. Now, since all hardware projects inevitably turn into software projects, I needed some code to make it go. I started out with my trusty old PDP-11/70 programmer's card (my old pal Dr. Bob said that these should have included some blister packed Valium on the back of them).  Assembling code by hand and entering it into my EPROM programmer's editor was beyond tedious, and modifying the code once it was written was even more of a challenge. To make it a little easier, I started coding the programs in MACRO-11 on an RSX system, and then reading the part of the listing file that contained the octal bytes generated. Here's an example. The generated bytes are in the 3rd, 4th and 5th columns. I could read them from there, translate to hex, and enter them in the editor screen for my EPROM programmer. Lots easier than hand assembling everything. 


     25 ;+
     26 ;  set 6522 port A & B lines
     27 ;-
     28 100000 z::
     29 100000 005003                                  clr             r3
     30 100002 012706 077760                    mov         #77760,sp
     31 100006 112767 000377 077667 movb #377,ddra
     32 100014 112767 000377 077660 movb #377,ddrb





This was easier, but was still pretty tedious - lots of reading, converting and typing to do. Time for more automation. I thought about reading and converting the object files from the assembly, but that looked like a lot of work. Instead, I wrote LISPAR.MAC, a utility that can read a listing file, parse out the memory columns, convert them to hex and output them as an Intel Hex record, ready for my EPROM programmer to digest.

  LISPAR is a pretty standard sort of RSX family utility - it uses GCML and CSI to get command input, FCS to do the file IO, and TPARSE to parse the input file. I've included it on the very remote chance that someone out there is working on PDP11 bare metal and doesn't already have a better cross assembler or other solution. I should point out that lispar is only useful on simple programs - it won't do anything useful if it encounters system calls or directives that don't emit anything (like .blkb for instance) or anything too hairy. It can deal with macros, but you'll need to add a .LIST MEB to the top of the program to get the binary expansions of the macros to appear in the listing.

  To make...
  >mac lispar=lispar
  >tkb
  TKB>lispar=lispar
  TKB>/
  Enter Options:
  TASK=...MLP
  //

  To use...
  >mac ,somefile=somefile
  >ins lispar
  >run lispar (or install it and invoke as MLP).
  MLP>outfile=somefile
  The output file will be in Intel Hex format.
  Input file default extension is .lst. Output file default extension is .hex
  The Intel Hex records are set to load at address 0. If you need another address, use the /adr switch.
  MLP>outfile=infile/adr:1000


No comments:

Post a Comment

Comments?