Search
lxdream.org :: lxdream :: r87:11208d725b61
lxdream 0.9.1
released Jun 29
Download Now
changeset87:11208d725b61
parent86:f151e63f9754
child88:0a1bd43fa4ad
authornkeynes
dateSun Jan 22 22:40:53 2006 +0000 (13 years ago)
Add dummied-up BIOS syscalls
src/Makefile.am
src/Makefile.in
src/bios.c
src/bios.h
src/main.c
1.1 --- a/src/Makefile.am Sun Jan 22 22:40:05 2006 +0000
1.2 +++ b/src/Makefile.am Sun Jan 22 22:40:53 2006 +0000
1.3 @@ -13,6 +13,7 @@
1.4 mem.c mem.h mmio.h watch.c \
1.5 asic.c asic.h \
1.6 pvr2.c pvr2.h \
1.7 + bios.c bios.h \
1.8 gdrom/ide.c gdrom/ide.h \
1.9 video.c dreamcast.c dreamcast.h \
1.10 sh4/intc.c sh4/intc.h sh4/sh4mem.c sh4/timer.c sh4/dmac.c \
2.1 --- a/src/Makefile.in Sun Jan 22 22:40:05 2006 +0000
2.2 +++ b/src/Makefile.in Sun Jan 22 22:40:53 2006 +0000
2.3 @@ -140,13 +140,15 @@
2.4 mem.c mem.h mmio.h watch.c \
2.5 asic.c asic.h \
2.6 pvr2.c pvr2.h \
2.7 + bios.c bios.h \
2.8 gdrom/ide.c gdrom/ide.h \
2.9 video.c dreamcast.c dreamcast.h \
2.10 sh4/intc.c sh4/intc.h sh4/sh4mem.c sh4/timer.c sh4/dmac.c \
2.11 sh4/sh4core.c sh4/sh4core.h sh4/sh4dasm.c sh4/sh4dasm.h \
2.12 sh4/sh4mmio.c sh4/sh4mmio.h sh4/scif.c \
2.13 aica/armcore.c aica/armcore.h aica/armdasm.c aica/armmem.c \
2.14 - aica/aica.c aica/aica.h \
2.15 + aica/aica.c aica/aica.h aica/audio.c aica/audio.h \
2.16 + aica/audio_null.c aica/audio_esd.c \
2.17 maple/maple.c maple/maple.h \
2.18 maple/controller.c maple/controller.h \
2.19 gui/support.c gui/support.h \
2.20 @@ -157,7 +159,7 @@
2.21 loader.c bootstrap.c util.c
2.22
2.23
2.24 -dream_LDADD = @PACKAGE_LIBS@ $(INTLLIBS)
2.25 +dream_LDADD = @PACKAGE_LIBS@ $(INTLLIBS) -lesd
2.26
2.27 AM_CFLAGS = -D_ISOC99_SOURCE -D_BSD_SOURCE
2.28 subdir = src
2.29 @@ -169,16 +171,17 @@
2.30 PROGRAMS = $(bin_PROGRAMS)
2.31
2.32 am_dream_OBJECTS = main.$(OBJEXT) mem.$(OBJEXT) watch.$(OBJEXT) \
2.33 - asic.$(OBJEXT) pvr2.$(OBJEXT) ide.$(OBJEXT) video.$(OBJEXT) \
2.34 - dreamcast.$(OBJEXT) intc.$(OBJEXT) sh4mem.$(OBJEXT) \
2.35 - timer.$(OBJEXT) dmac.$(OBJEXT) sh4core.$(OBJEXT) \
2.36 - sh4dasm.$(OBJEXT) sh4mmio.$(OBJEXT) scif.$(OBJEXT) \
2.37 - armcore.$(OBJEXT) armdasm.$(OBJEXT) armmem.$(OBJEXT) \
2.38 - aica.$(OBJEXT) maple.$(OBJEXT) controller.$(OBJEXT) \
2.39 - support.$(OBJEXT) interface.$(OBJEXT) callbacks.$(OBJEXT) \
2.40 - gui.$(OBJEXT) mmr_win.$(OBJEXT) debug_win.$(OBJEXT) \
2.41 - dump_win.$(OBJEXT) loader.$(OBJEXT) bootstrap.$(OBJEXT) \
2.42 - util.$(OBJEXT)
2.43 + asic.$(OBJEXT) pvr2.$(OBJEXT) bios.$(OBJEXT) ide.$(OBJEXT) \
2.44 + video.$(OBJEXT) dreamcast.$(OBJEXT) intc.$(OBJEXT) \
2.45 + sh4mem.$(OBJEXT) timer.$(OBJEXT) dmac.$(OBJEXT) \
2.46 + sh4core.$(OBJEXT) sh4dasm.$(OBJEXT) sh4mmio.$(OBJEXT) \
2.47 + scif.$(OBJEXT) armcore.$(OBJEXT) armdasm.$(OBJEXT) \
2.48 + armmem.$(OBJEXT) aica.$(OBJEXT) audio.$(OBJEXT) \
2.49 + audio_null.$(OBJEXT) audio_esd.$(OBJEXT) maple.$(OBJEXT) \
2.50 + controller.$(OBJEXT) support.$(OBJEXT) interface.$(OBJEXT) \
2.51 + callbacks.$(OBJEXT) gui.$(OBJEXT) mmr_win.$(OBJEXT) \
2.52 + debug_win.$(OBJEXT) dump_win.$(OBJEXT) loader.$(OBJEXT) \
2.53 + bootstrap.$(OBJEXT) util.$(OBJEXT)
2.54 dream_OBJECTS = $(am_dream_OBJECTS)
2.55 dream_DEPENDENCIES =
2.56 dream_LDFLAGS =
2.57 @@ -188,7 +191,9 @@
2.58 am__depfiles_maybe = depfiles
2.59 @AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/aica.Po ./$(DEPDIR)/armcore.Po \
2.60 @AMDEP_TRUE@ ./$(DEPDIR)/armdasm.Po ./$(DEPDIR)/armmem.Po \
2.61 -@AMDEP_TRUE@ ./$(DEPDIR)/asic.Po ./$(DEPDIR)/bootstrap.Po \
2.62 +@AMDEP_TRUE@ ./$(DEPDIR)/asic.Po ./$(DEPDIR)/audio.Po \
2.63 +@AMDEP_TRUE@ ./$(DEPDIR)/audio_esd.Po ./$(DEPDIR)/audio_null.Po \
2.64 +@AMDEP_TRUE@ ./$(DEPDIR)/bios.Po ./$(DEPDIR)/bootstrap.Po \
2.65 @AMDEP_TRUE@ ./$(DEPDIR)/callbacks.Po ./$(DEPDIR)/controller.Po \
2.66 @AMDEP_TRUE@ ./$(DEPDIR)/debug_win.Po ./$(DEPDIR)/dmac.Po \
2.67 @AMDEP_TRUE@ ./$(DEPDIR)/dreamcast.Po ./$(DEPDIR)/dump_win.Po \
2.68 @@ -258,6 +263,10 @@
2.69 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/armdasm.Po@am__quote@
2.70 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/armmem.Po@am__quote@
2.71 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/asic.Po@am__quote@
2.72 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/audio.Po@am__quote@
2.73 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/audio_esd.Po@am__quote@
2.74 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/audio_null.Po@am__quote@
2.75 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bios.Po@am__quote@
2.76 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bootstrap.Po@am__quote@
2.77 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/callbacks.Po@am__quote@
2.78 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/controller.Po@am__quote@
2.79 @@ -594,6 +603,72 @@
2.80 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
2.81 @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o aica.obj `if test -f 'aica/aica.c'; then $(CYGPATH_W) 'aica/aica.c'; else $(CYGPATH_W) '$(srcdir)/aica/aica.c'; fi`
2.82
2.83 +audio.o: aica/audio.c
2.84 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT audio.o -MD -MP -MF "$(DEPDIR)/audio.Tpo" \
2.85 +@am__fastdepCC_TRUE@ -c -o audio.o `test -f 'aica/audio.c' || echo '$(srcdir)/'`aica/audio.c; \
2.86 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/audio.Tpo" "$(DEPDIR)/audio.Po"; \
2.87 +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/audio.Tpo"; exit 1; \
2.88 +@am__fastdepCC_TRUE@ fi
2.89 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='aica/audio.c' object='audio.o' libtool=no @AMDEPBACKSLASH@
2.90 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/audio.Po' tmpdepfile='$(DEPDIR)/audio.TPo' @AMDEPBACKSLASH@
2.91 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
2.92 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o audio.o `test -f 'aica/audio.c' || echo '$(srcdir)/'`aica/audio.c
2.93 +
2.94 +audio.obj: aica/audio.c
2.95 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT audio.obj -MD -MP -MF "$(DEPDIR)/audio.Tpo" \
2.96 +@am__fastdepCC_TRUE@ -c -o audio.obj `if test -f 'aica/audio.c'; then $(CYGPATH_W) 'aica/audio.c'; else $(CYGPATH_W) '$(srcdir)/aica/audio.c'; fi`; \
2.97 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/audio.Tpo" "$(DEPDIR)/audio.Po"; \
2.98 +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/audio.Tpo"; exit 1; \
2.99 +@am__fastdepCC_TRUE@ fi
2.100 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='aica/audio.c' object='audio.obj' libtool=no @AMDEPBACKSLASH@
2.101 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/audio.Po' tmpdepfile='$(DEPDIR)/audio.TPo' @AMDEPBACKSLASH@
2.102 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
2.103 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o audio.obj `if test -f 'aica/audio.c'; then $(CYGPATH_W) 'aica/audio.c'; else $(CYGPATH_W) '$(srcdir)/aica/audio.c'; fi`
2.104 +
2.105 +audio_null.o: aica/audio_null.c
2.106 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT audio_null.o -MD -MP -MF "$(DEPDIR)/audio_null.Tpo" \
2.107 +@am__fastdepCC_TRUE@ -c -o audio_null.o `test -f 'aica/audio_null.c' || echo '$(srcdir)/'`aica/audio_null.c; \
2.108 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/audio_null.Tpo" "$(DEPDIR)/audio_null.Po"; \
2.109 +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/audio_null.Tpo"; exit 1; \
2.110 +@am__fastdepCC_TRUE@ fi
2.111 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='aica/audio_null.c' object='audio_null.o' libtool=no @AMDEPBACKSLASH@
2.112 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/audio_null.Po' tmpdepfile='$(DEPDIR)/audio_null.TPo' @AMDEPBACKSLASH@
2.113 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
2.114 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o audio_null.o `test -f 'aica/audio_null.c' || echo '$(srcdir)/'`aica/audio_null.c
2.115 +
2.116 +audio_null.obj: aica/audio_null.c
2.117 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT audio_null.obj -MD -MP -MF "$(DEPDIR)/audio_null.Tpo" \
2.118 +@am__fastdepCC_TRUE@ -c -o audio_null.obj `if test -f 'aica/audio_null.c'; then $(CYGPATH_W) 'aica/audio_null.c'; else $(CYGPATH_W) '$(srcdir)/aica/audio_null.c'; fi`; \
2.119 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/audio_null.Tpo" "$(DEPDIR)/audio_null.Po"; \
2.120 +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/audio_null.Tpo"; exit 1; \
2.121 +@am__fastdepCC_TRUE@ fi
2.122 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='aica/audio_null.c' object='audio_null.obj' libtool=no @AMDEPBACKSLASH@
2.123 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/audio_null.Po' tmpdepfile='$(DEPDIR)/audio_null.TPo' @AMDEPBACKSLASH@
2.124 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
2.125 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o audio_null.obj `if test -f 'aica/audio_null.c'; then $(CYGPATH_W) 'aica/audio_null.c'; else $(CYGPATH_W) '$(srcdir)/aica/audio_null.c'; fi`
2.126 +
2.127 +audio_esd.o: aica/audio_esd.c
2.128 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT audio_esd.o -MD -MP -MF "$(DEPDIR)/audio_esd.Tpo" \
2.129 +@am__fastdepCC_TRUE@ -c -o audio_esd.o `test -f 'aica/audio_esd.c' || echo '$(srcdir)/'`aica/audio_esd.c; \
2.130 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/audio_esd.Tpo" "$(DEPDIR)/audio_esd.Po"; \
2.131 +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/audio_esd.Tpo"; exit 1; \
2.132 +@am__fastdepCC_TRUE@ fi
2.133 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='aica/audio_esd.c' object='audio_esd.o' libtool=no @AMDEPBACKSLASH@
2.134 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/audio_esd.Po' tmpdepfile='$(DEPDIR)/audio_esd.TPo' @AMDEPBACKSLASH@
2.135 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
2.136 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o audio_esd.o `test -f 'aica/audio_esd.c' || echo '$(srcdir)/'`aica/audio_esd.c
2.137 +
2.138 +audio_esd.obj: aica/audio_esd.c
2.139 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT audio_esd.obj -MD -MP -MF "$(DEPDIR)/audio_esd.Tpo" \
2.140 +@am__fastdepCC_TRUE@ -c -o audio_esd.obj `if test -f 'aica/audio_esd.c'; then $(CYGPATH_W) 'aica/audio_esd.c'; else $(CYGPATH_W) '$(srcdir)/aica/audio_esd.c'; fi`; \
2.141 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/audio_esd.Tpo" "$(DEPDIR)/audio_esd.Po"; \
2.142 +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/audio_esd.Tpo"; exit 1; \
2.143 +@am__fastdepCC_TRUE@ fi
2.144 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='aica/audio_esd.c' object='audio_esd.obj' libtool=no @AMDEPBACKSLASH@
2.145 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/audio_esd.Po' tmpdepfile='$(DEPDIR)/audio_esd.TPo' @AMDEPBACKSLASH@
2.146 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
2.147 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o audio_esd.obj `if test -f 'aica/audio_esd.c'; then $(CYGPATH_W) 'aica/audio_esd.c'; else $(CYGPATH_W) '$(srcdir)/aica/audio_esd.c'; fi`
2.148 +
2.149 maple.o: maple/maple.c
2.150 @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT maple.o -MD -MP -MF "$(DEPDIR)/maple.Tpo" \
2.151 @am__fastdepCC_TRUE@ -c -o maple.o `test -f 'maple/maple.c' || echo '$(srcdir)/'`maple/maple.c; \
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
3.2 +++ b/src/bios.c Sun Jan 22 22:40:53 2006 +0000
3.3 @@ -0,0 +1,213 @@
3.4 +/**
3.5 + * $Id: bios.c,v 1.1 2006-01-22 22:40:53 nkeynes Exp $
3.6 + *
3.7 + * "Fake" BIOS functions, for operation without the actual BIOS.
3.8 + *
3.9 + * Copyright (c) 2005 Nathan Keynes.
3.10 + *
3.11 + * This program is free software; you can redistribute it and/or modify
3.12 + * it under the terms of the GNU General Public License as published by
3.13 + * the Free Software Foundation; either version 2 of the License, or
3.14 + * (at your option) any later version.
3.15 + *
3.16 + * This program is distributed in the hope that it will be useful,
3.17 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
3.18 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3.19 + * GNU General Public License for more details.
3.20 + */
3.21 +
3.22 +#include "dream.h"
3.23 +#include "mem.h"
3.24 +#include "bios.h"
3.25 +#include "sh4/sh4core.h"
3.26 +
3.27 +#define COMMAND_QUEUE_LENGTH 16
3.28 +
3.29 +/* TODO: Check if these are the real ATAPI command codes or not */
3.30 +#define GD_CMD_PIOREAD 16
3.31 +#define GD_CMD_DMAREAD 17
3.32 +#define GD_CMD_GETTOC 18
3.33 +#define GD_CMD_GETTOC2 19
3.34 +#define GD_CMD_PLAY 20
3.35 +#define GD_CMD_PLAY2 21
3.36 +#define GD_CMD_PAUSE 22
3.37 +#define GD_CMD_RELEASE 23
3.38 +#define GD_CMD_INIT 24
3.39 +#define GD_CMD_SEEK 27
3.40 +#define GD_CMD_READ 28
3.41 +#define GD_CMD_STOP 33
3.42 +#define GD_CMD_GETSCD 34
3.43 +#define GD_CMD_GETSES 35
3.44 +
3.45 +#define GD_CMD_STATUS_NONE 0
3.46 +#define GD_CMD_STATUS_ACTIVE 1
3.47 +#define GD_CMD_STATUS_DONE 2
3.48 +#define GD_CMD_STATUS_ABORT 3
3.49 +#define GD_CMD_STATUS_ERROR 4
3.50 +
3.51 +#define GD_ERROR_OK 0
3.52 +#define GD_ERROR_NO_DISC 2
3.53 +#define GD_ERROR_DISC_CHANGE 6
3.54 +#define GD_ERROR_SYSTEM 1
3.55 +
3.56 +
3.57 +typedef struct gdrom_command {
3.58 + int status;
3.59 + uint32_t cmd_code;
3.60 + char *data;
3.61 + uint32_t result[4];
3.62 +} *gdrom_command_t;
3.63 +
3.64 +static struct gdrom_command gdrom_cmd_queue[COMMAND_QUEUE_LENGTH];
3.65 +
3.66 +static struct bios_gdrom_status {
3.67 + uint32_t status;
3.68 + uint32_t disk_type;
3.69 +} bios_gdrom_status;
3.70 +
3.71 +void bios_gdrom_run_command( gdrom_command_t cmd )
3.72 +{
3.73 + DEBUG( "BIOS GD command %d", cmd->cmd_code );
3.74 + switch( cmd->cmd_code ) {
3.75 + case GD_CMD_INIT:
3.76 + /* *shrug* */
3.77 + cmd->status = GD_CMD_STATUS_DONE;
3.78 + break;
3.79 + default:
3.80 + cmd->status = GD_CMD_STATUS_ERROR;
3.81 + cmd->result[0] = GD_ERROR_SYSTEM;
3.82 + break;
3.83 + }
3.84 +}
3.85 +
3.86 +void bios_gdrom_init( void )
3.87 +{
3.88 + memset( &gdrom_cmd_queue, 0, sizeof(gdrom_cmd_queue) );
3.89 +}
3.90 +
3.91 +uint32_t bios_gdrom_enqueue( uint32_t cmd, char *ptr )
3.92 +{
3.93 + int i;
3.94 + for( i=0; i<COMMAND_QUEUE_LENGTH; i++ ) {
3.95 + if( gdrom_cmd_queue[i].status != GD_CMD_STATUS_ACTIVE ) {
3.96 + gdrom_cmd_queue[i].status = GD_CMD_STATUS_ACTIVE;
3.97 + gdrom_cmd_queue[i].cmd_code = cmd;
3.98 + gdrom_cmd_queue[i].data = ptr;
3.99 + return i;
3.100 + }
3.101 + }
3.102 + return -1;
3.103 +}
3.104 +
3.105 +void bios_gdrom_run_queue( void )
3.106 +{
3.107 + int i;
3.108 + for( i=0; i<COMMAND_QUEUE_LENGTH; i++ ) {
3.109 + if( gdrom_cmd_queue[i].status == GD_CMD_STATUS_ACTIVE ) {
3.110 + bios_gdrom_run_command( &gdrom_cmd_queue[i] );
3.111 + }
3.112 + }
3.113 +}
3.114 +
3.115 +gdrom_command_t bios_gdrom_get_command( uint32_t id )
3.116 +{
3.117 + if( id >= COMMAND_QUEUE_LENGTH ||
3.118 + gdrom_cmd_queue[id].status == GD_CMD_STATUS_NONE )
3.119 + return NULL;
3.120 + return &gdrom_cmd_queue[id];
3.121 +}
3.122 +
3.123 +void bios_install( void )
3.124 +{
3.125 + bios_gdrom_init();
3.126 + sh4_write_long( 0x8C0000B0, 0xFFFFFFB0 );
3.127 + sh4_write_long( 0x8C0000B4, 0xFFFFFFB4 );
3.128 + sh4_write_long( 0x8C0000B8, 0xFFFFFFB8 );
3.129 + sh4_write_long( 0x8C0000BC, 0xFFFFFFBC );
3.130 + sh4_write_long( 0x8C0000E0, 0xFFFFFFE0 );
3.131 +}
3.132 +
3.133 +/**
3.134 + * Syscall list courtesy of Marcus Comstedt
3.135 + */
3.136 +
3.137 +void bios_syscall( uint32_t syscallid )
3.138 +{
3.139 + gdrom_command_t cmd;
3.140 +
3.141 + switch( syscallid ) {
3.142 + case 0xB0: /* sysinfo */
3.143 + break;
3.144 + case 0xB4: /* Font */
3.145 + break;
3.146 + case 0xB8: /* Flash */
3.147 + break;
3.148 + case 0xBC: /* Misc/GD-Rom */
3.149 + switch( sh4r.r[6] ) {
3.150 + case 0: /* GD-Rom */
3.151 + switch( sh4r.r[7] ) {
3.152 + case 0: /* Send command */
3.153 + if( sh4r.r[5] == 0 )
3.154 + sh4r.r[0] = bios_gdrom_enqueue( sh4r.r[4], NULL );
3.155 + else
3.156 + sh4r.r[0] = bios_gdrom_enqueue( sh4r.r[4], mem_get_region(sh4r.r[5]) );
3.157 + break;
3.158 + case 1: /* Check command */
3.159 + cmd = bios_gdrom_get_command( sh4r.r[4] );
3.160 + if( cmd == NULL ) {
3.161 + sh4r.r[0] = GD_CMD_STATUS_NONE;
3.162 + } else {
3.163 + sh4r.r[0] = cmd->status;
3.164 + if( cmd->status == GD_CMD_STATUS_ERROR &&
3.165 + sh4r.r[5] != 0 ) {
3.166 + mem_copy_to_sh4( sh4r.r[5], &cmd->result, sizeof(cmd->result) );
3.167 + }
3.168 + }
3.169 + break;
3.170 + case 2: /* Mainloop */
3.171 + bios_gdrom_run_queue();
3.172 + break;
3.173 + case 3: /* Init */
3.174 + bios_gdrom_init();
3.175 + break;
3.176 + case 4: /* Drive status */
3.177 + if( sh4r.r[4] != 0 ) {
3.178 + mem_copy_to_sh4( sh4r.r[4], &bios_gdrom_status,
3.179 + sizeof(bios_gdrom_status) );
3.180 + }
3.181 + sh4r.r[0] = 0;
3.182 + break;
3.183 + case 8: /* Abort command */
3.184 + cmd = bios_gdrom_get_command( sh4r.r[4] );
3.185 + if( cmd == NULL || cmd->status != GD_CMD_STATUS_ACTIVE ) {
3.186 + sh4r.r[0] = -1;
3.187 + } else {
3.188 + cmd->status = GD_CMD_STATUS_ABORT;
3.189 + sh4r.r[0] = 0;
3.190 + }
3.191 + break;
3.192 + case 9: /* Reset */
3.193 + break;
3.194 + case 10: /* Set mode */
3.195 + sh4r.r[0] = 0;
3.196 + break;
3.197 + }
3.198 + break;
3.199 + case -1: /* Misc */
3.200 + break;
3.201 + default: /* ??? */
3.202 + break;
3.203 + }
3.204 + break;
3.205 + case 0xE0: /* Menu */
3.206 + switch( sh4r.r[7] ) {
3.207 + case 0:
3.208 + WARN( "Entering main program" );
3.209 + break;
3.210 + case 1:
3.211 + WARN( "Program aborted to DC menu");
3.212 + dreamcast_stop();
3.213 + break;
3.214 + }
3.215 + }
3.216 +}
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
4.2 +++ b/src/bios.h Sun Jan 22 22:40:53 2006 +0000
4.3 @@ -0,0 +1,45 @@
4.4 +/**
4.5 + * $Id: bios.h,v 1.1 2006-01-22 22:40:53 nkeynes Exp $
4.6 + *
4.7 + * "Fake" BIOS support, to allow basic functionality without the BIOS
4.8 + * actually being present.
4.9 + *
4.10 + * Copyright (c) 2005 Nathan Keynes.
4.11 + *
4.12 + * This program is free software; you can redistribute it and/or modify
4.13 + * it under the terms of the GNU General Public License as published by
4.14 + * the Free Software Foundation; either version 2 of the License, or
4.15 + * (at your option) any later version.
4.16 + *
4.17 + * This program is distributed in the hope that it will be useful,
4.18 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
4.19 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4.20 + * GNU General Public License for more details.
4.21 + */
4.22 +#ifndef dream_bios_H
4.23 +#define dream_bios_H 1
4.24 +
4.25 +#include <stdint.h>
4.26 +#include <glib/gtypes.h>
4.27 +
4.28 +#ifdef __cplusplus
4.29 +extern "C" {
4.30 +#endif
4.31 +
4.32 +/**
4.33 + * Execute a BIOS syscall identified by a syscall ID (currently the last
4.34 + * byte of the vector).
4.35 + */
4.36 +void bios_syscall( uint32_t syscallid );
4.37 +
4.38 +/**
4.39 + * Install the BIOS emu hack into ram (sets the vectors at 8C0000B0 through
4.40 + * 8C0000C0)
4.41 + */
4.42 +void bios_install( void );
4.43 +
4.44 +
4.45 +#ifdef __cplusplus
4.46 +}
4.47 +#endif
4.48 +#endif
5.1 --- a/src/main.c Sun Jan 22 22:40:05 2006 +0000
5.2 +++ b/src/main.c Sun Jan 22 22:40:53 2006 +0000
5.3 @@ -1,5 +1,5 @@
5.4 /**
5.5 - * $Id: main.c,v 1.11 2006-01-16 11:18:29 nkeynes Exp $
5.6 + * $Id: main.c,v 1.12 2006-01-22 22:40:53 nkeynes Exp $
5.7 *
5.8 * Main program, initializes dreamcast and gui, then passes control off to
5.9 * the gtk main loop (currently).
5.10 @@ -27,15 +27,17 @@
5.11 #include <gnome.h>
5.12 #include "gui/gui.h"
5.13 #include "dream.h"
5.14 +#include "bios.h"
5.15 #include "dreamcast.h"
5.16
5.17 #define S3M_PLAYER "s3mplay.bin"
5.18
5.19 -char *option_list = "a:s:A:V:ph";
5.20 +char *option_list = "a:s:A:V:phb";
5.21 char *aica_program = NULL;
5.22 char *s3m_file = NULL;
5.23 gboolean start_immediately = FALSE;
5.24 gboolean headless = FALSE;
5.25 +gboolean without_bios = FALSE;
5.26
5.27 int main (int argc, char *argv[])
5.28 {
5.29 @@ -61,6 +63,9 @@
5.30 case 'p': /* Start immediately */
5.31 start_immediately = TRUE;
5.32 break;
5.33 + case 'b': /* No BIOS */
5.34 + without_bios = TRUE;
5.35 + break;
5.36 case 'h': /* Headless */
5.37 headless = TRUE;
5.38 break;
5.39 @@ -87,6 +92,9 @@
5.40 }
5.41 }
5.42
5.43 + if( without_bios ) {
5.44 + bios_install();
5.45 + }
5.46 INFO( "DreamOn! ready..." );
5.47 if( start_immediately )
5.48 dreamcast_run();
.