changeset 951:fec4a59ae5d7

Merge
author Michael Pavone <pavone@retrodev.com>
date Mon, 11 Apr 2016 20:56:54 -0700
parents 938c72a2f7a9 (diff) f87522554d7b (current diff)
children 7f4a7f07f325
files blastem.c
diffstat 4 files changed, 45 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/blastem.c	Sun Apr 10 22:22:36 2016 -0700
+++ b/blastem.c	Mon Apr 11 20:56:54 2016 -0700
@@ -1178,6 +1178,9 @@
 	start_genesis(genesis, menu ? NULL : statefile, menu == debug_target ? debuggerfun : NULL);
 	for(;;)
 	{
+		if (genesis->should_exit) {
+			break;
+		}
 		if (menu && menu_context->next_rom) {
 			if (game_context) {
 				if (game_context->save_type != SAVE_NONE) {
@@ -1230,8 +1233,7 @@
 			genesis->m68k->options->address_log = address_log;
 			map_all_bindings(genesis->ports);
 			start_genesis(genesis, statefile, menu == debug_target ? debuggerfun : NULL);
-		}
-		else if (menu && game_context) {
+		} else if (menu && game_context) {
 			genesis->arena = set_current_arena(game_context->arena);
 			genesis = game_context;
 			cart = genesis->cart;
--- a/blastem.h	Sun Apr 10 22:22:36 2016 -0700
+++ b/blastem.h	Mon Apr 11 20:56:54 2016 -0700
@@ -43,6 +43,7 @@
 	uint8_t        save_type;
 	io_port        ports[3];
 	uint8_t        bus_busy;
+	uint8_t        should_exit;
 	eeprom_state   eeprom;
 } genesis_context;
 
--- a/menu.c	Sun Apr 10 22:22:36 2016 -0700
+++ b/menu.c	Mon Apr 11 20:56:54 2016 -0700
@@ -190,6 +190,11 @@
 			gen->next_rom = alloc_concat_m(3, pieces);
 			m68k->should_return = 1;
 			break;
+		case 3: {
+			m68k->should_return = 1;
+			gen->should_exit = 1;
+			break;
+		}
 		}
 		default:
 			fprintf(stderr, "WARNING: write to undefined menu port %X\n", address);
--- a/menu.s68	Sun Apr 10 22:22:36 2016 -0700
+++ b/menu.s68	Mon Apr 11 20:56:54 2016 -0700
@@ -348,7 +348,9 @@
 	;regular file
 	lea menu_port+8, a3
 	move.l a2, (a3)
-	rts
+	
+	addq #6, a7
+	bra show_pause_menu
 .select_menu_button:
 	movea.l menu_functions.w, a2
 	move.l (0, a2, d0.w), a2
@@ -781,6 +783,17 @@
 	bsr draw_menu
 	bra gamepad_setup
 	
+show_pause_menu:
+	bsr clear_screen
+	;init vertical scroll RAM
+	vdpaccess $0, VDP_VSRAM_WRITE
+	move.w #-4, (a0)
+	move.w #0, (a0)
+	moveq #8, d6
+	move.l #pause_menu_func, menu_functions.w
+	lea pause_menu(pc), a5
+	bsr draw_menu
+	bra gamepad_setup
 	
 menu_start:
 	;init vertical scroll RAM
@@ -913,9 +926,21 @@
 	bra .wait
 	
 exit:
-	;TODO: implement me
+	move.w #1, menu_port+12
 	bra exit
 	
+resume:
+	;TODO: Implement me
+	bra resume
+	
+save_state:
+	;TODO: Implement me
+	bra save_state
+	
+load_state:
+	;TODO: Implement me
+	bra save_state
+	
 about_text:
 	dc.b "BlastEm v0.4.0", 0
 	dc.b "Copyright 2011-2016 Michael Pavone", 0
@@ -1071,5 +1096,13 @@
 	dc.b "Load State", 0
 	dc.b "Exit", 0
 	dc.b 0
+	
+	align 1
+pause_menu_func
+	dc.l resume
+	dc.l menu_start
+	dc.l save_state
+	dc.l load_state
+	dc.l exit
 
 rom_end: