Tutorials

now browsing by category

 

Developing for VZ – Part 2

I decided to try setting up Visual Studio for my development environment. It’s not as easy to set up as Notepad++ was, but everything is integrated nicely, including GITHUB support so I figured I’d go with it.

You need to set up a custom task in Visual Studio. You can read about that on the “Tasks in Visual Studio Code” page. Below is a screenshot of how I set up the Z88DK compiler to compile my Assembler and C code together.

Visual Studio Task for Z88DK

The below code can be copied into the tasks.json file you created. The switches include setting the VZ computer for the output file format “+vz”, the Origin (or beginning memory location) for the code “-zorg=31488” which is 7b00h, “-vn” tells zcc to supress extra output, “-create-app” creates the application to load into the VZEm emulator, “-lndos” means to not add DOS extensions if you don’t need them. I have a couple of Assembler files so I add *.asm to the compile line. Note that I tried using the Visual Studio “args” field in tasks.json but it was not compatible with how Z88DK wanted it to work. This works nicely.

{
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "2.0.0",
    "tasks": [
        {
            "label": "Z88DK VZ Build",
            "type": "shell",
            "command": "zcc +vz -zorg=31488 -vn -create-app -lndos -m ${file} *.asm -o ${fileBasenameNoExtension}.vz",
            "group": {
                "kind": "build",
                "isDefault": true
            }
        }
    ]
}

Now to compile my C and Assembler code I just execute “Run Build Task” or hit the shortcut “Ctrl+Shift+B”:

Now my .vz file will be compiled and ready for loading in the VZEm emulator (or any other VZ emulator you happen to have lying around).
You will probably want to set up Github for your Visual Studio. I found a little YouTube “Video Visual Studio Code | How to use git and github“. You could always just install “Git for Windows“.
I had already installed Git for Windows and set it up for a different project so it was already configured nicely for me. You could always use the Github Desktop GUI app but it’s another app to launch whereas this is built into Visual Studio.

You will see the squiggly lines where Visual Studio cannot find your include files. You can fix this by editing the Visual Studio Include Path. Under Preferences Settings:

Click Edit in settings.json

Enter the following code, changing your z88dk\include path to your actual path:

{
    "git.enableSmartCommit": true,
    "C_Cpp.default.includePath": [
        "D:\\Dev\\VZ\\z88dk\\include"
    ]
}

You may also find it useful to install the Visual Studio extension “Z80 Assembly”.

The Z80 Assembly extension for Visual Studio provides the following features inside VS Code: Syntax Highlighting for Z80 Assembly

Happy coding and compiling! 🙂

Developing for VZ – Part 1

To begin your foray into developing for VZ computers, you will first need an IDE. Next, you’ll need to download and set up Z88DK development kit and grab a VZ emulator.

A good, easy-to-use IDE is Notepad++ as it’s free and simple to use. I use a plugin called NppExec to compile the code with a one-button press. You can also set it to auto-launch an emulator, but at this stage we won’t worry about that.

First, download the latest version of Notepad++ and install it. Next, get NppExec. I watched a neat little video for setting this up. It’s quite easy to do.
Download and install Z88DK. There’s plenty of info there on how to do it and I’m sure you can find a YouTube video or two. I have mine installed at D:\Dev\VZ\z88dk
Make sure you set up your PATH and ENVIRONMENT VARIABLES in Windows as described.

Start Notepad++ and go to the plugin Execute menu
This is the code I use to compile my script. I saved it as “VZ Build”

You can just copy the text I used from here and edit as needed:

npp_save
cd $(CURRENT_DIRECTORY)
D:\Dev\VZ\z88dk\bin\zcc.exe +vz -pragma-redirect:scrbase=base_graphics -o $(NAME_PART).vz $(FILE_NAME)
Next, go into the Advanced Options
Now select the “Associated Script”, Give a name to the Menu Item and click “Add/Modify”

Now you can easily compile your code from a .c file to a .vz file, ready for testing in an emulator.

Set up your HotKey in the Shortcut Mapper
I’ve set up my HotKey as F5 here

Download an Emulator from the Tools download page on this site. I prefer VZ Em as it’s lightweight and easy to use. Now you can test out a compiled .vz file by loading it into VZ Em.




© 2020: Blue Bilby | GREEN EYE Theme by: D5 Creation | Powered by: WordPress