Command line assembler

Frank
Posts: 159
Joined: Sun May 03, 2015 2:43 pm

Re: Command line assembler

Post by Frank »

Oops, must have missed it on the copy and paste. Fixed it in the above for anyone else that tries it.

To anyone else messing with this the 'No Build System' error means an error in the build file. For some reason the JSON parser in Sublime Text was not able to properly parse it so look for a typo (like mine) in your edits.
PhilHaw
Posts: 65
Joined: Thu Mar 07, 2019 5:37 pm

Re: Command line assembler

Post by PhilHaw »

Frank wrote: Fri Oct 07, 2022 7:33 am Oops, must have missed it on the copy and paste. Fixed it in the above for anyone else that tries it.

To anyone else messing with this the 'No Build System' error means an error in the build file. For some reason the JSON parser in Sublime Text was not able to properly parse it so look for a typo (like mine) in your edits.
When you fixed it you put a bracket ([) in Frank but it should be a brace ({). In math we used to call them 'square brackets' and 'curly brackets' :D

So, you used a square bracket, but it should have been a curly bracket!
Philip Hawthorne

Blue Nebula Development Team
Frank
Posts: 159
Joined: Sun May 03, 2015 2:43 pm

Re: Command line assembler

Post by Frank »

PhilHaw wrote: Fri Oct 07, 2022 8:47 am When you fixed it you put a bracket ([) in Frank but it should be a brace ({). In math we used to call them 'square brackets' and 'curly brackets' :D

So, you used a square bracket, but it should have been a curly bracket!
DOH!!!!

OK, fixed the fix so it should be fixed.

Too many things going on today, gotta slow down to avoid any more errors.

Need to clean it all up and put them in a zip file for others to d/l if they want to use them.
PhilHaw
Posts: 65
Joined: Thu Mar 07, 2019 5:37 pm

Re: Command line assembler

Post by PhilHaw »

Frank wrote: Fri Oct 07, 2022 9:15 am
PhilHaw wrote: Fri Oct 07, 2022 8:47 am When you fixed it you put a bracket ([) in Frank but it should be a brace ({). In math we used to call them 'square brackets' and 'curly brackets' :D

So, you used a square bracket, but it should have been a curly bracket!
DOH!!!!

OK, fixed the fix so it should be fixed.

Too many things going on today, gotta slow down to avoid any more errors.

Need to clean it all up and put them in a zip file for others to d/l if they want to use them.
I am glad I was able to help you fix the fix that needed to be fixed LOL

Phil.
Philip Hawthorne

Blue Nebula Development Team
PhilHaw
Posts: 65
Joined: Thu Mar 07, 2019 5:37 pm

Re: Command line assembler

Post by PhilHaw »

I have created a Windows cmd script and a Sublime Text build that will get the Assembler to program a specified location in the FXCore Flash memory.

You will have to install the 'Terminus' package in Sublime Text since its own terminal window is not interactive, so, although you can type in a location number to program, the standard terminal window won't send it back to the script. Terminus provides a fully interactive terminal window. I assume if you are a Sublime Text user you will know how to install a package.

Here's the Sublime Text build file for using with the following .cmd script. You can save it as, for example: "FX-Core-Program-Location.sublime-build", in the Sublime text 'User' folder. The command script checks to make sure you have entered a valid location number between 0 and 15.

Code: Select all

{
	"target": "terminus_open",
	"cancel": "terminus_cancel_build",
	"focus": true,
	"auto_close": true,
	
	"title": "FX Core Assembler",

	"working_dir": "C:/Program Files (x86)/Experimental Noize/FXCore Assembler",


    "file_patterns": ["*.fxc","*.FXC"],

	"shell_cmd": "assemble-program-loc \"$file\"",

}
Save the following Windows command script as "assemble-program-loc.cmd" in the FXCore Assembler folder: "C:\Program Files (x86)\Experimental Noize\FXCore Assembler"

Code: Select all

@echo off
set /p LOCATION="Which location do you wish to program (0-15)?"

if %LOCATION% gtr 15 (
echo Too large - must be less than 16!
pause
exit /b 1
)
if %LOCATION% lss 0 (
echo Must be greater than 0!
pause
exit /b 1
) else (
echo Calling FXCore Assembler to program location %LOCATION%
"C:\Program Files (x86)\Experimental Noize\FXCore Assembler\FXCoreCmdAsm.exe" -p %LOCATION% %1 
)
pause


Here it is in operation: https://youtu.be/F5vG_o1zwfs
Philip Hawthorne

Blue Nebula Development Team
Frank
Posts: 159
Joined: Sun May 03, 2015 2:43 pm

Re: Command line assembler

Post by Frank »

These are my final versions, the batch file detects if a listing file was passed to it and if so assumes it is some form of assemble command and if it detects an error will type out the listing file to highlight the errors in the source window. If no listing file then it will execute the commands as passed for the assembler.

Create the file assemble_st.cmd in "C:\Program Files (x86)\Experimental Noize\FXCore Assembler" and edit it to contain

Code: Select all

@echo off
setlocal enabledelayedexpansion

set argCount=0
for %%x in (%*) do (
   set /A argCount+=1
   set "argVec[!argCount!]=%%~x"
)

set /A max=%argCount%-1
for /L %%i in (1,1,%max%) do (
   set sublist=!sublist! "!argVec[%%i]!"
)

set list_file=!argVec[%argCount%]!

IF "%list_file:~-4%" == ".lst" (
   REM have a listing file so must be an assemble command of some type
   "C:\Program Files (x86)\Experimental Noize\FXCore Assembler\FXCoreCmdAsm.exe" %sublist%
   if !errorlevel! EQU 0 (echo. & echo NO ERRORS ) Else ( type "%list_file%" )
) ELSE (
   REM no listiing file so just run it
   "C:\Program Files (x86)\Experimental Noize\FXCore Assembler\FXCoreCmdAsm.exe" %*
)
Then edit the fxcore_hw.sublime-build in "C:\Users\your_user_name\AppData\Roaming\Sublime Text\Packages\User" replacing "your_user_name" with the user name on your
windows pc and edit fxcore_hw.sublime-build to contain:

Code: Select all

{
	// set working dir for relative paths
	// change this to suit the location of FXCoreAsm.exe
	"working_dir" : "C:/Program Files (x86)/Experimental Noize/FXCore Assembler",
	"file_patterns": ["*.fxc","*.FXC"],

	// REGEX for capturing errors

	// file regex finds the name of the file for highlighting errors
	"file_regex" : "Source File: (.+)$",

	// line regex finds the errors in the output .LST
	"line_regex" : "ERROR.* ([0-9]+):([0-9]+)?(.+)$",

	// allow user to cancel "run from RAM" mode by pressing Ctrl+Pause/Break
	"cancel":
	{
		"cmd" : "assemble_st.cmd -ee -i 0x30",
	},

	// default build type is assemble only

	"cmd" : "assemble_st.cmd -a \"$file\" \"$file_path\\\\$file_base_name.lst\"",

	"variants": [

		{
			"name": "Run from RAM",
			"cmd" : "assemble_st.cmd -re -i 0x30 \"$file\" \"$file_path\\\\$file_base_name.lst\"",
		},

		{
			"name": "End run from RAM",
			"cmd" : "assemble_st.cmd -ee -i 0x30",
		},

		{
			"name": "Get serial number",
			"cmd" : "assemble_st.cmd -s -i 0x30",
		},

		{
			"name": "Assemble and program location 0",
			"cmd" : "assemble_st.cmd -p 0 -i 0x30 \"$file\" \"$file_path\\\\$file_base_name.lst\"",
		},

		{
			"name": "Assemble and program location 1",
			"cmd" : "assemble_st.cmd -p 1 -i 0x30 \"$file\" \"$file_path\\\\$file_base_name.lst\"",
		},

		{
			"name": "Assemble and program location 2",
			"cmd" : "assemble_st.cmd -p 2 -i 0x30 \"$file\" \"$file_path\\\\$file_base_name.lst\"",
		},

		{
			"name": "Assemble and program location 3",
			"cmd" : "assemble_st.cmd -p 3 -i 0x30 \"$file\" \"$file_path\\\\$file_base_name.lst\"",
		},
		
	]

}
If you are installing Sublime Text on Windows remember to include the fxcore.sublime-syntax and fxcore_Comments.tmPreferences files from the Linux set in "C:\Users\your_user_name\AppData\Roaming\Sublime Text\Packages\User" (replacing "your_user_name" blah blah blah)

I will try to zip all this up later this week in a single file.
Post Reply