almost got the term emu working and shell

This commit is contained in:
2026-07-08 21:15:30 -05:00
parent ec3cbb4794
commit 4d98d73f5e
20 changed files with 214 additions and 228 deletions

View File

@@ -1,5 +1,44 @@
#include <stdio.h>
#include <unistd.h>
void term();
int ptys;
int ptym;
int main(int argc, char *argv[]) {
(void)argc;
(void)argv;
ptym = pty(&ptys);
if (fork() == 0) {
close(ptym);
dup2(ptys, 0);
dup2(0, 1);
dup2(0, 2);
exec("/rocksh.elf");
}
close(ptys);
dup2(ptym, 0);
dup2(0, 1);
dup2(0, 2);
term();
return 0;
}
void term() {
int vga_fd = open("/dev/tvga");
if (vga_fd == -1) return;
while (1) {
char c;
int rd = read(0, &c, 1);
if (rd > 0) {
write(vga_fd, &c, 1);
}
}
}