Jump to content
Bones-69

RXB - Rich Extended Basic

Recommended Posts

On 11/28/2019 at 2:36 PM, RXB said:

As you can see the code is the same in TI INTERN as my code in RXB 2015, error? (where?)

XB amd TI BASIC use the scratchpad in different ways. Maybe there is a memory conflict somewhere in the scratchpad?

Share this post


Link to post
Share on other sites
13 hours ago, senior_falcon said:

XB amd TI BASIC use the scratchpad in different ways. Maybe there is a memory conflict somewhere in the scratchpad?

Hmmm the locations are exactly the same use, >8378 Random location same, >834A FAC the same, >8310 VAR5 the same

so what SCRATCH PAD address is different?

I guess I could change VAR5 to another address but this is the first time any problems have ever cropped up.

Are you sure the problem is not your Assembly program?

Share this post


Link to post
Share on other sites
2 hours ago, RXB said:

 

Are you sure the problem is not your Assembly program?

It works with regular XB and does not work with the random number generator in RXB.

 

(edit) An example of different locations is the "insert" flag. This is at >8363 in TI BASIC and >8364 in XB

Edited by senior_falcon

Share this post


Link to post
Share on other sites

Maybe this would be helpful for you. I have attached RNDTESTXB which is an XB program that has a simple assembly routine that prints a random number on the screen. The assembly routine is called this way: CALL LINK("RANDOM",N) where N is a number from 0 to 9. The number is converted to an integer and printed on the screen at R23,C3. In TIXB you can pass a random number (RND*9) and it is printed on the screen. RXB cannot do this but gives a "subprogram not found" message.  

The assembly program:
	DEF RANDOM
	
WKSP	BSS 32
RANDOM	LWPI WKSP
	CLR R0
	LI R1,1
	BLWP @NUMREF
	BLWP @XMLLNK
	DATA >12B8		CFI
	MOVB @FAC+1,R1
	AI R1,>9000		CONVERT TO ASCII PLUS OFFSET
	LI R0,>02C2		BOTTOM OF SCREEN
	BLWP @VSBW
	LWPI >83E0
	B @>006A
And the XB program:

10 CALL INIT :: CALL LOAD(8192,255,172):: CALL LINK("X")  (this is a SYSTEX like loader to put the assembly routine into low memory)
20 CALL LINK("RANDOM",RND*9)
30 PRINT
40 GOTO 20

 

RNDTESTXB.zip

Share this post


Link to post
Share on other sites
20 hours ago, senior_falcon said:

Maybe this would be helpful for you. I have attached RNDTESTXB which is an XB program that has a simple assembly routine that prints a random number on the screen. The assembly routine is called this way: CALL LINK("RANDOM",N) where N is a number from 0 to 9. The number is converted to an integer and printed on the screen at R23,C3. In TIXB you can pass a random number (RND*9) and it is printed on the screen. RXB cannot do this but gives a "subprogram not found" message.  

The assembly program:
	DEF RANDOM
	
WKSP	BSS 32
RANDOM	LWPI WKSP
	CLR R0
	LI R1,1
	BLWP @NUMREF
	BLWP @XMLLNK
	DATA >12B8		CFI
	MOVB @FAC+1,R1
	AI R1,>9000		CONVERT TO ASCII PLUS OFFSET
	LI R0,>02C2		BOTTOM OF SCREEN
	BLWP @VSBW
	LWPI >83E0
	B @>006A
And the XB program:

10 CALL INIT :: CALL LOAD(8192,255,172):: CALL LINK("X")  (this is a SYSTEX like loader to put the assembly routine into low memory)
20 CALL LINK("RANDOM",RND*9)
30 PRINT
40 GOTO 20

 

RNDTESTXB.zip 371 B · 2 downloads

XB CALL INIT has NUMREF and uses >8310 and my RND does same as TI Basic.

Where is the name "RANDOM" for CALL LINK loaded as I do not see it put into low memory?

I see a CALL LINK("X") but RXB has had issues with SYSTEX before as they use hard coded GPL address that only works with XB  and fails with others XB's.

I suspect the SYSTEX loader never put the program into memory, hence gives a "subprogram not found" message.

Edited by RXB
spelling error

Share this post


Link to post
Share on other sites
3 hours ago, RXB said:

XB CALL INIT has NUMREF and uses >8310 and my RND does same as TI Basic.

Where is the name "RANDOM" for CALL LINK loaded as I do not see it put into low memory?

I see a CALL LINK("X") but RXB has had issues with SYSTEX before as they use hard coded GPL address that only works with XB  and fails with others XB's.

I suspect the SYSTEX loader never put the program into memory, hence gives a "subprogram not found" message.

This is not systex. It is my own loader similar to systex. There are no hard coded addresses.  Run the program. You'll get the error "subprogram not found" in line 20. Use Classic99's debugger to take a look into low memory. Look at >2002 and >2004. They should be >2540 and >3FF8. This shows the xb routine was loaded. Look at >3FF8 and you will see "RANDOM", also indicating that the program was loaded. If you really want to be sure the program is loaded you can open up Classic99 and select XB and open up a second Classic99 and select RXB. Compare the code from >24F4 to >2540. It should be the same. I suppose the file might have been corrupted when I made the zip file, but I doubt it.

