Jump to content

Recommended Posts

Uhhg. Any other Action programmers in here? Don't you just HATE the dreaded error #11? Error #11 explanation from the Action! manual:

 

Unknown error. You have somehow impaired the ACTION! system error routines, so it cannot tell you which error you have made.

 

Link to comment
Share on other sites

Thanks for the example. In this specific case, the error message appears OK to me.
It gives the "RETURN()" and states it does not understand that line.

post-17404-0-61617900-1433285486_thumb.png

 

More relevant is that case I found. It shows a problem I've had sooo many times. The line in the error output is the line after the errror.

post-17404-0-02091900-1433285496_thumb.png

Reports error 8 in the line "MAIN()".

post-17404-0-16697200-1433285654_thumb.png

 

Nice to have a minimal reproduction of the problem to fix.

Edited by JAC!
  • Like 1
Link to comment
Share on other sites

Be glad to. I did figure out what was causing the error 11, but I left that error in this source for ya. The error, was that I mistakenly had empty parenthesis on the main procedure's RETURN.

 

attachicon.gifERROR11.TAR

 

RETURN() is invalid syntax.

 

For a PROC you need RETURN

 

For a FUNC you need RETURN(variable or value). The return value is one or two bytes depending on whether the function is declared as BYTE, INT, or CARD.

 

-SteveS

Link to comment
Share on other sites

Yep Steve, I threw on the () onto the main procedure's RETURN out of habits formed from many influences (beyond Action!). I understand that error #11 is a catch all, but the compiler should be able to understand that a PROC needs a naked RETURN (and a FUNC should return a value) and communicate appropriately. That is unless there just isn't enough memory to spare for such checks.

Link to comment
Share on other sites

For anyone interested in writing or examining Action! code on their PC with Notepad ++, I have put together a .udl (user defined language) file so you get some syntax highlighting. That makes reading code so much easier on the eyes (and brain), in my opinion anyway. I am attaching the file. In Notepad ++, just use Language --> Define Your Language --> Import.

 

Here is an example of how it looks:

 

example.png

 

For some reason I was not allowed to upload the .UDL file. I call it "Action!.udl" It is basically XML. I will instead paste the XML text into a code box in this message. Simply copy and paste that into a .udl file of your own, and import that into Notepad ++ as described.

<NotepadPlus>
    <UserLang name="Action!" ext="act" udlVersion="2.1">
        <Settings>
            <Global caseIgnored="no" allowFoldOfComments="no" foldCompact="no" forcePureLC="0" decimalSeparator="0" />
            <Prefix Keywords1="no" Keywords2="no" Keywords3="no" Keywords4="no" Keywords5="no" Keywords6="no" Keywords7="no" Keywords8="no" />
        </Settings>
        <KeywordLists>
            <Keywords name="Comments">00; 01 02 03 04</Keywords>
            <Keywords name="Numbers, prefix1"></Keywords>
            <Keywords name="Numbers, prefix2"></Keywords>
            <Keywords name="Numbers, extras1"></Keywords>
            <Keywords name="Numbers, extras2"></Keywords>
            <Keywords name="Numbers, suffix1"></Keywords>
            <Keywords name="Numbers, suffix2"></Keywords>
            <Keywords name="Numbers, range"></Keywords>
            <Keywords name="Operators1"></Keywords>
            <Keywords name="Operators2"></Keywords>
            <Keywords name="Folders in code1, open"></Keywords>
            <Keywords name="Folders in code1, middle"></Keywords>
            <Keywords name="Folders in code1, close"></Keywords>
            <Keywords name="Folders in code2, open"></Keywords>
            <Keywords name="Folders in code2, middle"></Keywords>
            <Keywords name="Folders in code2, close"></Keywords>
            <Keywords name="Folders in comment, open"></Keywords>
            <Keywords name="Folders in comment, middle"></Keywords>
            <Keywords name="Folders in comment, close"></Keywords>
            <Keywords name="Keywords1">DEFINE
INCLUDE
SET
MODULE
</Keywords>
            <Keywords name="Keywords2">ARRAY
BYTE
CARD
CHAR
DO
ELSE
ELSEIF
EXIT
FI
FOR
FUNC
IF
INT
LSH
MOD
OD
POINTER
PROC
RETURN
RSH
STEP
THEN
TO
TYPE
UNTIL
WHILE
</Keywords>
            <Keywords name="Keywords3">AND
