Skip to content

Instantly share code, notes, and snippets.

@pfiscarelli
Last active August 2, 2026 14:58
Show Gist options
  • Select an option

  • Save pfiscarelli/598800570f4103da2f35ba27f731e926 to your computer and use it in GitHub Desktop.

Select an option

Save pfiscarelli/598800570f4103da2f35ba27f731e926 to your computer and use it in GitHub Desktop.
6809 Coding Environment - 6809 Assembly Batch Script
@echo off & setlocal EnableExtensions EnableDelayedExpansion
cls
:: Set tool paths here
set LWTOOLS_PATH="%USERPROFILE%\Desktop\lwtools"
set TOOLSHED_PATH="%USERPROFILE%\Desktop\toolshed"
set MAME_PATH="%USERPROFILE%\Desktop\MESS"
set VCC_PATH="%USERPROFILE%\Desktop\VCC\VCC.exe"
set XROAR_PATH="%USERPROFILE%\Desktop\XRoar"
set XROAR_COMMAND="%USERPROFILE%\Desktop\XRoar\xroar.exe"
:: Set environment paths here
set DISKETTE_NAME=assembly.dsk
set "DISKETTE_PATH=%USERPROFILE%\Desktop\CoCo Disks\"
set "CODE_PATH=%USERPROFILE%\Desktop\6809 Assembly Code\"
:: Set filename to uppercase?
:: Set line below equal to FALSE if not worried about uppercase only files
set uppercase=TRUE
:: ///
:: /// NO NEED TO EDIT BELOW THIS LINE ///
:: ///
set filename=%1
if "%uppercase%" NEQ "TRUE" goto :start
:toupper
for %%L in (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) do set filename=!filename:%%L=%%L!
:: Build paths for scripting
:start
set assembly_path="%CODE_PATH%%filename%.asm"
set binary_path="%CODE_PATH%%filename%.BIN"
set disk_path="%DISKETTE_PATH%%DISKETTE_NAME%"
:: Echo paths to console
echo.
echo Compiling: %assembly_path%
::echo Writing: %disk_path%
::echo Launching: %binary_path%
echo.
:: Compile the source code to binary
cd %LWTOOLS_PATH%
lwasm %assembly_path% --6809 --list --symbols --6800compat --output=%binary_path% --format=decb
if %ERRORLEVEL% neq 0 goto:done
:: Emulator left blank - exit script
if "%2" == "" goto:done
:: Copy binary file to disk image
echo.
echo Writing: %disk_path%
cd %TOOLSHED_PATH%
decb copy -2 -b %binary_path% -r %disk_path%,%filename%.BIN
if %ERRORLEVEL% == 248 (echo The target disk %disk_path% is full)
if %ERRORLEVEL% neq 0 goto:done
:: Check which platform to test on
echo Launching: %binary_path%
if "%2" == "vcc" goto:vcc
if "%2" == "xroar" goto:xroar
:: MAME/MESS executes here as default emulator
:: Use: coco,coco2,coco2b,coco3 on command line to select target platform
:mess
cd %MAME_PATH%
messui64.exe %2 %3 -menu -skip_gameinfo -window -flop1 %disk_path% -autoboot_delay 1 -autoboot_command "\nLOADM\"%filename%\":EXEC\n"
cd %CODE_PATH%
goto:done
:: VCC executes here
:vcc
cd %CODE_PATH%
%VCC_PATH% %filename%.BIN
goto:done
:: XRoar executes here
:xroar
cd %XROAR_PATH%
%XROAR_COMMAND% "%CODE_PATH%%filename%.BIN"
:: Change directory back to source path and exit
:done
cd %CODE_PATH%
:end
@mauriciomatte

Copy link
Copy Markdown

Hello, Paul. My name is Mauricio Matte. I am a student of Simon Jonassen ("The Invisible Man") in 6809 Assembly and the creator of the CoCo File Image Utility (for PC). I am writing a book on 6809 assembly—scheduled for release this October—for which Simon has already written the preface, and I will be sending the final content to the publisher this week (actually, tomorrow). I would like to ask for your permission to include your Notepad++ .xml file and this batch file, on the media accompanying the book. I will reference your "long branch never" channel and your environment setup videos. I will ensure proper credit is given, should you grant me permission. Thank you very much. I look forward to hearing your thoughts.

@mauriciomatte

Copy link
Copy Markdown

Just to be precise about what I'm asking: the two files are your 6809Assembly.xml (gist 4013e3f…) and assem.bat (gist 5988005…). And to be upfront — the book is a commercial title, published in Brazil by Editora Âncora, in Portuguese. Both files would go on the accompanying media, credited to you by name, with links to your gists and to the long branch never videos. If you'd rather not, that's completely fine — I'll point readers to your gists and channel instead of shipping the files. Either way, the credit stays. Thanks!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment