Jump to content
IGNORED

RXB - Rich Extended Basic


Bones-69

Recommended Posts

7 hours ago, Retrospect said:

hey @RXB I liked the video.  Also you gotta love the sound of a proper TI keyboard.  I miss that so much.  

I've a request for RXB if it's at all possible?  The CALL ROLLUP, ROLLDOWN command is pretty awesome , is there any way this can be extended with something like this;
CALL BOX(1,1,8,32)  .... what that could do is specify an area of the screen for ROLL to play with, so ROLL only rolls that specific area of the screen , like in my example there it would be from row 1, column 1, down to row 8 column 32 ... or the user could specify whole screen with CALL BOX(1,1,24,32) ... my idea is we could specify a portion of the screen to ROLL for example with a starfield , leaving the rest of the screen for the scoreboard to stay still.  This would enable coders to create pretty good games for just the console.
 

My very first package before RXB was WINDYXB (my daughters name) that had CALL WINDOW(row,column,height,width,string-variable) ! 255 max string

Now I could substitute string-variable for VDP address so you could actually save up to 768 bytes.

  • Like 2
Link to comment
Share on other sites

4 minutes ago, RXB said:

My very first package before RXB was WINDYXB (my daughters name) that had CALL WINDOW(row,column,height,width,string-variable) ! 255 max string

Now I could substitute string-variable for VDP address so you could actually save up to 768 bytes.

Cool ... could you set up a call window or call box that lets call roll just roll what's in the window ?  

Link to comment
Share on other sites

11 hours ago, Retrospect said:

Cool ... could you set up a call window or call box that lets call roll just roll what's in the window ?  

That seems pretty specialized to just a very few applications.

On other hand:

CALL WINDOW(row,column,height,width,string-variable) ! 255 max

This could be used to replace many programs using DISPLAY AT or CALL HCHAR to draw a box or rectangle with contents there in one command.

 

Almost all commands have to be very universal or as replacements for other commands, this is how RXB has evolved over last 30 years.

The idea is to find common sets of commands being used and replace them with a single command like CALL JOYST/MOTION/KEY and IF something THEN line number

is RXB command CALL JOYMOTION

or like ON/KEY/GOTO in a single command like RXB command CALL ONKEY

  • Like 1
Link to comment
Share on other sites

As Rich always emphasize, RXB runs on the unexpanded console ... so I guess it does not use the lower 8k at all when present. I tested some of my games with RXB, mainly my wordsearch which stores the vocabulary there.

 

  • Like 1
Link to comment
Share on other sites

It might do ... he does have it set up for 32K expansion when present.  Check out the SIZE command.  It comes up on screen like a full screen of details. (if expansions are present)  I've never tried RXB using just 16K console.  

 

Hey that's a fair point, I don't know if my RXB Cosmic Hero game will work on 16K console? 

Link to comment
Share on other sites

6 hours ago, Vorticon said:

Quick question: does RXB use any of the low memory of the 32K expansion or is it available for user machine language routines?

A quick test can use the Heatmap in Classic99.  If you don't see any "red" lines in the low RAM area it's not being used, at least not for the program you are running.

 

  • Like 2
  • Thanks 1
Link to comment
Share on other sites

5 hours ago, Asmusr said:

How come there are 8192 assembly bytes free on an unexpanded console?

That is a very interesting question.  There literally should only be 11840 bytes free (a little more if disk drive turned off)  .... wtf ... 

@RXB have you seen this?

Link to comment
Share on other sites

5 hours ago, Asmusr said:

How come there are 8192 assembly bytes free on an unexpanded console? And what does >A040 Program end address mean when the program is in VDP RAM?

Well I have fixed this I defaulted to show it but this was before I move to console only and now it works properly.

It is in RXB 2023A that is not out yet hopefully Tursi will include it in next RXB release.

  • Like 1
Link to comment
Share on other sites

In order to gain some space in XB ROMs I have seen how to eliminate some insanely useless Assembly in XB ROM 1 that is no faster then GPL.

In this case it is GRSUB1 in XB GROM 3 that calls the XML GREAD is changed here:

***********************************************************
* SUBROUTINE TO READ 2 BYTES OF DATA FROM VDP OR ERAM
*  (use GREAD)
***********************************************************
GRSUB1 FETCH @FAC4            Fetch the source addr on ERAM
       DST  *FAC4,@FAC2       Put it in @FAC2
       CZ   @RAMTOP           If ERAM present
       BS   G6823
       DST  2,@FAC4           @FAC4 : Byte count
       XML  GREAD             Read data from ERAM
*                             @FAC6 : Destination addr on CP
       BR   G6827             ERAM not exists
G6823  DST  V*FAC2,@FAC6      Read data from VDP
G6827  RTN
***********************************************************

RXB NEW PATCH CODE
***********************************************************
GRSUB1 FETCH @FAC4            Fetch the source addr on ERAM
       DST  *FAC4,@FAC2       Put it in @FAC2
       CZ   @RAMTOP           If ERAM present
       BS   G6823
       DST  2,@FAC4         @FAC4 : Byte count
       DST  *FAC2,@FAC6      Read data from ERAM
*                           @FAC6 : Destination addr on CPU
       BR   G6827             ERAM not exists
G6823  DST  V*FAC2,@FAC6      Read data from VDP
G6827  RTN
***********************************************************

 

Now this is the Assembly in XB ROM 1 that is to be removed as it is not any faster than DST *FAC2,@FAC6 vs XML GREAD