OR
XOR
+
-
*
/
&
%
!
=
<>
#
>
>=
<
<=
$
^
@
(
)
[
]
"
'
==

</Keywords>
            <Keywords name="Keywords4"></Keywords>
            <Keywords name="Keywords5"></Keywords>
            <Keywords name="Keywords6"></Keywords>
            <Keywords name="Keywords7"></Keywords>
            <Keywords name="Keywords8"></Keywords>
            <Keywords name="Delimiters"></Keywords>
        </KeywordLists>
        <Styles>
            <WordsStyle name="DEFAULT" fgColor="000000" bgColor="FFFFFF" fontName="Lucida Console" fontStyle="0" nesting="0" />
            <WordsStyle name="COMMENTS" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="LINE COMMENTS" fgColor="008000" bgColor="FFFFFF" fontName="" fontStyle="2" nesting="0" />
            <WordsStyle name="NUMBERS" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="KEYWORDS1" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="1" nesting="0" />
            <WordsStyle name="KEYWORDS2" fgColor="0000FF" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="KEYWORDS3" fgColor="FF8040" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="KEYWORDS4" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="KEYWORDS5" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="KEYWORDS6" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="KEYWORDS7" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="KEYWORDS8" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="OPERATORS" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="FOLDER IN CODE1" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="FOLDER IN CODE2" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="FOLDER IN COMMENT" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="DELIMITERS1" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="DELIMITERS2" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="DELIMITERS3" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="DELIMITERS4" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="DELIMITERS5" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="DELIMITERS6" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="DELIMITERS7" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="DELIMITERS8" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
        </Styles>
    </UserLang>
</NotepadPlus>

  • Like 2
Link to comment
Share on other sites

Yeah, NP++ is truly excellent. I haven't been able to really find proper documentation on the user defined language thing, so I've just been feeling around in the dark so far. I'm sure if I ever get the proper dox, I will make an improved version of the Action! language definition for NP++.

 

Glad you like what's done so far!

  • Like 1
Link to comment
Share on other sites

 

For anyone interested in writing or examining Action! code on their PC with Notepad ++, I have put together a .udl (user defined language) file so you get some syntax highlighting. That makes reading code so much easier on the eyes (and brain), in my opinion anyway. I am attaching the file. In Notepad ++, just use Language --> Define Your Language --> Import.

 

Here is an example of how it looks:

 

example.png

 

For some reason I was not allowed to upload the .UDL file. I call it "Action!.udl" It is basically XML. I will instead paste the XML text into a code box in this message. Simply copy and paste that into a .udl file of your own, and import that into Notepad ++ as described.

<NotepadPlus>
    <UserLang name="Action!" ext="act" udlVersion="2.1">
        <Settings>
            <Global caseIgnored="no" allowFoldOfComments="no" foldCompact="no" forcePureLC="0" decimalSeparator="0" />
            <Prefix Keywords1="no" Keywords2="no" Keywords3="no" Keywords4="no" Keywords5="no" Keywords6="no" Keywords7="no" Keywords8="no" />
        </Settings>
        <KeywordLists>
            <Keywords name="Comments">00; 01 02 03 04</Keywords>
            <Keywords name="Numbers, prefix1"></Keywords>
            <Keywords name="Numbers, prefix2"></Keywords>
            <Keywords name="Numbers, extras1"></Keywords>
            <Keywords name="Numbers, extras2"></Keywords>
            <Keywords name="Numbers, suffix1"></Keywords>
            <Keywords name="Numbers, suffix2"></Keywords>
            <Keywords name="Numbers, range"></Keywords>
            <Keywords name="Operators1"></Keywords>
            <Keywords name="Operators2"></Keywords>
            <Keywords name="Folders in code1, open"></Keywords>
            <Keywords name="Folders in code1, middle"></Keywords>
            <Keywords name="Folders in code1, close"></Keywords>
            <Keywords name="Folders in code2, open"></Keywords>
            <Keywords name="Folders in code2, middle"></Keywords>
            <Keywords name="Folders in code2, close"></Keywords>
            <Keywords name="Folders in comment, open"></Keywords>
            <Keywords name="Folders in comment, middle"></Keywords>
            <Keywords name="Folders in comment, close"></Keywords>
            <Keywords name="Keywords1">DEFINE
