With this post, I start a new series to share my experiences with developing a Visual Studio Code extension. While you’re reading it, you will learn about these topics:
- Visual Studio Code extensibility fundamentals
- Understanding the techniques to develop a virtual machine that emulates real hardware
- Designing your software with testability in mind
About 18 months ago, I started a new GitHub project, SpectNetIde. The project aimed to create a Visual Studio 2017 integrated development environment for the retro computer of the ’80-s, ZX Spectrum. Though it started as a fun project, later it proved itself to be pretty useful. As I’ve been working as an agile coach and architect for seven years, I could use SpectNetIde at my customer teams to teach software design and testing principles. I have a strong .NET background, so I chose C# as the programming language for the project.
SpectNetIde became popular among programmers creating software for ZX Spectrum, yet, it has a significant drawback. It runs only on Windows. Many Spectrum fans use Mac, and Linux, too. SpectNetIde would not be an alternative for them.
About half a year ago I decided to look for a platform-agnostic solution that does not has this disadvantage. I started the SpectNetVsc project that aimed to create a ZX Spectrum IDE integrated with Visual Studio Code.
Now, I’m over the first — and probably the most challenging phase — of the project: I can run a high fidelity ZX Spectrum emulator within Visual Studio Code. Here are a few screenshots:
Topics of the Series
While I created SpectNetIde and SpectNetVsc, I have learned great and exciting things I would like to share with you. Here is a list of topics I plan to publish and discuss — and it is only the top of the iceberg.
- A short introduction to the ZX Spectrum microcomputer
- How to create a software abstraction of real hardware?
- Building a device and component hierarchy
- Coping with timings
- Making a high-fidelity display
- Memory and paging
- Tape emulation
- Floppy disks
- What are the challenges of implementing a CPU?
- Execution cycle
- Instruction sets and decoding
- Interrupts and signals
- Contended memory
- Synchronization with other hardware components
- Creating a simple Visual Studio Code extension
- How to create a simple VS Code extension
- Debugging VS Code extensions
- Syntax highlighting
- Adding your custom programming language support to VS Code
- Source code debugging
- Visual Studio Code Themes support
- Creating a VS Code WebView
- Understanding VS Code WebViews
- WebView life cycle
- Integrating a WebView with its backend, messaging
- Using local resources
- Running scripts
- Using UI frameworks such as Angular, React, Vue, etc.
- Challenges of implementing a software emulator with a WebView
- Refreshing the emulator’s screen
- Creating sound
- Emulating the physical keyboard
- Virtual lists
- The power TypeScript adds to creating a VS Code extension
- Interfaces and advanced types
- Using string literal types and discriminated unions
- The power of classes
- Building the project
- Creating a testing strategy for an emulator
- Testing the timing of CPU
- CPU, memory, and I/O operations
- Screen rendering
- Memory contention
- User interactions