Hi Thomas,
below is the source for two maybe useful methods, wrc2HXS and GetAndSet.
wrc2HXS creates an 'empty' HXS string of the needed size, GetAndSet is the suitable HXS access method.
Note that the wrc2HXS code actually creates a CSTR, which doesn't have any disadvantages over a HSTR,
as long as you don't attempt to edit it with non-suitable functions.
If you intend to access the HXS stream with other methods than those below,
you should make sure to change the prologue to DOHSTR, as indicated in the listing.
I made some other methods for converting between real arrays and arrays_of_BINT, but didn't print them here.
Just drop me a note if interested.
HTH
Raymond
Quote:
PS: I have only an HP-48GX.
Wise choice. Did you try SpeedUI ?
Now for the sources:
*****************************************************************************
* Modulname : wrc2HXS Create tempob HXS string from #width #rows #cols
* Modultype : Secondary/Code
* Dest.Comp. : HP48
* Language : System RPL with parts of Machine Code
* Author : Raymond Del Tondo
* Interface : #w #r# #c --> HXS|$
* Description: Just try...
* Keywords :
*
* Stack : #w #r# #c --> HXS|$
*
* Notes :
*
* THIS CODE IS COPYRIGHTED 2005 BY :
* Raymond Del Tondo of Magic48ges
*
* To Do :
*
* Version Date ED Reason
*
* 0.0 22.11.2005 RDT Start demo file
*
*****************************************************************************
TITLE wrc2HXS
*****************************************************************************
* INCLUDE FILES
*****************************************************************************
* INCLUDE D:\RPL\TL\HEADER.H
*****************************************************************************
* DEFINES
*****************************************************************************
ASSEMBLE
DBG? EQU 0
RPL
*****************************************************************************
* MISSING ENTRIES
*****************************************************************************
ASSEMBLE
=WIPEOUT EQU #0675C
RPL
*****************************************************************************
* OBJECTS
*****************************************************************************
*****************************************************************************
*
* wrc2HXS Create tempob HXS string from #width #rows #cols
*
* #w #r# #c --> HXS|$
*
*****************************************************************************
CODE
* A B C D Rn Dn P Cyc Data Stk
GOSBVL =POP2# r c
RSTK=C
GOSBVL =SAVPTR
C=RSTK ...cc
B=A A r
D=C A c
CSL A r r ..cc. c
CSL A .cc..
C=C+A A .ccrr
CSL A ccrr.
A=DAT1 A 1:@dsktop
D1=A 1:@ob1
D1=D1+ 5 1:@ob_body
A=DAT1 A w
C=C+A A ccrrw
RSTK=C w r ccrrw c * Save for later
C=B A w r r c
***************************************************************************************************************************
* CPU: A B C D Rn Dn P Cyc Data Stk
* w r r c 0:? 0
* 1:?
* 2:?
* 3:?
* 4:?
* 0:?
* 1:@ob_body
* Stk: ( *Here will be an RPL data stack content list* )
***************************************************************************************************************************
* A B C D Rn Dn P Cyc Data Stk
*
GOSBVL =MUL# ? prod_wr ? c
A=B A prod_wr prod_wr
C=D A prod_wr c
GOSBVL =MUL# prod_wrc
C=B A prod_wrc
C=C+CON A,5
GOSBVL =MAKE$N lenfield 0:@prlg 0:@data
C=RSTK ccrrw
DAT0=C A * Write wrc field
* LC(5) =DOHSTR
D0=D0+ 5 0:data+5
AD0EX @data+5 0:len
D0=D0- 10 0:len-10
C=A A @data+5
CD1EX len-10 1:@data+5
CD0EX
GOSBVL =WIPEOUT * Zero out data area
GOVLNG =GPOverWrR0Lp
ENDCODE
And here follows the GetAndSet method:
** HP-48
**
** GET: HXS #c #r TRUE --> HXS #value
** SET: HXS #c #r #value FALSE --> HXS'
**
* A B C D
CODE
ST=1 3
GOSBVL =popflag
GOC STget
GOSBVL =POP# #data
R4=A
ST=0 3
STget GOSBVL =POP2# c r
R3=A
RSTK=C
GOSBVL =SAVPTR
GOSBVL =GetStrLenStk
C=0 A
C=DAT1 1 #w
D=C A #w
D1=D1+ 3
C=DAT1 B #cc
D1=D1+ 2 * Skip wrc field
A=C A #cc
C=RSTK #cc #r
C=C-1 A #cc #r-1 #w
GOSBVL =MUL# product #w
A=R3 c
A=A+B A ((#r-1)*#cc)+c * Now we have the element slot
C=D A ((#r-1)*#cc)+c #w
A=A-1 A * Pre-decrement
GOSBVL =MUL# product #w
CD1EX
C=C+B A
CD1EX
C=D A
P=C 0
P=P-1
?ST=1 3
GOYES STget2
****************************
* Part of the PUT
****************************
A=R4
DAT1=A WP
P= 0
GOVLNG =GETPTRLOOP
****************************
* But here we need the GET
STget2 A=0 A
A=DAT1 WP
P= 0
GOVLNG =PUSH#ALOOP
ENDCODE