From bdf5fad41d5a2cd5b7cc3ae663e11c2be5dbd30e Mon Sep 17 00:00:00 2001 From: aap Date: Wed, 19 Oct 2016 21:51:58 +0200 Subject: [PATCH] fixed tty; implemented ptr --- Makefile | 2 +- main.c | 10 +- mem | 606 +--------------------------------------------------- pdp6.h | 2 + tools/ld6.c | 2 +- tty.c | 16 +- 6 files changed, 31 insertions(+), 607 deletions(-) diff --git a/Makefile b/Makefile index ff96b21..b89f10f 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/main.c b/main.c index 7ac3e10..b23cbac 100644 --- a/main.c +++ b/main.c @@ -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; diff --git a/mem b/mem index c54e119..487e2b9 100644 --- a/mem +++ b/mem @@ -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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-0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -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 diff --git a/pdp6.h b/pdp6.h index 7c9bdca..64477e6 100644 --- a/pdp6.h +++ b/pdp6.h @@ -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); diff --git a/tools/ld6.c b/tools/ld6.c index 6f6bb3a..b755285 100644 --- a/tools/ld6.c +++ b/tools/ld6.c @@ -389,7 +389,7 @@ handlestart(void) * CONSO PTR,10 * JRST .-1 * B: 0 - * JRST ! + * JRST A */ void save(const char *filename) diff --git a/tty.c b/tty.c index d957517..51dd37b 100644 --- a/tty.c +++ b/tty.c @@ -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; }