;####################################################################### ; ___ ___ ___ __ ______ .___ ___. ______. ; / \ \ \ / / | | / __ \ | \/ | / | ; / ^ \ \ ' / | | | | | | | \ / | | (---` ; / /_\ \ > < | | | | | | | |\/| | \ \ ; / _____ \ / . \ | | | `--' | | | | | .---) | ; /__/ \__\ /__/ \__\ |__| \______/ |__| |__| |______/ ; ; The Assembly SDK for Axe programmers ; By Kevin Horowitz ; ; This template will make it easy to implement real assembly commands ;into Axe Parser so that they can be used just like the native commands ;that come with the App. ; ;####################################################################### ;################### ;# Library header # ;################### ;This is required for all Axe Libraries: .dw $C0DE ;################### ;# Command Header # ;################### ;Shells that this command can be used with: ; ;bit 0 = No Stub Compatible ;bit 1 = Ion Compatible ;bit 2 = MirageOS Compatible ;bit 3 = DoorsCS Compatible ;bit 4 = Application Compatible ; ;Be sure to use $FF to make the command compatible with all shells ;Bits 5-7 are reserved for future use and might not necessarily be ;other shells. .db 0 ;The token used in this command. If its a 1 byte token, make the second byte 0. .db 0,0 ;The type of command. ;0 = Quick Replacement ; This is the simplest to write. The assembly is just going to be inserted ; at the location the command is placed. ;1 = Quick Subroutine ; The command is only inserted once into the code and then called from that ; point on. ;This list is expected to expand, and more advanced commands will eventually be ;possible for Axioms. .db 0 ;Number of arguments expected for this routine. .db 0 ;##################### ;# Initial Routine # ;##################### ;This is the command that will always be written (not called) after all the ;arguments have been pushed, expect the last argument, which is in HL. If ;you're writing a replacement, then this will be the only routine you need. ;On the other hand, if this is a subroutine with 1 or 0 arguments then this ;part of the Axiom must be ignored since there is no popping needed. ;The size of the code to be inserted. .db 0 ;The command itself goes here Insert_Your_Initial_Routine ;################ ;# Subroutine # ;################ ;This section should only be inserted if you have a subroutine. This is the ;subroutine itself, called immediately after the initial routine. ;The size of the code to be inserted. .db 0 ;The command itself goes here Insert_Your_Subroutine ;################## ;# And repeat... # ;################## ;Repeat this pattern (not including the library header) until all your routines ;are completed. ;################################ ;# Frequently Asked Questions # ;################################ ; ;How do I compile the code? ; ; The code must be an appvar, not a program. Do NOT include the ; assembly program header in addition to the Axe Library header. ; The appvar can be in ram or archive when used. ; ;How does Axe do output? ; ; The HL register is always used as the output. ; ;Can I redefine existing Axe commands? ; ; No. The parser only looks through the Axioms once all of the ; original commands have been searched through. ; ;What if another library uses the same token as I'm using? ; ; Similar explanation as above. The command is searched for in ; the order that Axioms were defined in the program. So if ; someone else uses the same command and their Axiom was defined ; before yours, then their command is found first. But if the ; programmer switches the order of the Axioms, yours will be ; found first. ; ;Can I use absolute jumps and calls to the routine itself? ; ; Not currently. I may add support for that later though. ; ;What ram areas are safe to use? Can I use shadow registers? ; ; If at all possible, I would recommend to not use ANY ram for ; your subroutines. But, if its absolutely necessary, I would ; recommend using the OP1-OP6 area as thats the location I use ; for extremely temporary storage. Make sure to warn if your ; library commands are interrupt compatible or not. If they use ; temporary storage or shadow registers, they are most likely ; not. ; ;Can I make a command have a different routine for different shells? ; ; Yes. Simply define the routines using the same token values ; but with different shell compatibility. ; ;Can you give me some limits? ; ; Sure. The maximum number or arguments is 6. Routines must be ; less than 255 bytes. The maximum number of Axioms in a single ; program is currently 5.