/ This is a set of tests accumulated from various places / in handbooks and on the Internet, for simple testing / or demonstration of a PDP-8/E. / Collected or written by Pete Turnbull / / Each main program lives at 0x00 (ie, an even "hundred") / Each variant lives at 0x40 / except this one: the "Initial Operating Test" / from the PDP-8/E Maintenance Manual, Chapter 2 / although here it's at 0040 instead of 0000 0040 7001 ZERO, IAC / increment Accumulator 0041 2051 DELAY, ISZ 0051 / inc 0051 (was 0101), skip if zero 0042 5041 JMP DELAY 0043 5040 JMP ZERO / reads switch register and outputs to console / from Robert Krten 0100 7200 BEG, CLA / setup a zero to get things rolling 0101 6046 TLS / write it to serial port 0102 6041 LOOP, TSF / see if we can output a character 0103 5102 JMP LOOP / nope, loop 0104 7200 CLA / wipe ACC ready to read char 0105 7404 OSR / get switch register 0106 6046 TLS / write it to serial port 0107 5102 JMP LOOP / loop / reads switch register and outputs to 1st TTY 0140 7200 BEG, CLA / setup a zero to get things rolling 0141 6416 TLS / write it to serial port 0142 6411 LOOP, TSF / see if we can output a character 0143 5142 JMP LOOP / nope, loop 0144 7200 CLA / wipe ACC ready to read char 0145 7404 OSR / get switch register 0146 6416 TLS / write it to serial port 0147 5142 JMP LOOP / loop / inchworm view with panel switch set to ACC (8E/F/M) 0200 7200 START, CLA / clear ACC 0201 1213 TAD WORM / put worm character in ACC 0202 7004 MAIN, RAL / push the worm left (7010: right) 0203 7000 DELAY, NOP 0204 7000 NOP 0205 7000 NOP 0206 7000 NOP 0207 2214 ISZ DELCNT / delay 4096 inner 0210 5203 JMP DELAY 0211 5202 JMP MAIN 0212 7402 HLT 0213 0007 WORM, 0007 / 3-bit long inchworm (original is 4-bit) 0214 0000 DELCNT, 0000 / inside loop count / growing column, a variation on inchworm / written by Pete 0240 *0140 / start address 0240 7200 START, CLA / clear ACC 0241 7120 LOOP, STL / set link 0242 7004 RAL / move column left (right: 7010) 0243 7000 DELAY, NOP 0244 7000 NOP 0245 7000 NOP 0246 7000 NOP 0247 2254 ISZ DELCNT / delay 0250 5243 JMP DELAY 0251 7420 SNL / skip if link set - overflow 0252 5241 JMP LOOP 0253 5240 JMP START 0254 0000 DELCNT, 0000 / echos characters typed on console / from the PDP-8/E Maintenance Manual, Chapter 2 / (with two extra setup instructions) 0300 7200 CLA / make a null 0301 6046 TLS / send to tty out to set it up 0302 6032 KCC / clear keyboard flag 0303 6031 INLOOP, KSF / continue if char there 0304 5303 JMP INLOOP / nope, keep looking 0305 6036 KRS / get char 0306 6041 OUTLP, TSF / continue if tty ready 0307 5306 JMP OUTLP / nope, keep waiting 0310 6046 TLS / echo it 0311 5303 JMP INLOOP / repeat / echos characters typed on first TTY 0340 7200 CLA / make a null 0341 6416 TLS / send to tty out to set it up 0342 6402 KCC / clear keyboard flag 0343 6401 INLOOP, KSF / continue if char there 0344 5343 JMP INLOOP / nope, keep looking 0345 6406 KRS / get char 0346 6411 OUTLP, TSF / continue if tty ready 0347 5346 JMP OUTLP / nope, keep waiting 0350 6416 TLS / echo it 0351 5343 JMP INLOOP / repeat / reads console characters, which remain visible in the ACC 0400 7200 CLA / make a null 0401 6032 KCC / clear keyboard flag 0402 6031 LOOP, KSF / continue if char there 0403 5202 JMP .-1 / nope, keep looking 0404 6036 KRS / get char 0405 5202 JMP LOOP / repeat until bored / reads TTY characters, which remain visible in the ACC 0440 7200 CLA / make a null 0441 6402 KCC / clear keyboard flag 0442 6401 LOOP, KSF / continue if char there 0443 5242 JMP .-1 / nope, keep looking 0444 6406 KRS / get char 0445 5242 JMP LOOP / repeat until bored / another one from Robert Krten. / This one flashes the accumulator as it counts 0500 2312 LOOP, ISZ DELAY ; create a delay 0501 5300 JMP LOOP 0502 7200 CLA ; clear AC so we can load it 0503 1313 TAD VALUE ; get value 0504 7421 MQL ; stash AC into MQ 0505 1313 TAD VALUE ; fetch value again 0506 7040 CMA ; complement AC 0507 2313 ISZ VALUE ; get to next value 0510 7000 NOP ; ignore possible "skip" from ISZ 0511 5300 JMP LOOP ; and do it all again 0512 0000 DELAY, 0 0513 0000 VALUE, 0 / cylon - rotates lights in AC back and forth 0540 7200 CLA / clear AC 0541 1353 TAD LIGHT / bit pattern 0542 7004 LOOPL, RAL / push left 0543 4354 JMS DELAY 0544 7420 SNL / skip to RAR if off end 0545 5342 JMP LOOPL 0546 7010 LOOPR, RAR / push right 0547 4354 JMS DELAY 0550 7420 SNL / skip and restart if off end 0551 5346 JMP LOOPR 0552 5342 JMP LOOPL 0553 0007 LIGHT, 0007 / 3 bits long 0554 0000 DELAY, 0000 / for return address 0555 7000 NOP 0556 7000 NOP 0567 7000 NOP 0560 2363 ISZ DELCNT / delay 4096 inner 0561 5355 JMP DELAY+1 0562 5754 JMP I DELAY / return to caller 0563 0000 DELCNT, 0000 / inside loop count / zoom - single bit at each end of AC move together then apart 0600 7200 CLA / set up AC 0601 1217 TAD LEFT / get bit that moves left 0602 1220 TAD RIGHT / include bit that moves right 0603 7000 or 4221 JMS DELAY / wait a while 0604 0217 AND LEFT / ignore right-moving bit 0605 7004 RAL / move left-moving bit along 0606 7430 SZL / if not lost it, nothing extra to do 0607 7004 RAL / otherwise move it to other end of AC 0610 3217 DCA LEFT / save that bit 0611 1220 TAD RIGHT / get the right-moving bit 0612 7010 RAR / like above, but moving right 0613 7430 SZL 0614 7010 RAR 0615 3220 DCA RIGHT 0616 5200 JMP LOOP / and repeat 0617 0001 LEFT, 0001 0620 4000 RIGHT, 4000 0621 0000 DELAY, 0000 / for return address 0622 7000 or 0217 NOP / slower is to AND left then ... 0623 7000 or 1220 NOP / ... TAD right 0624 7000 NOP 0625 2230 ISZ DELCNT / delay 4096 inner 0626 5222 JMP DELAY+1 0627 5621 JMP I DELAY / return to caller 0630 0000 DELCNT, 0000 / inside loop count