graph TD Main["Main/UI thread
Choreographer vsync loop, touch events"] Vice["VICE thread
main_program() → maincpu_mainloop()"] Http["NanoHTTPD worker thread(s)
one per request"] StdoutT["stdout reader thread"] StderrT["stderr reader thread"] Audio["OpenSL ES callback thread"] Main -->|"captureFrame(): reads g_framebuf"| Vice Main -->|"injectKey(): writes keyboard matrix"| Vice Http -->|"onKey → injectWatchKey → injectKey"| Vice Http -->|"getScreenText(): reads C64 RAM"| Vice Vice -->|"writes g_framebuf, drains pending queues"| Main Vice -->|stdout/stderr pipes| StdoutT Vice -->|stdout/stderr pipes| StderrT Vice -->|sound ring buffer| Audio