Jump to content
IGNORED

RXB - Rich Extended Basic


Bones-69

Recommended Posts

A thing of beauty Lee.

 

I am wondering if you have one free register?

VWROW1 MOVB *R1+,@VDPWD    * write next VRAM byte from RAM
       MOVB *R1+,@VDPWD    * write next VRAM byte from RAM

My experiments showed that replacing the symbolic address with indirect addressing through a register speeds up this kind of loop by 12.9%.

 

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

1 hour ago, TheBF said:

A thing of beauty Lee.

 

I am wondering if you have one free register?


VWROW1 MOVB *R1+,@VDPWD    * write next VRAM byte from RAM
       MOVB *R1+,@VDPWD    * write next VRAM byte from RAM

My experiments showed that replacing the symbolic address with indirect addressing through a register speeds up this kind of loop by 12.9%.

 

Indeed, It sped up the rolls by an average of 12 %. Here is the new code, which, by the way, is the same size as the previous code:

Spoiler

************************************************************
       AORG >6000
       TITL 'RXB ROM3'

UNUSED DATA >0000,>0000,>0000,>0000
       DATA >0000,>0000,>0000,>0000
************************************************************
* XML table number 7 for RXB ROM3 - must have              *
*     it's origin at >6010                                 *
************************************************************
*           0     1     2     3      4      5     6
       DATA RROLL,LROLL,UROLL,DROLL,>0000,>0000,>0000
*            7     8     9     A     B     C     D
       DATA >0000,>0000,>0000,>0000,>0000,>0000,>0000
*             E     F
       DATA >0000,>0000
************************************************************
* XML table number 8 for RXB ROM3 - must have              *
*     it's origin at >6030                                 *
************************************************************
*            0     1     2     3     4     5     6     7
       DATA >0000,>0000,>0000,>0000,>0000,>0000,>0000,>0000
*            8     9     A     B     C     D     E     F
       DATA >0000,>0000,>0000,>0000,>0000,>0000,>0000,>0000

GR0LB  EQU  >83E1          * GPLWS R0 LSB
FAC    EQU  >834A          * RAM line buffer
SAVRTN EQU  >836C          * free space after RAM line buffer
VBUFF  EQU  >03C0          * line buffer in VRAM
VDPRD  EQU  >8800          * VDP Read Data address
VDPWD  EQU  >8C00          * VDP Write Data address

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Write VRAM address
*     Expects address in R0
*
* BL here for writing data
*
VWADDW ORI  R0,>4000       * set to write VRAM data
*
* BL here for reading data
*
VWADD  MOVB @GR0LB,*R15    * write LSB of R0 to VDPWA
       MOVB R0,*R15        * write MSB of R0 to VDPWA
       ANDI R0,>3FFF       * ensure R0 returned intact
       RT

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* The following utilities expect 
*     R0 = VRAM address of row
*     R1 = RAM buffer address
*
* R2 and R10 will be destroyed
* 
* Copy 1 row of 32 bytes from VRAM (R0) to RAM (R1)
*
VRROW  MOV  R11,R10        * save return
       BL   @VWADD         * write out VRAM read address
       LI   R2,32          * read 1 row
       LI   R4,VDPRD       * load VDP Read Data address
VRROW1 MOVB *R4,*R1+       * read next VRAM byte to RAM
       MOVB *R4,*R1+       * read next VRAM byte to RAM
       DECT R2             * dec count by 2
       JNE  VRROW1         * repeat if not done
       B    *R10           * return to caller

* 
* Copy 1 row of 32 bytes from RAM (R1) to VRAM (R0)
*
VWROW  MOV  R11,R10        * save return
       BL   @VWADDW        * write out VRAM write address
       LI   R2,32          * write one row
       LI   R4,VDPWD       * load VDP Write Data address
VWROW1 MOVB *R1+,*R4       * write next VRAM byte from RAM
       MOVB *R1+,*R4       * write next VRAM byte from RAM
       DECT R2             * dec count by 2
       JNE  VWROW1         * repeat if not done
       B    *R10           * return to caller

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* RROLL
*
RROLL  MOV  R11,@SAVRTN    * save return address
       CLR  R0             * set to screen start
       LI   R3,24          * rows to roll
* Write row to RAM buffer
RROLLP LI   R1,FAC+1       * RAM buffer+1 for roll-right positions
       BL   @VRROW         * copy row to RAM buffer 2 bytes at a time
* Copy last column before first in RAM buffer
       MOVB @FAC+32,@FAC   * copy roll-out byte to roll-in position
* Copy rolled row back to screen (R0 still has correct location)
       LI   R1,FAC         * reset RAM buffer pointer
       BL   @VWROW         * copy rolled line          
* Process next row
       AI   R0,32          * next row                   
       DEC  R3             * dec row count
       JNE  RROLLP         * roll next row if not done
       MOV  @SAVRTN,R11    * restore return address
       RT

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* LROLL
*
LROLL  MOV  R11,@SAVRTN    * save return address
       CLR  R0             * set to screen start
       LI   R3,24          * rows to roll
* Write row to RAM buffer
LROLLP LI   R1,FAC         * RAM buffer+1 for roll-left positions
       BL   @VRROW         * copy row to RAM buffer 2 bytes at a time
* Copy first column after last in RAM buffer
       MOVB @FAC,@FAC+32   * copy roll-out byte to roll-in position
* Copy rolled row back to screen (R0 still has correct location)
       LI   R1,FAC+1       * reset RAM buffer pointer
       BL   @VWROW         * copy rolled line 2 bytes at a time
