Sie sehen gerade die Germany Version der Website.
Möchten Sie zu Ihrer lokalen Seite wechseln?
12 MIN LESEZEIT
6502 Assembler

Create a VS Code 6502 extension

David Bolton shows how to set up Node, NPM and Yeoman for creating extensions for Visual Studio Code.

OUR EXPERT

David Bolton likes creating 6502 assemblers. Now he’s showing how to create an extension in VS Code to run the 6502 assembler he created for Linux Format.

OUR EXPERT

David Bolton likes creating 6502 assemblers. Now he’s showing how to create an extension in VS Code to run the 6502 assembler he created for Linux Format.

The IDE (integrated development environment) was created in 1983, with Borland’s Turbo Pascal considered to be the first example. Before that you edited, compiled and debugged your code with separate programs. It was a clunky process having to switch from the editor to run the compiler and then switch back if a compile error was found. With an IDE, if there is a syntax error, the editor jumps straight to the offending line. With some languages, the errors are identified as you type, without even needing to compile.

Visual Studio Code, also known as VS Code (see the boxout, opposite), has an extension API that can register commands, configurations, key bindings or context menu items, store workspace or global data, display notification messages, use Quick Pick to collect user input, open the system file picker to let users select files or folders, and use the Progress API to indicate long-running operations.

It can also let you change the colours of your source code through theming, change the colours of the VS Code UI or add custom file icons. For now, we’re going to produce an extension that can run as65 from a command in the VS Code menu and assemble it.

Extension basics

At its simplest it’s just a file, src/extension.ts, containing two functions: export function activate(context: vscode. ExtensionContext): {}

And the corresponding but optional: export function deactivate() {}

The idea is that when your extension is first activated, code in the activate function registers all the commands specified in package.json and provides a mapping for each one in extension.ts.

You can write extensions in either JavaScript or TypeScript. Our personal preference is TypeScript, which if you don’t already know is JavaScript with additional syntax added. The TypeScript compiler does static checking for errors before running it, and helps you avoid those silly JavaScript errors at runtime. You can take any valid JavaScript code and put it in a TypeScript file without worrying about exactly how it is written. Simply rename your .js files to .ts. When you see a file with a .ts file extension, that’s a TypeScript file.

QUICK TIP

You can find many extensions with source code on GitHub. Go to https://github. com and in the search bar at the top type in /extension vscode language: TypeScript or variations of it, like /vscodeextension language: TypeScript .

QUICK TIP

You can find many extensions with source code on GitHub. Go to https://github. com and in the search bar at the top type in /extension vscode language: TypeScript or variations of it, like /vscodeextension language: TypeScript .

A successful launch of Yeoman on Ubuntu 24.04.

Getting started

Schalten Sie diesen Artikel und vieles mehr frei mit
Sie können genießen:
Genießen Sie diese Ausgabe in voller Länge
Sofortiger Zugang zu mehr als 600 Titeln
Tausende von früheren Ausgaben
Kein Vertrag und keine Verpflichtung
Versuch für €1.09
JETZT ABONNIEREN
30 Tage Zugang, dann einfach €11,99 / Monat. Jederzeit kündbar. Nur für neue Abonnenten.


Mehr erfahren
Pocketmags Plus
Pocketmags Plus

Dieser Artikel stammt aus...


View Issues
Linux Format
October 2024
ANSICHT IM LAGER

Andere Artikel in dieser Ausgabe


