• Please review our updated Terms and Rules here

Help disassembling short PDP-11 program

Joined
Aug 5, 2015
Messages
15
Location
Tacoma, WA
I recently purchased a PDP-11/23+ and am working on learning about it and restoring it. I found the following snippet of code on this forum and attempted to disassemble it as shown. Both from reading the code and from the output when run on my PDP-11, the code outputs incrementing values from 0 -> 255 to the console SLU. This manifests as repeatedly printing the ASCII character set, including non-print characters.

My question: At address 1010, what does the code 100376 do?

Since there aren't any skipped characters in the output, I would expect it to loop back to address 1006 if N=0 in the PSW, or continue to address 1012 if N=1. In other words, I would expect it to see if the SLU is ready for another character. However, I don't see any PDP-11 instruction that corresponds to that opcode.

Code:
@1000/005000   # CLR R0
@1002/12701    # MOV (R7)+ R1
@1004/177564   # SLU TCSR register address (moved to R1 in previous instruction)
@1006/105711   # TSTB (R1) (PSW will contain N=1 if SLU is transmit ready)
@1010/100376   # ???
@1012/110061   # MOVB R0 X(R1) (Prints character currently stored in R0)
@1014/2        #   X = 2 (since TBUF = TCSR + 2)
@1016/005200   # INC R0 (Increments R0 to next character. Output rolls over when lower byte = 255)
@1020/000137   # JMP @(R7)+
@1022/001006   #   Address for previous instruction's jump. PC=1010 after jump due to autoincrement.
 
BPL If N is clear PC +2 x offset, offset is -2.

Branches back to 1006 and waits for N=1 as you surmise!
 
Thanks!

I see where I went wrong. I was working from the octal opcode list in the KDF11-B manual and it lists BPL as 10 00 XXX. But, since it's an 8 bit opcode, there isn't clean separation of opcode and offset when represented in octal. It's all clear when represented in binary.
 
Machine and Assembly Language Programming of the PDP-11 by Arthur Gill is often available on EBay for not much and has been of great value to me. Think if you’re doing the PDP-11 lifestyle having that book is mandatory.
Be warned though that I am not a programmer so others may have different thoughts! I do love hat little loop and have used it on several systems both Uni and Omni with great success. Have videos on YouTube with both 11/23 1nd 11/34 systems running that loop.
 
Using SIMH can be handy here.

C:\simh>pdp11.exe
PDP-11 simulator V3.9-0
sim> d 1000 005000
sim> d 1002 012701
sim> d 1004 177564
sim> d 1006 105711
sim> d 1010 100376
sim> d 1012 110061
sim> d 1014 000002
sim> d 1016 005200
sim> d 1020 000137
sim> d 1022 001006
sim>
sim> e 1000-1022
1000: 005000
1002: 012701
1004: 177564
1006: 105711
1010: 100376
1012: 110061
1014: 000002
1016: 005200
1020: 000137
1022: 001006
sim>
sim> e -m 1000-1022
1000: CLR R0
1002: MOV #177564,R1
1006: TSTB (R1)
1010: BPL 1006
1012: MOVB R0,2(R1)
1016: INC R0
1020: JMP @#1006
sim>
 
Qbus: Thanks for the recommendation; I'll pick up a copy. I've already read through Assembly Language for the PDP-11 by Kapps & Stafford, and use it now as a reference.

gslick: I didn't realize SIMH would do that. That's awesome and will come in handy as I proceed.

-----

I wrote a short bootloader client for the PDP-11 and am almost done writing some code for my SPARCstation 20 to act as a host. That should make experimentation easier/faster.
 
I wrote a short bootloader client for the PDP-11 and am almost done writing some code for my SPARCstation 20 to act as a host. That should make experimentation easier/faster.

Are you aware of PDP11GUI?

http://www.retrocmp.com/tools/pdp11gui

I have never gotten around to using that but it looks like it could be pretty handy for some things. Might be Windows only though, and you should learn more through writing your own tools.
 
Are you aware of PDP11GUI?

I am aware of it, and of other bootstrapping methods like the TU58 emulator. This project is more about increasing my knowledge and I learn best by hands-on experimentation. There will be a lot of 'reinventing the wheel' before I'm done.
 
Hi All;

Sub, "" I wrote a short bootloader client for the PDP-11. "" Would You be willing to share it and other things that You are writing with the rest of us.. I would be interested in it, for my own learning..

THANK YOU Marty
 
I learned to program the PDP-11 primarily from this book: PDP-11 Handbook 1969 (pdf 112 pages). I thought it was a pretty good read. Pretty sure it was written for people who already know about the PDP-8. Had to learn a bit more about later PDP-11 models in regards to additional instructions, memory management, etc.
 
Sub, "" I wrote a short bootloader client for the PDP-11. "" Would You be willing to share it and other things that You are writing with the rest of us.. I would be interested in it, for my own learning..

Marty, I would be happy to share my progress. My plan is to document on my website each time I complete a 'module' of progress, like the bootloader. I will also post here each time I make a significant update. Of course, I'm sure you guys will already know about it by then as I will have asked a million questions along the way.

Uniballer, that's a good reference. I've already hit up bitsavers for the manuals relevant to my machine. The KDF11 manual has been my reference thus far. I have a few other bitsavers PDFs in the queue (like the one in your link) but it's a lot of information to take in.
 
Hi All;

Sub, "" My plan is to document on my website each time I complete a 'module' of progress, ""
Where is Your Web site ??

THANK YOU Marty
 
I recently picked up a copy of "The Digital Way: Macro-11 Assembly Language Programming (PDP-11)", by J. F. Peters, III. It is very good. The examples are all complete programs and every one that I have typed in (about 30 or so) has run exactly as described.
 
I'm curious what kind of audience/subject matter books on PDP-11 programming are aimed at - not the later microcomputer-hobbyist material, surely. Business applications? Systems programming? I'd think that the -11 instruction set is so straightforward that anybody with basic assembler programming experience wouldn't really need much more than a reference card, assembler manual, and possibly a timing table for their particular target processor...
 
Hi All;

In Answer to Your Question, CommodoreJohn, I try to get as many of these type of books, on the PDP 11, as I can..
Since, I am mostly a Hardware Person, And Programming and coding and Assembly Language, are like a Black Box sort of thing to me..
A lot of Mumble-Jumble to me..
And so I collect as many books that I can find, and afford, so that maybe someOne can Explain it in a way that I might (hopefully) Understand..
Remember, that Daver2, had to do alot of (to others) unnecessary explaining for something to make sense to me, and I still didn't always get it..
Yes, I can (maybe) figure out a short few line program, but anything longer than that and I am hopelessly Lost..
Or, trying to figure out how to make things work on my PDP 11/45..

THANK YOU Marty
 
I'm curious what kind of audience/subject matter books on PDP-11 programming are aimed at - not the later microcomputer-hobbyist material, surely. Business applications? Systems programming?

I've only read the Kapps & Stafford book, so I can't speak to the others, but it was aimed at undergrads taking their first assembly language course. Based on the content of the first few chapters, it didn't seem to assume any prior knowledge or experience with computers.

I suspect that, rather than teach PDP-11 assembly specifically, it was intended to teach assembly in general and the PDP-11 was selected as a pleasant architecture to work on that was also likely to be present on a university campus.
 
Back
Top