The "subprogram not found" is a red herring. At times passing a random number leads to a crash with the usual colorful graphics on the screen.

Share this post


Link to post
Share on other sites
On 12/1/2019 at 11:32 AM, senior_falcon said:

It works with regular XB and does not work with the random number generator in RXB.

 

(edit) An example of different locations is the "insert" flag. This is at >8363 in TI BASIC and >8364 in XB

Hmmm that is not a PERMANENT FLAG, it is a temporary flag.

[1806] 6C3A 8E,64    VALIZ9 CZ   @ARG8             INSERT mode?
[1807] 6C3C 6C,91           BS   G6C91
[1808]               * INSERT - is COMPLICATED!!!!! Because of those edge charac
[1809]               * Shift up all things. . . . continue as a standard insert
[1810]               * VARA <= ARG2
[1811] 6C3E D5,2A,5E        DCEQ @ARG2,@VARA       If end of screen
[1812] 6C41 6C,68           BS   READZ4
[1813]               *----------------------------------------------------------
[1814]               * Fix Editing a line that has been retrived by the REDO key
[1815]               * and may garble the last few characters bug, 5/28/81
[1816] 6C43 D6,B0,2A        CEQ  EDGECH,V*VARA     If at end of line
       6C46 7F
[1817] 6C47 4C,68           BR   READZ4
[1818] 6C49 D7,2A,02        DCEQ >02FE,@VARA       If also at end of screen
       6C4C FE
[1819] 6C4D 4C,64           BR   G6C64
[1820] 6C4F 0F,83           XML  SCROLL            Scroll the screen
[1821] 6C51 A7,20,00        DSUB 32,@VARW          Back up line start address
       6C54 20
[1822] 6C55 A7,2A,00        DSUB 28,@VARA          Back up to current start line
       6C58 1C
[1823] 6C59 A7,5E,00        DSUB 32,@ARG2          Absolute high limit backs up
       6C5C 20
[1824] 6C5D A7,61,00        DSUB 32,@ARG5          Current cursor position too
       6C60 20
[1825] 6C61 05,6C,68        B    READZ4
[1826] 6C64 A3,2A,00 G6C64  DADD 4,@VARA           Skip to next line
       6C67 04
[1827]               *----------------------------------------------------------
[1828] 6C68 BD,5C,2A READZ4 DST  @VARA,@ARG        Use ARG as temp for insert
[1829] 6C6B C5,5C,61 G6C6B  DCH  @ARG5,@ARG        Move everything up to current
[1830]               *                              line
[1831] 6C6E 4C,8A           BR   G6C8A
[1832] 6C70 93,5C           DDEC @ARG              Copy lower location to higher
[1833] 6C72 BC,E0,01        ST   V*ARG,[email protected](@ARG)   Going from high to low
       6C75 5C,B0,5C
[1834] 6C78 D6,B0,5C        CEQ  EDGECH,V*ARG      Bumped into wall again
       6C7B 7F
[1835] 6C7C 4C,88           BR   G6C88
[1836] 6C7E A7,5C,00        DSUB 4,@ARG            Skip the wall
       6C81 04
[1837] 6C82 BC,E0,05        ST   V*ARG,[email protected](@ARG)   And move character over
       6C85 5C,B0,5C
[1838] 6C88 4C,6B    G6C88  BR   G6C6B

99/4 GPL-ASSEMBLER (Pass 3) correct                                   PAGE 0035 
EDIT-359
[1839] 6C8A C9,2A,5E G6C8A  DCHE @ARG2,@VARA       Only update VARA if upper
[1840] 6C8D 6C,91           BS   G6C91
[1841] 6C8F 91,2A           DINC @VARA              hasn't been reached yet
[1842] 6C91 A2,75,60 G6C91  ADD  OFFSET,@RKEY      Create displayable character
[1843] 6C94 BC,B0,61        ST   @RKEY,V*ARG5      Display at current character
       6C97 75
[1844]               *                              position
[1845] 6C98 86,60           CLR  @ARG4             Indicate change in line
[1846] 6C9A D5,61,5E READ05 DCEQ @ARG2,@ARG5       Hit right margin
[1847] 6C9D 4C,AD           BR   G6CAD
[1848] 6C9F 8E,A3,74        CZ   [email protected]          If not the first time
[1849] 6CA2 6C,A7           BS   G6CA7
[1850] 6CA4 06,00,34        CALL TONE1             ---BEEP---
[1851] 6CA7 BE,A3,74 G6CA7  ST   >FF,[email protected]      Set the flag
       6CAA FF
[1852] 6CAB 4A,A8           BR   READZ1            Stay in current mode !!!!
[1853] 6CAD 91,61    G6CAD  DINC @ARG5             Update current address
[1854] 6CAF D6,B0,61        CEQ  EDGECH,V*ARG5     Correct for next line
       6CB2 7F
