Hello, Guest the thread was viewed10k times and contains 95 replies

last post from KSimcomal at the

Mega Assembler is live on file host

  • I just checked it with the emulator. After pressing the HELP key twice, nothing works in the editor. ;(

    So I'm not the only one who repeatedly taps the HELP key in desperation! :D I've created a small fix. (Could be nice if this forum accepted a d81 file extension). The same bug happens with function keys too. A `KEY OFF` before doing `GETKEY` (and then a `KEY ON` afterwards) will tell the function and HELP keys to return their keycode instead of whatever text they print out.

  • I just checked it with the emulator. After pressing the HELP key twice, nothing works in the editor. ;(

    So I'm not the only one who repeatedly taps the HELP key in desperation! :D

    It was actually designed ad a feature. Developers who call for help too often are automatically locked out of Mega Assembler 8|


    Thanks for posting and fixing. I've had other priorities in the past months, but hopefully I"ll find some more time for MA.

  • Hi, a new version (V1.2.0) of Mega Assembler is now available on the file host. Here's what's new:


    Changes in version 1.2.0, released 18-DEC-2022

    - Added official mnemonics for long branching: LBEQ, LBNE, LBPL, LBMI, LBCC, LBCS, LBVC, LBVS, LBRA. These can be used as an alternative to forcing 16-bit branching with '!'

    - Fixed a bug where pressing function keys (e.g. the HELP key) could hang the editor. Kudos to crsc, rscottfree and snoopy for spotting the bug and finding a fix.

    - Tab positions can now be configured by changing line 126. T1 is the column for assembly instructions, T2 is to line up comments. Defaults to 14 and 32.

    - You can now align instructions or comments in a line by automatically inserting the appropriate number of spaces by pressing SHIFT-TAB.

    - When a line in the editor is full (79 characters) and the cursor is at the end of the line, it is now possible to overwrite the last character.

    - Local labels have been completely reworked to use VASM-style labels. The previous keywords SECTION, ENDSECTION and GLOBAL have been removed. Global labels now start with a letter, local labels start with a dot. You can access labels within other sections by fully qualifying them.

    Example:

  • A new version of Mega Assembler is now available on file host. Check it out and have fun:


    *** CHRISTMAS EDITION :weihnachten: ***


    Changes in version 2.0.0 released 28-DEC-2022


    - Multi file project support added

    - Ignore mode added

    - Create new file with ESC N

    - Multi file support in the editor

    - Indicator is displayed when file has been edited

    - Autosave function added

    - F9/F11 have been swapped to be in line with MEGA65 default behaviour



    Multi file project support explained


    Large programs can now be split into multiple files, for easier editing and faster assembly times. Each source file can be assembled independently, so time is saved when working only on a specific part of the program.


    It does not replace a fully fledged linker. The principle how it works is quite simple. At the same time, it is important to understand how it works to be able to use it properly.


    You combine multiple source files into a larger project by specifying the same project name (not file name, they can be freely chosen) for each source file using the new ".PROJECT" directive. You can see an example in the included demo project, called 'MULTIDEMO' consisting of three source files (MULTI-MAIN.ASM, MULTI-GFX.ASM and MULTI-UTIL.ASM):

    .PROJECT 'MULTIDEMO'

    at the begining of each source file combines those into the multidemo project. Please note that at least one space before the directive is needed, otherwise it would be interpreted as a local label.


    Next you define the bank and destination address where each file is assembled:

    .BANK 4

    *=$2000


    When such a file is assembled with MEGA-A, it is written directly into memory. But additionally, a binary file (*.BIN) is written that contains the machine code, and a project file "MULTIDEMO.PRJ" is created that stores information about the source files that belong to the project and all symbols that are exported from a source file for use in other source files.


    You can use the new 'EXPORT' keyword to export labels:

    EXPORT START


    This both defines the label start, and also exports it to the project, so it can be used within other source files:

    JMP START


    All source files add their exported symbols to the project file, and all other source files import the exported symbols from that project file.


    When a source file is assembled, not only the symbols ar imported, but also all .BIN files from the other project files are loaded into memory, allowing you to test the whole program, with all sources "linked" together. It is recommended to start each source with a JMP to the main program, so you can start the whole program from each source file directly from within Mega Assembler by pressing MEGA-R. You need to export the main entry point for that to work.


    Note: When the value of any exported symbol changes, you need to re-assemble all other files that use it, before you can run the program! You can minimize the need for re-assembly by using jump tables at the beginning of your files, as demonstrated in the multi-file demo project. As long as you only add to the end of the table, no re-assembly of other files is needed.


    You need to make sure that the assembled code from all the source files does not overlap in memory. Let's say you have a file that is assembled to $2000 in bank 4, and another one to $2400 in bank 4. This works as long as the first file does not exceed $400 bytes. Simply leave some room between memory locations of your files to allow them to grow while you work on them. When you have finished your program, you can modify locations so that they tightly fit together with no wasted bytes in between. Mega Assembler helps you doing this by pointing out the next available memory address after each assembly of a source file. But it is manual work, as opposed to a real linker that would do this automatically. But you have to do it only once your program is finished. Then you can use BSAVE wo write the whole program to disk in one piece and run it without having to load Mega Assembler.



    Ignore mode explained


    There is a trap in this simple approach to multiple files. Each file must be able to be assembled without errors, because its symbols ar only exported after successful assembly. That means you have to export a symbol to the project before using it in another file. If you wait with assembly until you have two files that cross-reference symbols (file A uses an exported symbol from file B, and vice versa), none of those files will assemble, because they don't know about the other files exports yet. So you're screwd.


    If you find yourself in this case, activate ignore mode by pressing MEGA-I. It will be displayed in the status bar. Now you can assemble all your files, because all unknown symbols will be ignored and assumed they are zero. This allows you to build up the project file. Then, deactivate ignore mode, and assemble all files again to have the correct values for your symbols.


    If you srew up your project file or loose it, you can simply delete it and rebuild it using this process.



    Create new file with ESC N


    You can now start a new file in the editor by pressing ESC N. This is especially useful for multi file projects. When you want to create a new file for your project, you can mark and copy the file header from the current file, then create the new file. The clipboard buffer remains valid, so you can paste your multi file header into the new file and start editing right away. Please remember to save your current file before creating a new file.



    Multi file support in the editor


    When a file is loaded, you can assign it a number by pressing CTRL-1 to CTRL-9. The assigned number is displayed in the status bar. You can remove it with CTRL-0.


    With ESC 1-9 you can quickly switch between marked files. Make sure the current file is saved before switching to another file! Multi file support in the editor comes in handy when working on multi file projects.



    Indicator is displayed when file has been edited


    When a file has been edited, the "*" mark is displayed in front of the filename, to remind you to save the file.



    Autosave function added


    With MEGA-* you can toggle the autosave function. When turned on, the "AS" indicator is displayed in the status bar. Autosave is turned on by default.


    When autosave is turned on, and a filename is already given for the current file (i.e. it has been saved at least once, or was loaded), a file that has been edited is saved automatically when loading a new file, starting a new file, switching marked files, performing assembly, running the program, or exiting Mega Assembler.



    Final disclaimer


    This might be the end of Mega Assembler development, since BASIC memory is almost completely used up. I will fix bugs, but don't count on any more features to be released. It is the largest Commodore BASIC program that I have ever written :-)


    However, the reason for developing Mega Assembler was (despite the fun) that i'd like to have a good, fast, easy-to-use and feature rich assembler that runs directly on the MEGA65, making use of its large memory capacity of 8 megabytes, so I can write assembly programs directly on the machine - I believe that cross-assembly from a PC does not really feel like retro computing.


    Mega Assembler is not that assembler I'd like to have. A good assembler needs to be written in assembly language ;-)


    My goal was to develop a very simple assembler that would be capable to write larger programs. With multi file support and local labels I believe this has been achieved now, with all its quirks.


    So i might be able to now use Mega Assembler to write a real assembler. It needs to be backwards compatible to Mega Assembler, so once it works I could use it to assemble its own code, migrating from Mega Assembler to it. Of course, this would be a very large project. Let's see if I can do it and how long it would take.


    This would also be my first commercial program for the MEGA65. I think it would be fair to ask for a small amount of money to compensate for the huge amount of work that would go into it. Regarding that there are only a couple hundred MEGA65s out there, and not everyone is an assembly programmer, this by far would not pay for my efforts. But i view it as a mixture between a contribution to the community and a small business that looses money. Maybe it will help to pay for my MEGA65 ;-)


    Mega Assembler will stay free software.


    If I'm able to pull it off as planned, stay tuned for:


    * MEGA ASSEMBLER PRO :achtung *


    Yours,

    grubi

  • This would also be my first commercial program for the MEGA65. I think it would be fair to ask for a small amount of money to compensate for the huge amount of work that would go into it. Regarding that there are only a couple hundred MEGA65s out there, and not everyone is an assembly programmer, this by far would not pay for my efforts. But i view it as a mixture between a contribution to the community and a small business that looses money. Maybe it will help to pay for my MEGA65 ;-)

    Did you think of this as a "call for donations" then, or do you want to sell the assembler in the classic way, as software only for payment? :gruebel

  • I thought of selling it the classic way, but for a very affordable price, so it will be a no-brainer for serious assembly programmers on the Mega65. Regarding the low number of Mega65s out there, this is clearly not about making money :saint:. However, I bought the 65 for my company, and now I have to come up with a product for it, or the next Steuerprüfung will cause some trouble.

  • Hello, is there an overview of the complete command set?

    Where can I buy the "Mega Assembler Pro"?

    Hi Jürgen,


    regarding the command set, there are.

    - directives for the assembler

    Those are documented in the integrated help function (press HELP, then A) and in the CHANGELOG.ASM file that is provided on the disk and can be loaded into the editor of Mega Assembler. Also, in the included examples you will find a lot of explanations. There is no manual as such, however. Mega Assembler Pro, on the other hand, will include a PDF manual.

    - assembler commands for the CPU

    For these, there are various sources. For example, in the mega65-book (donwloadable from mega65.org), all the assembly commands are explained. And all sources for the 6502 command set (there are many books for the C64, for example) can be used. The Mega65 command set builds on those and expands the command set even more.


    Regarding Mega Assembler Pro, it is still in development and cannot be bought yet. Once it is ready, I plan to release a test version to be able to try it out, and announce the website where it can be bought for a very affordable price.


    Also, I'm planning an online live event for people who want to program the Mega65 in assembler, to introduce them to assembler. In this event, we will use Mega Assembler - I will explain its features in that meeting. But the focus of the event is not on Mega Assembler, it's on learning assembly language and its usage on the Mega 65. I will do it in german, and plan to do a similar event in english, if there is interest.


    If you're interested, follow this thread: Assembly live webinar thread

  • Hi there, I am using Xmega65 and earlier I patched my 911001 ROM to 230305 to get the BASIC 65 EXTRA commands. Was using 920373 before. Anyway, I would like to install Mega Assembler v203. I put this in Appdata / Roaming / xemu-lgb / mega65 / hdos. But when I run "mega assembler", Mega Assembler still shows v0.1.2 in the upper right. Take care.