6

I'm trying to run a bare-metal example program from the DL11 manual that echoes user input. When I try to run it via SIMH however I get a 'Trap stack push abort' error when it tries to access address 2000 The program is as follows:

.PSECT   ECHO, ABS

        .=200

START:    JMP    BEGIN

; SYMBOL DEFINITIONS

RING  =  04000                 ; BIT 14 OF RCSR, RING
CTS   =  02000                 ; BIT 13 OF RCSR, CLEAR TO SEND
RDONE =  00200                 ; BIT 07 OF RCSR, RECIEVER DONE
DTR   =  00002                 ; BIT 01 OF RCSR, DATA TERMINAL READY
XRDY  =  00200                 ; BIT 07 OF XCSR, TRANSMITTER READY

        .=2000

RCSR:   175610                  ; CONTROL AND STATUS REGISTER OF RECIEVER
RBUF:   175612                  ; BUFFER OF RECIEVER
XCSR:   175614                  ; CONTROL AND STATUS REGISTER OF TRANSMITTER
XBUF:   175616                  ; BUFFER OF TRANSMITTER
CXCSR:  177564                  ; CONTROL AND STATUS REGISTER OF CONSOLE TRANSMITTER
CXBUF:  177566                  ; BUFFER OF CONSOLE TRANSMITTER
BUFFER: 0                       ; HOLDS CHARACTER RECIEVED
DELAY:  0                       ; HOLDS DELAY COUNT, HIGH ORDER
        0                       ; HOLDS DELAY COUNT, LOW ORDER


; BEGINNING OF ECHO PROGRAM

BEGIN:  CLR    @RCSR            ; START BY INITIALIZING ALL BITS TO 0

LOOP1:  BIT    #RING, @RCSR     ; CHECK FOR INCOMING CALL
        BEQ    LOOP1            ; BRANCH IF PHONE IS NOT RINGING
        BIS    #DTR, @RCSR      ; PHONE IS RINGING, ANSWER WITH DIR
        MOV    #5,   DELAY      ; SET UP COUNT FOR DELAY

LOOP2:  BIT    #CTS, @RCSR      ; CHECK FOR CLEAR TO SEND
        BNE    LOOP3            ; BRANCH IF ON
        SUB    #1, DELAY+2      ; CHECK DELAY
        SBC    DELAY            ; DECREMENT TWO-WORD INTEGER
        BEQ    BEGIN            ; BRANCH IF WE HAVE WAITED TOO LONG
        BR     LOOP2            ; BRANCH AND CONTINUE TO WAIT FOR CTS

LOOP3:  BIT    #CTS, @RCSR      ; IS CHANNEL STILL ESTABLISHED?
        BEQ    BEGIN            ; BRANCH IF CTS NOT PRESENT
        BIT    #RDONE, @RCSR    ; CHECK FOR RECIEVED CHARACTER
        BEQ    LOOP3            ; BRANCH IF NO CHARACTER RECIEVED
        MOV    @RBUF, BUFFER    ; READ RECIEVED CHARACTER INTO BUFFER

LOOP4:  BIT    #XRDY, @XCSR     ; CHECK FOR TRANSMITTER READY
        BEQ    LOOP4            ; BRANCH IF NOT READY
        MOV    BUFFER, @XBUF    ; TRANSMIT CHARACTER TO REMOTE TERMINAL

LOOP5:  BIT    #XRDY, @CXCSR    ; CHECK FOR CONSOLE TRANSMITTER READY
        BEQ    LOOP5            ; BRANCH IF NOT READY
        MOV    BUFFER, @CXBUF   ; TRANSMIT CHARACTER TO CONSOLE
        BR     LOOP3            ; BRANCH AND WAIT FOR FOR NEXT CHARACTER

How do I make this not happen?

1
  • I don't see why you need to, but given the error, you might try and set up a stack. MOV #BEGIN, SP at the entry point. Feb 21 at 12:54

1 Answer 1

7

Some theorizing, as answer because too long for comment.

Just to review the addresses (per my paper handbook). For the console DL-11:

177560 keyboard status
177562 keyboard data
177564 printer status
177576 printer data

DL11-A, -B models have registers (in the same order) at 176500 to 176576; DL-11 C, -D, -E models have registers at 175610 to 176176.

The example code looks therefore like it is reading from the first DL11-E and writing to the console terminal. Per my Peripherals Handbook, it's only the DL11-E that supports modem control.

Did you in fact configure a DL-11 apart from the console? If not, you'll get a Unibus trap, which may then fail because there's no stack set up. (I don't recall how 'reset' leaves SP).

Your question says 'when it tries to access address 2000' but in my explanation it's when it tries to execute the instruction fetched from address 2000, which attempts to access address 175610.


What's your intent here? For a simpler example, you could just read and write to the console DL. That is always configured.

.PSECT ECHO, ABS

        .=200

START:  JMP BEGIN

RDONE = 00200
XRDY  = 00200

        .=2000

CRCSR:  177560                  ; CONTROL AND STATUS REGISTER OF CONSOLE RECEIVER
CRBUF:  177562                  ; BUFFER OF CONSOLE RECEIVER
CXCSR:  177564                  ; CONTROL AND STATUS REGISTER OF CONSOLE TRANSMITTER
CXBUF:  177566                  ; BUFFER OF CONSOLE TRANSMITTER


BEGIN:  CLR    @CRCSR           ; INIT RECEIVER

LOOP1:  BIT    #RDONE, @CRCSR   ; CHECK FOR RECEIVED CHARACTER
        BEQ    LOOP1            ; BRANCH IF NO CHARACTER RECIEVED
        MOV    @CRBUF, R0       ; READ RECEIVED CHARACTER INTO BUFFER

LOOP2:  BIT    #XRDY, @CXCSR    ; CHECK FOR CONSOLE TRANSMITTER READY
        BEQ    LOOP2            ; BRANCH IF NOT READY
        MOV    R0, @CXBUF       ; TRANSMIT CHARACTER TO CONSOLE
        BR     LOOP1            ; BRANCH AND WAIT FOR FOR NEXT CHARACTER
6
  • I think you're right, I set up a stack with MOV #BEGIN, SP as you suggested in your comment, and now when I try to access address 175610 the PC gets changed to address 0, presumably from the Unibus trap. I'm not sure how to fix getting the Unibus trap however. Feb 21 at 14:20
  • 3
    In a real PDP-11, it's a matter of opening the CPU cabinet and inserting a DL11 in a free Unibus slot (likely after setting the address and vector on some DIP switches or jumpers). In SIMH, you need to make sure the SIMH config has that device at that address. Feb 21 at 16:06
  • 1
    The simh names for extra DL11's are DLI and DLO (in, out respectively). Try SHOW DLI. Feb 21 at 17:48
  • 1
    Oh, my code? Yeah, I wasn't intending to provide the 'complete' code, just the central bit. I'll approve the edit. Though I bristle at them being called 'bugs'. ;-) Feb 21 at 22:53
  • 1
    Incidentally, the code is a bit clunky (copied from the original). Real code would only need to provide the base address, 177560, and then define offsets 0,2,4,6 for the device registers. These offsets are fixed, regardless of the base address of your particular DL11. You would load the base into a CPU register (in this example, you could dedicate one) and use displacement addressing off that register. Similarly, note how I balked at using BUFFER, and used R0 instead. Feb 21 at 23:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.