Jump to content
IGNORED

Crimson Editor output with DASM


Omegamatrix

Recommended Posts

Hey all,

 

Is there a way to add a tool in Crimison Editor that will have DASM compile a .asm file and output a .bin with or without a .lst? Right now I have:

 

"$(FilePath)" -f3 -o"$(FilePath).bin" -l"$(FilePath).lst"

 

This works if your intial file is just a "file" without a specified extension. If your file does have an extension though like example.asm you would get example.asm.bin and example.asm.lst when you use the tool. I started playing around with the other options like FileName and FileTitle but then it started saving stuff in my DASM folder, and usually as a 0k file. :ponder: I really want to use the GUI and click the tool button as it's quick and I'm already there. I could write a batch file to change the extension names after it compiles I guess but how do you guys do it?

Link to comment
Share on other sites

Okay I found a way to do it. I copied the macro.h and VCS.h files into the folder I'm storing my assemblies in, and changed the intial dir to use $(FileDir) instead of my old path. Then I used this for my arguement:

 

"$(FilePath)" -f3 -o"$(FileTitle).bin" -l"$(FileTitle).lst"

 

This works good now and I can have all my files start as .asm and end with .bin or .lst :)

Edited by Omegamatrix
Link to comment
Share on other sites

Is there a way to add a tool in Crimison Editor that will have DASM compile a .asm file and output a .bin with or without a .lst?

Yes, you can have one tool that generates a listing when it compiles, and another tool that doesn't. I always just generate a listing, because they come in so useful when you need to track down a bug-- although they do tend to fill up the directory with extra files! :D

 

Right now I have:

 

"$(FilePath)" -f3 -o"$(FilePath).bin" -l"$(FilePath).lst"

Define another tool just like that, except leave off the -l"$(FilePath).lst" at the end, and you'll get a .bin but no .lst file. Then you can compile using the non-listing tool. If your code has compile errors or runtime bugs and you need to look at the full listing to get a better idea of what's going on, just recompile it using the tool that generates the listing file.

 

This works if your intial file is just a "file" without a specified extension. If your file does have an extension though like example.asm you would get example.asm.bin and example.asm.lst when you use the tool. I started playing around with the other options like FileName and FileTitle but then it started saving stuff in my DASM folder, and usually as a 0k file.

If it started to save things in different directories and generated 0 kb files, then the compile batch or command string didn't know it should be using a specific directory, so it was using whatever the current directory happened to be, and further more it couldn't find the program file that you were trying to compile.

 

Crimson Editor has four variables that represent all or part of the name of the file that's being edited on the active tab:

 

$(FilePath) -- This variable represents the full name of the current file, meaning the drive letter, directory path, file name, and file extension. For example, if you open up the file "C:\Atari\2600\source\myprogram.asm," then "$(FilePath)" will be equal to that full file name, "C:\Atari\2600\source\myprogram.asm."

 

$(FileDir) -- This variable represents just the file path of the current file, meaning the drive letter and directory path. In the preceding example, "$(FileDir)" would be equal to "C:\Atari\2600\source."

 

$(FileName) -- This variable represents just the file name of the current file, meaning the file name plus the extension, but without the drive letter and directory path. In the preceding example, "$(FileName)" would be equal to "myprogram.asm."

 

$(FileTitle) -- This variable represents just the file "title" of the current file, meaning the file name *without* the extension, and also without the drive letter and directory path. In the preceding example, "$(FileTitle)" would be "myprogram."

 

If you use -o"$(FilePath).bin," the compiled .bin file will have the same name as the original file-- including its extension-- but with ".bin" tacked on the end. In the preceding example, it would be "C:\Atari\2600\source\myprogram.asm.bin."

 

If you don't want the compiled .bin to have the funky ".asm.bin" extension, you'll need to use -o"$(FileTitle)".bin instead-- except then the file path won't be included, which will probably screw things up because DASM will use the current directory and the source file might not be in the current directory. So to get around that, you need to also include "$(FileDir)" in the arguments, as follows:

 

"$(FilePath)" -f3 -o"$(FileDir)"\"$(FileTitle)".bin -l"$(FileDir)"\"$(FileTitle)".lst

 

or

 

"$(FilePath)" -f3 -o"$(FileDir)"\"$(FileTitle)".bin

 

depending on whether or not you want the .lst file to be generated.

 

:ponder: I really want to use the GUI and click the tool button as it's quick and I'm already there. I could write a batch file to change the extension names after it compiles I guess but how do you guys do it?

Personally, I just use "$(FilePath)," and then I rename the .bin file to change the extension from ".bas.bin" or ".asm.bin" to just ".bin" if I really want to. It isn't that I happen to like those funky extensions-- I actually don't-- but I do a lot of stuff in batari Basic, including helping out other batari Basic programmers, and the batari Basic compile batch uses "%1" (because it's a batch command file), and it doesn't recognize Crimson Editor's variables. I could always use "$(FileDir)"\"$(FileTitle)" as the argument, and then "%1" would be equal to the file path plus file name *without* the extension, and I could tack on the extension inside the batch file-- e.g., "%1.bas" and "%1.bin"-- but I want to try to maintain as much compatibility and consistency with the other batari Basic as possible. (Some batari Basic users might be executing the compile batch from a command prompt, or from the 2600IDE editor, so unless they've modified the compile batch and are leaving the extension off when they enter the command string, the "%1" batch variable will include the ".bas" extension.)

 

Michael

Link to comment
Share on other sites

Okay I found a way to do it. I copied the macro.h and VCS.h files into the folder I'm storing my assemblies in, and changed the intial dir to use $(FileDir) instead of my old path. Then I used this for my arguement:

 

"$(FilePath)" -f3 -o"$(FileTitle).bin" -l"$(FileTitle).lst"

 

This works good now and I can have all my files start as .asm and end with .bin or .lst :)

That will work, but see the argument lists I posted, which combine "$(FileDir)" with "$(FileTitle)."

 

Michael

Link to comment
Share on other sites

If you don't want the compiled .bin to have the funky ".asm.bin" extension, you'll need to use -o"$(FileTitle)".bin instead-- except then the file path won't be included, which will probably screw things up because DASM will use the current directory and the source file might not be in the current directory. So to get around that, you need to also include "$(FileDir)" in the arguments, as follows:

 

"$(FilePath)" -f3 -o"$(FileDir)"\"$(FileTitle)".bin -l"$(FileDir)"\"$(FileTitle)".lst

 

or

 

"$(FilePath)" -f3 -o"$(FileDir)"\"$(FileTitle)".bin

 

depending on whether or not you want the .lst file to be generated.

I could not get this to work. I tried a few things like putting the extension inside the quotation make ie. "$(FileTitle).bin" instead of "$(FileTitle)".bin, and I also tried using $(FileDir) and the full path to DASM without dasm.exe as the intial Dir. Nothing worked. I also tried substituting "\" for the pipe command "|" because it seemed like worth trying at the time. :ponder: I only know a little command prompt right now, but it makes sense to me how you are doing it so I'm not sure why it's not working. I loved the idea of two different tools though so I made a second one like so:

 

[b]Menu Text:[/b]       2600 bin                                                                        ; but it can be called whatever you want
[b]Command:[/b]         C:\Documents and Settings\Jeff\My Documents\Gaming\DASM\bin\DOS\dasm.exe        ; the full path to DASM including dasm.exe
[b]Argument:[/b]        "$(FilePath)" -f3 -o"$(FileTitle).bin"                                          ; output is a .bin file only
[b]Initial Dir:[/b]    $(FileDir)
[b]Hot Key:[/b]         None                                                                            ; make one if you want


[b][no check][/b] Close on exit                           [b][no check][/b] Use short filename (8.3)
[b][checked][/b] Capture output                           [b][checked][/b] Save before execute                ; "save before execute" updates your source file

 

What I like is that the file will assemble wherever it's located, and doesn't have to be in a specific folder. As long as macro.h and VCS are in the same place as the file you assembling then the .bin will appear there too. The other tool I made produces both a .bin file and .lst file at the same time. The only difference between this and my first tool is -l"$(FileTitle).lst" which will make a .lst file like you talked about, Michael:

 

"$(FilePath)" -f3 -o"$(FileTitle).bin" -l"$(FileTitle).lst"

 

:ponder: I really want to use the GUI and click the tool button as it's quick and I'm already there. I could write a batch file to change the extension names after it compiles I guess but how do you guys do it?

Personally, I just use "$(FilePath)," and then I rename the .bin file to change the extension from ".bas.bin" or ".asm.bin" to just ".bin" if I really want to. It isn't that I happen to like those funky extensions-- I actually don't-- but I do a lot of stuff in batari Basic, including helping out other batari Basic programmers, and the batari Basic compile batch uses "%1" (because it's a batch command file), and it doesn't recognize Crimson Editor's variables. I could always use "$(FileDir)"\"$(FileTitle)" as the argument, and then "%1" would be equal to the file path plus file name *without* the extension, and I could tack on the extension inside the batch file-- e.g., "%1.bas" and "%1.bin"-- but I want to try to maintain as much compatibility and consistency with the other batari Basic as possible. (Some batari Basic users might be executing the compile batch from a command prompt, or from the 2600IDE editor, so unless they've modified the compile batch and are leaving the extension off when they enter the command string, the "%1" batch variable will include the ".bas" extension.)

 

Michael

Does the .bas extension stand for basic then?

Link to comment
Share on other sites

"$(FilePath)" -f3 -o"$(FileDir)"\"$(FileTitle)".bin -l"$(FileDir)"\"$(FileTitle)".lst

 

or

 

"$(FilePath)" -f3 -o"$(FileDir)"\"$(FileTitle)".bin

 

depending on whether or not you want the .lst file to be generated.

I could not get this to work. I tried a few things like putting the extension inside the quotation make ie. "$(FileTitle).bin" instead of "$(FileTitle)".bin, and I also tried using $(FileDir) and the full path to DASM without dasm.exe as the intial Dir. Nothing worked. I also tried substituting "\" for the pipe command "|" because it seemed like worth trying at the time. :ponder: I only know a little command prompt right now, but it makes sense to me how you are doing it so I'm not sure why it's not working.

There's no pipe command in there-- the only thing that looks like a pipe is the -l parameter, and it's actually a lowercase letter L (as in "list file," or "listing"). The reason it didn't work as I'd typed it is because I messed up with the quotation symbols, and I didn't actually try it out before I posted it. The *correct* way to do it is as follows (and this time I *did* test it to be sure it works! :)):

 

"$(FilePath)" -f3 -o"$(FileDir)\$(FileTitle).bin" -l"$(FileDir)\$(FileTitle).lst"

 

or

 

"$(FilePath)" -f3 -o"$(FileDir)\$(FileTitle).bin"

 

Does the .bas extension stand for basic then?

Yes, .bas is a common extension for BASIC program files. There are a lot of versions and variations of BASIC, so some programmers might use different extensions for different kinds of BASIC languages. For example, when batari Basic was first introduced a few years ago, I think some people were using a .bB extension, or you could use .bbas or something else. I think some batari Basic programmers even use the .txt extension, perhaps because they're using a text editor like Notepad or WordPad to write their batari Basic programs. And I think I've seen some people use the .txt extension for their assembly programs, too, possibly because the forum software that AtariAge uses doesn't let you upload files with a .asm extension. But .bas is a pretty common generic extension for BASIC programs, so that's what I use for batari Basic.

 

Michael

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...