revision 2:42349f6ea216
summary |
tree |
shortlog |
changelog |
graph |
changeset |
raw | bz2 | zip | gz changeset | 2:42349f6ea216 |
parent | 1:eea311cfd33e |
child | 3:999d7586a739 |
author | nkeynes |
date | Sat Aug 21 06:15:49 2004 +0000 (19 years ago) |
Commit changes into cvs
1.1 --- a/src/Makefile.am Sat Mar 13 00:03:32 2004 +00001.2 +++ b/src/Makefile.am Sat Aug 21 06:15:49 2004 +00001.3 @@ -13,11 +13,15 @@1.4 support.c support.h \1.5 interface.c interface.h \1.6 callbacks.c callbacks.h \1.7 - gui.c gui.h gui_mmr.c \1.8 - asic.c asic.h pvr2.c pvr2.h \1.9 - video.c machine.c aica.c aica.h\1.10 + gui.c gui.h mmr_win.c debug_win.c dump_win.c \1.11 + asic.c asic.h pvr2.c pvr2.h ide.c ide.h \1.12 + video.c dreamcast.c dreamcast.h aica.c aica.h\1.13 + maple.c maple.h maple/controller.c maple/controller.h \1.14 + sh4/intc.c sh4/intc.h sh4/mem.c sh4/mem.h sh4/mmio.h \1.15 + sh4/sh4core.c sh4/sh4core.h sh4/sh4dasm.c sh4/sh4dasm.h \1.16 + sh4/sh4mmio.c sh4/sh4mmio.h sh4/watch.c \1.17 fileio.c ipbin.c1.19 -dream_LDADD = @PACKAGE_LIBS@ $(INTLLIBS) sh4/libsh4.a1.20 +dream_LDADD = @PACKAGE_LIBS@ $(INTLLIBS)1.22 AM_CFLAGS = -D_ISOC99_SOURCE -D_BSD_SOURCE
2.1 --- a/src/Makefile.in Sat Mar 13 00:03:32 2004 +00002.2 +++ b/src/Makefile.in Sat Aug 21 06:15:49 2004 +00002.3 @@ -140,13 +140,17 @@2.4 support.c support.h \2.5 interface.c interface.h \2.6 callbacks.c callbacks.h \2.7 - gui.c gui.h gui_mmr.c \2.8 - asic.c asic.h pvr2.c pvr2.h \2.9 - video.c machine.c aica.c aica.h\2.10 + gui.c gui.h mmr_win.c debug_win.c dump_win.c \2.11 + asic.c asic.h pvr2.c pvr2.h ide.c ide.h \2.12 + video.c dreamcast.c dreamcast.h aica.c aica.h\2.13 + maple.c maple.h maple/controller.c maple/controller.h \2.14 + sh4/intc.c sh4/intc.h sh4/mem.c sh4/mem.h sh4/mmio.h \2.15 + sh4/sh4core.c sh4/sh4core.h sh4/sh4dasm.c sh4/sh4dasm.h \2.16 + sh4/sh4mmio.c sh4/sh4mmio.h sh4/watch.c \2.17 fileio.c ipbin.c2.20 -dream_LDADD = @PACKAGE_LIBS@ $(INTLLIBS) sh4/libsh4.a2.21 +dream_LDADD = @PACKAGE_LIBS@ $(INTLLIBS)2.23 AM_CFLAGS = -D_ISOC99_SOURCE -D_BSD_SOURCE2.24 subdir = src2.25 @@ -158,23 +162,32 @@2.26 PROGRAMS = $(bin_PROGRAMS)2.28 am_dream_OBJECTS = main.$(OBJEXT) support.$(OBJEXT) interface.$(OBJEXT) \2.29 - callbacks.$(OBJEXT) gui.$(OBJEXT) gui_mmr.$(OBJEXT) \2.30 - asic.$(OBJEXT) pvr2.$(OBJEXT) video.$(OBJEXT) machine.$(OBJEXT) \2.31 - aica.$(OBJEXT) fileio.$(OBJEXT) ipbin.$(OBJEXT)2.32 + callbacks.$(OBJEXT) gui.$(OBJEXT) mmr_win.$(OBJEXT) \2.33 + debug_win.$(OBJEXT) dump_win.$(OBJEXT) asic.$(OBJEXT) \2.34 + pvr2.$(OBJEXT) ide.$(OBJEXT) video.$(OBJEXT) \2.35 + dreamcast.$(OBJEXT) aica.$(OBJEXT) maple.$(OBJEXT) \2.36 + controller.$(OBJEXT) intc.$(OBJEXT) mem.$(OBJEXT) \2.37 + sh4core.$(OBJEXT) sh4dasm.$(OBJEXT) sh4mmio.$(OBJEXT) \2.38 + watch.$(OBJEXT) fileio.$(OBJEXT) ipbin.$(OBJEXT)2.39 dream_OBJECTS = $(am_dream_OBJECTS)2.40 -dream_DEPENDENCIES = sh4/libsh4.a2.41 +dream_DEPENDENCIES =2.42 dream_LDFLAGS =2.44 DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)2.45 depcomp = $(SHELL) $(top_srcdir)/depcomp2.46 am__depfiles_maybe = depfiles2.47 @AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/aica.Po ./$(DEPDIR)/asic.Po \2.48 -@AMDEP_TRUE@ ./$(DEPDIR)/callbacks.Po ./$(DEPDIR)/fileio.Po \2.49 -@AMDEP_TRUE@ ./$(DEPDIR)/gui.Po ./$(DEPDIR)/gui_mmr.Po \2.50 -@AMDEP_TRUE@ ./$(DEPDIR)/interface.Po ./$(DEPDIR)/ipbin.Po \2.51 -@AMDEP_TRUE@ ./$(DEPDIR)/machine.Po ./$(DEPDIR)/main.Po \2.52 -@AMDEP_TRUE@ ./$(DEPDIR)/pvr2.Po ./$(DEPDIR)/support.Po \2.53 -@AMDEP_TRUE@ ./$(DEPDIR)/video.Po2.54 +@AMDEP_TRUE@ ./$(DEPDIR)/callbacks.Po ./$(DEPDIR)/controller.Po \2.55 +@AMDEP_TRUE@ ./$(DEPDIR)/debug_win.Po ./$(DEPDIR)/dreamcast.Po \2.56 +@AMDEP_TRUE@ ./$(DEPDIR)/dump_win.Po ./$(DEPDIR)/fileio.Po \2.57 +@AMDEP_TRUE@ ./$(DEPDIR)/gui.Po ./$(DEPDIR)/ide.Po \2.58 +@AMDEP_TRUE@ ./$(DEPDIR)/intc.Po ./$(DEPDIR)/interface.Po \2.59 +@AMDEP_TRUE@ ./$(DEPDIR)/ipbin.Po ./$(DEPDIR)/main.Po \2.60 +@AMDEP_TRUE@ ./$(DEPDIR)/maple.Po ./$(DEPDIR)/mem.Po \2.61 +@AMDEP_TRUE@ ./$(DEPDIR)/mmr_win.Po ./$(DEPDIR)/pvr2.Po \2.62 +@AMDEP_TRUE@ ./$(DEPDIR)/sh4core.Po ./$(DEPDIR)/sh4dasm.Po \2.63 +@AMDEP_TRUE@ ./$(DEPDIR)/sh4mmio.Po ./$(DEPDIR)/support.Po \2.64 +@AMDEP_TRUE@ ./$(DEPDIR)/video.Po ./$(DEPDIR)/watch.Po2.65 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \2.66 $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)2.67 CCLD = $(CC)2.68 @@ -229,16 +242,27 @@2.69 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/aica.Po@am__quote@2.70 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/asic.Po@am__quote@2.71 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/callbacks.Po@am__quote@2.72 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/controller.Po@am__quote@2.73 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/debug_win.Po@am__quote@2.74 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dreamcast.Po@am__quote@2.75 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dump_win.Po@am__quote@2.76 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fileio.Po@am__quote@2.77 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gui.Po@am__quote@2.78 -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gui_mmr.Po@am__quote@2.79 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ide.Po@am__quote@2.80 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/intc.Po@am__quote@2.81 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/interface.Po@am__quote@2.82 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ipbin.Po@am__quote@2.83 -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/machine.Po@am__quote@2.84 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@2.85 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/maple.Po@am__quote@2.86 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mem.Po@am__quote@2.87 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mmr_win.Po@am__quote@2.88 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pvr2.Po@am__quote@2.89 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sh4core.Po@am__quote@2.90 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sh4dasm.Po@am__quote@2.91 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sh4mmio.Po@am__quote@2.92 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/support.Po@am__quote@2.93 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/video.Po@am__quote@2.94 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/watch.Po@am__quote@2.96 .c.o:2.97 @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \2.98 @@ -261,6 +285,160 @@2.99 @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@2.100 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@2.101 @am__fastdepCC_FALSE@ $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`2.102 +2.103 +controller.o: maple/controller.c2.104 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT controller.o -MD -MP -MF "$(DEPDIR)/controller.Tpo" \2.105 +@am__fastdepCC_TRUE@ -c -o controller.o `test -f 'maple/controller.c' || echo '$(srcdir)/'`maple/controller.c; \2.106 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/controller.Tpo" "$(DEPDIR)/controller.Po"; \2.107 +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/controller.Tpo"; exit 1; \2.108 +@am__fastdepCC_TRUE@ fi2.109 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='maple/controller.c' object='controller.o' libtool=no @AMDEPBACKSLASH@2.110 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/controller.Po' tmpdepfile='$(DEPDIR)/controller.TPo' @AMDEPBACKSLASH@2.111 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@2.112 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o controller.o `test -f 'maple/controller.c' || echo '$(srcdir)/'`maple/controller.c2.113 +2.114 +controller.obj: maple/controller.c2.115 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT controller.obj -MD -MP -MF "$(DEPDIR)/controller.Tpo" \2.116 +@am__fastdepCC_TRUE@ -c -o controller.obj `if test -f 'maple/controller.c'; then $(CYGPATH_W) 'maple/controller.c'; else $(CYGPATH_W) '$(srcdir)/maple/controller.c'; fi`; \2.117 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/controller.Tpo" "$(DEPDIR)/controller.Po"; \2.118 +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/controller.Tpo"; exit 1; \2.119 +@am__fastdepCC_TRUE@ fi2.120 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='maple/controller.c' object='controller.obj' libtool=no @AMDEPBACKSLASH@2.121 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/controller.Po' tmpdepfile='$(DEPDIR)/controller.TPo' @AMDEPBACKSLASH@2.122 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@2.123 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o controller.obj `if test -f 'maple/controller.c'; then $(CYGPATH_W) 'maple/controller.c'; else $(CYGPATH_W) '$(srcdir)/maple/controller.c'; fi`2.124 +2.125 +intc.o: sh4/intc.c2.126 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT intc.o -MD -MP -MF "$(DEPDIR)/intc.Tpo" \2.127 +@am__fastdepCC_TRUE@ -c -o intc.o `test -f 'sh4/intc.c' || echo '$(srcdir)/'`sh4/intc.c; \2.128 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/intc.Tpo" "$(DEPDIR)/intc.Po"; \2.129 +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/intc.Tpo"; exit 1; \2.130 +@am__fastdepCC_TRUE@ fi2.131 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sh4/intc.c' object='intc.o' libtool=no @AMDEPBACKSLASH@2.132 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/intc.Po' tmpdepfile='$(DEPDIR)/intc.TPo' @AMDEPBACKSLASH@2.133 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@2.134 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o intc.o `test -f 'sh4/intc.c' || echo '$(srcdir)/'`sh4/intc.c2.135 +2.136 +intc.obj: sh4/intc.c2.137 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT intc.obj -MD -MP -MF "$(DEPDIR)/intc.Tpo" \2.138 +@am__fastdepCC_TRUE@ -c -o intc.obj `if test -f 'sh4/intc.c'; then $(CYGPATH_W) 'sh4/intc.c'; else $(CYGPATH_W) '$(srcdir)/sh4/intc.c'; fi`; \2.139 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/intc.Tpo" "$(DEPDIR)/intc.Po"; \2.140 +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/intc.Tpo"; exit 1; \2.141 +@am__fastdepCC_TRUE@ fi2.142 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sh4/intc.c' object='intc.obj' libtool=no @AMDEPBACKSLASH@2.143 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/intc.Po' tmpdepfile='$(DEPDIR)/intc.TPo' @AMDEPBACKSLASH@2.144 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@2.145 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o intc.obj `if test -f 'sh4/intc.c'; then $(CYGPATH_W) 'sh4/intc.c'; else $(CYGPATH_W) '$(srcdir)/sh4/intc.c'; fi`2.146 +2.147 +mem.o: sh4/mem.c2.148 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT mem.o -MD -MP -MF "$(DEPDIR)/mem.Tpo" \2.149 +@am__fastdepCC_TRUE@ -c -o mem.o `test -f 'sh4/mem.c' || echo '$(srcdir)/'`sh4/mem.c; \2.150 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/mem.Tpo" "$(DEPDIR)/mem.Po"; \2.151 +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/mem.Tpo"; exit 1; \2.152 +@am__fastdepCC_TRUE@ fi2.153 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sh4/mem.c' object='mem.o' libtool=no @AMDEPBACKSLASH@2.154 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/mem.Po' tmpdepfile='$(DEPDIR)/mem.TPo' @AMDEPBACKSLASH@2.155 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@2.156 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o mem.o `test -f 'sh4/mem.c' || echo '$(srcdir)/'`sh4/mem.c2.157 +2.158 +mem.obj: sh4/mem.c2.159 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT mem.obj -MD -MP -MF "$(DEPDIR)/mem.Tpo" \2.160 +@am__fastdepCC_TRUE@ -c -o mem.obj `if test -f 'sh4/mem.c'; then $(CYGPATH_W) 'sh4/mem.c'; else $(CYGPATH_W) '$(srcdir)/sh4/mem.c'; fi`; \2.161 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/mem.Tpo" "$(DEPDIR)/mem.Po"; \2.162 +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/mem.Tpo"; exit 1; \2.163 +@am__fastdepCC_TRUE@ fi2.164 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sh4/mem.c' object='mem.obj' libtool=no @AMDEPBACKSLASH@2.165 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/mem.Po' tmpdepfile='$(DEPDIR)/mem.TPo' @AMDEPBACKSLASH@2.166 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@2.167 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o mem.obj `if test -f 'sh4/mem.c'; then $(CYGPATH_W) 'sh4/mem.c'; else $(CYGPATH_W) '$(srcdir)/sh4/mem.c'; fi`2.168 +2.169 +sh4core.o: sh4/sh4core.c2.170 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT sh4core.o -MD -MP -MF "$(DEPDIR)/sh4core.Tpo" \2.171 +@am__fastdepCC_TRUE@ -c -o sh4core.o `test -f 'sh4/sh4core.c' || echo '$(srcdir)/'`sh4/sh4core.c; \2.172 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/sh4core.Tpo" "$(DEPDIR)/sh4core.Po"; \2.173 +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/sh4core.Tpo"; exit 1; \2.174 +@am__fastdepCC_TRUE@ fi2.175 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sh4/sh4core.c' object='sh4core.o' libtool=no @AMDEPBACKSLASH@2.176 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/sh4core.Po' tmpdepfile='$(DEPDIR)/sh4core.TPo' @AMDEPBACKSLASH@2.177 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@2.178 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o sh4core.o `test -f 'sh4/sh4core.c' || echo '$(srcdir)/'`sh4/sh4core.c2.179 +2.180 +sh4core.obj: sh4/sh4core.c2.181 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT sh4core.obj -MD -MP -MF "$(DEPDIR)/sh4core.Tpo" \2.182 +@am__fastdepCC_TRUE@ -c -o sh4core.obj `if test -f 'sh4/sh4core.c'; then $(CYGPATH_W) 'sh4/sh4core.c'; else $(CYGPATH_W) '$(srcdir)/sh4/sh4core.c'; fi`; \2.183 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/sh4core.Tpo" "$(DEPDIR)/sh4core.Po"; \2.184 +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/sh4core.Tpo"; exit 1; \2.185 +@am__fastdepCC_TRUE@ fi2.186 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sh4/sh4core.c' object='sh4core.obj' libtool=no @AMDEPBACKSLASH@2.187 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/sh4core.Po' tmpdepfile='$(DEPDIR)/sh4core.TPo' @AMDEPBACKSLASH@2.188 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@2.189 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o sh4core.obj `if test -f 'sh4/sh4core.c'; then $(CYGPATH_W) 'sh4/sh4core.c'; else $(CYGPATH_W) '$(srcdir)/sh4/sh4core.c'; fi`2.190 +2.191 +sh4dasm.o: sh4/sh4dasm.c2.192 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT sh4dasm.o -MD -MP -MF "$(DEPDIR)/sh4dasm.Tpo" \2.193 +@am__fastdepCC_TRUE@ -c -o sh4dasm.o `test -f 'sh4/sh4dasm.c' || echo '$(srcdir)/'`sh4/sh4dasm.c; \2.194 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/sh4dasm.Tpo" "$(DEPDIR)/sh4dasm.Po"; \2.195 +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/sh4dasm.Tpo"; exit 1; \2.196 +@am__fastdepCC_TRUE@ fi2.197 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sh4/sh4dasm.c' object='sh4dasm.o' libtool=no @AMDEPBACKSLASH@2.198 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/sh4dasm.Po' tmpdepfile='$(DEPDIR)/sh4dasm.TPo' @AMDEPBACKSLASH@2.199 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@2.200 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o sh4dasm.o `test -f 'sh4/sh4dasm.c' || echo '$(srcdir)/'`sh4/sh4dasm.c2.201 +2.202 +sh4dasm.obj: sh4/sh4dasm.c2.203 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT sh4dasm.obj -MD -MP -MF "$(DEPDIR)/sh4dasm.Tpo" \2.204 +@am__fastdepCC_TRUE@ -c -o sh4dasm.obj `if test -f 'sh4/sh4dasm.c'; then $(CYGPATH_W) 'sh4/sh4dasm.c'; else $(CYGPATH_W) '$(srcdir)/sh4/sh4dasm.c'; fi`; \2.205 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/sh4dasm.Tpo" "$(DEPDIR)/sh4dasm.Po"; \2.206 +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/sh4dasm.Tpo"; exit 1; \2.207 +@am__fastdepCC_TRUE@ fi2.208 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sh4/sh4dasm.c' object='sh4dasm.obj' libtool=no @AMDEPBACKSLASH@2.209 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/sh4dasm.Po' tmpdepfile='$(DEPDIR)/sh4dasm.TPo' @AMDEPBACKSLASH@2.210 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@2.211 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o sh4dasm.obj `if test -f 'sh4/sh4dasm.c'; then $(CYGPATH_W) 'sh4/sh4dasm.c'; else $(CYGPATH_W) '$(srcdir)/sh4/sh4dasm.c'; fi`2.212 +2.213 +sh4mmio.o: sh4/sh4mmio.c2.214 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT sh4mmio.o -MD -MP -MF "$(DEPDIR)/sh4mmio.Tpo" \2.215 +@am__fastdepCC_TRUE@ -c -o sh4mmio.o `test -f 'sh4/sh4mmio.c' || echo '$(srcdir)/'`sh4/sh4mmio.c; \2.216 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/sh4mmio.Tpo" "$(DEPDIR)/sh4mmio.Po"; \2.217 +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/sh4mmio.Tpo"; exit 1; \2.218 +@am__fastdepCC_TRUE@ fi2.219 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sh4/sh4mmio.c' object='sh4mmio.o' libtool=no @AMDEPBACKSLASH@2.220 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/sh4mmio.Po' tmpdepfile='$(DEPDIR)/sh4mmio.TPo' @AMDEPBACKSLASH@2.221 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@2.222 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o sh4mmio.o `test -f 'sh4/sh4mmio.c' || echo '$(srcdir)/'`sh4/sh4mmio.c2.223 +2.224 +sh4mmio.obj: sh4/sh4mmio.c2.225 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT sh4mmio.obj -MD -MP -MF "$(DEPDIR)/sh4mmio.Tpo" \2.226 +@am__fastdepCC_TRUE@ -c -o sh4mmio.obj `if test -f 'sh4/sh4mmio.c'; then $(CYGPATH_W) 'sh4/sh4mmio.c'; else $(CYGPATH_W) '$(srcdir)/sh4/sh4mmio.c'; fi`; \2.227 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/sh4mmio.Tpo" "$(DEPDIR)/sh4mmio.Po"; \2.228 +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/sh4mmio.Tpo"; exit 1; \2.229 +@am__fastdepCC_TRUE@ fi2.230 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sh4/sh4mmio.c' object='sh4mmio.obj' libtool=no @AMDEPBACKSLASH@2.231 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/sh4mmio.Po' tmpdepfile='$(DEPDIR)/sh4mmio.TPo' @AMDEPBACKSLASH@2.232 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@2.233 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o sh4mmio.obj `if test -f 'sh4/sh4mmio.c'; then $(CYGPATH_W) 'sh4/sh4mmio.c'; else $(CYGPATH_W) '$(srcdir)/sh4/sh4mmio.c'; fi`2.234 +2.235 +watch.o: sh4/watch.c2.236 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT watch.o -MD -MP -MF "$(DEPDIR)/watch.Tpo" \2.237 +@am__fastdepCC_TRUE@ -c -o watch.o `test -f 'sh4/watch.c' || echo '$(srcdir)/'`sh4/watch.c; \2.238 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/watch.Tpo" "$(DEPDIR)/watch.Po"; \2.239 +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/watch.Tpo"; exit 1; \2.240 +@am__fastdepCC_TRUE@ fi2.241 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sh4/watch.c' object='watch.o' libtool=no @AMDEPBACKSLASH@2.242 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/watch.Po' tmpdepfile='$(DEPDIR)/watch.TPo' @AMDEPBACKSLASH@2.243 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@2.244 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o watch.o `test -f 'sh4/watch.c' || echo '$(srcdir)/'`sh4/watch.c2.245 +2.246 +watch.obj: sh4/watch.c2.247 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT watch.obj -MD -MP -MF "$(DEPDIR)/watch.Tpo" \2.248 +@am__fastdepCC_TRUE@ -c -o watch.obj `if test -f 'sh4/watch.c'; then $(CYGPATH_W) 'sh4/watch.c'; else $(CYGPATH_W) '$(srcdir)/sh4/watch.c'; fi`; \2.249 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/watch.Tpo" "$(DEPDIR)/watch.Po"; \2.250 +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/watch.Tpo"; exit 1; \2.251 +@am__fastdepCC_TRUE@ fi2.252 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sh4/watch.c' object='watch.obj' libtool=no @AMDEPBACKSLASH@2.253 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/watch.Po' tmpdepfile='$(DEPDIR)/watch.TPo' @AMDEPBACKSLASH@2.254 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@2.255 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o watch.obj `if test -f 'sh4/watch.c'; then $(CYGPATH_W) 'sh4/watch.c'; else $(CYGPATH_W) '$(srcdir)/sh4/watch.c'; fi`2.256 uninstall-info-am:2.258 ETAGS = etags
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +00003.2 +++ b/src/aica/armcore.c Sat Aug 21 06:15:49 2004 +00003.3 @@ -0,0 +1,31 @@3.4 +3.5 +#include "armcore.h"3.6 +3.7 +struct arm_registers armr;3.8 +3.9 +/* NB: The arm (one assumes) has a different memory map, but for the meantime... */3.10 +3.11 +#define MEM_READ_BYTE( addr ) mem_read_byte(addr)3.12 +#define MEM_READ_WORD( addr ) mem_read_word(addr)3.13 +#define MEM_READ_LONG( addr ) mem_read_long(addr)3.14 +#define MEM_WRITE_BYTE( addr, val ) mem_write_byte(addr, val)3.15 +#define MEM_WRITE_WORD( addr, val ) mem_write_word(addr, val)3.16 +#define MEM_WRITE_LONG( addr, val ) mem_write_long(addr, val)3.17 +3.18 +#define PC armr.r[15];3.19 +3.20 +void arm_execute_instruction( void )3.21 +{3.22 + uint32_t ir = MEM_READ_LONG(PC);3.23 +3.24 +#define COND(ir) (ir>>28)3.25 +3.26 +3.27 +}3.28 +3.29 +void arm_execute_thumb_instruction( void )3.30 +{3.31 +3.32 +3.33 +3.34 +}
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +00004.2 +++ b/src/aica/armcore.h Sat Aug 21 06:15:49 2004 +00004.3 @@ -0,0 +1,47 @@4.4 +4.5 +#ifndef dream_armcore_H4.6 +#define dream_armcore_H 14.7 +4.8 +#include "dream.h"4.9 +#include <stdint.h>4.10 +4.11 +4.12 +4.13 +struct arm_registers {4.14 + uint32_t r[16]; /* Current register bank */4.15 +4.16 + uint32_t cpsr;4.17 + uint32_t spsr;4.18 +4.19 + /* Various banked versions of the registers. */4.20 + uint32_t fiq_r[7]; /* FIQ bank 8..14 */4.21 + uint32_t irq_r[2]; /* IRQ bank 13..14 */4.22 + uint32_t und_r[2]; /* UND bank 13..14 */4.23 + uint32_t abt_r[2]; /* ABT bank 13..14 */4.24 + uint32_t svc_r[2]; /* SVC bank 13..14 */4.25 + uint32_t user_r[7]; /* User/System bank 8..14 */4.26 +4.27 +};4.28 +4.29 +#define CPSR_N 0x80000000 /* Negative flag */4.30 +#define CPSR_Z 0x40000000 /* Zero flag */4.31 +#define CPSR_C 0x20000000 /* Carry flag */4.32 +#define CPSR_V 0x10000000 /* Overflow flag */4.33 +#define CPSR_I 0x00000080 /* Interrupt disable bit */4.34 +#define CPSR_F 0x00000040 /* Fast interrupt disable bit */4.35 +#define CPSR_T 0x00000020 /* Thumb mode */4.36 +#define CPSR_MODE 0x0000001F /* Current execution mode */4.37 +4.38 +#define MODE_USER 0x00 /* User mode */4.39 +#define MODE_FIQ 0x01 /* Fast IRQ mode */4.40 +#define MODE_IRQ 0x02 /* IRQ mode */4.41 +#define MODE_SV 0x03 /* Supervisor mode */4.42 +#define MODE_ABT 0x07 /* Abort mode */4.43 +#define MODE_UND 0x0B /* Undefined mode */4.44 +#define MODE_SYS 0x0F /* System mode */4.45 +4.46 +extern struct arm_registers armr;4.47 +4.48 +4.49 +4.50 +#endif /* !dream_armcore_H */
5.1 --- a/src/asic.c Sat Mar 13 00:03:32 2004 +00005.2 +++ b/src/asic.c Sat Aug 21 06:15:49 2004 +00005.3 @@ -3,7 +3,9 @@5.4 #include "mem.h"5.5 #include "sh4/intc.h"5.6 #include "asic.h"5.7 +#include "dreamcast.h"5.8 #include "maple.h"5.9 +#include "ide.h"5.10 #define MMIO_IMPL5.11 #include "asic.h"5.12 /*5.13 @@ -39,10 +41,10 @@5.14 MMIO_WRITE( ASIC, reg, val );5.15 if( val & 1 ) {5.16 uint32_t maple_addr = MMIO_READ( ASIC, MAPLE_DMA) &0x1FFFFFE0;5.17 -// maple_handle_buffer( maple_addr );5.18 - WARN( "Maple request initiated, halting" );5.19 + WARN( "Maple request initiated at %08X, halting", maple_addr );5.20 + maple_handle_buffer( maple_addr );5.21 MMIO_WRITE( ASIC, reg, 0 );5.22 - sh4_stop();5.23 +// dreamcast_stop();5.24 }5.25 break;5.26 default:5.27 @@ -56,6 +58,11 @@5.28 {5.29 int32_t val;5.30 switch( reg ) {5.31 + /*5.32 + case 0x89C:5.33 + sh4_stop();5.34 + return 0x000000B;5.35 + */5.36 case PIRQ0:5.37 case PIRQ1:5.38 case PIRQ2:5.39 @@ -91,13 +98,63 @@5.41 MMIO_REGION_WRITE_FN( EXTDMA, reg, val )5.42 {5.43 - MMIO_WRITE( EXTDMA, reg, val );5.44 + switch( reg ) {5.45 + case IDEALTSTATUS: /* Device control */5.46 + ide_write_control( val );5.47 + break;5.48 + case IDEDATA:5.49 + ide_write_data_pio( val );5.50 + break;5.51 + case IDEFEAT:5.52 + if( ide_can_write_regs() )5.53 + idereg.feature = (uint8_t)val;5.54 + break;5.55 + case IDECOUNT:5.56 + if( ide_can_write_regs() )5.57 + idereg.count = (uint8_t)val;5.58 + break;5.59 + case IDELBA0:5.60 + if( ide_can_write_regs() )5.61 + idereg.lba0 = (uint8_t)val;5.62 + break;5.63 + case IDELBA1:5.64 + if( ide_can_write_regs() )5.65 + idereg.lba1 = (uint8_t)val;5.66 + break;5.67 + case IDELBA2:5.68 + if( ide_can_write_regs() )5.69 + idereg.lba2 = (uint8_t)val;5.70 + break;5.71 + case IDEDEV:5.72 + if( ide_can_write_regs() )5.73 + idereg.device = (uint8_t)val;5.74 + break;5.75 + case IDECMD:5.76 + if( ide_can_write_regs() ) {5.77 + ide_clear_interrupt();5.78 + ide_write_command( (uint8_t)val );5.79 + }5.80 + break;5.81 +5.82 + default:5.83 + MMIO_WRITE( EXTDMA, reg, val );5.84 + }5.85 }5.87 MMIO_REGION_READ_FN( EXTDMA, reg )5.88 {5.89 switch( reg ) {5.90 - case GDBUSY: return 0;5.91 + case IDEALTSTATUS: return idereg.status;5.92 + case IDEDATA: return ide_read_data_pio( );5.93 + case IDEFEAT: return idereg.error;5.94 + case IDECOUNT:return idereg.count;5.95 + case IDELBA0: return idereg.disc;5.96 + case IDELBA1: return idereg.lba1;5.97 + case IDELBA2: return idereg.lba2;5.98 + case IDEDEV: return idereg.device;5.99 + case IDECMD:5.100 + ide_clear_interrupt();5.101 + return idereg.status;5.102 default:5.103 return MMIO_READ( EXTDMA, reg );5.104 }
6.1 --- a/src/asic.h Sat Mar 13 00:03:32 2004 +00006.2 +++ b/src/asic.h Sat Aug 21 06:15:49 2004 +00006.3 @@ -9,6 +9,7 @@6.4 LONG_PORT( 0x884, ASICUNK1, PORT_MRW, 0, "ASIC <unknown1>" )6.5 LONG_PORT( 0x888, ASICUNK2, PORT_MRW, 0, "ASIC <unknown2>" )6.6 LONG_PORT( 0x88C, G2STATUS, PORT_MR, 0, "G2 Bus status" )6.7 + LONG_PORT( 0x89C, ASICUNK3, PORT_MRW, 0xB, "Unknown, always 0xB?" )6.8 LONG_PORT( 0x900, PIRQ0, PORT_MRW, 0, "Pending interrupts 0" )6.9 LONG_PORT( 0x904, PIRQ1, PORT_MRW, 0, "Pending interrupts 1" )6.10 LONG_PORT( 0x908, PIRQ2, PORT_MRW, 0, "Pending interrupts 2" )6.11 @@ -21,24 +22,48 @@6.12 LONG_PORT( 0x930, IRQC0, PORT_MRW, 0, "IRQ C event map 0" )6.13 LONG_PORT( 0x934, IRQC1, PORT_MRW, 0, "IRQ C event map 1" )6.14 LONG_PORT( 0x938, IRQC2, PORT_MRW, 0, "IRQ C event map 2" )6.15 + LONG_PORT( 0x940, ASIC9UNK1, PORT_MRW, 0, "Unknown 1" )6.16 + LONG_PORT( 0x944, ASIC9UNK2, PORT_MRW, 0, "Unknown 2" )6.17 + LONG_PORT( 0x950, ASIC9UNK3, PORT_MRW, 0, "Unknown 3" )6.18 + LONG_PORT( 0x954, ASIC9UNK4, PORT_MRW, 0, "Unknown 4" )6.19 +/* ASIC events repeats at 0x980..0x9FF, then the whole region 800..9ff6.20 + * repeats at 000..1ff, 200..3ff, 400..5ff, 600..7ff, a00..bff.6.21 + * The whole region 800..8ff is long-readable, but since I so far have no idea6.22 + * what any of it means (nor have I seen any of it accessed), they're not6.23 + * listed above.6.24 + */6.25 +6.27 LONG_PORT( 0xC04, MAPLE_DMA, PORT_MRW, UNDEFINED, "Maple DMA Address" )6.28 LONG_PORT( 0xC10, MAPLE_RESET2, PORT_MRW, UNDEFINED, "Maple Reset 2" )6.29 LONG_PORT( 0xC14, MAPLE_ENABLE, PORT_MRW, UNDEFINED, "Maple Enable" )6.30 LONG_PORT( 0xC18, MAPLE_STATE, PORT_MRW, 0, "Maple State" )6.31 + LONG_PORT( 0xC70, MAPLE_UNK1, PORT_MRW, 0, "Maple unknown 1" )6.32 + LONG_PORT( 0xC74, MAPLE_UNK2, PORT_MRW, 0, "Maple unknown 2" )6.33 + LONG_PORT( 0xC78, MAPLE_UNK3, PORT_MRW, 0, "Maple unknown 3" )6.34 + LONG_PORT( 0xC7C, MAPLE_UNK4, PORT_MRW, 0, "Maple unknown 4" )6.35 LONG_PORT( 0xC80, MAPLE_SPEED, PORT_MRW, UNDEFINED, "Maple Speed" )6.36 + LONG_PORT( 0xC84, MAPLE_UNK5, PORT_MRW, 0, "Maple unknown 5" )6.37 LONG_PORT( 0xC8C, MAPLE_RESET1, PORT_MRW, UNDEFINED, "Maple Reset 1" )6.38 + LONG_PORT( 0xCE8, MAPLE_UNK6, PORT_MRW, 0, "Maple unknown 6" )6.39 + LONG_PORT( 0xCF4, MAPLE_SRC, PORT_MRW, 0, "Maple current source" )6.40 + LONG_PORT( 0xCF8, MAPLE_DEST1, PORT_MRW, 0, "Maple current destination" )6.41 + LONG_PORT( 0xCFC, MAPLE_DEST2, PORT_MRW, 0, "Maple current destination 2?" )6.42 +/* Note: Maple registers repeat at 0xD00..0xDFF,6.43 + * 0xE00..0xEFF and 0xF00..0xFFF */6.44 MMIO_REGION_END6.46 MMIO_REGION_BEGIN( 0x005F7000, EXTDMA, "ASIC External DMA" )6.47 - BYTE_PORT( 0x018, GDBUSY, PORT_MRW, 0, "GD-Rom Busy" )6.48 - WORD_PORT( 0x080, GDDATA, PORT_MRW, 0, "GD-Rom Data" )6.49 - BYTE_PORT( 0x084, GDFEAT, PORT_MRW, 0, "GD-Rom Feature" )6.50 - BYTE_PORT( 0x088, GDSECTOR, PORT_MRW, 0, "GD-Rom Sector Count" )6.51 - BYTE_PORT( 0x08C, GDNSECTOR, PORT_MRW, 0, "GD-Rom Sector" )6.52 - BYTE_PORT( 0x090, GDCMDLENLO, PORT_MRW, 0, "GD-Rom Command length low" )6.53 - BYTE_PORT( 0x094, GDCMDLENHI, PORT_MRW, 0, "GD-Rom Command length hi" )6.54 - BYTE_PORT( 0x09C, GDSTATUS, PORT_MRW, 0, "GD-Rom Status" )6.55 + BYTE_PORT( 0x018, IDEALTSTATUS, PORT_RW, 0, "IDE Device Control / Alt-status" ) /* 10110 */6.56 + BYTE_PORT( 0x01C, IDEUNK1, PORT_MRW, 0, "IDE Unknown" )6.57 + WORD_PORT( 0x080, IDEDATA, PORT_RW, 0, "IDE Data" )6.58 + BYTE_PORT( 0x084, IDEFEAT, PORT_RW, 0, "IDE Feature / Error" )6.59 + BYTE_PORT( 0x088, IDECOUNT, PORT_RW, 0, "IDE Sector Count" )6.60 + BYTE_PORT( 0x08C, IDELBA0, PORT_RW, 0, "IDE LBA lo" ) /* AKA sector */6.61 + BYTE_PORT( 0x090, IDELBA1, PORT_RW, 0, "IDE LBA mid" ) /* AKA Cyl lo */6.62 + BYTE_PORT( 0x094, IDELBA2, PORT_RW, 0, "IDE LBA hi" ) /* AKA Cyl hi */6.63 + BYTE_PORT( 0x098, IDEDEV, PORT_RW, 0, "IDE Device" )6.64 + BYTE_PORT( 0x09C, IDECMD, PORT_RW, 0, "IDE Command/Status" )6.65 LONG_PORT( 0x404, EXTDMASH4, PORT_MRW, 0, "Ext DMA SH4 address" )6.66 LONG_PORT( 0x408, EXTDMASIZ, PORT_MRW, 0, "Ext DMA Size" )6.67 LONG_PORT( 0x40C, EXTDMADIR, PORT_MRW, 0, "Ext DMA Direction" )6.68 @@ -54,7 +79,7 @@6.69 LONG_PORT( 0x4A4, EXTDMAUNK7, PORT_MRW, 0, "Ext DMA <unknown7>" )6.70 LONG_PORT( 0x4B4, EXTDMAUNK8, PORT_MRW, 0, "Ext DMA <unknown8>" )6.71 LONG_PORT( 0x4B8, EXTDMAUNK9, PORT_MRW, 0, "Ext DMA <unknown9>" )6.72 - LONG_PORT( 0x4E4, GDACTIVATE, PORT_MRW, 0, "GD-Rom activate" )6.73 + LONG_PORT( 0x4E4, IDEACTIVATE, PORT_MRW, 0, "IDE activate" )6.74 LONG_PORT( 0x800, SPUDMA0EXT, PORT_MRW, 0, "SPU DMA0 External address" )6.75 LONG_PORT( 0x804, SPUDMA0SH4, PORT_MRW, 0, "SPU DMA0 SH4-based address" )6.76 LONG_PORT( 0x808, SPUDMA0SIZ, PORT_MRW, 0, "SPU DMA0 Size" )
7.1 --- a/src/dream.h Sat Mar 13 00:03:32 2004 +00007.2 +++ b/src/dream.h Sat Aug 21 06:15:49 2004 +00007.3 @@ -4,6 +4,8 @@7.4 #ifndef dream_H7.5 #define dream_H 17.7 +#include <stdint.h>7.8 +7.9 #ifdef __cplusplus7.10 extern "C" {7.11 #if 0
8.1 --- /dev/null Thu Jan 01 00:00:00 1970 +00008.2 +++ b/src/dreamcast.c Sat Aug 21 06:15:49 2004 +00008.3 @@ -0,0 +1,37 @@8.4 +#include "dream.h"8.5 +#include "mem.h"8.6 +#include "aica.h"8.7 +#include "asic.h"8.8 +#include "ide.h"8.9 +#include "dreamcast.h"8.10 +/* Central switchboard for the system */8.11 +8.12 +void dreamcast_init( void )8.13 +{8.14 + mem_init();8.15 + sh4_init();8.16 + asic_init();8.17 + pvr2_init();8.18 + aica_init();8.19 + ide_reset();8.20 +8.21 + mem_create_ram_region( 0x0C000000, 16 MB, MEM_REGION_MAIN );8.22 + mem_create_ram_region( 0x05000000, 8 MB, MEM_REGION_VIDEO );8.23 + mem_create_ram_region( 0x00800000, 2 MB, MEM_REGION_AUDIO );8.24 + mem_create_ram_region( 0x00703000, 8 KB, MEM_REGION_AUDIO_SCRATCH ); /*???*/8.25 + mem_load_rom( "dcboot.rom", 0x00000000, 0x00200000, 0x89f2b1a1 );8.26 + mem_load_rom( "dcflash.rom",0x00200000, 0x00020000, 0x357c3568 );8.27 +}8.28 +8.29 +void dreamcast_reset( void )8.30 +{8.31 + sh4_reset();8.32 + mem_reset();8.33 +// pvr2_reset();8.34 + aica_reset();8.35 +}8.36 +8.37 +void dreamcast_stop( void )8.38 +{8.39 + sh4_stop();8.40 +}
9.1 --- /dev/null Thu Jan 01 00:00:00 1970 +00009.2 +++ b/src/dreamcast.h Sat Aug 21 06:15:49 2004 +00009.3 @@ -0,0 +1,9 @@9.4 +9.5 +#ifndef dreamcast_H9.6 +#define dreamcast_H 19.7 +9.8 +void dreamcast_init(void);9.9 +void dreamcast_reset(void);9.10 +void dreamcast_stop(void);9.11 +9.12 +#endif /* !dream_machine_H */
10.1 --- /dev/null Thu Jan 01 00:00:00 1970 +000010.2 +++ b/src/gdrom/ide.c Sat Aug 21 06:15:49 2004 +000010.3 @@ -0,0 +1,127 @@10.4 +/*10.5 + * ide.c 31 Mar 2004 - IDE Interface implementation10.6 + *10.7 + * Copyright (c) 2004 Nathan Keynes. Distribution and modification permitted10.8 + * under the terms of the GNU General Public License version 2 or later.10.9 + */10.10 +#include <stdlib.h>10.11 +#include "ide.h"10.12 +10.13 +#define MAX_WRITE_BUF 4096;10.14 +10.15 +struct ide_registers idereg;10.16 +10.17 +static char command_buffer[12];10.18 +10.19 +/* "\0\0\0\0\xb4\x19\0\0\x08SE REV 6.42990316" */10.20 +char gdrom_ident[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0xb4, 0x19, 0x00,10.21 + 0x00, 0x08, 0x53, 0x45, 0x20, 0x20, 0x20, 0x20,10.22 + 0x20, 0x20, 0x52, 0x65, 0x76, 0x20, 0x36, 0x2e,10.23 + 0x34, 0x32, 0x39, 0x39, 0x30, 0x33, 0x31, 0x36 };10.24 +10.25 +10.26 +void set_write_buffer( char *buf, int len )10.27 +{10.28 + idereg.status |= IDE_ST_DATA;10.29 + idereg.data = buf;10.30 + idereg.datalen = len;10.31 + idereg.writeptr = (uint16_t *)buf;10.32 + idereg.readptr = NULL;10.33 +}10.34 +10.35 +void set_read_buffer( char *buf, int len )10.36 +{10.37 + idereg.status |= IDE_ST_DATA;10.38 + idereg.data = buf;10.39 + idereg.datalen = len;10.40 + idereg.readptr = (uint16_t *)buf;10.41 + idereg.writeptr = NULL;10.42 + idereg.lba1 = len&0xFF;10.43 + idereg.lba2 = len>>8;10.44 +}10.45 +10.46 +void ide_clear_interrupt( void )10.47 +{10.48 + /* TODO */10.49 +}10.50 +10.51 +void ide_reset( void )10.52 +{10.53 + ide_clear_interrupt();10.54 + idereg.error = 0x01;10.55 + idereg.count = 0x01;10.56 + idereg.lba0 = 0x21;10.57 + idereg.lba1 = 0x14;10.58 + idereg.lba2 = 0xeb;10.59 + idereg.feature = 0; /* Indeterminate really */10.60 + idereg.status = 0x00;10.61 + idereg.device = 0x00;10.62 + idereg.disc = IDE_DISC_GDROM | IDE_DISC_READY;10.63 +}10.64 +10.65 +uint16_t ide_read_data_pio( void ) {10.66 + if( idereg.readptr == NULL )10.67 + return 0xFFFF;10.68 + uint16_t rv = *idereg.readptr++;10.69 + idereg.datalen-=2;10.70 + if( idereg.datalen <=0 ) {10.71 + idereg.readptr = NULL;10.72 + idereg.status &= ~IDE_ST_DATA;10.73 + }10.74 + return rv;10.75 +}10.76 +10.77 +void ide_write_data_pio( uint16_t val ) {10.78 + if( idereg.writeptr == NULL )10.79 + return;10.80 + *idereg.writeptr++ = val;10.81 + idereg.datalen-=2;10.82 + if( idereg.datalen <= 0 ) {10.83 + idereg.writeptr = NULL;10.84 + idereg.status &= ~IDE_ST_DATA;10.85 + ide_write_buffer( idereg.data );10.86 + }10.87 +}10.88 +10.89 +void ide_write_control( uint8_t val ) {10.90 + /* TODO: In theory we can cause a soft-reset here, but the DC doesn't10.91 + * appear to support it.10.92 + */10.93 +}10.94 +10.95 +void ide_write_command( uint8_t val ) {10.96 + idereg.command = val;10.97 + switch( val ) {10.98 + case IDE_CMD_RESET_DEVICE:10.99 + ide_reset();10.100 + break;10.101 + case IDE_CMD_PACKET:10.102 + set_write_buffer(command_buffer,12);10.103 + break;10.104 + default:10.105 + WARN( "IDE: Unimplemented command: %02X", val );10.106 + }10.107 + idereg.status |= IDE_ST_READY | IDE_ST_SERV;10.108 +}10.109 +10.110 +void ide_write_buffer( char *data ) {10.111 + uint16_t length;10.112 + switch( idereg.command ) {10.113 + case IDE_CMD_PACKET:10.114 + /* Okay we have the packet in the command buffer */10.115 + WARN( "ATAPI: Received Packet command: %02X", data[0] );10.116 +10.117 + switch( command_buffer[0] ) {10.118 + case PKT_CMD_IDENTIFY:10.119 + /* NB: Bios sets data[4] = 0x08, no idea what this is for;10.120 + * different values here appear to have no effect.10.121 + */10.122 + length = *((uint16_t*)(data+2));10.123 + if( length > sizeof(gdrom_ident) )10.124 + length = sizeof(gdrom_ident);10.125 + set_read_buffer(gdrom_ident, length);10.126 + break;10.127 + }10.128 + break;10.129 + }10.130 +}
11.1 --- /dev/null Thu Jan 01 00:00:00 1970 +000011.2 +++ b/src/gdrom/ide.h Sat Aug 21 06:15:49 2004 +000011.3 @@ -0,0 +1,91 @@11.4 +/*11.5 + * ide.h 31 Mar 2004 - IDE Interface definitions11.6 + *11.7 + * Copyright (c) 2004 Nathan Keynes. Distribution and modification permitted11.8 + * under the terms of the GNU General Public License version 2 or later.11.9 + *11.10 + * This file defines the interface and structures of the dreamcast's IDE port.11.11 + * Note that the register definitions are in asic.h, as the registers fall into11.12 + * the general ASIC ranges (and I don't want to use smaller pages at this11.13 + * stage). The registers here are exactly as per the ATA specifications, which11.14 + * makes things a little easier.11.15 + */11.16 +#ifndef dream_ide_H11.17 +#define dream_ide_H 111.18 +11.19 +#include "dream.h"11.20 +11.21 +struct ide_registers {11.22 + uint8_t status; /* A05F709C + A05F7018 Read-only */11.23 + uint8_t control; /* A05F7018 Write-only 01110 */11.24 + uint8_t error; /* A05F7084 Read-only 10001 */11.25 + uint8_t feature; /* A05F7084 Write-only 10001 */11.26 + uint8_t count; /* A05F7088 Read/Write 10010 */11.27 + uint8_t disc; /* A05F708C Read-only 10011 */11.28 + uint8_t lba0; /* A05F708C Write-only 10011 (NB: Presumed, TBV */11.29 + uint8_t lba1; /* A05F7090 Read/Write 10100 */11.30 + uint8_t lba2; /* A05F7094 Read/Write 10101 */11.31 + uint8_t device; /* A05F7098 Read/Write 10110 */11.32 + uint8_t command; /* A05F709C Write-only 10111 */11.33 +11.34 + /* We don't keep the data register per se, rather the currently pending11.35 + * data is kept here and read out a byte at a time (in PIO mode) or all at11.36 + * once (in DMA mode). The IDE routines are responsible for managing this11.37 + * memory. If dataptr == NULL, there is no data available.11.38 + */11.39 + char *data;11.40 + uint16_t *readptr, *writeptr;11.41 + int datalen;11.42 +};11.43 +11.44 +#define IDE_ST_BUSY 0x8011.45 +#define IDE_ST_READY 0x4011.46 +#define IDE_ST_SERV 0x1011.47 +#define IDE_ST_DATA 0x0811.48 +#define IDE_ST_ERROR 0x0111.49 +11.50 +#define IDE_CTL_RESET 0x0411.51 +#define IDE_CTL_IRQEN 0x02 /* IRQ enabled when == 0 */11.52 +11.53 +#define IDE_CMD_RESET_DEVICE 0x0811.54 +#define IDE_CMD_PACKET 0xA011.55 +#define IDE_CMD_IDENTIFY_PACKET_DEVICE 0xA111.56 +#define IDE_CMD_SERVICE 0xA211.57 +#define IDE_CMD_SET_FEATURE 0xEF11.58 +11.59 +/* The disc register indicates the current contents of the drive. When open11.60 + * contains 0x06.11.61 + */11.62 +#define IDE_DISC_AUDIO 0x0011.63 +#define IDE_DISC_NONE 0x0611.64 +#define IDE_DISC_CDROM 0x2011.65 +#define IDE_DISC_GDROM 0x8011.66 +#define IDE_DISC_READY 0x01 /* ored with above */11.67 +#define IDE_DISC_IDLE 0x02 /* ie spun-down */11.68 +11.69 +#define PKT_CMD_RESET 0x00 /* Wild-ass guess */11.70 +#define PKT_CMD_IDENTIFY 0x1111.71 +11.72 +extern struct ide_registers idereg;11.73 +11.74 +/* Note: control can be written at any time - all other registers are writable11.75 + * only when ide_can_write_regs() is true11.76 + */11.77 +#define ide_can_write_regs() ((idereg.status&0x88)==0)11.78 +11.79 +/* Called upon:11.80 + * a) Writing the command register11.81 + * b) Reading the status (but not altstatus) register11.82 + * (whether this actually has any effect an the ASIC event is TBD)11.83 + */11.84 +void ide_clear_interrupt(void);11.85 +11.86 +void ide_reset(void);11.87 +11.88 +uint16_t ide_read_data_pio(void);11.89 +void ide_write_data_pio( uint16_t value );11.90 +void ide_write_buffer( char * );11.91 +11.92 +void ide_write_command( uint8_t command );11.93 +void ide_write_control( uint8_t value );11.94 +#endif
12.1 --- a/src/gui/callbacks.c Sat Mar 13 00:03:32 2004 +000012.2 +++ b/src/gui/callbacks.c Sat Aug 21 06:15:49 2004 +000012.3 @@ -84,7 +84,7 @@12.4 {12.5 sh4_reset();12.6 mem_reset();12.7 - update_registers();12.8 + update_gui();12.9 }12.12 @@ -103,7 +103,7 @@12.13 gpointer user_data)12.14 {12.15 sh4_execute_instruction();12.16 - update_registers();12.17 + update_gui();12.18 }12.21 @@ -120,7 +120,7 @@12.22 gtk_main_iteration();12.23 pvr2_next_frame();12.24 } while( sh4_isrunning() );12.25 - update_registers();12.26 + update_gui();12.27 }12.28 }12.29 void12.30 @@ -273,3 +273,35 @@12.31 jump_to_disassembly( sh4r.pc, TRUE );12.32 }12.34 +12.35 +void12.36 +on_button_add_watch_clicked (GtkButton *button,12.37 + gpointer user_data)12.38 +{12.39 +12.40 +}12.41 +12.42 +12.43 +void12.44 +on_button_clear_all_clicked (GtkButton *button,12.45 + gpointer user_data)12.46 +{12.47 +12.48 +}12.49 +12.50 +12.51 +void12.52 +on_button_close_clicked (GtkButton *button,12.53 + gpointer user_data)12.54 +{12.55 +12.56 +}12.57 +12.58 +12.59 +void12.60 +on_view_memory_activate (GtkMenuItem *menuitem,12.61 + gpointer user_data)12.62 +{12.63 + dump_window_new();12.64 +}12.65 +
13.1 --- a/src/gui/callbacks.h Sat Mar 13 00:03:32 2004 +000013.2 +++ b/src/gui/callbacks.h Sat Aug 21 06:15:49 2004 +000013.3 @@ -141,3 +141,37 @@13.4 void13.5 on_jump_pc_btn_clicked (GtkButton *button,13.6 gpointer user_data);13.7 +13.8 +void13.9 +on_memory1_activate (GtkMenuItem *menuitem,13.10 + gpointer user_data);13.11 +13.12 +gboolean13.13 +on_memory_win_delete_event (GtkWidget *widget,13.14 + GdkEvent *event,13.15 + gpointer user_data);13.16 +13.17 +void13.18 +button_view_clicked (GtkButton *button,13.19 + gpointer user_data);13.20 +13.21 +void13.22 +on_button_add_watch_clicked (GtkButton *button,13.23 + gpointer user_data);13.24 +13.25 +void13.26 +on_button_clear_all_clicked (GtkButton *button,13.27 + gpointer user_data);13.28 +13.29 +void13.30 +on_button_close_clicked (GtkButton *button,13.31 + gpointer user_data);13.32 +13.33 +gboolean13.34 +on_dump_win_delete_event (GtkWidget *widget,13.35 + GdkEvent *event,13.36 + gpointer user_data);13.37 +13.38 +void13.39 +on_view_memory_activate (GtkMenuItem *menuitem,13.40 + gpointer user_data);
14.1 --- /dev/null Thu Jan 01 00:00:00 1970 +000014.2 +++ b/src/gui/debug_win.c Sat Aug 21 06:15:49 2004 +000014.3 @@ -0,0 +1,217 @@14.4 +14.5 +#include <stdlib.h>14.6 +#include <stdarg.h>14.7 +#include <gnome.h>14.8 +#include <math.h>14.9 +#include "gui.h"14.10 +#include "mem.h"14.11 +#include "sh4dasm.h"14.12 +#include "sh4core.h"14.13 +14.14 +GdkColor *msg_colors[] = { &clrError, &clrError, &clrWarn, &clrNormal,14.15 + &clrDebug, &clrTrace };14.16 +14.17 +#define REG_INT 014.18 +#define REG_FLT 114.19 +#define REG_SPECIAL 214.20 +14.21 +struct reg_map_struct {14.22 + char *name;14.23 + int type;14.24 + void *value;14.25 +} reg_map[] = { {"R0", REG_INT, &sh4r.r[0]}, {"R1", REG_INT, &sh4r.r[1]},14.26 + {"R2", REG_INT, &sh4r.r[2]}, {"R3", REG_INT, &sh4r.r[3]},14.27 + {"R4", REG_INT, &sh4r.r[4]}, {"R5", REG_INT, &sh4r.r[5]},14.28 + {"R6", REG_INT, &sh4r.r[6]}, {"R7", REG_INT, &sh4r.r[7]},14.29 + {"R8", REG_INT, &sh4r.r[8]}, {"R9", REG_INT, &sh4r.r[9]},14.30 + {"R10",REG_INT, &sh4r.r[10]}, {"R11",REG_INT, &sh4r.r[11]},14.31 + {"R12",REG_INT, &sh4r.r[12]}, {"R13",REG_INT, &sh4r.r[13]},14.32 + {"R14",REG_INT, &sh4r.r[14]}, {"R15",REG_INT, &sh4r.r[15]},14.33 + {"SR", REG_INT, &sh4r.sr}, {"GBR", REG_INT, &sh4r.gbr},14.34 + {"SSR",REG_INT, &sh4r.ssr}, {"SPC", REG_INT, &sh4r.spc},14.35 + {"SGR",REG_INT, &sh4r.sgr}, {"DBR", REG_INT, &sh4r.dbr},14.36 + {"VBR",REG_INT, &sh4r.vbr},14.37 + {"PC", REG_INT, &sh4r.pc}, {"PR", REG_INT, &sh4r.pr},14.38 + {"MACL",REG_INT, &sh4r.mac},{"MACH",REG_INT, ((uint32_t *)&sh4r.mac)+1},14.39 + {"FPUL", REG_INT, &sh4r.fpul}, {"FPSCR", REG_INT, &sh4r.fpscr},14.40 + {NULL, 0, NULL} };14.41 +14.42 +GtkCList *msgs, *regs, *disasm;14.43 +GtkEntry *page_field;14.44 +GtkProgressBar *icounter;14.45 +char icounter_text[16];14.46 +14.47 +struct sh4_registers sh4r_s;14.48 +int disasm_from = -1, disasm_to = -1;14.49 +int disasm_pc = -1;14.50 +14.51 +14.52 +void init_debug_win(GtkWidget *win)14.53 +{14.54 + int i;14.55 + char buf[20];14.56 + char *arr[2];14.57 + GnomeAppBar *appbar;14.58 +14.59 + regs = gtk_object_get_data(GTK_OBJECT(win), "reg_list");14.60 + arr[1] = buf;14.61 + for( i=0; reg_map[i].name != NULL; i++ ) {14.62 + arr[0] = reg_map[i].name;14.63 + if( reg_map[i].type == REG_INT )14.64 + sprintf( buf, "%08X", *((uint32_t *)reg_map[i].value) );14.65 + else14.66 + sprintf( buf, "%f", *((float *)reg_map[i].value) );14.67 + gtk_clist_append( regs, arr );14.68 + }14.69 + gtk_widget_modify_font( GTK_WIDGET(regs), fixed_list_font );14.70 +14.71 + msgs = gtk_object_get_data(GTK_OBJECT(win), "output_list");14.72 + disasm = gtk_object_get_data(GTK_OBJECT(win), "disasm_list");14.73 + gtk_clist_set_column_width( disasm, 1, 16 );14.74 + page_field = gtk_object_get_data(GTK_OBJECT(win), "page_field");14.75 +14.76 + appbar = gtk_object_get_data(GTK_OBJECT(win), "debug_appbar");14.77 + icounter = gnome_appbar_get_progress( appbar );14.78 + gtk_progress_bar_set_text(icounter, "1");14.79 +}14.80 +14.81 +/*14.82 + * Check for changed registers and update the display14.83 + */14.84 +void update_registers( void )14.85 +{14.86 + int i;14.87 + for( i=0; reg_map[i].name != NULL; i++ ) {14.88 + if( reg_map[i].type == REG_INT ) {14.89 + /* Yes this _is_ probably fairly evil */14.90 + if( *((uint32_t *)reg_map[i].value) !=14.91 + *((uint32_t *)((char *)&sh4r_s + ((char *)reg_map[i].value - (char *)&sh4r))) ) {14.92 + char buf[20];14.93 + sprintf( buf, "%08X", *((uint32_t *)reg_map[i].value) );14.94 + gtk_clist_set_text( regs, i, 1, buf );14.95 + gtk_clist_set_foreground( regs, i, &clrChanged );14.96 + } else {14.97 + gtk_clist_set_foreground( regs, i, &clrNormal );14.98 + }14.99 + } else {14.100 + if( *((float *)reg_map[i].value) !=14.101 + *((float *)((char *)&sh4r_s + ((char *)reg_map[i].value - (char *)&sh4r))) ) {14.102 + char buf[20];14.103 + sprintf( buf, "%f", *((float *)reg_map[i].value) );14.104 + gtk_clist_set_text( regs, i, 1, buf );14.105 + gtk_clist_set_foreground( regs, i, &clrChanged );14.106 + } else {14.107 + gtk_clist_set_foreground( regs, i, &clrNormal );14.108 + }14.109 + }14.110 + }14.111 + if( sh4r.pc != sh4r_s.pc )14.112 + set_disassembly_pc( sh4r.pc, FALSE );14.113 + memcpy( &sh4r_s, &sh4r, sizeof(sh4r) );14.114 +}14.115 +14.116 +void update_icount( void )14.117 +{14.118 + sprintf( icounter_text, "%d", sh4r.icount );14.119 + gtk_progress_bar_set_text( icounter, icounter_text );14.120 +}14.121 +14.122 +void set_disassembly_region( unsigned int page )14.123 +{14.124 + uint32_t i, posn;14.125 + uint16_t op;14.126 + char buf[80];14.127 + char addr[10];14.128 + char opcode[6] = "";14.129 + char *arr[4] = { addr, " ", opcode, buf };14.130 + unsigned int from = page & 0xFFFFF000;14.131 + unsigned int to = from + 4096;14.132 +14.133 + gtk_clist_clear(disasm);14.134 +14.135 + sprintf( addr, "%08X", from );14.136 + gtk_entry_set_text( page_field, addr );14.137 +14.138 + if( !mem_has_page( from ) ) {14.139 + arr[3] = "This page is currently unmapped";14.140 + gtk_clist_append( disasm, arr );14.141 + gtk_clist_set_foreground( disasm, 0, &clrError );14.142 + } else {14.143 + for( i=from; i<to; i+=2 ) {14.144 + sh4_disasm_instruction( i, buf, sizeof(buf) );14.145 + sprintf( addr, "%08X", i );14.146 + op = mem_read_phys_word(i);14.147 + sprintf( opcode, "%02X %02X", op&0xFF, op>>8 );14.148 + posn = gtk_clist_append( disasm, arr );14.149 + if( buf[0] == '?' )14.150 + gtk_clist_set_foreground( disasm, posn, &clrWarn );14.151 + }14.152 + if( disasm_pc != -1 && disasm_pc >= from && disasm_pc < to )14.153 + gtk_clist_set_foreground( disasm, (disasm_pc - from)>>1,14.154 + &clrPC );14.155 + }14.156 +14.157 + if( page != from ) { /* not a page boundary */14.158 + gtk_clist_moveto( disasm, (page-from)>>1, 0, 0.5, 0.0 );14.159 + }14.160 + disasm_from = from;14.161 + disasm_to = to;14.162 +}14.163 +14.164 +void jump_to_disassembly( unsigned int addr, gboolean select )14.165 +{14.166 + int row;14.167 +14.168 + if( addr < disasm_from || addr >= disasm_to )14.169 + set_disassembly_region(addr);14.170 +14.171 + row = (addr-disasm_from)>>1;14.172 + if(select) {14.173 + gtk_clist_select_row( disasm, row, 0 );14.174 + }14.175 + if( gtk_clist_row_is_visible( disasm, row ) != GTK_VISIBILITY_FULL ){14.176 + gtk_clist_moveto( disasm, row, 0, 0.5, 0.0 );14.177 + }14.178 +}14.179 +14.180 +void set_disassembly_pc( unsigned int pc, gboolean select )14.181 +{14.182 + int row;14.183 +14.184 + jump_to_disassembly( pc, select );14.185 + if( disasm_pc != -1 && disasm_pc >= disasm_from && disasm_pc < disasm_to )14.186 + gtk_clist_set_foreground( disasm, (disasm_pc - disasm_from)>>1,14.187 + &clrNormal );14.188 + row = (pc - disasm_from)>>1;14.189 + gtk_clist_set_foreground( disasm, row, &clrPC );14.190 + disasm_pc = pc;14.191 +}14.192 +14.193 +14.194 +void emit( int level, int source, char *msg, ... )14.195 +{14.196 + char buf[20], addr[10] = "", *p;14.197 + char *arr[3] = {buf, addr};14.198 + int posn;14.199 + time_t tm = time(NULL);14.200 + va_list ap;14.201 +14.202 + va_start(ap, msg);14.203 + p = g_strdup_vprintf( msg, ap );14.204 + strftime( buf, sizeof(buf), "%H:%M:%S", localtime(&tm) );14.205 + if( source != -1 )14.206 + sprintf( addr, "%08X", sh4r.pc );14.207 + arr[2] = p;14.208 + posn = gtk_clist_append(msgs, arr);14.209 + free(p);14.210 + va_end(ap);14.211 +14.212 + gtk_clist_set_foreground( msgs, posn, msg_colors[level] );14.213 + gtk_clist_moveto( msgs, posn, 0, 1.0, 0.0 );14.214 +14.215 + /* emit _really_ slows down the emu, to the point where the gui can be14.216 + * completely unresponsive if I don't include this:14.217 + */14.218 + while( gtk_events_pending() )14.219 + gtk_main_iteration();14.220 +}
15.1 --- /dev/null Thu Jan 01 00:00:00 1970 +000015.2 +++ b/src/gui/dump_win.c Sat Aug 21 06:15:49 2004 +000015.3 @@ -0,0 +1,194 @@15.4 +/**15.5 + * Implements the memory dump window.15.6 + */15.7 +#include <gnome.h>15.8 +#include <ctype.h>15.9 +#include <assert.h>15.10 +#include "gui.h"15.11 +#include "interface.h"15.12 +#include "mem.h"15.13 +15.14 +#define MAX_DUMP_SIZE 409615.15 +15.16 +#define DUMP_DATA_TAG 0xD4B9DA7A15.17 +15.18 +typedef struct dump_data {15.19 + uint32_t _tag;15.20 + uint32_t start;15.21 + uint32_t end;15.22 + int flags;15.23 + char *data;15.24 +15.25 + GtkEntry *fromInput, *toInput;15.26 + GtkTextView *textArea;15.27 + GtkTextTag *changedTag;15.28 + GtkTextBuffer *textBuffer;15.29 + struct dump_data *next;15.30 +} *dump_data_t;15.31 +15.32 +static dump_data_t dump_list_head = NULL;15.33 +15.34 +gboolean on_dump_win_delete_event( GtkWidget *widget, GdkEvent *event,15.35 + gpointer user_data );15.36 +void on_dump_win_button_view_clicked( GtkWidget *widget, gpointer user_data );15.37 +void dump_win_set_text( dump_data_t data, char *old_data, char *new_data );15.38 +15.39 +15.40 +void dump_window_new( void ) {15.41 + GtkWidget *win = create_dump_win();15.42 + GtkWidget *dump_view_button = (GtkWidget *)g_object_get_data(G_OBJECT(win), "dump_view_button");15.43 + dump_data_t data = malloc( sizeof(struct dump_data) );15.44 + data->_tag = DUMP_DATA_TAG;15.45 + data->fromInput = (GtkEntry *)g_object_get_data(G_OBJECT(win), "dump_from");15.46 + data->toInput = (GtkEntry *)g_object_get_data(G_OBJECT(win), "dump_to");15.47 + data->textArea = (GtkTextView *)g_object_get_data(G_OBJECT(win), "dump_text");15.48 + data->next = dump_list_head;15.49 + dump_list_head = data;15.50 + data->data = NULL;15.51 + data->start = 0;15.52 + data->end = 0;15.53 + gtk_entry_set_text( data->fromInput, "" );15.54 + gtk_entry_set_text( data->toInput, "" );15.55 + data->textBuffer = gtk_text_buffer_new(NULL);15.56 + data->changedTag = gtk_text_buffer_create_tag(data->textBuffer, "changed",15.57 + "foreground", "blue",15.58 + NULL);15.59 + gtk_text_view_set_buffer(data->textArea, data->textBuffer);15.60 + gtk_text_view_set_editable(data->textArea, FALSE);15.61 + gtk_widget_modify_font(GTK_WIDGET(data->textArea),fixed_list_font);15.62 +15.63 + g_signal_connect ((gpointer) win, "delete_event",15.64 + G_CALLBACK (on_dump_win_delete_event),15.65 + data);15.66 + g_signal_connect ((gpointer) dump_view_button, "clicked",15.67 + G_CALLBACK (on_dump_win_button_view_clicked),15.68 + data);15.69 + gtk_widget_show( GTK_WIDGET(win) );15.70 +}15.71 +15.72 +15.73 +15.74 +gboolean on_dump_win_delete_event( GtkWidget *widget, GdkEvent *event,15.75 + gpointer user_data )15.76 +{15.77 + dump_data_t data = (dump_data_t)user_data;15.78 + if( data->data != NULL )15.79 + free( data->data );15.80 + dump_data_t node = dump_list_head;15.81 + if( node == data )15.82 + dump_list_head = data->next;15.83 + else {15.84 + while( node->next != data ) {15.85 + node = node->next;15.86 + assert( node != NULL );15.87 + }15.88 + node->next = data->next;15.89 + }15.90 + free( data );15.91 + return FALSE;15.92 +}15.93 +15.94 +void on_dump_win_button_view_clicked( GtkWidget *widget, gpointer user_data )15.95 +{15.96 + dump_data_t data = (dump_data_t)user_data;15.97 + uint32_t startVal, endVal;15.98 +15.99 + assert( data != NULL );15.100 + assert( data->_tag == DUMP_DATA_TAG );15.101 +15.102 + startVal = gtk_entry_get_hex_value(data->fromInput, data->start);15.103 + endVal = gtk_entry_get_hex_value(data->toInput, data->end);15.104 + if( startVal != data->start || endVal != data->end ) {15.105 + if( startVal > endVal ) {15.106 + int tmp = endVal;15.107 + endVal = startVal;15.108 + startVal = tmp;15.109 + }15.110 + if( endVal > startVal + MAX_DUMP_SIZE )15.111 + endVal = startVal + MAX_DUMP_SIZE;15.112 +15.113 + gtk_entry_set_hex_value(data->fromInput,startVal);15.114 + gtk_entry_set_hex_value(data->toInput,endVal);15.115 + data->start = startVal;15.116 + data->end = endVal;15.117 +15.118 + if( data->data != NULL ) {15.119 + free( data->data );15.120 + data->data = NULL;15.121 + }15.122 + if( startVal != endVal ) {15.123 + data->data = malloc( endVal - startVal );15.124 + mem_copy_from_sh4( data->data, startVal, endVal-startVal );15.125 + dump_win_set_text( data, data->data, data->data );15.126 + }15.127 + }15.128 +}15.129 +15.130 +void dump_win_update( dump_data_t data )15.131 +{15.132 + if( data->data == NULL )15.133 + return;15.134 + char tmp[data->end-data->start];15.135 + int length = data->end-data->start;15.136 + memcpy( tmp, data->data, length );15.137 + mem_copy_from_sh4( data->data, data->start, length );15.138 + dump_win_set_text( data, tmp, data->data );15.139 +}15.140 +15.141 +void dump_win_update_all( )15.142 +{15.143 + dump_data_t node = dump_list_head;15.144 + while( node != NULL ) {15.145 + dump_win_update(node);15.146 + node = node->next;15.147 + }15.148 +}15.149 +15.150 +void dump_win_set_text( dump_data_t data, char *old_data, char *new_data )15.151 +{15.152 + GtkTextBuffer *buf = data->textBuffer;15.153 + GtkTextTag *changedTag = data->changedTag;15.154 + GtkTextIter iter, endIter;15.155 + int i, j, offset;15.156 + /* Clear out the buffer */15.157 + gtk_text_buffer_get_start_iter(buf,&iter);15.158 + gtk_text_buffer_get_end_iter(buf,&endIter);15.159 + gtk_text_buffer_delete(buf,&iter,&endIter);15.160 + gtk_text_buffer_get_start_iter(buf,&iter);15.161 +15.162 + for( offset = 0, i=data->start; i<data->end; i+=16, offset+=16 ) {15.163 + char text[80];15.164 + sprintf(text, "%08X:", i );15.165 + gtk_text_buffer_insert( buf, &iter, text, 9 );15.166 + for( j=0; j<16; j++ ) {15.167 + if( j%4 == 0 )15.168 + gtk_text_buffer_insert( buf, &iter, " ", 1 );15.169 + if( i+j < data->end ) {15.170 + int oldVal = ((int)old_data[offset+j])&0xFF;15.171 + int newVal = ((int)new_data[offset+j])&0xFF;15.172 + sprintf(text, "%02X ", newVal);15.173 + if( oldVal == newVal )15.174 + gtk_text_buffer_insert( buf, &iter, text, 3 );15.175 + else15.176 + gtk_text_buffer_insert_with_tags( buf, &iter, text, 3,15.177 + changedTag, NULL );15.178 + } else {15.179 + gtk_text_buffer_insert( buf, &iter, " ", 3 );15.180 + }15.181 + }15.182 + gtk_text_buffer_insert( buf, &iter, " ", 2 );15.183 + for( j=0; j<16 && i+j < data->end; j++ ) {15.184 + int oldVal = ((int)old_data[offset+j])&0xFF;15.185 + int newVal = ((int)new_data[offset+j])&0xFF;15.186 + if( isprint(newVal) )15.187 + sprintf( text, "%c", newVal );15.188 + else strcpy( text, "." );15.189 + if( oldVal == newVal )15.190 + gtk_text_buffer_insert( buf, &iter, text, 1 );15.191 + else15.192 + gtk_text_buffer_insert_with_tags( buf, &iter, text, 1,15.193 + changedTag, NULL );15.194 + }15.195 + gtk_text_buffer_insert( buf, &iter, "\n", 1 );15.196 + }15.197 +}
16.1 --- a/src/gui/gui.c Sat Mar 13 00:03:32 2004 +000016.2 +++ b/src/gui/gui.c Sat Aug 21 06:15:49 2004 +000016.3 @@ -9,164 +9,48 @@16.5 #define REGISTER_FONT "-*-fixed-medium-r-normal--12-*-*-*-*-*-iso8859-1"16.7 -#define REG_INT 016.8 -#define REG_FLT 116.9 -#define REG_SPECIAL 216.10 -16.11 -struct reg_map_struct {16.12 - char *name;16.13 - int type;16.14 - void *value;16.15 -} reg_map[] = { {"R0", REG_INT, &sh4r.r[0]}, {"R1", REG_INT, &sh4r.r[1]},16.16 - {"R2", REG_INT, &sh4r.r[2]}, {"R3", REG_INT, &sh4r.r[3]},16.17 - {"R4", REG_INT, &sh4r.r[4]}, {"R5", REG_INT, &sh4r.r[5]},16.18 - {"R6", REG_INT, &sh4r.r[6]}, {"R7", REG_INT, &sh4r.r[7]},16.19 - {"R8", REG_INT, &sh4r.r[8]}, {"R9", REG_INT, &sh4r.r[9]},16.20 - {"R10",REG_INT, &sh4r.r[10]}, {"R11",REG_INT, &sh4r.r[11]},16.21 - {"R12",REG_INT, &sh4r.r[12]}, {"R13",REG_INT, &sh4r.r[13]},16.22 - {"R14",REG_INT, &sh4r.r[14]}, {"R15",REG_INT, &sh4r.r[15]},16.23 - {"SR", REG_INT, &sh4r.sr}, {"GBR", REG_INT, &sh4r.gbr},16.24 - {"SSR",REG_INT, &sh4r.ssr}, {"SPC", REG_INT, &sh4r.spc},16.25 - {"SGR",REG_INT, &sh4r.sgr}, {"DBR", REG_INT, &sh4r.dbr},16.26 - {"VBR",REG_INT, &sh4r.vbr},16.27 - {"PC", REG_INT, &sh4r.pc}, {"PR", REG_INT, &sh4r.pr},16.28 - {"MACL",REG_INT, &sh4r.mac},{"MACH",REG_INT, ((uint32_t *)&sh4r.mac)+1},16.29 - {"FPUL", REG_INT, &sh4r.fpul}, {"FPSCR", REG_INT, &sh4r.fpscr},16.30 - {NULL, 0, NULL} };16.31 -16.32 -GtkCList *msgs, *regs, *disasm;16.33 GdkColor clrNormal, clrChanged, clrError, clrWarn, clrPC, clrDebug, clrTrace;16.34 -GtkEntry *page_field;16.35 -GnomeAppBar *appbar;16.36 -GtkProgressBar *icounter;16.37 -char icounter_text[16];16.38 -GtkStyle *fixed_list_style;16.39 PangoFontDescription *fixed_list_font;16.40 -GdkColor *msg_colors[] = { &clrError, &clrError, &clrWarn, &clrNormal,16.41 - &clrDebug, &clrTrace };16.42 -16.43 -struct sh4_registers sh4r_s;16.44 -int disasm_from = -1, disasm_to = -1;16.45 -int disasm_pc = -1;16.47 void open_file_callback(GtkWidget *btn, gpointer user_data);16.48 void open_file_canceled(GtkWidget *btn, gpointer user_data);16.49 void open_file( char *filename );16.51 -/*16.52 - * Check for changed registers and update the display16.53 - */16.54 -void update_registers( void )16.55 -{16.56 - int i;16.57 - for( i=0; reg_map[i].name != NULL; i++ ) {16.58 - if( reg_map[i].type == REG_INT ) {16.59 - /* Yes this _is_ probably fairly evil */16.60 - if( *((uint32_t *)reg_map[i].value) !=16.61 - *((uint32_t *)((char *)&sh4r_s + ((char *)reg_map[i].value - (char *)&sh4r))) ) {16.62 - char buf[20];16.63 - sprintf( buf, "%08X", *((uint32_t *)reg_map[i].value) );16.64 - gtk_clist_set_text( regs, i, 1, buf );16.65 - gtk_clist_set_foreground( regs, i, &clrChanged );16.66 - } else {16.67 - gtk_clist_set_foreground( regs, i, &clrNormal );16.68 - }16.69 - } else {16.70 - if( *((float *)reg_map[i].value) !=16.71 - *((float *)((char *)&sh4r_s + ((char *)reg_map[i].value - (char *)&sh4r))) ) {16.72 - char buf[20];16.73 - sprintf( buf, "%f", *((float *)reg_map[i].value) );16.74 - gtk_clist_set_text( regs, i, 1, buf );16.75 - gtk_clist_set_foreground( regs, i, &clrChanged );16.76 - } else {16.77 - gtk_clist_set_foreground( regs, i, &clrNormal );16.78 - }16.79 - }16.80 - }16.81 - if( sh4r.pc != sh4r_s.pc )16.82 - set_disassembly_pc( sh4r.pc, FALSE );16.83 - memcpy( &sh4r_s, &sh4r, sizeof(sh4r) );16.84 +void init_gui() {16.85 + GdkColormap *map;16.86 +16.87 + clrNormal.red = clrNormal.green = clrNormal.blue = 0;16.88 + clrChanged.red = clrChanged.green = 64*256;16.89 + clrChanged.blue = 154*256;16.90 + clrError.red = 65535;16.91 + clrError.green = clrError.blue = 64*256;16.92 + clrPC.red = 32*256;16.93 + clrPC.green = 170*256;16.94 + clrPC.blue = 52*256;16.95 + clrWarn = clrChanged;16.96 + clrTrace.red = 156*256;16.97 + clrTrace.green = 78*256;16.98 + clrTrace.blue = 201*256;16.99 + clrDebug = clrPC;16.101 + map = gdk_colormap_new(gdk_visual_get_best(), TRUE);16.102 + gdk_colormap_alloc_color(map, &clrNormal, TRUE, TRUE);16.103 + gdk_colormap_alloc_color(map, &clrChanged, TRUE, TRUE);16.104 + gdk_colormap_alloc_color(map, &clrError, TRUE, TRUE);16.105 + gdk_colormap_alloc_color(map, &clrWarn, TRUE, TRUE);16.106 + gdk_colormap_alloc_color(map, &clrPC, TRUE, TRUE);16.107 + gdk_colormap_alloc_color(map, &clrDebug, TRUE, TRUE);16.108 + gdk_colormap_alloc_color(map, &clrTrace, TRUE, TRUE);16.109 + fixed_list_font = pango_font_description_from_string("Courier 10");16.110 +}16.111 +16.112 +void update_gui(void) {16.113 + update_registers();16.114 update_icount();16.115 update_mmr_win();16.116 + dump_win_update_all();16.117 }16.119 -void update_icount( void )16.120 -{16.121 - sprintf( icounter_text, "%d", sh4r.icount );16.122 - gtk_progress_bar_set_text( icounter, icounter_text );16.123 -}16.124 -16.125 -void set_disassembly_region( unsigned int page )16.126 -{16.127 - uint32_t i, posn;16.128 - uint16_t op;16.129 - char buf[80];16.130 - char addr[10];16.131 - char opcode[6] = "";16.132 - char *arr[4] = { addr, " ", opcode, buf };16.133 - unsigned int from = page & 0xFFFFF000;16.134 - unsigned int to = from + 4096;16.135 -16.136 - gtk_clist_clear(disasm);16.137 -16.138 - sprintf( addr, "%08X", from );16.139 - gtk_entry_set_text( page_field, addr );16.140 -16.141 - if( !mem_has_page( from ) ) {16.142 - arr[3] = "This page is currently unmapped";16.143 - gtk_clist_append( disasm, arr );16.144 - gtk_clist_set_foreground( disasm, 0, &clrError );16.145 - } else {16.146 - for( i=from; i<to; i+=2 ) {16.147 - sh4_disasm_instruction( i, buf, sizeof(buf) );16.148 - sprintf( addr, "%08X", i );16.149 - op = mem_read_phys_word(i);16.150 - sprintf( opcode, "%02X %02X", op&0xFF, op>>8 );16.151 - posn = gtk_clist_append( disasm, arr );16.152 - if( buf[0] == '?' )16.153 - gtk_clist_set_foreground( disasm, posn, &clrWarn );16.154 - }16.155 - if( disasm_pc != -1 && disasm_pc >= from && disasm_pc < to )16.156 - gtk_clist_set_foreground( disasm, (disasm_pc - from)>>1,16.157 - &clrPC );16.158 - }16.159 -16.160 - if( page != from ) { /* not a page boundary */16.161 - gtk_clist_moveto( disasm, (page-from)>>1, 0, 0.5, 0.0 );16.162 - }16.163 - disasm_from = from;16.164 - disasm_to = to;16.165 -}16.166 -16.167 -void jump_to_disassembly( unsigned int addr, gboolean select )16.168 -{16.169 - int row;16.170 -16.171 - if( addr < disasm_from || addr >= disasm_to )16.172 - set_disassembly_region(addr);16.173 -16.174 - row = (addr-disasm_from)>>1;16.175 - if(select) {16.176 - gtk_clist_select_row( disasm, row, 0 );16.177 - }16.178 - if( gtk_clist_row_is_visible( disasm, row ) != GTK_VISIBILITY_FULL ){16.179 - gtk_clist_moveto( disasm, row, 0, 0.5, 0.0 );16.180 - }16.181 -}16.182 -16.183 -void set_disassembly_pc( unsigned int pc, gboolean select )16.184 -{16.185 - int row;16.186 -16.187 - jump_to_disassembly( pc, select );16.188 - if( disasm_pc != -1 && disasm_pc >= disasm_from && disasm_pc < disasm_to )16.189 - gtk_clist_set_foreground( disasm, (disasm_pc - disasm_from)>>1,16.190 - &clrNormal );16.191 - row = (pc - disasm_from)>>1;16.192 - gtk_clist_set_foreground( disasm, row, &clrPC );16.193 - disasm_pc = pc;16.194 -}16.196 void open_file_callback(GtkWidget *btn, gpointer user_data) {16.197 GtkFileSelection *file = GTK_FILE_SELECTION(user_data);16.198 @@ -193,90 +77,23 @@16.199 gtk_widget_show( file );16.200 }16.202 -void emit( int level, int source, char *msg, ... )16.203 +uint32_t gtk_entry_get_hex_value( GtkEntry *entry, uint32_t defaultValue )16.204 {16.205 - char buf[20], addr[10] = "", *p;16.206 - char *arr[3] = {buf, addr};16.207 - int posn;16.208 - time_t tm = time(NULL);16.209 - va_list ap;16.210 -16.211 - va_start(ap, msg);16.212 - p = g_strdup_vprintf( msg, ap );16.213 - strftime( buf, sizeof(buf), "%H:%M:%S", localtime(&tm) );16.214 - if( source != -1 )16.215 - sprintf( addr, "%08X", sh4r.pc );16.216 - arr[2] = p;16.217 - posn = gtk_clist_append(msgs, arr);16.218 - free(p);16.219 - va_end(ap);16.220 -16.221 - gtk_clist_set_foreground( msgs, posn, msg_colors[level] );16.222 - gtk_clist_moveto( msgs, posn, 0, 1.0, 0.0 );16.223 -16.224 - /* emit _really_ slows down the emu, to the point where the gui can be16.225 - * completely unresponsive if I don't include this:16.226 - */16.227 - while( gtk_events_pending() )16.228 - gtk_main_iteration();16.229 + gchar *text = gtk_entry_get_text(entry);16.230 + if( text == NULL )16.231 + return defaultValue;16.232 + gchar *endptr;16.233 + uint32_t value = strtoul( text, &endptr, 16 );16.234 + if( text == endptr ) { /* invalid input */16.235 + value = defaultValue;16.236 + gtk_entry_set_hex_value( entry, value );16.237 + }16.238 + return value;16.239 }16.241 -void init_debug_win(GtkWidget *win)16.242 +void gtk_entry_set_hex_value( GtkEntry *entry, uint32_t value )16.243 {16.244 - GdkColormap *map;16.245 - GdkFont *regfont;16.246 - GtkAdjustment *adj;16.247 - int i;16.248 - char buf[20];16.249 - char *arr[2];16.250 -16.251 - clrNormal.red = clrNormal.green = clrNormal.blue = 0;16.252 - clrChanged.red = clrChanged.green = 64*256;16.253 - clrChanged.blue = 154*256;16.254 - clrError.red = 65535;16.255 - clrError.green = clrError.blue = 64*256;16.256 - clrPC.red = 32*256;16.257 - clrPC.green = 170*256;16.258 - clrPC.blue = 52*256;16.259 - clrWarn = clrChanged;16.260 - clrTrace.red = 156*256;16.261 - clrTrace.green = 78*256;16.262 - clrTrace.blue = 201*256;16.263 - clrDebug = clrPC;16.264 -16.265 - map = gdk_colormap_new(gdk_visual_get_best(), TRUE);16.266 - gdk_colormap_alloc_color(map, &clrNormal, TRUE, TRUE);16.267 - gdk_colormap_alloc_color(map, &clrChanged, TRUE, TRUE);16.268 - gdk_colormap_alloc_color(map, &clrError, TRUE, TRUE);16.269 - gdk_colormap_alloc_color(map, &clrWarn, TRUE, TRUE);16.270 - gdk_colormap_alloc_color(map, &clrPC, TRUE, TRUE);16.271 - gdk_colormap_alloc_color(map, &clrDebug, TRUE, TRUE);16.272 - gdk_colormap_alloc_color(map, &clrTrace, TRUE, TRUE);16.273 -16.274 - fixed_list_font = pango_font_description_from_string("Courier 10");16.275 - regs = gtk_object_get_data(GTK_OBJECT(win), "reg_list");16.276 - arr[1] = buf;16.277 - for( i=0; reg_map[i].name != NULL; i++ ) {16.278 - arr[0] = reg_map[i].name;16.279 - if( reg_map[i].type == REG_INT )16.280 - sprintf( buf, "%08X", *((uint32_t *)reg_map[i].value) );16.281 - else16.282 - sprintf( buf, "%f", *((float *)reg_map[i].value) );16.283 - gtk_clist_append( regs, arr );16.284 - }16.285 -16.286 - fixed_list_style = gtk_style_copy( gtk_rc_get_style( GTK_WIDGET(regs) ) );16.287 - if( fixed_list_style != NULL ) {16.288 - fixed_list_style->font_desc = fixed_list_font;16.289 - gtk_widget_set_style( GTK_WIDGET(regs), fixed_list_style );16.290 - }16.291 -16.292 - msgs = gtk_object_get_data(GTK_OBJECT(win), "output_list");16.293 - disasm = gtk_object_get_data(GTK_OBJECT(win), "disasm_list");16.294 - gtk_clist_set_column_width( disasm, 1, 16 );16.295 - page_field = gtk_object_get_data(GTK_OBJECT(win), "page_field");16.296 -16.297 - appbar = gtk_object_get_data(GTK_OBJECT(win), "debug_appbar");16.298 - icounter = gnome_appbar_get_progress( appbar );16.299 - gtk_progress_bar_set_text(icounter, "1");16.300 + char buf[10];16.301 + sprintf( buf, "%08X", value );16.302 + gtk_entry_set_text( entry, buf );16.303 }
17.1 --- a/src/gui/gui.h Sat Mar 13 00:03:32 2004 +000017.2 +++ b/src/gui/gui.h Sat Aug 21 06:15:49 2004 +000017.3 @@ -14,21 +14,28 @@17.4 #endif17.5 #endif17.7 +void init_gui(void);17.8 +void update_gui(void);17.9 +17.10 void init_debug_win(GtkWidget *);17.11 void open_file_dialog( void );17.12 void update_mmr_win( void );17.13 void init_mmr_win( void );17.14 void update_registers( void );17.15 void update_icount( void );17.16 +void dump_win_update_all( void );17.17 void set_disassembly_region( unsigned int page );17.18 void set_disassembly_pc( unsigned int pc, gboolean select );17.19 void jump_to_disassembly( unsigned int addr, gboolean select );17.21 -extern GtkStyle *fixed_list_style;17.22 -extern GdkColor clrNormal, clrChanged, clrError, clrWarn, clrPC;17.23 +extern PangoFontDescription *fixed_list_font;17.24 +extern GdkColor clrNormal, clrChanged, clrError, clrWarn,17.25 + clrPC, clrDebug, clrTrace;17.27 void mmr_open_win( void );17.28 void mmr_close_win( void );17.29 +uint32_t gtk_entry_get_hex_value( GtkEntry *entry, uint32_t defaultValue );17.30 +void gtk_entry_set_hex_value( GtkEntry *entry, uint32_t value );17.32 #ifdef __cplusplus17.33 }
18.1 --- a/src/gui/interface.c Sat Mar 13 00:03:32 2004 +000018.2 +++ b/src/gui/interface.c Sat Aug 21 06:15:49 2004 +000018.3 @@ -28,49 +28,26 @@18.5 static GnomeUIInfo file1_menu_uiinfo[] =18.6 {18.7 - {18.8 - GNOME_APP_UI_ITEM, N_("gtk-new"),18.9 - NULL,18.10 - (gpointer) on_new_file1_activate, NULL, NULL,18.11 - GNOME_APP_PIXMAP_NONE, NULL,18.12 - 0, (GdkModifierType) 0, NULL18.13 - },18.14 - {18.15 - GNOME_APP_UI_ITEM, N_("gtk-open"),18.16 - NULL,18.17 - (gpointer) on_open1_activate, NULL, NULL,18.18 - GNOME_APP_PIXMAP_NONE, NULL,18.19 - 0, (GdkModifierType) 0, NULL18.20 - },18.21 - {18.22 - GNOME_APP_UI_ITEM, N_("gtk-save"),18.23 - NULL,18.24 - (gpointer) on_save1_activate, NULL, NULL,18.25 - GNOME_APP_PIXMAP_NONE, NULL,18.26 - 0, (GdkModifierType) 0, NULL18.27 - },18.28 - {18.29 - GNOME_APP_UI_ITEM, N_("gtk-save-as"),18.30 - NULL,18.31 - (gpointer) on_save_as1_activate, NULL, NULL,18.32 - GNOME_APP_PIXMAP_NONE, NULL,18.33 - 0, (GdkModifierType) 0, NULL18.34 - },18.35 + GNOMEUIINFO_MENU_NEW_ITEM (N_("_New"), NULL, on_new_file1_activate, NULL),18.36 + GNOMEUIINFO_MENU_OPEN_ITEM (on_open1_activate, NULL),18.37 + GNOMEUIINFO_MENU_SAVE_ITEM (on_save1_activate, NULL),18.38 + GNOMEUIINFO_MENU_SAVE_AS_ITEM (on_save_as1_activate, NULL),18.39 GNOMEUIINFO_SEPARATOR,18.40 - {18.41 - GNOME_APP_UI_ITEM, N_("gtk-quit"),18.42 - NULL,18.43 - (gpointer) on_exit1_activate, NULL, NULL,18.44 - GNOME_APP_PIXMAP_NONE, NULL,18.45 - 0, (GdkModifierType) 0, NULL18.46 - },18.47 + GNOMEUIINFO_MENU_EXIT_ITEM (on_exit1_activate, NULL),18.48 GNOMEUIINFO_END18.49 };18.51 static GnomeUIInfo view1_menu_uiinfo[] =18.52 {18.53 {18.54 - GNOME_APP_UI_ITEM, N_("Mem mapped Regs"),18.55 + GNOME_APP_UI_ITEM, N_("Memory..."),18.56 + NULL,18.57 + (gpointer) on_view_memory_activate, NULL, NULL,18.58 + GNOME_APP_PIXMAP_NONE, NULL,18.59 + 0, (GdkModifierType) 0, NULL18.60 + },18.61 + {18.62 + GNOME_APP_UI_ITEM, N_("Mem mapped Regs..."),18.63 NULL,18.64 (gpointer) on_mem_mapped_regs1_activate, NULL, NULL,18.65 GNOME_APP_PIXMAP_NONE, NULL,18.66 @@ -81,25 +58,13 @@18.68 static GnomeUIInfo settings1_menu_uiinfo[] =18.69 {18.70 - {18.71 - GNOME_APP_UI_ITEM, N_("gtk-preferences"),18.72 - NULL,18.73 - (gpointer) on_preferences1_activate, NULL, NULL,18.74 - GNOME_APP_PIXMAP_NONE, NULL,18.75 - 0, (GdkModifierType) 0, NULL18.76 - },18.77 + GNOMEUIINFO_MENU_PREFERENCES_ITEM (on_preferences1_activate, NULL),18.78 GNOMEUIINFO_END18.79 };18.81 static GnomeUIInfo help1_menu_uiinfo[] =18.82 {18.83 - {18.84 - GNOME_APP_UI_ITEM, N_("gnome-stock-about"),18.85 - NULL,18.86 - (gpointer) on_about1_activate, NULL, NULL,18.87 - GNOME_APP_PIXMAP_NONE, NULL,18.88 - 0, (GdkModifierType) 0, NULL18.89 - },18.90 + GNOMEUIINFO_MENU_ABOUT_ITEM (on_about1_activate, NULL),18.91 GNOMEUIINFO_END18.92 };18.94 @@ -466,7 +431,8 @@18.95 GLADE_HOOKUP_OBJECT (debug_win, file1_menu_uiinfo[4].widget, "separator1");18.96 GLADE_HOOKUP_OBJECT (debug_win, file1_menu_uiinfo[5].widget, "exit1");18.97 GLADE_HOOKUP_OBJECT (debug_win, menubar1_uiinfo[1].widget, "view1");18.98 - GLADE_HOOKUP_OBJECT (debug_win, view1_menu_uiinfo[0].widget, "mem_mapped_regs1");18.99 + GLADE_HOOKUP_OBJECT (debug_win, view1_menu_uiinfo[0].widget, "view_memory");18.100 + GLADE_HOOKUP_OBJECT (debug_win, view1_menu_uiinfo[1].widget, "mem_mapped_regs1");18.101 GLADE_HOOKUP_OBJECT (debug_win, menubar1_uiinfo[2].widget, "settings1");18.102 GLADE_HOOKUP_OBJECT (debug_win, settings1_menu_uiinfo[0].widget, "preferences1");18.103 GLADE_HOOKUP_OBJECT (debug_win, menubar1_uiinfo[3].widget, "help1");18.104 @@ -603,3 +569,200 @@18.105 return about_win;18.106 }18.108 +GtkWidget*18.109 +create_dump_win (void)18.110 +{18.111 + GtkWidget *dump_win;18.112 + GtkWidget *vbox3;18.113 + GtkWidget *hbox2;18.114 + GtkWidget *label34;18.115 + GtkWidget *dump_from;18.116 + GtkWidget *label35;18.117 + GtkWidget *dump_to;18.118 + GtkWidget *dump_view_button;18.119 + GtkWidget *label36;18.120 + GtkWidget *scrolledwindow9;18.121 + GtkWidget *dump_text;18.122 +18.123 + dump_win = gtk_window_new (GTK_WINDOW_TOPLEVEL);18.124 + gtk_window_set_title (GTK_WINDOW (dump_win), _("Memory dump"));18.125 +18.126 + vbox3 = gtk_vbox_new (FALSE, 0);18.127 + gtk_widget_show (vbox3);18.128 + gtk_container_add (GTK_CONTAINER (dump_win), vbox3);18.129 +18.130 + hbox2 = gtk_hbox_new (FALSE, 0);18.131 + gtk_widget_show (hbox2);18.132 + gtk_box_pack_start (GTK_BOX (vbox3), hbox2, FALSE, TRUE, 3);18.133 +18.134 + label34 = gtk_label_new (_(" From "));18.135 + gtk_widget_show (label34);18.136 + gtk_box_pack_start (GTK_BOX (hbox2), label34, FALSE, FALSE, 0);18.137 +18.138 + dump_from = gtk_entry_new ();18.139 + gtk_widget_show (dump_from);18.140 + gtk_box_pack_start (GTK_BOX (hbox2), dump_from, FALSE, TRUE, 0);18.141 +18.142 + label35 = gtk_label_new (_(" To "));18.143 + gtk_widget_show (label35);18.144 + gtk_box_pack_start (GTK_BOX (hbox2), label35, FALSE, FALSE, 0);18.145 +18.146 + dump_to = gtk_entry_new ();18.147 + gtk_widget_show (dump_to);18.148 + gtk_box_pack_start (GTK_BOX (hbox2), dump_to, FALSE, TRUE, 0);18.149 +18.150 + dump_view_button = gtk_button_new_with_mnemonic (_("View"));18.151 + gtk_widget_show (dump_view_button);18.152 + gtk_box_pack_start (GTK_BOX (hbox2), dump_view_button, FALSE, FALSE, 0);18.153 +18.154 + label36 = gtk_label_new (_(" "));18.155 + gtk_widget_show (label36);18.156 + gtk_box_pack_start (GTK_BOX (hbox2), label36, TRUE, TRUE, 0);18.157 +18.158 + scrolledwindow9 = gtk_scrolled_window_new (NULL, NULL);18.159 + gtk_widget_show (scrolledwindow9);18.160 + gtk_box_pack_start (GTK_BOX (vbox3), scrolledwindow9, TRUE, TRUE, 0);18.161 + gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolledwindow9), GTK_SHADOW_IN);18.162 +18.163 + dump_text = gtk_text_view_new ();18.164 + gtk_widget_show (dump_text);18.165 + gtk_container_add (GTK_CONTAINER (scrolledwindow9), dump_text);18.166 +18.167 + /* Store pointers to all widgets, for use by lookup_widget(). */18.168 + GLADE_HOOKUP_OBJECT_NO_REF (dump_win, dump_win, "dump_win");18.169 + GLADE_HOOKUP_OBJECT (dump_win, vbox3, "vbox3");18.170 + GLADE_HOOKUP_OBJECT (dump_win, hbox2, "hbox2");18.171 + GLADE_HOOKUP_OBJECT (dump_win, label34, "label34");18.172 + GLADE_HOOKUP_OBJECT (dump_win, dump_from, "dump_from");18.173 + GLADE_HOOKUP_OBJECT (dump_win, label35, "label35");18.174 + GLADE_HOOKUP_OBJECT (dump_win, dump_to, "dump_to");18.175 + GLADE_HOOKUP_OBJECT (dump_win, dump_view_button, "dump_view_button");18.176 + GLADE_HOOKUP_OBJECT (dump_win, label36, "label36");18.177 + GLADE_HOOKUP_OBJECT (dump_win, scrolledwindow9, "scrolledwindow9");18.178 + GLADE_HOOKUP_OBJECT (dump_win, dump_text, "dump_text");18.179 +18.180 + return dump_win;18.181 +}18.182 +18.183 +GtkWidget*18.184 +create_watch_win (void)18.185 +{18.186 + GtkWidget *watch_win;18.187 + GtkWidget *vbox4;18.188 + GtkWidget *hbox4;18.189 + GtkWidget *label37;18.190 + GtkWidget *watch_start_addr;18.191 + GtkWidget *label38;18.192 + GtkWidget *watch_end_addr;18.193 + GtkWidget *label39;18.194 + GtkWidget *combo1;18.195 + GtkWidget *watch_type;18.196 + GtkWidget *button_add_watch;18.197 + GtkWidget *scrolledwindow10;18.198 + GtkWidget *treeview1;18.199 + GtkWidget *hbox5;18.200 + GtkWidget *label40;18.201 + GtkWidget *button_clear_all;18.202 + GtkWidget *button_close;18.203 +18.204 + watch_win = gtk_window_new (GTK_WINDOW_TOPLEVEL);18.205 + gtk_window_set_title (GTK_WINDOW (watch_win), _("Watchpoints"));18.206 +18.207 + vbox4 = gtk_vbox_new (FALSE, 0);18.208 + gtk_widget_show (vbox4);18.209 + gtk_container_add (GTK_CONTAINER (watch_win), vbox4);18.210 +18.211 + hbox4 = gtk_hbox_new (FALSE, 0);18.212 + gtk_widget_show (hbox4);18.213 + gtk_box_pack_start (GTK_BOX (vbox4), hbox4, FALSE, TRUE, 3);18.214 +18.215 + label37 = gtk_label_new (_("Start addr "));18.216 + gtk_widget_show (label37);18.217 + gtk_box_pack_start (GTK_BOX (hbox4), label37, FALSE, FALSE, 3);18.218 +18.219 + watch_start_addr = gtk_entry_new ();18.220 + gtk_widget_show (watch_start_addr);18.221 + gtk_box_pack_start (GTK_BOX (hbox4), watch_start_addr, FALSE, TRUE, 0);18.222 +18.223 + label38 = gtk_label_new (_("End addr"));18.224 + gtk_widget_show (label38);18.225 + gtk_box_pack_start (GTK_BOX (hbox4), label38, FALSE, FALSE, 3);18.226 +18.227 + watch_end_addr = gtk_entry_new ();18.228 + gtk_widget_show (watch_end_addr);18.229 + gtk_box_pack_start (GTK_BOX (hbox4), watch_end_addr, FALSE, TRUE, 0);18.230 +18.231 + label39 = gtk_label_new (_("Type"));18.232 + gtk_widget_show (label39);18.233 + gtk_box_pack_start (GTK_BOX (hbox4), label39, FALSE, FALSE, 3);18.234 +18.235 + combo1 = gtk_combo_new ();18.236 + g_object_set_data (G_OBJECT (GTK_COMBO (combo1)->popwin),18.237 + "GladeParentKey", combo1);18.238 + gtk_widget_show (combo1);18.239 + gtk_box_pack_start (GTK_BOX (hbox4), combo1, TRUE, TRUE, 0);18.240 +18.241 + watch_type = GTK_COMBO (combo1)->entry;18.242 + gtk_widget_show (watch_type);18.243 +18.244 + button_add_watch = gtk_button_new_with_mnemonic (_("Add Watch"));18.245 + gtk_widget_show (button_add_watch);18.246 + gtk_box_pack_start (GTK_BOX (hbox4), button_add_watch, FALSE, FALSE, 3);18.247 +18.248 + scrolledwindow10 = gtk_scrolled_window_new (NULL, NULL);18.249 + gtk_widget_show (scrolledwindow10);18.250 + gtk_box_pack_start (GTK_BOX (vbox4), scrolledwindow10, TRUE, TRUE, 0);18.251 +18.252 + treeview1 = gtk_tree_view_new ();18.253 + gtk_widget_show (treeview1);18.254 + gtk_container_add (GTK_CONTAINER (scrolledwindow10), treeview1);18.255 + gtk_tree_view_set_enable_search (GTK_TREE_VIEW (treeview1), FALSE);18.256 +18.257 + hbox5 = gtk_hbox_new (FALSE, 0);18.258 + gtk_widget_show (hbox5);18.259 + gtk_box_pack_start (GTK_BOX (vbox4), hbox5, FALSE, TRUE, 3);18.260 +18.261 + label40 = gtk_label_new ("");18.262 + gtk_widget_show (label40);18.263 + gtk_box_pack_start (GTK_BOX (hbox5), label40, TRUE, TRUE, 0);18.264 +18.265 + button_clear_all = gtk_button_new_with_mnemonic (_("Clear all"));18.266 + gtk_widget_show (button_clear_all);18.267 + gtk_box_pack_start (GTK_BOX (hbox5), button_clear_all, FALSE, FALSE, 3);18.268 +18.269 + button_close = gtk_button_new_with_mnemonic (_("Close"));18.270 + gtk_widget_show (button_close);18.271 + gtk_box_pack_start (GTK_BOX (hbox5), button_close, FALSE, FALSE, 5);18.272 +18.273 + g_signal_connect ((gpointer) button_add_watch, "clicked",18.274 + G_CALLBACK (on_button_add_watch_clicked),18.275 + NULL);18.276 + g_signal_connect ((gpointer) button_clear_all, "clicked",18.277 + G_CALLBACK (on_button_clear_all_clicked),18.278 + NULL);18.279 + g_signal_connect ((gpointer) button_close, "clicked",18.280 + G_CALLBACK (on_button_close_clicked),18.281 + NULL);18.282 +18.283 + /* Store pointers to all widgets, for use by lookup_widget(). */18.284 + GLADE_HOOKUP_OBJECT_NO_REF (watch_win, watch_win, "watch_win");18.285 + GLADE_HOOKUP_OBJECT (watch_win, vbox4, "vbox4");18.286 + GLADE_HOOKUP_OBJECT (watch_win, hbox4, "hbox4");18.287 + GLADE_HOOKUP_OBJECT (watch_win, label37, "label37");18.288 + GLADE_HOOKUP_OBJECT (watch_win, watch_start_addr, "watch_start_addr");18.289 + GLADE_HOOKUP_OBJECT (watch_win, label38, "label38");18.290 + GLADE_HOOKUP_OBJECT (watch_win, watch_end_addr, "watch_end_addr");18.291 + GLADE_HOOKUP_OBJECT (watch_win, label39, "label39");18.292 + GLADE_HOOKUP_OBJECT (watch_win, combo1, "combo1");18.293 + GLADE_HOOKUP_OBJECT (watch_win, watch_type, "watch_type");18.294 + GLADE_HOOKUP_OBJECT (watch_win, button_add_watch, "button_add_watch");18.295 + GLADE_HOOKUP_OBJECT (watch_win, scrolledwindow10, "scrolledwindow10");18.296 + GLADE_HOOKUP_OBJECT (watch_win, treeview1, "treeview1");18.297 + GLADE_HOOKUP_OBJECT (watch_win, hbox5, "hbox5");18.298 + GLADE_HOOKUP_OBJECT (watch_win, label40, "label40");18.299 + GLADE_HOOKUP_OBJECT (watch_win, button_clear_all, "button_clear_all");18.300 + GLADE_HOOKUP_OBJECT (watch_win, button_close, "button_close");18.301 +18.302 + return watch_win;18.303 +}18.304 +
19.1 --- a/src/gui/interface.h Sat Mar 13 00:03:32 2004 +000019.2 +++ b/src/gui/interface.h Sat Aug 21 06:15:49 2004 +000019.3 @@ -5,3 +5,5 @@19.4 GtkWidget* create_debug_win (void);19.5 GtkWidget* create_mmr_win (void);19.6 GtkWidget* create_about_win (void);19.7 +GtkWidget* create_dump_win (void);19.8 +GtkWidget* create_watch_win (void);
20.1 --- /dev/null Thu Jan 01 00:00:00 1970 +000020.2 +++ b/src/gui/mmio_win.c Sat Aug 21 06:15:49 2004 +000020.3 @@ -0,0 +1,151 @@20.4 +#include <stdint.h>20.5 +#include <gnome.h>20.6 +#include "interface.h"20.7 +#include "gui.h"20.8 +#include "mem.h"20.9 +#include "mmio.h"20.10 +20.11 +GtkWidget *mmr_win;20.12 +GtkNotebook *mmr_book;20.13 +20.14 +static void printbits( char *out, int nbits, uint32_t value )20.15 +{20.16 + if( nbits < 32 ) {20.17 + int i;20.18 + for( i=32; i>nbits; i-- ) {20.19 + if( !(i % 8) ) *out++ = ' ';20.20 + *out++ = ' ';20.21 + }20.22 + }20.23 + while( nbits > 0 ) {20.24 + *out++ = (value&(1<<--nbits) ? '1' : '0');20.25 + if( !(nbits % 8) ) *out++ = ' ';20.26 + }20.27 + *out = '\0';20.28 +}20.29 +20.30 +static void printhex( char *out, int nbits, uint32_t value )20.31 +{20.32 + char tmp[10], *p = tmp;20.33 + int i;20.34 +20.35 + sprintf( tmp, "%08X", value );20.36 + for( i=32; i>0; i-=4, p++ ) {20.37 + if( i <= nbits ) *out++ = *p;20.38 + else *out++ = ' ';20.39 + }20.40 + *out = '\0';20.41 +}20.42 +20.43 +20.44 +static GtkCList *create_mmr_page( char *name )20.45 +{20.46 + GtkCList *list;20.47 + GtkWidget *scroll;20.48 + GtkWidget *tab;20.49 +20.50 + scroll = gtk_scrolled_window_new(NULL, NULL);20.51 + gtk_widget_show( scroll );20.52 + gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW(scroll),20.53 + GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS );20.54 + list = GTK_CLIST(gtk_clist_new(5));20.55 + gtk_clist_set_column_width(list, 0, 60);20.56 + gtk_clist_set_column_width(list, 1, 50);20.57 + gtk_clist_set_column_width(list, 2, 60);20.58 + gtk_clist_set_column_width(list, 3, 220);20.59 + gtk_clist_set_column_width(list, 4, 160);20.60 + gtk_clist_set_column_justification(list, 0, GTK_JUSTIFY_CENTER );20.61 + gtk_clist_set_column_justification(list, 2, GTK_JUSTIFY_CENTER );20.62 + gtk_clist_set_column_justification(list, 3, GTK_JUSTIFY_CENTER );20.63 + gtk_clist_set_column_title(list, 0, "Address");20.64 + gtk_clist_set_column_title(list, 1, "Register");20.65 + gtk_clist_set_column_title(list, 2, "Value");20.66 + gtk_clist_set_column_title(list, 3, "Bit Pattern");20.67 + gtk_clist_set_column_title(list, 4, "Description");20.68 + gtk_clist_column_titles_show(list);20.69 + gtk_widget_modify_font( GTK_WIDGET(list), fixed_list_font );20.70 + gtk_widget_show( GTK_WIDGET(list) );20.71 + tab = gtk_label_new(_(name));20.72 + gtk_widget_show( tab );20.73 + gtk_container_add( GTK_CONTAINER(scroll), GTK_WIDGET(list) );20.74 + gtk_notebook_append_page( mmr_book, scroll, tab );20.75 + gtk_object_set_data( GTK_OBJECT(mmr_win), name, list );20.76 + return list;20.77 +}20.78 +20.79 +void update_mmr_win( void )20.80 +{20.81 + int i,j, count = 0;20.82 + GtkCList *page, *all_page;20.83 + char data[10], bits[40];20.84 +20.85 + all_page = GTK_CLIST(gtk_object_get_data( GTK_OBJECT(mmr_win), "All" ));20.86 +20.87 + for( i=1; i < num_io_rgns; i++ ) {20.88 + page = GTK_CLIST(gtk_object_get_data( GTK_OBJECT(mmr_win),20.89 + io_rgn[i]->id ));20.90 + for( j=0; io_rgn[i]->ports[j].id != NULL; j++ ) {20.91 + if( *io_rgn[i]->ports[j].val !=20.92 + *(uint32_t *)(io_rgn[i]->save_mem+io_rgn[i]->ports[j].offset)){20.93 + int sz = io_rgn[i]->ports[j].width;20.94 + /* Changed */20.95 + printhex( data, sz, *io_rgn[i]->ports[j].val );20.96 + printbits( bits, sz, *io_rgn[i]->ports[j].val );20.97 +20.98 + gtk_clist_set_text( page, j, 2, data );20.99 + gtk_clist_set_text( page, j, 3, bits );20.100 + gtk_clist_set_foreground( page, j, &clrChanged );20.101 +20.102 + gtk_clist_set_text( all_page, count, 2, data );20.103 + gtk_clist_set_text( all_page, count, 3, bits );20.104 + gtk_clist_set_foreground( all_page, count, &clrChanged );20.105 +20.106 + } else {20.107 + gtk_clist_set_foreground( page, j, &clrNormal );20.108 + gtk_clist_set_foreground( all_page, count, &clrNormal );20.109 + }20.110 + count++;20.111 + }20.112 + memcpy( io_rgn[i]->save_mem, io_rgn[i]->mem, PAGE_SIZE );20.113 + }20.114 +}20.115 +20.116 +void init_mmr_win( void )20.117 +{20.118 + int i, j;20.119 + GtkCList *all_list;20.120 + mmr_win = create_mmr_win();20.121 + mmr_book = GTK_NOTEBOOK( gtk_object_get_data( GTK_OBJECT(mmr_win), "mmr_notebook" ));20.122 +20.123 + /* kill the dummy page glade insists on adding */20.124 + gtk_notebook_remove_page( mmr_book, 0 );20.125 +20.126 + all_list = create_mmr_page( "All" );20.127 + for( i=1; i < num_io_rgns; i++ ) {20.128 + GtkCList *list = create_mmr_page( io_rgn[i]->id );20.129 +20.130 + for( j=0; io_rgn[i]->ports[j].id != NULL; j++ ) {20.131 + int sz = io_rgn[i]->ports[j].width;20.132 + char addr[10], data[10], bits[40];20.133 + char *arr[] = { addr, io_rgn[i]->ports[j].id, data, bits,20.134 + io_rgn[i]->ports[j].desc };20.135 + sprintf( addr, "%08X",20.136 + io_rgn[i]->base + io_rgn[i]->ports[j].offset );20.137 + printhex( data, sz, *io_rgn[i]->ports[j].val );20.138 + printbits( bits, io_rgn[i]->ports[j].width,20.139 + *io_rgn[i]->ports[j].val );20.140 + gtk_clist_append( list, arr );20.141 + gtk_clist_append( all_list, arr );20.142 + }20.143 + }20.144 +}20.145 +20.146 +void mmr_open_win( void )20.147 +{20.148 + gtk_widget_show( mmr_win );20.149 +}20.150 +20.151 +void mmr_close_win( void )20.152 +{20.153 + gtk_widget_hide( mmr_win );20.154 +}
21.1 --- a/src/loader.c Sat Mar 13 00:03:32 2004 +000021.2 +++ b/src/loader.c Sat Aug 21 06:15:49 2004 +000021.3 @@ -59,7 +59,7 @@21.4 sh4_set_pc( BOOTSTRAP_LOAD_ADDR + 0x300 );21.5 set_disassembly_region( BOOTSTRAP_LOAD_ADDR );21.6 set_disassembly_pc( sh4r.pc, TRUE );21.7 - update_registers();21.8 + update_gui();21.9 } else {21.10 /* look for a valid ISO9660 header */21.11 lseek( fd, 32768, SEEK_SET );
22.1 --- a/src/machine.c Sat Mar 13 00:03:32 2004 +000022.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +000022.3 @@ -1,29 +0,0 @@22.4 -#include "dream.h"22.5 -#include "mem.h"22.6 -#include "aica.h"22.7 -#include "asic.h"22.8 -/* Central switchboard for the system */22.9 -22.10 -void machine_init( void )22.11 -{22.12 - mem_init();22.13 - sh4_init();22.14 - asic_init();22.15 - pvr2_init();22.16 - aica_init();22.17 -22.18 - mem_create_ram_region( 0x0C000000, 16 MB, MEM_REGION_MAIN );22.19 - mem_create_ram_region( 0x05000000, 8 MB, MEM_REGION_VIDEO );22.20 - mem_create_ram_region( 0x00800000, 2 MB, MEM_REGION_AUDIO );22.21 - mem_create_ram_region( 0x00703000, 8 KB, MEM_REGION_AUDIO_SCRATCH ); /*???*/22.22 - mem_load_rom( "dcboot.rom", 0x00000000, 0x00200000, 0x89f2b1a1 );22.23 - mem_load_rom( "dcflash.rom",0x00200000, 0x00020000, 0x357c3568 );22.24 -}22.25 -22.26 -void machine_reset( void )22.27 -{22.28 - sh4_reset();22.29 - mem_reset();22.30 -// pvr2_reset();22.31 - aica_reset();22.32 -}
23.1 --- a/src/main.c Sat Mar 13 00:03:32 2004 +000023.2 +++ b/src/main.c Sat Aug 21 06:15:49 2004 +000023.3 @@ -12,6 +12,7 @@23.4 #include "interface.h"23.5 #include "gui.h"23.6 #include "sh4core.h"23.7 +#include "mem.h"23.10 int23.11 @@ -24,16 +25,18 @@23.12 textdomain (PACKAGE);23.13 #endif23.14 gnome_init ("dreamon", VERSION, argc, argv);23.15 -23.16 + init_gui();23.17 debug_win = create_debug_win ();23.18 init_debug_win(debug_win);23.19 video_open();23.20 - machine_init();23.21 + dreamcast_init();23.22 init_mmr_win(); /* Note: must be done after sh4_init */23.23 sh4_reset();23.24 - update_registers();23.25 + update_gui();23.26 gtk_widget_show (debug_win);23.27 set_disassembly_region( 0xA0000000 );23.28 + // mem_new_watch( 0x0C204818, 0x0C204830, WATCH_WRITE );23.29 +23.30 emit( EMIT_INFO, -1, "DreamOn! ready..." );23.32 gtk_main ();
24.1 --- /dev/null Thu Jan 01 00:00:00 1970 +000024.2 +++ b/src/maple/controller.c Sat Aug 21 06:15:49 2004 +000024.3 @@ -0,0 +1,56 @@24.4 +#include <stdlib.h>24.5 +#include "dream.h"24.6 +#include "maple.h"24.7 +#include "maple/controller.h"24.8 +24.9 +void controller_attach( maple_device_t dev );24.10 +void controller_detach( maple_device_t dev );24.11 +int controller_get_cond( maple_device_t dev, int function, char *outbuf,24.12 + int *outlen );24.13 +24.14 +static struct maple_device base_controller = {24.15 + MAPLE_DEVICE_TAG, CONTROLLER_IDENT, CONTROLLER_VERSION, NULL, NULL,24.16 + controller_get_cond, NULL, NULL, NULL,24.17 + controller_attach, controller_detach };24.18 +24.19 +typedef struct controller_device {24.20 + struct maple_device dev;24.21 + uint32_t condition[2];24.22 +} *controller_device_t;24.23 +24.24 +24.25 +24.26 +maple_device_t controller_new( )24.27 +{24.28 + controller_device_t dev = malloc( sizeof(struct controller_device) );24.29 + memcpy( dev, &base_controller, sizeof(base_controller) );24.30 + memset( dev->condition, 0, 8 );24.31 + dev->condition[0] = 0x0000FFFF;24.32 + return MAPLE_DEVICE(dev);24.33 +}24.34 +24.35 +24.36 +void controller_attach( maple_device_t dev )24.37 +{24.38 +24.39 +}24.40 +24.41 +void controller_detach( maple_device_t dev )24.42 +{24.43 +24.44 +}24.45 +24.46 +24.47 +int controller_get_cond( maple_device_t mdev, int function, char *outbuf,24.48 + int *outlen )24.49 +{24.50 + controller_device_t dev = (controller_device_t)mdev;24.51 + if( function == MAPLE_FUNC_CONTROLLER ) {24.52 + *outlen = 2;24.53 + memcpy( outbuf, dev->condition, 8 );24.54 + return 0;24.55 + } else {24.56 + return MAPLE_ERR_FUNC_UNSUP;24.57 + }24.58 +}24.59 +
25.1 --- /dev/null Thu Jan 01 00:00:00 1970 +000025.2 +++ b/src/maple/controller.h Sat Aug 21 06:15:49 2004 +000025.3 @@ -0,0 +1,37 @@25.4 +/* First word of controller condition */25.5 +#define BUTTON_C 0x00000001 /* not on standard controller */25.6 +#define BUTTON_B 0x0000000225.7 +#define BUTTON_A 0x0000000425.8 +#define BUTTON_START 0x0000000825.9 +#define BUTTON_DPAD_UP 0x0000001025.10 +#define BUTTON_DPAD_DOWN 0x0000002025.11 +#define BUTTON_DPAD_LEFT 0x0000004025.12 +#define BUTTON_DPAD_RIGHT 0x0000008025.13 +#define BUTTON_Z 0x00000100 /* not on standard controller */25.14 +#define BUTTON_Y 0x0000020025.15 +#define BUTTON_X 0x0000040025.16 +#define BUTTON_D 0x00000800 /* not on standard controller */25.17 +#define BUTTON_LEFT_TRIGGER 0xFF000000 /* Bitmask */25.18 +#define BUTTON_RIGHT_TRIGGER 0x00FF0000 /* Bitmask */25.19 +25.20 +/* Second word of controller condition (bitmasks) */25.21 +#define JOY_X_AXIS 0x000000FF25.22 +#define JOY_Y_AXIS 0x0000FF0025.23 +#define JOY2_X_AXIS 0x00FF0000 /* not on standard controller */25.24 +#define JOY2_Y_AXIS 0xFF000000 /* not on standard controller */25.25 +25.26 +/* Standard controller ID */25.27 +#define CONTROLLER_IDENT {0x00, 0x00, 0x00, 0x01, 0x00, 0x0f, 0x06, 0xfe, 0x00, 0x00, 0x00, 0x00, \25.28 +0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x44, 0x72, 0x65, 0x61, 0x6d, 0x63, 0x61, 0x73, 0x74, 0x20, \25.29 + 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, \25.30 + 0x20, 0x20, 0x20, 0x20, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x65, 0x64, 0x20, 0x42, 0x79, 0x20, \25.31 + 0x6f, 0x72, 0x20, 0x55, 0x6e, 0x64, 0x65, 0x72, 0x20, 0x4c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, \25.32 + 0x20, 0x46, 0x72, 0x6f, 0x6d, 0x20, 0x53, 0x45, 0x47, 0x41, 0x20, 0x45, 0x4e, 0x54, 0x45, 0x52, \25.33 + 0x50, 0x52, 0x49, 0x53, 0x45, 0x53, 0x2c, 0x4c, 0x54, 0x44, 0x2e, 0x20, 0x20, 0x20, 0x20, 0x20, \25.34 + 0xae, 0x01, 0xf4, 0x01}25.35 +#define CONTROLLER_VERSION {0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x31, 0x2e, 0x30, 0x31, \25.36 + 0x30, 0x2c, 0x31, 0x39, 0x39, 0x38, 0x2f, 0x30, 0x39, 0x2f, 0x32, 0x38, 0x2c, 0x33, 0x31, 0x35, \25.37 + 0x2d, 0x36, 0x32, 0x31, 0x31, 0x2d, 0x41, 0x42, 0x20, 0x20, 0x20, 0x2c, 0x41, 0x6e, 0x61, 0x6c, \25.38 + 0x6f, 0x67, 0x20, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x20, 0x3a, 0x20, 0x54, 0x68, 0x65, 0x20, \25.39 + 0x34, 0x74, 0x68, 0x20, 0x45, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x35, 0x2f, 0x38, 0x20, \25.40 + 0x20, 0x2b, 0x44, 0x46 }
26.1 --- a/src/maple/maple.c Sat Mar 13 00:03:32 2004 +000026.2 +++ b/src/maple/maple.c Sat Aug 21 06:15:49 2004 +000026.3 @@ -4,24 +4,213 @@26.4 #include "asic.h"26.5 #include "maple.h"26.7 +/**26.8 + * Input data looks like this:26.9 + * 0: transfer control word26.10 + * 0: length of data in words (not including 3 word header)26.11 + * 1: low bit = lightgun mode26.12 + * 2: low 2 bits = port # (0..3)26.13 + * 3: 0x80 = last packet, 0x00 = normal packet26.14 + * 4: output buffer address26.15 + * 8: Command word26.16 + * 8: command code26.17 + * 9: destination address26.18 + * 10: source address26.19 + * 11: length of data in words (not including 3 word header)26.20 + * 12: command-specific data26.21 + */26.22 +26.23 +/**26.24 + * array is [port][subperipheral], so [0][0] is main peripheral on port A,26.25 + * [1][2] is the second subperipheral on port B and so on.26.26 + */26.27 +maple_device_t maple_devices[4][6];26.28 +int maple_periph_mask[4];26.29 +#define GETBYTE(n) ((uint32_t)(buf[n]))26.30 +#define GETWORD(n) (*((uint32_t *)(buf+(n))))26.31 +#define PUTBYTE(n,x) (buf[n] = (char)x)26.32 +#define PUTWORD(n,x) (*((uint32_t *)(return_buf+(n))) = (x))26.33 +26.34 void maple_handle_buffer( uint32_t address ) {26.35 - uint32_t *buf = (uint32_t *)mem_get_region(address);26.36 + unsigned char *buf = (unsigned char *)mem_get_region(address);26.37 if( buf == NULL ) {26.38 ERROR( "Invalid or unmapped buffer passed to maple (0x%08X)", address );26.39 } else {26.40 - int last, port, length, cmd, recv_addr, send_addr, add_length;26.41 - int i = 0;26.42 - do {26.43 - last = buf[i]>>31; /* indicates last packet */26.44 - port = (buf[i]>>16)&0x03;26.45 - length = buf[i]&0x0F;26.46 - uint32_t return_address = buf[i+1];26.47 - cmd = buf[i+2]&0xFF;26.48 - recv_addr = (buf[i+2]>>8)&0xFF;26.49 - send_addr = (buf[i+2]>>16)&0xFF;26.50 - add_length = (buf[i+2]>>24)&0xFF;26.51 - char *return_buf = mem_get_region(return_address);26.52 + unsigned int last = 0;26.53 + int i = 0, count;26.54 + for( count=0; !last; count++ ) {26.55 + unsigned int port, length, gun, periph, periph_id, out_length;26.56 + unsigned int cmd, recv_addr, send_addr;26.57 + uint32_t return_addr;26.58 + unsigned char *return_buf;26.60 - } while( !last );26.61 + last = GETBYTE(3) & 0x80; /* indicates last packet */26.62 + port = GETBYTE(2) & 0x03;26.63 + gun = GETBYTE(1) & 0x01;26.64 + length = GETBYTE(0) & 0xFF;26.65 + return_addr = GETWORD(4);26.66 + if( return_addr == 0 ) {26.67 + /* ERROR */26.68 + }26.69 + return_buf = mem_get_region(return_addr);26.70 + cmd = GETBYTE(8);26.71 + recv_addr = GETBYTE(9);26.72 + send_addr = GETBYTE(10);26.73 + /* Sanity checks */26.74 + if( GETBYTE(11) != length ||26.75 + send_addr != (port<<6) ||26.76 + recv_addr >> 6 != port ||26.77 + return_buf == NULL ) {26.78 + /* ERROR */26.79 + }26.80 + periph = 0;26.81 + periph_id = recv_addr & 0x3F;26.82 + if( periph_id != 0x20 ) {26.83 + for( i=0;i<5;i++ ) {26.84 + if( periph_id == (1<<i) ) {26.85 + periph = i+1;26.86 + break;26.87 + }26.88 + }26.89 + if( periph == 0 ) { /* Bad setting */26.90 + /* ERROR */26.91 + }26.92 + }26.93 +26.94 + INFO( "Maple packet %d: Cmd %d on port %d device %d", count, cmd, port, periph );26.95 + maple_device_t dev = maple_devices[port][periph];26.96 + if( dev == NULL ) {26.97 + /* no device attached */26.98 + *((uint32_t *)return_buf) = -1;26.99 + } else {26.100 + int status, func, block;26.101 + out_length = 0;26.102 + switch( cmd ) {26.103 + case MAPLE_CMD_INFO:26.104 + status = MAPLE_RESP_INFO;26.105 + memcpy( return_buf+4, dev->ident, 112 );26.106 + out_length = 0x1C;26.107 + break;26.108 + case MAPLE_CMD_EXT_INFO:26.109 + status = MAPLE_RESP_EXT_INFO;26.110 + memcpy( return_buf+4, dev->ident, 192 );26.111 + out_length = 0x30;26.112 + break;26.113 + case MAPLE_CMD_RESET:26.114 + if( dev->reset == NULL )26.115 + status = MAPLE_RESP_ACK;26.116 + else status = dev->reset(dev);26.117 + break;26.118 + case MAPLE_CMD_SHUTDOWN:26.119 + if( dev->shutdown == NULL )26.120 + status = MAPLE_RESP_ACK;26.121 + else status = dev->shutdown(dev);26.122 + break;26.123 + case MAPLE_CMD_GET_COND:26.124 + func = GETWORD(12);26.125 + if( dev->get_condition == NULL )26.126 + status = MAPLE_ERR_CMD_UNKNOWN;26.127 + else status = dev->get_condition(dev, func,26.128 + return_buf+8,26.129 + &out_length );26.130 + if( status == 0 ) {26.131 + status = MAPLE_RESP_DATA;26.132 + PUTWORD(4,func);26.133 + }26.134 + break;26.135 + case MAPLE_CMD_SET_COND:26.136 + func = GETWORD(12);26.137 + if( dev->set_condition == NULL )26.138 + status = MAPLE_ERR_CMD_UNKNOWN;26.139 + else status = dev->set_condition(dev, func,26.140 + buf+16,26.141 + length);26.142 + if( status == 0 )26.143 + status = MAPLE_RESP_ACK;26.144 + break;26.145 + case MAPLE_CMD_READ_BLOCK:26.146 + func = GETWORD(12);26.147 + block = GETWORD(16);26.148 + if( dev->read_block == NULL )26.149 + status = MAPLE_ERR_CMD_UNKNOWN;26.150 + else status = dev->read_block(dev, func, block,26.151 + return_buf+12,26.152 + &out_length );26.153 + if( status == 0 ) {26.154 + status = MAPLE_RESP_DATA;26.155 + PUTWORD(4,func);26.156 + PUTWORD(8,block);26.157 + }26.158 + break;26.159 + case MAPLE_CMD_WRITE_BLOCK:26.160 + func = GETWORD(12);26.161 + block = GETWORD(16);26.162 + if( dev->write_block == NULL )26.163 + status = MAPLE_ERR_CMD_UNKNOWN;26.164 + else {26.165 + status = dev->write_block(dev, func, block,26.166 + buf+20, length);26.167 + if( status == 0 )26.168 + status = MAPLE_RESP_ACK;26.169 + }26.170 + break;26.171 + default:26.172 + status = MAPLE_ERR_CMD_UNKNOWN;26.173 + }26.174 + return_buf[0] = status;26.175 + return_buf[1] = send_addr;26.176 + return_buf[2] = recv_addr;26.177 + if( periph == 0 )26.178 + return_buf[2] |= maple_periph_mask[port];26.179 + return_buf[3] = out_length;26.180 + }26.181 + buf += 12 + (length<<2);26.182 + }26.183 + asic_event( EVENT_MAPLE_DMA );26.184 }26.185 }26.186 +26.187 +void maple_attach_device( maple_device_t dev, unsigned int port,26.188 + unsigned int periph ) {26.189 + assert( port < 4 );26.190 + assert( periph < 6 );26.191 +26.192 + if( maple_devices[port][periph] != NULL ) {26.193 + /* Detach existing peripheral first */26.194 + maple_detach_device( port, periph );26.195 + }26.196 +26.197 + maple_devices[port][periph] = dev;26.198 + if( periph != 0 )26.199 + maple_periph_mask[port] |= (1<<(periph-1));26.200 + else maple_periph_mask[port] |= 0x20;26.201 + if( dev->attach != NULL ) {26.202 + dev->attach( dev );26.203 + }26.204 +}26.205 +26.206 +void maple_detach_device( unsigned int port, unsigned int periph ) {26.207 + assert( port < 4 );26.208 + assert( periph < 6 );26.209 +26.210 + maple_device_t dev = maple_devices[port][periph];26.211 + if( dev == NULL ) /* already detached */26.212 + return;26.213 + maple_devices[port][periph] = NULL;26.214 + if( dev->detach != NULL ) {26.215 + dev->detach(dev);26.216 + }26.217 + if( periph == 0 ) {26.218 + /* If we detach the main peripheral, we also have to detach all the26.219 + * subperipherals, or the system could get quite confused26.220 + */26.221 + int i;26.222 + maple_periph_mask[port] = 0;26.223 + for( i=1; i<6; i++ ) {26.224 + maple_detach_device(port,i);26.225 + }26.226 + } else {26.227 + maple_periph_mask[port] &= (~(1<<(periph-1)));26.228 + }26.229 +26.230 +}
27.1 --- a/src/maple/maple.h Sat Mar 13 00:03:32 2004 +000027.2 +++ b/src/maple/maple.h Sat Aug 21 06:15:49 2004 +000027.3 @@ -10,8 +10,8 @@27.4 #define MAPLE_CMD_SHUTDOWN 4 /* Shutdown device */27.5 #define MAPLE_CMD_GET_COND 9 /* Get condition */27.6 #define MAPLE_CMD_MEM_INFO 10 /* Get memory information */27.7 -#define MAPLE_CMD_BLOCK_READ 11 /* Block read */27.8 -#define MAPLE_CMD_BLOCK_WRITE 12 /* Block write */27.9 +#define MAPLE_CMD_READ_BLOCK 11 /* Block read */27.10 +#define MAPLE_CMD_WRITE_BLOCK 12 /* Block write */27.11 #define MAPLE_CMD_SET_COND 14 /* Set condition */27.12 #define MAPLE_RESP_INFO 5 /* Device information response */27.13 #define MAPLE_RESP_EXT_INFO 6 /* Extended device information response */27.14 @@ -23,24 +23,42 @@27.15 #define MAPLE_ERR_RETRY -4 /* Retry command */27.16 #define MAPLE_ERR_FILE -5 /* File error? */27.18 -#define MAPLE_FUNC_CONTROLLER 0x00127.19 -#define MAPLE_FUNC_MEMORY 0x00227.20 -#define MAPLE_FUNC_LCD 0x00427.21 -#define MAPLE_FUNC_CLOCK 0x00827.22 -#define MAPLE_FUNC_MICROPHONE 0x01027.23 -#define MAPLE_FUNC_AR_GUN 0x02027.24 -#define MAPLE_FUNC_KEYBOARD 0x04027.25 -#define MAPLE_FUNC_LIGHT_GUN 0x08027.26 -#define MAPLE_FUNC_PURU_PURU 0x10027.27 -#define MAPLE_FUNC_MOUSE 0x20027.28 +#define MAPLE_FUNC_CONTROLLER 0x0100000027.29 +#define MAPLE_FUNC_MEMORY 0x0200000027.30 +#define MAPLE_FUNC_LCD 0x0400000027.31 +#define MAPLE_FUNC_CLOCK 0x0800000027.32 +#define MAPLE_FUNC_MICROPHONE 0x1000000027.33 +#define MAPLE_FUNC_AR_GUN 0x2000000027.34 +#define MAPLE_FUNC_KEYBOARD 0x4000000027.35 +#define MAPLE_FUNC_LIGHT_GUN 0x8000000027.36 +#define MAPLE_FUNC_PURU_PURU 0x0001000027.37 +#define MAPLE_FUNC_MOUSE 0x0002000027.38 +27.39 +#define MAPLE_DEVICE_TAG 0x4D41504C27.40 +#define MAPLE_DEVICE(x) ((maple_device_t)x)27.41 +27.42 +typedef struct maple_device {27.43 + uint32_t _tag;27.44 + unsigned char ident[112];27.45 + unsigned char version[80];27.46 + int (*reset)(struct maple_device *dev);27.47 + int (*shutdown)(struct maple_device *dev);27.48 + int (*get_condition)(struct maple_device *dev,27.49 + int function, char *outbuf, int *buflen);27.50 + int (*set_condition)(struct maple_device *dev,27.51 + int function, char *inbuf, int buflen);27.52 + int (*read_block)(struct maple_device *dev,27.53 + int function, uint32_t block, char *outbuf, int *buflen);27.54 + int (*write_block)(struct maple_device *dev,27.55 + int function, uint32_t block, char *inbuf, int buflen);27.56 + void (*attach)(struct maple_device *dev);27.57 + void (*detach)(struct maple_device *dev);27.58 +} *maple_device_t;27.59 +27.60 +maple_device_t controller_new(void);27.62 void maple_handle_buffer( uint32_t buffer );27.63 -27.64 -27.65 -struct maple_device_t {27.66 -27.67 -27.68 -};27.69 -27.70 +void maple_attach_device( maple_device_t dev, unsigned int port, unsigned int periph );27.71 +void maple_detach_device( unsigned int port, unsigned int periph );27.73 #endif /* !dream_maple_H */
28.1 --- a/src/pvr2/pvr2.c Sat Mar 13 00:03:32 2004 +000028.2 +++ b/src/pvr2/pvr2.c Sat Aug 21 06:15:49 2004 +000028.3 @@ -89,7 +89,7 @@28.4 {28.5 switch( reg ) {28.6 case BEAMPOS:28.7 - return sh4r.icount&0x20 ? 0x2000 : 0;28.8 + return sh4r.icount&0x20 ? 0x2000 : 1;28.9 default:28.10 return MMIO_READ( PVR2, reg );28.11 }
29.1 --- a/src/sh4/mem.c Sat Mar 13 00:03:32 2004 +000029.2 +++ b/src/sh4/mem.c Sat Aug 21 06:15:49 2004 +000029.3 @@ -11,10 +11,29 @@29.4 #include "dream.h"29.5 #include "sh4core.h"29.6 #include "mem.h"29.7 +#include "dreamcast.h"29.9 #define OC_BASE 0x1C00000029.10 #define OC_TOP 0x2000000029.12 +#ifdef ENABLE_WATCH29.13 +#define CHECK_READ_WATCH( addr, size ) \29.14 + if( mem_is_watched(addr,size,WATCH_READ) != NULL ) { \29.15 + WARN( "Watch triggered at %08X by %d byte read", addr, size ); \29.16 + dreamcast_stop(); \29.17 + }29.18 +#define CHECK_WRITE_WATCH( addr, size, val ) \29.19 + if( mem_is_watched(addr,size,WATCH_WRITE) != NULL ) { \29.20 + WARN( "Watch triggered at %08X by %d byte write <= %0*X", addr, size, size*2, val ); \29.21 + dreamcast_stop(); \29.22 + }29.23 +#else29.24 +#define CHECK_READ_WATCH( addr, size )29.25 +#define CHECK_WRITE_WATCH( addr, size )29.26 +#endif29.27 +29.28 +#define TRANSLATE_VIDEO_64BIT_ADDRESS(a) ( (((a)&0x00FFFFF8)>>1)|(((a)&0x00000004)<<20)|((a)&0x03)|0x05000000 );29.29 +29.30 static char **page_map = NULL;29.31 static char *cache = NULL;29.33 @@ -209,7 +228,12 @@29.34 {29.35 struct mmio_region *io = P4_io[(addr&0x1FFFFFFF)>>19];29.36 if( !io ) {29.37 - ERROR( "Attempted write to unknown P4 region: %08X", addr );29.38 + if( (addr & 0xFC000000) == 0xE0000000 ) {29.39 + /* Store queue */29.40 + SH4_WRITE_STORE_QUEUE( addr, val );29.41 + } else {29.42 + ERROR( "Attempted write to unknown P4 region: %08X", addr );29.43 + }29.44 } else {29.45 io->io_write( addr&0xFFF, val );29.46 }29.47 @@ -227,6 +251,10 @@29.48 if( addr > 0xE0000000 ) /* P4 Area, handled specially */29.49 return SIGNEXT16(mem_read_p4( addr ));29.51 + if( (addr&0x1F800000) == 0x04000000 ) {29.52 + addr = TRANSLATE_VIDEO_64BIT_ADDRESS(addr);29.53 + }29.54 +29.55 page = page_map[ (addr & 0x1FFFFFFF) >> 12 ];29.56 if( ((uint32_t)page) < MAX_IO_REGIONS ) { /* IO Region */29.57 if( page == NULL ) {29.58 @@ -243,9 +271,16 @@29.59 int32_t mem_read_long( uint32_t addr )29.60 {29.61 char *page;29.62 +29.63 + CHECK_READ_WATCH(addr,4);29.64 +29.65 if( addr > 0xE0000000 ) /* P4 Area, handled specially */29.66 return mem_read_p4( addr );29.68 + if( (addr&0x1F800000) == 0x04000000 ) {29.69 + addr = TRANSLATE_VIDEO_64BIT_ADDRESS(addr);29.70 + }29.71 +29.72 if( IS_MMU_ENABLED() ) {29.73 ERROR( "user-mode & mmu translation not implemented, aborting", NULL );29.74 sh4_stop();29.75 @@ -270,9 +305,16 @@29.76 int32_t mem_read_word( uint32_t addr )29.77 {29.78 char *page;29.79 +29.80 + CHECK_READ_WATCH(addr,2);29.81 +29.82 if( addr > 0xE0000000 ) /* P4 Area, handled specially */29.83 return SIGNEXT16(mem_read_p4( addr ));29.85 + if( (addr&0x1F800000) == 0x04000000 ) {29.86 + addr = TRANSLATE_VIDEO_64BIT_ADDRESS(addr);29.87 + }29.88 +29.89 if( IS_MMU_ENABLED() ) {29.90 ERROR( "user-mode & mmu translation not implemented, aborting", NULL );29.91 sh4_stop();29.92 @@ -297,8 +339,14 @@29.93 int32_t mem_read_byte( uint32_t addr )29.94 {29.95 char *page;29.96 +29.97 + CHECK_READ_WATCH(addr,1);29.98 +29.99 if( addr > 0xE0000000 ) /* P4 Area, handled specially */29.100 return SIGNEXT8(mem_read_p4( addr ));29.101 + if( (addr&0x1F800000) == 0x04000000 ) {29.102 + addr = TRANSLATE_VIDEO_64BIT_ADDRESS(addr);29.103 + }29.105 if( IS_MMU_ENABLED() ) {29.106 ERROR( "user-mode & mmu translation not implemented, aborting", NULL );29.107 @@ -325,14 +373,14 @@29.108 {29.109 char *page;29.111 + CHECK_WRITE_WATCH(addr,4,val);29.112 +29.113 if( addr > 0xE0000000 ) {29.114 mem_write_p4( addr, val );29.115 return;29.116 }29.117 -29.118 - if( addr & 0xFFFFF000 == 0x0CFF0000 ||29.119 - addr & 0x0FFFF000 == 0x0C374000 ) {29.120 - TRACE( "Long write to watched page: %08X => %08X", val, addr );29.121 + if( (addr&0x1F800000) == 0x04000000 ) {29.122 + addr = TRANSLATE_VIDEO_64BIT_ADDRESS(addr);29.123 }29.125 if( IS_MMU_ENABLED() ) {29.126 @@ -340,6 +388,11 @@29.127 sh4_stop();29.128 return;29.129 }29.130 + if( (addr&0x1FFFFFFF) < 0x200000 ) {29.131 + ERROR( "Attempted write to read-only memory: %08X => %08X", val, addr);29.132 + sh4_stop();29.133 + return;29.134 + }29.135 page = page_map[ (addr & 0x1FFFFFFF) >> 12 ];29.136 if( ((uint32_t)page) < MAX_IO_REGIONS ) { /* IO Region */29.137 if( page == NULL ) {29.138 @@ -357,10 +410,15 @@29.139 {29.140 char *page;29.142 + CHECK_WRITE_WATCH(addr,2,val);29.143 +29.144 if( addr > 0xE0000000 ) {29.145 mem_write_p4( addr, (int16_t)val );29.146 return;29.147 }29.148 + if( (addr&0x1F800000) == 0x04000000 ) {29.149 + addr = TRANSLATE_VIDEO_64BIT_ADDRESS(addr);29.150 + }29.151 if( IS_MMU_ENABLED() ) {29.152 ERROR( "user-mode & mmu translation not implemented, aborting", NULL );29.153 sh4_stop();29.154 @@ -383,10 +441,16 @@29.155 {29.156 char *page;29.158 + CHECK_WRITE_WATCH(addr,1,val);29.159 +29.160 if( addr > 0xE0000000 ) {29.161 mem_write_p4( addr, (int8_t)val );29.162 return;29.163 }29.164 + if( (addr&0x1F800000) == 0x04000000 ) {29.165 + addr = TRANSLATE_VIDEO_64BIT_ADDRESS(addr);29.166 + }29.167 +29.168 if( IS_MMU_ENABLED() ) {29.169 ERROR( "user-mode & mmu translation not implemented, aborting", NULL );29.170 sh4_stop();29.171 @@ -414,3 +478,17 @@29.172 return page+(addr&0xFFF);29.173 }29.174 }29.175 +29.176 +/* FIXME: Handle all the many special cases when the range doesn't fall cleanly29.177 + * into the same memory black29.178 + */29.179 +29.180 +void mem_copy_from_sh4( char *dest, uint32_t srcaddr, size_t count ) {29.181 + char *src = mem_get_region(srcaddr);29.182 + memcpy( dest, src, count );29.183 +}29.184 +29.185 +void mem_copy_to_sh4( uint32_t destaddr, char *src, size_t count ) {29.186 + char *dest = mem_get_region(destaddr);29.187 + memcpy( dest, src, count );29.188 +}
30.1 --- a/src/sh4/mem.h Sat Mar 13 00:03:32 2004 +000030.2 +++ b/src/sh4/mem.h Sat Aug 21 06:15:49 2004 +000030.3 @@ -11,13 +11,13 @@30.4 #endif30.5 #endif30.7 -struct mem_region {30.8 +typedef struct mem_region {30.9 uint32_t base;30.10 uint32_t size;30.11 char *name;30.12 char *mem;30.13 int flags;30.14 -};30.15 +} *mem_region_t;30.17 #define MAX_IO_REGIONS 2430.18 #define MAX_MEM_REGIONS 830.19 @@ -48,6 +48,17 @@30.20 void mem_init( void );30.21 void mem_reset( void );30.23 +#define ENABLE_WATCH 130.24 +30.25 +#define WATCH_WRITE 130.26 +#define WATCH_READ 230.27 +#define WATCH_EXEC 3 /* AKA Breakpoint :) */30.28 +30.29 +typedef struct watch_point *watch_point_t;30.30 +30.31 +watch_point_t mem_new_watch( uint32_t start, uint32_t end, int flags );30.32 +void mem_delete_watch( watch_point_t watch );30.33 +watch_point_t mem_is_watched( uint32_t addr, int size, int op );30.35 /* mmucr register bits */30.36 #define MMUCR_AT 0x00000001 /* Address Translation enabled */
31.1 --- a/src/sh4/sh4core.c Sat Mar 13 00:03:32 2004 +000031.2 +++ b/src/sh4/sh4core.c Sat Aug 21 06:15:49 2004 +000031.3 @@ -49,7 +49,14 @@31.4 {31.5 running = 1;31.6 while( running && count--) {31.7 + int pc = sh4r.pc;31.8 sh4_execute_instruction();31.9 + /*31.10 + if( sh4r.pc == 0x8C0C1636 ||31.11 + sh4r.pc == 0x8C0C1634 ) {31.12 + WARN( "Branching to %08X from %08X", sh4r.pc, pc );31.13 + sh4_stop();31.14 + }*/31.15 }31.16 }31.18 @@ -61,11 +68,13 @@31.19 void sh4_runto( uint32_t target_pc, uint32_t count )31.20 {31.21 running = 1;31.22 - do {31.23 + while( running && count--) {31.24 sh4_execute_instruction();31.25 - } while( running && sh4r.pc != target_pc && count-- );31.26 - if( count == 0 )31.27 - running = 0;31.28 + if( sh4r.pc == target_pc ) {31.29 + running = 0;31.30 + break;31.31 + }31.32 + }31.33 }31.35 #define UNDEF(ir) do{ ERROR( "Raising exception on undefined instruction at %08x, opcode = %04x", sh4r.pc, ir ); sh4_stop(); RAISE( EXC_ILLEGAL, EXV_ILLEGAL ); }while(0)31.36 @@ -107,6 +116,7 @@31.38 #define EXC_POWER_RESET 0x000 /* vector special */31.39 #define EXC_MANUAL_RESET 0x02031.40 +#define EXC_SLOT_ILLEGAL 0x1A031.41 #define EXC_ILLEGAL 0x18031.42 #define EXV_ILLEGAL 0x10031.43 #define EXC_TRAP 0x16031.44 @@ -118,6 +128,7 @@31.45 #define CHECKPRIV() CHECK( IS_SH4_PRIVMODE(), EXC_ILLEGAL, EXV_ILLEGAL )31.46 #define CHECKFPUEN() CHECK( IS_FPU_ENABLED(), EXC_FPDISABLE, EXV_FPDISABLE )31.47 #define CHECKDEST(p) if( (p) == 0 ) { ERROR( "%08X: Branch/jump to NULL, CPU halted", sh4r.pc ); sh4_stop(); return; }31.48 +#define CHECKSLOTILLEGAL() if(sh4r.in_delay_slot) { RAISE(EXC_SLOT_ILLEGAL,EXV_ILLEGAL); }31.50 static void sh4_switch_banks( )31.51 {31.52 @@ -159,7 +170,6 @@31.53 static void sh4_accept_interrupt( void )31.54 {31.55 uint32_t code = intc_accept_interrupt();31.56 -31.57 sh4r.ssr = sh4_read_sr();31.58 sh4r.spc = sh4r.pc;31.59 sh4r.sgr = sh4r.r[15];31.60 @@ -167,12 +177,13 @@31.61 MMIO_WRITE( MMU, INTEVT, code );31.62 sh4r.pc = sh4r.vbr + 0x600;31.63 sh4r.new_pc = sh4r.pc + 2;31.64 + WARN( "Accepting interrupt %03X, from %08X => %08X", code, sh4r.spc, sh4r.pc );31.65 }31.67 void sh4_execute_instruction( void )31.68 {31.69 - int pc = sh4r.pc;31.70 - unsigned short ir = MEM_READ_WORD(pc);31.71 + int pc;31.72 + unsigned short ir;31.73 uint32_t tmp;31.74 uint64_t tmpl;31.76 @@ -187,8 +198,8 @@31.77 #define IMM8(ir) SIGNEXT8(ir&0x00FF)31.78 #define UIMM8(ir) (ir&0x00FF) /* Unsigned immmediate */31.79 #define DISP12(ir) SIGNEXT12(ir&0x0FFF)31.80 -#define FVN(ir) ((ir&0x0C00)31.81 -#define FVM(ir) ((ir&0x0300)>>8)31.82 +#define FVN(ir) ((ir&0x0C00)>>8)31.83 +#define FVM(ir) ((ir&0x0300)>>6)31.84 #define FRN(ir) (FR[(ir&0x0F00)>>8])31.85 #define FRM(ir) (FR[(ir&0x00F0)>>4])31.86 #define FRNi(ir) (((uint32_t *)FR)[(ir&0x0F00)>>8])31.87 @@ -202,8 +213,11 @@31.88 #define FPULf *((float *)&sh4r.fpul)31.89 #define FPULi (sh4r.fpul)31.91 - if( SH4_INT_PENDING() ) sh4_accept_interrupt();31.92 + if( SH4_INT_PENDING() )31.93 + sh4_accept_interrupt();31.95 + pc = sh4r.pc;31.96 + ir = MEM_READ_WORD(pc);31.97 sh4r.icount++;31.99 switch( (ir&0xF000)>>12 ) {31.100 @@ -242,16 +256,32 @@31.101 switch( (ir&0x00F0)>>4 ) {31.102 case 0: /* BSRF Rn */31.103 CHECKDEST( pc + 4 + RN(ir) );31.104 + CHECKSLOTILLEGAL();31.105 + sh4r.in_delay_slot = 1;31.106 sh4r.pr = sh4r.pc + 4;31.107 sh4r.pc = sh4r.new_pc;31.108 sh4r.new_pc = pc + 4 + RN(ir);31.109 return;31.110 case 2: /* BRAF Rn */31.111 CHECKDEST( pc + 4 + RN(ir) );31.112 + CHECKSLOTILLEGAL();31.113 + sh4r.in_delay_slot = 1;31.114 sh4r.pc = sh4r.new_pc;31.115 sh4r.new_pc = pc + 4 + RN(ir);31.116 return;31.117 case 8: /* PREF [Rn] */31.118 + tmp = RN(ir);31.119 + if( (tmp & 0xFC000000) == 0xE0000000 ) {31.120 + /* Store queue operation */31.121 + int queue = (tmp&0x20)>>2;31.122 + int32_t *src = &sh4r.store_queue[queue];31.123 + uint32_t hi = (MMIO_READ( MMU, (queue == 0 ? QACR0 : QACR1) ) & 0x1C) << 24;31.124 + uint32_t target = tmp&0x03FFFFE0 | hi;31.125 + mem_copy_to_sh4( target, src, 32 );31.126 + WARN( "Executed SQ%c => %08X",31.127 + (queue == 0 ? '0' : '1'), target );31.128 + }31.129 + break;31.130 case 9: /* OCBI [Rn] */31.131 case 10:/* OCBP [Rn] */31.132 case 11:/* OCBWB [Rn] */31.133 @@ -272,7 +302,7 @@31.134 MEM_WRITE_LONG( R0 + RN(ir), RM(ir) );31.135 break;31.136 case 7: /* MUL.L Rm, Rn */31.137 - sh4r.mac = (sh4r.mac&0xFFFFFFFF00000000) |31.138 + sh4r.mac = (sh4r.mac&0xFFFFFFFF00000000LL) |31.139 (RM(ir) * RN(ir));31.140 break;31.141 case 8:31.142 @@ -338,6 +368,8 @@31.143 switch( (ir&0x0FF0)>>4 ) {31.144 case 0: /* RTS */31.145 CHECKDEST( sh4r.pr );31.146 + CHECKSLOTILLEGAL();31.147 + sh4r.in_delay_slot = 1;31.148 sh4r.pc = sh4r.new_pc;31.149 sh4r.new_pc = sh4r.pr;31.150 return;31.151 @@ -347,9 +379,12 @@31.152 case 2: /* RTE */31.153 CHECKPRIV();31.154 CHECKDEST( sh4r.spc );31.155 + CHECKSLOTILLEGAL();31.156 + sh4r.in_delay_slot = 1;31.157 sh4r.pc = sh4r.new_pc;31.158 sh4r.new_pc = sh4r.spc;31.159 sh4_load_sr( sh4r.ssr );31.160 + WARN( "RTE => %08X", sh4r.new_pc );31.161 return;31.162 default:UNDEF(ir);31.163 }31.164 @@ -369,12 +404,12 @@31.165 if( sh4r.s ) {31.166 /* 48-bit Saturation. Yuch */31.167 tmpl += SIGNEXT48(sh4r.mac);31.168 - if( tmpl < 0xFFFF800000000000 )31.169 - tmpl = 0xFFFF800000000000;31.170 - else if( tmpl > 0x00007FFFFFFFFFFF )31.171 - tmpl = 0x00007FFFFFFFFFFF;31.172 - sh4r.mac = (sh4r.mac&0xFFFF000000000000) |31.173 - (tmpl&0x0000FFFFFFFFFFFF);31.174 + if( tmpl < 0xFFFF800000000000LL )31.175 + tmpl = 0xFFFF800000000000LL;31.176 + else if( tmpl > 0x00007FFFFFFFFFFFLL )31.177 + tmpl = 0x00007FFFFFFFFFFFLL;31.178 + sh4r.mac = (sh4r.mac&0xFFFF000000000000LL) |31.179 + (tmpl&0x0000FFFFFFFFFFFFLL);31.180 } else sh4r.mac = tmpl;31.182 RM(ir) += 4;31.183 @@ -440,11 +475,11 @@31.184 RN(ir) = (RN(ir)>>16) | (RM(ir)<<16);31.185 break;31.186 case 14:/* MULU.W Rm, Rn */31.187 - sh4r.mac = (sh4r.mac&0xFFFFFFFF00000000) |31.188 + sh4r.mac = (sh4r.mac&0xFFFFFFFF00000000LL) |31.189 (uint32_t)((RM(ir)&0xFFFF) * (RN(ir)&0xFFFF));31.190 break;31.191 case 15:/* MULS.W Rm, Rn */31.192 - sh4r.mac = (sh4r.mac&0xFFFFFFFF00000000) |31.193 + sh4r.mac = (sh4r.mac&0xFFFFFFFF00000000LL) |31.194 (uint32_t)(SIGNEXT32(RM(ir)&0xFFFF) * SIGNEXT32(RN(ir)&0xFFFF));31.195 break;31.196 }31.197 @@ -571,6 +606,8 @@31.198 break;31.199 case 0x0B: /* JSR [Rn] */31.200 CHECKDEST( RN(ir) );31.201 + CHECKSLOTILLEGAL();31.202 + sh4r.in_delay_slot = 1;31.203 sh4r.pc = sh4r.new_pc;31.204 sh4r.new_pc = RN(ir);31.205 sh4r.pr = pc + 4;31.206 @@ -598,7 +635,7 @@31.207 sh4r.t = ( ((int32_t)RN(ir)) > 0 ? 1 : 0 );31.208 break;31.209 case 0x16: /* LDS.L [Rn++], MACL */31.210 - sh4r.mac = (sh4r.mac & 0xFFFFFFFF00000000) |31.211 + sh4r.mac = (sh4r.mac & 0xFFFFFFFF00000000LL) |31.212 (uint64_t)((uint32_t)MEM_READ_LONG(RN(ir)));31.213 RN(ir) += 4;31.214 break;31.215 @@ -613,7 +650,7 @@31.216 RN(ir) >>= 8;31.217 break;31.218 case 0x1A: /* LDS Rn, MACL */31.219 - sh4r.mac = (sh4r.mac & 0xFFFFFFFF00000000) |31.220 + sh4r.mac = (sh4r.mac & 0xFFFFFFFF00000000LL) |31.221 (uint64_t)((uint32_t)(RN(ir)));31.222 break;31.223 case 0x1B: /* TAS.B [Rn] */31.224 @@ -639,7 +676,7 @@31.225 case 0x23: /* STC.L VBR, [--Rn] */31.226 CHECKPRIV();31.227 RN(ir) -= 4;31.228 - MEM_WRITE_LONG( RN(ir), sh4r.pr );31.229 + MEM_WRITE_LONG( RN(ir), sh4r.vbr );31.230 break;31.231 case 0x24: /* ROTCL Rn */31.232 tmp = RN(ir) >> 31;31.233 @@ -673,6 +710,8 @@31.234 break;31.235 case 0x2B: /* JMP [Rn] */31.236 CHECKDEST( RN(ir) );31.237 + CHECKSLOTILLEGAL();31.238 + sh4r.in_delay_slot = 1;31.239 sh4r.pc = sh4r.new_pc;31.240 sh4r.new_pc = RN(ir);31.241 return;31.242 @@ -876,6 +915,7 @@31.243 sh4r.t = ( R0 == IMM8(ir) ? 1 : 0 );31.244 break;31.245 case 9: /* BT disp8 */31.246 + CHECKSLOTILLEGAL()31.247 if( sh4r.t ) {31.248 CHECKDEST( sh4r.pc + (PCDISP8(ir)<<1) + 4 )31.249 sh4r.pc += (PCDISP8(ir)<<1) + 4;31.250 @@ -884,6 +924,7 @@31.251 }31.252 break;31.253 case 11:/* BF disp8 */31.254 + CHECKSLOTILLEGAL()31.255 if( !sh4r.t ) {31.256 CHECKDEST( sh4r.pc + (PCDISP8(ir)<<1) + 4 )31.257 sh4r.pc += (PCDISP8(ir)<<1) + 4;31.258 @@ -892,16 +933,21 @@31.259 }31.260 break;31.261 case 13:/* BT/S disp8 */31.262 + CHECKSLOTILLEGAL()31.263 if( sh4r.t ) {31.264 CHECKDEST( sh4r.pc + (PCDISP8(ir)<<1) + 4 )31.265 + sh4r.in_delay_slot = 1;31.266 sh4r.pc = sh4r.new_pc;31.267 sh4r.new_pc = pc + (PCDISP8(ir)<<1) + 4;31.268 + sh4r.in_delay_slot = 1;31.269 return;31.270 }31.271 break;31.272 case 15:/* BF/S disp8 */31.273 + CHECKSLOTILLEGAL()31.274 if( !sh4r.t ) {31.275 CHECKDEST( sh4r.pc + (PCDISP8(ir)<<1) + 4 )31.276 + sh4r.in_delay_slot = 1;31.277 sh4r.pc = sh4r.new_pc;31.278 sh4r.new_pc = pc + (PCDISP8(ir)<<1) + 4;31.279 return;31.280 @@ -916,13 +962,17 @@31.281 break;31.282 case 10:/* 1010dddddddddddd */31.283 /* BRA disp12 */31.284 - CHECKDEST( sh4r.pc + (DISP12(ir)<<1) + 4 );31.285 + CHECKDEST( sh4r.pc + (DISP12(ir)<<1) + 4 )31.286 + CHECKSLOTILLEGAL()31.287 + sh4r.in_delay_slot = 1;31.288 sh4r.pc = sh4r.new_pc;31.289 sh4r.new_pc = pc + 4 + (DISP12(ir)<<1);31.290 return;31.291 case 11:/* 1011dddddddddddd */31.292 /* BSR disp12 */31.293 CHECKDEST( sh4r.pc + (DISP12(ir)<<1) + 4 )31.294 + CHECKSLOTILLEGAL()31.295 + sh4r.in_delay_slot = 1;31.296 sh4r.pr = pc + 4;31.297 sh4r.pc = sh4r.new_pc;31.298 sh4r.new_pc = pc + 4 + (DISP12(ir)<<1);31.299 @@ -939,6 +989,8 @@31.300 MEM_WRITE_LONG( sh4r.gbr + (DISP8(ir)<<2), R0 );31.301 break;31.302 case 3: /* TRAPA imm8 */31.303 + CHECKSLOTILLEGAL()31.304 + sh4r.in_delay_slot = 1;31.305 MMIO_WRITE( MMU, TRA, UIMM8(ir) );31.306 sh4r.pc = sh4r.new_pc; /* RAISE ends the instruction */31.307 sh4r.new_pc += 2;31.308 @@ -1065,6 +1117,9 @@31.309 case 6: /* FSQRT FRn */31.310 FRN(ir) = sqrtf(FRN(ir));31.311 break;31.312 + case 7: /* FSRRA FRn */31.313 + FRN(ir) = 1.0/sqrtf(FRN(ir));31.314 + break;31.315 case 8: /* FLDI0 FRn */31.316 FRN(ir) = 0.0;31.317 break;31.318 @@ -1081,20 +1136,55 @@31.319 FPULf = (float)DRN(ir);31.320 else UNDEF(ir);31.321 break;31.322 - case 14:/* FIPR FVn, FVn */31.323 - UNIMP(ir);31.324 + case 14:/* FIPR FVm, FVn */31.325 + /* FIXME: This is not going to be entirely accurate31.326 + * as the SH4 instruction is less precise. Also31.327 + * need to check for 0s and infinities.31.328 + */31.329 + {31.330 + float *fr_bank = FR;31.331 + int tmp2 = FVN(ir);31.332 + tmp = FVM(ir);31.333 + fr_bank[tmp2+3] = fr_bank[tmp]*fr_bank[tmp2] +31.334 + fr_bank[tmp+1]*fr_bank[tmp2+1] +31.335 + fr_bank[tmp+2]*fr_bank[tmp2+2] +31.336 + fr_bank[tmp+3]*fr_bank[tmp2+3];31.337 break;31.338 + }31.339 case 15:31.340 - if( FVM(ir) == 1 )31.341 - /* FTRV XMTRX,FVn */31.342 - UNIMP(ir);31.343 - else if( ir == 0xFBFD )31.344 - /* FRCHG */31.345 + if( (ir&0x0300) == 0x0100 ) { /* FTRV XMTRX,FVn */31.346 + float *fvout = FR+FVN(ir);31.347 + float *xm = XF;31.348 + float fv[4] = { fvout[0], fvout[1], fvout[2], fvout[3] };31.349 + fvout[0] = xm[0] * fv[0] + xm[4]*fv[1] +31.350 + xm[8]*fv[2] + xm[12]*fv[3];31.351 + fvout[1] = xm[1] * fv[0] + xm[5]*fv[1] +31.352 + xm[9]*fv[2] + xm[13]*fv[3];31.353 + fvout[2] = xm[2] * fv[0] + xm[6]*fv[1] +31.354 + xm[10]*fv[2] + xm[14]*fv[3];31.355 + fvout[3] = xm[3] * fv[0] + xm[7]*fv[1] +31.356 + xm[11]*fv[2] + xm[15]*fv[3];31.357 + break;31.358 + }31.359 + else if( (ir&0x0100) == 0 ) { /* FSCA FPUL, DRn */31.360 + float angle = (((float)(short)(FPULi>>16)) +31.361 + ((float)(FPULi&16)/65536.0)) *31.362 + 2 * M_PI;31.363 + int reg = FRNn(ir);31.364 + FR[reg] = sinf(angle);31.365 + FR[reg+1] = cosf(angle);31.366 + break;31.367 + }31.368 + else if( ir == 0xFBFD ) {31.369 + /* FRCHG */31.370 sh4r.fpscr ^= FPSCR_FR;31.371 - else if( ir == 0xF3FD )31.372 + break;31.373 + }31.374 + else if( ir == 0xF3FD ) {31.375 + /* FSCHG */31.376 sh4r.fpscr ^= FPSCR_SZ;31.377 - /* FSCHG */31.378 - break;31.379 + break;31.380 + }31.381 default: UNDEF(ir);31.382 }31.383 break;31.384 @@ -1107,4 +1197,5 @@31.385 }31.386 sh4r.pc = sh4r.new_pc;31.387 sh4r.new_pc += 2;31.388 + sh4r.in_delay_slot = 0;31.389 }
32.1 --- a/src/sh4/sh4core.h Sat Mar 13 00:03:32 2004 +000032.2 +++ b/src/sh4/sh4core.h Sat Aug 21 06:15:49 2004 +000032.3 @@ -22,9 +22,13 @@32.4 uint32_t m, q, s, t; /* really boolean - 0 or 1 */32.5 float fr[2][16];32.7 + int32_t store_queue[16]; /* technically 2 banks of 32 bytes */32.8 +32.9 uint32_t new_pc; /* Not a real register, but used to handle delay slots */32.10 uint32_t icount; /* Also not a real register, instruction counter */32.11 uint32_t int_pending; /* flag set by the INTC = pending priority level */32.12 + int in_delay_slot; /* flag to indicate the current instruction is in32.13 + * a delay slot (certain rules apply) */32.14 };32.16 extern struct sh4_registers sh4r;32.17 @@ -66,7 +70,7 @@32.19 #define IS_SH4_PRIVMODE() (sh4r.sr&SR_MD)32.20 #define SH4_INTMASK() ((sh4r.sr&SR_IMASK)>>4)32.21 -#define SH4_INT_PENDING() (sh4r.int_pending)32.22 +#define SH4_INT_PENDING() (sh4r.int_pending && !sh4r.in_delay_slot)32.24 #define FPSCR_FR 0x00200000 /* FPU register bank */32.25 #define FPSCR_SZ 0x00100000 /* FPU transfer size (0=32 bits, 1=64 bits) */32.26 @@ -82,6 +86,7 @@32.27 #define IS_FPU_ENABLED() ((sh4r.sr&SR_FD)==0)32.29 #define FR sh4r.fr[(sh4r.fpscr&FPSCR_FR)>>21]32.30 +#define XF sh4r.fr[((~sh4r.fpscr)&FPSCR_FR)>>21]32.32 /* Exceptions (for use with sh4_raise_exception) */32.34 @@ -100,7 +105,7 @@32.35 #define EX_FPU_DISABLED 0x800, 0x10032.36 #define EX_SLOT_FPU_DISABLED 0x820, 0x10032.38 -32.39 +#define SH4_WRITE_STORE_QUEUE(addr,val) sh4r.store_queue[(addr>>2)&0xF] = val;32.41 #ifdef __cplusplus32.42 }
33.1 --- a/src/sh4/sh4dasm.c Sat Mar 13 00:03:32 2004 +000033.2 +++ b/src/sh4/sh4dasm.c Sat Aug 21 06:15:49 2004 +000033.3 @@ -305,18 +305,22 @@33.4 case 4: snprintf( buf, len, "FNEG FR%d", RN(ir) ); break;33.5 case 5: snprintf( buf, len, "FABS FR%d", RN(ir) ); break;33.6 case 6: snprintf( buf, len, "FSQRT FR%d", RN(ir) ); break;33.7 + case 7: snprintf( buf, len, "FSRRA FR%d", RN(ir) ); break;33.8 case 8: snprintf( buf, len, "FLDI0 FR%d", RN(ir) ); break;33.9 case 9: snprintf( buf, len, "FLDI1 FR%d", RN(ir) ); break;33.10 case 10:snprintf( buf, len, "FCNVSD FPUL, DR%d", RN(ir)>>1 ); break;33.11 case 11:snprintf( buf, len, "FCNVDS DR%d, FPUL", RN(ir)>>1 ); break;33.12 case 14:snprintf( buf, len, "FIPR FV%d, FV%d", FVM(ir), FVN(ir) ); break;33.13 case 15:33.14 - if( FVM(ir) == 1 )33.15 + if( (ir & 0x0300) == 0x0100 )33.16 snprintf( buf, len, "FTRV XMTRX,FV%d", FVN(ir) );33.17 + else if( (ir & 0x0100) == 0 )33.18 + snprintf( buf, len, "FSCA FPUL, DR%d", RN(ir) );33.19 else if( ir == 0xFBFD )33.20 snprintf( buf, len, "FRCHG " );33.21 else if( ir == 0xF3FD )33.22 snprintf( buf, len, "FSCHG " );33.23 + else UNIMP(ir);33.24 break;33.25 default: UNIMP(ir);33.26 }
34.1 --- /dev/null Thu Jan 01 00:00:00 1970 +000034.2 +++ b/src/watch.c Sat Aug 21 06:15:49 2004 +000034.3 @@ -0,0 +1,71 @@34.4 +#include <stdlib.h>34.5 +#include "mem.h"34.6 +34.7 +struct watch_point {34.8 + uint32_t start;34.9 + uint32_t end;34.10 + int flags;34.11 +};34.12 +34.13 +struct watch_point *watch_arr = NULL;34.14 +int watch_count = 0, watch_capacity = 0;34.15 +34.16 +34.17 +watch_point_t mem_new_watch( uint32_t start, uint32_t end, int flags )34.18 +{34.19 + int num;34.20 + if( watch_arr == NULL ) {34.21 + watch_capacity = 10;34.22 + watch_arr = calloc( sizeof(struct watch_point), watch_capacity );34.23 + num = 0;34.24 + } else if( watch_count == watch_capacity ) {34.25 + struct watch_point *tmp = realloc( watch_arr, sizeof(struct watch_point) * watch_capacity * 2 );34.26 + if( tmp == NULL )34.27 + return NULL;34.28 + watch_arr = tmp;34.29 + memset( &watch_arr[watch_capacity], 0, sizeof( struct watch_point ) * watch_capacity );34.30 + num = watch_capacity;34.31 + watch_capacity *= 2;34.32 + } else {34.33 + for( num=0; num<watch_capacity; num++ ) {34.34 + if( watch_arr[num].flags == 0 )34.35 + break;34.36 + }34.37 + }34.38 + watch_arr[num].start = start & 0x1FFFFFFF;34.39 + watch_arr[num].end = end & 0x1FFFFFFF;34.40 + watch_arr[num].flags = flags;34.41 + watch_count++;34.42 + return &watch_arr[num];34.43 +}34.44 +34.45 +void mem_delete_watch( watch_point_t watch )34.46 +{34.47 + if( watch_arr == NULL )34.48 + return;34.49 + int num = watch - watch_arr;34.50 + if( num < 0 || num >= watch_capacity )34.51 + return NULL;34.52 + watch->start = watch->end = 0;34.53 + watch->flags = 0;34.54 + watch_count--;34.55 +}34.56 +34.57 +34.58 +watch_point_t mem_is_watched( uint32_t addr, int size, int op )34.59 +{34.60 + int i, count;34.61 + addr &= 0x1FFFFFFF;34.62 + for( i=0, count=0; count< watch_count; i++ ) {34.63 + if( watch_arr[i].flags == 0 )34.64 + continue;34.65 + count++;34.66 + if( watch_arr[i].flags & op &&34.67 + watch_arr[i].start < addr+size &&34.68 + watch_arr[i].end >= addr ) {34.69 + return &watch_arr[i];34.70 + }34.71 + }34.72 + return NULL;34.73 +}34.74 +
.