Marty
Veteran Member
Hi All;
Here is the first program from the book 'Machine and Assembly Language Programming of the PDP 11'..
BCPL 32-bit Cintcode System (30 May 2013)
0.000> TRIPOS PDP-11 Assembler version 1.4
Calling firstpass()
Calling secondpass()
;Title Backward
;Accept a line of characters fron the Teletype and Echo it Backwards.
000000' LC=.
000004' .=4+LC
000004' 000006 000000 000012 .WORD 6,0,12,0 ; INITIALIZE ERROR VECTORS
000012' 000000
000500' .=500+LC
000500' 010706 START: MOV PC,SP ;INITIALIZE SP TO START
000502' 005746 TST -(SP)
;
177560 KBSTAT=177560
177562 KBDATA=177562
177564 PRSTAT=177564
177566 PRDATA=177566
;
000504' 012746 000015 MOV #15,-(SP) ;CR CODE TO STACK
000510' 012746 000012 MOV #12,-(SP) ;LF CODE TO STACK
000514' 105767 177560 LOOP: TSTB KBSTAT ;CHARACTER ENTERED?
000520' 100375 BPL LOOP ;NO KEEP IDLING
000522' 016700 177562 MOV KBDATA,R0 ;(R0)=CHARACTER
000526' 042700 177600 BIC #177600,R0 ;CLEAR ALL BUT CODE BITS
000532' 020027 000015 CMP R0,#15 ;IS CHARACTER CR?
000536' 001402 BEQ OUT ;IF SO, GO TO OUTPUT
000540' 010046 MOV R0,-(SP) ;ELSE PUSH CHARACTER ON STACK
000542' 000764 BR LOOP ;AND RETURN FOR NEXT CHARACTER
000544' 105767 177564 OUT: TSTB PRSTAT ;IS PRINTER READY
000550' 100375 BPL OUT ;IF NOT, KEEP IDLING
000552' 012667 177566 MOV (SP)+,PRDATA ;IF SO, POP NEXT CHARACTER AND PRINT IT
000556' 020627 000500' CMP SP,#START ;IS STACK EMPTY?
000562' 001746 BEQ START ;IF SO, ACCEPT NEW LINE
000564' 000767 BR OUT ;IF NOT, GO ON PRINTING
.END START
Returned from secondpass()
No errors detected
Assembly statistics (words):
Absolute Relocatable
Code 0 187
Reloc. info 0 1
Space used for symbol table: 780 words
Total workspace used: 993 words
Assembly complete
0.000>
I wish the copy would 'copy' the contents like it is on the screen..
Anyway I would Enter a line of Text, followed by a Carriage Return and using the Stack it will Print the line BackWards..
This will test some features of my PDP 11/45 that I have Not Tested before..
THANK YOU Marty
Here is the first program from the book 'Machine and Assembly Language Programming of the PDP 11'..
BCPL 32-bit Cintcode System (30 May 2013)
0.000> TRIPOS PDP-11 Assembler version 1.4
Calling firstpass()
Calling secondpass()
;Title Backward
;Accept a line of characters fron the Teletype and Echo it Backwards.
000000' LC=.
000004' .=4+LC
000004' 000006 000000 000012 .WORD 6,0,12,0 ; INITIALIZE ERROR VECTORS
000012' 000000
000500' .=500+LC
000500' 010706 START: MOV PC,SP ;INITIALIZE SP TO START
000502' 005746 TST -(SP)
;
177560 KBSTAT=177560
177562 KBDATA=177562
177564 PRSTAT=177564
177566 PRDATA=177566
;
000504' 012746 000015 MOV #15,-(SP) ;CR CODE TO STACK
000510' 012746 000012 MOV #12,-(SP) ;LF CODE TO STACK
000514' 105767 177560 LOOP: TSTB KBSTAT ;CHARACTER ENTERED?
000520' 100375 BPL LOOP ;NO KEEP IDLING
000522' 016700 177562 MOV KBDATA,R0 ;(R0)=CHARACTER
000526' 042700 177600 BIC #177600,R0 ;CLEAR ALL BUT CODE BITS
000532' 020027 000015 CMP R0,#15 ;IS CHARACTER CR?
000536' 001402 BEQ OUT ;IF SO, GO TO OUTPUT
000540' 010046 MOV R0,-(SP) ;ELSE PUSH CHARACTER ON STACK
000542' 000764 BR LOOP ;AND RETURN FOR NEXT CHARACTER
000544' 105767 177564 OUT: TSTB PRSTAT ;IS PRINTER READY
000550' 100375 BPL OUT ;IF NOT, KEEP IDLING
000552' 012667 177566 MOV (SP)+,PRDATA ;IF SO, POP NEXT CHARACTER AND PRINT IT
000556' 020627 000500' CMP SP,#START ;IS STACK EMPTY?
000562' 001746 BEQ START ;IF SO, ACCEPT NEW LINE
000564' 000767 BR OUT ;IF NOT, GO ON PRINTING
.END START
Returned from secondpass()
No errors detected
Assembly statistics (words):
Absolute Relocatable
Code 0 187
Reloc. info 0 1
Space used for symbol table: 780 words
Total workspace used: 993 words
Assembly complete
0.000>
I wish the copy would 'copy' the contents like it is on the screen..
Anyway I would Enter a line of Text, followed by a Carriage Return and using the Stack it will Print the line BackWards..
This will test some features of my PDP 11/45 that I have Not Tested before..
THANK YOU Marty