FreeBSD Bugzilla – Attachment 229625 Details for
Bug 259956
[NEW PORT] emulators/vt100: Simulation of VT100 terminal hardware
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
[New Port] emulators/vt100: Simulation of VT100 terminal hardware
0001-New-port-emulators-vt100-Software-simulation-of-the-.patch (text/plain), 8.13 KB, created by
Robert Clausecker
on 2021-11-20 22:59:00 UTC
(
hide
)
Description:
[New Port] emulators/vt100: Simulation of VT100 terminal hardware
Filename:
MIME Type:
Creator:
Robert Clausecker
Created:
2021-11-20 22:59:00 UTC
Size:
8.13 KB
patch
obsolete
>From 5a16e12ba093741fafe713bd0497bc4eef2666f8 Mon Sep 17 00:00:00 2001 >From: Robert Clausecker <fuz@fuz.su> >Date: Sat, 20 Nov 2021 22:26:16 +0100 >Subject: [PATCH] [New port] emulators/vt100: Software simulation of the VT100 > hardware > >This is a software simulation of the VT100 hardware. The original >firmware ROM is built in and executed by an 8080 emulator. Other >components include video display with character generator ROM, settings >NVRAM, Intel 8251 USART, and a keyboard matrix scanner. The Advance >Video Option is not included. > >WWW: https://github.com/larsbrinkhoff/terminal-simulator >--- > emulators/Makefile | 1 + > emulators/vt100/Makefile | 27 ++++++++++++ > emulators/vt100/distinfo | 3 ++ > emulators/vt100/files/patch-main.c | 44 +++++++++++++++++++ > emulators/vt100/files/patch-nvr.c | 68 +++++++++++++++++++++++++++++ > emulators/vt100/files/patch-pty.c | 26 +++++++++++ > emulators/vt100/files/patch-sound.c | 11 +++++ > emulators/vt100/files/patch-vt100.h | 11 +++++ > emulators/vt100/pkg-descr | 7 +++ > 9 files changed, 198 insertions(+) > create mode 100644 emulators/vt100/Makefile > create mode 100644 emulators/vt100/distinfo > create mode 100644 emulators/vt100/files/patch-main.c > create mode 100644 emulators/vt100/files/patch-nvr.c > create mode 100644 emulators/vt100/files/patch-pty.c > create mode 100644 emulators/vt100/files/patch-sound.c > create mode 100644 emulators/vt100/files/patch-vt100.h > create mode 100644 emulators/vt100/pkg-descr > >diff --git a/emulators/Makefile b/emulators/Makefile >index 3f4339edd9cb..be28c1f0f7e9 100644 >--- a/emulators/Makefile >+++ b/emulators/Makefile >@@ -158,6 +158,7 @@ > SUBDIR += vmips > SUBDIR += vmsbackup > SUBDIR += vmw >+ SUBDIR += vt100 > SUBDIR += vxtools > SUBDIR += wine > SUBDIR += wine-devel >diff --git a/emulators/vt100/Makefile b/emulators/vt100/Makefile >new file mode 100644 >index 000000000000..e87501e79978 >--- /dev/null >+++ b/emulators/vt100/Makefile >@@ -0,0 +1,27 @@ >+PORTNAME= vt100 >+DISTVERSION= 0.1 >+CATEGORIES= emulators >+ >+MAINTAINER= fuz@fuz.su >+COMMENT= Simulation of VT100 terminal hardware >+ >+LICENSE= GPLv3 >+LICENSE_FILE= ${WRKSRC:H}/LICENSE >+ >+USES= gl gmake sdl >+USE_GITHUB= yes >+GH_ACCOUNT= larsbrinkhoff >+GH_PROJECT= terminal-simulator >+USE_GL= gl >+USE_SDL= image2 >+WRKSRC_SUBDIR= vt100 >+ >+PLIST_FILES= bin/vt100 >+ >+do-install: >+ ${INSTALL_PROGRAM} ${WRKSRC}/vt100 ${STAGEDIR}${PREFIX}/bin/ >+ >+do-test: >+ cd ${WRKSRC:H} && ${SH} test/test.sh >+ >+.include <bsd.port.mk> >diff --git a/emulators/vt100/distinfo b/emulators/vt100/distinfo >new file mode 100644 >index 000000000000..5dde27056826 >--- /dev/null >+++ b/emulators/vt100/distinfo >@@ -0,0 +1,3 @@ >+TIMESTAMP = 1637415028 >+SHA256 (larsbrinkhoff-terminal-simulator-0.1_GH0.tar.gz) = 17640cc8dbbf8aa4d63a9c40fdcce623d7912ccc6dde7e461401f12297718c7b >+SIZE (larsbrinkhoff-terminal-simulator-0.1_GH0.tar.gz) = 72930080 >diff --git a/emulators/vt100/files/patch-main.c b/emulators/vt100/files/patch-main.c >new file mode 100644 >index 000000000000..5f8a6608b3aa >--- /dev/null >+++ b/emulators/vt100/files/patch-main.c >@@ -0,0 +1,44 @@ >+--- main.c.orig 2021-11-20 13:13:34 UTC >++++ main.c >+@@ -1,6 +1,5 @@ >+ #include "vt100.h" >+ #include "xsdl.h" >+-#define _XOPEN_SOURCE 600 >+ #include <stdlib.h> >+ #include <unistd.h> >+ #include <fcntl.h> >+@@ -116,7 +115,7 @@ usage(void) >+ void help(void) >+ { >+ printf ( >+- "Usage: %s [OPTIONS] command...\n" >++ "Usage: %s [OPTIONS] [command...]\n" >+ "Run command [with arguments] in a hardware-emulated VT100.\n" >+ "\n" >+ " -h Display this help page and exit.\n" >+@@ -144,6 +143,7 @@ int main (int argc, char **argv) >+ int debug = 0; >+ int scale = 1; >+ int opt; >++ char *defaultcommand[2] = { NULL, NULL }; >+ >+ halt = end; >+ sdl_capslock (0x7E); //Default is capslock. >+@@ -187,10 +187,13 @@ int main (int argc, char **argv) >+ } >+ } >+ >+- if (optind == argc && !debug) >+- usage (); >+- >+- cmd = &argv[optind]; >++ if (optind < argc) >++ cmd = &argv[optind]; >++ else { >++ setenv("SHELL", "/bin/sh", 0); >++ defaultcommand[0] = getenv("SHELL"); >++ cmd = defaultcommand; >++ } >+ >+ log_file = stderr; >+ >diff --git a/emulators/vt100/files/patch-nvr.c b/emulators/vt100/files/patch-nvr.c >new file mode 100644 >index 000000000000..284acf43eb85 >--- /dev/null >+++ b/emulators/vt100/files/patch-nvr.c >@@ -0,0 +1,68 @@ >+--- nvr.c.orig 2021-11-20 14:32:08 UTC >++++ nvr.c >+@@ -1,4 +1,7 @@ >++#include <stdlib.h> >++#include <stdio.h> >+ #include <string.h> >++#include <sys/stat.h> >+ #include "vt100.h" >+ >+ //ER1400 device. >+@@ -8,7 +11,36 @@ static u8 nvr_latch; >+ static u32 nvr_addr; >+ static u16 nvr_data; >+ static FILE *f; >++static char *filename = NULL; >++#define NVRAM "vt100-nvram" >+ >++static void setfilename(void) { >++ char *statehome, *home; >++ >++ if (filename != NULL) >++ return; >++ >++ statehome = getenv("XDG_STATE_HOME"); >++ if (statehome != NULL) { >++ asprintf(&filename, "%s/%s", statehome, NVRAM); >++ return; >++ } >++ >++ home = getenv("HOME"); >++ if (home != NULL) { >++ asprintf(&statehome, "%s/.local", home); >++ mkdir(statehome, 0777); >++ free(statehome); >++ asprintf(&statehome, "%s/.local/state", home); >++ mkdir(statehome, 0777); >++ free(statehome); >++ asprintf(&filename, "%s/.local/state/%s", home, NVRAM); >++ return; >++ } >++ >++ filename = NVRAM; >++} >++ >+ static u8 nvr_in (u8 port) >+ { >+ LOG (NVR, "IN"); >+@@ -23,8 +55,9 @@ static void nvr_out (u8 port, u8 data) >+ >+ static void save (int addr) >+ { >++ setfilename(); >+ if (f == NULL) >+- f = fopen ("nvram", "wb"); >++ f = fopen (filename, "wb"); >+ if (f == NULL) >+ return; >+ fseek (f, 2 * addr, SEEK_SET); >+@@ -161,7 +194,8 @@ void reset_nvr (void) >+ register_port (0x62, nvr_in, nvr_out); >+ nvr_data = 0; >+ nvr_addr = 0; >+- f = fopen ("nvram", "r+b"); >++ setfilename(); >++ f = fopen (filename, "r+b"); >+ if (f != NULL) >+ load (); >+ else >diff --git a/emulators/vt100/files/patch-pty.c b/emulators/vt100/files/patch-pty.c >new file mode 100644 >index 000000000000..03177d45fef4 >--- /dev/null >+++ b/emulators/vt100/files/patch-pty.c >@@ -0,0 +1,26 @@ >+--- pty.c.orig 2021-11-20 13:13:34 UTC >++++ pty.c >+@@ -1,6 +1,3 @@ >+-#define _XOPEN_SOURCE 600 >+-#define _DEFAULT_SOURCE >+-#define _DARWIN_C_SOURCE >+ #include <stdlib.h> >+ #include <fcntl.h> >+ #include <unistd.h> >+@@ -151,6 +148,7 @@ static void spawn (char **cmd) >+ close (pty); >+ dup (0); >+ dup (1); >++ ioctl (0, TIOCSCTTY); >+ shell (cmd); >+ } >+ } >+@@ -235,7 +233,7 @@ u8 receive_character (void) >+ while (throttle) >+ SDL_CondWait (cond, lock); >+ SDL_UnlockMutex (lock); >+- if (read (pty, &data, 1) < 0) { >++ if (read (pty, &data, 1) <= 0) { >+ LOG (PTY, "End of file or error from pty."); >+ exit (0); >+ } >diff --git a/emulators/vt100/files/patch-sound.c b/emulators/vt100/files/patch-sound.c >new file mode 100644 >index 000000000000..3f40ede1d8ab >--- /dev/null >+++ b/emulators/vt100/files/patch-sound.c >@@ -0,0 +1,11 @@ >+--- sound.c.orig 2021-11-20 14:06:26 UTC >++++ sound.c >+@@ -3,7 +3,7 @@ >+ #include "xsdl.h" >+ >+ #define FREQUENCY 48000 >+-#define SAMPLES (FREQUENCY * 3520 / 2764800) >++#define SAMPLES 64 >+ >+ int sound_scope; >+ static SDL_AudioDeviceID dev; >diff --git a/emulators/vt100/files/patch-vt100.h b/emulators/vt100/files/patch-vt100.h >new file mode 100644 >index 000000000000..dace71945161 >--- /dev/null >+++ b/emulators/vt100/files/patch-vt100.h >@@ -0,0 +1,11 @@ >+--- vt100.h.orig 2021-11-20 14:08:25 UTC >++++ vt100.h >+@@ -86,7 +86,7 @@ extern void nvr_clock (void); >+ extern void key_down (u8 code); >+ extern void key_up (u8 code); >+ >+-#if 1 >++#if 0 >+ #define LOG(COMPONENT, MESSAGE, ...) \ >+ logger (#COMPONENT, MESSAGE, ##__VA_ARGS__) >+ #else >diff --git a/emulators/vt100/pkg-descr b/emulators/vt100/pkg-descr >new file mode 100644 >index 000000000000..1a8912ace98e >--- /dev/null >+++ b/emulators/vt100/pkg-descr >@@ -0,0 +1,7 @@ >+This is a software simulation of the VT100 hardware. The original >+firmware ROM is built in and executed by an 8080 emulator. Other >+components include video display with character generator ROM, settings >+NVRAM, Intel 8251 USART, and a keyboard matrix scanner. The Advance >+Video Option is not included. >+ >+WWW: https://github.com/larsbrinkhoff/terminal-simulator >-- >2.33.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
fuz
:
maintainer-approval+
Actions:
View
|
Diff
Attachments on
bug 259956
:
229625
|
229626
|
229916