Advertisement

Language::Zcode::Runtime::State 0.8

OS Support:

Publisher

Update:

Download:

Description

Language: ZCode:: Runtime:: State is a Perl module to manage the backup, restore the game state, etc.. Language: ZCode:: Runtime:: State is a Perl module to manage backup, restoration, etc., the state.restoringGetter game / setter: currently being restored or not? start_machineStart implementation of the Z - machine.In the normal case (starting a new game or restart), it's as simple as calling the subroutine Z-machine whose address is stored in the header.If we are restoring from a backup file is more complicated. See "resume_execution. Z_callWrapper around Z-code calls subroutine. The main reason we need it to save / restore.In the normal case, z_call simply calls the Z-subroutine code to address arg0 with the given arguments (arg5-argn), where applicable. Args 1-4 are not used by z_call, but (hack alert!) They go to the Perl call stack, which is necessary to save state.Input Z-Machine: address of subroutine to call, local variables & eval stack (arrayref), PC next variable store, args the Z-sub.See "The call stack" for more details on this sub and save / restore.save_stateImplement the opcode @ save, save-Z machine current state (as opposed to writing a table to a file, the other using the @ save opcode) Note that this also gets called in at the very end of the process. Returns 0 for re not record, 1 for successfully register, 2 for "just finished restoring. build_save_stackCreate a Z-machine call stack by taking a look at the call of stack.When calling Perl subroutines Z_machine we call z_call with all information contained in a Z stack frame. We retrieve this information to call the Perl stack and build a Z-machine call stack with opcode le@it.restore_stateImplement restore, restoration of the Z-machine state Current (as opposed to reading a table from a file, the other using @ restore opcode)