Ultimate Amiga

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Guide for making Extensions?  (Read 11163 times)

0 Members and 1 Guest are viewing this topic.

Lonewolf10

  • AMOS Extensions Developer
  • AMOS Dev
  • A2000
  • *****
  • Karma: 3
  • Offline Offline
  • Gender: Male
  • Posts: 618
    • http://www.aliensrcooluk.com
Guide for making Extensions?
« on: June 08, 2008, 08:52:46 PM »


Hi,

Does anyone know if there is a guide lurking about somewhere for creating extensions?

I have started making my own extension, but having a guide would save me time that would otherwise be spent studying the source code to the few extension I have (only 5 that work on AMOS Pro).


Regards,
Lonewolf10

Logged

SamuraiCrow

  • compile-time wierdo
  • Forum Mod
  • A1200
  • *****
  • Karma: 5
  • Offline Offline
  • Gender: Male
  • Posts: 946
  • Compile-time wierdo
Re: Guide for making Extensions?
« Reply #1 on: June 08, 2008, 09:31:13 PM »

I'm afraid the only extension help I've heard of from the AmosPro team was that the source code of the Amos Music extension was available on the AmosPro disks.
Logged

Lonewolf10

  • AMOS Extensions Developer
  • AMOS Dev
  • A2000
  • *****
  • Karma: 3
  • Offline Offline
  • Gender: Male
  • Posts: 618
    • http://www.aliensrcooluk.com
Re: Guide for making Extensions?
« Reply #2 on: June 12, 2008, 08:30:35 PM »


Well, I searched around on Amiga Coding and it doesn't appear that there is anything up on there either. I have the source code for the zoom command for AMOS - TC (it's actually hidden away on the AMOS System disk, in the manual under chapter 22, IIRC), and the source code for around 6 AMOS Pro compatible extensions.

I spent an hour tonight examining the token code (for the JVP extension) and writing the command syntax underneath to help me understand it. It seems fairly easy, and I'm sort of writing a guide on-the-fly (will post it/upload it when I'm satisfied most of it is correct. There's just one thing I still don't (yet) understand:

Code: [Select]
                dc.w    L_COMMAND,-1
                dc.b    "comman","d"+$80,"I0,0t0,0",-1

Now that is all fairly easy, the bit I don't understand is the "-1" on the end. A couple of commands in the JVP extension are like this:

Code: [Select]
                dc.w    L_SetStrSep1,-1
                dc.b    "!jvp set str se","p"+$80,"I",-2

After the command syntax, instead of it being "-1" it's "-2". Does anyone have any idea what this might mean? I'll try and have another look at it this weekend.


Regards,
Lonewolf10

Logged

SamuraiCrow

  • compile-time wierdo
  • Forum Mod
  • A1200
  • *****
  • Karma: 5
  • Offline Offline
  • Gender: Male
  • Posts: 946
  • Compile-time wierdo
Re: Guide for making Extensions?
« Reply #3 on: June 12, 2008, 09:08:41 PM »

Is one a command and the other a function?  It might have something to do with the return code...  I'm just guessing at this point.   ???
Logged

Lonewolf10

  • AMOS Extensions Developer
  • AMOS Dev
  • A2000
  • *****
  • Karma: 3
  • Offline Offline
  • Gender: Male
  • Posts: 618
    • http://www.aliensrcooluk.com
Re: Guide for making Extensions?
« Reply #4 on: June 13, 2008, 09:20:52 PM »

Nice guess, but I think I worked it out today...


The command syntax must be finished with ",-1" unless...

Code: [Select]
                dc.w    L_COMMAND,-1
                dc.b    "!comman","d"+$80,"I0,0t0,0",-2

                dc.w    L_COMMAND2,-1
dc.b $80,"I0,0t0,0,0",-1

 ...you have the same command with multiple syntax possibilities. In which case the first syntax line should end with ",-2", as should additional versions of the command. The *last* version should *always* end with ",-1". Also notice that the command text has been omitted and is simply replaced by "$80" in all, but the first syntax listing. In this case AMOS reverts back to the last command marked with an exclaimation mark before the command name.


