Proposal: virtual alpha variable?

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

Proposal: virtual alpha variable?

Post by Krauts In Space » Mon Apr 09, 2018 3:27 pm

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: 498
Joined: Mon Apr 24, 2017 6:38 pm

Re: Proposal: virtual alpha variable?

Post by keithdalby » Mon Apr 09, 2018 4:24 pm

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: 490
Joined: Tue May 02, 2017 3:48 pm
Location: New Jersey, USA
Contact:

Re: Proposal: virtual alpha variable?

Post by Thomas Okken » Mon Apr 09, 2018 7:01 pm

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: 26
Joined: Sat Jul 22, 2017 7:14 pm

Re: Proposal: virtual alpha variable?

Post by Bill (Smithville NJ) » Tue Apr 10, 2018 1:14 am

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: 140
Joined: Thu May 04, 2017 10:20 am
Location: France

Re: Proposal: virtual alpha variable?

Post by dlachieze » Tue Apr 10, 2018 5:31 am

Bill (Smithville NJ) wrote:
Tue Apr 10, 2018 1: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 SN: 00425

Krauts In Space
Posts: 85
Joined: Wed Jan 03, 2018 2:48 pm
Location: Nuremberg, Germany

Re: Proposal: virtual alpha variable?

Post by Krauts In Space » Tue Apr 10, 2018 8:58 am

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: 27
Joined: Thu Dec 21, 2017 12:23 pm

Re: Proposal: virtual alpha variable?

Post by whuyse » Tue Apr 10, 2018 12:38 pm

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
42S #3249S01123
DM42 #00345

Post Reply