Search
lxdream.org :: lxdream/src/bios.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/bios.c
changeset 736:a02d1475ccfd
prev586:2a3ba82cf243
next1065:bc1cc0c54917
author nkeynes
date Mon Jul 14 07:44:42 2008 +0000 (11 years ago)
permissions -rw-r--r--
last change Re-indent everything consistently
Fix include guards for consistency as well
file annotate diff log raw
1.1 --- a/src/bios.c Tue Jan 15 20:50:23 2008 +0000
1.2 +++ b/src/bios.c Mon Jul 14 07:44:42 2008 +0000
1.3 @@ -71,13 +71,13 @@
1.4 DEBUG( "BIOS GD command %d", cmd->cmd_code );
1.5 switch( cmd->cmd_code ) {
1.6 case GD_CMD_INIT:
1.7 - /* *shrug* */
1.8 - cmd->status = GD_CMD_STATUS_DONE;
1.9 - break;
1.10 + /* *shrug* */
1.11 + cmd->status = GD_CMD_STATUS_DONE;
1.12 + break;
1.13 default:
1.14 - cmd->status = GD_CMD_STATUS_ERROR;
1.15 - cmd->result[0] = GD_ERROR_SYSTEM;
1.16 - break;
1.17 + cmd->status = GD_CMD_STATUS_ERROR;
1.18 + cmd->result[0] = GD_ERROR_SYSTEM;
1.19 + break;
1.20 }
1.21 }
1.22
1.23 @@ -90,12 +90,12 @@
1.24 {
1.25 int i;
1.26 for( i=0; i<COMMAND_QUEUE_LENGTH; i++ ) {
1.27 - if( gdrom_cmd_queue[i].status != GD_CMD_STATUS_ACTIVE ) {
1.28 - gdrom_cmd_queue[i].status = GD_CMD_STATUS_ACTIVE;
1.29 - gdrom_cmd_queue[i].cmd_code = cmd;
1.30 - gdrom_cmd_queue[i].data = ptr;
1.31 - return i;
1.32 - }
1.33 + if( gdrom_cmd_queue[i].status != GD_CMD_STATUS_ACTIVE ) {
1.34 + gdrom_cmd_queue[i].status = GD_CMD_STATUS_ACTIVE;
1.35 + gdrom_cmd_queue[i].cmd_code = cmd;
1.36 + gdrom_cmd_queue[i].data = ptr;
1.37 + return i;
1.38 + }
1.39 }
1.40 return -1;
1.41 }
1.42 @@ -104,17 +104,17 @@
1.43 {
1.44 int i;
1.45 for( i=0; i<COMMAND_QUEUE_LENGTH; i++ ) {
1.46 - if( gdrom_cmd_queue[i].status == GD_CMD_STATUS_ACTIVE ) {
1.47 - bios_gdrom_run_command( &gdrom_cmd_queue[i] );
1.48 - }
1.49 + if( gdrom_cmd_queue[i].status == GD_CMD_STATUS_ACTIVE ) {
1.50 + bios_gdrom_run_command( &gdrom_cmd_queue[i] );
1.51 + }
1.52 }
1.53 }
1.54
1.55 gdrom_command_t bios_gdrom_get_command( uint32_t id )
1.56 {
1.57 if( id >= COMMAND_QUEUE_LENGTH ||
1.58 - gdrom_cmd_queue[id].status == GD_CMD_STATUS_NONE )
1.59 - return NULL;
1.60 + gdrom_cmd_queue[id].status == GD_CMD_STATUS_NONE )
1.61 + return NULL;
1.62 return &gdrom_cmd_queue[id];
1.63 }
1.64
1.65 @@ -128,78 +128,78 @@
1.66
1.67 switch( syscallid ) {
1.68 case 0xB0: /* sysinfo */
1.69 - break;
1.70 + break;
1.71 case 0xB4: /* Font */
1.72 - break;
1.73 + break;
1.74 case 0xB8: /* Flash */
1.75 - break;
1.76 + break;
1.77 case 0xBC: /* Misc/GD-Rom */
1.78 - switch( sh4r.r[6] ) {
1.79 - case 0: /* GD-Rom */
1.80 - switch( sh4r.r[7] ) {
1.81 - case 0: /* Send command */
1.82 - if( sh4r.r[5] == 0 )
1.83 - sh4r.r[0] = bios_gdrom_enqueue( sh4r.r[4], NULL );
1.84 - else
1.85 - sh4r.r[0] = bios_gdrom_enqueue( sh4r.r[4], mem_get_region(sh4r.r[5]) );
1.86 - break;
1.87 - case 1: /* Check command */
1.88 - cmd = bios_gdrom_get_command( sh4r.r[4] );
1.89 - if( cmd == NULL ) {
1.90 - sh4r.r[0] = GD_CMD_STATUS_NONE;
1.91 - } else {
1.92 - sh4r.r[0] = cmd->status;
1.93 - if( cmd->status == GD_CMD_STATUS_ERROR &&
1.94 - sh4r.r[5] != 0 ) {
1.95 - mem_copy_to_sh4( sh4r.r[5], (sh4ptr_t)&cmd->result, sizeof(cmd->result) );
1.96 - }
1.97 - }
1.98 - break;
1.99 - case 2: /* Mainloop */
1.100 - bios_gdrom_run_queue();
1.101 - break;
1.102 - case 3: /* Init */
1.103 - bios_gdrom_init();
1.104 - break;
1.105 - case 4: /* Drive status */
1.106 - if( sh4r.r[4] != 0 ) {
1.107 - mem_copy_to_sh4( sh4r.r[4], (sh4ptr_t)&bios_gdrom_status,
1.108 - sizeof(bios_gdrom_status) );
1.109 - }
1.110 - sh4r.r[0] = 0;
1.111 - break;
1.112 - case 8: /* Abort command */
1.113 - cmd = bios_gdrom_get_command( sh4r.r[4] );
1.114 - if( cmd == NULL || cmd->status != GD_CMD_STATUS_ACTIVE ) {
1.115 - sh4r.r[0] = -1;
1.116 - } else {
1.117 - cmd->status = GD_CMD_STATUS_ABORT;
1.118 - sh4r.r[0] = 0;
1.119 - }
1.120 - break;
1.121 - case 9: /* Reset */
1.122 - break;
1.123 - case 10: /* Set mode */
1.124 - sh4r.r[0] = 0;
1.125 - break;
1.126 - }
1.127 - break;
1.128 - case -1: /* Misc */
1.129 - break;
1.130 - default: /* ??? */
1.131 - break;
1.132 - }
1.133 - break;
1.134 - case 0xE0: /* Menu */
1.135 - switch( sh4r.r[7] ) {
1.136 - case 0:
1.137 - WARN( "Entering main program" );
1.138 - break;
1.139 - case 1:
1.140 - WARN( "Program aborted to DC menu");
1.141 - dreamcast_stop();
1.142 - break;
1.143 - }
1.144 + switch( sh4r.r[6] ) {
1.145 + case 0: /* GD-Rom */
1.146 + switch( sh4r.r[7] ) {
1.147 + case 0: /* Send command */
1.148 + if( sh4r.r[5] == 0 )
1.149 + sh4r.r[0] = bios_gdrom_enqueue( sh4r.r[4], NULL );
1.150 + else
1.151 + sh4r.r[0] = bios_gdrom_enqueue( sh4r.r[4], mem_get_region(sh4r.r[5]) );
1.152 + break;
1.153 + case 1: /* Check command */
1.154 + cmd = bios_gdrom_get_command( sh4r.r[4] );
1.155 + if( cmd == NULL ) {
1.156 + sh4r.r[0] = GD_CMD_STATUS_NONE;
1.157 + } else {
1.158 + sh4r.r[0] = cmd->status;
1.159 + if( cmd->status == GD_CMD_STATUS_ERROR &&
1.160 + sh4r.r[5] != 0 ) {
1.161 + mem_copy_to_sh4( sh4r.r[5], (sh4ptr_t)&cmd->result, sizeof(cmd->result) );
1.162 + }
1.163 + }
1.164 + break;
1.165 + case 2: /* Mainloop */
1.166 + bios_gdrom_run_queue();
1.167 + break;
1.168 + case 3: /* Init */
1.169 + bios_gdrom_init();
1.170 + break;
1.171 + case 4: /* Drive status */
1.172 + if( sh4r.r[4] != 0 ) {
1.173 + mem_copy_to_sh4( sh4r.r[4], (sh4ptr_t)&bios_gdrom_status,
1.174 + sizeof(bios_gdrom_status) );
1.175 + }
1.176 + sh4r.r[0] = 0;
1.177 + break;
1.178 + case 8: /* Abort command */
1.179 + cmd = bios_gdrom_get_command( sh4r.r[4] );
1.180 + if( cmd == NULL || cmd->status != GD_CMD_STATUS_ACTIVE ) {
1.181 + sh4r.r[0] = -1;
1.182 + } else {
1.183 + cmd->status = GD_CMD_STATUS_ABORT;
1.184 + sh4r.r[0] = 0;
1.185 + }
1.186 + break;
1.187 + case 9: /* Reset */
1.188 + break;
1.189 + case 10: /* Set mode */
1.190 + sh4r.r[0] = 0;
1.191 + break;
1.192 + }
1.193 + break;
1.194 + case -1: /* Misc */
1.195 + break;
1.196 + default: /* ??? */
1.197 + break;
1.198 + }
1.199 + break;
1.200 + case 0xE0: /* Menu */
1.201 + switch( sh4r.r[7] ) {
1.202 + case 0:
1.203 + WARN( "Entering main program" );
1.204 + break;
1.205 + case 1:
1.206 + WARN( "Program aborted to DC menu");
1.207 + dreamcast_stop();
1.208 + break;
1.209 + }
1.210 }
1.211 }
1.212
.