mirror of
https://github.com/aap/pdp6.git
synced 2026-02-04 23:55:09 +00:00
lots of additions and changes
This commit is contained in:
11
tools/as6.c
11
tools/as6.c
@@ -1195,8 +1195,8 @@ opline(word w, int io)
|
||||
w |= 0000020000000;
|
||||
w = fw(left(w), right(w)+right(y.val));
|
||||
/* TODO: really warn about this? */
|
||||
if(left(y.val))
|
||||
err(0, "warning: address too large");
|
||||
// if(left(y.val))
|
||||
// err(0, "warning: address too large");
|
||||
w = fw(left(w)+left(x.val), right(w)+right(x.val));
|
||||
if(x.rel)
|
||||
err(0, "warning: X relocation ignored");
|
||||
@@ -1732,9 +1732,9 @@ checkundef(int glob)
|
||||
s->type != Operator && s->type != IoOperator && s->type != Pseudo){
|
||||
unsixbit(s->name, name);
|
||||
if(s->type == Undef){
|
||||
if(glob)
|
||||
s->type |= Extern;
|
||||
else
|
||||
// if(glob)
|
||||
// s->type |= Extern;
|
||||
// else
|
||||
err(1, "undefined symbol: %s\n", name);
|
||||
}
|
||||
}
|
||||
@@ -1909,6 +1909,7 @@ main(int argc, char *argv[])
|
||||
|
||||
|
||||
pass2 = 1;
|
||||
radix = 8;
|
||||
// printf("\n PASS2\n\n");
|
||||
|
||||
startitem(Name);
|
||||
|
||||
111
tools/scon33.c
Normal file
111
tools/scon33.c
Normal file
@@ -0,0 +1,111 @@
|
||||
#define _XOPEN_SOURCE 600 /* for ptys */
|
||||
#define _DEFAULT_SOURCE /* for cfmakeraw */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <fcntl.h>
|
||||
#include <termios.h>
|
||||
#include <unistd.h>
|
||||
#include <poll.h>
|
||||
#include <errno.h>
|
||||
#include <time.h>
|
||||
|
||||
struct termios tiosaved;
|
||||
|
||||
int
|
||||
raw(int fd)
|
||||
{
|
||||
struct termios tio;
|
||||
if(tcgetattr(fd, &tio) < 0) return -1;
|
||||
tiosaved = tio;
|
||||
cfsetispeed(&tio, B110);
|
||||
cfsetospeed(&tio, B110);
|
||||
cfmakeraw(&tio);
|
||||
tio.c_cflag |= CSTOPB;
|
||||
if(tcsetattr(fd, TCSAFLUSH, &tio) < 0) return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
reset(int fd)
|
||||
{
|
||||
if(tcsetattr(0, TCSAFLUSH, &tiosaved) < 0) return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* tty1: unix tty
|
||||
* tty2: serial port */
|
||||
void
|
||||
readwrite(int tty1in, int tty1out, int tty2in, int tty2out)
|
||||
{
|
||||
int n;
|
||||
struct pollfd pfd[2];
|
||||
char c;
|
||||
|
||||
pfd[0].fd = tty2in;
|
||||
pfd[0].events = POLLIN;
|
||||
pfd[1].fd = tty1in;
|
||||
pfd[1].events = POLLIN;
|
||||
while(pfd[0].fd != -1){
|
||||
n = poll(pfd, 2, -1);
|
||||
if(n < 0){
|
||||
perror("error poll");
|
||||
return;
|
||||
}
|
||||
if(n == 0)
|
||||
return;
|
||||
if(pfd[0].revents & POLLHUP)
|
||||
return;
|
||||
/* read from tty2, write to tty1 */
|
||||
if(pfd[0].revents & POLLIN){
|
||||
if(n = read(tty2in, &c, 1), n <= 0)
|
||||
return;
|
||||
else{
|
||||
c &= 0177;
|
||||
//if(c == '\a') c = '.';
|
||||
if(c < 0140)
|
||||
write(tty1out, &c, 1);
|
||||
}
|
||||
}
|
||||
/* read from tty1, write to tty2 */
|
||||
if(pfd[1].revents & POLLIN){
|
||||
if(n = read(tty1in, &c, 1), n <= 0)
|
||||
return;
|
||||
else{
|
||||
if(c == 035)
|
||||
return;
|
||||
/* map character reasonably */
|
||||
if(c == 033) c = 0175; // esc to altmode
|
||||
if(c >= 'a' && c <= 'z') // to upper
|
||||
c &= ~040;
|
||||
c |= 0200; // needed?
|
||||
write(tty2out, &c, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
int fd;
|
||||
|
||||
if(argc < 2)
|
||||
return 1;
|
||||
|
||||
fd = open(argv[1], O_RDWR);
|
||||
if(fd < 0)
|
||||
return 1;
|
||||
|
||||
raw(fd);
|
||||
raw(0);
|
||||
|
||||
readwrite(0, 1, fd, fd);
|
||||
printf("\r\n\r\n");
|
||||
close(fd);
|
||||
|
||||
reset(0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user