Difference between revisions of "PDP-11"

From SizeCoding
Jump to: navigation, search
m (Childishbeat moved page PDP-11 CPUs to PDP-11: Less verbose)
 
(One intermediate revision by one other user not shown)
Line 69: Line 69:
 
=== Learning PDP-11 Assembler ===
 
=== Learning PDP-11 Assembler ===
 
There are a couple of PDP-11 tutorials available online, but most of them are in russian. Here is a basic one:
 
There are a couple of PDP-11 tutorials available online, but most of them are in russian. Here is a basic one:
* http://www.z80.info/lesson1.htm
+
* https://www.chibiakumas.com/pdp11/
  
 
== Electronika BK-0010  ==
 
== Electronika BK-0010  ==

Latest revision as of 09:42, 8 April 2022

Introduction

Wanting to start sizecoding on a PDP-11 platforms like the BK-0010 and BK-0011m in this day and age can be tough, especially if you have not grown up with such a machine.

So here is a bit of help to get you started:

Registers

The PDP-11's registers are ALL 16 bit.

R0, R1, R2, R3, R4 R5 (Often Used to remember the return address during calls) SP (R6), PC (R7) If an Even register number (R0,R2,R4) is used for certain commands (for example MUL)- the register and it's following will be used as a 32 bit pair when the result is returned

Assignment direction is left (source) to right (dest). Default number mode for the PDP-11 is Octal mode (base-8), but there is possible to use other modes as well

mov #777,r0    ; octal =default
mov #^b101,r0  ; binary
mov #^x0aa,r0  ; hexadecimal
mov #'A,r0     ; ascii

Instructions

Here is a rough translation for some of the PDP-11 instructions:

  • MOV src,dest - move source int dest register
  • CLR, CLRB - move zero into register
  • INC/DEC , incb/decb - Increase/decrease register
  • ADD/SUB - Add/Sub in 16 bits
  • ADC/SBC - Add and Subtract in 32 bits
  • MUL - 16 (odd register) or 32 bit (even register) multiplication
  • DIV - 32 bit division
  • ROL/ROR/ASR/ASL - Bit Rol and Shift instructions for 16 bit register
  • ASH/ASHC - Shift 32bit register pair left and right (depending on argument)
  • CALL/RETURN - Call subroutine, return to PC
  • JSR/RTS<reg> - Jump subroutine / Return to address in register
  • BIT - Bit test (can be used for AND)
  • SWAB - Swap bytes in a 16bit register
  • SXT - Sign extend a 16bit register into a 32bit pari
  • COM - Complement register (flip all bit)
  • NEG - Flip all bits and add 1 (negative)
  • XOR - Exclusive OR
  • BIS - Logical OR
  • BIC - Inverse Logical OR (can be used as an AND instruction if performing a COM (bitflip) command first)

Testing and Branching

The PDP-11 has many branch conditions:

  • TST - test register and update flags
  • CMP - compare register
  • BLT - branch if smaller (signed)
  • BGT - branch if greater (signed)
  • BLE - branch if smaller or equal (signed)
  • BLO - branch if smaller (unsigned)
  • BHI - branch if greater (unsigned)
  • BLOS - branch if smaller or equal (unsigned)
  • BHIS - branch if greater or equal (unsigned)
  • BEQ - will branch if Z is set (Branch if EQual)
  • BNE - will branch if Z is not set (Branch if Not Equal)
  • BVS will branch if overflow is set
  • BVC will branch if overflow is clear
  • BMI will branch if the value is negative (minus - N set)
  • BPL will branch if the value is positive (plus - N clear)
  • BCS will Branch if Carry is Set
  • BCC will Branch if Carry is Clear
  • BR - this will ALWAYS branch

Learning PDP-11 Assembler

There are a couple of PDP-11 tutorials available online, but most of them are in russian. Here is a basic one:

Electronika BK-0010

The Electronika BK-0010 is a 16-bit PDP-11-compatible fanless Soviet home computers developed under the Electronika brand by NPO Scientific Center, the leading Soviet microcomputer design team at the time. It was also the predecessor of the more powerful UKNC and DVK micros.

Setting up

Setting up your development platform for the BK-0010/BK-0011m machine works as follows:

Video display

Video display

Memory Map

To be added.

Getting something on screen

Now to get something on screen, lets fill our colorram with a simple AND pattern, like so:

to be added

Sound

To be added.

Small demos with documented source code

Additional Resources

I found resources on BK-0010 sizecoding in english to be sparse.