Gury Posted August 27, 2007 Share Posted August 27, 2007 (edited) Hi all, I thought of cross-compiler (MS Windows program, later maybe Linux port), which would resemble Action! syntax and to be as compatible as possible with it. Here is quick and very "primitive" start, called EFFECTUS, which shows a way of doing this. The project is in ALPHA stage, it means it does not feature anything useful yet, it is just for academic purposes and to show others to make suggestions and improvements which would be implemented besides my own development. I played with the syntax and came with the current list of "features", which does not include even anything basic yet, like conditional branching, variables, etc. If I will continue with the project, there will be also some time for documentation, which would probably grow with the program. Before brief explanation of the commands, I just want to remind you that my program relies on MADS assembler for creating assembler source code and executable file. With the help of configuration file inlcuded with the program (CONFIG.INI), you can set MADS folder, starting address of binary executable program created with MADS, Effectus source code listing, source code output and binary executable program path and filename created with MADS. Just unzip included file and extract the files in same folder. When you run the program (EFFECTUS.EXE), you can see current settings and by clicking the Process button you begin translating EFFECTUS program. The syntax is similar to Action! and currently you can play with the commands: Graphics, PrintE, Poke, DPoke, Include, special command ASM and my custom library procedure KeyPressed. Some of the procedures are featured in RUNTIME.ASM, which is supposed to be runtime library for created binary programs. This can be changed by you as you desire, the same goes for all included libraries which you make. From the demo program listed in the folder, called TEST.EFF, you can see actual syntax, so I will not deal with it here right now. There is no checking of the listing by any means, just test of something which does not really exist yet. Procedure ASM is just simple way of directly putting actual ASM code to MADS source code listing. I used it (for now) to include example of custom library function / procedure in the program. Check demo programo and LIB.EFF library. From the source code you can see that parsing of LIB.EFF creates the LIB.ASM, accordingly. The result of MADS can be found in OUTPUT.TXT, so you can see if assembling was successful. To see an example, you can run TEST.XEX in Atari emulator or real thing. Try EFFECTUS and make suggestions and criticism for the program. I will explain inner workings and logic of the source code made by Effectus in next installments if you want. Edited September 20, 2007 by Gury 1 Quote Link to comment Share on other sites More sharing options...
devwebcl Posted August 27, 2007 Share Posted August 27, 2007 Great! finally another cross-compiler for a different language, I'll test it ASAP. Cheers, Devwebcl Quote Link to comment Share on other sites More sharing options...
Pengwin Posted August 27, 2007 Share Posted August 27, 2007 Great idea Gury. :thumbsup: I'll definitely be keeping an eye on the progress of this. Quote Link to comment Share on other sites More sharing options...
cas Posted August 27, 2007 Share Posted August 27, 2007 (edited) A nice idea and a good start! I personally would prefer an existing language syntax, as the hardest part is getting a good, consistent syntax. And I like to reuse old code. Please be careful to not invent another "quick" with different syntax. Have a look at the Amsterdam Compiler Kit, which also has an 6502 backend: http://tack.sourceforge.net/index.html C-- might be a nice inspiration --> http://en.wikipedia.org/wiki/Sphinx_C-- as well as SDCC http://sdcc.sourceforge.net/ when using a cross-compiler, it should make use of the computing power of the host platform for code optimization and smart-linking- Quetzalcoatl (6502 compiler for VC20/C64, GPL Source) http://www.kdef.com/geek/vic/quetz/develop/chg.html Carsten Edited August 27, 2007 by cas Quote Link to comment Share on other sites More sharing options...
TXG/MNX Posted August 27, 2007 Share Posted August 27, 2007 wow please make a FULL ACTION! compiler this would be nice, I have been looking for this for years... Quote Link to comment Share on other sites More sharing options...
Gury Posted August 28, 2007 Author Share Posted August 28, 2007 Thank you all for testing and to you Cas for interesting links, these cross-compiler kits are great for the inspiration. Surely it is best to use the power of host platform, because many features from modern high languages are not feasible on a platform which operate on 64K basis, memory limitations are simply to great and many memory locations are not allowed for you to use. My main goal is to make Effectus as compatible with Action! as possible. Quick presented ways of doing such things like incorporating variables, DLis and VBIs in special way, which I didn't like. The syntax must be flexible, making any task easy, like in structured Action! Using modern platform, we gain fast assembling and additional optimizations. Smart linking is one of the features, which is also feasible for my project. Using MADS assembler (or XASM, TASM...) we gain new amazing features of modern cross-compilers. What Effectus should give you is resulting MADS assembly code which you can optimize even further. It is like outer shell with resembles of Action!, using syntax of Pascal and C. RUNTIME.ASM will include procedures and functions of native language, enabling you to change everything afterwards with your optimized routines if you want and sharing with others. We can also add new statements to the core, for example CASE, etc. Time will tell, with your help it will be even easier. Quote Link to comment Share on other sites More sharing options...
Gury Posted September 8, 2007 Author Share Posted September 8, 2007 (edited) Hi all, You can try new version of Effectus. Currently supported features are: limited conditional branching with WHILE, global variables (BYTE and CARD), local procedures, added some graphics procedures, limited comment support. You can read more about current rules and restrictions on http://gury.atari8.info/effectus/. You are free to try demonstration programs on example\ folder (colors.eff, etc.). PC program GUI changed a little, featuring more control of compiling Effectus programs. Before using it, please set default values in config.ini file. Loading and running Effectus programs should be more user-friendly now. File output.txt shows you compilation results of MADS assembler. With new versions there will be hopefully more to see and limitations will be eliminated whereever possible. When you download attached ZIP file, please extract all files in the same folder, overwritting all previous ones from previous version. Edited October 7, 2007 by Gury Quote Link to comment Share on other sites More sharing options...
Gury Posted September 20, 2007 Author Share Posted September 20, 2007 (edited) Hi all, Here is new version of Effectus. Thanks to the suggestions of Tebe the screen printing routines are now improved. You can now use many of standard print routines like Put, PutE, PrintB, PrintBE... IF branching is finally implemented. Also, you can peek memory locations with Peek function, play with joystick and use SOUND procedure. You can read more about new features, bugs, to-do list, etc. on http://gury.atari8.info/effectus/ The use of Effectus is still limited, but it will get more features when new versions are ready. You can help with any suggestions and improvements, I am here to listen. The runtime library is located in lib\ directory. When unpacked, be sure the contents of the ZIP file are copied accordingly with all the directories included. The paths and other options can be set in config.ini file. Please refer to it and make changes accordingly. You can check some examples and try them on http://gury.atari8.info/effectus/docs/examples.htm. These examples will help you to see current possibilities / unpossibilities of Effectus. Effectus.zip Edited October 7, 2007 by Gury Quote Link to comment Share on other sites More sharing options...
Allas Posted September 20, 2007 Share Posted September 20, 2007 Interesting. Really works. Quote Link to comment Share on other sites More sharing options...
TXG/MNX Posted September 21, 2007 Share Posted September 21, 2007 Good work Exelent can't say more, but MAC/65 output would also be great .... Quote Link to comment Share on other sites More sharing options...
Gury Posted September 21, 2007 Author Share Posted September 21, 2007 Good work Exelent can't say more, but MAC/65 output would also be great .... Interesting idea. But first, core implementation has to be done to the point, where most of Action! functioning is integrated (I hope) and more features are added. Then, maybe, if everything goes well, we can think about other assembler outputs, which would surely be great idea. Quote Link to comment Share on other sites More sharing options...
JamesD Posted September 21, 2007 Share Posted September 21, 2007 A nice idea and a good start! I personally would prefer an existing language syntax, as the hardest part is getting a good, consistent syntax. And I like to reuse old code. Please be careful to not invent another "quick" with different syntax. Have a look at the Amsterdam Compiler Kit, which also has an 6502 backend: http://tack.sourceforge.net/index.html C-- might be a nice inspiration --> http://en.wikipedia.org/wiki/Sphinx_C-- as well as SDCC http://sdcc.sourceforge.net/ when using a cross-compiler, it should make use of the computing power of the host platform for code optimization and smart-linking- Quetzalcoatl (6502 compiler for VC20/C64, GPL Source) http://www.kdef.com/geek/vic/quetz/develop/chg.html Carsten SDCC is pretty decent to modify. I've spent some time working on a 6809 code generator and it seems much more straightforward than other compilers I've messed with. It's also pretty easy to setup the peephole optimizer for a new target. If you want to add a peephole optimizer to a new compiler I'd steal that one. Quote Link to comment Share on other sites More sharing options...
Gury Posted October 7, 2007 Author Share Posted October 7, 2007 (edited) Hi there, New version of Effectus (0.0.4) is available. New features: - FOR branches - IF-ELSE conditions - INCLUDE files (user defined libraries) - Rand (random generator) routine - String manipulation (SCopy, InputS) - Use of variables as routine arguments - DEFINE constants (currently just numeric constants) - Fixed and removed many bugs (including comments issues) - Graphics support - Game controller support - Sound support Tebe helped me again with the suggestions for more flexible and readable code by including external libraries. So I introduce new system for generated MADS code. Also, thanks to idea of TXG/MNX, program now includes compile status information for every compile made. Documentation is on: http://gury.atari8.info/effectus/ You can check examples and runtime library on: http://gury.atari8.info/effectus/docs/examples.htm http://gury.atari8.info/effectus/docs/lib.htm There is also forum opened: http://effectus.forumotion.com/Effectus-f1/ Good day Edit: - After downloading the program archive, you have to overwrite any existing file already on your disk. Only exception in this version is config.ini, which can be used from previous version, so your program settings can remain intact. - You can also use hexadecimal numbers instead of numeric literals if you want, for variable values or function arguments. effectus.zip Edited October 7, 2007 by Gury Quote Link to comment Share on other sites More sharing options...
TXG/MNX Posted October 7, 2007 Share Posted October 7, 2007 Nice to see the new version, will play around with this aswell... Quote Link to comment Share on other sites More sharing options...
Gury Posted October 7, 2007 Author Share Posted October 7, 2007 First bug reported by dely (Daniel). .link statement (external library) used wrong pathname for runtime libraries, which was in fact pathname from my local machine. Now this is corrected, so the correct pathname is taken. Specifically, from field MADS_RTL_DIR in config.ini file. New version is attached here. Also, Tebe suggested me to use JCC mnemonic for FOR branch, because BCC is used for short branches. Any suggestions and additional help is most welcome. Thanks to all helping me. effectus.zip Quote Link to comment Share on other sites More sharing options...
cas Posted October 10, 2007 Share Posted October 10, 2007 Hallo Gury, take a look at David A. Wheelers discussion on implementing languages for the 6502 architecture. An very interesting reading.... http://www.dwheeler.com/6502/index.html Carsten Quote Link to comment Share on other sites More sharing options...
Gury Posted October 10, 2007 Author Share Posted October 10, 2007 (edited) Hallo Gury, take a look at David A. Wheelers discussion on implementing languages for the 6502 architecture. An very interesting reading.... http://www.dwheeler.com/6502/index.html Carsten Thanks for very interesting link. Mr. David did very detailed discussion on different approaches on creating efficient code with 6502 processor. He also goes into great details about using parameters (by reference) with procedures. Fortunatelly, MADS has many features, including those Mr. David mentions in his article, one of them is using registers or specified locations as parameters in procedures. Of course, registers make things to run much faster. The idea behind Effectus is making it compatible with Action! as much as it can be. If the project goes on, I will continue with implementing many features MADS offers us for making efficient machine language object code. Also, it really speeds up development with all those mnemonic abbreviations for long listing code you would have to write from scratch otherwise. Branches, conditions, PROCs and MACROs are another examples of its features. Edit: We had electric shutdown when I was writting for the first time and I think I forgot to mention something now Edited October 10, 2007 by Gury Quote Link to comment Share on other sites More sharing options...
devwebcl Posted October 22, 2007 Share Posted October 22, 2007 Gury, I wonder if you may release a version with command line and have the usual interface with parameters, this way is easier to use with an editor (i.e.: notepad++) then compile and insert to a disk image. Regards, Devwebcl Quote Link to comment Share on other sites More sharing options...
Gury Posted October 23, 2007 Author Share Posted October 23, 2007 Gury, I wonder if you may release a version with command line and have the usual interface with parameters, this way is easier to use with an editor (i.e.: notepad++) then compile and insert to a disk image. Regards, Devwebcl Hi Devwebcl, Don't worry, I plan to implement command line version. I am also thinking of automatically generating Atari image files (ATR), but maybe later in developing stage of Effectus. Some facilities, like I/O, can't be tested fully in just one binary file, but we need, for example, formatted disk (ATR...). This can be done with existing ATR tools, but I would like to make it more automatic. Quote Link to comment Share on other sites More sharing options...
Gury Posted December 25, 2007 Author Share Posted December 25, 2007 (edited) Hi all, Here is new version of Effectus (0.0.6 alpha). Some of the new features are: - Console version of the program - Functions - Procedure and function parameter handling - Many new Action! routines included - I/O support - Math support (addition - sum up to 500) - Common equates included in one file - Declaration of any variable type can be repeated throughout the program - Three new libraries added: math.asm, io.asm and printfd.asm - New examples - Program code optimised and factorized for usage with GUI and console version of the Effectus By default, settings are the same in console and GUI version of Effectus EXCEPT default parameters for output, which is written to directory you are currently on. Of course, unless otherwise set with program options. Requirement for proper working of Effectus is to include config.ini configuration file in the same directory as the executable program. Links: http://gury.atari8.info/effectus/ http://gury.atari8.info/effectus/download.htm http://gury.atari8.info/effectus/docs/examples.htm (here you can also check I/O examples included in ATR image file) Any comments most appreciated, thanks! Regards, Gury P.S.: Before copying new version of Effectus to appropriate directory please make a backup of your previous config.ini configuration file, which you can use again with your own settings. Edited December 26, 2007 by Gury Quote Link to comment Share on other sites More sharing options...
Gury Posted December 26, 2007 Author Share Posted December 26, 2007 Little information update: 8-bit substraction is working too, but care must be taken to use BYTE variable as the storage of result. Example is here: http://gury.atari8.info/effectus/docs/examples/math_test.eff. 16-bit math manipulation will be added in one of next versions. I implemented I/O checking as mentioned but removed that facility because BMI, Branch on minus flag of P register, uses so little range to jump to. If there is another way to solve this problem, please contact me. Thank you for any advice. Quote Link to comment Share on other sites More sharing options...
tebe Posted December 26, 2007 Share Posted December 26, 2007 I implemented I/O checking as mentioned but removed that facility because BMI, Branch on minus flag of P register, uses so little range to jump to. If there is another way to solve this problem, please contact me. Thank you for any advice. BMI - short jump JMI - long jump Quote Link to comment Share on other sites More sharing options...
Gury Posted December 26, 2007 Author Share Posted December 26, 2007 Thank you as usual Tebe I am not so familiar with non-standard assembly mnemonics such as this, but it is good to know what alternatives MADS / XASM have to offer to simplify rather complicated job. Quote Link to comment Share on other sites More sharing options...
Gury Posted January 6, 2008 Author Share Posted January 6, 2008 Hello there, lepo pozdravljeni New version of Effectus - 0.0.7 Alpha (works only with MADS 1.8.0 and higher): - 8-bit multiplication and division (allowed math on two numbers, same applies to addition and subtraction) - ValB, ValI and ValC Action! functions implemented (current restriction is that you cannot pass variable strings as parameter, just literal numbers in double quotation marks are allowed) - Fixed printing of text in graphic mode text window (No more need for extra routines PrintG and PrintGE, which are deprecated. For now, for empty lines, use PrintE(" "). For this, modified PrintF library was added, called PrintFG - Most routines commented (description, parameters, results) in all runtime libraries - INCLUDE statement bug fixes: - Comments allowed with this directive - No more searching for non-existing INCLUDE directive file in root directory. Instead, by referencing the filename without a pathname, program automatically searches for current location set in configuration file, pointed to Effectus source code directory. You can also state the folder of that directory inside brackets - Correctly parsed blank lines in assembly code (to match Effectus source code layout) - device ( Effectus global variable) correctly treated and referenced as device.devscr in MADS code to allow its proper internal handling - Up to five parameters are allowed to be passed to procedures and functions - InputS and InputSD allowed maximum string size is 120 bytes - Rand routine optimized - Fixed Locate routine (a problem which remains is extra keypress of return key - yet to be fixed (any advice?)) - IF condition and WHILE branch variable type checking (if any of the numbers is of type .word, the resulting code is also of type .word) - Game controllers library added - Default device applied to routines GetLine, Put, PutE - CHAR ARRAY handled as BYTE ARRAY (check scopy.eff example) - New generated program layout: - common.asm (macro routines Poke, Peek, PokeC, PeekC, XIO, MoveBlock) - runtime.asm library as object code library - All runtime libraries optimised and revised - MADS conditions and branches #if, #else, #while and #end (with MADS 1.8.0 and higher) - I/O error checking (program automatically closes a device and program execution) - Syntax typing freedom (variable declarations and expressions, routine parameters... Some examples: n = 1, k =Sum(n1, n2), BYTE jx, jn,jy...) - PutD and PutDE routines modified and moved from runtime.asm to io.asm, obsolete ReadByte removed and more... Link is here: http://gury.atari8.info/effectus/ For brief information on console version of the program, click here: http://gury.atari8.info/effectus/effcon.htm Quote Link to comment Share on other sites More sharing options...
twh/f2 Posted January 6, 2008 Share Posted January 6, 2008 (edited) Gury, without diving to deep into your project I have a couple of questions: can your tool be somehow used to implement algorithmic logic containing several IF-Then-Else branches, local variables, while loops, 16bit loops, counters and stuff so that I can -after using your tools- simply copy'n'paste (better include) the logic in my existing MADS projects? Instead of creating a complete Effectus project I would rather prefer to program parts of my logic in the Action dialect and include the results into my assembler source code. I saw at your web site that you have a Frontend .. is the tool also able to be completely driven by command line? Is there a unix version available? I normally use a Makefile for my MADS projects. When Effectus would be usable with GNU Make it was a valuable extension to the toolchain (like Mads, Exomizer, ATR tools, etc.) many grtx, \twh::taos Edited January 6, 2008 by twh/f2 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.