1
0
mirror of https://github.com/aap/pdp6.git synced 2026-01-11 23:53:31 +00:00

fixed div shift; added misc files

This commit is contained in:
aap 2016-10-04 20:54:49 +02:00
parent 1452e2c856
commit 01be323fad
10 changed files with 1596 additions and 1 deletions

2
apr.c
View File

@ -926,7 +926,7 @@ pulse(blt_t0){
#define SC_CRY apr->sc += (~apr->sc & SC_DATA) << 1
// 6-7
#define SHC_ASHC (apr->inst == ASHC || apr->nrf2 || apr->faf3)
#define SHC_DIV (IR_DIV || IR_FDV || !apr->nrf2)
#define SHC_DIV ((IR_DIV || IR_FDV) && !apr->nrf2)
#define MS_MULT (apr->mpf1 || apr->fmf2) // 6-24

1329
misc/as6.c Normal file

File diff suppressed because it is too large Load Diff

8
misc/chtest.s Normal file
View File

@ -0,0 +1,8 @@
. = 1000
MOVEI 1,2
HRLI 1,440700
# HRLI 1,010700
# IBP 1
# ILDB 3,1
IDPB 4,1
JRST 4,

21
misc/fptest.s Normal file
View File

@ -0,0 +1,21 @@
. = 1000
# MOVE 0,FP
# FMP 0,FP+4
# FSC 0,1
MOVE 0,DV
# FDV 0,DV+1
FSB 0,DV+1
# FAD 0,DV+1
JRST 4,
FP:
2.0
-1.0
1.5
-1.5
10.0
-10.0
DV:
12.0
4.0

6
misc/hwttest.s Normal file
View File

@ -0,0 +1,6 @@
. = 1000
HLLM 0,BLAH
JRST 4,
BLAH:
333333444444

27
misc/mdtest.s Normal file
View File

@ -0,0 +1,27 @@
. = 1000
# MOVEI 0,3
# MOVEI 1,12
# MUL 1,0
# IMUL 1,0
# MOVE 0,DIVITST
# IDIV 0,DIVITST+1
MOVE 0,DIVTST
MOVE 1,DIVTST+1
DIV 0,DIVTST+2
JRST 4,
DIVITST:
-36
-12
DIVTST:
-1
-7
-3
-1
-6
-3

84
misc/rim2mem.c Normal file
View File

@ -0,0 +1,84 @@
#include <stdio.h>
#include <stdint.h>
typedef uint64_t word;
typedef uint32_t hword;
word mem[1<<18];
hword maxmem, pc;
word
rimword(void)
{
int i, b;
word w;
w = 0;
for(i = 0; i < 6;){
if(b = getchar(), b == EOF)
return ~0;
if(b & 0200){
w = (w << 6) | (b & 077);
i++;
}
}
return w;
}
int
readrim(void)
{
word w, n, sum;
word p;
for(;;){
sum = n = rimword();
if(n == ~0){
fprintf(stderr, "EOF at header\n");
return 0;
}
if((n & 0777000000000) == 0254000000000){
pc = n & 0777777;
break;
}
p = n+1 & 0777777;
for(; n & 0400000000000; n += 01000000){
w = rimword();
if(w == ~0){
fprintf(stderr, "EOF at data\n");
return 0;
}
mem[p++] = w;
sum += w;
}
if(p > maxmem)
maxmem = p;
w = rimword();
if(w == ~0){
fprintf(stderr, "EOF at checksum\n");
return 0;
}
if((sum + w) & 0777777777777){
fprintf(stderr, "checksum error %lo %lo\n", sum, w);
return 0;
}
}
return 1;
}
void
writemem(void)
{
hword i;
for(i = 0; i < maxmem; i++)
printf("%lo\n", mem[i]);
}
int
main()
{
if(readrim()){
writemem();
fprintf(stderr, "pc: %o\n", pc);
return 0;
}
return 1;
}

57
misc/test.s Normal file
View File

@ -0,0 +1,57 @@
APR = 0
PI = 4
PI_RESET = 10000
PI_SET_PIR = 4000
PI_SET_PIO = 2000
PI_CLR_PIO = 1000
PI_CLR_ACT = 400
PI_SET_ACT = 200
. = 40
777777777777
JRST 4,
. = 1000
# CONI PI,1
# CONO PI,PI_RESET
# CONO PI,PI_SET_ACT|PI_SET_PIO|177
# DATAO APR,APR_PR_RLR
# DATAI APR,2
# CONI APR,1
# BLKI APR,TEST
# JRST 4,
# JRST .-2
# MOVE 0,BLTTEST
# BLT 0,BLTSPC+17
# XCT XCTTEST
# UUO04 3,BLAH
# LSH 7,9
# LSH 10,-9
# LSHC 11,6
# LSH 3,3
# LSH 4,-3
# ASH 5,3
# ASH 6,-3
# LSHC 7,3
# LSHC 11,-3
# ASHC 13,3
# ASHC 15,-3
ROT 3,3
ROT 4,-3
ROTC 5,3
ROTC 7,-3
JRST 4,
TEST:
-5,,TEST+1
. = . + 10
XCTTEST:
MOVEI 0,4321
BLTSPC:
. = . + 20
APR_PR_RLR:
321321123123
BLTTEST:
1,,BLTSPC
BLAH:
1234,,4321

2
misc/test2.s Normal file
View File

@ -0,0 +1,2 @@
. = 1000
JRST .

61
misc/ttytest.s Normal file
View File

@ -0,0 +1,61 @@
P=17
TTY=120
PDLLEN=100
.=40
JRST 4,
JRST 4,
.=1000
ENTRY: JRST START
PDL: .=.+PDLLEN
SP: -PDLLEN,,PDL-1
START:
MOVE P,SP
MOVE 0,STR
PUSHJ P,PUTSTR
# PUSHJ P,GETCH
# PUSHJ P,PUTCHR
# MOVEI 0,"\n
# PUSHJ P,PUTCHR
# MOVEI 0,"a
# PUSHJ P,PUTCHR
JRST 4,
PUTSTR:
MOVE 4,0 # save str pointer to AC4
PLOOP:
MOVE 0,(4) # load char
JRST 4,
AOS 4 # advance to next
SKIPN 0 # check for end of string
POPJ P,
PUSHJ P,PUTCHR # print char
JRST PLOOP # next char
GETCH:
CONI TTY,0
TRNN 0,40
JRST .-2
DATAI TTY,0
TRZ 0,200
POPJ P,
PUTCHR:
CONI TTY,1
TRNE 1,20
JRST .-2
IORI 0,200
DATAO TTY,0
CAIE 0,"\n|200
POPJ P,
MOVEI 0,"\r
JRST PUTCHR
STR:
"a
"b
"c