[1855] 6CB3 4C,B9           BR   G6CB9
[1856] 6CB5 A3,61,00        DADD 4,@ARG5           By skipping border
       6CB8 04
[1857] 6CB9 C5,61,2A G6CB9  DCH  @VARA,@ARG5       Check for last new high limit
[1858] 6CBC 4C,C1           BR   G6CC1
[1859] 6CBE BD,2A,61        DST  @ARG5,@VARA       Update new high limit
[1860] 6CC1 CB,2A,02 G6CC1  DCHE >02FE,@VARA       Still some space to go
       6CC4 FE
[1861] 6CC5 4A,A8           BR   READZ1
[1862] 6CC7 0F,83           XML  SCROLL            Scroll the screen!!!
[1863] 6CC9 A7,2A,00        DSUB 28,@VARA          Back to current start of line
       6CCC 1C
[1864] 6CCD 8E,64           CZ   @ARG8             If not insert mode then
[1865] 6CCF 6C,D5           BS   G6CD5
[1866] 6CD1 A7,2A,00        DSUB 4,@VARA           Off by 4 more-correct it
       6CD4 04
[1867] 6CD5 A7,20,00 G6CD5  DSUB 32,@VARW          Backup line start address
       6CD8 20
[1868] 6CD9 A7,5E,00        DSUB 32,@ARG2          Absolute high limit backs up
       6CDC 20
[1869] 6CDD A7,61,00        DSUB 32,@ARG5          Current cursor position too
       6CE0 20
[1870] 6CE1 4A,A8           BR   READZ1            Start with something else
[1871]               *

Using it like a permanent flag is just wrong, ARG has many uses so making the claim this is a permanent flag is just incorrect.

[0183]               * ARG  EQU  >835C             Floating-point ARGument
[0184] 835D          ARG1   EQU  ARG+1
[0185] 835E          ARG2   EQU  ARG+2
[0186] 835F          ARG3   EQU  ARG+3
[0187] 8360          ARG4   EQU  ARG+4
[0188] 8361          ARG5   EQU  ARG+5
[0189] 8362          ARG6   EQU  ARG+6
[0190] 8363          ARG7   EQU  ARG+7
[0191] 8364          ARG8   EQU  ARG+8
[0192] 8364          XSTLN  EQU  >8364            GKXB variable
[0193] 8366          XENLN  EQU  >8366            GKXB variable

99/4 GPL-ASSEMBLER (Pass 3) correct                                   PAGE 0004 
EQUATES EDIT-359
[0194] 8367          ARG11  EQU  ARG+11
[0195] 8368          XCURLI EQU  >8368            GKXB variable
[0196] 836A          XCURIN EQU  >836A            GKXB variable
[0197] 836B          ARG15  EQU  ARG+15
[0198] 836C          ARG16  EQU  ARG+16

 

Share this post


Link to post
Share on other sites
20 hours ago, senior_falcon said:

This is not systex. It is my own loader similar to systex. There are no hard coded addresses.  Run the program. You'll get the error "subprogram not found" in line 20. Use Classic99's debugger to take a look into low memory. Look at >2002 and >2004. They should be >2540 and >3FF8. This shows the xb routine was loaded. Look at >3FF8 and you will see "RANDOM", also indicating that the program was loaded. If you really want to be sure the program is loaded you can open up Classic99 and select XB and open up a second Classic99 and select RXB. Compare the code from >24F4 to >2540. It should be the same. I suppose the file might have been corrupted when I made the zip file, but I doubt it.

The "subprogram not found" is a red herring. At times passing a random number leads to a crash with the usual colorful graphics on the screen.

Hmm I may have the answer....

See original XB and other others all load way to many bytes into Lower 8K thus was a chunk of memory as they later reduced the CALL INIT routines for more space later.

But they never changed the GPL code for loading that Assembly into lower 8K for support. which includes a lot of junk.

When I saw this in the notes off to side of GPL code loader for CALL INIT I decided to fix this overlooked error. (They never fixed it in time for version 110 but noted error.)

Now I had to return the same values to >2002 and >2004 even though loading junk bytes from GPL to that area does not take place in since RXB 2000

(People complained about that area was not the same, even though XB uses a FIXED LOAD ADDRESS not a RELOCATABLE that seems a odd complaint to me.)

So instead I zeroed out >24EA to >3FFF in RXB instead of loading all  that junk from GPL that was never used, after all it was being written over by loading.

If you fire up Classic99 and check RXB after CALL INIT vs XB after CALL INIT you will see that difference.

I try to fix what I can but baked in stupid is hard to fix, very hard for me to say broken,  so just gotta love it.

Just wondering what is going on as when RXB uses CALL INIT it zeros out lower 8K, which would make more sense then leaving all the junk there?

(I mean INIT means INITIALIZE not just load this stuff.)

in·i·tial·ize
/iˈniSHəˌlīz/
verb
COMPUTING
 
  1. 1.
    set to the value or put in the condition appropriate to the start of an operation.
    "the counter is initialized to one"
     
  2. 2.
    format (a computer disk).
Edited by RXB
Added Text.

Share this post


