Files
RockOS/programs/vga_text_term/main.c

60 lines
872 B
C
Raw Normal View History

2026-07-16 14:44:08 -05:00
#include "syscall.h"
#include <unistd.h>
2026-07-16 14:44:08 -05:00
#include <sys/video.h>
2026-07-12 04:37:46 -05:00
#define VGA_TEXT_W 80
#define VGA_TEXT_H 25
void term();
int ptys;
int ptym;
2026-07-16 14:44:08 -05:00
fb_info_t fb_info;
void* framebuffer_address;
int terminal_col = 0;
int terminal_row = 0;
void term_write_char(char c) {
}
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("/bin/rocksh.elf");
}
close(ptys);
dup2(ptym, 0);
dup2(0, 1);
dup2(0, 2);
2026-07-16 14:44:08 -05:00
int vga_fd = open("/dev/vga");
if (vga_fd == -1) return 1;
2026-07-16 14:44:08 -05:00
int kbd_fd = open("/dev/kbd");
if (kbd_fd == -1) return 1;
2026-07-16 14:44:08 -05:00
int res = ioctl(vga_fd, FBIOGET_INFO, &fb_info);
if (!res) {
return 1;
2026-07-12 04:37:46 -05:00
}
2026-07-16 14:44:08 -05:00
framebuffer_address = mmap(vga_fd);
2026-07-16 14:44:08 -05:00
return 0;
}