1
0
mirror of https://github.com/aap/pdp6.git synced 2026-01-13 15:27:46 +00:00

fixed tty; implemented ptr

This commit is contained in:
aap 2016-10-19 21:51:58 +02:00
parent 3df4051093
commit bdf5fad41d
6 changed files with 31 additions and 607 deletions

View File

@ -1,4 +1,4 @@
SRC=main.c apr.c mem.c tty.c
SRC=main.c apr.c mem.c tty.c pt.c
# clang
#CFLAGS= -Wno-shift-op-parentheses -Wno-logical-op-parentheses \
# -Wno-bitwise-op-parentheses

10
main.c
View File

@ -678,14 +678,14 @@ mouse(int button, int state, int x, int y)
keys[i].state = 1;
if(buttonstate & 4)
keys[i].state = 2;
if(prevst != keys[i].state){
if(prevst != keys[i].state && apr.sw_power){
switch(i){
case 0: /* start */
case 1: /* cont */
case 3: /* execute, reset */
case 4: /* deposit */
case 5: /* examine */
if(keys[i].state && apr.sw_power)
if(keys[i].state)
tmpextpulse |= EXT_KEY_MANUAL;
break;
case 2: /* stop */
@ -693,6 +693,11 @@ mouse(int button, int state, int x, int y)
tmpextpulse |= EXT_KEY_STOP;
break;
case 6: /* on off reader */
if(keys[i].state == 1) // off
ptr_setmotor(0);
else if(keys[i].state == 2) // on
ptr_setmotor(1);
break;
case 7: /* punch */
break;
}
@ -874,6 +879,7 @@ error:
initmem();
inittty();
initpt();
memset(&apr, 0xff, sizeof apr);
apr.extpulse = 0;

606
mem
View File

@ -14,601 +14,11 @@
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
254200000000
254200000000
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
254000001102
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
777700001000
200740001101
201000001142
260740001114
260740001123
260740001131
201000000012
260740001131
201000000141
260740001131
254200000000
200200000000
200004000000
350000000004
336000000000
263740000000
260740001131
254000001115
712240000000
606000000040
254000001123
712040000000
620000000200
263740000000
712240000001
602040000020
254000001131
435000000200
712140000000
302000000212
263740000000
201000000015
254000001131
141
142
143
0
710600000060
710740000010
254000000021
710440000026
710740000010
254000000024
0
254000000021

2
pdp6.h
View File

@ -300,6 +300,8 @@ extern u8 ioreq[128];
void recalc_req(void);
void inittty(void);
void initpt(void);
void ptr_setmotor(int m);
//void wakepanel(void);

View File

@ -389,7 +389,7 @@ handlestart(void)
* CONSO PTR,10
* JRST .-1
* B: 0
* JRST !
* JRST A
*/
void
save(const char *filename)

16
tty.c
View File

@ -60,13 +60,14 @@ ttythread(void *arg)
listen(sockfd,5);
clilen = sizeof(cli_addr);
pthread_t thread_id;
while(newsockfd = accept(sockfd, (struct sockaddr*)&cli_addr, &clilen)){
printf("TTY attached\n");
tty.fd = newsockfd;
while(n = read(tty.fd, &buf, 1), n > 0){
tty.tti_busy = 1;
//fprintf(stderr, "(got.%c)", buf);
tty.tti = buf|0200;
tty.tti_busy = 0;
tty.tti_flag = 1;
recalc_tty_req();
}
@ -100,8 +101,10 @@ wake_tty(void)
if(tty.tto_flag) iobus0 |= F32;
iobus0 |= tty.pia & 7;
}
if(IOB_DATAI)
apr.ar = tty.tti;
if(IOB_DATAI){
iobus0 |= tty.tti;
tty.tti_flag = 0;
}
if(IOB_CONO_CLEAR)
tty.pia = 0;
if(IOB_CONO_SET){
@ -115,15 +118,18 @@ wake_tty(void)
if(iobus0 & F32) tty.tto_flag = 1;
tty.pia |= iobus0 & 7;
}
if(IOB_DATAO_CLEAR)
if(IOB_DATAO_CLEAR){
tty.tto = 0;
tty.tto_busy = 1;
tty.tto_flag = 0;
}
if(IOB_DATAO_SET){
tty.tto = iobus0 & 0377;
tty.tto_busy = 1;
if(tty.tto & 0200 && tty.fd >= 0){
tty.tto &= ~0200;
write(tty.fd, &tty.tto, 1);
}
// TTO DONE
tty.tto_busy = 0;
tty.tto_flag = 1;
}