Page 1 of 1

Proposal: virtual alpha variable?

Posted: Mon Apr 09, 2018 5:27 pm
by Krauts In Space
I'd like to have a virtual variable for the alpha register.
STO "ALPHA" (or A-REG or A-MAT or ...) generates a 8x1 matrix named ALPHA (or ...) and saves the alpha register there.
RCL "ALPHA" (...) recalls the ALPHA matrix into the alpha register.

Re: Proposal: virtual alpha variable?

Posted: Mon Apr 09, 2018 6:24 pm
by keithdalby
It might be possible to write a little routine to do this yourself. I don't have time to ponder on it too much right now though, maybe tonight...

Re: Proposal: virtual alpha variable?

Posted: Mon Apr 09, 2018 9:01 pm
by Thomas Okken
How about:

LBL "ATOM"
1
ENTER
NEWMAT
EDIT
GROW
LBL 00
ASTO ST X
ASHF
ALENG
X=0?
GTO 01
R↓

GTO 00
LBL 01
R↓
EXITALL
RTN

LBL "MTOA"
EDIT
LBL 02
ARCL ST X

FC? 77
GTO 02
EXITALL
RTN

Re: Proposal: virtual alpha variable?

Posted: Tue Apr 10, 2018 3:14 am
by Bill (Smithville NJ)
Question - Do you just wish to store the contents of the ALPHA register for future restore? If so, the the two following routines will do that:

Code: Select all

00 { 37-Byte Prgm }
01▸LBL "STOA"
02 1
03 ALENG
04 NEWMAT
05 EDIT
06▸LBL 00
07 ATOX
08 →
09 FC? 76
10 GTO 00
11 EXITALL
12 STO "ALPHA"
13 XTOA
14 RTN
15 END

Code: Select all

00 { 18-Byte Prgm }
01▸LBL "RCLA"
02 RCL "ALPHA"
03 XTOA
04 RTN
05 END

This will store the Numeric Codes for each of the Characters in the ALPHA register. It will size the MATRIX to be the same as the length of the string in the ALPHA Register.

You could add a ROLL DOWN before exiting the routines if you don't wish to have the MATRIX in the X-Register.



Bill
Smithville, NJ

Re: Proposal: virtual alpha variable?

Posted: Tue Apr 10, 2018 7:31 am
by dlachieze
Bill (Smithville NJ) wrote:
Tue Apr 10, 2018 3:14 am
This will store the Numeric Codes for each of the Characters in the ALPHA register. It will size the MATRIX to be the same as the length of the string in the ALPHA Register.

You could add a ROLL DOWN before exiting the routines if you don't wish to have the MATRIX in the X-register.
Nicely done. However it doesn't work if the ALPHA register is empty. So here is a slightly modified version, combining your two programs and supporting an empty ALPHA register:

Code: Select all

00 { 63-Byte Prgm }
01▸LBL "STOA"
02 ASTO "ALPHA"
03 1
04 ALENG
05 X=0?
06 RTN
07 NEWMAT
08 EDIT
09▸LBL 00
10 ATOX
11 →
12 FC? 76
13 GTO 00
14 EXITALL
15 STO "ALPHA"
16 R↓
17▸LBL "RCLA"
18 CLA
19 RCL "ALPHA"
20 XTOA
21 R↓
22 END

Re: Proposal: virtual alpha variable?

Posted: Tue Apr 10, 2018 10:58 am
by Krauts In Space
Thomas, Bill, dlachzie ... thanks for your help.
Bill, I have to save the alpha register to a named matrix since your graphics string programm "messes" the stack ;)

Re: Proposal: virtual alpha variable?

Posted: Tue Apr 10, 2018 2:38 pm
by whuyse
Of course, Thomas' program will need at most a 8x1 matrix and 8 loops to store the Alpha register, and just performing XTOA on the matrix in the X-reg will append it to the Alpha register, just like Bill's. And it works for an empty Alpha Register without modification.
Werner