LINUX FORMAT
LINUX FORMAT
The #1 open source mag Future Publishing Limited,
WELCOME
MEET THE TEAM
This issue, we are lighting up our lives with Home Assistant-powered smart lights, so what’s the smartest thing you have installed lately?
Not so smart homes
Every tech startup and their dog seems to
REGULARS AT A GLANCE
Canonical is having a great time with Ubuntu
The company has recently filed its financial statements. It saw $251 million in revenue for the last year, and has 1,034 employees.
GIMP 3.0 is coming
The much-anticipated GIMP 3.0 will soon be upon us, with the latest developer preview build announced.
The 0.0.0.0 Day vulnerability
The exploit allows execution of arbitrary code.
LATEST UPDATES!
Italo Vignoli is one of the founders
TURNING THE TDE
Dave Stokes is a technology evangelist at
Rust adoption lags behind expectations
Linus Torvalds attended KubeCon in Hong Kong to speak about AI and Rust.
Nvidia fixes Wayland
The latest driver supports KDE and direct scanout on multiple monitors.
Linux outperforms Windows (again)
Clear Linux outperforms Windows on AMD Ryzen 9 9950X hardware.
Distro watch
What’s behind the free software sofa?
TAMING PANTHOR
Eric Smith is a senior software developer
BOOT CAMP
Jon Masters is a kernel hacker who’s
Kernel Watch
Jon Masters summarises the latest happenings in the Linux kernel, so that you don’t have to.
Answers
Got a burning question about open source or the kernel? Whatever your level, email it to answers@linuxformat.com
Mailserver
WRITE TO US Do you have a burning
LETTER OF THE MONTH
Super safes I buy your magazine every month,
HotPicks
VirtualBox Signal GpgFrontend Alpaca Keypunch Falkon Super Productivity A-Mazing Urho Warzone 2100 Etcher Video Downloader
Signal
Version: 7.16.0 Web: https://signal.org In addition to
GpgFrontend
Version: 2.1.3 Web: https://gpgfrontend.bktus.com GpgFrontend makes GnuPG
Alpaca
Version: 1.0.2 Web: https://jeffser.com/alpaca The models that
Keypunch
Version: 3.0 Web: https://github.com/bragefuglseth/keypunch Keypunch has a
Falkon
Version: 24.05.2 Web: www.falkon.org Like the desktop
Super Productivity
Version: 9.0.6 Web: https://super-productivity.com You can make
A-Mazing Urho
Version: 20240714 Web: https://luckeyproductions.itch.io/amazingurho The A-Mazing Urho
Warzone 2100
Version: 4.5.1 Web: https://wz2100.net Warzone 2100 maybe
Etcher
Version: 1.19.21 Web: https://etcher.balena.io While Etcher is
Video Downloader
The app doesn’t offer many controls while downloading
REVIEWS
GnuCash
The words “free accounting” are music to Rob Clymo’s freelance ears.
Vanilla OS 2 Orchid
Is Vanilla OS a darling bud of May or just an awkward orchid? Nate Drake is on the case.
Emmabuntüs DE 5 1.02
Nate Drake searches frantically for his umlaut key in evaluating this ethical, lightweight and accessible French distro.
Sleeper OS Bee v2
Nate Drake fires up his laptop to discover whether Sleeper OS is the perfect dream or every Linux user’s nightmare.
Super Grub2 2.06s4
Is it a bird? Is it a plane? No, it’s Super Grub! Nate Drake shares how it worms its way into unbootable systems.
Schim
Management is thrilled that Jody Macgregor likes working in the shadows.
ROUNDUP
Beginners’ distributions
Not everyone is a Linux veteran like Michael Reed, so he’s assessing five distributions that could be a good choice for Linux newbs.
Getting it installed
The installation process, from a beginner’s perspective.
First-run experience
People new to Linux might need extra hand-holding at the start.
Getting around the desktop
Where you’ll spend most of your time.
Visual customisation
Even beginners have ideas about how things should look and work.
Available documentation
One of the most important considerations for a Linux beginner.
Application installation
Installing apps is the next step once the basic customisations are done.
Default applications
We like a distro that can handle the basic tasks without extra work.
Beginners’ distributions
M int inherits many of the advantages of Ubuntu
BRIGHTER SMARTER HOMES
BRIGHTER SMARTER HOMES!
Matt Holder uses Home Assistant and Zigbee devices to make automations and dashboards showing the state of our homes.
Making you smarter
Before kick-starting your new obsession, it is worth explaining a little bit about Home Assistant’s concepts…
Create dashboards
To control your smart home, you need dashboard controls that link to your smart home devices.
Pair your Zigbee gear
Using low-cost widely available smart lighting is easier than you might think, thanks to open protocols and open standards.
Automatic pilot
Automations are key to creating a smarter home and ensuring it works from dusk to dawn.
Pi USER
Shoot for the Moon with Moonhack 2024
Join in with the Australia-based hackfest that’s open to everyone around the world!
The Pi 5 GPU
Hacked, of course!
Pi 5 2GB
New low cost.
GETTING INTO INTEL
Les Pounder works with groups such as
Elegoo Saturn 4 Ultra
It turns out that Denise Bertacchi will go crazy for anything that tilts!
Pi Pico 2
With £5 burning a hole in his pocket, Les Pounder splashes out on the new embedded Pi.
Hack Wi-Fi on to your new Pi Pico 2
The new Pico 2 doesn’t come with Wi-Fi, but when has that ever stopped Les Pounder? Never, that’s when.
Cut a slice of Pi Pico on BreadboardOS
BREADBOARDOS
TUTORIALS
Speed up downloads
Optimum use of internet bandwidth is Shashank Sharma’s life’s purpose. Thankfully, there are tools designed to help do just that.
Fix and tweak your network settings
LINUX BASICS
Advanced PDF editing and tricks in OnlyOffice
PDF is an extremely popular format, touching our workflow every day. Kseniya Fedoruk shares tips to get the most out of dealing with them.
Emulate the classic Psion PDA range
Les Pounder travels back to the 1990s, when Filofax became digital, and your phone was dumb and the size of a brick.
Reviving the WW2 Enigma machine
The Enigma machine was hugely sophisticated for its day. Today, all that clever mechanics can be replicated in software, as Mike Bedford reveals.
How to handle Nvidia graphics card drivers
NVIDIA
Upgrade it: Nvidia GeForce graphic cards
GPU
GeForce RTX 4070 Super
SPECS GPU: AD104 Compute: 56 Shaders: 7,168
GeForce RTX 4070
SPECS GPU: AD104 Compute: 46 Shaders: 5,888
GeForce RTX 4090
You’ll be the fastest kid on the block
GeForce RTX 4060
Your wallet is going to love you, but
GeForce RTX 4080 Super
This has 80% of the speed of a
GeForce RTX 4060 Ti
Triple 1080p frame rates and playable 4K make
ADMINISTERIA
Fixing system services on Linux servers
Stuart Burns laments the fact that fixing broken services is much easier on Linux than in the UK at large.
IN DEPTH
Inside the AI PC
Is the AI PC anything more than marketing speak? Barry Collins and Tim Danton find out…
CODING ACADEMY
Adding colour to the LXF Shell project
Removing his head from the retro demoscene clouds, Ferenc Deák is back down to earth and adding colour to our ongoing LXF Shell project.
ADVERTISEMENT
GO COMPARE
LINUX FORMAT
www.magazinesdirect.com/LIN/C75J
LINUX FORMAT
magazinesdirect.com
LINUX FORMAT
www.magazinesdirect.com/linux-format
Tech Radar
www.techradar.com
MAGAZINES DIRECT
www.magazinesdirect.com
MAGAZINES DIRECT
www.magazinesdirect.com/linux-format
LINUX FORMAT
magazinesdirect.com
Code club
www.codeclub.org.uk
LINUX FORMAT
EFF
EFF.ORG
THE BRAIN TUMOUR CHARITY
thebraintumourcharity.org
Chat
X
Pocketmags Unterstützung