{"id":25942529,"url":"https://github.com/mihamarkic/vice-bridge-net","last_synced_at":"2025-06-23T19:06:48.316Z","repository":{"id":68977448,"uuid":"352104879","full_name":"MihaMarkic/vice-bridge-net","owner":"MihaMarkic","description":".NET implementation of bridge for VICE binary monitor","archived":false,"fork":false,"pushed_at":"2025-04-18T12:19:27.000Z","size":167,"stargazers_count":6,"open_issues_count":1,"forks_count":3,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-05-24T01:21:15.801Z","etag":null,"topics":["c64-emulator","vice"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MihaMarkic.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-03-27T15:16:48.000Z","updated_at":"2025-04-18T12:19:31.000Z","dependencies_parsed_at":null,"dependency_job_id":"cca438b1-d73a-42b6-96df-92dbc3c5933b","html_url":"https://github.com/MihaMarkic/vice-bridge-net","commit_stats":null,"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"purl":"pkg:github/MihaMarkic/vice-bridge-net","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MihaMarkic%2Fvice-bridge-net","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MihaMarkic%2Fvice-bridge-net/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MihaMarkic%2Fvice-bridge-net/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MihaMarkic%2Fvice-bridge-net/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MihaMarkic","download_url":"https://codeload.github.com/MihaMarkic/vice-bridge-net/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MihaMarkic%2Fvice-bridge-net/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261539318,"owners_count":23174136,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c64-emulator","vice"],"created_at":"2025-03-04T06:19:26.778Z","updated_at":"2025-06-23T19:06:46.314Z","avatar_url":"https://github.com/MihaMarkic.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# VICE Binary Monitor Bridge for .NET\n\nA cross platform .NET 8.0 library that implements a bridge for communication with [VICE](https://vice-emu.sourceforge.io/) [binary monitor](https://vice-emu.sourceforge.io/vice_13.html#SEC281).\n\n[![NuGet](https://img.shields.io/nuget/v/Righthand.Vice.Bridge.svg)](https://www.nuget.org/packages/Righthand.Vice.Bridge)\n\n| Main   | Develop |\n| ------ | ------- |\n| [![Build status](https://ci.appveyor.com/api/projects/status/j4mug5wqaqh4ystn/branch/main?svg=true)](https://ci.appveyor.com/project/MihaMarkic/vice-bridge-net/branch/main) | [![Build status](https://ci.appveyor.com/api/projects/status/j4mug5wqaqh4ystn/branch/develop?svg=true)](https://ci.appveyor.com/project/MihaMarkic/vice-bridge-net/branch/develop) |\n\n\nTested(limited on Windows 10) and built against VICE 3.7.\n\n**Important**: At the moment, it works only against API v1, not API v2 which is implemented at least in VICE 3.7.\n\n## Quick start\n\nStart VICE with *-binarymonitor* argument so it listens to default port 6502.\n\nFirst step is to register types with .NET's standard `Microsoft.Extensions.DependencyInjection.IServiceCollection` by calling extension method `Righthand.ViceMonitor.Bridge.AddEngineServices`, like:\n\n```csharp\nvar collection = new ServiceCollection();\ncollection.AddEngineServices();\n```\n\nAfter IoC is setup, `IViceBridge` has to be resolved through IoC. Optionally `ConnectionChanged` even handler can be used to track connection status (also available through `IViceBridge.IsConnected` property) and `ViceResponse` event handler can be used to receive unbound responses from VICE.\n\n```csharp\nbridge.ConnectedChanged += Bridge_ConnectedChanged;\nbridge.Start();\n```\n\nAfter `IViceBridge.IsConnected` property becomes `true`, command can be sent to VICE and responses will flow back. Here is a ping command:\n\n```csharp\nvar ping = bridge.EnqueueCommand(new PingCommand());\nvar commandResponse = await ping.Response;\nif (commandResponse.IsSuccess)\n{\n\t// response is of type PingCommand expects\n\tvar response = cr.Response;\n\t...\n}\nelse\n{\n\tConsole.WriteLine($\"An error with code {commandResponse.ErrorCode} occurred\");\n}\n```\n\n## A bit more about internal working\n\nLibrary is using .NET's `Microsoft.Extensions.DependencyInjection` IoC system and is mandatory to initialize it before starting `ViceBridge`.\n\nClient typically creates immutable commands and enqueues them into bridge. ViceBridge will process them in FIFO manner. Once commands are sent to VICE, bridge matches response (or in some case responses) to issued command. When client wants to read VICE's response or just waits for it, it can await `ViceCommand.Response` task.\n\nCommands are using `Righthand.ViceMonitor.Bridge.Commands` namespace and are modelled to match VICE's binary protocol with few enhancements where available. For example, there is no need for `FileNameIndex` as it can be read from `FileName` string property.\n\nInternally byte arrays for input and output are retrieved from `ArrayPool\u003cbyte\u003e.Shared` through custom `BufferManager` class which packs the arrays into `ManagedBuffer` class. Some properties exposes said `ManagedBuffer`. Read Memory Management chapter below to avoid memory leaks.\n\nThe responses that are not bound to any command are accessible through `IViceBridge.ViceResponse` event. Responses are using `Righthand.ViceMonitor.Bridge.Responses` namespace.\n\n## Memory management\n\nCaller is required to dispose responses that implement `IDisposable` after all data has been processed. Usually those responses have at least one property of `ManagedBuffer` type which is borrowing byte array from a shared pool. Failing to call `Dispose()` on response will result in memory leak.\n\nAt the moment of this writing there are only two such responses: `MemoryGetResponse` and `DisplayGetResponse`.\n\nWhen a `ManagedBuffer` instance is passed to a command then `ViceBridge` will dispose the command and consequently the given `ManagedBuffer`. Once command in enqueued the caller shouldn't modify passed `ManagedBuffer` anymore as there are no guarantees when it is being disposed.\n\nAt the moment of this writing there is only one such command: `MemorySetCommand`.\n\n## Playground sample\n\nPlayground sample is a console application that is used for testing and for sample purposes. It demonstrates the basics and some simple tasks.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmihamarkic%2Fvice-bridge-net","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmihamarkic%2Fvice-bridge-net","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmihamarkic%2Fvice-bridge-net/lists"}