various changes
10
README.md
@@ -27,11 +27,19 @@ Otherwise you need SDL and pthread.
|
||||
## Running
|
||||
|
||||
The cpu and the console tty are implemented.
|
||||
There are no other external devices yet.
|
||||
The paper tape reader and punch are work in progress,
|
||||
there are no other external devices yet.
|
||||
The only things missing from the cpu are the clock to generate interrupts
|
||||
and the repeat key mechanism.
|
||||
The simulator reads `fmem` and `mem` to initialise the memory and fast memory.
|
||||
|
||||
## File tree
|
||||
|
||||
* `art` has everything graphical
|
||||
* `code` contains some test code for the PDP-6
|
||||
* `misc` contains some misc. and old stuff
|
||||
* `tools` has tools like an assembler and linker
|
||||
|
||||
## To do
|
||||
|
||||
- clock and repeat
|
||||
|
||||
|
Before Width: | Height: | Size: 5.6 KiB After Width: | Height: | Size: 5.6 KiB |
BIN
art/extra_panel.xcf
Normal file
|
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 28 KiB |
BIN
art/ind_panel.xcf
Normal file
BIN
art/key.xcf
Normal file
|
Before Width: | Height: | Size: 614 B After Width: | Height: | Size: 614 B |
|
Before Width: | Height: | Size: 547 B After Width: | Height: | Size: 547 B |
|
Before Width: | Height: | Size: 598 B After Width: | Height: | Size: 598 B |
|
Before Width: | Height: | Size: 280 B After Width: | Height: | Size: 280 B |
|
Before Width: | Height: | Size: 282 B After Width: | Height: | Size: 282 B |
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
3858
art/op_panel.ps
Normal file
3045
art/op_panel.svg
Normal file
|
After Width: | Height: | Size: 1.1 MiB |
BIN
art/op_panel.xcf
Normal file
BIN
art/switch.xcf
Normal file
|
Before Width: | Height: | Size: 355 B After Width: | Height: | Size: 355 B |
|
Before Width: | Height: | Size: 356 B After Width: | Height: | Size: 356 B |
5
code/Makefile
Normal file
@@ -0,0 +1,5 @@
|
||||
test.rim: main.rel tty.rel
|
||||
ld6 -r 100 -o test.rim main.rel tty.rel
|
||||
|
||||
%.rel: %.s
|
||||
as6 -o $@ $<
|
||||
1
code/a.dump
Normal file
@@ -0,0 +1 @@
|
||||
ケ│÷睡<EFBFBD>dケ│=粋<EFBFBD>≠ケ│≠枚<EFBFBD>eケ│<覆ケ│>ケ│≦ケ│≧ケ│∞ケ│∴ケ│♂ケ│♀ケ│°ケ│′ケ│″ケ│℃ケ│¥ケ│$ケ│¢ケ│£ケ│%ケ│#ケ│&ケ│*ケ│@ケ│§ケ│☆ケ│★ケ│○ケ│●ケ│◎ケ│◇ケ│◆ケ│□ケ│■ケ│△ケ│▲ケ│▽ケ│▼ケ│※ケ│〒ケ│→ケ│←ケ│↑ケ│↓ケ│〓ケ│<EFBFBD>ケ│<EFBFBD>ケ│<EFBFBD>ケ│<EFBFBD>ケ│<EFBFBD>ケ│<EFBFBD>ケ│<EFBFBD>ケ│<EFBFBD>ケ│<EFBFBD>ケ│<EFBFBD>ケ│<EFBFBD>ケ│∈ケ│∋ケ│⊆ケ│⊇ケ│⊂ケ│⊃ケ│∪ケ│∩ケ│<EFBFBD>ケ│aケ│bケ│cケ│dソソ<ケ│eケ凍聖│f腹eケ│gケ蔵∋│h<EFBFBD><EFBFBD>柑│i漫<EFBFBD>ケ│j粋<EFBFBD>沙│k枚<EFBFBD>eケ│l粋<EFBFBD>∩ケ│m枚<EFBFBD>eケ│n枚<EFBFBD>eケ│o漫<EFBFBD>覆÷
|
||||
1
code/a.rel
Normal file
@@ -0,0 +1 @@
|
||||
<EFBFBD>÷÷椛$ケ凍枢<EFBFBD>ケ蔵*泛侠<EFBFBD>○ー*泛枚<EFBFBD>腹о<EFBFBD>死操ゥ<EFBFBD>┴ゥ<EFBFBD>柏←<EFBFBD>」ク↑<EFBFBD>サ柏醇」「亰<EFBFBD>「氤шサエ精$<EFBFBD>p園
|
||||
54
code/main.lst
Normal file
@@ -0,0 +1,54 @@
|
||||
|
||||
main.s
|
||||
|
||||
00001 AC0==0
|
||||
00002 AC1==1
|
||||
00003 AC2==2
|
||||
00004 PDP==17
|
||||
00005
|
||||
00006 EXTERNAL PUTC,PUTS
|
||||
00007
|
||||
000000' 254000 000102' 00008 ENTRY: JRST START
|
||||
00009
|
||||
00010 PDL: BLOCK 100
|
||||
000101' 777700 000000' 00011 SP: XWD -100,PDL-1
|
||||
00012
|
||||
00013 START:
|
||||
000102' 200740 000101' 00014 MOVE PDP,SP
|
||||
00015
|
||||
00016 ; MOVEI AC1,110
|
||||
00017 ; PUSHJ PDP,PUTC
|
||||
00018
|
||||
000103' 205100 440700 00019 MOVSI AC2,440700
|
||||
000104' 541100 000107' 00020 HRRI AC2,MSG
|
||||
00021
|
||||
000105' 260740 000000 00022 PUSHJ PDP,PUTS
|
||||
00023
|
||||
00024 ; ILDB AC1,AC2
|
||||
00025 ; SKIPN AC1
|
||||
00026 ; HALT
|
||||
00027 ; PUSHJ PDP,PUTC
|
||||
00028 ; JRST .-4
|
||||
00029
|
||||
000106' 254200 000000 00030 HALT
|
||||
00031
|
||||
000107' 443135 466336 00032 MSG: ASCIZ /Hello, world!/
|
||||
000110' 261016 767744
|
||||
000111' 663104 100000
|
||||
00033 ;yo!/
|
||||
00034
|
||||
00035 END ENTRY
|
||||
|
||||
SYMBOL TABLE
|
||||
|
||||
AC0 000000
|
||||
AC1 000001
|
||||
AC2 000002
|
||||
ENTRY 000000'
|
||||
MSG 000107'
|
||||
PDL 000001'
|
||||
PDP 000017
|
||||
PUTC 000000 EXT
|
||||
PUTS 000105' EXT
|
||||
SP 000101'
|
||||
START 000102'
|
||||
1
code/main.rel
Normal file
@@ -0,0 +1 @@
|
||||
<EFBFBD>÷÷t腹≠÷黒о=ソソ睡<EFBFBD>=姓、〝ャ園∴枚<EFBFBD>枚<EFBFBD>覆、劑ヲウ椁<EFBFBD>セソ、カ刋斡半サエ梶シ逗<EFBFBD>噫ююゥ<EFBFBD>┴ゥ<EFBFBD>柏←<EFBFBD>」クi泄吹クアェ刈オ≧アェ苅逗叶キョィ∴刈コ焚↑<EFBFBD>サ柏準槍イ」「亰イ」「氤≦感セ<EFBFBD>=慣ァス<EFBFBD>≠〝$<EFBFBD>p″
|
||||
29
code/main.s
Normal file
@@ -0,0 +1,29 @@
|
||||
AC0==0
|
||||
AC1==1
|
||||
AC2==2
|
||||
PDP==17
|
||||
|
||||
EXTERNAL PUTC,PUTS
|
||||
EXTERNAL GETCH,GETC
|
||||
|
||||
ENTRY: JRST START
|
||||
|
||||
PDL: BLOCK 100
|
||||
SP: XWD -100,PDL-1
|
||||
|
||||
START:
|
||||
MOVE PDP,SP
|
||||
|
||||
MOVSI AC2,440700
|
||||
HRRI AC2,MSG
|
||||
PUSHJ PDP,PUTS
|
||||
|
||||
PUSHJ PDP,GETC
|
||||
; JRST .-1
|
||||
|
||||
HALT
|
||||
|
||||
MSG: ASCIZ /Hello, world!
|
||||
yo! > /
|
||||
|
||||
END ENTRY
|
||||
0
code/ptp.out
Normal file
1
code/test.rim
Normal file
@@ -0,0 +1 @@
|
||||
ケ│÷腹bケ│=ケ│≠ケ│<ケ│>ケ│≦ケ│≧ケ│∞ケ│∴ケ│♂ケ│♀ケ│°ケ│′ケ│″ケ│℃ケ│¥ケ│$ケ│¢ケ│£ケ│%ケ│#ケ│&ケ│*ケ│@ケ│§ケ│☆ケ│★ケ│○ケ│●ケ│◎ケ│◇ケ│◆ケ│□ケ│■ケ│△ケ│▲ケ│▽ケ│▼ケ│※ケ│〒ケ│→ケ│←ケ│↑ケ│↓ケ│〓ケ│<EFBFBD>ケ│<EFBFBD>ケ│<EFBFBD>ケ│<EFBFBD>ケ│<EFBFBD>ケ│<EFBFBD>ケ│<EFBFBD>ケ│<EFBFBD>ケ│<EFBFBD>ケ│<EFBFBD>ケ│<EFBFBD>ケ│∈ケ│∋ケ│⊆ケ│⊇ケ│⊂ケ│⊃ケ│∪ケ│∩ケ│<EFBFBD>ケ│aソソ÷ケ│b睡<EFBFBD>aケ│c姓、〝ケ│dャ園hケ│e枚<EFBFBD>qケ│f枚<EFBFBD><EFBFBD>ケ│g覆ケ│h、劑ヲウ椹│i毎疾ソ、ケ│jカ刋斡隼│kシサエ梶シケ│l逗ケ│mケ凍聖│n腹mケ│oケ蔵∋│p漫<EFBFBD>ケ│q侠<EFBFBD>せ│r峅∋│s漫<EFBFBD>ケ│t枚<EFBFBD>mケ│u腹qケ│vケ蕩mケ│w腹vケ│xケ摺∋│y<EFBFBD>ィ<EFBFBD>∩ケ│z漫<EFBFBD>ケ│<EFBFBD>枚<EFBFBD>vケ│<EFBFBD>枚<EFBFBD>mケ│<EFBFBD>漫<EFBFBD>覆÷
|
||||
41
code/tty.lst
Normal file
@@ -0,0 +1,41 @@
|
||||
|
||||
tty.s
|
||||
|
||||
00001 TTY=120
|
||||
00002
|
||||
00003 AC0==0
|
||||
00004 AC1==1
|
||||
00005 AC2==1
|
||||
00006 PDP==17
|
||||
00007
|
||||
00008 INTERNAL PUTC,PUTS
|
||||
00009
|
||||
00010 PUTC:
|
||||
000000' 712300 000020 00011 CONSZ TTY,20 ; wait until not busy
|
||||
000001' 254000 000000' 00012 JRST .-1
|
||||
000002' 712140 000001 00013 DATAO TTY,AC1 ; transfer character
|
||||
00014 ; CAIE AC1,12 ; return unless LF
|
||||
00015 ; POPJ PDP,
|
||||
00016 ; MOVEI AC1,15 ; put CR and two DEL
|
||||
00017 ; PUSHJ PDP,PUTC
|
||||
00018 ; MOVEI AC1,177
|
||||
00019 ; PUSHJ PDP,PUTC
|
||||
00020 ; PUSHJ PDP,PUTC
|
||||
000003' 263740 000000 00021 POPJ PDP,
|
||||
00022
|
||||
00023 PUTS:
|
||||
000004' 134040 000001 00024 ILDB AC1,AC2
|
||||
000005' 336000 000001 00025 SKIPN AC1
|
||||
000006' 263740 000000 00026 POPJ PDP,
|
||||
000007' 260740 000000' 00027 PUSHJ PDP,PUTC
|
||||
000010' 254000 000004' 00028 JRST PUTS
|
||||
|
||||
SYMBOL TABLE
|
||||
|
||||
AC0 000000
|
||||
AC1 000001
|
||||
AC2 000001
|
||||
PDP 000017
|
||||
PUTC 000000' INT
|
||||
PUTS 000004' INT
|
||||
TTY 000120
|
||||
1
code/tty.rel
Normal file
@@ -0,0 +1 @@
|
||||
<EFBFBD>÷÷酎¢楳ケ凍枢<EFBFBD>ケ蔵*泛侠<EFBFBD><EFBFBD>ー*泛枚<EFBFBD>腹┿蕩<EFBFBD>腹音摺□ィ<EFBFBD>∩漫<EFBFBD>枚<EFBFBD>塩<EFBFBD>漫<EFBFBD><EFBFBD>逐ююゥ<EFBFBD>┴ゥ<EFBFBD>柏←<EFBFBD>」クeェ刈オ糸ェ苅逗岡<EFBFBD>サ柏醇」「亰<EFBFBD>「氤шサエ精$<EFBFBD>p操
|
||||
42
code/tty.s
Normal file
@@ -0,0 +1,42 @@
|
||||
TTY=120
|
||||
|
||||
AC0==0
|
||||
AC1==1
|
||||
AC2==2
|
||||
PDP==17
|
||||
|
||||
INTERNAL PUTC,PUTS
|
||||
|
||||
PUTC:
|
||||
CONSZ TTY,20 ; wait until not busy
|
||||
JRST .-1
|
||||
DATAO TTY,AC1 ; transfer character
|
||||
; CAIE AC1,12 ; return unless LF
|
||||
; POPJ PDP,
|
||||
; MOVEI AC1,15 ; put CR and two DEL
|
||||
; PUSHJ PDP,PUTC
|
||||
; MOVEI AC1,177
|
||||
; PUSHJ PDP,PUTC
|
||||
; PUSHJ PDP,PUTC
|
||||
POPJ PDP,
|
||||
|
||||
PUTS:
|
||||
ILDB AC1,AC2
|
||||
SKIPN AC1
|
||||
POPJ PDP,
|
||||
PUSHJ PDP,PUTC
|
||||
JRST PUTS
|
||||
|
||||
INTERNAL GETCH,GETC
|
||||
|
||||
GETCH:
|
||||
CONSO TTY,40 ; wait for flag
|
||||
JRST .-1
|
||||
DATAI TTY,AC1 ; get character
|
||||
ANDI AC1,177
|
||||
POPJ PDP,
|
||||
|
||||
GETC:
|
||||
PUSHJ PDP,GETCH
|
||||
PUSHJ PDP,PUTC
|
||||
POPJ PDP,
|
||||
22
main.c
@@ -742,8 +742,6 @@ main(int argc, char *argv[])
|
||||
// void testinst(Apr*);
|
||||
// testinst(&apr);
|
||||
|
||||
debugfp = stdout;
|
||||
|
||||
outfile = "/dev/null";
|
||||
ARGBEGIN{
|
||||
case 't':
|
||||
@@ -774,55 +772,55 @@ error:
|
||||
return 1;
|
||||
}
|
||||
|
||||
op_surf = IMG_Load("op_panel.png");
|
||||
op_surf = IMG_Load("art/op_panel.png");
|
||||
if(op_surf == NULL){
|
||||
fprintf(stderr, "Couldn't load op_panel.png\n");
|
||||
return 1;
|
||||
}
|
||||
ind_surf = IMG_Load("ind_panel.png");
|
||||
ind_surf = IMG_Load("art/ind_panel.png");
|
||||
if(ind_surf == NULL){
|
||||
fprintf(stderr, "Couldn't load ind_panel.png\n");
|
||||
return 1;
|
||||
}
|
||||
extra_surf = IMG_Load("extra_panel.png");
|
||||
extra_surf = IMG_Load("art/extra_panel.png");
|
||||
if(extra_surf == NULL){
|
||||
fprintf(stderr, "Couldn't load extra_panel.png\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
keysurf[0] = IMG_Load("key_n.png");
|
||||
keysurf[0] = IMG_Load("art/key_n.png");
|
||||
if(keysurf[0] == NULL){
|
||||
fprintf(stderr, "Couldn't load key_n.png\n");
|
||||
return 1;
|
||||
}
|
||||
keysurf[1] = IMG_Load("key_d.png");
|
||||
keysurf[1] = IMG_Load("art/key_d.png");
|
||||
if(keysurf[1] == NULL){
|
||||
fprintf(stderr, "Couldn't load key_d.png\n");
|
||||
return 1;
|
||||
}
|
||||
keysurf[2] = IMG_Load("key_u.png");
|
||||
keysurf[2] = IMG_Load("art/key_u.png");
|
||||
if(keysurf[2] == NULL){
|
||||
fprintf(stderr, "Couldn't load key_u.png\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
lampsurf[0] = IMG_Load("lamp_off.png");
|
||||
lampsurf[0] = IMG_Load("art/lamp_off.png");
|
||||
if(lampsurf[0] == NULL){
|
||||
fprintf(stderr, "Couldn't load lamp_off.png\n");
|
||||
return 1;
|
||||
}
|
||||
lampsurf[1] = IMG_Load("lamp_on.png");
|
||||
lampsurf[1] = IMG_Load("art/lamp_on.png");
|
||||
if(lampsurf[1] == NULL){
|
||||
fprintf(stderr, "Couldn't load lamp_on.png\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
switchsurf[0] = IMG_Load("switch_d.png");
|
||||
switchsurf[0] = IMG_Load("art/switch_d.png");
|
||||
if(switchsurf[0] == NULL){
|
||||
fprintf(stderr, "Couldn't load switch_d.png\n");
|
||||
return 1;
|
||||
}
|
||||
switchsurf[1] = IMG_Load("switch_u.png");
|
||||
switchsurf[1] = IMG_Load("art/switch_u.png");
|
||||
if(switchsurf[1] == NULL){
|
||||
fprintf(stderr, "Couldn't load switch_u.png\n");
|
||||
return 1;
|
||||
|
||||
192
pt.c
Normal file
@@ -0,0 +1,192 @@
|
||||
#include "pdp6.h"
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <pthread.h>
|
||||
#include <poll.h>
|
||||
|
||||
/*
|
||||
* These device are not modeled accurately after the schematics.
|
||||
*/
|
||||
|
||||
#define PTP (0100>>2)
|
||||
#define PTR (0104>>2)
|
||||
|
||||
typedef struct Ptp Ptp;
|
||||
struct Ptp
|
||||
{
|
||||
FILE *fp;
|
||||
uchar ptp;
|
||||
bool busy, flag, b;
|
||||
int pia;
|
||||
};
|
||||
Ptp ptp;
|
||||
|
||||
typedef struct Ptr Ptr;
|
||||
struct Ptr
|
||||
{
|
||||
FILE *fp;
|
||||
int motor_on;
|
||||
word sr;
|
||||
word ptr;
|
||||
bool busy, flag, b;
|
||||
int pia;
|
||||
};
|
||||
Ptr ptr;
|
||||
|
||||
void
|
||||
recalc_ptp_req(void)
|
||||
{
|
||||
u8 req;
|
||||
req = ptp.flag ? ptp.pia : 0;
|
||||
if(req != ioreq[PTP]){
|
||||
ioreq[PTP] = req;
|
||||
recalc_req();
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
wake_ptp(void)
|
||||
{
|
||||
if(IOB_RESET || IOB_CONO_CLEAR){
|
||||
ptp.pia = 0;
|
||||
ptp.busy = 0;
|
||||
ptp.flag = 0;
|
||||
ptp.b = 0;
|
||||
ioreq[PTP] = 0;
|
||||
}
|
||||
if(IOB_STATUS){
|
||||
if(ptp.b) iobus0 |= F30;
|
||||
if(ptp.busy) iobus0 |= F31;
|
||||
if(ptp.flag) iobus0 |= F32;
|
||||
iobus0 |= ptp.pia & 7;
|
||||
}
|
||||
if(IOB_CONO_SET){
|
||||
if(iobus0 & F30) ptp.b = 1;
|
||||
if(iobus0 & F31) ptp.busy = 1;
|
||||
if(iobus0 & F32) ptp.flag = 1;
|
||||
ptp.pia |= iobus0 & 7;
|
||||
}
|
||||
if(IOB_DATAO_CLEAR){
|
||||
ptp.ptp = 0;
|
||||
ptp.busy = 1;
|
||||
ptp.flag = 0;
|
||||
}
|
||||
if(IOB_DATAO_SET){
|
||||
ptp.ptp = iobus0 & 0377;
|
||||
if(ptp.b)
|
||||
putc((ptp.ptp & 077) | 0200, ptp.fp);
|
||||
else
|
||||
putc(ptp.ptp, ptp.fp);
|
||||
ptp.busy = 0;
|
||||
ptp.flag = 1;
|
||||
}
|
||||
recalc_ptp_req();
|
||||
}
|
||||
|
||||
void
|
||||
recalc_ptr_req(void)
|
||||
{
|
||||
u8 req;
|
||||
req = ptr.flag ? ptr.pia : 0;
|
||||
if(req != ioreq[PTR]){
|
||||
ioreq[PTR] = req;
|
||||
recalc_req();
|
||||
}
|
||||
}
|
||||
|
||||
void*
|
||||
ptrthread(void *arg)
|
||||
{
|
||||
int c;
|
||||
for(;;){
|
||||
if(ptr.busy && ptr.motor_on){
|
||||
// PTR CLR
|
||||
ptr.sr = 0;
|
||||
ptr.ptr = 0;
|
||||
|
||||
next:
|
||||
c = getc(ptr.fp);
|
||||
if(c == EOF){
|
||||
ptr.busy = 0;
|
||||
continue;
|
||||
}
|
||||
if(!ptr.b || c & 0200){
|
||||
// PTR STROBE
|
||||
ptr.sr <<= 1;
|
||||
ptr.ptr <<= 6;
|
||||
ptr.sr |= 1;
|
||||
ptr.ptr |= c & 077;
|
||||
if(!ptr.b)
|
||||
ptr.ptr |= c & 0300;
|
||||
}
|
||||
if(!ptr.b || ptr.sr & 040){
|
||||
ptr.busy = 0;
|
||||
ptr.flag = 1;
|
||||
}else
|
||||
goto next;
|
||||
recalc_ptr_req();
|
||||
}
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
static void
|
||||
wake_ptr(void)
|
||||
{
|
||||
if(IOB_RESET || IOB_CONO_CLEAR){
|
||||
ptr.pia = 0;
|
||||
ptr.busy = 0;
|
||||
ptr.flag = 0;
|
||||
ptr.b = 0;
|
||||
ioreq[PTR] = 0;
|
||||
}
|
||||
if(IOB_STATUS){
|
||||
if(ptr.motor_on) iobus0 |= F27;
|
||||
if(ptr.b) iobus0 |= F30;
|
||||
if(ptr.busy) iobus0 |= F31;
|
||||
if(ptr.flag) iobus0 |= F32;
|
||||
iobus0 |= ptr.pia & 7;
|
||||
}
|
||||
if(IOB_DATAI){
|
||||
iobus0 |= ptr.ptr;
|
||||
ptr.flag = 0;
|
||||
// actually when DATAI is negated again
|
||||
ptr.busy = 1;
|
||||
}
|
||||
if(IOB_CONO_SET){
|
||||
if(iobus0 & F30) ptr.b = 1;
|
||||
if(iobus0 & F31) ptr.busy = 1;
|
||||
if(iobus0 & F32) ptr.flag = 1;
|
||||
ptr.pia |= iobus0 & 7;
|
||||
}
|
||||
recalc_ptr_req();
|
||||
}
|
||||
|
||||
void
|
||||
ptr_setmotor(int m)
|
||||
{
|
||||
if(ptr.motor_on == m)
|
||||
return;
|
||||
ptr.motor_on = m;
|
||||
if(ptr.motor_on)
|
||||
ptr.busy = 0;
|
||||
ptr.flag = 1;
|
||||
recalc_ptr_req();
|
||||
}
|
||||
|
||||
void
|
||||
initpt(void)
|
||||
{
|
||||
pthread_t thread_id;
|
||||
ioreq[PTP] = 0;
|
||||
iobusmap[PTP] = wake_ptp;
|
||||
ioreq[PTR] = 0;
|
||||
iobusmap[PTR] = wake_ptr;
|
||||
pthread_create(&thread_id, nil, ptrthread, nil);
|
||||
|
||||
ptr.fp = fopen("code/test.rim", "rb");
|
||||
ptp.fp = fopen("code/ptp.out", "wb");
|
||||
}
|
||||
8
tools/Makefile
Normal file
@@ -0,0 +1,8 @@
|
||||
all: as6 ld6 ptdump
|
||||
|
||||
as6: as6.c pdp6common.c
|
||||
cc -g as6.c pdp6common.c -o as6
|
||||
ld6: ld6.c pdp6common.c
|
||||
cc -g ld6.c pdp6common.c -o ld6
|
||||
ptdump: ptdump.c pdp6common.c
|
||||
cc -g ptdump.c pdp6common.c -o ptdump
|
||||
78
tools/as6.c
@@ -275,10 +275,10 @@ putv(word w, int rel)
|
||||
}
|
||||
putword(w, rel);
|
||||
}else{
|
||||
printf("\t%06o%c\t%06o%c%06o%c\n",
|
||||
right(dot->v.val), dot->v.rel ? '\'' : ' ',
|
||||
left(w), rel & 2 ? '\'' : ' ',
|
||||
right(w), rel & 1 ? '\'' : ' ');
|
||||
// printf("\t%06o%c\t%06o%c%06o%c\n",
|
||||
// right(dot->v.val), dot->v.rel ? '\'' : ' ',
|
||||
// left(w), rel & 2 ? '\'' : ' ',
|
||||
// right(w), rel & 1 ? '\'' : ' ');
|
||||
}
|
||||
lastdot = dot->v;
|
||||
dot->v.val++;
|
||||
@@ -1041,21 +1041,35 @@ ascii(void)
|
||||
}
|
||||
w = 0;
|
||||
i = 0;
|
||||
for(; *lp && *lp != delim; lp++){
|
||||
for(; *lp != delim; lp++){
|
||||
/* This is a hack since LF is not part of the line
|
||||
* but we have to output it in multiline strings */
|
||||
if(*lp == '\0')
|
||||
*lp = '\n';
|
||||
|
||||
w = (w<<7) | *lp;
|
||||
if(++i == 5){
|
||||
w <<= 1;
|
||||
putv(w, 0);
|
||||
i = 0;
|
||||
w = 0;
|
||||
}
|
||||
|
||||
/* load the next line when we recognized EOL earlier */
|
||||
if(*lp == '\n'){
|
||||
lp = getln();
|
||||
if(lp == nil){
|
||||
err(1, "error: unexpected EOF");
|
||||
break;
|
||||
}
|
||||
lp--;
|
||||
}
|
||||
}
|
||||
if(*lp != delim)
|
||||
err(1, "error: '%c' expected", delim);
|
||||
if(asciiz){
|
||||
i++;
|
||||
w <<= 7;
|
||||
}
|
||||
w <<= 35-i*7;
|
||||
w <<= 36-i*7;
|
||||
if(w || asciiz)
|
||||
putv(w, 0);
|
||||
}
|
||||
@@ -1104,14 +1118,6 @@ sixbitOp(void)
|
||||
putv(w, 0);
|
||||
}
|
||||
|
||||
void
|
||||
endOp(void)
|
||||
{
|
||||
skipwhite();
|
||||
start = expr(2, nil);
|
||||
hadstart = 1;
|
||||
}
|
||||
|
||||
void
|
||||
radixOp(void)
|
||||
{
|
||||
@@ -1131,6 +1137,26 @@ radixOp(void)
|
||||
radix = v.val;
|
||||
}
|
||||
|
||||
void
|
||||
blockOp(void)
|
||||
{
|
||||
Value v;
|
||||
skipwhite();
|
||||
v = expr(1, nil);
|
||||
if(v.rel)
|
||||
err(1, "error: non-absolute block size");
|
||||
else
|
||||
dot->v.val += v.val;
|
||||
}
|
||||
|
||||
void
|
||||
endOp(void)
|
||||
{
|
||||
skipwhite();
|
||||
start = expr(2, nil);
|
||||
hadstart = 1;
|
||||
}
|
||||
|
||||
void
|
||||
statement(void)
|
||||
{
|
||||
@@ -1240,7 +1266,7 @@ void
|
||||
resetdot(void)
|
||||
{
|
||||
dot = getsym(sixbit("."));
|
||||
dot->type = Local | Hide;
|
||||
dot->type = Local | Def | Hide;
|
||||
absdot = (Value){ 0, 0 };
|
||||
reldot = (Value){ 0, 1 };
|
||||
dot->v = reldot;
|
||||
@@ -1359,17 +1385,24 @@ usage(void)
|
||||
|
||||
void initsymtab(void);
|
||||
|
||||
char *outfile = "a.rel";
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
int i;
|
||||
char *outfile;
|
||||
char *lstfile;
|
||||
|
||||
|
||||
outfile = "a.rel";
|
||||
lstfile = "/dev/null";
|
||||
|
||||
ARGBEGIN{
|
||||
case 'o':
|
||||
outfile = EARGF(usage());
|
||||
break;
|
||||
case 'l':
|
||||
lstfile = EARGF(usage());
|
||||
break;
|
||||
default:
|
||||
usage();
|
||||
break;
|
||||
@@ -1440,13 +1473,13 @@ main(int argc, char *argv[])
|
||||
if(error & 1)
|
||||
panic("Error\n*****");
|
||||
|
||||
lstfp = mustopen("a.lst", "w");
|
||||
lstfp = mustopen(lstfile, "w");
|
||||
relfp = mustopen(outfile, "w");
|
||||
tmpfp = mustopen("a.tmp", "r");
|
||||
|
||||
resetdot();
|
||||
pass2 = 1;
|
||||
printf("\n PASS2\n\n");
|
||||
// printf("\n PASS2\n\n");
|
||||
|
||||
startitem(Name);
|
||||
putword(rad50(0, progtitle), 0);
|
||||
@@ -1526,6 +1559,7 @@ Ps pslist[] = {
|
||||
{ "ASCIZ", asciz },
|
||||
{ "SIXBIT", sixbitOp },
|
||||
{ "RADIX", radixOp },
|
||||
{ "BLOCK", blockOp },
|
||||
{ "END", endOp },
|
||||
/*
|
||||
" '
|
||||
@@ -1538,8 +1572,6 @@ Ps pslist[] = {
|
||||
IOWD
|
||||
INTEGER
|
||||
ARRAY
|
||||
BLOCK
|
||||
END
|
||||
LIT
|
||||
ENTRY
|
||||
OPDEF
|
||||
|
||||
10
tools/ld6.c
@@ -392,7 +392,7 @@ handlestart(void)
|
||||
* JRST A
|
||||
*/
|
||||
void
|
||||
save(const char *filename)
|
||||
saverim(const char *filename)
|
||||
{
|
||||
FILE *out;
|
||||
hword i;
|
||||
@@ -419,6 +419,7 @@ main(int argc, char *argv[])
|
||||
word w;
|
||||
hword type;
|
||||
int i;
|
||||
char *outfile;
|
||||
void (*typesw[8])(void) = {
|
||||
skipitem,
|
||||
handlecode,
|
||||
@@ -430,10 +431,15 @@ main(int argc, char *argv[])
|
||||
handlestart,
|
||||
};
|
||||
|
||||
outfile = "a.rim";
|
||||
|
||||
ARGBEGIN{
|
||||
case 'r':
|
||||
rel = strtol(EARGF(usage()), NULL, 8);
|
||||
break;
|
||||
case 'o':
|
||||
outfile = EARGF(usage());
|
||||
break;
|
||||
default:
|
||||
usage();
|
||||
}ARGEND;
|
||||
@@ -468,7 +474,7 @@ main(int argc, char *argv[])
|
||||
// disasmrange(0600+rel, 0603+rel);
|
||||
// disasmrange(0200+rel, 0212+rel);
|
||||
|
||||
save("a.dump");
|
||||
saverim(outfile);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||