3943 7EA6              AORG >7EA6   

 99/4 ASSEMBLER
GREADS                                                       PAGE 0091
  3945                
  3946            * (RAM to RAM)  
  3947            * Read data from ERAM   
  3948            * @GSRC  : Source address on ERAM   
  3949            * @DEST  : Destination address in CPU   
  3950            *           Where the data stored after read from ERAM  
  3951            * @BCNT3 : byte count   
  3952 7EA6 0203  GREAD1 LI   R3,BCNT3          # of bytes to move  
       7EA8 8356  
  3953 7EAA 0202         LI   R2,GSRC           Source in ERAM  
       7EAC 8354  
  3954 7EAE 0201         LI   R1,DEST           Destination in CPU  
       7EB0 8358  
  3955 7EB2 1006         JMP  GRZ1              Jump to common routine  
  3956            * Read data from ERAM to CPU  
  3957            * @ADDR1 : Source address on ERAM   
  3958            * @ADDR2 : Destination address in CPU   
  3959            *           Where the data stored after read from ERAM  
  3960            * @BCNT1 : byte count   
  3961 7EB4 0203  GREAD  LI   R3,BCNT1          # of bytes to move  
       7EB6 834E  
  3962 7EB8 0202         LI   R2,ADDR1          Source in ERAM  
       7EBA 834C  
  3963 7EBC 0201         LI   R1,ADDR2          Destination in CPU  
       7EBE 8350  
  3964            * Common ERAM to CPU transfer routine   
  3965 7EC0 C112  GRZ1   MOV  *R2,R4  
  3966 7EC2 DC74  GRZ2   MOVB *R4+,*R1+         Move byte from ERAM to CPU  
  3967 7EC4 0613         DEC  *R3               One less to move, done?   
  3968 7EC6 16FD         JNE  GRZ2              No, copy the rest   
  3969 7EC8 045B         RT   
  3970            ************************************************************

There are a few other Assembly routines in XB ROM 1 that are no faster than GPL commands or same speed but take up way more to set up vs GPL.

I am looking at maybe as much as almost 1K of assembly in XB ROM 1 that is much less efficient than GPL CALL MOVE command that only takes 7 bytes.

But is no slower than the above assembly routine due to all the time to set up just to use assembly will benefit more overall.

 

As example in GPL 

CALL MOVE @BCNT1,*ADDR1,*ADDR2  only takes 7 bytes and does not require reloading variables to make a call to make it work.

So 7 bytes vs 34 bytes but they do the same thing at same amount of time.

 

I still have to do some timing checks but I do need room to add INTEGERs to XB to go with Floating Point too.

 

  • Like 2
Link to comment
Share on other sites

15 hours ago, RXB said:

In order to gain some space in XB ROMs I have seen how to eliminate some insanely useless Assembly in XB ROM 1 that is no faster then GPL.

In this case it is GRSUB1 in XB GROM 3 that calls the XML GREAD is changed here:

***********************************************************
* SUBROUTINE TO READ 2 BYTES OF DATA FROM VDP OR ERAM
*  (use GREAD)
***********************************************************
GRSUB1 FETCH @FAC4            Fetch the source addr on ERAM
       DST  *FAC4,@FAC2       Put it in @FAC2
       CZ   @RAMTOP           If ERAM present
       BS   G6823
       DST  2,@FAC4           @FAC4 : Byte count
       XML  GREAD             Read data from ERAM
*                             @FAC6 : Destination addr on CP
       BR   G6827             ERAM not exists
G6823  DST  V*FAC2,@FAC6      Read data from VDP
G6827  RTN
***********************************************************

RXB NEW PATCH CODE
***********************************************************
GRSUB1 FETCH @FAC4            Fetch the source addr on ERAM
       DST  *FAC4,@FAC2       Put it in @FAC2
       CZ   @RAMTOP           If ERAM present
       BS   G6823
       DST  2,@FAC4         @FAC4 : Byte count
       DST  *FAC2,@FAC6      Read data from ERAM
*                           @FAC6 : Destination addr on CPU
       BR   G6827             ERAM not exists
G6823  DST  V*FAC2,@FAC6      Read data from VDP
G6827  RTN
***********************************************************

 

 

Unless some later routine (other than the now unused GREAD) depends on the byte-count being in FAC4, I would eliminate

 

       DST  2,@FAC4           @FAC4 : Byte count

 

...lee

Link to comment
Share on other sites

On 2/25/2023 at 8:32 PM, RXB said:

CALL WINDOW(row,column,height,width,string-variable) ! 255 max

This could be used to replace many programs using DISPLAY AT or CALL HCHAR to draw a box or rectangle with contents there in one command.

I've done exactly that as a unit for the p-system. Could be used to present pop-up error messages or whatever.

The p-system uses a simulated 80-column screen, but I designed my window thing so it would always show on the same physical place on the screen, regardless of which logical section you were viewing.

  • Like 1
Link to comment
Share on other sites

Maybe this...

********************************************************************************
       AORG >7B88
       TITL 'CRUNCHS'
 
QUOTE  EQU  >22
COMMA  EQU  >2C
 
LISTZ  EQU  >02
OLDZ   EQU  >05
SAVEZ  EQU  >07
MERGEZ EQU  >08
RETURZ EQU  >88
UNBRKZ EQU  >8F
DATAZ  EQU  >93
RESTOZ EQU  >94
REMZ   EQU  >9A
CALLZ  EQU  >9D
IMAGEZ EQU  >A3
RUNZ   EQU  >A9
COLONZ EQU  >B5
QUOTEZ EQU  >C7
UNQSTZ EQU  >C8
USINGZ EQU  >ED
 