Regards,
Lonewolf10

« Last Edit: June 18, 2008, 07:55:35 PM by Lonewolf10 »
Logged

Lonewolf10

  • AMOS Extensions Developer
  • AMOS Dev
  • A2000
  • *****
  • Karma: 3
  • Offline Offline
  • Gender: Male
  • Posts: 618
    • http://www.aliensrcooluk.com
Re: Guide for making Extensions?
« Reply #5 on: June 15, 2008, 09:00:37 PM »

Hi,

Just an update, the last couple of days I have discovered a few more things.
I have worked out the syntax settings used by AMOS in the extension code.


                dc.w    L_COMMAND1,-1
                dc.b   "comman","d"+$80,"I0,0t0,0,0",-1


 "I0,0t0,0" - First Character

                I  represents command doesn't return a result. Also adds a space between the last
                   letter of the command name and any variables (if any) that follow.
                0  represents command returns numeric result to variable
                1  represents command returns floating-point numeric result
                2  represents command returns a string. Any variables (if any) that follow are
                   contained in brackets.


 "I0,0t0,0" - Additional Characters
                *********************

                0  represents a numeric variable
                1  represents floating point numeric variable
                2  represents a string variable
                ,  represents ","   (as in Command 3,5) and separates variables
                t  represents "to"  (as in Command 3,5 to 3,3)
                V  reserved variable. Must state type (int, float or string) afterwards


This has been confirmed by writing commands into my own extension. Now I just need to work on the real commands and make sure my assembly code doesn't crash AMOS!


Regards,
Lonewolf10

PS. Back in hospital tomorrow (Monday) to have more treatment to hopefully get rid of my kidneystone.

« Last Edit: June 18, 2008, 07:58:25 PM by Lonewolf10 »
Logged

Lonewolf10

  • AMOS Extensions Developer
  • AMOS Dev
  • A2000
  • *****
  • Karma: 3
  • Offline Offline
  • Gender: Male
  • Posts: 618
    • http://www.aliensrcooluk.com
Re: Guide for making Extensions?
« Reply #6 on: June 18, 2008, 08:05:46 PM »

I'm afraid the only extension help I've heard of from the AmosPro team was that the source code of the Amos Music extension was available on the AmosPro disks.

Hmm... I couldn't find anything on the AMOS Pro disks. Are you sure you didn't mean the AMOS - TC disks?
I found several source files for AMOS - TC 1.2 on the Extra's disk (in the Extensions drawer) which have confirmed what I already knew and gave me a little extra info - reserved variables and floating point variables - which I have added to previous postings.


The only problem I have now is finding the location of the variables!! D3 stores the last variable used in the command, but I can't find any of the others. I have searched all the data registers and tried the address registers (indirectly of course) with no luck. I have also tried using "move.l -4(a3),d3" and "move.l -(a3),d3" to force a return of the missing variable (only 2 in the command I am working on) to d3 so it could be returned to AMOS before I try doing anything else with it... still no luck :(

I will closely examine all the extension sources I have tomorrow and hopefully solve my problem.


Regards,
Lonewolf10

Logged

Lonewolf10

  • AMOS Extensions Developer
  • AMOS Dev
  • A2000
  • *****
  • Karma: 3
  • Offline Offline
  • Gender: Male
  • Posts: 618
    • http://www.aliensrcooluk.com
Re: Guide for making Extensions?
« Reply #7 on: June 19, 2008, 08:54:53 PM »


I don't believe I could be such a dumass! I tried everything but "move.l (a3)+,d3". I now know how to recover variables, including string ones :)

Now I just need to find out how to return strings to AMOS and how to ask for space. I could cheat, like other extensions, and create my own space for variables within the extension data (but that means limited space, and limits on variable length/size).


Regards,
Lonewolf10

Logged

