			     ARGU 0.X

		      by Per Blomqvist 1998-08
	       Tysler@hotmail.com, ie9510@malmo.lth.se  

	VARNING! It's safe for me all right, but .. any way this is
		 the first program I wrote with code and put on the net.

Hello.
I must first make excuse for my bad English, I hope you understand me any way.
I have made a program that's makes argument check for usrRPL commands.
I know that theirs an other program USAGE that does the same thing,
made by HP self. But I don't like the out put of that thing.
My program uses UFL with font1, if this is not present the out put 
is ordinary big hp font2. It's display the argument in the same order
as it comes in the real code. Afterwards the object is still on the stack.
This make it easy to mask out the sysRPL command with jazz.
This is one of my first sysRPL program, and the fist with code.
That's way I'm put an X in the version number. So pleas take notice and backup
memory or so before testing it. Its so far works only good for me on
my HP 48GX ROM version R. I'm looking for coding suggesting/help from 
some folks who maybe know better.

____ SYNTAX ____
 In opposite to USAGE , AGRU does not take list of usrRPL.
 You have to put only the usrRPL command on the stack.
 This is made through OBJ-> on the list.
	ex: 
	Put     1:{ + } 
	Type      OBJ->  
	Execute   ARGU
At least this one have work dussens of time for me perfect, so I think it's
safe for you to.



		   
___THE CODE____   x x
		   o 

If it's any body wonder something in this code,
feel free to e-mail me. Theirs no stupid question. -"for me"
And if you some guru who know better code feel more free e-mail me.


::
 CK1
 DUP ZERO 
 {{ LA }}
 DUPTYPEROMP?           * If it's some ROMPTR then recall it
 IT
 ::
  ROMPTR@               * yea
  DROP                  * Dropping flag
 ;
 DUP
 CARCOMP                * breaking out the first object in the composite(the program)
			


*A*** Check for number of arguments or LA keeps 'ZERO' ***A*
 ::
  DUP  ' CK1&Dispatch EQUALcase
  ::
   DROP
   ONE LA!
  ;
  DUP ' CK2&Dispatch EQUALcase
  ::
   DROP
   TWO LA!
  ;
  DUP ' CK3&Dispatch EQUALcase
  ::
   DROP
   THREE LA!
  ;
  DUP ' CK4&Dispatch EQUALcase
  ::
   DROP
   FOUR LA!
  ;
  DUP ' CK5&Dispatch EQUALcase
  ::
   DROP
   FIVE LA!
  ;
  DROP
 ;
*A***   END     ***A*


****** And here is 'my' argument check/handle
 LA
 #0=
 IT             * If LA is ZERO then:
 ::
  DROP
  ABND                  * Abound temp var
  $ "Ingen CK&.."       * Put out an fault string
  TRUE
 ;
 FALSE
 ?SEMI                  * Quit the program, if LA 'was' zero
*********************

*B***  Make a composite with only the numbers, of the original prg check **B*
 INNERCOMP      
 DUP#1+
 ROLL
 DROP#1-
 NULL::
 SWAP
 #2/
 ZERO_DO
 UNROTDROP
 >TCOMP
LOOP
*B***   END     ***B*



:: LA
 {{  LIS LA }} ZERO     * Keep Numbers in LA, and put the Comp in LIS
 
*C***   Making Strings of the numbers in LA  ***C* 
 BEGIN
  LIS CARCOMP           
  ONE
  SWAP
  NULL$
  3UNROLL

 *D**  Making 'one' string of the fist number of remaining LIS **D*
  BEGIN


*********************
* NOTE!! THIS IS MY FIRST WORKING CODE OBJECT
* This Code function is #1 -> #1 #2 #3
* 1: Were #2 is ASR of #1 and #3 is the same as #1 last nibb.
* 2: Or #2 is ASR ASR of #1 and #3 is the same as #1 last byte.
* Exp1:  <2658h> -> <2658h>  <265h>  <8h> 
* Exp2:  <265Fh> -> <265Fh>  <26h> <8Fh>
* I wants to maybe know drop the first 


   CODE
	GOSBVL  =SAVPTR         
	A=DAT1  A       
	D0=A
	D0=D0+  5
	A=DAT0  A       * Well some how here now is the hex in A 
	LCHEX   0000F   * Load hex number with specified length into C 
	C=C&A   B       * Last A nibb is now in C

	C=C+1   B       *This is for checking if 
	CSL     X       *the last nibb if the hex is F
	CSL     X       *
	?C=0    XS      *

	GOYES   Far     * If it was then go to label 'Far'

	R2=A.F  A       * Im saving the hex in backup register 
	ASR     A       
	R0=A.F  A       * Preparing for fist output to the stack
	GOSBVL  =PUSH#  
	GOSBVL  =SAVPTR 
	A=R2.F  A       * Get back the backup of original hex
	LCHEX   0000F   
	A=A&C   A
ut      R0=A.F  A
	GOSBVL  =PUSH#          * final out 
	GOSBVL  =SAVPTR
	GOVLNG  =GETPTRLOOP

Far     R2=A.F  A       
	ASR     A       
	ASR     A       * one extra here
	R0=A.F  A
	GOSBVL  =PUSH#
	GOSBVL  =SAVPTR
	A=R2.F  A
	LCHEX   000FF   * here to
	A=A&C   A
	GOTO    ut      * go to the final output
   ENDCODE
   ROTDROP              * I drop the third obj here out