MAXKEY EQU  10
*
* CRUNCH copies a line (normally in LINBUF) to CRNBUF in the
* process, it turns the line number (if any) binary, and
* converts all reserved words to tokens. CALL is a GPL XML
* followed by a single byte which indicates the type of
* crunch to be done. Possible types include:
*              >00 - Normal crunch
*              >01 - crunch as a data statement (input stmt)
*        REGISGERS:
*      R0 - R1   Scratch
*      R2 - R3   Scratch
*      R4        Points to R8LB
*      R5        Points to length byte of string/numeric
*      R6        Indicates numeric copy mode (numeric/line #)
*      R7        Mode of copy (strings, names, REMs, etc)
*      R8        Character buffer
*      R9        Points to name during keyword scan
*      R11 - R12 Links
*      R13       GROM read data pointer
*      R15       VDP write address pointer
*
CRUNCH MOV  R11,R12           Save return link
       MOVB *R13,R3           Read call code
       BL   @PUTSTK           Save GROM address
       CLR  @FAC              Assume no line number
       LI   R4,R8LB           Set up W/S low-byte pointer
       CLR  R8                Initialize character buffer
       BL   @GETNB            Scan line for 1st good char
       MOVB R1,*R4            Save character
       JEQ  CRU28             If empty line, return
* Now check crunch call mode, normal or input statement
       SRL  R3,8              Normal curnch call?
       JEQ  CRU01             Yes, crunch the statement
* Initialize for input statement crunch
       LI   R2,CRU84          No, must be crunch input stmt
       LI   R10,CRU83           so set up move indicators
       LI   R7,CRU80
       JMP  CRU10             And jump into it
* Initialize for normal line crunch
CRU01  INC  @BUFLEV           Indicate CRNBUF is destroyed
       CLR  @ARG4             Assume no symbol
       MOVB R8,@PRGFLG        Clear program flag
       BL   @GETINT           Try to read a line number
       MOV  R0,@FAC           Put line number into final
       JEQ  CRU02             If no line number
       BL   @GETNB            Skip all leading spaces
       MOVB R1,*R4            Save character in R8LB
       JEQ  CRU28             If nothing left in line
CRU02  LI   R7,CRU16          Set normal scan move
       LI   R6,CRU96          Set normal numeric scan mode
       JMP  CRU10             Merge into normal scan code
* Main loop of the input copy routine. Sets R8LB to next
* character, R0 to its character property byte
* R7 indicates dispatch mode.
CRU04  LI   R6,CRU96          Set normal numeric mode
CRU05  LI   R7,CRU16          Set normal scan mode
CRU06  BL   @PUTCHR           Copy into crunch buffer
CRU08  BL   @GETCHR           Get next input character
       CLR  R0                Assume nil property
       MOVB R1,*R4            Copy to crunch buffer
       JEQ  CRU12             Finish up if we reach a null
*-----------------------------------------------------------*
* Replace following line for adding lowercase character     *
* set to 99/4A                5/12/81                       *                  *
*  CRU10 MOVB @CPTBL(R8),R0     Fetch char's prop table vec *
CRU10  CB   *R4,@ENDPRO       Higher then "z"               *
       JHE  CRU09             Yes, give CPNIL property      *
       MOVB @CPTBL(R8),R0     Fetch char's prop table value *
       B    *R7               Dispatch to appropriate code  *
CRU09  MOVB CPNIL,R0          Don't go to CPT, just take    *
*                              CPNIL prop                   *
*-----------------------------------------------------------*
CRU12  B    *R7               Dispatch to appropriate code
CRU14  MOV  R8,R8             End of line?
       JNE  CRU06             Not yet
CRU15  MOV  @RAMPTR,R3        Now check for trailing spaces
       DEC  R3                Backup to read last character
       BL   @GETV1            Go read it
       CB   R1,@CBH20         Last character a space?
       JNE  CRU28             No, so end of line, exit
       DEC  @RAMPTR           Yes, backup pointer to delete
       JMP  CRU15             And test new last character
*-----------------------------------------------------------*
* The following two lines are added for adding lowercase    *
* character set for 99/4A     5/13/81                       *
ENDPRO BYTE >7B               ASCII code for char after "z" *
       EVEN                                                 *
*-----------------------------------------------------------*
*
* Normal scan mode -- figures out what to do with this char
CRU16 MOVB  *R4,*R4           At end of line?
       JEQ  CRU28             Yes, clean up and return
       MOVB R0,R0             Set condition on char prop
       JLT  CRU08             Ignore separators (spaces)
       MOV  @RAMPTR,R9        Save crunch pointer
       SLA  R0,2              Scan property bits 1 and 2
       JOC  CRU32             Break chars are 1 char tokens
       JLT  CRU18             Alpha, prepare to pack name
       SLA  R0,2              Scan property bits 3 and 4
       JNC  CRU20             Jump if not multi-char oper
       BL   @GETCHR           Check next char to see if we
       SRL  R1,8               have a 2 char operator
       JEQ  CRU32             If read end of line-single oper
       BL   @BACKUP           Backup read pointer
       CB   @CPTBL(R1),@LBCPMO Next char also a multi-oper?
       JNE  CRU32             No, want single-char oper
       BL   @PUTCHR           Copy in first char to oper
       JMP  CRU36             And scan keyword table
* Set name copy mode
CRU18  LI   R7,CRU76          Alphabetic: set name copy mode
*-----------------------------------------------------------*
* Insert following 2 lines for adding lowercase character   *
* set in 99/4A                5/12/81                       *
       SRL  R0,2              Adjust R0 for LOWUP routine   *
       BL   @LOWUP            Translate lowercase to upper  *
*                              if necessary                 *
*-----------------------------------------------------------*
       JMP  CRU06             And resume copy
* Handle single character operators
CRU20  JLT  CRU32             Bit 4: single character oper
       SLA  R0,2              Scan property bits 5 and 6
       JOC  CRU24             If numeric
       JLT  CRU26             If digit only
       CI   R8,QUOTE          Is it a string quote?
       JNE  ERRIVN            No, unknown char so error
       MOV  R7,R10            Yes, save current mode
CRU22  LI   R8,QUOTEZ         Convert char to quote token
       BL   @PUTCHR           Put in token
       LI   R7,CRU68          Set string, copy mode
       MOV  @RAMPTR,R5        Save pointer to length byte
       JMP  CRU06             Continue copy w/quote token
CRU24  CI   R8,'.'            A decimal point
       JNE  CRU26             No, decode as numeric/line #
       LI   R6,CRU96          Yes, decode as numeric
CRU26  B    *R6               Handle numeric or line #
BERRSY B    @CERSYN           Long distance SYNTAX ERROR
CRU27  BL   @PUTCHR           Put out last char before end
       INC  @VARW             Skip last character
* Here for successful completion of scan
CRU28  SWPB R8                Mark end of line with a null
       BL   @PUTCHR           Put the end of line in
CRNADD EQU  $+2
       LI   R0,CRNBUF         Get start of crunch buffer
       NEG  R0                Negate for backwards add
       A    @RAMPTR,R0        Calculate line length
       MOVB @R0LB,@CHAT       Save length for GPL
       BL   @GETSTK           Restore GROM address
       B    *R12              Return with pointer beyond null
* Keyword table scanning routine. Name has already been
* copied into crunch area starting at R9; RAMPTR point just
* beyond name in input line.
* R3 is name length, R1 indexes into the table
CRU32  BL   @BACKUP           Fix pointer for copy(next line)
CRU36  BL   @GETCHR           Read last character
       MOVB R1,*R4            Put into output buffer
       BL   @PUTCHR           Copy into crunch buffer
CRU38  MOV  @RAMPTR,R3        Get end pointer
       S    R9,R3             Sub start to get length of name
       CI   R3,MAXKEY         Is longer than any keyword?
       JH   CRU61             Yes, can't be a keyword
       MOV  R3,R2             Get name length and
       DEC  R2                 corremt 0 length name indexing
       SLA  R2,1              Turn it into an index
       AI   R2,KEYTAB         Add in address of table list
       MOVB R2,@GRMWAX(R13)    Load address to GROM
       SWPB R2
       MOVB R2,@GRMWAX(R13)
       MOVB *R13,R2           Read address of correct table
       MOVB *R13,@R2LB        Both bytes
* R2 now contains the address of the correct table
CRU40  MOVB R2,@GRMWAX(R13)   Load address of table
       MOV  R3,R0             Copy of length for compare
       MOVB @R2LB,@GRMWAX(R13)
       MOVB @R9LB,*R15        Source is in VDP
       A    R3,R2             Address of next keyword in table
       MOVB R9,*R15
       INC  R2                Skip token value
CRU42  CB   @XVDPRD,*R13      Compare the character
       JL   CRU61A            If no match possible
       JNE  CRU40             No match, but match possible
       DEC  R0                Compared all?
       JNE  CRU42             No, check next one
       MOV  R9,@RAMPTR        Name matched so throw out name
       MOVB *R13,*R4          Read the token value
       CLR  @ARG4             Indicate keyword found
* Check for specially crunched statements
       LI   R7,CRU14          Assume a REM statement
       LI   R0,SPECTB-1       Now check for special cases
***********************************************************                    <
* For GRAM KRACKER XB or RichGKXB or SXB substitute with: *                    <
*      CI   R8,>000B                                      *                    <
***********************************************************                    <
       CI   R8,MERGEZ         Is this a command?                               <
       JH   CRU47             No, continue on
       MOV  @FAC,R3           Yes, attempt to put in program?
       JNE  ERRCIP            Yes, *COMMAND ILLEGAL IN PROGRAM*
       CI   R9,CRNBUF         Command 1st token in line?
       JNE  BERRSY            No, *SYNTAX ERROR*
CRU47  INC  R0                Skip offset value
       CB   *R4,*R0+          In special table?
       JEQ  CRU53A            Yes, handle it
       JH   CRU47             If still possible match
***********************************************************                    <
* For GRAM KRACKER XB or RichGKXB or SXB substitute with: *                    <
*      CI   R8,>000C                                      *                    <
***********************************************************                    <
       CI   R8,MERGEZ         A specially scanned command?                     <
       JL   CRU27             Yes, exit crunch
       LI   R0,LNTAB          Now check for line number
CRU48  CB   *R4,*R0+          In table?
       JEQ  CRU52             Yes, change to line # crunch
       JH   CRU48             May still be in table
       CI   R8,COMMAZ         Just crunch a comma?
       JEQ  CRU50             Yes, so retain current numeric
       CI   R8,TOZ            Just crunch a TO?
       JNE  CRU53             No, so reset to normal numeric
CRU50  B    @CRU05            Yes, resume normal copy
CRU52  LI   R6,CRU100         Set line number scan mode
       JMP  CRU50             Set normal scan mode
ERRIVN INC  @ERRCOD           *ILLEGAL VARIABLE NAME
ERRCIP INC  @ERRCOD           *COMMAND ILLEGAL IN PROGRAM
ERRNQT INC  @ERRCOD           *NONTERMINATED QUOTED STING
CBH20  EQU  $+1
ERRNTL A    @C4,@ERRCOD       *NAME TO LONG
       JMP  CRU28             Exit back to GPL
OFFSET EQU  $
CRU53  B    @CRU04            Stmt sep resets to normal scan
CRU53A MOVB *R0,R1            Pick up offset from table
       SRL  R1,8              Make into offset
       B    @OFFSET(R1)       Goto special case handler
* Process a LIST statement
CRU57  BL   @PUTCHR           Put the list token in
       BL   @GETNB            Get next character
       CI   R1,QUOTE*256      Device name available?
       JNE  CRU28             No, no more to crunch, exit
       LI   R10,CRU106        Yes, set after string scan mode
       B    @CRU22            Crunch the device name
* Process an IMAGE statement
CRU54  LI   R10,CRU83B        Image after, string copy mode
       JMP  CRU59             Handle similar to data stmt
* Process a DATA statement
CRU58  LI   R10,CRU83         After-datum skip spaces
CRU59  C    @RAMPTR,@CRNADD   Image & data must be 1st on line
       JNE  JNESY1            If not, error
       LI   R2,CRU84          (non)quote string copy mode
CRU60  LI   R7,CRU80          Now set check-for-quote mode
CRU74  B    @CRU06            And copyin statement token
* Here when don't find something in the keyword table
CRU61  CI   R3,15             Is it longer than name can be?
       JH   ERRNTL            Yes, name to long
CRU61A MOV  @ARG4,R0          Symbol name last time too?
       JNE  JNESY1            Yes, can't have 2 in a row
       DEC  @ARG4             Indicate symbol noe
CRU62  LI   R7,CRU16          No keyword,; leave in CRNBUF
       LI   R6,CRU96          Assume normal numeric scan
CRU64  B    @CRU08            And continue to scan line
* Process a SUB statement
CRU65  MOV  @RAMPTR,R3        Get the current crunch pointer
       DEC  R3                Point at last character put in
       BL   @GETV1            Read it
       CB   R1,@GOZTOK        Was it a GO?
       JEQ  CRU52             Yes, SUB is part of GO SUB
* Process a CALL SUB statement
CRU66  LI   R7,CRU93          Set name copy
       JMP  CRU74             And get next character
CRU32L B    @CRU32
* Now the various mode copy routines; string, names, image,
*  and data statements
CRU68  MOV  R8,R8             Premature end of line?
       JEQ  ERRNQT            Yes, *NONTERMINATED QUOTED STRING
       CI   R8,QUOTE          Reach end of string?
       JNE  CRU74             No, continue copying
       BL   @GETCHR           Get next character
       MOVB R1,R1             Read end of line?
       JEQ  CRU70             Yes, can't be double quote
       CI   R1,QUOTE*256      Is it two quotes in a row?
       JEQ  CRU74             Yes, copy in a normal quote
       BL   @BACKUP           No, backup & rtn to normal scan
CRU70  MOV  R10,R7            Needed for image/data stmts
CRU72  BL   @LENGTH           Calculate length of string
       JMP  CRU64             Resume scan
* Names
*-----------------------------------------------------------*
* Replace following two lines for adding lowercase          *
* character set in 99/4A      5/12/81                       *
*  CRU76  ANDI R0,CPALNM*256    Is this char alpha or digit *
*         JEQ  CRU74            Yes, continue packing       *
CRU76  ANDI R0,CPULNM*256     Is this char alpha (both are  *
*                              upper and lower) or a digit? *
       JNE  CRU78             Yes, continue packing         *
*-----------------------------------------------------------*
*                             No, finish w/name packing
       CI   R8,'$'            Does name end with a $?
       JEQ  CRU32L            Yes, include it in name
       MOVB *R4,*R4           At an end of line?
       JEQ  CRU79             Yes, don't back up pointer
       BL   @BACKUP           Backup for next char
CRU79  B    @CRU38            Jump to name/keyword check
CRU82  B    @CRU22
*-----------------------------------------------------------*
* Add following 2 lines for adding lowercase character set  *
* for 99/4A                   5/12/81                       *
CRU78  BL   @LOWUP            Translate lower to upper if   *
*                              necessary                    *
       JMP  CRU74             Continue packing              *
*-----------------------------------------------------------*
* DATA: Scan spaces after a quoted string datum
CRU83  CI   R8,COMMA          Hit a comma?
       JEQ  CRU85A            Yes, get back into scan
* IMAGE: Scan spaces after a quoted string datum
CRU83B MOVB R0,R0             At a space?
       JLT  CRU64             Yes, ignore it
       MOV  R8,R8             At end of line?
       JEQ  CRU62             Yes, exit scan
JNESY1 JMP  JNESYN            No, unknown character
* DATA: Scan imbedded blanks and check trailing blanks
CRU83A MOV  @VARW,@ARG2       Save input pointer
       BL   @GETNB            Look for next non-blank
       MOVB R1,R1             At end of line?
       JEQ  CRU92             Yes, end string and exit
       CI   R10,CRU83B        Scanning an image?
       JEQ  CRU83C            Yes, commas are not significant
       CI   R1,COMMA*256      Hit a comma?
       JEQ  CRU85             Yes, ignore trailing spaces
CRU83C MOV  @ARG2,@VARW       No, restore input pointer
       JMP  CRU74              and include imbedded space
* DATA: Scan unquoted strings
CRU84  JLT  CRU83A            If hit a space-end of string
       MOV  R8,R8             At end-of-line?
       JEQ  CRU92             Yes, put in length and exit
       CI   R8,COMMA          Reached a comma?
       JNE  CRU74             No, scan unquoted string
       CI   R10,CRU83B        Scanning an IMAGE stmt?
       JEQ  CRU74             Commas are not significant
CRU85  BL   @LENGTH           Yes, end the string
CRU85A LI   R8,COMMAZ         Load a comma token
       INC  @VAR5             Count comma for input stmt
       JMP  CRU60             And resume in string mode
* IMAGE/DATA: Check for leading quote mark
CRU80  JLT  CRU64             Ignore leading separators
       CI   R8,QUOTE          Quotoed string?
       JEQ  CRU82             Yes, like any string, R10 ok
       MOV  R8,R8             End of line?
       JEQ  BCRU28            Yes, end it
       CI   R10,CRU83B        Scanning an IMAGE?
       JEQ  CRU88             Yes, ignore commas
       CI   R8,COMMA          At a comma?
       JEQ  CRU85A            Yes, put it in directly
CRU88  MOV  R2,R7             No, set unquote string copy mode
* IMAGE & DATA: Scan unquoted strings
CRU86  LI   R8,UNQSTZ         Load unquoted string token
       BL   @PUTCHR           Put the token in
       MOV  @RAMPTR,R5        Save current crunch pointer
       BL   @BACKUP           Back up to scan again
CRU87  JMP  CRU74             Resume scan
* CALL and SUB statements
*-----------------------------------------------------------*
* Replace following 2 lines for adding lowercase character  *
* set for 99/4A               5/12/81                       *
*  CRU94 ANDI R0,CPALNM*256     Still an alpha-numeric      *
*        JNE  CRU74             Yes, include in name        *
CRU94  ANDI R0,CPULNM*256     Still an alpha(U & L)-numeric *
       JNE  CRU91             Yes, transfer L to U, then    *
*                              include in name              *
*-----------------------------------------------------------*
       MOV  R8,R8             At end of line?
       JEQ  CRU92             Yes, get out now
CRU90  BL   @BACKUP           No, reset read pointer
CRU92  LI   R7,CRU16          Normal scanning mode
       JMP  CRU72             Calculate & put in string length
*-----------------------------------------------------------*
* Add following lines for adding lowercase character set    *
* for 99/4A                   5/12/81                       *
CRU91  BL   @LOWUP            Transfer lowercase char to    *
*                              uppercase char if necessary  *
       B    @CRU74            Include in name               *
*-----------------------------------------------------------*
* CALL and SUB statements before hit name
CRU93  JLT  CRU64             If a space, ignore it
       MOV  R0,R0             Premature EOL or NIL char, prop?
       JEQ  CERSYN            Yes, *SYNTAX ERROR
*-----------------------------------------------------------*
* Replace following line for adding lowercase character set *
* for 99/4A                   5/12/81                       *
*         ANDI R0,CPALPH*256    An alphabetic to start name?*
       ANDI R0,CPUL*256       An alphabetic (both U & L) to *
*                              start name?                  *
*-----------------------------------------------------------*
       JEQ  CERSYN            No, syntax error
       LI   R7,CRU94          Set up to copy name
       JMP  CRU86             Put in the unqst token
* Numerics
CRU96  LI   R7,CRU98          Set after-initialize scan
       CLR  @ARG              Clear the 'E' flag
       JMP  CRU86             Set up for the numeric
CRU98  MOV  R8,R8             At end of line?
       JEQ  CRU92             Yes end the number
       SLA  R0,2              Scan property bit 2
       JLT  CRU99A            If alpha, might ge 'E'
       SLA  R0,3              Scan property bits 4 and 5
       JNC  CRU99             Bit 4=oper, if not oper, jmp
       MOV  @ARG,R0           If operator, follow an 'E'?
CRU99  CLR  @ARG              Previous char no longer an 'E'
       JLT  CRU87             If still numeric
       JMP  CRU90             No longer numeric
CRU99A CI   R8,'E'            'E' to indicate an exponent?
       JNE  CRU90             No, so end the numeric
       MOV  @ARG,R0           An 'E' already encountered?
JNESYN JNE  CERSYN            Yes, so error
       SETO @ARG              No, indicated 1 encountered now
       JMP  CRU87             And include it in the number
* Line numbers
CRU100 MOV  R8,R8             At end of line?
       JEQ  BCRU28            Yes, exit crunch
       BL   @GETINT           Try to get a line number
       MOV  R0,R0             Get a line number?
       JEQ  CRU105            No, back to normal numeric mode
       LI   R8,LNZ            Load a line number token
       BL   @PUTCHR           Put it out
       MOV  R0,R8             Set up to put out binary #
       SWPB R8                Swap to put MSB of # 1st
       BL   @PUTCHR           Put out 1st byte of line #
       SRL  R8,8              Bare the 2nd byte of line #
       JMP  CRU87             Jump back into it
CRU105 B    @CRU04            Back to normal numeric mode
* Handle a list statement
CRU106 JLT  CRU93             If space, ignore it
       MOV  R8,R8             At end of line?
       JEQ  BCRU28            Yes, exit crunch
       CI   R8,':'            Get a colon?
       JNE  CERSYN            No, *SYNTAX ERROR
       LI   R8,COLONZ         Need to put colon in
       B    @CRU27            And exit crunch
* Error handling routine
ERRLTL INC  @ERRCOD           * LINE TO LONG      3
       DECT @RAMPTR           Backup so can exit to GPL
ERRBLN INC  @ERRCOD           * BAD LINE NUMBER   2
CERSYN INC  @ERRCOD           * SYNTAX ERROR      1
BCRU28 B    @CRU28            Exit back to GPL
* Back up pointer in input line to rescan last character
BACKUP DEC  @VARW             Back up the pointer
       MOVB @VARW1,*R15       Write LSB of address
       NOP
       MOVB @VARW,*R15        Write MSB of address
       LI   R0,>7F00          >7F is an edge character                <<<<<<<<<<
       SB   @XVDPRD,R0        At an edge chracter?
       JEQ  BACKUP            Yes, back up one more
       RT                     And return to caller
* Put a character into the crunch buffer
PUTCHR MOV  @RAMPTR,R1        Fetch the current pointer
       CI   R1,CRNEND         At end of buffer?
       JH   ERRLTL            Yes, LINE TO LONG
       MOVB @R1LB,*R15        Put out LSB of address
       ORI  R1,WRVDP          Enable VDP write
       MOVB R1,*R15           Put out MSB of address
       INC  @RAMPTR           Increment the pointer
       MOVB *R4,@XVDPWD       Write out the byte
       RT                     And return
*-----------------------------------------------------------*
* Move LENGTH to GETNB, becuase CRUNCH is running out of    *
* space, 1/21/81                                            *
* Calculate and put length of string/number into length     *
* byte                                                      *
* LENGTH MOV  R11,R3            Save return address         *
*        MOV  @RAMPTR,R0        Save current crunch pointer *
*        MOV  R0,R8             Put into R8 for PUTCHR below*
*        S    R5,R8             Calculate length of string  *
*        DEC  R8                RAMPTR is post-incremented  *
*        MOV  R5,@RAMPTR        Address of length byte      *
*        BL   @PUTCHR           Put the length in           *
*        MOV  R0,@RAMPTR        Restore crunch pointer      *
*        B    *R3               And return                  *
*-----------------------------------------------------------*
*
* Get a small non-negative integer
* CALL: VARW - TEXT POINTER, points to second character
*       R8   - First character in low byte
*       BL     @GETINT
*       R0   - NUMBER
*       VARW - Text pointer, if there is a number, points to
*               character after number. If there is not a
*               number, unchanged.
*       R8   - 0 in high byte
*       DESTROYS: R1, R2
GETINT MOV  R11,R3            Save return address
       MOV  R8,R0             Get possible digit
       LI   R2,10             Get radix in register for speed
       AI   R0,-'0'           Convert from ASCII to binary
       C    R0,R2             Is the character a digit?
       JL   GETI02            Yes, there is a number!
       CLR  R0                No, indicate no number
       B    *R3               Done, no number
GETI01 MPY  R2,R0             Multiply previous by radix
       MOV  R0,R0             Overflow?
       JNE  ERRBLN            Yes, bad line number
       MOV  R1,R0             Get low order word of product
       A    R8,R0             Add in next digit
       JLT  ERRBLN            If number went negative, error
GETI02 BL   @GETCHR           Get next character
       MOVB R1,*R4            Put into normal position
       JEQ  GETI03            If read end of line
       AI   R8,-'0'           Convert from ASCII to binary
       C    R8,R2             Is this character a digit?
       JL   GETI01            Yes, try to pack it in
       DEC  @VARW             No point to 1st char after number
GETI03 CLR  R8                Clean up our mess
       MOV  R0,R0             Hit a natural zero?
       JEQ  ERRBLN            Yes, its an error
       B    *R3               And return
* The LINE NUMER TABLE
* All tokens which appear in the table must have numerics
* which follow them crunched as line numbers.
LNTAB  BYTE ELSEZ
GOZTOK BYTE GOZ                                                       <<<<<<<<<<
       BYTE GOTOZ
       BYTE GOSUBZ
       BYTE RETURZ
       BYTE BREAKZ
       BYTE UNBRKZ
       BYTE RESTOZ
       BYTE ERRORZ
       BYTE RUNZ
       BYTE THENZ
       BYTE USINGZ
       BYTE >FF               Indicate end of table
       EVEN
*************************************************************
* Table of specially crunched statements                    *
* 2 bytes - special token                                   *
*  Byte 1 - token value                                     *
*  Byte 2 - "address" of special handler                    *
*           Offset from label OFFSET in this assembly of    *
*           the special case handler                        *
*************************************************************
SPECTB BYTE LISTZ,CRU57-OFFSET
       BYTE OLDZ,CRU58-OFFSET
       BYTE SAVEZ,CRU58-OFFSET
       BYTE MERGEZ,CRU58-OFFSET
       BYTE SSEPZ,CRU53-OFFSET
       BYTE TREMZ,CRU74-OFFSET
       BYTE DATAZ,CRU58-OFFSET
       BYTE REMZ,CRU74-OFFSET
       BYTE CALLZ,CRU66-OFFSET
       BYTE SUBZ,CRU65-OFFSET
       BYTE IMAGEZ,CRU54-OFFSET
       BYTE >FF
       EVEN
*
* TRANSFER LOWERCASE CHARACTER TO UPPERCASE CHARACTER
* R0 - Last digit indicates whether this character is a
*       lowercase character
LOWUP  ANDI R0,CPLOW*256      Is lowercase prop set?
       JEQ  LU01              No, just return
       SB   @CBH20,*R4        Change lower to upper
LU01   RT
       AORG >7FFE
       DATA >C68C
********************************************************************************
  • Like 1
  • Thanks 1
Link to comment
Share on other sites

1 hour ago, HOME AUTOMATION said:

Maybe this...

********************************************************************************
       AORG >7B88
       TITL 'CRUNCHS'

That's the file!  Is this file and related files somewhere on WHT and/or another repository?  I compared this file to the Geneve's ABASIC source, and the latter is definitely built upon the XB source. It even answered a few questions.  Thank you, very cool. 

  • Like 4
Link to comment
Share on other sites

I did a quick RXB demo showing bit-shifted scrolling, twinkling stars using RXB instead of ordinary XB. These stars will scroll a little bit faster than normal XB due to CALL HPUT being quite perky.

I've provided the source code for anyone who wants to have a play around with it.  

 

Video shows program running under normal speed ( still quite slow, the routine was originally meant for compiled games! ) and running under CPU overdrive ( more acceptable for what it is )

RXB BIT SHIFTED STARS.txt



Note: The great thing about CALL HPUT is that it can address more .... there's a line in there that needs to delete a star and then re-display it 1 column to the left, HPUT can do this in one command and that saves time and bytes in comparison to normal XB which would have to use DISPLAY AT twice.  :)
 

 

 

  • Like 3
Link to comment
Share on other sites

I was intrigued by the CALL USER functionality of RXB2023, so I tried a small test. I wrote a test program in Stevie, saved it to disk, and tried to load it using CALL USER, but it's coming up all on 1 line. The program displays fine in TI99Dir and each line is properly terminated by a carriage return. Any thoughts on the issue?

 

 

Link to comment
Share on other sites

16 hours ago, Vorticon said:

I was intrigued by the CALL USER functionality of RXB2023, so I tried a small test. I wrote a test program in Stevie, saved it to disk, and tried to load it using CALL USER, but it's coming up all on 1 line. The program displays fine in TI99Dir and each line is properly terminated by a carriage return. Any thoughts on the issue?

 

I've only experimented with CALL USER to see how it works. While it works as advertised I have not found many uses for it to date. Entering the same short program in TI Writer works as it should, the E/A (no CR) will produce the same results you see. Fred's nifty adaptation of notepad in TIDIR displays both the TIW and E/A versions properly (it's one of those smart programs). I would check and see if your line entries all terminate with a ".", which is how Fred's program represents a CR. I unfortunately do not know anything about Stevie... yet! It is on the to-do list.

 

Link to comment
Share on other sites

46 minutes ago, MikeV said:

I've only experimented with CALL USER to see how it works. While it works as advertised I have not found many uses for it to date. Entering the same short program in TI Writer works as it should, the E/A (no CR) will produce the same results you see. Fred's nifty adaptation of notepad in TIDIR displays both the TIW and E/A versions properly (it's one of those smart programs). I would check and see if your line entries all terminate with a ".", which is how Fred's program represents a CR. I unfortunately do not know anything about Stevie... yet! It is on the to-do list.

 

Ah! That may be the case. I'll check and see how Stevie terminates lines.

The CALL USER functionality actually allows you to create and edit XB programs in a full screen proper editor then simply "paste" them into RXB without the need to use emulators or external PC programs. 

Few users nowadays use real hardware for initial development but there are special cases where programming on the real thing is necessary such as when working on interfacing projects as in my case. So this functionality will come in real handy!

  • Like 1
Link to comment
Share on other sites

XB GEM has a DV2XB subprogram which does the same thing but a lot faster and does not require that pesky CR line termination. I really think RXB should could benefit from enhancing the CALL USER functionality and removing the CR limitation.

Link to comment
Share on other sites

  • 2 months later...
On 3/24/2023 at 5:24 AM, Vorticon said:

XB GEM has a DV2XB subprogram which does the same thing but a lot faster and does not require that pesky CR line termination. I really think RXB should could benefit from enhancing the CALL USER functionality and removing the CR limitation.

XB 256 cannot do half as much as RXB CALL USER, can it edit lines and run multiple XB programs and load Assembly support routines all from a single DV 80 file?

I demoed in 2000 RXB CALL USER ran 52K of Assembly support from various XB Assembly programs. (I did not write any of them like STAR or XB40)

So XB 256 is great but 20 years behind what I already did in 2000.

Link to comment
Share on other sites

RXB 2023A now has a routine installed that was discussed on the XB 256 page.

I think this came from CALL LOAD(8192,A,B,"",8198,C,D) where the "" skips to another address.

I always thought this was more than a strange way to skip to another address or filename.

 

The idea in XB 256 was to use

CALL PEEK(8192,A,B,"",8198,C,D)

The "" was to indicate a jump to another address in the PEEK routine.

 

I thought this was a waste of space as double quotes is 2 characters along with the previous comma and ending comma before the next address.

RXB 2023A has modified this with a single character token insted of the quote marks it uses the & (and) symbol token.

So RXB 2023A has 

CALL PEEK(8192,A,B,&,8198,C,D)

One less token used and when reading it makes a little more logical sense to read.

  • Like 1
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...