• Please review our updated Terms and Rules here

Using PDPGUI to run BASIC

Just re-reading post #137.

I see you are entering a start address and pressing CONT to run a program. I don't think this works (perhaps other people can chip in here). I think you have to load the start address and press START (not CONT).

Dave


How else do you step through a program? I press START to run the program, CONT to walk through from wherever the program counter is, right?
 
I have just read "http://bitsavers.trailing-edge.com/pdf/dec/pdp11/1140/1140_SystemManual.pdf" pages 3-9 (LOAD ADRS), 3-11 (CONT) and 3-13 (START) and it says that the start address of the program is taken from "the address register" when the START key is depressed (paraphrasing).

To start a program you should enter the address into the switches, press "LOAD ADRS" and then press "START" not "CONT".

Can you re-run my test program again following this procedure to actually start the program running. Can I also suggest trying the diagnostic again (from both 202 and 200) using this procedure. I am guessing it won't work (!) but at least we have ruled this out as an issue. I suspect that if you use CONT it is NOT starting the program from the switch register settings but carrying on from where it left off. If it was cycling around your loop when you pressed halt - and you then entered a new start address and hit CONT - I suspect the processor will carry on from the loop it left (i.e. not the response you expected and could lead to us getting confused about what works and what doesn't).

Dave
 
Sorry Bill - our posts are getting crossed...

This is my take:

To run a program - enter an address into the switches, press "LOAD ADRS" and then "START" with the "ENABLE/HALT" in ENABLE (up).

To step a program - enter an address into the switches, press "LOAD ADRS" and then "START" with the "ENABLE/HALT" in HALT (down). Then press "CONT" for each instruction.

To continue a program (from the halt state) - "ENABLE/HALT" in HALT (down) and operate "CONT" for each instruction.

Dave

Correction: Operating START when in HALT mode performs a complete system clear (I've just learned something). Set the PC (R7) to the start address of the program. with the "ENABLE/HALT" switch set to "HALT" (down) use the CONT switch to execute each instruction. Now, how do you load R7/PC from the console?
 
Hi All;

Bill, on my 11/45 and I think it's close or nearly the same..
I raise up the Halt switch, I put my address in the Switches, I raise the Load Address Switch, and Load the address into the Load Address Register.. I Lower the Halt switch and I press Start to Run..
To single Step, I raise up the Halt switch, I put my address in the Switches, I raise the Load Address Switch, and Load the address into the Load Address Register.. Then, I leave the HALT switch raised, and Press the Start Switch, for each stepping after that, You Press the CONTinue Switch..
I am not sure that You have had the Halt Switched Raised while Continuing.. At least You didn't say that You did..
Now maybe, You thought that, that was Understood when continuing..

THANK YOU Marty
 
Sorry Bill - our posts are getting crossed...

This is my take:

To run a program - enter an address into the switches, press "LOAD ADRS" and then "START" with the "ENABLE/HALT" in ENABLE (up).

To step a program - enter an address into the switches, press "LOAD ADRS" and then "START" with the "ENABLE/HALT" in HALT (down). Then press "CONT" for each instruction.

To continue a program (from the halt state) - "ENABLE/HALT" in HALT (down) and operate "CONT" for each instruction.

Dave

This *is* what I do and have been doing all along. yes. My process of testing post may have been confusing, or I left out something.
 
I have just read "http://bitsavers.trailing-edge.com/pdf/dec/pdp11/1140/1140_SystemManual.pdf" pages 3-9 (LOAD ADRS), 3-11 (CONT) and 3-13 (START) and it says that the start address of the program is taken from "the address register" when the START key is depressed (paraphrasing).

To start a program you should enter the address into the switches, press "LOAD ADRS" and then press "START" not "CONT".

Can you re-run my test program again following this procedure to actually start the program running. Can I also suggest trying the diagnostic again (from both 202 and 200) using this procedure. I am guessing it won't work (!) but at least we have ruled this out as an issue. I suspect that if you use CONT it is NOT starting the program from the switch register settings but carrying on from where it left off. If it was cycling around your loop when you pressed halt - and you then entered a new start address and hit CONT - I suspect the processor will carry on from the loop it left (i.e. not the response you expected and could lead to us getting confused about what works and what doesn't).

Dave

?? I assume now we're on the same page, I first ran each version of the program. Recorded the results. I think my post is pretty clear as it is, you may have missed that I corrected my original post soon after. I added "HALT" in between the ENABLE/START test vs. the HALT/CONT walkthrough to show that I ran then stepped through the program.
 
