Running
Pasmo paired with FUSE offers a great way to run the script you are working with. We need to pass some some command line parameters to pasmo, then we can either start FUSE up, open the file ready to then start the loading process. It can become a little bit repetitive to keep doing this manually so we adopt a batch script on Windows (linux bash script still to create although it's probably not going to be much different) .
Create a file called run.bat in the root of your coding directory. You can add this file to the PATH environment variable on Windows so that it can be run from anywhere if you prefer to keep this somewhere more suitable. Copy the below code and paste it into this file.
- @echo off
- setlocal
- set filename=%1
- set debugMode=
- set machineVer=48
- set breakPoint=8000
- set createListFile=
- echo.
- goto :argloop
- :usage
- echo Version 1.1
- echo USAGE:
- echo filename [flags]
- echo.
- echo. --debug sets the debugger active
- echo. --br {value} sets break point for debugger, value in hex i.e. 4000 (default=8000)
- echo. --machine {value} sets the machine mode 48/128 (default=48)
- echo. --list creates an assembler list file
- goto :eof
- :argloop
- if "%~1"=="" goto :endloop
- if "%~1"=="--debug" (
- set debugMode=--debugger-command
- shift
- goto :argloop
- )
- if "%~1"=="--machine" (
- shift
- if "%~2"=="" goto :endloop
- set "machineVer=%~2"
- shift
- goto :argloop
- )
- if "%~1"=="--br" (
- shift
- if "%~2"=="" goto :endloop
- set "breakPoint=%~2"
- shift
- goto :argloop
- )
- if "%~1"=="--list" (
- set createListFile=%filename%.lst
- shift
- goto :argloop
- )
- shift
- goto :argloop
- :endloop
- if not defined filename (
- goto :usage
- )
- echo. Filename: %filename%.asm
- if defined debugMode (
- set debugMode=%debugMode% "br $%breakPoint%"
- echo. Debug Mode: %debugMode%
- echo. Breakpoint: %breakPoint%
- )
- if not defined debugMode (
- echo. Debug Mode: off
- )
- echo. Machine Version: %machineVer%
- echo.
- echo. Running Assembler
- echo. pasmo --tapbas %filename%.asm %filename%.tap %createListFile%
- echo.
- pasmo --tapbas %filename%.asm %filename%.tap %createListFile%
- echo.
- if %ERRORLEVEL% neq 0 (
- echo. Stopping, PASMO error(s^) found
- goto :eof
- )
- echo. Running Emulator
- echo. fuse --machine %machineVer% --fastload --auto-load --tape ./%filename%.tap %debugMode%
- echo.
- fuse --machine %machineVer% --fastload --auto-load --tape ./%filename%.tap %debugMode%
- echo.
- endlocal
To use the file you'll just need to pass a filename to the new batch command and it will do the rest. Here's an example of the steps.
- Create a assembly script and save i.e helloworld.asm
- In terminal, type ./run.bat helloworld
- Behind the scenes, we're taking the filename (we're assuming .asm) and asking pasmo to make a tap file out of it
- We then call on FUSE and it's excellent support for CLI where we ask it to auto-load the tape file we've just made.
- FUSE will open up, immediately load the tap file in a speedy way and your program will be loaded on screen in moments.
- We can also pass an extra --debug flag to allow us to step through our script line by line ./run.bat helloworld --debug
- Run ./run.bat by itself to see the help dialoge for more options
Boilerplate
We set our immediate value as equal to the 16-bit hex address $8000 (32,768), this helps us for both the start and end address references