31 March 2017, 18:51 | #1 |
Registered User
Join Date: Mar 2017
Location: DFO:
Posts: 15
|
Is there any way of modularize AMOS code?
Something like Pascal units or #include in C. Or do I have to put everything in a huge file? New to AMOS, no examples seem to have code spread along several files, but the fact it isn't used doesn't mean it doesn't exist.
|
31 March 2017, 19:04 | #2 |
Total Chaos forever!
Join Date: Aug 2007
Location: Waterville, MN, USA
Age: 49
Posts: 2,186
|
Highlight the code you want to reuse and export it to ASCII text using the appropriate menu options. You can merge it from another menu option into your destination program.
Sadly it must be a big file before you are done since reusable code is usually written in Assembly and saved as an extension. |
31 March 2017, 21:11 | #3 |
Registered User
Join Date: Mar 2017
Location: DFO:
Posts: 15
|
_panda:
I wish this could be added for 3.0 though (since AMOS is apparently opensource now). Something like INCLFILE "Filename.amos" and then it would work just like C's #include |
31 March 2017, 22:55 | #4 | |
AMOS Extensions Developer
Join Date: Jun 2007
Location: near Cambridge, UK
Age: 44
Posts: 1,924
|
Quote:
You can, however, split programs up. I have a (crappy) AMOS game called BLAIM! which I wrote around 10 years ago. It is split into 2 files, one is the intro and then it loads the main game, which is stored in a 2nd file. I think I used the instruction RUN "FILENAME" to load and run the 2nd file from within the intro program. |
|
01 April 2017, 02:00 | #5 |
Registered User
Join Date: Mar 2017
Location: DFO:
Posts: 15
|
I see. Though I figure it would play badly with the compiler.
I was thinking about separating code into logical segments though, e.g. map handling routines in one file, custom menu handler in other file, gameplay rutines in another and main file to bind them all together. Like Pascal units or C includes. But apparently you can't do it in AMOS. |
01 April 2017, 14:12 | #6 |
Registered User
Join Date: Sep 2007
Location: Stockholm
Posts: 4,332
|
I think you can do so, at least using the compiler. There are some caveats, but the way to do so is described somewhere in the manual.
|
01 April 2017, 19:26 | #7 | |
AMOS Extensions Developer
Join Date: Jun 2007
Location: near Cambridge, UK
Age: 44
Posts: 1,924
|
No. Just compile each file individually. Data can be saved to the RAM: disk for transferring between each program - there may be a better way, but I couldn't figure out how back then.
Quote:
I'm not familiar with C or Pascal programming languages - I have heard of them, just not used them before. |
|
01 April 2017, 19:46 | #8 |
Total Chaos forever!
Join Date: Aug 2007
Location: Waterville, MN, USA
Age: 49
Posts: 2,186
|
The fact that an AmosPro tokenized source can hold .abk files inside means that merge ASCII is the only way.
As far as the compiler is concerned, I think that being able to write extensions in Amos and lift the 26 extension limit would solve the problems nicely for Amos 3. The bug fix release 2.1 should be first. |
02 April 2017, 05:34 | #9 | |
Registered User
Join Date: Sep 2007
Location: Stockholm
Posts: 4,332
|
From the manual, page 10.2.16:
Quote:
|
|
04 April 2017, 23:54 | #10 |
Registered User
Join Date: Mar 2015
Location: Sheffield UK
Posts: 360
|
Yup! that works.... tried it lastnight and it's a gem
I hadn't even heard of that option before. Thank idrougge that'll come in useful sometime |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
AMOS (Editor) Source Code | SparkyNZ | request.Apps | 4 | 25 March 2017 00:49 |
f/s Amiga Amos Programming books / Disks / Easy Amos & other Books *mega collection!* | fitzsteve | MarketPlace | 4 | 23 May 2012 04:35 |
Req: AMOS code for scrolling plasma thingy | Dunny | request.Other | 7 | 20 September 2010 14:51 |
Amos PRO source code availability ? | freddix | request.Other | 7 | 09 April 2010 21:22 |
Where's the amos.library on the 3-disk AMOS set? | andreas | support.Apps | 0 | 15 November 2001 16:04 |
|
|