changeset 37:2cee29e025f9

Fix bug saving games. There was a missing table entry in the scheduling table entry fixup list. This caused save games to break when the data structures in the direct page and above were shifted around. The missing entry has been added. An additional entry was added to allow loading previously saved games where the fixup table was wrong. Finally, move the pause mode variables back into the direct page as it is no longer required that they be elsewhere.
author William Astle <lost@l-w.ca>
date Fri, 02 Jan 2015 21:16:23 -0700
parents dd3c541ae75b
children 4ed03bbd19be
files dod.s
diffstat 1 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/dod.s	Fri Jan 02 19:48:35 2015 -0700
+++ b/dod.s	Fri Jan 02 21:16:23 2015 -0700
@@ -311,8 +311,6 @@
 error_handler	rmb 2				; the installed error trap
 error_stack	rmb 2				; the stack address to use when transferring control to the error trap
 hook_irq	rmb 2				; the address of the original IRQ routine for Basic
-pausemode	rmb 1				; nonzero = game paused
-pausedispptr	rmb 2				; saved dungeon display pointer in pause
 		rmb 256-(*&255)			; align the next bit on a page boundary
 ; These are the original variables used by the system, including the direct page.
 zero		rmb 2				; initialized to $0000
@@ -439,6 +437,8 @@
 columnctr	rmb 1				; column counter/tracker for displaying inventory list
 textother	rmb 1				; nonzero means nonstandard text location
 loadsaveflag	rmb 1				; load/save flag - <0 = ZLOAD, >0 = ZSAVE, 0 = regular init
+pausemode	rmb 1				; nonzero = game paused
+pausedispptr	rmb 2				; saved dungeon display pointer in pause
 schedtabfree	rmb 2				; pointer to next free entry in the scheduling table
 readylistchg	rmb 1				; nonzero if the ready list processing should be restarted
 keybufread	rmb 1				; keyboard buffer read offset
@@ -533,7 +533,6 @@
 		lda #zero/256			; point to MSB of direct page
 		tfr a,dp			; set DP appropriately
 		setdp zero/256			; tell the assembler about DP
-		clr pausemode			; flag not in pause mode
 		ldy #LD7E8			; point to variable initialization table
 LC041		lda ,y+				; fetch number of bytes in this initializer
 		beq LC086			; brif zero - we're done
@@ -5394,7 +5393,12 @@
 		fdb 5				; type 5
 		fdb 0				; save remainder as is
 		fdb LD041			; creature movement hanlder
+		fdb 6				; type 6
 		fdb creaturetab			; save as offset into creature table
+; This one is for handling broken save game data from a previous buggy version.
+		fdb LD041			; creature movement handler
+		fdb $43d4			; bad type value
+		fdb creaturetab+$9B		; offset into creature table
 save_schedtabe	equ *				; end of table marker
 save_magic	fcc 'DoDL'			; magic number
 		fcb 1				; save game version