Emu48 - Load, Save As, Save Programmatically
|
11-20-2021, 04:29 PM
Post: #2
|
|||
|
|||
RE: Emu48 - Load, Save As, Save Programmatically
(10-15-2021 09:17 PM)MNH Wrote: Is it possible to programmatically load a file into the Emu48? What about save as or save? To my knowledge this is currently not possible. Emu48 halts the (HP48) system when it does file operations because it has to read/change RAM pointers in order to prevent program execution from possibly changing the content of what is (or is going to be) on the user's stack. File loading/saving are operations on the computer side and Emu48 would have to implement new ways for the emulated system (the HP48 operating system) to interact with the computer operating system. Since the source code is available, I suppose it could be possible. One possible method would be to create a "new" opcode at the assembly language level. The emulator would trap this opcode, pause emulation and do the appropriate operations on the operating system side: use the data stack pointer to copy the appropriate bits and save it as a new file. The file names will probably have to be generically named (maybe the file name could also be timestamped and the root of the name is something set in the Emu48 settings) to keep things simple. As far as the "new" opcode is concerned, using a NOP opcode inside an "empty" code object. Code: CODE The "12345" would be a 5-bit code designating what sort of operation this is (e.g. 00001 might mean save, 00002 could be load, etc.) and could be any width; I just picked 5 arbitrarily. So Emu48 would check to see if NOP is followed by a GOTO statement that skips only 5 bits and immediately ends in a jump back to RPL. Emu48 would then execute the proper operating system functions (save, load, etc) based on the 5-bit code. These different operations would be implemented as library commands. Anyone accidentally executing these commands on a real calculator would see no harm done since all the commands would be basically no-operation commands that only Emu48 would be aware of. If you wanted to get fancy, you could even have a string on the stack be used as the file name. For example, the 5-bit value 00003 might be used for a load command using the string on the user data stack as the file name. You would have to implement this yourself, or perhaps you could contact Christoph Giesselink who currently maintains Emu48 to see if he could add this as a feature. Graph 3D | QPI | SolveSys |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
Emu48 - Load, Save As, Save Programmatically - MNH - 10-15-2021, 09:17 PM
RE: Emu48 - Load, Save As, Save Programmatically - Han - 11-20-2021 04:29 PM
RE: Emu48 - Load, Save As, Save Programmatically - MNH - 11-20-2021, 05:06 PM
|
User(s) browsing this thread: 1 Guest(s)