From 8682b7ce22bd03b72af1ccaf65a71046e5303f73 Mon Sep 17 00:00:00 2001
From: notaz <notasas@gmail.com>
Date: Fri, 20 May 2011 14:36:55 +0300
Subject: [PATCH] hexed: refactor init code a bit

---
 hexed/hexed.s    | 12 +++++++++++-
 hexed/sega_gcc.s |  9 ---------
 2 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/hexed/hexed.s b/hexed/hexed.s
index b7d9186..418ca5c 100644
--- a/hexed/hexed.s
+++ b/hexed/hexed.s
@@ -262,8 +262,18 @@ txt_exc:
 main:
 	/* make sure io port 2 is doing inputs */
 	move.b		#0,(0xa1000b).l
-	/* mask irqs during init */
+	/* make sure irqs are masked */
 	move.w		#0x2700,sr
+	/* take care of TMSS */
+	move.b		(0xa10000).l,d0
+	andi.b		#0x0f,d0
+	beq		no_tmss
+	move.l		#0x53454741,(0xa14000).l
+	/* want cart, not OS rom if cart pops in */
+	move.w		#1,(0xa14100).l
+	/* touch VDP after TMSS setup? */
+	tst.w		(0xc00004).l
+no_tmss:
 
 .if COPY_TO_EXP
 	/* copy to expansion device if magic number is set */
diff --git a/hexed/sega_gcc.s b/hexed/sega_gcc.s
index 580d496..13cb300 100644
--- a/hexed/sega_gcc.s
+++ b/hexed/sega_gcc.s
@@ -20,18 +20,9 @@
         .ascii "                         "
         .ascii "JUE             "
 
-* Check Version Number
-	move.b  (0xa10000),%d0
-	andi.b  #0x0f,%d0
-	beq     WrongVersion
-* Sega Security Code (SEGA)
-	move.l  #0x53454741,(0xa14000)
-WrongVersion:
 	moveq   #0,%d0
 	movea.l %d0,%a7
 	move    %a7,%usp
-
-	tst.w   0xC00004
 	bra     main
 
 * INT:
-- 
2.39.5