Link to post
Share on other sites

Try to run RNDTESTXB but replace 'RND*9' in line 20 with just '9'. It works fine. Then put 'RND*9' back in and you get "SubProgram not found in 20".

  • Like 1

Share this post


Link to post
Share on other sites
18 hours ago, Asmusr said:

Try to run RNDTESTXB but replace 'RND*9' in line 20 with just '9'. It works fine. Then put 'RND*9' back in and you get "SubProgram not found in 20".

The main difference between original RND in XB and RXB is the stupid number of Floating Point instructions and assembly used to just make a random number.

Also why it is insanely slow for that very reason, this is why XB RND is crazy slow.

This is from RXB 2001 GPL source and is exactly the same as XB.

<0215>               * Initialize random number generator
<0216> A28D 31,00,0A INTRND MOVE 10,[email protected],[email protected]
       A290 A3,A0,A2
       A293 95
<0217> A294 00              RTN
<0218> A295 42,03,23 X2SEED BYTE >42,>03,>23,>15,>00 * =   33521, X2 INITIAL VAL
       A298 15,00
<0219> A29A 43,02,3E X1SEED BYTE >43,>02,>3E,>2A,>17 * = 2624223, X1 INITIAL VAL
       A29D 2A,17
<0220>               ***********************************************************
<0221>               *           PSEUDO-RANDOM NUMBER GENERATOR                 
<0222>               *      X(N+1) = (A*X(N)+C) MOD M;  RND = X/M               

99/4 GPL-ASSEMBLER (Pass 3) correct                                   PAGE 0016 
EQUATES EXEC-359
<0223>               *    WHERE:                 X = X2 * 1E7 + X1              
<0224>               *                           A = A2 * 1E7 + A1              
<0225>               *                           C = C2 * 1E7 + C1              
<0226>               *                           M = 1E14                       
<0227>               * ASSUMPTIONS:                                             
<0228>               *  (1) All numbers are integers; fractional parts are      
<0229>               *      truncated                                           
<0230>               *  (2) If the variables listed below start in the ranges   
<0231>               *     specified. They will also end in the ranges specified
<0232>               *                                                          
<0233>               * CONSTANTS: 0 <= A2 < 5E6 ; 0 <= C2 < 1E7                 
<0234>               *            0 <= A1 < 5E6 ; 0 <= C1 < 1E7                 
<0235>               * VARIABLES: 0 <= X2 < 1E7 ; 0 <= T1 <= 1E14 ; 0 <= T2 < 1E
<0236>               *            0 <= X1 < 1E7 ; 0 <= T3 <= 1E14 ; 0 <= T4 < 1E
<0237>               *                                                          
<0238>               *        STACK USAGE:                                      
<0239>               *            CONSTANT REFS      CONTANT REFS    CONTANT REF
<0240>               * +---------+      IN/OUT            IN/OUT          IN/OUT
<0241>               * | STACK+4 | X2*A1(F)(H)       --    ----      --    ---- 
<0242>               * +---------+                                              
<0243>               * | STACK+3 |   T2 (C)(J)       --    ----      --    ---- 
<0244>               * +---------+                                              
<0245>               * | STACK+2 |   T1 (B)(D)   new X1   (E)(N)     --    ---- 
<0246>               * +---------+                                              
<0247>               * | STACK+1 |old X1(A)(G)       T3   (K)(L) new X2   (M)(P)
<0248>               * +---------+                                              
<0249>               ***********************************************************
<0250>               * COMPUTE NEW VALUE FOR X1, SAVE IT IN [email protected]
<0251>               *                             STACK
<0252>               *                               SREFS   FAC CONTENTS
<0253> A29F 35,00,05 NRND   MOVE 5,[email protected],@FAC        FAC = X1
       A2A2 4A,A3,A5
<0254> A2A5 86,4F           CLR  @FAC5                 FAC = CLR
<0255> A2A7 87,50           DCLR @FAC6                 FAC = CLR
<0256> A2A9 0F,77           XML  VPUSH          (A)    FAC = X1
<0257> A2AB 31,00,08        MOVE 8,[email protected],@ARG        ARG = A1
       A2AE 5C,A3,57
<0258> A2B1 0F,08           XML  FMUL                  FAC = X1*A1
<0259> A2B3 31,00,08        MOVE 8,[email protected],@ARG        ARG = C1
       A2B6 5C,A3,67
<0260> A2B9 0F,06           XML  FADD               T1=FAC = X1*A1+C1
<0261> A2BB 0F,77           XML  VPUSH          (B)    FAC = T1
<0262> A2BD 31,00,08        MOVE 8,[email protected],@ARG        ARG = 1/1E7
       A2C0 5C,A3,77
<0263> A2C3 0F,08           XML  FMUL                  FAC = T1/1E7
<0264> A2C5 06,00,22        CALL GRINT              T2=FAC = INT(T1/1E7)
<0265> A2C8 0F,77           XML  VPUSH          (C)    FAC = T2
<0266> A2CA 31,00,08        MOVE 8,[email protected],@ARG        ARG = 1E7
       A2CD 5C,A3,6F