INCLUDE
SET
MODULE
</Keywords>
            <Keywords name="Keywords2">ARRAY
BYTE
CARD
CHAR
DO
ELSE
ELSEIF
EXIT
FI
FOR
FUNC
IF
INT
LSH
MOD
OD
POINTER
PROC
RETURN
RSH
STEP
THEN
TO
TYPE
UNTIL
WHILE
</Keywords>
            <Keywords name="Keywords3">AND
OR
XOR
+
-
*
/
&
%
!
=
<>
#
>
>=
<
<=
$
^
@
(
)
[
]
"
'
==

</Keywords>
            <Keywords name="Keywords4"></Keywords>
            <Keywords name="Keywords5"></Keywords>
            <Keywords name="Keywords6"></Keywords>
            <Keywords name="Keywords7"></Keywords>
            <Keywords name="Keywords8"></Keywords>
            <Keywords name="Delimiters"></Keywords>
        </KeywordLists>
        <Styles>
            <WordsStyle name="DEFAULT" fgColor="000000" bgColor="FFFFFF" fontName="Lucida Console" fontStyle="0" nesting="0" />
            <WordsStyle name="COMMENTS" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="LINE COMMENTS" fgColor="008000" bgColor="FFFFFF" fontName="" fontStyle="2" nesting="0" />
            <WordsStyle name="NUMBERS" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="KEYWORDS1" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="1" nesting="0" />
            <WordsStyle name="KEYWORDS2" fgColor="0000FF" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="KEYWORDS3" fgColor="FF8040" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="KEYWORDS4" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="KEYWORDS5" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="KEYWORDS6" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="KEYWORDS7" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="KEYWORDS8" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="OPERATORS" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="FOLDER IN CODE1" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="FOLDER IN CODE2" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="FOLDER IN COMMENT" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="DELIMITERS1" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="DELIMITERS2" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="DELIMITERS3" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="DELIMITERS4" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="DELIMITERS5" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="DELIMITERS6" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="DELIMITERS7" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="DELIMITERS8" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
        </Styles>
    </UserLang>
</NotepadPlus>

Fujidude, why don't you send it here: http://docs.notepad-plus-plus.org/index.php?title=User_Defined_Language_Files

 

Then it can be incorporated into the official download of Notepad++

Link to comment
Share on other sites

Hey Kyle. I like to be satisfied that my work is of the quality and level of completion I'm comfortable with before I would make a move like that. I was just thrashing about trying to get something to work, and it does a bit. But I could see that there is much more that could be done. Unfortunately I couldn't find decent dox on the subject. There was some info, but it was scattered all about and it was taking too long to try and find the bits of info I wanted to know next. I mostly just figured it out on my own, but there is more to know.

 

Anyway, if and when (most likely the when) I get it more complete I think that would be a good idea. I've already made a couple small changes since I uploaded the version you see here on AA.

  • Like 1
Link to comment
Share on other sites

Okay, I figured out where the documentation was.... I had been there and missed what I was really seeing! I must have been tired. Anyway, I have now updated the .udl to a point where I think it is ready for the world. It now has proper operators and also code folding capabilities. I'll post it here again, but will also look into submitting it to the Notepad ++ community as Kyle22 suggested.

 

I still couldn't find any real info on how to do an autocomplete component for it though. That would be nice to do.

<NotepadPlus>
    <UserLang name="Action!" ext="act" udlVersion="2.1">
        <Settings>
            <Global caseIgnored="no" allowFoldOfComments="yes" foldCompact="no" forcePureLC="0" decimalSeparator="0" />
            <Prefix Keywords1="no" Keywords2="no" Keywords3="no" Keywords4="no" Keywords5="no" Keywords6="no" Keywords7="no" Keywords8="no" />
        </Settings>
        <KeywordLists>
            <Keywords name="Comments">00; 01 02 03 04</Keywords>
            <Keywords name="Numbers, prefix1"></Keywords>
            <Keywords name="Numbers, prefix2">$</Keywords>
            <Keywords name="Numbers, extras1">A B C D E F a b c d e f</Keywords>
            <Keywords name="Numbers, extras2"></Keywords>
            <Keywords name="Numbers, suffix1"></Keywords>
            <Keywords name="Numbers, suffix2"></Keywords>
            <Keywords name="Numbers, range"></Keywords>
            <Keywords name="Operators1">+ - * / & % ! == = <> # > >= < <= ^ @ ( ) [ ] ' + -
