Hello Podalirius,
I was able to successfully backup/restored HRAM 16K set to/from HP-IL mass storage media.
PowerCL (PWRL) module functions WRTPG/READPG works beautifully for that job. (thank you Ángel)
Unfortunately HEPAX module functions WRTROM/READROM are no so willing, these functions are modifying the image content rendering them useless for our purpose.
Look at step 9 (backup) and step 12 (restore) for your answer.
The only part missing from the initial request is the backup/restore of the MMU configuration sets.
That will have to wait a bit, I have a test job to finish for Monte before being able to address this final part.
Best regards,
Sylvain
PS: The following steps shows the process I went thru to validate the HRAM backup/restore and its integrity.
- Basic configuration
- Copy HRAM Templates
- Map ROM & HRAM to 41OS space
- Initialize HRAM-1 (HRAM set #1)
- Copy empty HRAM-1 to HRAM-2 (41CL RAM-to-RAM copy, HRAM set #2)
- Enter FOCAL HRAM data test program
- Load data into HRAM-1
- Setup HP-IL with a mass storage device
- Backup HRAM-1 to an HP-IL mass storage media using PowerCL module WRTPG function
- Backup HRAM-1 to an HP-IL mass storage media using HEPAX module WRTROM function
- Copy empty HRAM-2 to HRAM-1 (erasing HRAM-1 content)
- Restore HP-IL mass storage media data to HRAM-1 using PowerCL module READPG function
- Validating HRAM-1 data integrity
- Copy empty HRAM-2 to HRAM-1 (erasing HRAM-1 content)
- Restore HP-IL mass storage media data to HRAM-1 using HEPAX module READROM function (failed)
- Cleanup
Warning: HP-IL interface must not be plugged-in at the beginning of this procedure.
01) Basic configuration
Code:
MMUDIS // disable MMU, will lockup the calculator if HP-IL module is plugged-in
MMUCLR // clear MMU configuration Set 0
"YFNX" PLUG1U // plug YFNX module to page 9
MMUEN // enable MMU
CLKEYS // clear user defined keys in order to not interfere with program local labels below
02) Copy HRAM Templates to 4 consecutive RAM pages (0x838 to 0x83B) and for this example name it HRAM-1
Code:
"0B9>838" YMCPY // copy HEPAX RAM template 0x0B9 to 41CL RAM page 0x838
"0B9>839" YMCPY // copy HEPAX RAM template 0x0B9 to 41CL RAM page 0x839
"0B9>83A" YMCPY // copy HEPAX RAM template 0x0B9 to 41CL RAM page 0x83A
"0B9>83B" YMCPY // copy HEPAX RAM template 0x0B9 to 41CL RAM page 0x83B
03) Map ROM and HRAM to 41OS space
Code:
"4LIB 4" PPLUG // plug 4LIB ROM to page 0x4
"OSX3 8" PPLUG // plug OSX3 module to page 0x8
"PWRL A" PPLUG // plug PWRL module to page 0xA
"%838 C" PPLUG // plug 0x838..0x83B HePaX RAM area to pages 0xC..0xF
"HEP2 B" PPLUG // mapping HePaX ROM to page 0xB
04) Initialize HRAM using HEPINI from PowerCL module (named HRAM-1 in this session)
Code:
HEPINI 4 C // initialize HEPAX RAM 4 pages starting at page 0xC
HEPROOM // should return 2610 in X
05) Copy empty HRAM-1 pages (0x838 to 0x83B) to HRAM-2 pages (0x83C to 0x83F)
Code:
"838>83C" YMCPY // copy empty HEPAX RAM at page 0x838 to page 0x83C
"839>83D" YMCPY // copy empty HEPAX RAM at page 0x839 to page 0x83D
"83A>83E" YMCPY // copy empty HEPAX RAM at page 0x83A to page 0x83E
"83B>83F" YMCPY // copy empty HEPAX RAM at page 0x83B to page 0x83F
06) Enter FOCAL HRAM data test program
Local labels
Code:
LBL A : create HEPAX data test file filled up with data (run time: ~ 2m36s in TURBO 50 mode)
LBL C : validate HEPAX data test file (run time: ~ 2m30s in TURBO 50 mode)
LBL E : delete HEPAX data test file (run time: negligible)
Program listing (press "View a Printable Version" at the bottom of the web page to get a more readable version)
Code:
LBL "HRAMTD" // HRAM content initialisation & validation
SF 27 // activate USER mode
GTO 00
// ---------------------------------------------------------------------------
LBL 99 // infinite loop
PROMPT
LBL 00 // show menu
"C V D" // Create, Validate & Delete assigned to letters A, C & E (aka local labels)
GTO 99
// ---------------------------------------------------------------------------
LBL A // create HEPAX data file
XEQ 90 // start timer
CF 25 // activate duplicate file error or not enough memory error
"TD"
2400
HCRFLD // create HEPAX data file => name: "TD" size: 2400 registers
RDN // manage stack
0 // init counter
SF 25 // ignore end of data file error
LBL 01 // set data loop
1
+ // increment counter
HSAVEX // save X in HEPAX data file
FS? 25 // have we reached end of data file ?
GTO 01 // nop!
1 // yes, adjust counter
- // number of records (should be 2400)
XEQ 91 // stop timer, expected running time ~ 2m36s in TURBO 50 mode
X<>Y // swap run time with number of records
"TD CREATED"
AVIEW
BEEP // warn user HEPAX data file has been created and initialized
GTO 99 // X = number of records and Y = running time
// ---------------------------------------------------------------------------
LBL C // validate HEPAX data file
XEQ 90 // start timer
CF 25 // activate file not found error
"TD"
0
HSEKPTA // set HEPAX data pointer to the beginning of the file
SF 25 // ignore end of data file error
LBL 02
HGETX // get in X current HEPAD data record and increment data pointer
FS? 25 // have we reached end of file
+ // no, do the calculation
FS? 25 // have we reached end of file
GTO 02 // loop for more records
XEQ 91 // stop timer, expected running time ~ 2m30s in TURBO 50 mode
X<>Y // swap run time with magic number
2881200 // result of the sum of all values
- // if X = 0 then the data was valid otherwise it is not
X=0?
"TD VALID"
X#0?
"TD INVALID"
AVIEW
BEEP // warn user HEPAX data file has been validated successfully or not
GTO 99 // X = substraction with magic number result and Y = running time
// ---------------------------------------------------------------------------
LBL E // erase HEPAX data file
SF 25 // ignore file not found error
"TD"
HPURFL // delete HEPAX data file => name: "TD"
FC?C 25 // was file found ?
GTO 99 // no, leave, stack unchanged
"TD PURGED" // yes, warn user
AVIEW
BEEP // warn user HEPAX data file has been deleted
GTO 99 // stack unchanged
// ---------------------------------------------------------------------------
LBL 90 // start timer
STOPSW
0
SETSW
RDN
RUNSW
RTN
// ---------------------------------------------------------------------------
LBL 91 // stop timer
STOPSW
RCLSW
END // return running time
07) Load data into HRAM-1
Code:
XEQ "HRAMTD" // execute test program, display: "C V D"
press "A" // execute local label A, [C]reate HEPAX data test file filled up with data
// display "TD CREATED" if successfull (run time: ~ 2m36s in TURBO 50 mode)
HEPDIR // should display: "TD DA 2400"
press "C" // execute local label C, [V]alidate HEPAX data test file
// display "TD VALID" if successfull (run time: ~ 2m30s in TURBO 50 mode)
08) Setup HP-IL with a mass storage device
Code:
OFF // put calculator in sleep mode
// insert the HP-IL module,
// plug your PIL-Box, start an HP-IL Peripheral simulator (ILPER or pyILPER) and configure a virtual mass storage device
// or plug a physical mass storage device (82161A, 9114A/B, etc)
ON // wake up the calculator
CAT 0 // OSX3 enhanced catalog 0 list HP-IL devices AID on the loop
// the catalog list must include a valid mass storage AID ("AID 16", "HP9114B", etc)
NEWM 128 // format mass storage media and allow space for 128 files
09) Backup HRAM-1 to an HP-IL mass storage media using PowerCL module WRTPG function
Code:
"PHR1C" 12 WRTPG // write page 12 (0xC) to file "PHR1C" on mass storage media (PowerCL HRAM #1 Page C)
"PHR1D" 13 WRTPG // write page 13 (0xD) to file "PHR1D" on mass storage media (PowerCL HRAM #1 Page D)
"PHR1E" 14 WRTPG // write page 14 (0xE) to file "PHR1E" on mass storage media (PowerCL HRAM #1 Page E)
"PHR1F" 15 WRTPG // write page 15 (0xF) to file "PHR1F" on mass storage media (PowerCL HRAM #1 Page F)
DIR // should display
// NAME TYPE REGS
// PHR1C ??,S 640
// PHR1D ??,S 640
// PHR1E ??,S 640
// PHR1F ??,S 640
10) Backup HRAM-1 to an HP-IL mass storage media using HEPAX module WRTROM function
Code:
"HHR1"
12.15
WRTROM // write page 12 to 15 (0xC to 0xF) to file "HHR1" on mass storage media
DIR // should display
// NAME TYPE REGS
// PHR1C ??,S 640
// PHR1D ??,S 640
// PHR1E ??,S 640
// PHR1F ??,S 640
// HHR1 DA 2560
11) Copy empty HRAM-2 pages (0x83C to 0x83F) to HRAM-1 pages (0x838 to 0x83B) (erasing HRAM-1 content)
Code:
"83C>838" YMCPY // copy empty HEPAX RAM at page 0x83C to page 0x838
"83D>839" YMCPY // copy empty HEPAX RAM at page 0x83D to page 0x839
"83E>83A" YMCPY // copy empty HEPAX RAM at page 0x83E to page 0x83A
"83F>83B" YMCPY // copy empty HEPAX RAM at page 0x83F to page 0x83B
HEPROOM // should return 2610 in X
12) Restore HP-IL mass storage media data to HRAM-1 using PowerCL module READPG function
Code:
"PHR1C" 12 READPG // read file "PHR1C" from mass storage media to page 12 (0xC)
"PHR1D" 13 READPG // read file "PHR1D" from mass storage media to page 13 (0xD)
"PHR1E" 14 READPG // read file "PHR1E" from mass storage media to page 14 (0xE)
"PHR1F" 15 READPG // read file "PHR1F" from mass storage media to page 15 (0xF)
13) Validating data integrity
Code:
HEPDIR // should display: "TD DA 2400"
XEQ "HRAMTD" // execute test program, display: "C V D"
press "C" // execute local label C, [V]alidate HEPAX data test file
// display "TD VALID" if successfull (run time: ~ 2m30s in TURBO 50 mode)
14) Copy empty HRAM-2 pages (0x83C to 0x83F) to HRAM-1 pages (0x838 to 0x83B) (erasing HRAM-1 content)
Code:
"83C>838" YMCPY // copy empty HEPAX RAM at page 0x83C to page 0x838
"83D>839" YMCPY // copy empty HEPAX RAM at page 0x83D to page 0x839
"83E>83A" YMCPY // copy empty HEPAX RAM at page 0x83E to page 0x83A
"83F>83B" YMCPY // copy empty HEPAX RAM at page 0x83F to page 0x83B
HEPROOM // should return 2610 in X
15) Restore HP-IL mass storage media data to HRAM-1 using HEPAX module READROM function (failed)
Code:
"HHR1"
12.15
READROM // read file "HHR1" from mass storage media and save it to pages 12 to 15 (0xC to 0xF)
// unfortunately we get the message "H:CHKSUM ERR" at the end of the file retrieval
// meaning WRTROM and/or READROM functions are modifying the ROM images
HEPDIR // is giving us: "H:NO FILESYS"
Note: I will investigate later who from WRTROM or READROM is modifying the image
16) Cleanup
Code:
OFF // put calculator in sleep mode
// unplug HP-IL module
ON // wake up the calculator
MMUDIS // disable MMU, will lockup the calculator if HP-IL module is plugged-in
MMUCLR // clear MMU configuration set 0
CLP "HRAMTD" // delete HRAM test program
edit: typo