Added struct for save game
authorLukas Krickl <lukas@krickl.dev>
Fri, 27 Dec 2024 09:23:31 +0000 (10:23 +0100)
committerLukas Krickl <lukas@krickl.dev>
Fri, 27 Dec 2024 09:23:31 +0000 (10:23 +0100)
src/sram.s
src/wram.s

index b0edd899a625cfbe292904a27c19125121916796..f4e62ead607fc377cb4c15545631aaf3f73267f4 100644 (file)
   ; flag for init of sram
 sram_magic: .adv 1
 
-  ; checksum of save game
-  ; this is simply all bytes in the save game added 
-save_game1_chksm: .adv 1
-
-  ; saving rng seed
-save_game1_seed: .adv 1
-  ; saving all rooms
-save_game1_rooms: .adv ROOM_SIZE_TOTAL * ROOMS_TOTAL
-  ; saving player state
-save_game1_player: .adv player_size
-
-  ; this is a canary value to detect out of bounds reads in sram
-  ; if this value is not SRAM_MAGIC then the save game is corrupted
-save_game1_overflow_canary: .adv 1
+save_game1: .adv save_game_size
index 3db3cd8550caaf433b670768ed4b2c87a5a616e5..68f691804062561a33f8c4d20eb1f325f6ce1a30 100644 (file)
@@ -142,6 +142,22 @@ curr_room_exits: .adv 2
   ; room_struct, tiles, flags, actor_table, exit_table
 #define ROOM_SIZE_TOTAL room_size + ROOM_TILES_SIZE + ROOM_FLAGS_SIZE + ACTOR_TABLE_SIZE + ROOM_EXIT_TABLE_SIZE 
 
+  ; save game struct 
+.se 0
+  ; checksum of save game
+  ; this is simply all bytes in the save game added 
+.de save_game_chksm, 1
+  ; saving rng seed
+.de save_game_seed, 1
+  ; saving all rooms
+.de save_game_rooms, ROOM_SIZE_TOTAL * ROOMS_TOTAL
+  ; saving player state
+.de save_game_player, player_size
+  ; this is a canary value to detect out of bounds reads in sram
+  ; if this value is not SRAM_MAGIC then the save game is corrupted
+.de save_game_canary, 1
+.de save_game_size, 0
+
   ; drawing related flags
 
   ; UI flags