Hey guys,

Holy schnikes, I forgot!  I already *DID* implement a "-nogui" mode to VirtualT!!  And it seems to resolve the thread deadlock issue.  But since VirtualT uses the console for I/O after launcing, running it in the background requires redirecting stdin / stdout to /dev/null (on Linux, would have to investigate Windows):

ken@andromeda$ ./virtualt -nogui < /dev/null > /dev/null &
[1] 293192
ken@andromeda$ telnet localhost 2023
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
cold_boot
Ok> load count.ba
Ok> sd
Jan 01,2025 Wed 00:00:04   VirtualT 1.8
 BASIC     TEXT      TELCOM    ADDRSS
 SCHEDL    COUNT.BA  -.-       -.-
 -.-       -.-       -.-       -.-
 -.-       -.-       -.-       -.-
 -.-       -.-       -.-       -.-
 -.-       -.-       -.-       -.-
Select: _              29620 Bytes free
Ok> key left cr
Ok> sd
 1
 2
 3
 4
 5
Ok


Ok> key "list" cr
Ok> sd
 3
 4
 5
Ok
list
10 FORX=1TO5:PRINTX:NEXT
Ok

Ok> quit
Thank you for contacting VirtualT v1.8.  Bye.
Connection closed by foreign host.

Ken

On 12/22/25 9:56 PM, Kenneth Pettit wrote:
It has to be enabled from the Tools->Socket Configuration menu item.  I am runnintg it with port 2023 and "Telnet mode" disabled.

As far as the thread deadlock, I'm not sure.  It seems maybe as long as I am only using the telnet port, there is no issue.  It is even possible to "load" programs or "kill" them and even "terminate" will cause VirtualT to shutdown.  At one point I was thinking of adding an option to launch VirtualT in headless mode where you only use the telnet / socket interface and don't even have / need the the GUI.  But that's a fair amount of work.

If you want to try it, it *might* work on Windows as is (I don't know, haven't used Windows for 15 years or so).  On linux in src/remote.cpp I had to add code to strip any trailing \r\n in the process command function prior to assigning to 'cmd' variable, then it started working:

std::string process_command(ServerSocket& sock, char *sockdata, int len,
        int console=FALSE)
{
   ...

    while (sockdata[len-1] == '\r' || sockdata[len-1] == '\n')
        sockdata[--len] = 0;

    std::string cmd = sockdata;
   ...
}

Ken

On 12/22/25 9:38 PM, B9 wrote:
Whoa, that's cool! The telnet daemon runs automatically with Virtual-T?

For the threads/deadlock issue, does it work reliably as long as no operator is at the graphical console?

--b9


On December 22, 2025 7:15:30 PM PST, Kenneth Pettit <[email protected]> wrote:

    Seems my VirtualT socket interface issue was mostly just \r\n
    line ending issues (though "telnet mode" still not working for
    some reason).  But there also seems to be some tread dealock
    issues lurking somewhere because sometimes the LCD gets some junk
    on it and X prints errors like below, and then VirtualT hangs
    (most likely on a semaphore wait that's in a deadlock)
    X_ChangeGC: BadPixmap (invalid Pixmap parameter) 0x0
    X_GetWindowAttributes: BadLength (poly request too large or
    internal Xlib length error) 0x0 X_GetInputFocus: BadLength (poly
    request too large or internal Xlib length error) 0x0
    X_GetWindowAttributes: BadLength (poly request too large or
    internal Xlib length error) 0x0
    ------------------------------------------------------------------------
    Example run (this could be turned into an agentic workflow once
    deadlock is resolved)
    ------------------------------------------------------------------------
    (Launch VirtualT in another Linux terminal)... ken@andromeda#
    telnet localhost 2023 Trying 127.0.0.1... Connected to localhost.
    Escape character is '^]'. help Help
    ------------------------------------------------------------------------
      bye   clear_break(cb) address   cold_boot   debug_isr(isr) [on
    off]   dis address [lines]   exit   flags [all S Z ac P=1 s=0
    ...]   halt   in port   key(k) [enter cr f1 esc ctrl+c
    shift+code+a "Text" ...]   kill filename   lcd_ignore(li) [none
    (row,col)-(row,col)]   lcd_mon(lm) [on off]   list_break(lb)  
    load filename   model [m10 m102 t200 pc8201 m10 kc85]   optrom
    [unload, filename]   out port, value   radix [10 or 16]  
    read_mem(rm) address [count]   read_reg(rr) [all A B h m DE ...]
      read_rex   reset   run   screen_dump(sd)   set_break(sb)
    address [main opt mplan ram ram2 ram3 read write]   speed [2.4
    friendly max]   status   step(s) [count]   step_over(so) [count]
      string address   terminate   write_mem(wm) address [data data
    data ...]   write_reg(wr) [A=xx B=xx hl=xx ...]   x [lines]
    (short for "dis pc") Ok> speed 2.4 Ok> speed max Ok> speed max
    (484.971 Mhz) Ok> screen_dump Dec 22,2025 Mon 19:02:21   VirtualT
    1.8  BASIC     TEXT      TELCOM    ADDRSS  SCHEDL    TRIANG.DO
    TRIANG.BA MIAM.BA  ASCPIX.CO -.-       -.-       -.-  -.-     
     -.-       -.-       -.-  -.-       -.-       -.-       -.-  -.- 
         -.-       -.-       -.- Select: _              10670 Bytes
    free Ok> key enter Ok> screen_dump TRS-80 Model 100 Software
    Copr. 1983 Microsoft 10414 Bytes free Ok Ok> lcd_mon on Ok> key
    "list" enter event, lcdwrite, (8,1),list event, lcdwrite,
    (8,1),10 FOR X=1TO5:PRINTX:NEXT event, lcdwrite, (8,1),Ok key
    "run" enter event, lcdwrite, (8,1),run event, lcdwrite, (8,1), 1
    event, lcdwrite, (8,1), 2 event, lcdwrite, (8,1), 3 event,
    lcdwrite, (8,1), 4 Ok> event, lcdwrite, (8,1), 5 event, lcdwrite,
    (8,1),Ok Ok> read_reg all A=1 F=68 B=0 C=0 D=1 E=6 H=117 L=81 M=1
    PC=30014 SP=57418 Ok> radix 16 Ok> read_mem 0 32 C3 33 7D 4D 45
    4E 55 00 7E E3 BE C2 46 04 23 E3 C3 58 08 EB 2A EB F6 EB 7C 92 C0
    7D 93 C9 3E 20 Ok>


Reply via email to