* Process next row
       AI   R0,32          * next row                   
       DEC  R3             * dec row count
       JNE  LROLLP         * roll next row if not done
       MOV  @SAVRTN,R11    * restore return address
       RT

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* UROLL
*
UROLL  MOV  R11,@SAVRTN    * save return address
       CLR  R0             * set to screen start
       LI   R3,23          * rows to roll (all but 1st)
* Write first row to RAM buffer
       LI   R1,FAC         * set RAM buffer
       BL   @VRROW         * copy row to RAM buffer 2 bytes at a time
* Copy RAM buffer to VRAM buffer
       LI   R0,VBUFF       * set VRAM dest to VBUFF
       LI   R1,FAC         * set RAM buffer
       BL   @VWROW         * copy row to VBUFF 2 bytes at a time
* Start copy loop at 2nd row
       LI   R0,32          * point to 2nd row
* Write row to RAM buffer
UROLLP LI   R1,FAC         * set RAM buffer
       BL   @VRROW         * copy row to RAM buffer 2 bytes at a time
* Copy to previous row
       AI   R0,-32         * back up 1 row
       LI   R1,FAC         * reset RAM buffer pointer
       BL   @VWROW         * copy to previous row 2 bytes at a time
* Process next row
       AI   R0,64          * next row
       DEC  R3             * dec row count
       JNE  UROLLP         * roll next row if not done
* Copy saved row to RAM
       LI   R0,VBUFF       * set VRAM source
       LI   R1,FAC         * set RAM buffer
       BL   @VRROW         * copy row to RAM buffer 2 bytes at a time
* Copy saved row to last row
       LI   R0,736         * point to last row
       LI   R1,FAC         * reset RAM buffer pointer
       BL   @VWROW         * copy to last row 2 bytes at a time
       MOV  @SAVRTN,R11    * restore return address
       RT
       
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* DROLL
*
DROLL  MOV  R11,@SAVRTN    * save return address
       LI   R0,736         * set to last row
       LI   R3,23          * rows to roll (all but last)
* Write last row to RAM buffer
       LI   R1,FAC         * set RAM buffer
       BL   @VRROW         * copy row to RAM buffer 2 bytes at a time
* Copy RAM buffer to VRAM buffer
       LI   R0,VBUFF       * set VRAM dest to VBUFF
       LI   R1,FAC         * set RAM buffer
       BL   @VWROW         * copy row to VBUFF 2 bytes at a time
* Start copy loop at 2nd-to-last row
       LI   R0,704         * point to row 22
* Write row to RAM buffer
DROLLP LI   R1,FAC         * set RAM buffer
       BL   @VRROW         * copy row to RAM buffer 2 bytes at a time
* Copy to next row
       AI   R0,32          * down 1 row
       LI   R1,FAC         * reset RAM buffer pointer
       BL   @VWROW         * copy to next row 2 bytes at a time
* Process next row
       AI   R0,-64         * back up 2 rows
       DEC  R3             * dec row count
       JNE  DROLLP         * roll next row if not done
* Copy saved row to RAM
       LI   R0,VBUFF       * set VRAM source
       LI   R1,FAC         * set RAM buffer
       BL   @VRROW         * copy row to RAM buffer 2 bytes at a time
* Copy saved row to first row
       CLR  R0             * point to first row
       LI   R1,FAC         * reset RAM buffer pointer
       BL   @VWROW         * copy to first row 2 bytes at a time
       MOV  @SAVRTN,R11    * restore return address
       RT

       END

 

 