<0267> A2D0 0F,08           XML  FMUL                  FAC = T2*1E7
<0268> A2D2 A7,6E,00        DSUB 8,@VSPTR
       A2D5 08
<0269> A2D6 0F,0C           XML  SSUB           (D) X1=FAC = T1-T2*1E7
<0270> A2D8 35,00,05        MOVE 5,@FAC,[email protected]        FAC = X1 (new)
       A2DB A3,A5,4A
<0271> A2DE 0F,77           XML  VPUSH          (E)    FAC = X1
<0272>               * COMPUTE NEW VALUE FOR X2, SAVE IT IN [email protected]
<0273> A2E0 35,00,05        MOVE 5,[email protected],@FAC        FAC = X2
       A2E3 4A,A3,A0
<0274> A2E6 86,4F           CLR  @FAC5                 FAC = CLR
<0275> A2E8 87,50           DCLR @FAC6                 FAC = CLR
<0276> A2EA 31,00,08        MOVE 8,[email protected],@ARG        ARG = A1
       A2ED 5C,A3,57
<0277> A2F0 0F,08           XML  FMUL                  FAC = X2*A1

99/4 GPL-ASSEMBLER (Pass 3) correct                                   PAGE 0017 
EQUATES EXEC-359
<0278> A2F2 A3,6E,00        DADD 8,@VSPTR
       A2F5 08
<0279> A2F6 0F,77           XML  VPUSH          (F)    FAC = X2*A1
<0280> A2F8 A7,6E,00        DSUB 24,@VSPTR
       A2FB 18
<0281> A2FC 0F,78           XML  VPOP           (G)    FAC = X1
<0282> A2FE A3,6E,00        DADD 32,@VSPTR
       A301 20
<0283> A302 31,00,08        MOVE 8,[email protected],@ARG        ARG = A2
       A305 5C,A3,4F
<0284> A308 0F,08           XML  FMUL                  FAC = X1*A2
<0285> A30A 0F,0B           XML  SADD           (H)    FAC = X2*A1+X1*A2
<0286> A30C 31,00,08        MOVE 8,[email protected],@ARG        ARG = C2
       A30F 5C,A3,5F
<0287> A312 0F,06           XML  FADD                  FAC = X2*A1+X1*A2
<0288> A314 0F,0B           XML  SADD           (J) T3=FAC = X2*A1+X1*A2
<0289> A316 A7,6E,00        DSUB 16,@VSPTR
       A319 10
<0290> A31A 0F,77           XML  VPUSH          (K)    FAC = T3
<0291> A31C 31,00,08        MOVE 8,[email protected],@ARG        ARG = 1/1E7
       A31F 5C,A3,77
<0292> A322 0F,08           XML  FMUL                  FAC = T3/1E7
<0293> A324 06,00,22        CALL GRINT              T4=FAC = INT(T3/1E7)
<0294> A327 31,00,08        MOVE 8,[email protected],@ARG        ARG = 1E7
       A32A 5C,A3,6F
<0295> A32D 0F,08           XML  FMUL                  FAC = T4*1E7
<0296> A32F 0F,0C           XML  SSUB           (L) X2=FAC = T3-T4*1E7
<0297> A331 35,00,05        MOVE 5,@FAC,[email protected]        FAC = X2 (new)
       A334 A3,A0,4A
<0298>               * COMPUTE NEW VALUE FOR RND, LEAVE IT IN FAC
<0299> A337 31,00,08        MOVE 8,[email protected],@ARG        ARG = 1/1E7
       A33A 5C,A3,77
<0300> A33D 0F,08           XML  FMUL                  FAC = X2/1E7
<0301> A33F 0F,77           XML  VPUSH          (M)    FAC = X2/1E7
<0302> A341 A3,6E,00        DADD 8,@VSPTR
       A344 08
<0303> A345 0F,78           XML  VPOP           (N)    FAC = X1
<0304> A347 0F,08           XML  FMUL                  FAC = X1/1E7
<0305> A349 0F,08           XML  FMUL                  FAC = X1/1E14
<0306> A34B 0F,0B           XML  SADD           (P)RND=FAC = (X2/1E7)+(X1/1E14)
<0307> A34D 0F,75           XML  CONT
[0008]               ***********************************************************

