Proposal: virtual alpha variable?

Discussion around the SwissMicros DM42 calculator
Post Reply
Krauts In Space
Posts: 85
Joined: Wed Jan 03, 2018 3:48 pm
Location: Nuremberg, Germany

Proposal: virtual alpha variable?

Post 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.
DM15L S/# 10584 FW v25
DM42 S/# 01015 FW v3.5
keithdalby
Posts: 564
Joined: Mon Apr 24, 2017 8:38 pm

Re: Proposal: virtual alpha variable?

Post 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...
Thomas Okken
Posts: 1101
Joined: Tue May 02, 2017 5:48 pm
Location: Netherlands
Contact:

Re: Proposal: virtual alpha variable?

Post 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
Bill (Smithville NJ)
Posts: 34
Joined: Sat Jul 22, 2017 9:14 pm

Re: Proposal: virtual alpha variable?

Post 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
dlachieze
Posts: 613
Joined: Thu May 04, 2017 12:20 pm
Location: France

Re: Proposal: virtual alpha variable?

Post 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
DM42: 00425 - DM41X: β00066 - WP43: 00042
Krauts In Space
Posts: 85
Joined: Wed Jan 03, 2018 3:48 pm
Location: Nuremberg, Germany

Re: Proposal: virtual alpha variable?

Post 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 ;)
DM15L S/# 10584 FW v25
DM42 S/# 01015 FW v3.5
whuyse
Posts: 198
Joined: Thu Dec 21, 2017 1:23 pm

Re: Proposal: virtual alpha variable?

Post 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
41CV†,42S,48GX,49G,DM42,DM41X,17BII,15CE, DM15L
Post Reply