Lonewolf10

  • AMOS Extensions Developer
  • AMOS Dev
  • A2000
  • *****
  • Karma: 3
  • Offline Offline
  • Gender: Male
  • Posts: 618
    • http://www.aliensrcooluk.com
Re: Guide for making Extensions?
« Reply #8 on: June 22, 2008, 08:31:31 PM »


Well, I have managed to find out how to ask for variable space and solved my problem about returning strings to AMOS :)

The only thing left to do is to find where the "AMOS_includes.S" file is and then the guide is pretty much complete.


Regards,
Lonewolf10

Logged

Lonewolf10

  • AMOS Extensions Developer
  • AMOS Dev
  • A2000
  • *****
  • Karma: 3
  • Offline Offline
  • Gender: Male
  • Posts: 618
    • http://www.aliensrcooluk.com
Re: Guide for making Extensions?
« Reply #9 on: July 04, 2008, 08:07:54 PM »

Hi,

Just had a breakthrough. After 2 weeks of examining my own code and carefully checking other extension sources, I have finally worked out how to do standalone commands :)  This is something that Francois Lionet did not comment apon in the "Music.S" (or other) files (either from AMOS - TC or AMOS Pro 1.0).


You have to write the first part of the token code thus (see my previous message for the complete token code):

                dc.w    -1,L_COMMAND   ;Returns variable (e.g. X=Command)

                dc.w    L_COMMAND,-1   ;Standalone instruction (e.g. Command)

  L_COMMAND  This is the marker for the location of the assembly code to execute.
             Always start markers with "L_" for location (or label), that way
             all AMOS extension sources will look the same (and be more readable).

  -1         This must be placed after L_COMMAND if you want it to return a value
             to a variable (e.g. X=Command). Place it before L_COMMAND if the
             command is a standalone instruction (e.g. Command). Remember to separate
             "-1" and "L_COMMAND" with a comma regardless of which is first.


I am sooo happy. You don't need the "|amos_includes.S" file as I previously thought, unless you
wish to access datazones within your own extension, or you wish to return (and display) error messages to AMOS.

All that's left for me to work on now is returning error messages to AMOS and creating a "Magic Title". I hope to have the guide finished by the end of this month.



Regards,
Lonewolf10

« Last Edit: July 06, 2008, 08:11:08 PM by Lonewolf10 »
Logged

Lonewolf10

  • AMOS Extensions Developer
  • AMOS Dev
  • A2000
  • *****
  • Karma: 3
  • Offline Offline
  • Gender: Male
  • Posts: 618
    • http://www.aliensrcooluk.com
Re: Guide for making Extensions?
« Reply #10 on: July 31, 2008, 10:00:54 PM »


Hi all,

Things have slowed down a bit. Unfortunately the magic title feature doesn't work!!! Here's what Francois wrote in the "|music.S" file:

Code: [Select]
       Note : magic title!
       ~~~~~~~~~~~~~~~~~~~
       If your extension begins with "MAGIC***", AMOSPro will call the
       address located after the string (even of course!). You can do whatever
       you want to the editor screen (the current at the moment), but
       restore it.
       You also handle the user key press, and the PREVIOUS/NEXT/CANCEL
       selection, buy returning a number in D0:

                        D0=-1   Cancel
                        D0=0    Previous extension
                        D0=1    Next extension

       Example of magic title:

          C_Title        dc.b    "MAGIC***"
                         bra     Magic_Title

Unfortunately, it doesn't work as anything after C_Title (including the bra command) is recognised as ASCII characters by AMOS, thus the above returns "MAGIC***'" when viewed via the "About Loaded Extensions..." option. I tried adding a 0 (dc.b "MAGIC***",0) to see if that would make AMOS recognise it as the end of the string, but no that didn't work either :(


I have also learned how to convert a floating point number in binary, to it's decimal version (with thanks to Sam and a few others). The equation is:

[(-1)^SIGN]*[2^(EXP-$40)]*[MANTISSA/$1000000]


Example Binary: 10000000 00000000 00000000 01000000