Starting to wonder if VSPTR (Value Stack Pointer needs to be reset as it is looking like CALL LINK is expecting something different on STACK

hence why "subprogram not found" as a value can not be found on stack as what ever on stack is not in proper place.

As RXB 2015 does not mess with stack at all this would point to the problem in CALL LINK has the issue.

Will have to look over CALL LINK to see what is going on in stack.

Share this post


Link to post
Share on other sites

So here is CALL LINK from XB and RXB 2015 that are exactly the same:


<0001>               ***********************************************************
<0002>               * LINK INSTRUCTION : SE Sep 1980                           
<0003>               ***********************************************************
<0004>               *  FORMAT:
<0005>               *  CALL LINK("file-name",parameter1,parameter2,...)
<0006>               *
<0007>               *  LINK ROUTINE READS THE FILE NAME SPECIFIED BY THE USER A
<0008>               *  SAVE THE ADDRESS OF THE NAME FOR LATER USE. THE FILE WIL
<0009>               *  BE SEARCHED IN UTILITY CODE LATER ON.
<0010>               *
<0011>               *  PARAMETERS ARE PASSED EITHER BY REFERENCE OR BY VALUE.
<0012>               *  NUMERIC OR STRING VARIABLES AND NUMERIC OR STRING ARRAYS
<0013>               *  ARE PASSED BY REFERENCE AND ALL OTHERS INCLUDING A USER
<0014>               *  DEFINED FUNCTION ARE PASSED BY VALUE.
<0015>               *
<0016>               *  PARAMETER INFORMATION IS STORED IN CPU >8300 THROUGH >83
<0017>               *  THAT GIVES A PARAMETER TYPE CODE OF EACH PARAMETER.
<0018>               *        CODE 0 ... Numeric expression
<0019>               *        CODE 1 ... String experession
<0020>               *        CODE 2 ... Numeric variable
<0021>               *        CODE 3 ... String variable
<0022>               *        CODE 4 ... Numeric array
<0023>               *        CODE 5 ... String array
<0024>               *
<0025>               *  IF A PARAMETER IS PASSED AS A NUMERIC EXPRESSION ITSL
<0026>               *  ACTUAL VALUE GETS PUSHED INTO THE VALUE STACK. IN CASE O
<0027>               *  A STRING EXPRESSION , ITS VALUE STACK CONTAINS AN ID(>65
<0028>               *  POINTER TO THE VALUE SPACE AND ITS LENGTH. IF A PARAMETE
<0029>               *  GETS PASSED AS A REFERENCE THE PRODUCT OF XML SYM AND XM
<0030>               *  SMB IN THE @FAC AREA GETS PUSHED INTO STACK.
<0031>               *
<0032>               *  AFTER AN ASSEMBLY LANGUAGE SUBPROGRAM IS EXECUTED LINK
<0033>               *  ROUTINE WILL POP THE STACK TO GET RID OF PARAMETER
<0034>               *  INFORMATION. CONTROL WILL BE TRANSFERED TO THE XB MAIN
<0035>               *  PROGRAM AFTERWARDS.
<0036>               *
<0037>               ***********************************************************
<0038>               * CALL LINK program                                        
<0039>               ***********************************************************
<0040> C325 06,C1,EB LINKIT CALL CHKIN             Check if INIT has been called
<0041> C328 BD,10,6E        DST  @VSPTR,@OLDS      Save VSPTR for later use
<0042> C32B D6,42,B7        CEQ  LPARZ,@CHAT       Check for "("
<0043> C32E 45,33           BR   ERRSYN
<0044> C330 0F,79           XML  PGMCHR            Advance program pointer
<0045> C332 0F,74           XML  PARSE             Get the routine name.
<0046> C334 B6              BYTE RPARZ           * Read up to ")"
<0047> C335 D6,4C,65        CEQ  >65,@FAC2         Should be a string
<0048> C338 45,9A           BR   ERRBA

99/4 GPL-ASSEMBLER (Pass 3) correct                                   PAGE 0021 
EQUATES ALCS-359
<0049> C33A 8F,50           DCZ  @FAC6             Don't accept null string
<0050> C33C 65,9A           BS   ERRBA
<0051> C33E C6,51,06        CH   6,@FAC7           Should be less then 6 char
<0052> C341 65,9A           BS   ERRBA
<0053> C343 0F,77           XML  VPUSH             Push to make it semi-permanen
<0054> C345 86,12           CLR  @COUNT            Initialize parameter counter
<0055>               ***********************************************************
<0056>               * PARAMETERS get evaluated here                            
<0057>               ***********************************************************
<0058> C347 D6,42,B6 PAR01  CEQ  RPARZ,@CHAT       No arg. So execute it
<0059> C34A 64,05           BS   EXE01
<0060> C34C D6,42,B3        CEQ  COMMAZ,@CHAT      Should have a comma
<0061> C34F 45,33           BR   ERRSYN
<0062> C351 BD,22,2C        DST  @PGMPTR,@ERRCOD   Save text pointer
<0063> C354 0F,79           XML  PGMCHR            Get the character
<0064> C356 CA,42,80        CHE  >80,@CHAT         Must be an expression
<0065> C359 63,C7           BS   VAL01
<0066>               * If CHAT = LPARZ then pass by expression
<0067> C35B 06,C4,2C        CALL CLRFAC            Clear FAC entry for SYM
<0068> C35E 0F,7A           XML  SYM               Read in the symbol table info
<0069>               * After XML SYM @FAC area contains a pointer to symbo table
<0070>               * Below statement checks if it is a UDF.
<0071> C360 DA,B0,4A        CLOG >40,V*FAC         Pass by value
       C363 40
<0072> C364 43,C7           BR   VAL01
<0073> C366 D6,42,B3        CEQ  COMMAZ,@CHAT      Pass by reference
<0074> C369 63,E5           BS   REF01
<0075> C36B D6,42,B6        CEQ  RPARZ,@CHAT       Pass by reference
<0076> C36E 63,E5           BS   REF01
<0077> C370 D6,42,B7        CEQ  LPARZ,@CHAT       An array
<0078> C373 63,7C           BS   ARRAY
<0079> C375 CA,42,80        CHE  >80,@CHAT         Pass by value
<0080> C378 63,C7           BS   VAL01
<0081> C37A 45,33           BR   ERRSYN
<0082>               ***********************************************************
<0083>               * ARRAY case gets checked here                             
<0084>               ***********************************************************
<0085>               * Should look like A(,,) etc.
<0086>               * Stack entry for an array will look like
<0087>               * +--------------+-------+---+-------------+---------------
<0088>               * | Pointer to   |  >00  |   | Pointer to  |               
<0089>               * | symbol table |   or  |   | dim info in |               
<0090>               * | entry        |  >65  |   | real v.s.   |               
<0091>               * +- FAC --------+ FAC2 -+---+- FAC4 ------+- FAC6 --------
<0092>               *
<0093> C37C 0F,79    ARRAY  XML  PGMCHR            Get the next character
<0094> C37E D6,42,B6        CEQ  RPARZ,@CHAT       Pass by reference
<0095> C381 63,8F           BS   ARRAY2
<0096> C383 D6,42,B3        CEQ  COMMAZ,@CHAT      More array information
<0097> C386 63,7C           BS   ARRAY
<0098> C388 93,2C           DDEC @PGMPTR           Adjust the pointer
<0099> C38A BE,42,B7        ST   LPARZ,@CHAT
<0100> C38D 43,E5           BR   REF01             Pass by reference
<0101>               * In array cases the symbol table address gets stored at FA
<0102>               * area, and the pointer to the value space (dimension info)
<0103>               * goes into FAC4
<0104> C38F 0F,79    ARRAY2 XML  PGMCHR            Advance the program pointer
<0105> C391 DA,B0,4A        CLOG >80,V*FAC         Test string bit
       C394 80
<0106> C395 43,9D           BR   GC39D
<0107> C397 BE,90,12        ST   4,*COUNT          Numeric array
       C39A 04
<0108> C39B 43,A1           BR   GC3A1
<0109> C39D BE,90,12 GC39D  ST   5,*COUNT          String array case

99/4 GPL-ASSEMBLER (Pass 3) correct                                   PAGE 0022 
EQUATES ALCS-359
       C3A0 05
<0110>               * Check if array is being shared. If it is then go back
<0111>               * through the linkage to get the actuals symbol table
<0112>               * pointer. Put the pointer to the value space (dimension in
<0113>               * into FAC4.
<0114> C3A1 DA,B0,4A GC3A1  CLOG >20,V*FAC         Shared array?
       C3A4 20
<0115> C3A5 63,BE           BS   GC3BE
<0116> C3A7 35,00,02        MOVE 2,[email protected](@FAC),@FAC4 If so, get pointer
       C3AA 4E,E0,06
       C3AD 4A
<0117> C3AE DA,EF,FF        CLOG >20,[email protected](@FAC4)   Shared also?
       C3B1 FA,4E,20
<0118> C3B4 63,BC           BS   GC3BC
<0119> C3B6 35,00,02        MOVE 2,V*FAC4,@FAC4    Array is not shared
       C3B9 4E,B0,4E
<0120> C3BC 43,C5    GC3BC  BR   GC3C5
<0121> C3BE BD,4E,4A GC3BE  DST  @FAC,@FAC4        Array is not shared
<0122> C3C1 A3,4E,00        DADD 6,@FAC4           Point to value space
       C3C4 06
<0123> C3C5 43,FA    GC3C5  BR   PUSH
<0124>               ***********************************************************
<0125>               * VALUE                                                    
<0126>               *  Passing the parameter by value                          
<0127>               ***********************************************************
<0128> C3C7 BD,2C,22 VAL01  DST  @ERRCOD,@PGMPTR   Restore program pointer
<0129> C3CA 0F,79           XML  PGMCHR            Skip the first character
<0130> C3CC BD,16,0C        DST  @BYTES,@TEMP      In case of passing a string
<0131> C3CF 0F,74           XML  PARSE             Parsing up to comma
<0132> C3D1 B6              BYTE RPARZ
<0133> C3D2 BD,0C,16        DST  @TEMP,@BYTES      Restore the value in >0C area
<0134>               * After parsing @FAC area contains its actual numeric value
<0135>               *  in a numeric case, and the following information in a
<0136>               *  string case.
<0137>               * +----------------+-----+--+------------+-----------------
<0138>               * | >001C  or      | >65 |  | Pointer to | Length of string
<0139>               * | value pointer  |     |  | string     | string          
<0140>               * | address        |     |  |            |                 
<0141>               * +- FAC ----------+-FAC2+--+-FAC4 ------+- FAC6 ----------
<0142>               *
<0143> C3D5 CE,4C,63        CGT  >63,@FAC2         If more then 99 then
<0144> C3D8 43,E0           BR   GC3E0
<0145> C3DA BE,90,12        ST   1,*COUNT          Store flag for string express
       C3DD 01
<0146> C3DE 43,E3           BR   GC3E3
<0147> C3E0 86,90,12 GC3E0  CLR  *COUNT            Otherwise it is a numeric exp
<0148> C3E3 43,FA    GC3E3  BR   PUSH              Push into stack
<0149>               ***********************************************************
<0150>               * REFERENCE                                                
<0151>               *   Passing the parameter by reference                     
<0152>               ***********************************************************
<0153>               * Variables, array element and whole array passing.
<0154>               *
<0155>               * After SMB @FAC entry shold look like;
<0156>               * +--------------+------+-----+-------------+--------------
<0157>               * | Pointer to   | >00  |     | Pointer to  |              
<0158>               * | symbol table |      |     | value space |              
<0159>               * | entry        |      |     |             |              
<0160>               * +-- FAC -------+ FAC2 +-----+- FAC4 ------+- FAC6 -------
<0161>               *  for numeric case, and
<0162>               * +--------------+------+-----+-------------+--------------
<0163>               * | Pointer to   | >65  |     | Pointer to  | String       
<0164>               * | value space  |      |     | string      | length       
<0165>               * | entry        |      |     |             |              

99/4 GPL-ASSEMBLER (Pass 3) correct                                   PAGE 0023 
EQUATES ALCS-359
<0166>               * +- FAC --------+ FAC2 +-----+- FAC4 ------+- FAC6 -------
<0167>               * for a string case.
<0168> C3E5 0F,7B    REF01  XML  SMB               Get the location
<0169> C3E7 CA,42,B8        CHE  >B8,@CHAT         Pass array expression
<0170> C3EA 63,C7           BS   VAL01
<0171> C3EC 8E,4C           CZ   @FAC2
<0172> C3EE 43,F6           BR   GC3F6
<0173> C3F0 BE,90,12        ST   2,*COUNT          Must be a numeric variable
       C3F3 02
<0174> C3F4 43,FA           BR   PUSH
<0175> C3F6 BE,90,12 GC3F6  ST   3,*COUNT          Must be a string variable
       C3F9 03
<0176>               ***********************************************************
<0177>               * PUSH routine                                             
<0178>               *  Pushes @FAC entry into a value stack.                   
<0179>               ***********************************************************
<0180> C3FA 90,12    PUSH   INC  @COUNT
<0181> C3FC CE,12,10        CGT  16,@COUNT         Too many parameters
<0182> C3FF 65,9A           BS   ERRBA
<0183> C401 0F,77           XML  VPUSH
<0184> C403 43,47           BR   PAR01             Get the next argument.
<0185>               ***********************************************************
<0186>               * EXECUTE routine                                          
<0187>               *  Restore file name info transfer control over to ALC     
<0188>               ***********************************************************
<0189> C405 BE,4A,20 EXE01  ST   >20,@FAC          Store blank in the FAC area.
<0190> C408 35,00,05        MOVE 5,@FAC,@FAC1
       C40B 4B,4A
<0191> C40D 35,00,04        MOVE 4,[email protected](@OLDS),@STORE   Get the file name info
       C410 14,E0,0C
       C413 10
<0192> C414 34,16,4A        MOVE @STORE+2,V*STORE,@FAC  Move to FAC
       C417 B0,14
<0193> C419 87,22           DCLR @ERRCOD           Clear program pointer for
<0194>               *                              error code
<0195> C41B 0F,20           XML  ALSUP             Go to CPU at >2000 to execute
<0196> C41D 64,C9           BS   ERROR             Error found
<0197>               *                             If no error, start checking s
<0198>               ***********************************************************
<0199>               * RETURN to the XB main program.                           
<0200>               ***********************************************************
<0201> C41F C5,6E,10 NOERR  DCH  @OLDS,@VSPTR      Pop the stack
<0202> C422 44,29           BR   GC429
<0203> C424 0F,78           XML  VPOP              Pop the stack
<0204> C426 05,C4,1F        B    NOERR
<0205> C429 05,A0,1C GC429  B    LNKRTN            Check ")" and end of statemen
<0206>               ***********************************************************
<0207>               * SUBROUTINES used in this file.                           
<0208>               ***********************************************************
<0209> C42C 86,4A    CLRFAC CLR  @FAC
<0210> C42E 35,00,07        MOVE 7,@FAC,@FAC1
       C431 4B,4A
<0211> C433 00              RTN
<0212>               ***********************************************************

So it appears RXB 2015 RND subprogram stack value is not set up for CALL LINK as it is expecting a reset Value Stack and Subprogram Stack.

Looking at NOERR you can see this where we end up with "no subprogram found" as previously XML SYM crashed as the stack value is not set.

It also appears that old XB RND leaves a Floating Point Number in FAC so this is going to delay RXB 2020 by some time digging into why.

Currently RND in RXB 2015 also leaves a Floating Point Number in FAC but what symbol being pushed on stack is in question.

Edited by RXB
Added Text.
  • Like 2

Share this post


Link to post
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.

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...