******************************
** The above was first implented in sysRPL as following
** Or something like following, I have only notes left 
* #>HXS DUP
* HXS 1 F
* DUPUNROT
* bitAND
* HXS#HXS
* #0<>          * This is not thure 
* ITE
* ::
* DUP
* HXS 1 F 
* bitAND
* SWAP
* bitSR
* bitSR
* bitSR
* bitSR
* SWAP 
* ;
* ::
* DUP 
* HXS 2 FF
* bitAND
* SWAP
* bitSRB
* SWAP
* ;
* HXS>#
*** This one works fine but I jest wanted to test making something simple in Code
***************

   ::                                           * Getting part string 
    ZERO        OVER#=case      $ "any "
    ONE         OVER#=case      $ "real"
    TWO         OVER#=case      $ "cmp "
    THREE       OVER#=case      $ "str "
    FOUR        OVER#=case      $ "arry"
    FIVE        OVER#=case      $ "list"
    SIX         OVER#=case      $ "idnt"
    SEVEN       OVER#=case      $ "lam "
    EIGHT       OVER#=case      $ "prog"
    NINE        OVER#=case      $ "symb"
    TEN         OVER#=case      $ "sym "
    ELEVEN      OVER#=case      $ "hxs "
    TWELVE      OVER#=case      $ "grob"
    THIRTEEN    OVER#=case      $ "Tagg"
    FOURTEEN    OVER#=case      $ "unit"
    FIFTEEN     OVER#=case      $ "XLIB"
    THIRTYONE   OVER#=case      $ "Sbin"
    FORTYSEVEN  OVER#=case      $ "Dir "
    SIXTYTHREE  OVER#=case      $ "ExRe"
    SEVENTYNINE OVER#=case      $ "ExCp"
    # 5F        OVER#=case      $ "LkAr"
    # 6F        OVER#=case      $ "char"
    # 7F        OVER#=case      $ "code"
    # 8F        OVER#=case      $ "Libr"
    # 9F        OVER#=case      $ "Back"
    # AF        OVER#=case      $ "Libd"
    # BF        OVER#=case      $ "Ext1"
    # CF        OVER#=case      $ "Ext2"
    # DF        OVER#=case      $ "Ext3"
    # EF        OVER#=case      $ "Ext4"
    $ "?   "                            * This last one have never happend
   ;
   SWAPDROP
   CHR_:        * Building final string
   >H$
   3PICK
   UNCOERCE     * Here the stack level is included
   a%>$
   SWAP
   &$
   APPEND_SPACE         * Some space
   4ROLL
   &$
   THREE
   ROLL
   #1+
   ROT
   OVER
   LA           * Of La number of part strings
   #>
  UNTIL
*D**    Here would one full string be finnish **D*


  2DROP 
  DUP
  LEN$
  #1-
  ONE
  SWAP
  SUB$          
  SWAP
  #1+
  LIS CDRCOMP
  DUPNULLCOMP?
  SWAP !LIS      
 UNTIL
*C***  all numbers of LIS is now transformed to list ***C*

*E***           Out put         ***E*
** It work as, if there is UFL with font1 then the out put is in small font
** Else the out put is in ordinary big fonts, and cuts the out view if the 
** arguments if it was more than 3. The topp number is 5 but.
** There is no risk for cut out look in the small fonts

 ::                     * Locking for UFL
  '
  ROMPTR 101 1
  ROMPTR@
  NOTcaseFALSE
  DROPTRUE
 ;
 ITE
 ::
  ONE
  ROMPTR 101 2          * And for FNT1 
 ;
 FALSE
 ITE

 ::
  DOCLLCD
  ZERO_DO
   INDEX@               
   NINE #/ DROP         * This transform of index@ is in range of 0..8
   SWAPOVER                     
   SIX          *
   #* #1+       * Make the Column distans right 
   ZEROSWAP

   ROMPTR 101 3
   CODE EB 143818F0981AF00174E78F1466081AF028F1466081AF018FC15231318FABFF28AE606F90D581AF1ADAD231438B2606680D6C4F2C6C28F13C10CA81AF19D7D231128B3F5DFE3CA130CD415CF4C4D2D014B81AF18C4C2C2C213715B5150016F16F1610C886EE20135171132D231BCEA1306FAF8D34150
		* This code is something that i have taken out of
		* access.dir that followed with UFL-packige
		* Taking three arguments 3:strg 2:row 1:coll            
		
   EIGHT
   #=
   IT
   ::
    WaitForKey          * If all line is full, then 'FREEZE'
    2DROP
    DOCLLCD
   ;
  LOOP
 ;


::                      
 ZERO_DO                * This procedure is much like the over procedure
  INDEX@
  
  SEVEN #/ DROP #1+     * This transform of index@ is in range of 1..7 
  SWAPOVER
  
  DISPN                 
  SEVEN 
  EQUAL
  IT
  ::
   WaitForKey
   2DROP
   DOCLLCD
  ;
 LOOP
;
 WaitForKey     * I have a 'FREESE' function out here to
 2DROP          * because mostly its odd number of strings to levels  
 ;              * This makes like double 'FREESE' if the last screen is field 
;