*
/
&
%
!
==
=
<>
#
>
>=
<
<=
$
^
@
(
)
[
]
'
</Keywords>
            <Keywords name="Operators2">AND OR XOR LSH MOD RSH</Keywords>
            <Keywords name="Folders in code1, open"></Keywords>
            <Keywords name="Folders in code1, middle"></Keywords>
            <Keywords name="Folders in code1, close"></Keywords>
            <Keywords name="Folders in code2, open">DO FUNC IF PROC</Keywords>
            <Keywords name="Folders in code2, middle">ELSE ELSEIF THEN</Keywords>
            <Keywords name="Folders in code2, close">OD FI RETURN</Keywords>
            <Keywords name="Folders in comment, open"></Keywords>
            <Keywords name="Folders in comment, middle"></Keywords>
            <Keywords name="Folders in comment, close"></Keywords>
            <Keywords name="Keywords1">DEFINE
INCLUDE
SET
MODULE
</Keywords>
            <Keywords name="Keywords2">ARRAY
BYTE
CARD
CHAR
DO
ELSE
ELSEIF
EXIT
FI
FOR
FUNC
IF
INT
OD
POINTER
PROC
RETURN
STEP
THEN
TO
TYPE
UNTIL
WHILE
</Keywords>
            <Keywords name="Keywords3"></Keywords>
            <Keywords name="Keywords4"></Keywords>
            <Keywords name="Keywords5"></Keywords>
            <Keywords name="Keywords6"></Keywords>
            <Keywords name="Keywords7"></Keywords>
            <Keywords name="Keywords8"></Keywords>
            <Keywords name="Delimiters">00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23</Keywords>
        </KeywordLists>
        <Styles>
            <WordsStyle name="DEFAULT" fgColor="000000" bgColor="FFFFFF" fontName="Lucida Console" fontStyle="0" nesting="0" />
            <WordsStyle name="COMMENTS" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="LINE COMMENTS" fgColor="008000" bgColor="FFFFFF" fontName="" fontStyle="2" nesting="0" />
            <WordsStyle name="NUMBERS" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="1" nesting="0" />
            <WordsStyle name="KEYWORDS1" fgColor="000000" bgColor="C0C0C0" fontName="" fontStyle="1" nesting="0" />
            <WordsStyle name="KEYWORDS2" fgColor="0000A0" bgColor="FFFFFF" fontName="" fontStyle="1" nesting="0" />
            <WordsStyle name="KEYWORDS3" fgColor="FF8000" bgColor="FFFFFF" fontName="" fontStyle="1" nesting="0" />
            <WordsStyle name="KEYWORDS4" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="KEYWORDS5" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="KEYWORDS6" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="KEYWORDS7" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="KEYWORDS8" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="OPERATORS" fgColor="FF0000" bgColor="FFFFFF" fontName="" fontStyle="1" nesting="0" />
            <WordsStyle name="FOLDER IN CODE1" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="FOLDER IN CODE2" fgColor="8000FF" bgColor="FFFFFF" fontName="" fontStyle="1" nesting="0" />
            <WordsStyle name="FOLDER IN COMMENT" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="DELIMITERS1" fgColor="008080" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="DELIMITERS2" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="DELIMITERS3" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="DELIMITERS4" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="DELIMITERS5" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="DELIMITERS6" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="DELIMITERS7" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="DELIMITERS8" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
        </Styles>
    </UserLang>
</NotepadPlus>

Edited by fujidude
  • Like 2
Link to comment
Share on other sites

Thanks. I'm glad it is useful for someone besides me. As to that issue.... yeah I really don't know what can be done about that. I don't think it can be addressed by the UDL system in NP++. The built-in languages can have more advanced criteria than the UDL, because they are programmed right into the software. At least that's what the dox say.

Edited by fujidude
Link to comment
Share on other sites

  • 1 month later...

I have created an Action! library for SpartaDOS X. It is already part of the posting of my AAC program I made (in its own topic). I will post the library here in text form:

;--------------------------------------------------------------------------
;SDX Library v1.3 for the Action! programming language.
;
;A collection of routines useful for creating programs which run under ;SpartaDOS X, especially those which utilize the command
;
;Background information was obtained primarily from the "Programming
;with SpartaDOS X" section of the SpartaDOS X 4.47 User Guide, the
;SpartaDOS X4.47 Programming Guide, various code examples, the great online
;community at www.atariage.com, and of course the Action! documentation.
;
;Copyright (C) 2015  FujiDude
;
;    This program is free software: you can redistribute it and/or modify
;    it under the terms of the GNU General Public License as published by
;    the Free Software Foundation, either version 3 of the License, or
;    (at your option) any later version.
;
;    This program is distributed in the hope that it will be useful,
;    but WITHOUT ANY WARRANTY; without even the implied warranty of
;    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;    GNU General Public License for more details.
;
;    You should have received a copy of the GNU General Public License
;    along with this program.  If not, see <http://www.gnu.org/licenses/>.
;--------------------------------------------------------------------------

MODULE ;Allow additions to global variables

CARD COMTAB = $0A


;------------------------------------
;Process next parameter on CL.  Dummy
;routine.  Gets set to point to SD
;crunch routine by sdxLibInit().
;Crunch reads the next CL parameter,
;processes it, and then stores the
;result at COMFNAM (COMTAB+33).
;------------------------------------
PROC crunch()


;------------------------------------
;EOL terminated line to string.
;This accepts two parameters, the 1st
;being the address of a place in
;memory where EOL terminated string
;data resides, and the 2nd a string
;variable which will get a copy of
;that data.  The EOL terminated data
;must be 255 characters or less, as
;Action strings only support a max
;length of 255.
;------------------------------------
PROC ln2S(CHAR ARRAY l, a)
  BYTE i
  FOR i=0 TO 255
    DO
    IF l(i) = $9B THEN EXIT FI
    a(i + 1) = l(i)
    OD
  a(0)=i
RETURN


;------------------------------------
;Number of parameters.  Returns
;number of parameters on the command
;line, not counting the program name
;itself.
;------------------------------------
BYTE FUNC nParms()
  BYTE i, c
  BYTE POINTER cl
  c = 0
  cl = COMTAB + 63 ;LBUF
  FOR i = 1 TO 64
    DO
    IF cl^ = $9B THEN EXIT FI
    IF cl^ = $20 THEN
      c == + 1 ;Increase count.
    FI
    cl == + 1    
    OD
RETURN(c)


;------------------------------------
;Length of command line.  Returns the
;length of the CL located at LBUF.
;------------------------------------
BYTE FUNC lenCL()
  BYTE i
  BYTE POINTER cl
  cl = COMTAB + 63 ;LBUF
  FOR i = 0 TO 63
    DO
    IF cl^ = $9B THEN EXIT FI
    cl == + 1
    OD
RETURN(i)


;------------------------------------
;Get entire command line.  Pass in
;address of a 65 byte long string.
;Entire CL will be returned in that
;string.
;------------------------------------
PROC getCL(CHAR ARRAY r)
  BYTE i
  BYTE POINTER cl
  r(0) = 0 ;Init to zero length.
  cl = COMTAB + 63
  FOR i = 0 TO 63
    DO
    IF cl^ = $9B THEN EXIT FI
    r(i + 1) = cl^
    r(0) = i + 1
    cl == + 1
    OD
RETURN


;------------------------------------
;Enter DOS via DOSVEC.  Equivilent to
;JMP ($000A) - an indirect jump to
;the address.  No "RETURN" is needed
;since we just jump to DOS.
;------------------------------------
PROC goDOS()
  [$6C $0A $00]

  
;------------------------------------
;Check for a switch in CL buffer.
;Function to check for switch in SDX
;command line.  Pass switch to look
;for as a single char.  Slash and
;hyphen will be assumed need to
;preceed switch.  Function returns 1
;if found, otherwise 0 is returned.
;------------------------------------
BYTE FUNC swChk(CHAR s)
  BYTE i
  BYTE POINTER cl
  cl = COMTAB + 63 ;LBUF
  FOR i = 0 TO 62 ;62 is last position switch should start in.
    DO
    IF cl^ = $9B THEN EXIT FI
    IF cl^ = '/ OR cl^ = '- THEN
      IF Peek(cl + 1) = s THEN RETURN(1) FI ;Switch found.
    FI
    cl == + 1
    OD
RETURN(0)
    

;------------------------------------
;Get next raw parm from CL.  This
;routine bypasses the built in
;crunch, operating directly on LBUF.
;Each time it is called, it gets the
;next parameter and places it back in
;the string which was passed to this
;routine for that purpose.
;
;If there are no more parameters, the
;string is set to 0 length.  Use that
;as a test for no more parameters.
;Parameters are expected to be space
;delimited.
;
;NOTE: this is independent of
;getParm(), and the two procedures
;track what is next independently.
;------------------------------------
PROC getRParm(CHAR ARRAY rParm)
  BYTE bOff = [0], i
  BYTE POINTER cl
  rParm(0) = 0 ;Init to zero length.
  i = 0
  cl = COMTAB + 63 + bOff
  WHILE cl^ # $20 AND cl^ # $9B ;Not space or EOL.
    DO
    rParm(i + 1) = cl^ ;Copy next char from LBUF to rParm.
    rParm(0) = i + 1 ;Adjust length byte accordingly.
    i == + 1
    cl == + 1
    OD
  IF cl^ = $9B THEN ;EOL is reached.
    bOff == + i ;bOff now set to be "on" the EOL.
  ELSE ;Space delimiter is reached.
    bOff == + i + 1 ;Set to position immediately following delimiter.
  FI
RETURN

;------------------------------------
;Get next "crunched" parameter.  Uses
;the SD "crunch" (or ZCRNAME) to get
;the next parameter.
;NOTE: this is independent of
;getRParm(), and the two procedures
;track what is next independently.
;------------------------------------
PROC getParm(CHAR ARRAY s)
  CARD a
  a = COMTAB + 33 ;Value of a now set to address of COMFNAM.
  crunch()
  ln2S(a, s)  
RETURN


;------------------------------------
;Initialize the library.  Take care
;of any init tasks the library
;requires.  This should be called
;first before any other routines in
;the library are invoked.  Returns 1
;if SpartaDOS is present and library
;initialized.  Returns 0 if not.
;------------------------------------
BYTE FUNC sdxLibInit()
  BYTE isSD = $700
  CARD POINTER a
  IF isSD # 'S THEN RETURN(0) FI ;SD not present
  a = COMTAB + 4 ;Addr of ZCRNAME is here.
  crunch = a^ ;Set AAC crunch routine to addr of SD crunch.
RETURN(1) ;SD present, init done.

  • Like 2
Link to comment
Share on other sites

Don't know who might be programming in Action! but hopefully this comes in handy. I want it to be free for anyone to use in their own program, but if they do, I want them to make their work free too. I like to promote free and open source software. That's why I chose the GNU license rather than just say PD.

 

I'm already thinking of ways to leverage SDX's built in routines via Action!, but I'm not sure if I'll do much with it if there really isn't an audience anymore.

  • Like 1
Link to comment
Share on other sites

One thing that confused me, reading this and your other thread: you end your program by jumping to DOSVEC, instead of just exiting normally? Doesn't that leave some addresses on the stack? (taking up a few bytes)

 

Just wondering, I have no experience with Action, and haven't written much for SpartaDOS, but I assumed most programs were just exiting via RTS at the end (I believe cc65 does this and I haven't seen any issues running programs in Sparta.)

 

PS. I've had thoughts of writing a SpartaDOS library like this for cc65... if I ever get around to it, this will help a lot!

Edited by Shawn Jefferson
  • Like 1
Link to comment
Share on other sites

  • 3 weeks later...

I've been re-learning Action! after many many idle years. I'm blogging my progress here: http://unfinishedbitness.info/tag/action/

 

Maybe if anyone views it they can point out things I've done wrong. Or maybe I shouldn't make that statement ;)

 

Is there some documentation that states how the Input[D] routines work exactly? I guess my real question is whats the best way to write a card value to file in LSB/MSB and read it back; and how does InputSD work vs InputMD? I know MD has a max # to read, but what if the string is shorter? Does it expect an EOL to terminate?

 

Now that I read what I've written, it sounds dumb. I don't think I've articulated my thoughts correctly.

 

Wade

  • Like 1
Link to comment
Share on other sites

One thing that confused me, reading this and your other thread: you end your program by jumping to DOSVEC, instead of just exiting normally? Doesn't that leave some addresses on the stack? (taking up a few bytes)

 

Just wondering, I have no experience with Action, and haven't written much for SpartaDOS, but I assumed most programs were just exiting via RTS at the end (I believe cc65 does this and I haven't seen any issues running programs in Sparta.)

 