Agreed (to post #146)...

Perhaps it is what I was reading in the post that is confusing as opposed to what you are doing. For example (back in post #137):

>> HALT
>>
>> load addr 200 then pressed CONT
>> address lights changed to 206
>> CONT
>> 210
>> CONT
>> 06

It says "load address 200 then press CONT". "Address lights changed to 206".

My interpretation of this is that you loaded 200 into the switch register with "LOAD ADRS" and then pressed CONT. In this case the address load would have been ignored and the processor would have continued from where it "left off" and it finished at 206. Since I don't know where the PC was before hitting CONT I don't know what has been executed to get to 206.

I will go back and re-read what you have written.

Dave
 
My understanding is completely the opposite of yours!

The "LOAD ADRS" switch loads the switch settings into an "internal address register" - not the PC.

To my knowledge - the PC is loaded from this internal address register when you press "START" but not "CONT".

I have found the location of the PC - you can read it by examining 777707 (it is mapped into the I/O space - along with all of the other CPU general registers in the range 777717 to 777700 - so you can look at them (and modify them) using the front panel console).

Dave
 
Here's a quick test:

Load the following program into memory:

200 = 0
202 = 0
204 = 0
206 = 0
210 = 0
212 = 0
214 = 0
216 = 0

[A load of HALTS]...

Put 210 into the switches, press "LOAD ADRS", ENABLE/HALT to ENABLE, press "START".

The program should halt at 212.

Put 200 into the switches, press "LOAD ADRS", press "CONT".

If the machine halts at 214 - the PC was never updated by the "LOAD ADRS". If the machine halts at 202 the PC was updated by the "LOAD ADRS".

Dave
 
I agree one should press start after they load the address, THEN press CONT. I just tested to confirm. Earlier I was not always hitting START, but I verfied one more time that my results recently are from a process that includes using START just before CONT.
 
Here's a quick test:

Load the following program into memory:

200 = 0
202 = 0
204 = 0
206 = 0
210 = 0
212 = 0
214 = 0
216 = 0

[A load of HALTS]...

Put 210 into the switches, press "LOAD ADRS", ENABLE/HALT to ENABLE, press "START".

The program should halt at 212.

Put 200 into the switches, press "LOAD ADRS", press "CONT".

If the machine halts at 214 - the PC was never updated by the "LOAD ADRS". If the machine halts at 202 the PC was updated by the "LOAD ADRS".

Dave

We are on the same page, you need the START.
 
Excellent.

So, I am back at home and have tried my 'noddy' test program on SIMH and realised I had a couple of addresses incorrect. Here is the updated program (I had the address of the IOT trap vector wrong - it should start at address 20 not 40 as I had it):

Memory location - Value

20 - 220 ; IOT trap vector
22 - 200 ; IOT trap vector

200 - 012706 ; MOV #600,SP
202 - 600
204 - 240 ; NOP
206 - 240 ; NOP
210 - 4 ; IOT
212 - 240 ; NOP
214 - 0 ; HALT
216 - 0 ; HALT
220 - 0 ; HALT
222 - 0 ; HALT

START the program from address 200.

The program should HALT with PC=222 (i.e. the address of the next instruction to be executed).

Replace address 220 from 0 (HALT) with 2 (RTI).

Restart from 200.

The program should HALT with PC=216 (i.e. the address of the next instruction to be executed).

If either of the above doesn't work as expected (i.e. halt at the correct address), try single-stepping the program to see where it goes awry.

The program should load the stack pointer with 600 (instructions at 200 and 202) to point it at a defined piece of memory. Invoke an IOT at address 210. other instructions are either NOPs (240) or HALT (0).

Dave
 
When i run the version where 220 = 0, the program does not halt. If I single step it goes through
204
206
210
200
204
206
210
200
loop..

Same results when I change 220 = 2. What is going on do you think?

B
 
That's interesting.

It looks like it is executing 200 correctly (loading the stack pointer with 600) as the next instruction to be executed after 200 is 204.

204 is a NOP - so will step on to 206 correctly.
206 is a NOP - so will step on to 210 correctly.

210 is an IOT - so it should vector to the PC located in memory address 20 (which should be 220) but we end up at 200 (which is the next word? - the new PSW for the IOT)...

Can you just triple check that memory address 20 is 220 and address 22 is 200 please.

Failing that - it looks like the IOT is misbehaving...

Dave
 
20 is 220, 22 is 200.

I was looking around for something about the 11/40 and 11/35 related to the IOT. I don't know enough about this I had been looking at the processor handbook for the 11/40 to see if there is anything about this CPU to explain. Page 4-68 on my copy. Vector address of 20
 
Last edited:
See page 4-68 of http://bitsavers.trailing-edge.com/pdf/dec/pdp11/handbooks/PDP-11_40_Processor_Handbook_1972.pdf.

IOT is basically a 'special' instruction designed for people writing operating system software.

The current processor status word (PSW) and program counter (PC) are stored on the stack (that's why I needed to initialise the Stack Pointer). The new Program Counter (PC) is fetched from memory location 20, and the new Processor Status Word (PSW) is fetched from memory location 22. Instruction execution then resumes.

Basically it is a very simple (1 word) instruction to very quickly preserve the existing PSW/PC on the stack and reload them from a 'trap vector' stored in memory.

A new PC should be picked up from 20 (which in my test case should be 220) and a new PSW from 22 (which should be 200).

There could be an issue setting the new PSW to 200 (it may enable interrupts for example which could have an 'undefined' action). Let me think of a new value for address 22 to make sure interrupts are disabled after the IOT to make sure these aren't compromising my test program.

Give me a couple of minutes...

Dave
 
Use the program from post #153 but change address 22 from 200 to 340.

This will disable any response by the processor to any pending interrupts from the hardware.

Dave
 
Back
Top