The above code is a full 3 times faster than the last RXB code I tested (post #1236).

 

...lee

  • Like 4
Link to comment
Share on other sites

On 6/17/2021 at 2:31 AM, Lee Stewart said:

If I worked a little harder, I could probably combine the up/down routines as well as the right/left routines—the pairs are practically identical...

 

TaDa!! Here is 252 bytes of code that is as compact as I can get it, I think. Left/right rolling is combined into a horizontal rolling routine and up/down rolling is combined into a vertical rolling routine. The times are virtually identical to the last program:

Spoiler

************************************************************
       AORG >6000
       TITL 'RXB ROM3'

UNUSED DATA >0000,>0000,>0000,>0000
       DATA >0000,>0000,>0000,>0000
************************************************************
* XML table number 7 for RXB ROM3 - must have              *
*     it's origin at >6010                                 *
************************************************************
*           0     1     2     3      4      5     6
       DATA RROLL,LROLL,UROLL,DROLL,>0000,>0000,>0000
*            7     8     9     A     B     C     D
       DATA >0000,>0000,>0000,>0000,>0000,>0000,>0000
*             E     F
       DATA >0000,>0000
************************************************************
* XML table number 8 for RXB ROM3 - must have              *
*     it's origin at >6030                                 *
************************************************************
*            0     1     2     3     4     5     6     7
       DATA >0000,>0000,>0000,>0000,>0000,>0000,>0000,>0000
*            8     9     A     B     C     D     E     F
       DATA >0000,>0000,>0000,>0000,>0000,>0000,>0000,>0000

GR0LB  EQU  >83E1          * GPLWS R0 LSB
FAC    EQU  >834A          * RAM line buffer
SAVRTN EQU  >836C          * free space after RAM line buffer
VBUFF  EQU  >03C0          * line buffer in VRAM
VDPRD  EQU  >8800          * VDP Read Data address
VDPWD  EQU  >8C00          * VDP Write Data address

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Write VRAM address
*     Expects address in R0
*
* BL here for writing data
*
VWADDW ORI  R0,>4000       * set to write VRAM data
*
* BL here for reading data
*
VWADD  MOVB @GR0LB,*R15    * write LSB of R0 to VDPWA
       MOVB R0,*R15        * write MSB of R0 to VDPWA
       ANDI R0,>3FFF       * ensure R0 returned intact
       RT

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* The following utilities expect 
*     R0 = VRAM address of row
*     R1 = RAM buffer address
*
* R2, R4, R10 will be destroyed
* 
* Copy 1 row of 32 bytes from VRAM (R0) to RAM (R1)
*
VRROW  MOV  R11,R10        * save return
       BL   @VWADD         * write out VRAM read address
       LI   R2,32          * read 1 row
       LI   R4,VDPRD       * load VDP Read Data address
VRROW1 MOVB *R4,*R1+       * read next VRAM byte to RAM
       MOVB *R4,*R1+       * read next VRAM byte to RAM
       DECT R2             * dec count by 2
       JNE  VRROW1         * repeat if not done
       B    *R10           * return to caller

* 
* Copy 1 row of 32 bytes from RAM (R1) to VRAM (R0)
*
VWROW  MOV  R11,R10        * save return
       BL   @VWADDW        * write out VRAM write address
       LI   R2,32          * write one row
       LI   R4,VDPWD       * load VDP Write Data address
VWROW1 MOVB *R1+,*R4       * write next VRAM byte from RAM
       MOVB *R1+,*R4       * write next VRAM byte from RAM
       DECT R2             * dec count by 2
       JNE  VWROW1         * repeat if not done
       B    *R10           * return to caller

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Roll table data...
*
RRLTAB DATA FAC+1,FAC+32,FAC,FAC    * Right
LRLTAB DATA FAC,FAC,FAC+32,FAC+1    * Left
URLTAB DATA 0,32,-32,64,736         * Up
DRLTAB DATA 736,704,32,-64,0        * Down

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* RROLL
*
RROLL  LI   R8,RRLTAB      * set HROLL for right roll
       JMP  HROLL          * on with the rolling
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* LROLL
*
LROLL  LI   R8,LRLTAB      * set HROLL for left roll
* Fall through to HROLL to get on with the rolling

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* HROLL  Horizontal Roll common code
*
HROLL  MOV  R11,@SAVRTN    * save return address
       CLR  R0             * set to screen start
       LI   R3,24          * rows to roll
* Write row to RAM buffer
HROLLP MOV  R8,R5          * reset roll table pointer
       MOV  *R5+,R1        * RAM buffer+1 for roll-right positions
       BL   @VRROW         * copy row to RAM buffer 2 bytes at a time
* Copy rolled-out column to roll-in column in RAM buffer
       MOV  *R5+,R6        * get source of rolled-out column
       MOV  *R5+,R7        * get destination of roll-in column
       MOVB *R6,*R7        * copy roll-out byte to roll-in position
* Copy rolled row back to screen (R0 still has correct location)
       MOV  *R5,R1         * reset RAM buffer pointer
       BL   @VWROW         * copy rolled line          
* Process next row
       AI   R0,32          * next row                   
       DEC  R3             * dec row count
       JNE  HROLLP         * roll next row if not done
       MOV  @SAVRTN,R11    * restore return address
       RT

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* UROLL
*
UROLL  LI   R8,URLTAB      * set VROLL for up roll
       JMP  VROLL          * on with the rolling
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* DROLL
*
DROLL  LI   R8,DRLTAB      * set VROLL for down roll
* Fall through to VROLL to get on with the rolling

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* VROLL  Vertical Roll common code
*
VROLL  MOV  R11,@SAVRTN    * save return address
       MOV  *R8+,R0        * set to roll-out row
       LI   R3,23          * rows to roll (all but 1st)
* Write roll-out row to RAM buffer
       LI   R1,FAC         * set RAM buffer
       BL   @VRROW         * copy row to RAM buffer 2 bytes at a time
* Copy RAM buffer to VRAM buffer
       LI   R0,VBUFF       * set VRAM dest to VBUFF
       LI   R1,FAC         * set RAM buffer
       BL   @VWROW         * copy row to VBUFF 2 bytes at a time
* Start copy loop at next row to scroll
       MOV  *R8+,R0        * point to roll to start scroll
* Write row to RAM buffer
VROLLP LI   R1,FAC         * set RAM buffer
       BL   @VRROW         * copy row to RAM buffer 2 bytes at a time
* Copy to scroll row
       MOV  R8,R5          * reset roll table pointer to 3rd entry
       A    *R5+,R0        * next scroll dest
       LI   R1,FAC         * reset RAM buffer pointer
       BL   @VWROW         * copy to scroll row 2 bytes at a time
* Process next row
       A    *R5+,R0        * next row
       DEC  R3             * dec row count
       JNE  VROLLP         * roll next row if not done
* Copy saved row to RAM
       LI   R0,VBUFF       * set VRAM source
       LI   R1,FAC         * set RAM buffer
       BL   @VRROW         * copy row to RAM buffer 2 bytes at a time
* Copy saved row to roll-in row
       MOV  *R5,R0         * to roll-in row
       LI   R1,FAC         * reset RAM buffer pointer
       BL   @VWROW         * copy to rolled-out row 2 bytes at a time
       MOV  @SAVRTN,R11    * restore return address
       RT
       
       END

 

 

...lee

  • Like 8
Link to comment
Share on other sites

On 6/17/2021 at 2:10 PM, Lee Stewart said:

 

TaDa!! Here is 252 bytes of code that is as compact as I can get it, I think. Left/right rolling is combined into a horizontal rolling routine and up/down rolling is combined into a vertical rolling routine. The times are virtually identical to the last program:

  Reveal hidden contents


************************************************************
       AORG >6000
       TITL 'RXB ROM3'

UNUSED DATA >0000,>0000,>0000,>0000
       DATA >0000,>0000,>0000,>0000
************************************************************
* XML table number 7 for RXB ROM3 - must have              *
*     it's origin at >6010                                 *
************************************************************
*           0     1     2     3      4      5     6
       DATA RROLL,LROLL,UROLL,DROLL,>0000,>0000,>0000
*            7     8     9     A     B     C     D
       DATA >0000,>0000,>0000,>0000,>0000,>0000,>0000
*             E     F
       DATA >0000,>0000
************************************************************
* XML table number 8 for RXB ROM3 - must have              *
*     it's origin at >6030                                 *
************************************************************
*            0     1     2     3     4     5     6     7
       DATA >0000,>0000,>0000,>0000,>0000,>0000,>0000,>0000
*            8     9     A     B     C     D     E     F
       DATA >0000,>0000,>0000,>0000,>0000,>0000,>0000,>0000

GR0LB  EQU  >83E1          * GPLWS R0 LSB
FAC    EQU  >834A          * RAM line buffer
SAVRTN EQU  >836C          * free space after RAM line buffer
VBUFF  EQU  >03C0          * line buffer in VRAM
VDPRD  EQU  >8800          * VDP Read Data address
VDPWD  EQU  >8C00          * VDP Write Data address

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Write VRAM address
*     Expects address in R0
*
* BL here for writing data
*
VWADDW ORI  R0,>4000       * set to write VRAM data
*
* BL here for reading data
*
VWADD  MOVB @GR0LB,*R15    * write LSB of R0 to VDPWA
       MOVB R0,*R15        * write MSB of R0 to VDPWA
       ANDI R0,>3FFF       * ensure R0 returned intact
       RT

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* The following utilities expect 
*     R0 = VRAM address of row
*     R1 = RAM buffer address
*
* R2, R4, R10 will be destroyed
* 
* Copy 1 row of 32 bytes from VRAM (R0) to RAM (R1)
*
VRROW  MOV  R11,R10        * save return
       BL   @VWADD         * write out VRAM read address
       LI   R2,32          * read 1 row
       LI   R4,VDPRD       * load VDP Read Data address
VRROW1 MOVB *R4,*R1+       * read next VRAM byte to RAM
       MOVB *R4,*R1+       * read next VRAM byte to RAM
       DECT R2             * dec count by 2
       JNE  VRROW1         * repeat if not done
       B    *R10           * return to caller

* 
* Copy 1 row of 32 bytes from RAM (R1) to VRAM (R0)
*
VWROW  MOV  R11,R10        * save return
       BL   @VWADDW        * write out VRAM write address
       LI   R2,32          * write one row
       LI   R4,VDPWD       * load VDP Write Data address
VWROW1 MOVB *R1+,*R4       * write next VRAM byte from RAM
       MOVB *R1+,*R4       * write next VRAM byte from RAM
       DECT R2             * dec count by 2
       JNE  VWROW1         * repeat if not done
       B    *R10           * return to caller

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Roll table data...
*
RRLTAB DATA FAC+1,FAC+32,FAC,FAC    * Right
LRLTAB DATA FAC,FAC,FAC+32,FAC+1    * Left
URLTAB DATA 0,32,-32,64,736         * Up
DRLTAB DATA 736,704,32,-64,0        * Down

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* RROLL
*
RROLL  LI   R8,RRLTAB      * set HROLL for right roll
       JMP  HROLL          * on with the rolling
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* LROLL
*
LROLL  LI   R8,LRLTAB      * set HROLL for left roll
* Fall through to HROLL to get on with the rolling

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* HROLL  Horizontal Roll common code
*
HROLL  MOV  R11,@SAVRTN    * save return address
       CLR  R0             * set to screen start
       LI   R3,24          * rows to roll
* Write row to RAM buffer
HROLLP MOV  R8,R5          * reset roll table pointer
       MOV  *R5+,R1        * RAM buffer+1 for roll-right positions
       BL   @VRROW         * copy row to RAM buffer 2 bytes at a time
* Copy rolled-out column to roll-in column in RAM buffer
       MOV  *R5+,R6        * get source of rolled-out column
       MOV  *R5+,R7        * get destination of roll-in column
       MOVB *R6,*R7        * copy roll-out byte to roll-in position
* Copy rolled row back to screen (R0 still has correct location)
       MOV  *R5,R1         * reset RAM buffer pointer
       BL   @VWROW         * copy rolled line          
* Process next row
       AI   R0,32          * next row                   
       DEC  R3             * dec row count
       JNE  HROLLP         * roll next row if not done
       MOV  @SAVRTN,R11    * restore return address
       RT

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* UROLL
*
UROLL  LI   R8,URLTAB      * set VROLL for up roll
       JMP  VROLL          * on with the rolling
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* DROLL
*
DROLL  LI   R8,DRLTAB      * set VROLL for down roll
* Fall through to VROLL to get on with the rolling

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* VROLL  Vertical Roll common code
*
VROLL  MOV  R11,@SAVRTN    * save return address
       MOV  *R8+,R0        * set to roll-out row
       LI   R3,23          * rows to roll (all but 1st)
* Write roll-out row to RAM buffer
       LI   R1,FAC         * set RAM buffer
       BL   @VRROW         * copy row to RAM buffer 2 bytes at a time
* Copy RAM buffer to VRAM buffer
       LI   R0,VBUFF       * set VRAM dest to VBUFF
       LI   R1,FAC         * set RAM buffer
       BL   @VWROW         * copy row to VBUFF 2 bytes at a time
* Start copy loop at next row to scroll
       MOV  *R8+,R0        * point to roll to start scroll
* Write row to RAM buffer
VROLLP LI   R1,FAC         * set RAM buffer
       BL   @VRROW         * copy row to RAM buffer 2 bytes at a time
* Copy to scroll row
       MOV  R8,R5          * reset roll table pointer to 3rd entry
       A    *R5+,R0        * next scroll dest
       LI   R1,FAC         * reset RAM buffer pointer
       BL   @VWROW         * copy to scroll row 2 bytes at a time
* Process next row
       A    *R5+,R0        * next row
       DEC  R3             * dec row count
       JNE  VROLLP         * roll next row if not done
* Copy saved row to RAM
       LI   R0,VBUFF       * set VRAM source
       LI   R1,FAC         * set RAM buffer
       BL   @VRROW         * copy row to RAM buffer 2 bytes at a time
* Copy saved row to roll-in row
       MOV  *R5,R0         * to roll-in row
       LI   R1,FAC         * reset RAM buffer pointer
       BL   @VWROW         * copy to rolled-out row 2 bytes at a time
       MOV  @SAVRTN,R11    * restore return address
       RT
       
       END

 

 

...lee

This is really great work! Look forward to seeing further collaborative efforts for the TI. Thanks.

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

  • 3 weeks later...

Ok just finished RXB 2021  new CALL INIT that instead of loading from GROM now loads from ROM3

Loop for 10,000 times results are:

XB             34  minutes 41 seconds

RXB 2021    3  minutes 12 seconds

 

Yea I know pointless values but shows a marked improvement over XB.

 

 

Also RXB 2021 has a new Assembly version of CALL CLEAR instead of the old XB GPL version.

Oddly hardly any improvement?

Spoiler

***********************************************************
       AORG >6000
       TITL 'RXB ROM3'

UNUSED DATA >0000,>0000,>0000,>0000
       DATA >0000,>0000,>0000,>0000
************************************************************
* XML table number 7 for RXB ROM3 - must have              *
*     it's origin at >6010                                 *
************************************************************
*           0     1     2     3      4      5     6
       DATA RROLL,LROLL,UROLL,DROLL,CLEAR,>0000,>0000
*            7     8     9     A     B     C     D
       DATA >0000,>0000,>0000,>0000,>0000,>0000,>0000
*             E     F
       DATA >0000,>0000
************************************************************
* XML table number 8 for RXB ROM3 - must have              *
*     it's origin at >6030                                 *
************************************************************
*            0     1     2     3     4     5     6     7
       DATA >0000,>0000,>0000,>0000,>0000,>0000,>0000,>0000
*            8     9     A     B     C     D     E     F
       DATA >0000,>0000,>0000,>0000,>0000,>0000,>0000,>0000

GR0LB  EQU  >83E1       * GPLWS R0 LSB
FAC    EQU  >834A       * RAM line buffer
SAVRTN EQU  >836C       * free space after RAM line buffer
VBUFF  EQU  >03C0       * line buffer in VRAM
VDPRD  EQU  >8800       * VDP Read Data address
VDPWD  EQU  >8C00       * VDP Write Data address

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Write VRAM address
*     Expects address in R0
*
* BL here for writing data
*
VWADDW ORI  R0,>4000    * set to write VRAM data
*
* BL here for reading data
*
VWADD  MOVB @GR0LB,*R15 * write LSB of R0 to VDPWA
       MOVB R0,*R15     * write MSB of R0 to VDPWA
       ANDI R0,>3FFF    * ensure R0 returned intact
       RT

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* The following utilities expect 
*     R0 = VRAM address of row
*     R1 = RAM buffer address
*
* R2 and R10 will be destroyed

* Copy 1 row of 32 bytes from VRAM (R0) to RAM (R1)
*
VRROW  MOV  R11,R10     * save return
       BL   @VWADD      * write out VRAM read address
       LI   R2,32       * read 1 row
VRROW1 MOVB @VDPRD,*R1+ * read next VRAM byte to RAM
       MOVB @VDPRD,*R1+ * read next VRAM byte to RAM
       DECT R2          * dec count by 2
       JNE  VRROW1      * repeat if not done
       B    *R10        * return to caller


* Copy 1 row of 32 bytes from RAM (R1) to VRAM (R0)
*
VWROW  MOV  R11,R10     * save return
       BL   @VWADDW     * write out VRAM write address
       LI   R2,32       * write one row
VWROW1 MOVB *R1+,@VDPWD * write next VRAM byte from RAM
       MOVB *R1+,@VDPWD * write next VRAM byte from RAM
       DECT R2          * dec count by 2
       JNE  VWROW1      * repeat if not done
       B    *R10        * return to caller

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* RROLL
*
RROLL  MOV  R11,R9      * save return address
       CLR  R0          * set to screen start
       LI   R3,24       * rows to roll
* Write row to RAM buffer
RROLLP LI   R1,FAC+1    * RAM buffer+1 for roll-right positions
       BL   @VRROW      * copy row to RAM buffer 2 bytes at a time
* Copy last column before first in RAM buffer
       MOVB @FAC+32,@FAC * copy roll-out byte to roll-in position
* Copy rolled row back to screen (R0 still has correct location)
       LI   R1,FAC      * reset RAM buffer pointer
       BL   @VWROW      * copy rolled line          
* Process next row
       AI   R0,32       * next row                   
       DEC  R3          * dec row count
       JNE  RROLLP      * roll next row if not done
       B    *R9         * return to caller
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* LROLL
*
LROLL  MOV  R11,R9      * save return address
       CLR  R0          * set to screen start
       LI   R3,24       * rows to roll
* Write row to RAM buffer
LROLLP LI   R1,FAC      * RAM buffer+1 for roll-left positions
       BL   @VRROW      * copy row to RAM buffer 2 bytes at a time
* Copy first column after last in RAM buffer
       MOVB @FAC,@FAC+32 * copy roll-out byte to roll-in position
* Copy rolled row back to screen (R0 still has correct location)
       LI   R1,FAC+1    * reset RAM buffer pointer
       BL   @VWROW      * copy rolled line 2 bytes at a time
* Process next row
       AI   R0,32       * next row                   
       DEC  R3          * dec row count
       JNE  LROLLP      * roll next row if not done
       B    *R9         * return to caller
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* UROLL
*
UROLL  MOV  R11,R9      * save return address
       CLR  R0          * set to screen start
       LI   R3,23       * rows to roll (all but 1st)
* Write first row to RAM buffer
       LI   R1,FAC      * set RAM buffer
       BL   @VRROW      * copy row to RAM buffer 2 bytes at a time
* Copy RAM buffer to VRAM buffer
       LI   R0,VBUFF    * set VRAM dest to VBUFF
       LI   R1,FAC      * set RAM buffer
       BL   @VWROW      * copy row to VBUFF 2 bytes at a time
* Start copy loop at 2nd row
       LI   R0,32       * point to 2nd row
* Write row to RAM buffer
UROLLP LI   R1,FAC      * set RAM buffer
       BL   @VRROW      * copy row to RAM buffer 2 bytes at a time
* Copy to previous row
       AI   R0,-32      * back up 1 row
       LI   R1,FAC      * reset RAM buffer pointer
       BL   @VWROW      * copy to previous row 2 bytes at a time
* Process next row
       AI   R0,64       * next row
       DEC  R3          * dec row count
       JNE  UROLLP      * roll next row if not done
* Copy saved row to RAM
       LI   R0,VBUFF    * set VRAM source
       LI   R1,FAC      * set RAM buffer
       BL   @VRROW      * copy row to RAM buffer 2 bytes at a time
* Copy saved row to last row
       LI   R0,736      * point to last row
       LI   R1,FAC      * reset RAM buffer pointer
       BL   @VWROW      * copy to last row 2 bytes at a time
       B    *R9         * return to caller
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* DROLL
*
DROLL  MOV  R11,R9      * save return address
       LI   R0,736      * set to last row
       LI   R3,23       * rows to roll (all but last)
* Write last row to RAM buffer
       LI   R1,FAC      * set RAM buffer
       BL   @VRROW      * copy row to RAM buffer 2 bytes at a time
* Copy RAM buffer to VRAM buffer
       LI   R0,VBUFF    * set VRAM dest to VBUFF
       LI   R1,FAC      * set RAM buffer
       BL   @VWROW      * copy row to VBUFF 2 bytes at a time
* Start copy loop at 2nd-to-last row
       LI   R0,704      * point to row 22
* Write row to RAM buffer
DROLLP LI   R1,FAC      * set RAM buffer
       BL   @VRROW      * copy row to RAM buffer 2 bytes at a time
* Copy to next row
       AI   R0,32       * down 1 row
       LI   R1,FAC      * reset RAM buffer pointer
       BL   @VWROW      * copy to next row 2 bytes at a time
* Process next row
       AI   R0,-64      * back up 2 rows
       DEC  R3          * dec row count
       JNE  DROLLP      * roll next row if not done
* Copy saved row to RAM
       LI   R0,VBUFF    * set VRAM source
       LI   R1,FAC      * set RAM buffer
       BL   @VRROW      * copy row to RAM buffer 2 bytes at a time
* Copy saved row to first row
       CLR  R0          * point to first row
       LI   R1,FAC      * reset RAM buffer pointer
       BL   @VWROW      * copy to first row 2 bytes at a time
       B    *R9         * return to caller
************************************************************
* CALL CLEAR                                               *
************************************************************
* >8080 already loaded *************************************
* Put writing out the VRAM address outside the loop. *******
************************************************************
CLEAR  MOV  R11,R9     * save return address
           LI   R0,0       * set to first screen address
           LI   R3,768     * Screen size
           LI   R1,>8080   * SPACE SPACE
           BL   @VWADDW    * write out VRAM write address
CLRLP  MOVB R1,@VDPWD * write next VRAM byte from R1
           MOVB R1,@VDPWD * write next VRAM byte from R1
           DECT R3         * count by -2
           JNE  CLRLP      * count=0?
           B    *R9        * return to caller
*************************************************************

Which was disappointing and a bummer. 3.1 seconds faster after 10,000 times in loop.

  • Like 1
Link to comment
Share on other sites

  6 hours ago, Vorticon said:

I just noted that the TAB key does not work in the editor. I think it's important to have that functionality for ease of formatting.

I can add a TAB key to RXB Editor so how many spaces should it jump forward or should it look for something like "::" ?

  Reveal hidden contents

I think the best thing would be tab maybe 24 characters at time so next line in Editor each tab.

XB EXAMPLE:

100 ! This is a test line at line 100 and just to show an example.

 

When you hit tab the screen would like this:

100 ! This is a test line at

@line 100 and just to sh

ow an example.

 

The @ is where the Cursor would move to.

  • Like 1
Link to comment
Share on other sites

I also thought RXB can add a FIND KEY to Editor in XB.

Like FCTN or CTRL TAB would ask for a search string say like "FIND?:" and you would type in string up to 24 characters.

Then a search of the XB program would find that line and display it.

  • Like 1
Link to comment
Share on other sites

16 hours ago, dhe said:

Rich - do you have a manual of the new features and functions?

 

Sorry no will have to add changes and put in addition changes.

 

I am going to add FIND into XB Editor Mode so like RES or NUM or COPY just type in FIND linenumber,string

EXAMPLE:

 

FIND 2070,RK=LF

 

Would start at line number 2070 and look for "RK=LF" in program and show line number with "RK=LF" in that line number.

Error output would be No Program Present, Bad Value, Bad Line Number or Line Not Found in case no match found. 

 

Second EXAMPLE:

 

FIND 1910,STR$

 

Would look for STR$ command starting at line 1910 and display that line if found.

  • Like 2
Link to comment
Share on other sites

Rich,

 

Just going to throw this out in case it is of interest to you following our Saturday Zoom call.

 

You mentioned something about converting some of the GPL routines in RXB to assembly.  I don't know if you would find any advantage to it or not, but Geneve Advanced Basic is written entirely in assembly.  I mention this as you are free to borrow routines you may want to convert to assembly, etc.  Also, all the math routines are in assembly but part of an XOP call which is basically not much more than load various registers and call the XOP which for the TI, would be like doing a BLWP instruction.  I know Lee converted the floating point routines to be used in Forth on the 4A.  I know he saw speed improvement, but not sure how much.

 

The Geneve supports more ram and has more graphic features due to the 9938, but if you got very industrious, I guess you might even consider rewriting Geneve Advanced Basic to work with the FinalGrom and a SAMS card cutting out the pieces that would not be compatible with a stock TI-99/4A or TI-99/4A with F18A.

 

Just wanted to point out that you might not have to start from scratch, etc. dependent upon where your development interest lies.

 

I had hoped to get Myarc's Advanced Basic for the TI with the 512K card from him, but thus far, he hasn't found any code.  

 

Beery

 

Link to comment
Share on other sites

3 hours ago, 9640News said:

I know Lee converted the floating point routines to be used in Forth on the 4A.  I know he saw speed improvement, but not sure how much.

 

I am pretty sure those routines that are equivalent to the XMLLNK calls (see the E/A manual) are slower due to 16-bit vs. 8-bit bus. Those equivalent to GPLLNK calls (again, see the E/A manual) are almost certainly faster. I am not sure I ever checked, however.

 

...lee

  • Like 1
Link to comment
Share on other sites

On 7/13/2021 at 3:37 PM, 9640News said:

The Geneve supports more ram and has more graphic features due to the 9938, but if you got very industrious, I guess you might even consider rewriting Geneve Advanced Basic to work with the FinalGrom and a SAMS card cutting out the pieces that would not be compatible with a stock TI-99/4A or TI-99/4A with F18A.

 

It would be really great to have some of the "automatic" extra memory features of XB-II (same as A-Basic? - do not know myself) incorporated into RXB.

 

I would coordinate an honorarium for this effort...  Thanks.

MikeV.

Link to comment
Share on other sites

  • 2 weeks later...

UPDATE of RXB 2021

CALL HCHAR converted so not using GPL FMT command but now Assembly in ROM3

Ran RXB 2021 HCHAR vs Extended Basic with this test

100 OPEN #1:"CLOCK"
110 INPUT #1:A$,B$,C$
120 FOR X=1 TO 10000
130 CALL HCHAR(1,1,66,768)
140 NEXT X
150 INPUT #1:X$,Y$,Z$
160 PRINT A$,X$:B$,Y$:C$,Z$

 

RXB 2021 = 9 Minutes 4 seconds

Extended Basic = over 2 hours when I gave up waiting.

 

I think I am on to something here.

 

CALL HCHAR(5,5,65)

If a single character is used after 10,000 loop only faster by 3 seconds in RXB 2021 over Extended Basic.

So the less characters the lower the speed increase.

  • Like 4
Link to comment
Share on other sites

Ok new test of rewritten CALL HCHAR(5,5,65) much smaller version loop 10,000 times:

XB            4 minutes 48 seconds

RXB 2021  4 minutes 41 seconds

 

Finally RXB is faster then GPL even though it was 1 character as previous version was slower.

Now to try the new routine and time CALL HCHAR(1,1,65,9999) in 10,000 loops.

  • Like 1
Link to comment
Share on other sites

Test of XB and RXB: 

100 OPEN #1:"CLOCK"
110 INPUT #1:A$,B$,C$
120 FOR X=1 TO 10000
130 CALL HCHAR(1,1,66,9999)
140 NEXT X
150 INPUT #1:X$,Y$,Z$
160 PRINT A$,X$:B$,Y$:C$,Z$

 

RXB 2021     7 minutes 1 second

XB               gave up waiting after 2 hours.

  • Like 7
Link to comment
Share on other sites

Got VCHAR assembly version to work and not crash system.

Test of RXB 2021 vs XB vs TI Basic: 

100 OPEN #1:"CLOCK"
110 INPUT #1:A$,B$,C$
120 FOR X=1 TO 10000
130 CALL VCHAR(5,5,65)
140 NEXT X
150 INPUT #1:X$,Y$,Z$
160 PRINT A$,X$:B$,Y$:C$,Z$

 

TI Basic    = 11 minutes 29 seconds

XB 110     = 4   minutes 51 seconds

RXB 2021 = 4   minutes 43 seconds

 

Changed line 130 to 

130 CALL VCHAR(1,1,65,999)

 

TI BASIC   = 5 hours 4 minutes

XB 110      = 33 minutes 59 seconds

RXB 2021  = 14 minutes 5 seconds

 

 

  • Like 6
Link to comment
Share on other sites

Just finished CALL GCHAR version for RXB 2021

Test of RXB 2021 vs XB: 

100 OPEN #1:"CLOCK"
110 INPUT #1:A$,B$,C$
120 FOR X=1 TO 10000
130 CALL VCHAR(5,5,65)
140 NEXT X
150 INPUT #1:X$,Y$,Z$
160 PRINT A$,X$:B$,Y$:C$,Z$

 

XB 110      = 4 minutes 8 seconds

RXB 2021  = 4 minutes 8 seconds

(So no improvement!)

 

Change line 130 

RXB changed to CALL GCHAR(5,5,G,7,7,Y,9,9,Z)

XB changed to CALL GCHAR(5,5,G) :: CALL GCHAR(7,7,Y) :: CALL GCHAR(9,9,Z)

 

XB 110      = 10 minutes 24 seconds

RXB 2021  = 4 minutes 27 seconds

 

On 8/1/2021 at 9:34 AM, RXB said:

 

 

  • Like 3
Link to comment
Share on other sites

7 hours ago, RXB said:

Just finished CALL GCHAR version for RXB 2021

Test of RXB 2021 vs XB: 

100 OPEN #1:"CLOCK"
110 INPUT #1:A$,B$,C$
120 FOR X=1 TO 10000
130 CALL VCHAR(5,5,65)   ??????
140 NEXT X
150 INPUT #1:X$,Y$,Z$
160 PRINT A$,X$:B$,Y$:C$,Z$

 

XB 110      = 4 minutes 8 seconds

RXB 2021  = 4 minutes 8 seconds

(So no improvement!)

 

Change line 130 

RXB changed to CALL GCHAR(5,5,G,7,7,Y,9,9,Z)

XB changed to CALL GCHAR(5,5,G) :: CALL GCHAR(7,7,Y) :: CALL GCHAR(9,9,Z)

 

XB 110      = 10 minutes 24 seconds

RXB 2021  = 4 minutes 27 seconds

 

 

With all the XB overhead, It takes about .02 second just to to do a CALL and return from it. The example above loops 10000 times. XB has 3 calls per loop, while RXB has just 1. So with 20000 additional CALLs we can estimate it would take XB about 400 additional seconds, or 6.66 minutes.  This agrees well with Rich's results showing XB taking just under 6 minutes longer to run the program. .02 second doesn't sound like much, but if you can eliminate enough CALLs it can add up to a noticeable improvement.

TI BASIC takes about .05 seconds to do a CALL which is the biggest reason it is slower.

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

This week, I was re-reading Lucie Dorais's column fastxb from the Ottawa newsletter, in a couple of columns, she was laminating that more XB commands didn't allow repetitions. RXB has solved that. Rich, I was reading the docs from the contrib directory of Classic99 - does RXB require 32K - I couldn't tell from the docs.

Link to comment
Share on other sites

  • 2 weeks later...
On 8/5/2021 at 4:36 PM, dhe said:

This week, I was re-reading Lucie Dorais's column fastxb from the Ottawa newsletter, in a couple of columns, she was laminating that more XB commands didn't allow repetitions. RXB has solved that. Rich, I was reading the docs from the contrib directory of Classic99 - does RXB require 32K - I couldn't tell from the docs.

RXB 2001 to RXB 2020E all will run in console only or with 32K but I prefer using SAMS 1Meg or more.

Link to comment
Share on other sites

Just finished testing RXB 2021

CALL VPUT(row,col,string)

here is the XB program run:

100 OPEN #1:"CLOCK"
110 INPUT #1:A$,B$,C$
120 FOR X=1 TO 10000
130 DISPLAY AT(12,12):"TEST"
140 NEXT X
150 INPUT #1:X$,Y$,Z$
160 PRINT A$,X$:B$,Y$:C$,Z$

 

Here is the RXB 2020 and RXB 2021 program run:

100 OPEN #1:"CLOCK"
110 INPUT #1:A$,B$,C$
120 FOR X=1 TO 10000
130 CALL HPUT(12,12,"TEST")
140 NEXT X
150 INPUT #1:X$,Y$,Z$
160 PRINT A$,X$:B$,Y$:C$,Z$

 

Times:

XB 110      =  8 minutes  20 seconds

RXB 2020E = 6 minutes  13 seconds

RXB 2021  =  3 minutes  31 seconds

 

RXB 2021 is almost 3 times faster then XB and twice as fast as last released version of RXB.

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