Post Reply 
(41) Preserve and recover stack/alpha/flags
12-25-2018, 01:16 PM
Post: #1
(41) Preserve and recover stack/alpha/flags
Works on: 41CX, DM41(L) or on a 41C/CV with an X-Func module

This little utility preserves the contents of the alpha register, the flags and the stack (X, Y, Z, T and L) by saving this in a data file in extended memory. A second utility pulls that data out of X-Mem and restores the alpha register, flags and stack to their state when the file was created.

Requires enough room in X-Mem for a 10-register file.

Register 00 and the four last registers in conventional memory are trashed by this. E.g. if SIZE? returns 100, then registers 00 and 96-99 will be overwritten.

Listing, .raw file and printable PDF with wand bar codes provided in the attached .zip archive.

Code:
LBL "PRSRV"
STO 00
CLX
SIZE?
X<> 00
XEQ 01
XEQ 01
XEQ 01
XEQ 01
XEQ 03
STO 00
CLX
10
SF 25
CRFLD
FS?C 25
GTO 02
CLX
SEEKPTA
LBL 02
X<> L
SAVEX
X<> 00
R^
SAVEX
R^
SAVEX
R^
SAVEX
R^
SAVEX
RCLFLAG
SAVEX
XEQ 04
SAVERX
RTN
LBL "RECOV"
XEQ 03
5
SEEKPTA
GETX
STOFLAG
XEQ 04
GETRX
2.996
+
CLA
LBL 05
ARCL IND X
DSE X
GTO 05
CLX
SEEKPT
GETX
X<> L
GETX
GETX
GETX
GETX
RTN
LBL 01
DSE 00
ASTO IND 00
ASHF
RTN
LBL 03
"BKSTAK"
RTN
LBL 04
SIZE?
DSE X
1.001
*
3
-
RTN


Attached File(s)
.zip  preserve-recover.zip (Size: 11.84 KB / Downloads: 9)
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)