MANTISSA = left 24 bits (bits 8-31)
SIGN = 1 bit (bit 7)
EXP (EXPONENT) = right 7 bits (bits 0-6)
RESULT=0.5


For further infirmation, simply visit http://www.geocities.com/aliensrcooluk/public/MFPP_problem.bmp


Regards,
Lonewolf10

Logged

Lukasz_Zelezny

  • A600
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 1
Re: Guide for making Extensions?
« Reply #11 on: December 16, 2008, 03:18:44 PM »


Hi,

Does anyone know if there is a guide lurking about somewhere for creating extensions?

I have started making my own extension, but having a guide would save me time that would otherwise be spent studying the source code to the few extension I have (only 5 that work on AMOS Pro).


Regards,
Lonewolf10



I can send you source code of my extension I done in somewhere 1997. Maybe it will help you
Logged

Lonewolf10

  • AMOS Extensions Developer
  • AMOS Dev
  • A2000
  • *****
  • Karma: 3
  • Offline Offline
  • Gender: Male
  • Posts: 618
    • http://www.aliensrcooluk.com
Re: Guide for making Extensions?
« Reply #12 on: December 20, 2008, 12:14:02 AM »

I can send you source code of my extension I done in somewhere 1997. Maybe it will help you

I already have the source code to a few extensions, but I would love to have yours aswell :)

I have the guide written, but it needs tidying up. I kinda got distracted by wanting to list all 3rd-party commands in one place (see one of my other threads) and haven't had the time to tidy it up or finish my own extension! (I wanted to list all the commands so I didn't attempt to create a command that someone else has already done)


Regards,
Lonewolf10

Logged

Lonewolf10

  • AMOS Extensions Developer
  • AMOS Dev
  • A2000
  • *****
  • Karma: 3
  • Offline Offline
  • Gender: Male
  • Posts: 618
    • http://www.aliensrcooluk.com
Re: Guide for making Extensions?
« Reply #13 on: July 03, 2010, 02:50:55 PM »


Hi all,

Just adding a quick note before I forget it (since I don't have time to delve deeper into this just yet). Whilst trying to compile the AMOS 1.3 sources I noticed how Francois coded boolean operators (e.g. <>,>,<,= etc.).

It's pretty much the same as any other command (see the syntax code in the file TOKTAB.S included in the AMOS 1.23 source):

   dc.w Diff-Tk,Synt-Tk
   dc.b "<",">"+$80,"O20",-1  ; NB: that reads O (letter) 20 (2 numbers - 2 & 0)

The above example syntax compares a string against a number (e.g. STRING$<>NUMBER).

The ASM code for the command (found in file EVALUE.S) ends with...

faux:   moveq    #0,d3
         moveq    #0,d2
         bra        EvaRet
vrai:   moveq    #-1,d3
         moveq    #0,d2
         bra        EvaRet

... but also appears to need a whole bunch of routines (compat,CFloat,compch and EvaRet) too.

Of course, this doesn't guarantee that it works the same in AMOS Pro, but I'll examine the relevant files when I have more time.


Regards,
Lonewolf10

Logged

Lonewolf10

  • AMOS Extensions Developer
  • AMOS Dev
  • A2000
  • *****
  • Karma: 3
  • Offline Offline
  • Gender: Male
  • Posts: 618
    • http://www.aliensrcooluk.com
Re: Guide for making Extensions?
« Reply #14 on: November 16, 2010, 09:43:29 PM »


Hi folks,

Completing my Extension Examiner program has revealed additional syntax codes, the first two are for use within the editor itself.


 C = Control Character (AMOSPro.Lib only)
 O = Operator (AMOSPro.Lib only)

 Raw syntax: £ O
 Translated: #


 3 = Array, string, variable, or floating-point variable - X$(),X#(),X(),X$,X or X#
 4 = Variable or floating-point variable - X or X#
 5 = Angle in degrees or radians (AMOSPro.Lib only)


Regards,
Lonewolf10

Logged
Pages: [1]   Go Up
 

TinyPortal 2.2.2 © 2005-2022