home *** CD-ROM | disk | FTP | other *** search
/ hobbes.nmsu.edu 2008 / 2008-06-02_hobbes.nmsu.edu.zip / new / scummc-0.2.0-os2.zip / ScummC / src / scc_target.c < prev    next >
Encoding:
C/C++ Source or Header  |  2007-11-27  |  4.5 KB  |  142 lines

  1. /* ScummC
  2.  * Copyright (C) 2007  Alban Bedel
  3.  *
  4.  * This program is free software; you can redistribute it and/or
  5.  * modify it under the terms of the GNU General Public License
  6.  * as published by the Free Software Foundation; either version 2
  7.  * of the License, or (at your option) any later version.
  8.  
  9.  * This program is distributed in the hope that it will be useful,
  10.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12.  * GNU General Public License for more details.
  13.  
  14.  * You should have received a copy of the GNU General Public License
  15.  * along with this program; if not, write to the Free Software
  16.  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  17.  *
  18.  */
  19.  
  20. /// @defgroup scc_target ScummC target definitons
  21. /**
  22.  * @file scc_target.c
  23.  * @ingroup scc_target
  24.  * @brief ScummC target definitions
  25.  */
  26.  
  27. #include "config.h"
  28.  
  29. #include <stdlib.h>
  30. #include <stdio.h>
  31. #include <string.h>
  32. #include <inttypes.h>
  33. #include <errno.h>
  34.  
  35. #include "scc_util.h"
  36. #include "scc_parse.h"
  37.  
  38. #include "scc_func.h"
  39.  
  40. static int scc_addr_max_v6[] = {
  41.     0,                       // unused
  42.     0x3FFF,                  // VAR
  43.     0xFF,                    // ROOM
  44.     0xC7,                    // SCR
  45.     0xFFFF,                  // COST
  46.     0xFFFF,                  // SOUND
  47.     0xFFFF,                  // CHSET
  48.     0xFF,                    // LSCR
  49.     0xFE,                    // VERB (0xFF is default)
  50.     0xFFFF,                  // OBJ
  51.     0x0F,                    // STATE
  52.     0x400F,                  // LVAR
  53.     0xFFFF,                  // BVAR
  54.     0xFFFF,                  // PALS
  55.     0x0F,                    // CYCL
  56.     0x0F,                    // ACTOR
  57.     0xFF,                    // BOX
  58.     SCC_MAX_CLASS,           // CLASS
  59.     0x7FFFFFFF               // VOICE
  60. };
  61.  
  62. static int scc_addr_min_v6[] = {
  63.     0,                       // nothing
  64.     0x100,                   // VAR (don't use the engine vars)
  65.     1,                       // ROOM
  66.     1,                       // SCR
  67.     1,                       // COST
  68.     1,                       // SOUND
  69.     1,                       // CHSET
  70.     200,                     // LSCR
  71.     1,                       // VERB
  72.     17,                      // OBJ
  73.     1,                       // STATE
  74.     0x4000,                  // LVAR
  75.     0x8000,                  // BVAR
  76.     1,                       // PAL
  77.     1,                       // CYCL
  78.     1,                       // ACTOR
  79.     0,                       // BOX
  80.     1,                       // CLASS
  81.     0                        // VOICE
  82. };
  83.  
  84.  
  85. static int scc_addr_max_v7[] = {
  86.     0,                       // unused
  87.     0x3FFF,                  // VAR
  88.     0xFF,                    // ROOM
  89.     0x7CF,                   // SCR
  90.     0xFFFF,                  // COST
  91.     0xFFFF,                  // SOUND
  92.     0xFFFF,                  // CHSET
  93.     0xFFFF,                  // LSCR
  94.     0xFE,                    // VERB (0xFF is default)
  95.     0xFFFF,                  // OBJ
  96.     0xFF,                    // STATE
  97.     0x400F,                  // LVAR
  98.     0xFFFF,                  // BVAR
  99.     0xFFFF,                  // PALS
  100.     0x0F,                    // CYCL
  101.     0x1D,                    // ACTOR
  102.     0xFF,                    // BOX
  103.     SCC_MAX_CLASS,           // CLASS
  104.     0x7FFFFFFF               // VOICE
  105. };
  106.  
  107. static int scc_addr_min_v7[] = {
  108.     0,                       // nothing
  109.     0x100,                     // VAR (don't use the engine vars)
  110.     1,                       // ROOM
  111.     1,                       // SCR
  112.     1,                       // COST
  113.     1,                       // SOUND
  114.     1,                       // CHSET
  115.     2000,                    // LSCR
  116.     1,                       // VERB
  117.     32,                      // OBJ
  118.     1,                       // STATE
  119.     0x4000,                  // LVAR
  120.     0x8000,                  // BVAR
  121.     1,                       // PAL
  122.     1,                       // CYCL
  123.     1,                       // ACTOR
  124.     0,                       // BOX
  125.     1,                       // CLASS
  126.     0                        // VOICE
  127. };
  128.  
  129. static scc_target_t target_list[] = {
  130.     { 6, scc_func_v6, scc_addr_max_v6, scc_addr_min_v6, 200 },
  131.     { 7, scc_func_v7, scc_addr_max_v7, scc_addr_min_v7, 2000 },
  132.     { -1 }
  133. };
  134.  
  135. scc_target_t* scc_get_target(int version) {
  136.     int i;
  137.     for(i = 0 ; target_list[i].version >= 0 ; i++)
  138.         if(target_list[i].version == version)
  139.             return target_list+i;
  140.     return NULL;
  141. }
  142.