PS. I've had thoughts of writing a SpartaDOS library like this for cc65... if I ever get around to it, this will help a lot!

 

Hi Shawn. You bring up a good question there. I have been pondering this some too. I will put a couple of quotes here from the SpartaDOS 4.47 Programmer's Guide.

 

From page 46:

 

It should be kept in mind that programs ending via JMP ($000A) do this because of changing the stack contents, which in turn makes it impossible to return via RTS. Therefore a program which regains control by taking the vdos over, should use JMP ($000A) to terminate itself as well.

 

From page 53:

 

15.2 Unconditional exit to DOS (_DOS)

Executing JMP _DOS will do almost the same thing as JMP (DOSVEC) – the calling program will get terminated and removed from the memory, and the control returns to the shell. An important difference is that after JMP _DOS the DOS will get entered unconditionally and the vector vdos $07E3 will get ignored. Because of that, if a program was invoked from within another program (via U_LOAD), the calling program does not have a possibility to regain control, but it will get terminated as well.

 

JMP _DOS should not be overused, because technically it is possible to take this call over: it is enough for a calling program to create own symbol _DOS pointing to own routine. Therefore it is better to leave JMP _DOS for exceptional occasions and terminate programs with JMP (DOSVEC), allowing parent programs to regain control in easy way by changing the vdos vector.

A better method of program termination is to use RTS – this allows to return to the calling program (which is not necessarily DOS) without additional trouble.

 

From what I gather, when SpartaDOS gets entered via a jump through DOSVEC, it makes use of or otherwise takes care of what's on the stack. This contrasting with a jump to its _DOS routine, which skips that kind of housekeeping. And yet, it is suggested that ending with an RTS is a great way to end a program. Hmm. I bet drac030 could clear this up in a second.

Link to comment
Share on other sites

One basic implication is that DOS called your program's RUN vector with JSR, so if you reset the stack pointer at the top of your application or otherwise overwrite stack data, RTS will not return to DOS. The other point mentioned is that terminating with RTS enables control to be gracefully handed back to a "parent" application (not necessarily DOS) which spawned your application.

 

Unless you're doing stuff like reset protection, terminating with RTS should work fine.

  • Like 1
Link to comment
Share on other sites

I've been re-learning Action! after many many idle years. I'm blogging my progress here: http://unfinishedbitness.info/tag/action/

 

Maybe if anyone views it they can point out things I've done wrong. Or maybe I shouldn't make that statement ;)

 

Is there some documentation that states how the Input[D] routines work exactly? I guess my real question is whats the best way to write a card value to file in LSB/MSB and read it back; and how does InputSD work vs InputMD? I know MD has a max # to read, but what if the string is shorter? Does it expect an EOL to terminate?

 

Now that I read what I've written, it sounds dumb. I don't think I've articulated my thoughts correctly.

 

Wade

 

Hi Wade. I'll try to take a look at your blog when I get a chance and offer feedback. I'm no Action! or even Atari programming guru by any means. I just recently got back into this stuff too and some of it is relearning.

 

I have been using this handy manual. It combines the Action! manual with the Toolkit and RunTime manuals. It does have some minor conversion errors in it, but hopefully they are easy to see and account for when they are seen.

 

After reading in section 3.2, I come to this understanding (I have not tested this though):

 

InputSD will read from a device/file a string of characters until an EOL ($9B) is encountered. It will convert that EOL terminated string into an Action! string, which is the same thing but minus and ending EOL and having a length byte placed at the beginning.

 

InputMD I think would operate exactly like InputSD, with the exception that the string will only be as large as MAX or up to the EOL, whichever comes soonest. Perhaps that isn't the case though. Perhaps it pads so it is always a fixed length, but I doubt it. The term "max" itself and the failure of the function description itself to mention padding makes me think that.

Action system, run-time, and tool-kit manual.pdf

Edited by fujidude
Link to comment
Share on other sites

I saw some strange results when using InputSD and InputMD that I was only able to resolve by writing my own routine to read x bytes from device. Specifically when writing bytes and cards (other vars) around the string. I tried putting EOL and without. Oddly, without I get more predictable results. I need to fully run through this for a complete understanding. And InputCD didn't seem to work as I expected either. Likely just my mis-use which is why I'm looking for more technical info than whats in the reference manual. Thx for the help!

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...