41-MCODE: Copying X-Mem Files
|
03-13-2014, 04:49 PM
(This post was last modified: 03-13-2014 04:56 PM by Ángel Martin.)
Post: #1
|
|||
|
|||
41-MCODE: Copying X-Mem Files
A few weeks ago Geir started a thread about copying ASCII files, which is not possible using the standard function set in the CX. Some workarounds involved using the Mass storage functions SAVEAS/GETAS, as well as a FOCAL program from Raymond.
I tried that program but failed to make it work as supposed to, probably my bad. That made me start thinking of a MCODE implementation that would copy a source file into a destination one; and not only ASCII but of any type; like-to-like. The code below shows the initial implementation - feel free to improve on it as you see fit ;-) Both files need to exist in X-Mem, but they don't have to be of the same size - which pretty much rules it out for program files, of course. Just make sure you know what you're doing... Enjoy it! 'AM PS. here's the original post: http://www.hpmuseum.org/forum/thread-260.html Code:
"To live or die by your own sword one must first learn to wield it aptly." |
|||
03-14-2014, 06:37 AM
(This post was last modified: 03-14-2014 06:39 AM by Ángel Martin.)
Post: #2
|
|||
|
|||
RE: 41-MCODE: Copying X-Mem Files
Because ASCII files are structured in Records, it's possible that the previous code messes up the destination file when both file sizes are not the same: it will copy registers until reaching the minimum of both sizes, which may leave out an EOR character for the last register.
Here's a safer version that requires both files having the same size - you can choose which one suits you better. Use it safely for all file types, like-to-like and same sizes. Code:
Cheers, 'AM PS. I tried to attach the RAMPAGE ROM image but it appears that file type isn't allowed any longer, ditto with MOD files - is that intended? "To live or die by your own sword one must first learn to wield it aptly." |
|||
03-15-2014, 09:52 AM
Post: #3
|
|||
|
|||
RE: 41-MCODE: Copying X-Mem Files
Changing a File type is a relatively trivial affair, as there's only one digit involved in the file header. Function RETPFL in the RamPage Module does exactly that.
Not because you change the type it means the file can be treated as if it was a "proper" one of that type. A useful examples is sorting MATRIX files using SORTFL (which requires DATA files), since in this case both file types have a compatible structure. Cheers, 'AM "To live or die by your own sword one must first learn to wield it aptly." |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)