| 1 | #cxx . . $ `<file>/sfc/chip/dsp3/dsp3emu.c`/ifdef DSP3_CPPcxx . . $ `sfc/chip/dsp3/dsp3.cpp:3:9`! |
| 2 | |
| 3 | //DSP-3 emulator code |
| 4 | //Copyright (c) 2003-2006 John Weidman, Kris Bleakley, Lancer, z80 gaiden |
| 5 | |
| 6 | uint16cxx . . $ uint16# DSP3_DataROMcxx . . $ SuperFamicom/DSP3i/DSP3_DataROM.[1024] = { |
| 7 | 0x8000, 0x4000, 0x2000, 0x1000, 0x0800, 0x0400, 0x0200, 0x0100, |
| 8 | 0x0080, 0x0040, 0x0020, 0x0010, 0x0008, 0x0004, 0x0002, 0x0001, |
| 9 | 0x0002, 0x0004, 0x0008, 0x0010, 0x0020, 0x0040, 0x0080, 0x0100, |
| 10 | 0x0000, 0x000f, 0x0400, 0x0200, 0x0140, 0x0400, 0x0200, 0x0040, |
| 11 | 0x007d, 0x007e, 0x007e, 0x007b, 0x007c, 0x007d, 0x007b, 0x007c, |
| 12 | 0x0002, 0x0020, 0x0030, 0x0000, 0x000d, 0x0019, 0x0026, 0x0032, |
| 13 | 0x003e, 0x004a, 0x0056, 0x0062, 0x006d, 0x0079, 0x0084, 0x008e, |
| 14 | 0x0098, 0x00a2, 0x00ac, 0x00b5, 0x00be, 0x00c6, 0x00ce, 0x00d5, |
| 15 | 0x00dc, 0x00e2, 0x00e7, 0x00ec, 0x00f1, 0x00f5, 0x00f8, 0x00fb, |
| 16 | 0x00fd, 0x00ff, 0x0100, 0x0100, 0x0100, 0x00ff, 0x00fd, 0x00fb, |
| 17 | 0x00f8, 0x00f5, 0x00f1, 0x00ed, 0x00e7, 0x00e2, 0x00dc, 0x00d5, |
| 18 | 0x00ce, 0x00c6, 0x00be, 0x00b5, 0x00ac, 0x00a2, 0x0099, 0x008e, |
| 19 | 0x0084, 0x0079, 0x006e, 0x0062, 0x0056, 0x004a, 0x003e, 0x0032, |
| 20 | 0x0026, 0x0019, 0x000d, 0x0000, 0xfff3, 0xffe7, 0xffdb, 0xffce, |
| 21 | 0xffc2, 0xffb6, 0xffaa, 0xff9e, 0xff93, 0xff87, 0xff7d, 0xff72, |
| 22 | 0xff68, 0xff5e, 0xff54, 0xff4b, 0xff42, 0xff3a, 0xff32, 0xff2b, |
| 23 | 0xff25, 0xff1e, 0xff19, 0xff14, 0xff0f, 0xff0b, 0xff08, 0xff05, |
| 24 | 0xff03, 0xff01, 0xff00, 0xff00, 0xff00, 0xff01, 0xff03, 0xff05, |
| 25 | 0xff08, 0xff0b, 0xff0f, 0xff13, 0xff18, 0xff1e, 0xff24, 0xff2b, |
| 26 | 0xff32, 0xff3a, 0xff42, 0xff4b, 0xff54, 0xff5d, 0xff67, 0xff72, |
| 27 | 0xff7c, 0xff87, 0xff92, 0xff9e, 0xffa9, 0xffb5, 0xffc2, 0xffce, |
| 28 | 0xffda, 0xffe7, 0xfff3, 0x002b, 0x007f, 0x0020, 0x00ff, 0xff00, |
| 29 | 0xffbe, 0x0000, 0x0044, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, |
| 30 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, |
| 31 | 0x0000, 0x0000, 0x0000, 0x0000, 0xffc1, 0x0001, 0x0002, 0x0045, |
| 32 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, |
| 33 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, |
| 34 | 0xffc5, 0x0003, 0x0004, 0x0005, 0x0047, 0x0000, 0x0000, 0x0000, |
| 35 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, |
| 36 | 0x0000, 0x0000, 0x0000, 0x0000, 0xffca, 0x0006, 0x0007, 0x0008, |
| 37 | 0x0009, 0x004a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, |
| 38 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, |
| 39 | 0xffd0, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x004e, 0x0000, |
| 40 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, |
| 41 | 0x0000, 0x0000, 0x0000, 0x0000, 0xffd7, 0x000f, 0x0010, 0x0011, |
| 42 | 0x0012, 0x0013, 0x0014, 0x0053, 0x0000, 0x0000, 0x0000, 0x0000, |
| 43 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, |
| 44 | 0xffdf, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001a, 0x001b, |
| 45 | 0x0059, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, |
| 46 | 0x0000, 0x0000, 0x0000, 0x0000, 0xffe8, 0x001c, 0x001d, 0x001e, |
| 47 | 0x001f, 0x0020, 0x0021, 0x0022, 0x0023, 0x0060, 0x0000, 0x0000, |
| 48 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, |
| 49 | 0xfff2, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002a, |
| 50 | 0x002b, 0x002c, 0x0068, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, |
| 51 | 0x0000, 0x0000, 0x0000, 0x0000, 0xfffd, 0x002d, 0x002e, 0x002f, |
| 52 | 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0071, |
| 53 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, |
| 54 | 0xffc7, 0x0037, 0x0038, 0x0039, 0x003a, 0x003b, 0x003c, 0x003d, |
| 55 | 0x003e, 0x003f, 0x0040, 0x0041, 0x007b, 0x0000, 0x0000, 0x0000, |
| 56 | 0x0000, 0x0000, 0x0000, 0x0000, 0xffd4, 0x0000, 0x0001, 0x0002, |
| 57 | 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000a, |
| 58 | 0x000b, 0x0044, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, |
| 59 | 0xffe2, 0x000c, 0x000d, 0x000e, 0x000f, 0x0010, 0x0011, 0x0012, |
| 60 | 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0050, 0x0000, |
| 61 | 0x0000, 0x0000, 0x0000, 0x0000, 0xfff1, 0x0019, 0x001a, 0x001b, |
| 62 | 0x001c, 0x001d, 0x001e, 0x001f, 0x0020, 0x0021, 0x0022, 0x0023, |
| 63 | 0x0024, 0x0025, 0x0026, 0x005d, 0x0000, 0x0000, 0x0000, 0x0000, |
| 64 | 0xffcb, 0x0027, 0x0028, 0x0029, 0x002a, 0x002b, 0x002c, 0x002d, |
| 65 | 0x002e, 0x002f, 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, |
| 66 | 0x006b, 0x0000, 0x0000, 0x0000, 0xffdc, 0x0000, 0x0001, 0x0002, |
| 67 | 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000a, |
| 68 | 0x000b, 0x000c, 0x000d, 0x000e, 0x000f, 0x0044, 0x0000, 0x0000, |
| 69 | 0xffee, 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, |
| 70 | 0x0017, 0x0018, 0x0019, 0x001a, 0x001b, 0x001c, 0x001d, 0x001e, |
| 71 | 0x001f, 0x0020, 0x0054, 0x0000, 0xffee, 0x0021, 0x0022, 0x0023, |
| 72 | 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002a, 0x002b, |
| 73 | 0x002c, 0x002d, 0x002e, 0x002f, 0x0030, 0x0031, 0x0032, 0x0065, |
| 74 | 0xffbe, 0x0000, 0xfeac, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, |
| 75 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, |
| 76 | 0x0000, 0x0000, 0x0000, 0x0000, 0xffc1, 0x0001, 0x0002, 0xfead, |
| 77 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, |
| 78 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, |
| 79 | 0xffc5, 0x0003, 0x0004, 0x0005, 0xfeaf, 0x0000, 0x0000, 0x0000, |
| 80 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, |
| 81 | 0x0000, 0x0000, 0x0000, 0x0000, 0xffca, 0x0006, 0x0007, 0x0008, |
| 82 | 0x0009, 0xfeb2, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, |
| 83 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, |
| 84 | 0xffd0, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0xfeb6, 0x0000, |
| 85 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, |
| 86 | 0x0000, 0x0000, 0x0000, 0x0000, 0xffd7, 0x000f, 0x0010, 0x0011, |
| 87 | 0x0012, 0x0013, 0x0014, 0xfebb, 0x0000, 0x0000, 0x0000, 0x0000, |
| 88 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, |
| 89 | 0xffdf, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001a, 0x001b, |
| 90 | 0xfec1, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, |
| 91 | 0x0000, 0x0000, 0x0000, 0x0000, 0xffe8, 0x001c, 0x001d, 0x001e, |
| 92 | 0x001f, 0x0020, 0x0021, 0x0022, 0x0023, 0xfec8, 0x0000, 0x0000, |
| 93 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, |
| 94 | 0xfff2, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002a, |
| 95 | 0x002b, 0x002c, 0xfed0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, |
| 96 | 0x0000, 0x0000, 0x0000, 0x0000, 0xfffd, 0x002d, 0x002e, 0x002f, |
| 97 | 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0xfed9, |
| 98 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, |
| 99 | 0xffc7, 0x0037, 0x0038, 0x0039, 0x003a, 0x003b, 0x003c, 0x003d, |
| 100 | 0x003e, 0x003f, 0x0040, 0x0041, 0xfee3, 0x0000, 0x0000, 0x0000, |
| 101 | 0x0000, 0x0000, 0x0000, 0x0000, 0xffd4, 0x0000, 0x0001, 0x0002, |
| 102 | 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000a, |
| 103 | 0x000b, 0xfeac, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, |
| 104 | 0xffe2, 0x000c, 0x000d, 0x000e, 0x000f, 0x0010, 0x0011, 0x0012, |
| 105 | 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0xfeb8, 0x0000, |
| 106 | 0x0000, 0x0000, 0x0000, 0x0000, 0xfff1, 0x0019, 0x001a, 0x001b, |
| 107 | 0x001c, 0x001d, 0x001e, 0x001f, 0x0020, 0x0021, 0x0022, 0x0023, |
| 108 | 0x0024, 0x0025, 0x0026, 0xfec5, 0x0000, 0x0000, 0x0000, 0x0000, |
| 109 | 0xffcb, 0x0027, 0x0028, 0x0029, 0x002a, 0x002b, 0x002c, 0x002d, |
| 110 | 0x002e, 0x002f, 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, |
| 111 | 0xfed3, 0x0000, 0x0000, 0x0000, 0xffdc, 0x0000, 0x0001, 0x0002, |
| 112 | 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000a, |
| 113 | 0x000b, 0x000c, 0x000d, 0x000e, 0x000f, 0xfeac, 0x0000, 0x0000, |
| 114 | 0xffee, 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, |
| 115 | 0x0017, 0x0018, 0x0019, 0x001a, 0x001b, 0x001c, 0x001d, 0x001e, |
| 116 | 0x001f, 0x0020, 0xfebc, 0x0000, 0xffee, 0x0021, 0x0022, 0x0023, |
| 117 | 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002a, 0x002b, |
| 118 | 0x002c, 0x002d, 0x002e, 0x002f, 0x0030, 0x0031, 0x0032, 0xfecd, |
| 119 | 0x0154, 0x0218, 0x0110, 0x00b0, 0x00cc, 0x00b0, 0x0088, 0x00b0, |
| 120 | 0x0044, 0x00b0, 0x0000, 0x00b0, 0x00fe, 0xff07, 0x0002, 0x00ff, |
| 121 | 0x00f8, 0x0007, 0x00fe, 0x00ee, 0x07ff, 0x0200, 0x00ef, 0xf800, |
| 122 | 0x0700, 0x00ee, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0x0001, |
| 123 | 0x0001, 0x0001, 0x0001, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, |
| 124 | 0xffff, 0x0000, 0x0000, 0x0001, 0x0001, 0x0001, 0x0001, 0x0000, |
| 125 | 0x0000, 0xffff, 0xffff, 0x0000, 0xffff, 0x0001, 0x0000, 0x0001, |
| 126 | 0x0001, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, |
| 127 | 0xffff, 0x0001, 0x0000, 0x0001, 0x0001, 0x0000, 0x0000, 0xffff, |
| 128 | 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0044, 0x0088, 0x00cc, |
| 129 | 0x0110, 0x0154, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, |
| 130 | 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, |
| 131 | 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, |
| 132 | 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, |
| 133 | 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, |
| 134 | 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff |
| 135 | }; |
| 136 | |
| 137 | void (*SetDSP3cxx . . $ SuperFamicom/DSP3i/SetDSP3.)(); |
| 138 | void DSP3_Commandcxx . . $ SuperFamicom/DSP3i/DSP3_Command(49f6e7a06ebc5aa8).(); |
| 139 | |
| 140 | uint16cxx . . $ uint16# DSP3_DRcxx . . $ SuperFamicom/DSP3i/DSP3_DR.; |
| 141 | uint16cxx . . $ uint16# DSP3_SRcxx . . $ SuperFamicom/DSP3i/DSP3_SR.; |
| 142 | uint16cxx . . $ uint16# DSP3_MemoryIndexcxx . . $ SuperFamicom/DSP3i/DSP3_MemoryIndex.; |
| 143 | |
| 144 | void DSP3_Resetcxx . . $ SuperFamicom/DSP3i/DSP3_Reset(49f6e7a06ebc5aa8).() |
| 145 | { |
| 146 | DSP3_DRcxx . . $ SuperFamicom/DSP3i/DSP3_DR. = 0x0080; |
| 147 | DSP3_SRcxx . . $ SuperFamicom/DSP3i/DSP3_SR. = 0x0084; |
| 148 | SetDSP3cxx . . $ SuperFamicom/DSP3i/SetDSP3. = &DSP3_Commandcxx . . $ SuperFamicom/DSP3i/DSP3_Command(49f6e7a06ebc5aa8).; |
| 149 | } |
| 150 | |
| 151 | void DSP3_MemorySizecxx . . $ SuperFamicom/DSP3i/DSP3_MemorySize(49f6e7a06ebc5aa8).() |
| 152 | { |
| 153 | DSP3_DRcxx . . $ SuperFamicom/DSP3i/DSP3_DR. = 0x0300; |
| 154 | SetDSP3cxx . . $ SuperFamicom/DSP3i/SetDSP3. = &DSP3_Resetcxx . . $ SuperFamicom/DSP3i/DSP3_Reset(49f6e7a06ebc5aa8).; |
| 155 | } |
| 156 | |
| 157 | void DSP3_TestMemorycxx . . $ SuperFamicom/DSP3i/DSP3_TestMemory(49f6e7a06ebc5aa8).() |
| 158 | { |
| 159 | DSP3_DRcxx . . $ SuperFamicom/DSP3i/DSP3_DR. = 0x0000; |
| 160 | SetDSP3cxx . . $ SuperFamicom/DSP3i/SetDSP3. = &DSP3_Resetcxx . . $ SuperFamicom/DSP3i/DSP3_Reset(49f6e7a06ebc5aa8).; |
| 161 | } |
| 162 | |
| 163 | void DSP3_DumpDataROMcxx . . $ SuperFamicom/DSP3i/DSP3_DumpDataROM(49f6e7a06ebc5aa8).() |
| 164 | { |
| 165 | DSP3_DRcxx . . $ SuperFamicom/DSP3i/DSP3_DR. = DSP3_DataROMcxx . . $ SuperFamicom/DSP3i/DSP3_DataROM.[DSP3_MemoryIndexcxx . . $ SuperFamicom/DSP3i/DSP3_MemoryIndex.++]; |
| 166 | if (DSP3_MemoryIndexcxx . . $ SuperFamicom/DSP3i/DSP3_MemoryIndex. == 1024) |
| 167 | SetDSP3cxx . . $ SuperFamicom/DSP3i/SetDSP3. = &DSP3_Resetcxx . . $ SuperFamicom/DSP3i/DSP3_Reset(49f6e7a06ebc5aa8).; |
| 168 | } |
| 169 | |
| 170 | void DSP3_MemoryDumpcxx . . $ SuperFamicom/DSP3i/DSP3_MemoryDump(49f6e7a06ebc5aa8).() |
| 171 | { |
| 172 | DSP3_MemoryIndexcxx . . $ SuperFamicom/DSP3i/DSP3_MemoryIndex. = 0; |
| 173 | SetDSP3cxx . . $ SuperFamicom/DSP3i/SetDSP3. = &DSP3_DumpDataROMcxx . . $ SuperFamicom/DSP3i/DSP3_DumpDataROM(49f6e7a06ebc5aa8).; |
| 174 | DSP3_DumpDataROMcxx . . $ SuperFamicom/DSP3i/DSP3_DumpDataROM(49f6e7a06ebc5aa8).(); |
| 175 | } |
| 176 | |
| 177 | int16cxx . . $ int16# DSP3_WinLocxx . . $ SuperFamicom/DSP3i/DSP3_WinLo.; |
| 178 | int16cxx . . $ int16# DSP3_WinHicxx . . $ SuperFamicom/DSP3i/DSP3_WinHi.; |
| 179 | |
| 180 | void DSP3_OP06cxx . . $ SuperFamicom/DSP3i/DSP3_OP06(49f6e7a06ebc5aa8).() |
| 181 | { |
| 182 | DSP3_WinLocxx . . $ SuperFamicom/DSP3i/DSP3_WinLo. = (uint8cxx . . $ uint8#)(DSP3_DRcxx . . $ SuperFamicom/DSP3i/DSP3_DR.); |
| 183 | DSP3_WinHicxx . . $ SuperFamicom/DSP3i/DSP3_WinHi. = (uint8cxx . . $ uint8#)(DSP3_DRcxx . . $ SuperFamicom/DSP3i/DSP3_DR. >> 8); |
| 184 | DSP3_Resetcxx . . $ SuperFamicom/DSP3i/DSP3_Reset(49f6e7a06ebc5aa8).(); |
| 185 | } |
| 186 | |
| 187 | void DSP3_OP03cxx . . $ SuperFamicom/DSP3i/DSP3_OP03(49f6e7a06ebc5aa8).() |
| 188 | { |
| 189 | int16cxx . . $ int16# Lo = (uint8cxx . . $ uint8#)(DSP3_DRcxx . . $ SuperFamicom/DSP3i/DSP3_DR.); |
| 190 | int16cxx . . $ int16# Hi = (uint8cxx . . $ uint8#)(DSP3_DRcxx . . $ SuperFamicom/DSP3i/DSP3_DR. >> 8); |
| 191 | int16cxx . . $ int16# Ofs = (DSP3_WinLocxx . . $ SuperFamicom/DSP3i/DSP3_WinLo. * Hi << 1) + (Lo << 1); |
| 192 | DSP3_DRcxx . . $ SuperFamicom/DSP3i/DSP3_DR. = Ofs >> 1; |
| 193 | SetDSP3cxx . . $ SuperFamicom/DSP3i/SetDSP3. = &DSP3_Resetcxx . . $ SuperFamicom/DSP3i/DSP3_Reset(49f6e7a06ebc5aa8).; |
| 194 | } |
| 195 | |
| 196 | int16cxx . . $ int16# DSP3_AddLocxx . . $ SuperFamicom/DSP3i/DSP3_AddLo.; |
| 197 | int16cxx . . $ int16# DSP3_AddHicxx . . $ SuperFamicom/DSP3i/DSP3_AddHi.; |
| 198 | |
| 199 | void DSP3_OP07_Bcxx . . $ SuperFamicom/DSP3i/DSP3_OP07_B(49f6e7a06ebc5aa8).() |
| 200 | { |
| 201 | int16cxx . . $ int16# Ofs = (DSP3_WinLocxx . . $ SuperFamicom/DSP3i/DSP3_WinLo. * DSP3_AddHicxx . . $ SuperFamicom/DSP3i/DSP3_AddHi. << 1) + (DSP3_AddLocxx . . $ SuperFamicom/DSP3i/DSP3_AddLo. << 1); |
| 202 | DSP3_DRcxx . . $ SuperFamicom/DSP3i/DSP3_DR. = Ofs >> 1; |
| 203 | SetDSP3cxx . . $ SuperFamicom/DSP3i/SetDSP3. = &DSP3_Resetcxx . . $ SuperFamicom/DSP3i/DSP3_Reset(49f6e7a06ebc5aa8).; |
| 204 | } |
| 205 | |
| 206 | void DSP3_OP07_Acxx . . $ SuperFamicom/DSP3i/DSP3_OP07_A(49f6e7a06ebc5aa8).() |
| 207 | { |
| 208 | int16cxx . . $ int16# Lo = (uint8cxx . . $ uint8#)(DSP3_DRcxx . . $ SuperFamicom/DSP3i/DSP3_DR.); |
| 209 | int16cxx . . $ int16# Hi = (uint8cxx . . $ uint8#)(DSP3_DRcxx . . $ SuperFamicom/DSP3i/DSP3_DR. >> 8); |
| 210 | |
| 211 | if (Lo & 1) Hi += (DSP3_AddLocxx . . $ SuperFamicom/DSP3i/DSP3_AddLo. & 1); |
| 212 | |
| 213 | DSP3_AddLocxx . . $ SuperFamicom/DSP3i/DSP3_AddLo. += Lo; |
| 214 | DSP3_AddHicxx . . $ SuperFamicom/DSP3i/DSP3_AddHi. += Hi; |
| 215 | |
| 216 | if (DSP3_AddLocxx . . $ SuperFamicom/DSP3i/DSP3_AddLo. < 0) |
| 217 | DSP3_AddLocxx . . $ SuperFamicom/DSP3i/DSP3_AddLo. += DSP3_WinLocxx . . $ SuperFamicom/DSP3i/DSP3_WinLo.; |
| 218 | else |
| 219 | if (DSP3_AddLocxx . . $ SuperFamicom/DSP3i/DSP3_AddLo. >= DSP3_WinLocxx . . $ SuperFamicom/DSP3i/DSP3_WinLo.) |
| 220 | DSP3_AddLocxx . . $ SuperFamicom/DSP3i/DSP3_AddLo. -= DSP3_WinLocxx . . $ SuperFamicom/DSP3i/DSP3_WinLo.; |
| 221 | |
| 222 | if (DSP3_AddHicxx . . $ SuperFamicom/DSP3i/DSP3_AddHi. < 0) |
| 223 | DSP3_AddHicxx . . $ SuperFamicom/DSP3i/DSP3_AddHi. += DSP3_WinHicxx . . $ SuperFamicom/DSP3i/DSP3_WinHi.; |
| 224 | else |
| 225 | if (DSP3_AddHicxx . . $ SuperFamicom/DSP3i/DSP3_AddHi. >= DSP3_WinHicxx . . $ SuperFamicom/DSP3i/DSP3_WinHi.) |
| 226 | DSP3_AddHicxx . . $ SuperFamicom/DSP3i/DSP3_AddHi. -= DSP3_WinHicxx . . $ SuperFamicom/DSP3i/DSP3_WinHi.; |
| 227 | |
| 228 | DSP3_DRcxx . . $ SuperFamicom/DSP3i/DSP3_DR. = DSP3_AddLocxx . . $ SuperFamicom/DSP3i/DSP3_AddLo. | (DSP3_AddHicxx . . $ SuperFamicom/DSP3i/DSP3_AddHi. << 8) | ((DSP3_AddHicxx . . $ SuperFamicom/DSP3i/DSP3_AddHi. >> 8) & 0xff); |
| 229 | SetDSP3cxx . . $ SuperFamicom/DSP3i/SetDSP3. = &DSP3_OP07_Bcxx . . $ SuperFamicom/DSP3i/DSP3_OP07_B(49f6e7a06ebc5aa8).; |
| 230 | } |
| 231 | |
| 232 | void DSP3_OP07cxx . . $ SuperFamicom/DSP3i/DSP3_OP07(49f6e7a06ebc5aa8).() |
| 233 | { |
| 234 | uint32cxx . . $ uint32# dataOfs = ((DSP3_DRcxx . . $ SuperFamicom/DSP3i/DSP3_DR. << 1) + 0x03b2) & 0x03ff; |
| 235 | |
| 236 | DSP3_AddHicxx . . $ SuperFamicom/DSP3i/DSP3_AddHi. = DSP3_DataROMcxx . . $ SuperFamicom/DSP3i/DSP3_DataROM.[dataOfs]; |
| 237 | DSP3_AddLocxx . . $ SuperFamicom/DSP3i/DSP3_AddLo. = DSP3_DataROMcxx . . $ SuperFamicom/DSP3i/DSP3_DataROM.[dataOfs + 1]; |
| 238 | |
| 239 | SetDSP3cxx . . $ SuperFamicom/DSP3i/SetDSP3. = &DSP3_OP07_Acxx . . $ SuperFamicom/DSP3i/DSP3_OP07_A(49f6e7a06ebc5aa8).; |
| 240 | DSP3_SRcxx . . $ SuperFamicom/DSP3i/DSP3_SR. = 0x0080; |
| 241 | } |
| 242 | |
| 243 | uint16cxx . . $ uint16# DSP3_Codewordscxx . . $ SuperFamicom/DSP3i/DSP3_Codewords.; |
| 244 | uint16cxx . . $ uint16# DSP3_Outwordscxx . . $ SuperFamicom/DSP3i/DSP3_Outwords.; |
| 245 | uint16cxx . . $ uint16# DSP3_Symbolcxx . . $ SuperFamicom/DSP3i/DSP3_Symbol.; |
| 246 | uint16cxx . . $ uint16# DSP3_BitCountcxx . . $ SuperFamicom/DSP3i/DSP3_BitCount.; |
| 247 | uint16cxx . . $ uint16# DSP3_Indexcxx . . $ SuperFamicom/DSP3i/DSP3_Index.; |
| 248 | uint16cxx . . $ uint16# DSP3_Codescxx . . $ SuperFamicom/DSP3i/DSP3_Codes.[512]; |
| 249 | uint16cxx . . $ uint16# DSP3_BitsLeftcxx . . $ SuperFamicom/DSP3i/DSP3_BitsLeft.; |
| 250 | uint16cxx . . $ uint16# DSP3_ReqBitscxx . . $ SuperFamicom/DSP3i/DSP3_ReqBits.; |
| 251 | uint16cxx . . $ uint16# DSP3_ReqDatacxx . . $ SuperFamicom/DSP3i/DSP3_ReqData.; |
| 252 | uint16cxx . . $ uint16# DSP3_BitCommandcxx . . $ SuperFamicom/DSP3i/DSP3_BitCommand.; |
| 253 | uint8cxx . . $ uint8# DSP3_BaseLengthcxx . . $ SuperFamicom/DSP3i/DSP3_BaseLength.; |
| 254 | uint16cxx . . $ uint16# DSP3_BaseCodescxx . . $ SuperFamicom/DSP3i/DSP3_BaseCodes.; |
| 255 | uint16cxx . . $ uint16# DSP3_BaseCodecxx . . $ SuperFamicom/DSP3i/DSP3_BaseCode.; |
| 256 | uint8cxx . . $ uint8# DSP3_CodeLengthscxx . . $ SuperFamicom/DSP3i/DSP3_CodeLengths.[8]; |
| 257 | uint16cxx . . $ uint16# DSP3_CodeOffsetscxx . . $ SuperFamicom/DSP3i/DSP3_CodeOffsets.[8]; |
| 258 | uint16cxx . . $ uint16# DSP3_LZCodecxx . . $ SuperFamicom/DSP3i/DSP3_LZCode.; |
| 259 | uint8cxx . . $ uint8# DSP3_LZLengthcxx . . $ SuperFamicom/DSP3i/DSP3_LZLength.; |
| 260 | |
| 261 | uint16cxx . . $ uint16# DSP3_Xcxx . . $ SuperFamicom/DSP3i/DSP3_X.; |
| 262 | uint16cxx . . $ uint16# DSP3_Ycxx . . $ SuperFamicom/DSP3i/DSP3_Y.; |
| 263 | |
| 264 | void DSP3_Coordinatecxx . . $ SuperFamicom/DSP3i/DSP3_Coordinate(49f6e7a06ebc5aa8).() |
| 265 | { |
| 266 | DSP3_Indexcxx . . $ SuperFamicom/DSP3i/DSP3_Index.++; |
| 267 | |
| 268 | switch (DSP3_Indexcxx . . $ SuperFamicom/DSP3i/DSP3_Index.) |
| 269 | { |
| 270 | case 3: |
| 271 | { |
| 272 | if (DSP3_DRcxx . . $ SuperFamicom/DSP3i/DSP3_DR. == 0xffff) |
| 273 | DSP3_Resetcxx . . $ SuperFamicom/DSP3i/DSP3_Reset(49f6e7a06ebc5aa8).(); |
| 274 | break; |
| 275 | } |
| 276 | case 4: |
| 277 | { |
| 278 | DSP3_Xcxx . . $ SuperFamicom/DSP3i/DSP3_X. = DSP3_DRcxx . . $ SuperFamicom/DSP3i/DSP3_DR.; |
| 279 | break; |
| 280 | } |
| 281 | case 5: |
| 282 | { |
| 283 | DSP3_Ycxx . . $ SuperFamicom/DSP3i/DSP3_Y. = DSP3_DRcxx . . $ SuperFamicom/DSP3i/DSP3_DR.; |
| 284 | DSP3_DRcxx . . $ SuperFamicom/DSP3i/DSP3_DR. = 1; |
| 285 | break; |
| 286 | } |
| 287 | case 6: |
| 288 | { |
| 289 | DSP3_DRcxx . . $ SuperFamicom/DSP3i/DSP3_DR. = DSP3_Xcxx . . $ SuperFamicom/DSP3i/DSP3_X.; |
| 290 | break; |
| 291 | } |
| 292 | case 7: |
| 293 | { |
| 294 | DSP3_DRcxx . . $ SuperFamicom/DSP3i/DSP3_DR. = DSP3_Ycxx . . $ SuperFamicom/DSP3i/DSP3_Y.; |
| 295 | DSP3_Indexcxx . . $ SuperFamicom/DSP3i/DSP3_Index. = 0; |
| 296 | break; |
| 297 | } |
| 298 | } |
| 299 | } |
| 300 | |
| 301 | uint8cxx . . $ uint8# DSP3_Bitmapcxx . . $ SuperFamicom/DSP3i/DSP3_Bitmap.[8]; |
| 302 | uint8cxx . . $ uint8# DSP3_Bitplanecxx . . $ SuperFamicom/DSP3i/DSP3_Bitplane.[8]; |
| 303 | uint16cxx . . $ uint16# DSP3_BMIndexcxx . . $ SuperFamicom/DSP3i/DSP3_BMIndex.; |
| 304 | uint16cxx . . $ uint16# DSP3_BPIndexcxx . . $ SuperFamicom/DSP3i/DSP3_BPIndex.; |
| 305 | uint16cxx . . $ uint16# DSP3_Countcxx . . $ SuperFamicom/DSP3i/DSP3_Count.; |
| 306 | |
| 307 | void DSP3_Convert_Acxx . . $ SuperFamicom/DSP3i/DSP3_Convert_A(49f6e7a06ebc5aa8).() |
| 308 | { |
| 309 | if (DSP3_BMIndexcxx . . $ SuperFamicom/DSP3i/DSP3_BMIndex. < 8) |
| 310 | { |
| 311 | DSP3_Bitmapcxx . . $ SuperFamicom/DSP3i/DSP3_Bitmap.[DSP3_BMIndexcxx . . $ SuperFamicom/DSP3i/DSP3_BMIndex.++] = (uint8cxx . . $ uint8#) (DSP3_DRcxx . . $ SuperFamicom/DSP3i/DSP3_DR.); |
| 312 | DSP3_Bitmapcxx . . $ SuperFamicom/DSP3i/DSP3_Bitmap.[DSP3_BMIndexcxx . . $ SuperFamicom/DSP3i/DSP3_BMIndex.++] = (uint8cxx . . $ uint8#) (DSP3_DRcxx . . $ SuperFamicom/DSP3i/DSP3_DR. >> 8); |
| 313 | |
| 314 | if (DSP3_BMIndexcxx . . $ SuperFamicom/DSP3i/DSP3_BMIndex. == 8) |
| 315 | { |
| 316 | short i, j; |
| 317 | for (i=0; i < 8; i++) |
| 318 | for (j=0; j < 8; j++) |
| 319 | { |
| 320 | DSP3_Bitplanecxx . . $ SuperFamicom/DSP3i/DSP3_Bitplane.[j] <<= 1; |
| 321 | DSP3_Bitplanecxx . . $ SuperFamicom/DSP3i/DSP3_Bitplane.[j] |= (DSP3_Bitmapcxx . . $ SuperFamicom/DSP3i/DSP3_Bitmap.[i] >> j) & 1; |
| 322 | } |
| 323 | |
| 324 | DSP3_BPIndexcxx . . $ SuperFamicom/DSP3i/DSP3_BPIndex. = 0; |
| 325 | DSP3_Countcxx . . $ SuperFamicom/DSP3i/DSP3_Count.--; |
| 326 | } |
| 327 | } |
| 328 | |
| 329 | if (DSP3_BMIndexcxx . . $ SuperFamicom/DSP3i/DSP3_BMIndex. == 8) |
| 330 | { |
| 331 | if (DSP3_BPIndexcxx . . $ SuperFamicom/DSP3i/DSP3_BPIndex. == 8) |
| 332 | { |
| 333 | if (!DSP3_Countcxx . . $ SuperFamicom/DSP3i/DSP3_Count.) DSP3_Resetcxx . . $ SuperFamicom/DSP3i/DSP3_Reset(49f6e7a06ebc5aa8).(); |
| 334 | DSP3_BMIndexcxx . . $ SuperFamicom/DSP3i/DSP3_BMIndex. = 0; |
| 335 | } |
| 336 | else |
| 337 | { |
| 338 | DSP3_DRcxx . . $ SuperFamicom/DSP3i/DSP3_DR. = DSP3_Bitplanecxx . . $ SuperFamicom/DSP3i/DSP3_Bitplane.[DSP3_BPIndexcxx . . $ SuperFamicom/DSP3i/DSP3_BPIndex.++]; |
| 339 | DSP3_DRcxx . . $ SuperFamicom/DSP3i/DSP3_DR. |= DSP3_Bitplanecxx . . $ SuperFamicom/DSP3i/DSP3_Bitplane.[DSP3_BPIndexcxx . . $ SuperFamicom/DSP3i/DSP3_BPIndex.++] << 8; |
| 340 | } |
| 341 | } |
| 342 | } |
| 343 | |
| 344 | void DSP3_Convertcxx . . $ SuperFamicom/DSP3i/DSP3_Convert(49f6e7a06ebc5aa8).() |
| 345 | { |
| 346 | DSP3_Countcxx . . $ SuperFamicom/DSP3i/DSP3_Count. = DSP3_DRcxx . . $ SuperFamicom/DSP3i/DSP3_DR.; |
| 347 | DSP3_BMIndexcxx . . $ SuperFamicom/DSP3i/DSP3_BMIndex. = 0; |
| 348 | SetDSP3cxx . . $ SuperFamicom/DSP3i/SetDSP3. = &DSP3_Convert_Acxx . . $ SuperFamicom/DSP3i/DSP3_Convert_A(49f6e7a06ebc5aa8).; |
| 349 | } |
| 350 | |
| 351 | bool DSP3_GetBitscxx . . $ SuperFamicom/DSP3i/DSP3_GetBits(cef82f9be00a201a).(uint8cxx . . $ uint8# Count) |
| 352 | { |
| 353 | if (!DSP3_BitsLeftcxx . . $ SuperFamicom/DSP3i/DSP3_BitsLeft.) |
| 354 | { |
| 355 | DSP3_BitsLeftcxx . . $ SuperFamicom/DSP3i/DSP3_BitsLeft. = Count; |
| 356 | DSP3_ReqBitscxx . . $ SuperFamicom/DSP3i/DSP3_ReqBits. = 0; |
| 357 | } |
| 358 | |
| 359 | do { |
| 360 | if (!DSP3_BitCountcxx . . $ SuperFamicom/DSP3i/DSP3_BitCount.) |
| 361 | { |
| 362 | DSP3_SRcxx . . $ SuperFamicom/DSP3i/DSP3_SR. = 0xC0; |
| 363 | return false; |
| 364 | } |
| 365 | |
| 366 | DSP3_ReqBitscxx . . $ SuperFamicom/DSP3i/DSP3_ReqBits. <<= 1; |
| 367 | if (DSP3_ReqDatacxx . . $ SuperFamicom/DSP3i/DSP3_ReqData. & 0x8000) DSP3_ReqBitscxx . . $ SuperFamicom/DSP3i/DSP3_ReqBits.++; |
| 368 | DSP3_ReqDatacxx . . $ SuperFamicom/DSP3i/DSP3_ReqData. <<= 1; |
| 369 | |
| 370 | DSP3_BitCountcxx . . $ SuperFamicom/DSP3i/DSP3_BitCount.--; |
| 371 | DSP3_BitsLeftcxx . . $ SuperFamicom/DSP3i/DSP3_BitsLeft.--; |
| 372 | |
| 373 | } while (DSP3_BitsLeftcxx . . $ SuperFamicom/DSP3i/DSP3_BitsLeft.); |
| 374 | |
| 375 | return true; |
| 376 | } |
| 377 | |
| 378 | void DSP3_Decode_Datacxx . . $ SuperFamicom/DSP3i/DSP3_Decode_Data(49f6e7a06ebc5aa8).() |
| 379 | { |
| 380 | if (!DSP3_BitCountcxx . . $ SuperFamicom/DSP3i/DSP3_BitCount.) |
| 381 | { |
| 382 | if (DSP3_SRcxx . . $ SuperFamicom/DSP3i/DSP3_SR. & 0x40) |
| 383 | { |
| 384 | DSP3_ReqDatacxx . . $ SuperFamicom/DSP3i/DSP3_ReqData. = DSP3_DRcxx . . $ SuperFamicom/DSP3i/DSP3_DR.; |
| 385 | DSP3_BitCountcxx . . $ SuperFamicom/DSP3i/DSP3_BitCount. += 16; |
| 386 | } |
| 387 | else |
| 388 | { |
| 389 | DSP3_SRcxx . . $ SuperFamicom/DSP3i/DSP3_SR. = 0xC0; |
| 390 | return; |
| 391 | } |
| 392 | } |
| 393 | |
| 394 | if (DSP3_LZCodecxx . . $ SuperFamicom/DSP3i/DSP3_LZCode. == 1) |
| 395 | { |
| 396 | if (!DSP3_GetBitscxx . . $ SuperFamicom/DSP3i/DSP3_GetBits(cef82f9be00a201a).(1)) |
| 397 | return; |
| 398 | |
| 399 | if (DSP3_ReqBitscxx . . $ SuperFamicom/DSP3i/DSP3_ReqBits.) |
| 400 | DSP3_LZLengthcxx . . $ SuperFamicom/DSP3i/DSP3_LZLength. = 12; |
| 401 | else |
| 402 | DSP3_LZLengthcxx . . $ SuperFamicom/DSP3i/DSP3_LZLength. = 8; |
| 403 | |
| 404 | DSP3_LZCodecxx . . $ SuperFamicom/DSP3i/DSP3_LZCode.++; |
| 405 | } |
| 406 | |
| 407 | if (DSP3_LZCodecxx . . $ SuperFamicom/DSP3i/DSP3_LZCode. == 2) |
| 408 | { |
| 409 | if (!DSP3_GetBitscxx . . $ SuperFamicom/DSP3i/DSP3_GetBits(cef82f9be00a201a).(DSP3_LZLengthcxx . . $ SuperFamicom/DSP3i/DSP3_LZLength.)) |
| 410 | return; |
| 411 | |
| 412 | DSP3_LZCodecxx . . $ SuperFamicom/DSP3i/DSP3_LZCode. = 0; |
| 413 | DSP3_Outwordscxx . . $ SuperFamicom/DSP3i/DSP3_Outwords.--; |
| 414 | if (!DSP3_Outwordscxx . . $ SuperFamicom/DSP3i/DSP3_Outwords.) SetDSP3cxx . . $ SuperFamicom/DSP3i/SetDSP3. = &DSP3_Resetcxx . . $ SuperFamicom/DSP3i/DSP3_Reset(49f6e7a06ebc5aa8).; |
| 415 | |
| 416 | DSP3_SRcxx . . $ SuperFamicom/DSP3i/DSP3_SR. = 0x80; |
| 417 | DSP3_DRcxx . . $ SuperFamicom/DSP3i/DSP3_DR. = DSP3_ReqBitscxx . . $ SuperFamicom/DSP3i/DSP3_ReqBits.; |
| 418 | return; |
| 419 | } |
| 420 | |
| 421 | if (DSP3_BaseCodecxx . . $ SuperFamicom/DSP3i/DSP3_BaseCode. == 0xffff) |
| 422 | { |
| 423 | if (!DSP3_GetBitscxx . . $ SuperFamicom/DSP3i/DSP3_GetBits(cef82f9be00a201a).(DSP3_BaseLengthcxx . . $ SuperFamicom/DSP3i/DSP3_BaseLength.)) |
| 424 | return; |
| 425 | |
| 426 | DSP3_BaseCodecxx . . $ SuperFamicom/DSP3i/DSP3_BaseCode. = DSP3_ReqBitscxx . . $ SuperFamicom/DSP3i/DSP3_ReqBits.; |
| 427 | } |
| 428 | |
| 429 | if (!DSP3_GetBitscxx . . $ SuperFamicom/DSP3i/DSP3_GetBits(cef82f9be00a201a).(DSP3_CodeLengthscxx . . $ SuperFamicom/DSP3i/DSP3_CodeLengths.[DSP3_BaseCodecxx . . $ SuperFamicom/DSP3i/DSP3_BaseCode.])) |
| 430 | return; |
| 431 | |
| 432 | DSP3_Symbolcxx . . $ SuperFamicom/DSP3i/DSP3_Symbol. = DSP3_Codescxx . . $ SuperFamicom/DSP3i/DSP3_Codes.[DSP3_CodeOffsetscxx . . $ SuperFamicom/DSP3i/DSP3_CodeOffsets.[DSP3_BaseCodecxx . . $ SuperFamicom/DSP3i/DSP3_BaseCode.] + DSP3_ReqBitscxx . . $ SuperFamicom/DSP3i/DSP3_ReqBits.]; |
| 433 | DSP3_BaseCodecxx . . $ SuperFamicom/DSP3i/DSP3_BaseCode. = 0xffff; |
| 434 | |
| 435 | if (DSP3_Symbolcxx . . $ SuperFamicom/DSP3i/DSP3_Symbol. & 0xff00) |
| 436 | { |
| 437 | DSP3_Symbolcxx . . $ SuperFamicom/DSP3i/DSP3_Symbol. += 0x7f02; |
| 438 | DSP3_LZCodecxx . . $ SuperFamicom/DSP3i/DSP3_LZCode.++; |
| 439 | } |
| 440 | else |
| 441 | { |
| 442 | DSP3_Outwordscxx . . $ SuperFamicom/DSP3i/DSP3_Outwords.--; |
| 443 | if (!DSP3_Outwordscxx . . $ SuperFamicom/DSP3i/DSP3_Outwords.) |
| 444 | SetDSP3cxx . . $ SuperFamicom/DSP3i/SetDSP3. = &DSP3_Resetcxx . . $ SuperFamicom/DSP3i/DSP3_Reset(49f6e7a06ebc5aa8).; |
| 445 | } |
| 446 | |
| 447 | DSP3_SRcxx . . $ SuperFamicom/DSP3i/DSP3_SR. = 0x80; |
| 448 | DSP3_DRcxx . . $ SuperFamicom/DSP3i/DSP3_DR. = DSP3_Symbolcxx . . $ SuperFamicom/DSP3i/DSP3_Symbol.; |
| 449 | } |
| 450 | |
| 451 | void DSP3_Decode_Treecxx . . $ SuperFamicom/DSP3i/DSP3_Decode_Tree(49f6e7a06ebc5aa8).() |
| 452 | { |
| 453 | if (!DSP3_BitCountcxx . . $ SuperFamicom/DSP3i/DSP3_BitCount.) |
| 454 | { |
| 455 | DSP3_ReqDatacxx . . $ SuperFamicom/DSP3i/DSP3_ReqData. = DSP3_DRcxx . . $ SuperFamicom/DSP3i/DSP3_DR.; |
| 456 | DSP3_BitCountcxx . . $ SuperFamicom/DSP3i/DSP3_BitCount. += 16; |
| 457 | } |
| 458 | |
| 459 | if (!DSP3_BaseCodescxx . . $ SuperFamicom/DSP3i/DSP3_BaseCodes.) |
| 460 | { |
| 461 | DSP3_GetBitscxx . . $ SuperFamicom/DSP3i/DSP3_GetBits(cef82f9be00a201a).(1); |
| 462 | if (DSP3_ReqBitscxx . . $ SuperFamicom/DSP3i/DSP3_ReqBits.) |
| 463 | { |
| 464 | DSP3_BaseLengthcxx . . $ SuperFamicom/DSP3i/DSP3_BaseLength. = 3; |
| 465 | DSP3_BaseCodescxx . . $ SuperFamicom/DSP3i/DSP3_BaseCodes. = 8; |
| 466 | } |
| 467 | else |
| 468 | { |
| 469 | DSP3_BaseLengthcxx . . $ SuperFamicom/DSP3i/DSP3_BaseLength. = 2; |
| 470 | DSP3_BaseCodescxx . . $ SuperFamicom/DSP3i/DSP3_BaseCodes. = 4; |
| 471 | } |
| 472 | } |
| 473 | |
| 474 | while (DSP3_BaseCodescxx . . $ SuperFamicom/DSP3i/DSP3_BaseCodes.) |
| 475 | { |
| 476 | if (!DSP3_GetBitscxx . . $ SuperFamicom/DSP3i/DSP3_GetBits(cef82f9be00a201a).(3)) |
| 477 | return; |
| 478 | |
| 479 | DSP3_ReqBitscxx . . $ SuperFamicom/DSP3i/DSP3_ReqBits.++; |
| 480 | |
| 481 | DSP3_CodeLengthscxx . . $ SuperFamicom/DSP3i/DSP3_CodeLengths.[DSP3_Indexcxx . . $ SuperFamicom/DSP3i/DSP3_Index.] = (uint8cxx . . $ uint8#) DSP3_ReqBitscxx . . $ SuperFamicom/DSP3i/DSP3_ReqBits.; |
| 482 | DSP3_CodeOffsetscxx . . $ SuperFamicom/DSP3i/DSP3_CodeOffsets.[DSP3_Indexcxx . . $ SuperFamicom/DSP3i/DSP3_Index.] = DSP3_Symbolcxx . . $ SuperFamicom/DSP3i/DSP3_Symbol.; |
| 483 | DSP3_Indexcxx . . $ SuperFamicom/DSP3i/DSP3_Index.++; |
| 484 | |
| 485 | DSP3_Symbolcxx . . $ SuperFamicom/DSP3i/DSP3_Symbol. += 1 << DSP3_ReqBitscxx . . $ SuperFamicom/DSP3i/DSP3_ReqBits.; |
| 486 | DSP3_BaseCodescxx . . $ SuperFamicom/DSP3i/DSP3_BaseCodes.--; |
| 487 | } |
| 488 | |
| 489 | DSP3_BaseCodecxx . . $ SuperFamicom/DSP3i/DSP3_BaseCode. = 0xffff; |
| 490 | DSP3_LZCodecxx . . $ SuperFamicom/DSP3i/DSP3_LZCode. = 0; |
| 491 | |
| 492 | SetDSP3cxx . . $ SuperFamicom/DSP3i/SetDSP3. = &DSP3_Decode_Datacxx . . $ SuperFamicom/DSP3i/DSP3_Decode_Data(49f6e7a06ebc5aa8).; |
| 493 | if (DSP3_BitCountcxx . . $ SuperFamicom/DSP3i/DSP3_BitCount.) DSP3_Decode_Datacxx . . $ SuperFamicom/DSP3i/DSP3_Decode_Data(49f6e7a06ebc5aa8).(); |
| 494 | } |
| 495 | |
| 496 | void DSP3_Decode_Symbolscxx . . $ SuperFamicom/DSP3i/DSP3_Decode_Symbols(49f6e7a06ebc5aa8).() |
| 497 | { |
| 498 | DSP3_ReqDatacxx . . $ SuperFamicom/DSP3i/DSP3_ReqData. = DSP3_DRcxx . . $ SuperFamicom/DSP3i/DSP3_DR.; |
| 499 | DSP3_BitCountcxx . . $ SuperFamicom/DSP3i/DSP3_BitCount. += 16; |
| 500 | |
| 501 | do { |
| 502 | |
| 503 | if (DSP3_BitCommandcxx . . $ SuperFamicom/DSP3i/DSP3_BitCommand. == 0xffff) |
| 504 | { |
| 505 | if (!DSP3_GetBitscxx . . $ SuperFamicom/DSP3i/DSP3_GetBits(cef82f9be00a201a).(2)) return; |
| 506 | DSP3_BitCommandcxx . . $ SuperFamicom/DSP3i/DSP3_BitCommand. = DSP3_ReqBitscxx . . $ SuperFamicom/DSP3i/DSP3_ReqBits.; |
| 507 | } |
| 508 | |
| 509 | switch (DSP3_BitCommandcxx . . $ SuperFamicom/DSP3i/DSP3_BitCommand.) |
| 510 | { |
| 511 | case 0: |
| 512 | { |
| 513 | if (!DSP3_GetBitscxx . . $ SuperFamicom/DSP3i/DSP3_GetBits(cef82f9be00a201a).(9)) return; |
| 514 | DSP3_Symbolcxx . . $ SuperFamicom/DSP3i/DSP3_Symbol. = DSP3_ReqBitscxx . . $ SuperFamicom/DSP3i/DSP3_ReqBits.; |
| 515 | break; |
| 516 | } |
| 517 | case 1: |
| 518 | { |
| 519 | DSP3_Symbolcxx . . $ SuperFamicom/DSP3i/DSP3_Symbol.++; |
| 520 | break; |
| 521 | } |
| 522 | case 2: |
| 523 | { |
| 524 | if (!DSP3_GetBitscxx . . $ SuperFamicom/DSP3i/DSP3_GetBits(cef82f9be00a201a).(1)) return; |
| 525 | DSP3_Symbolcxx . . $ SuperFamicom/DSP3i/DSP3_Symbol. += 2 + DSP3_ReqBitscxx . . $ SuperFamicom/DSP3i/DSP3_ReqBits.; |
| 526 | break; |
| 527 | } |
| 528 | case 3: |
| 529 | { |
| 530 | if (!DSP3_GetBitscxx . . $ SuperFamicom/DSP3i/DSP3_GetBits(cef82f9be00a201a).(4)) return; |
| 531 | DSP3_Symbolcxx . . $ SuperFamicom/DSP3i/DSP3_Symbol. += 4 + DSP3_ReqBitscxx . . $ SuperFamicom/DSP3i/DSP3_ReqBits.; |
| 532 | break; |
| 533 | } |
| 534 | } |
| 535 | |
| 536 | DSP3_BitCommandcxx . . $ SuperFamicom/DSP3i/DSP3_BitCommand. = 0xffff; |
| 537 | |
| 538 | DSP3_Codescxx . . $ SuperFamicom/DSP3i/DSP3_Codes.[DSP3_Indexcxx . . $ SuperFamicom/DSP3i/DSP3_Index.++] = DSP3_Symbolcxx . . $ SuperFamicom/DSP3i/DSP3_Symbol.; |
| 539 | DSP3_Codewordscxx . . $ SuperFamicom/DSP3i/DSP3_Codewords.--; |
| 540 | |
| 541 | } while (DSP3_Codewordscxx . . $ SuperFamicom/DSP3i/DSP3_Codewords.); |
| 542 | |
| 543 | DSP3_Indexcxx . . $ SuperFamicom/DSP3i/DSP3_Index. = 0; |
| 544 | DSP3_Symbolcxx . . $ SuperFamicom/DSP3i/DSP3_Symbol. = 0; |
| 545 | DSP3_BaseCodescxx . . $ SuperFamicom/DSP3i/DSP3_BaseCodes. = 0; |
| 546 | |
| 547 | SetDSP3cxx . . $ SuperFamicom/DSP3i/SetDSP3. = &DSP3_Decode_Treecxx . . $ SuperFamicom/DSP3i/DSP3_Decode_Tree(49f6e7a06ebc5aa8).; |
| 548 | if (DSP3_BitCountcxx . . $ SuperFamicom/DSP3i/DSP3_BitCount.) DSP3_Decode_Treecxx . . $ SuperFamicom/DSP3i/DSP3_Decode_Tree(49f6e7a06ebc5aa8).(); |
| 549 | } |
| 550 | |
| 551 | void DSP3_Decode_Acxx . . $ SuperFamicom/DSP3i/DSP3_Decode_A(49f6e7a06ebc5aa8).() |
| 552 | { |
| 553 | DSP3_Outwordscxx . . $ SuperFamicom/DSP3i/DSP3_Outwords. = DSP3_DRcxx . . $ SuperFamicom/DSP3i/DSP3_DR.; |
| 554 | SetDSP3cxx . . $ SuperFamicom/DSP3i/SetDSP3. = &DSP3_Decode_Symbolscxx . . $ SuperFamicom/DSP3i/DSP3_Decode_Symbols(49f6e7a06ebc5aa8).; |
| 555 | DSP3_BitCountcxx . . $ SuperFamicom/DSP3i/DSP3_BitCount. = 0; |
| 556 | DSP3_BitsLeftcxx . . $ SuperFamicom/DSP3i/DSP3_BitsLeft. = 0; |
| 557 | DSP3_Symbolcxx . . $ SuperFamicom/DSP3i/DSP3_Symbol. = 0; |
| 558 | DSP3_Indexcxx . . $ SuperFamicom/DSP3i/DSP3_Index. = 0; |
| 559 | DSP3_BitCommandcxx . . $ SuperFamicom/DSP3i/DSP3_BitCommand. = 0xffff; |
| 560 | DSP3_SRcxx . . $ SuperFamicom/DSP3i/DSP3_SR. = 0xC0; |
| 561 | } |
| 562 | |
| 563 | void DSP3_Decodecxx . . $ SuperFamicom/DSP3i/DSP3_Decode(49f6e7a06ebc5aa8).() |
| 564 | { |
| 565 | DSP3_Codewordscxx . . $ SuperFamicom/DSP3i/DSP3_Codewords. = DSP3_DRcxx . . $ SuperFamicom/DSP3i/DSP3_DR.; |
| 566 | SetDSP3cxx . . $ SuperFamicom/DSP3i/SetDSP3. = &DSP3_Decode_Acxx . . $ SuperFamicom/DSP3i/DSP3_Decode_A(49f6e7a06ebc5aa8).; |
| 567 | } |
| 568 | |
| 569 | |
| 570 | // Opcodes 1E/3E bit-perfect to 'dsp3-intro' log |
| 571 | // src: adapted from SD Gundam X/G-Next |
| 572 | |
| 573 | int16cxx . . $ int16# op3e_xcxx . . $ SuperFamicom/DSP3i/op3e_x.; |
| 574 | int16cxx . . $ int16# op3e_ycxx . . $ SuperFamicom/DSP3i/op3e_y.; |
| 575 | |
| 576 | int16cxx . . $ int16# op1e_terraincxx . . $ SuperFamicom/DSP3i/op1e_terrain.[0x2000]; |
| 577 | int16cxx . . $ int16# op1e_costcxx . . $ SuperFamicom/DSP3i/op1e_cost.[0x2000]; |
| 578 | int16cxx . . $ int16# op1e_weightcxx . . $ SuperFamicom/DSP3i/op1e_weight.[0x2000]; |
| 579 | |
| 580 | int16cxx . . $ int16# op1e_cellcxx . . $ SuperFamicom/DSP3i/op1e_cell.; |
| 581 | int16cxx . . $ int16# op1e_turncxx . . $ SuperFamicom/DSP3i/op1e_turn.; |
| 582 | int16cxx . . $ int16# op1e_searchcxx . . $ SuperFamicom/DSP3i/op1e_search.; |
| 583 | |
| 584 | int16cxx . . $ int16# op1e_xcxx . . $ SuperFamicom/DSP3i/op1e_x.; |
| 585 | int16cxx . . $ int16# op1e_ycxx . . $ SuperFamicom/DSP3i/op1e_y.; |
| 586 | |
| 587 | int16cxx . . $ int16# op1e_min_radiuscxx . . $ SuperFamicom/DSP3i/op1e_min_radius.; |
| 588 | int16cxx . . $ int16# op1e_max_radiuscxx . . $ SuperFamicom/DSP3i/op1e_max_radius.; |
| 589 | |
| 590 | int16cxx . . $ int16# op1e_max_search_radiuscxx . . $ SuperFamicom/DSP3i/op1e_max_search_radius.; |
| 591 | int16cxx . . $ int16# op1e_max_path_radiuscxx . . $ SuperFamicom/DSP3i/op1e_max_path_radius.; |
| 592 | |
| 593 | int16cxx . . $ int16# op1e_lcv_radiuscxx . . $ SuperFamicom/DSP3i/op1e_lcv_radius.; |
| 594 | int16cxx . . $ int16# op1e_lcv_stepscxx . . $ SuperFamicom/DSP3i/op1e_lcv_steps.; |
| 595 | int16cxx . . $ int16# op1e_lcv_turnscxx . . $ SuperFamicom/DSP3i/op1e_lcv_turns.; |
| 596 | |
| 597 | void DSP3_OP3Ecxx . . $ SuperFamicom/DSP3i/DSP3_OP3E(49f6e7a06ebc5aa8).() |
| 598 | { |
| 599 | op3e_xcxx . . $ SuperFamicom/DSP3i/op3e_x. = (uint8cxx . . $ uint8#)(DSP3_DRcxx . . $ SuperFamicom/DSP3i/DSP3_DR. & 0x00ff); |
| 600 | op3e_ycxx . . $ SuperFamicom/DSP3i/op3e_y. = (uint8cxx . . $ uint8#)((DSP3_DRcxx . . $ SuperFamicom/DSP3i/DSP3_DR. & 0xff00)>>8); |
| 601 | |
| 602 | DSP3_OP03cxx . . $ SuperFamicom/DSP3i/DSP3_OP03(49f6e7a06ebc5aa8).(); |
| 603 | |
| 604 | op1e_terraincxx . . $ SuperFamicom/DSP3i/op1e_terrain.[ DSP3_DRcxx . . $ SuperFamicom/DSP3i/DSP3_DR. ] = 0x00; |
| 605 | op1e_costcxx . . $ SuperFamicom/DSP3i/op1e_cost.[ DSP3_DRcxx . . $ SuperFamicom/DSP3i/DSP3_DR. ] = 0xff; |
| 606 | op1e_weightcxx . . $ SuperFamicom/DSP3i/op1e_weight.[ DSP3_DRcxx . . $ SuperFamicom/DSP3i/DSP3_DR. ] = 0; |
| 607 | |
| 608 | op1e_max_search_radiuscxx . . $ SuperFamicom/DSP3i/op1e_max_search_radius. = 0; |
| 609 | op1e_max_path_radiuscxx . . $ SuperFamicom/DSP3i/op1e_max_path_radius. = 0; |
| 610 | } |
| 611 | |
| 612 | void DSP3_OP1E_Acxx . . $ SuperFamicom/DSP3i/DSP3_OP1E_A(49f6e7a06ebc5aa8).(); |
| 613 | void DSP3_OP1E_A1cxx . . $ SuperFamicom/DSP3i/DSP3_OP1E_A1(49f6e7a06ebc5aa8).(); |
| 614 | void DSP3_OP1E_A2cxx . . $ SuperFamicom/DSP3i/DSP3_OP1E_A2(49f6e7a06ebc5aa8).(); |
| 615 | void DSP3_OP1E_A3cxx . . $ SuperFamicom/DSP3i/DSP3_OP1E_A3(49f6e7a06ebc5aa8).(); |
| 616 | |
| 617 | void DSP3_OP1E_Bcxx . . $ SuperFamicom/DSP3i/DSP3_OP1E_B(49f6e7a06ebc5aa8).(); |
| 618 | void DSP3_OP1E_B1cxx . . $ SuperFamicom/DSP3i/DSP3_OP1E_B1(49f6e7a06ebc5aa8).(); |
| 619 | void DSP3_OP1E_B2cxx . . $ SuperFamicom/DSP3i/DSP3_OP1E_B2(49f6e7a06ebc5aa8).(); |
| 620 | |
| 621 | void DSP3_OP1E_Ccxx . . $ SuperFamicom/DSP3i/DSP3_OP1E_C(49f6e7a06ebc5aa8).(); |
| 622 | void DSP3_OP1E_C1cxx . . $ SuperFamicom/DSP3i/DSP3_OP1E_C1(49f6e7a06ebc5aa8).(); |
| 623 | void DSP3_OP1E_C2cxx . . $ SuperFamicom/DSP3i/DSP3_OP1E_C2(49f6e7a06ebc5aa8).(); |
| 624 | |
| 625 | void DSP3_OP1E_Dcxx . . $ SuperFamicom/DSP3i/DSP3_OP1E_D(9698444918e4f66a).( int16cxx . . $ int16#, int16cxx . . $ int16# *, int16cxx . . $ int16# * ); |
| 626 | void DSP3_OP1E_D1cxx . . $ SuperFamicom/DSP3i/DSP3_OP1E_D1(9698444918e4f66a).( int16cxx . . $ int16# move, int16cxx . . $ int16# *lo, int16cxx . . $ int16# *hi ); |
| 627 | |
| 628 | void DSP3_OP1Ecxx . . $ SuperFamicom/DSP3i/DSP3_OP1E(49f6e7a06ebc5aa8).() |
| 629 | { |
| 630 | int lcv; |
| 631 | |
| 632 | op1e_min_radiuscxx . . $ SuperFamicom/DSP3i/op1e_min_radius. = (uint8cxx . . $ uint8#)(DSP3_DRcxx . . $ SuperFamicom/DSP3i/DSP3_DR. & 0x00ff); |
| 633 | op1e_max_radiuscxx . . $ SuperFamicom/DSP3i/op1e_max_radius. = (uint8cxx . . $ uint8#)((DSP3_DRcxx . . $ SuperFamicom/DSP3i/DSP3_DR. & 0xff00)>>8); |
| 634 | |
| 635 | if( op1e_min_radiuscxx . . $ SuperFamicom/DSP3i/op1e_min_radius. == 0 ) |
| 636 | op1e_min_radiuscxx . . $ SuperFamicom/DSP3i/op1e_min_radius.++; |
| 637 | |
| 638 | if( op1e_max_search_radiuscxx . . $ SuperFamicom/DSP3i/op1e_max_search_radius. >= op1e_min_radiuscxx . . $ SuperFamicom/DSP3i/op1e_min_radius. ) |
| 639 | op1e_min_radiuscxx . . $ SuperFamicom/DSP3i/op1e_min_radius. = op1e_max_search_radiuscxx . . $ SuperFamicom/DSP3i/op1e_max_search_radius.+1; |
| 640 | |
| 641 | if( op1e_max_radiuscxx . . $ SuperFamicom/DSP3i/op1e_max_radius. > op1e_max_search_radiuscxx . . $ SuperFamicom/DSP3i/op1e_max_search_radius. ) |
| 642 | op1e_max_search_radiuscxx . . $ SuperFamicom/DSP3i/op1e_max_search_radius. = op1e_max_radiuscxx . . $ SuperFamicom/DSP3i/op1e_max_radius.; |
| 643 | |
| 644 | op1e_lcv_radiuscxx . . $ SuperFamicom/DSP3i/op1e_lcv_radius. = op1e_min_radiuscxx . . $ SuperFamicom/DSP3i/op1e_min_radius.; |
| 645 | op1e_lcv_stepscxx . . $ SuperFamicom/DSP3i/op1e_lcv_steps. = op1e_min_radiuscxx . . $ SuperFamicom/DSP3i/op1e_min_radius.; |
| 646 | |
| 647 | op1e_lcv_turnscxx . . $ SuperFamicom/DSP3i/op1e_lcv_turns. = 6; |
| 648 | op1e_turncxx . . $ SuperFamicom/DSP3i/op1e_turn. = 0; |
| 649 | |
| 650 | op1e_xcxx . . $ SuperFamicom/DSP3i/op1e_x. = op3e_xcxx . . $ SuperFamicom/DSP3i/op3e_x.; |
| 651 | op1e_ycxx . . $ SuperFamicom/DSP3i/op1e_y. = op3e_ycxx . . $ SuperFamicom/DSP3i/op3e_y.; |
| 652 | |
| 653 | for( lcv = 0; lcv < op1e_min_radiuscxx . . $ SuperFamicom/DSP3i/op1e_min_radius.; lcv++ ) |
| 654 | DSP3_OP1E_Dcxx . . $ SuperFamicom/DSP3i/DSP3_OP1E_D(9698444918e4f66a).( op1e_turncxx . . $ SuperFamicom/DSP3i/op1e_turn., &op1e_xcxx . . $ SuperFamicom/DSP3i/op1e_x., &op1e_ycxx . . $ SuperFamicom/DSP3i/op1e_y. ); |
| 655 | |
| 656 | DSP3_OP1E_Acxx . . $ SuperFamicom/DSP3i/DSP3_OP1E_A(49f6e7a06ebc5aa8).(); |
| 657 | } |
| 658 | |
| 659 | void DSP3_OP1E_Acxx . . $ SuperFamicom/DSP3i/DSP3_OP1E_A(49f6e7a06ebc5aa8).() |
| 660 | { |
| 661 | int lcv; |
| 662 | |
| 663 | if( op1e_lcv_stepscxx . . $ SuperFamicom/DSP3i/op1e_lcv_steps. == 0 ) { |
| 664 | op1e_lcv_radiuscxx . . $ SuperFamicom/DSP3i/op1e_lcv_radius.++; |
| 665 | |
| 666 | op1e_lcv_stepscxx . . $ SuperFamicom/DSP3i/op1e_lcv_steps. = op1e_lcv_radiuscxx . . $ SuperFamicom/DSP3i/op1e_lcv_radius.; |
| 667 | |
| 668 | op1e_xcxx . . $ SuperFamicom/DSP3i/op1e_x. = op3e_xcxx . . $ SuperFamicom/DSP3i/op3e_x.; |
| 669 | op1e_ycxx . . $ SuperFamicom/DSP3i/op1e_y. = op3e_ycxx . . $ SuperFamicom/DSP3i/op3e_y.; |
| 670 | |
| 671 | for( lcv = 0; lcv < op1e_lcv_radiuscxx . . $ SuperFamicom/DSP3i/op1e_lcv_radius.; lcv++ ) |
| 672 | DSP3_OP1E_Dcxx . . $ SuperFamicom/DSP3i/DSP3_OP1E_D(9698444918e4f66a).( op1e_turncxx . . $ SuperFamicom/DSP3i/op1e_turn., &op1e_xcxx . . $ SuperFamicom/DSP3i/op1e_x., &op1e_ycxx . . $ SuperFamicom/DSP3i/op1e_y. ); |
| 673 | } |
| 674 | |
| 675 | if( op1e_lcv_radiuscxx . . $ SuperFamicom/DSP3i/op1e_lcv_radius. > op1e_max_radiuscxx . . $ SuperFamicom/DSP3i/op1e_max_radius. ) { |
| 676 | op1e_turncxx . . $ SuperFamicom/DSP3i/op1e_turn.++; |
| 677 | op1e_lcv_turnscxx . . $ SuperFamicom/DSP3i/op1e_lcv_turns.--; |
| 678 | |
| 679 | op1e_lcv_radiuscxx . . $ SuperFamicom/DSP3i/op1e_lcv_radius. = op1e_min_radiuscxx . . $ SuperFamicom/DSP3i/op1e_min_radius.; |
| 680 | op1e_lcv_stepscxx . . $ SuperFamicom/DSP3i/op1e_lcv_steps. = op1e_min_radiuscxx . . $ SuperFamicom/DSP3i/op1e_min_radius.; |
| 681 | |
| 682 | op1e_xcxx . . $ SuperFamicom/DSP3i/op1e_x. = op3e_xcxx . . $ SuperFamicom/DSP3i/op3e_x.; |
| 683 | op1e_ycxx . . $ SuperFamicom/DSP3i/op1e_y. = op3e_ycxx . . $ SuperFamicom/DSP3i/op3e_y.; |
| 684 | |
| 685 | for( lcv = 0; lcv < op1e_min_radiuscxx . . $ SuperFamicom/DSP3i/op1e_min_radius.; lcv++ ) |
| 686 | DSP3_OP1E_Dcxx . . $ SuperFamicom/DSP3i/DSP3_OP1E_D(9698444918e4f66a).( op1e_turncxx . . $ SuperFamicom/DSP3i/op1e_turn., &op1e_xcxx . . $ SuperFamicom/DSP3i/op1e_x., &op1e_ycxx . . $ SuperFamicom/DSP3i/op1e_y. ); |
| 687 | } |
| 688 | |
| 689 | if( op1e_lcv_turnscxx . . $ SuperFamicom/DSP3i/op1e_lcv_turns. == 0 ) { |
| 690 | DSP3_DRcxx . . $ SuperFamicom/DSP3i/DSP3_DR. = 0xffff; |
| 691 | DSP3_SRcxx . . $ SuperFamicom/DSP3i/DSP3_SR. = 0x0080; |
| 692 | SetDSP3cxx . . $ SuperFamicom/DSP3i/SetDSP3. = &DSP3_OP1E_Bcxx . . $ SuperFamicom/DSP3i/DSP3_OP1E_B(49f6e7a06ebc5aa8).; |
| 693 | return; |
| 694 | } |
| 695 | |
| 696 | DSP3_DRcxx . . $ SuperFamicom/DSP3i/DSP3_DR. = (uint8cxx . . $ uint8#)(op1e_xcxx . . $ SuperFamicom/DSP3i/op1e_x.) | ((uint8cxx . . $ uint8#)(op1e_ycxx . . $ SuperFamicom/DSP3i/op1e_y.)<<8); |
| 697 | DSP3_OP03cxx . . $ SuperFamicom/DSP3i/DSP3_OP03(49f6e7a06ebc5aa8).(); |
| 698 | |
| 699 | op1e_cellcxx . . $ SuperFamicom/DSP3i/op1e_cell. = DSP3_DRcxx . . $ SuperFamicom/DSP3i/DSP3_DR.; |
| 700 | |
| 701 | DSP3_SRcxx . . $ SuperFamicom/DSP3i/DSP3_SR. = 0x0080; |
| 702 | SetDSP3cxx . . $ SuperFamicom/DSP3i/SetDSP3. = &DSP3_OP1E_A1cxx . . $ SuperFamicom/DSP3i/DSP3_OP1E_A1(49f6e7a06ebc5aa8).; |
| 703 | } |
| 704 | |
| 705 | void DSP3_OP1E_A1cxx . . $ SuperFamicom/DSP3i/DSP3_OP1E_A1(49f6e7a06ebc5aa8).() |
| 706 | { |
| 707 | DSP3_SRcxx . . $ SuperFamicom/DSP3i/DSP3_SR. = 0x0084; |
| 708 | SetDSP3cxx . . $ SuperFamicom/DSP3i/SetDSP3. = &DSP3_OP1E_A2cxx . . $ SuperFamicom/DSP3i/DSP3_OP1E_A2(49f6e7a06ebc5aa8).; |
| 709 | } |
| 710 | |
| 711 | void DSP3_OP1E_A2cxx . . $ SuperFamicom/DSP3i/DSP3_OP1E_A2(49f6e7a06ebc5aa8).() |
| 712 | { |
| 713 | op1e_terraincxx . . $ SuperFamicom/DSP3i/op1e_terrain.[ op1e_cellcxx . . $ SuperFamicom/DSP3i/op1e_cell. ] = (uint8cxx . . $ uint8#)(DSP3_DRcxx . . $ SuperFamicom/DSP3i/DSP3_DR. & 0x00ff); |
| 714 | |
| 715 | DSP3_SRcxx . . $ SuperFamicom/DSP3i/DSP3_SR. = 0x0084; |
| 716 | SetDSP3cxx . . $ SuperFamicom/DSP3i/SetDSP3. = &DSP3_OP1E_A3cxx . . $ SuperFamicom/DSP3i/DSP3_OP1E_A3(49f6e7a06ebc5aa8).; |
| 717 | } |
| 718 | |
| 719 | void DSP3_OP1E_A3cxx . . $ SuperFamicom/DSP3i/DSP3_OP1E_A3(49f6e7a06ebc5aa8).() |
| 720 | { |
| 721 | op1e_costcxx . . $ SuperFamicom/DSP3i/op1e_cost.[ op1e_cellcxx . . $ SuperFamicom/DSP3i/op1e_cell. ] = (uint8cxx . . $ uint8#)(DSP3_DRcxx . . $ SuperFamicom/DSP3i/DSP3_DR. & 0x00ff); |
| 722 | |
| 723 | if( op1e_lcv_radiuscxx . . $ SuperFamicom/DSP3i/op1e_lcv_radius. == 1 ) { |
| 724 | if( op1e_terraincxx . . $ SuperFamicom/DSP3i/op1e_terrain.[ op1e_cellcxx . . $ SuperFamicom/DSP3i/op1e_cell. ] & 1 ) { |
| 725 | op1e_weightcxx . . $ SuperFamicom/DSP3i/op1e_weight.[ op1e_cellcxx . . $ SuperFamicom/DSP3i/op1e_cell. ] = 0xff; |
| 726 | } else { |
| 727 | op1e_weightcxx . . $ SuperFamicom/DSP3i/op1e_weight.[ op1e_cellcxx . . $ SuperFamicom/DSP3i/op1e_cell. ] = op1e_costcxx . . $ SuperFamicom/DSP3i/op1e_cost.[ op1e_cellcxx . . $ SuperFamicom/DSP3i/op1e_cell. ]; |
| 728 | } |
| 729 | } |
| 730 | else { |
| 731 | op1e_weightcxx . . $ SuperFamicom/DSP3i/op1e_weight.[ op1e_cellcxx . . $ SuperFamicom/DSP3i/op1e_cell. ] = 0xff; |
| 732 | } |
| 733 | |
| 734 | DSP3_OP1E_Dcxx . . $ SuperFamicom/DSP3i/DSP3_OP1E_D(9698444918e4f66a).( (int16cxx . . $ int16#)(op1e_turncxx . . $ SuperFamicom/DSP3i/op1e_turn.+2), &op1e_xcxx . . $ SuperFamicom/DSP3i/op1e_x., &op1e_ycxx . . $ SuperFamicom/DSP3i/op1e_y. ); |
| 735 | op1e_lcv_stepscxx . . $ SuperFamicom/DSP3i/op1e_lcv_steps.--; |
| 736 | |
| 737 | DSP3_SRcxx . . $ SuperFamicom/DSP3i/DSP3_SR. = 0x0080; |
| 738 | DSP3_OP1E_Acxx . . $ SuperFamicom/DSP3i/DSP3_OP1E_A(49f6e7a06ebc5aa8).(); |
| 739 | } |
| 740 | |
| 741 | |
| 742 | void DSP3_OP1E_Bcxx . . $ SuperFamicom/DSP3i/DSP3_OP1E_B(49f6e7a06ebc5aa8).() |
| 743 | { |
| 744 | op1e_xcxx . . $ SuperFamicom/DSP3i/op1e_x. = op3e_xcxx . . $ SuperFamicom/DSP3i/op3e_x.; |
| 745 | op1e_ycxx . . $ SuperFamicom/DSP3i/op1e_y. = op3e_ycxx . . $ SuperFamicom/DSP3i/op3e_y.; |
| 746 | op1e_lcv_radiuscxx . . $ SuperFamicom/DSP3i/op1e_lcv_radius. = 1; |
| 747 | |
| 748 | op1e_searchcxx . . $ SuperFamicom/DSP3i/op1e_search. = 0; |
| 749 | |
| 750 | DSP3_OP1E_B1cxx . . $ SuperFamicom/DSP3i/DSP3_OP1E_B1(49f6e7a06ebc5aa8).(); |
| 751 | |
| 752 | SetDSP3cxx . . $ SuperFamicom/DSP3i/SetDSP3. = &DSP3_OP1E_Ccxx . . $ SuperFamicom/DSP3i/DSP3_OP1E_C(49f6e7a06ebc5aa8).; |
| 753 | } |
| 754 | |
| 755 | |
| 756 | void DSP3_OP1E_B1cxx . . $ SuperFamicom/DSP3i/DSP3_OP1E_B1(49f6e7a06ebc5aa8).() |
| 757 | { |
| 758 | while( op1e_lcv_radiuscxx . . $ SuperFamicom/DSP3i/op1e_lcv_radius. < op1e_max_radiuscxx . . $ SuperFamicom/DSP3i/op1e_max_radius. ) { |
| 759 | op1e_ycxx . . $ SuperFamicom/DSP3i/op1e_y.--; |
| 760 | |
| 761 | op1e_lcv_turnscxx . . $ SuperFamicom/DSP3i/op1e_lcv_turns. = 6; |
| 762 | op1e_turncxx . . $ SuperFamicom/DSP3i/op1e_turn. = 5; |
| 763 | |
| 764 | while( op1e_lcv_turnscxx . . $ SuperFamicom/DSP3i/op1e_lcv_turns. ) { |
| 765 | op1e_lcv_stepscxx . . $ SuperFamicom/DSP3i/op1e_lcv_steps. = op1e_lcv_radiuscxx . . $ SuperFamicom/DSP3i/op1e_lcv_radius.; |
| 766 | |
| 767 | while( op1e_lcv_stepscxx . . $ SuperFamicom/DSP3i/op1e_lcv_steps. ) { |
| 768 | DSP3_OP1E_D1cxx . . $ SuperFamicom/DSP3i/DSP3_OP1E_D1(9698444918e4f66a).( op1e_turncxx . . $ SuperFamicom/DSP3i/op1e_turn., &op1e_xcxx . . $ SuperFamicom/DSP3i/op1e_x., &op1e_ycxx . . $ SuperFamicom/DSP3i/op1e_y. ); |
| 769 | |
| 770 | if( 0 <= op1e_ycxx . . $ SuperFamicom/DSP3i/op1e_y. && op1e_ycxx . . $ SuperFamicom/DSP3i/op1e_y. < DSP3_WinHicxx . . $ SuperFamicom/DSP3i/DSP3_WinHi. && |
| 771 | 0 <= op1e_xcxx . . $ SuperFamicom/DSP3i/op1e_x. && op1e_xcxx . . $ SuperFamicom/DSP3i/op1e_x. < DSP3_WinLocxx . . $ SuperFamicom/DSP3i/DSP3_WinLo. ) { |
| 772 | DSP3_DRcxx . . $ SuperFamicom/DSP3i/DSP3_DR. = (uint8cxx . . $ uint8#)(op1e_xcxx . . $ SuperFamicom/DSP3i/op1e_x.) | ((uint8cxx . . $ uint8#)(op1e_ycxx . . $ SuperFamicom/DSP3i/op1e_y.)<<8); |
| 773 | DSP3_OP03cxx . . $ SuperFamicom/DSP3i/DSP3_OP03(49f6e7a06ebc5aa8).(); |
| 774 | |
| 775 | op1e_cellcxx . . $ SuperFamicom/DSP3i/op1e_cell. = DSP3_DRcxx . . $ SuperFamicom/DSP3i/DSP3_DR.; |
| 776 | if( op1e_costcxx . . $ SuperFamicom/DSP3i/op1e_cost.[ op1e_cellcxx . . $ SuperFamicom/DSP3i/op1e_cell. ] < 0x80 && |
| 777 | op1e_terraincxx . . $ SuperFamicom/DSP3i/op1e_terrain.[ op1e_cellcxx . . $ SuperFamicom/DSP3i/op1e_cell. ] < 0x40 ) { |
| 778 | DSP3_OP1E_B2cxx . . $ SuperFamicom/DSP3i/DSP3_OP1E_B2(49f6e7a06ebc5aa8).(); |
| 779 | } // end cell perimeter |
| 780 | } |
| 781 | |
| 782 | op1e_lcv_stepscxx . . $ SuperFamicom/DSP3i/op1e_lcv_steps.--; |
| 783 | } // end search line |
| 784 | |
| 785 | op1e_turncxx . . $ SuperFamicom/DSP3i/op1e_turn.--; |
| 786 | if( op1e_turncxx . . $ SuperFamicom/DSP3i/op1e_turn. == 0 ) op1e_turncxx . . $ SuperFamicom/DSP3i/op1e_turn. = 6; |
| 787 | |
| 788 | op1e_lcv_turnscxx . . $ SuperFamicom/DSP3i/op1e_lcv_turns.--; |
| 789 | } // end circle search |
| 790 | |
| 791 | op1e_lcv_radiuscxx . . $ SuperFamicom/DSP3i/op1e_lcv_radius.++; |
| 792 | } // end radius search |
| 793 | } |
| 794 | |
| 795 | |
| 796 | void DSP3_OP1E_B2cxx . . $ SuperFamicom/DSP3i/DSP3_OP1E_B2(49f6e7a06ebc5aa8).() |
| 797 | { |
| 798 | int16cxx . . $ int16# cell; |
| 799 | int16cxx . . $ int16# path; |
| 800 | int16cxx . . $ int16# x,y; |
| 801 | int16cxx . . $ int16# lcv_turns; |
| 802 | |
| 803 | path = 0xff; |
| 804 | lcv_turns = 6; |
| 805 | |
| 806 | while( lcv_turns ) { |
| 807 | x = op1e_xcxx . . $ SuperFamicom/DSP3i/op1e_x.; |
| 808 | y = op1e_ycxx . . $ SuperFamicom/DSP3i/op1e_y.; |
| 809 | |
| 810 | DSP3_OP1E_D1cxx . . $ SuperFamicom/DSP3i/DSP3_OP1E_D1(9698444918e4f66a).( lcv_turns, &x, &y ); |
| 811 | |
| 812 | DSP3_DRcxx . . $ SuperFamicom/DSP3i/DSP3_DR. = (uint8cxx . . $ uint8#)(x) | ((uint8cxx . . $ uint8#)(y)<<8); |
| 813 | DSP3_OP03cxx . . $ SuperFamicom/DSP3i/DSP3_OP03(49f6e7a06ebc5aa8).(); |
| 814 | |
| 815 | cell = DSP3_DRcxx . . $ SuperFamicom/DSP3i/DSP3_DR.; |
| 816 | |
| 817 | if( 0 <= y && y < DSP3_WinHicxx . . $ SuperFamicom/DSP3i/DSP3_WinHi. && |
| 818 | 0 <= x && x < DSP3_WinLocxx . . $ SuperFamicom/DSP3i/DSP3_WinLo. ) { |
| 819 | |
| 820 | if( op1e_terraincxx . . $ SuperFamicom/DSP3i/op1e_terrain.[ cell ] < 0x80 || op1e_weightcxx . . $ SuperFamicom/DSP3i/op1e_weight.[ cell ] == 0 ) { |
| 821 | if( op1e_weightcxx . . $ SuperFamicom/DSP3i/op1e_weight.[ cell ] < path ) { |
| 822 | path = op1e_weightcxx . . $ SuperFamicom/DSP3i/op1e_weight.[ cell ]; |
| 823 | } |
| 824 | } |
| 825 | } // end step travel |
| 826 | |
| 827 | lcv_turns--; |
| 828 | } // end while turns |
| 829 | |
| 830 | if( path != 0xff ) { |
| 831 | op1e_weightcxx . . $ SuperFamicom/DSP3i/op1e_weight.[ op1e_cellcxx . . $ SuperFamicom/DSP3i/op1e_cell. ] = path + op1e_costcxx . . $ SuperFamicom/DSP3i/op1e_cost.[ op1e_cellcxx . . $ SuperFamicom/DSP3i/op1e_cell. ]; |
| 832 | } |
| 833 | } |
| 834 | |
| 835 | |
| 836 | void DSP3_OP1E_Ccxx . . $ SuperFamicom/DSP3i/DSP3_OP1E_C(49f6e7a06ebc5aa8).() |
| 837 | { |
| 838 | int lcv; |
| 839 | |
| 840 | op1e_min_radiuscxx . . $ SuperFamicom/DSP3i/op1e_min_radius. = (uint8cxx . . $ uint8#)(DSP3_DRcxx . . $ SuperFamicom/DSP3i/DSP3_DR. & 0x00ff); |
| 841 | op1e_max_radiuscxx . . $ SuperFamicom/DSP3i/op1e_max_radius. = (uint8cxx . . $ uint8#)((DSP3_DRcxx . . $ SuperFamicom/DSP3i/DSP3_DR. & 0xff00)>>8); |
| 842 | |
| 843 | if( op1e_min_radiuscxx . . $ SuperFamicom/DSP3i/op1e_min_radius. == 0 ) |
| 844 | op1e_min_radiuscxx . . $ SuperFamicom/DSP3i/op1e_min_radius.++; |
| 845 | |
| 846 | if( op1e_max_path_radiuscxx . . $ SuperFamicom/DSP3i/op1e_max_path_radius. >= op1e_min_radiuscxx . . $ SuperFamicom/DSP3i/op1e_min_radius. ) |
| 847 | op1e_min_radiuscxx . . $ SuperFamicom/DSP3i/op1e_min_radius. = op1e_max_path_radiuscxx . . $ SuperFamicom/DSP3i/op1e_max_path_radius.+1; |
| 848 | |
| 849 | if( op1e_max_radiuscxx . . $ SuperFamicom/DSP3i/op1e_max_radius. > op1e_max_path_radiuscxx . . $ SuperFamicom/DSP3i/op1e_max_path_radius. ) |
| 850 | op1e_max_path_radiuscxx . . $ SuperFamicom/DSP3i/op1e_max_path_radius. = op1e_max_radiuscxx . . $ SuperFamicom/DSP3i/op1e_max_radius.; |
| 851 | |
| 852 | op1e_lcv_radiuscxx . . $ SuperFamicom/DSP3i/op1e_lcv_radius. = op1e_min_radiuscxx . . $ SuperFamicom/DSP3i/op1e_min_radius.; |
| 853 | op1e_lcv_stepscxx . . $ SuperFamicom/DSP3i/op1e_lcv_steps. = op1e_min_radiuscxx . . $ SuperFamicom/DSP3i/op1e_min_radius.; |
| 854 | |
| 855 | op1e_lcv_turnscxx . . $ SuperFamicom/DSP3i/op1e_lcv_turns. = 6; |
| 856 | op1e_turncxx . . $ SuperFamicom/DSP3i/op1e_turn. = 0; |
| 857 | |
| 858 | op1e_xcxx . . $ SuperFamicom/DSP3i/op1e_x. = op3e_xcxx . . $ SuperFamicom/DSP3i/op3e_x.; |
| 859 | op1e_ycxx . . $ SuperFamicom/DSP3i/op1e_y. = op3e_ycxx . . $ SuperFamicom/DSP3i/op3e_y.; |
| 860 | |
| 861 | for( lcv = 0; lcv < op1e_min_radiuscxx . . $ SuperFamicom/DSP3i/op1e_min_radius.; lcv++ ) |
| 862 | DSP3_OP1E_Dcxx . . $ SuperFamicom/DSP3i/DSP3_OP1E_D(9698444918e4f66a).( op1e_turncxx . . $ SuperFamicom/DSP3i/op1e_turn., &op1e_xcxx . . $ SuperFamicom/DSP3i/op1e_x., &op1e_ycxx . . $ SuperFamicom/DSP3i/op1e_y. ); |
| 863 | |
| 864 | DSP3_OP1E_C1cxx . . $ SuperFamicom/DSP3i/DSP3_OP1E_C1(49f6e7a06ebc5aa8).(); |
| 865 | } |
| 866 | |
| 867 | |
| 868 | void DSP3_OP1E_C1cxx . . $ SuperFamicom/DSP3i/DSP3_OP1E_C1(49f6e7a06ebc5aa8).() |
| 869 | { |
| 870 | int lcv; |
| 871 | |
| 872 | if( op1e_lcv_stepscxx . . $ SuperFamicom/DSP3i/op1e_lcv_steps. == 0 ) { |
| 873 | op1e_lcv_radiuscxx . . $ SuperFamicom/DSP3i/op1e_lcv_radius.++; |
| 874 | |
| 875 | op1e_lcv_stepscxx . . $ SuperFamicom/DSP3i/op1e_lcv_steps. = op1e_lcv_radiuscxx . . $ SuperFamicom/DSP3i/op1e_lcv_radius.; |
| 876 | |
| 877 | op1e_xcxx . . $ SuperFamicom/DSP3i/op1e_x. = op3e_xcxx . . $ SuperFamicom/DSP3i/op3e_x.; |
| 878 | op1e_ycxx . . $ SuperFamicom/DSP3i/op1e_y. = op3e_ycxx . . $ SuperFamicom/DSP3i/op3e_y.; |
| 879 | |
| 880 | for( lcv = 0; lcv < op1e_lcv_radiuscxx . . $ SuperFamicom/DSP3i/op1e_lcv_radius.; lcv++ ) |
| 881 | DSP3_OP1E_Dcxx . . $ SuperFamicom/DSP3i/DSP3_OP1E_D(9698444918e4f66a).( op1e_turncxx . . $ SuperFamicom/DSP3i/op1e_turn., &op1e_xcxx . . $ SuperFamicom/DSP3i/op1e_x., &op1e_ycxx . . $ SuperFamicom/DSP3i/op1e_y. ); |
| 882 | } |
| 883 | |
| 884 | if( op1e_lcv_radiuscxx . . $ SuperFamicom/DSP3i/op1e_lcv_radius. > op1e_max_radiuscxx . . $ SuperFamicom/DSP3i/op1e_max_radius. ) { |
| 885 | op1e_turncxx . . $ SuperFamicom/DSP3i/op1e_turn.++; |
| 886 | op1e_lcv_turnscxx . . $ SuperFamicom/DSP3i/op1e_lcv_turns.--; |
| 887 | |
| 888 | op1e_lcv_radiuscxx . . $ SuperFamicom/DSP3i/op1e_lcv_radius. = op1e_min_radiuscxx . . $ SuperFamicom/DSP3i/op1e_min_radius.; |
| 889 | op1e_lcv_stepscxx . . $ SuperFamicom/DSP3i/op1e_lcv_steps. = op1e_min_radiuscxx . . $ SuperFamicom/DSP3i/op1e_min_radius.; |
| 890 | |
| 891 | op1e_xcxx . . $ SuperFamicom/DSP3i/op1e_x. = op3e_xcxx . . $ SuperFamicom/DSP3i/op3e_x.; |
| 892 | op1e_ycxx . . $ SuperFamicom/DSP3i/op1e_y. = op3e_ycxx . . $ SuperFamicom/DSP3i/op3e_y.; |
| 893 | |
| 894 | for( lcv = 0; lcv < op1e_min_radiuscxx . . $ SuperFamicom/DSP3i/op1e_min_radius.; lcv++ ) |
| 895 | DSP3_OP1E_Dcxx . . $ SuperFamicom/DSP3i/DSP3_OP1E_D(9698444918e4f66a).( op1e_turncxx . . $ SuperFamicom/DSP3i/op1e_turn., &op1e_xcxx . . $ SuperFamicom/DSP3i/op1e_x., &op1e_ycxx . . $ SuperFamicom/DSP3i/op1e_y. ); |
| 896 | } |
| 897 | |
| 898 | if( op1e_lcv_turnscxx . . $ SuperFamicom/DSP3i/op1e_lcv_turns. == 0 ) { |
| 899 | DSP3_DRcxx . . $ SuperFamicom/DSP3i/DSP3_DR. = 0xffff; |
| 900 | DSP3_SRcxx . . $ SuperFamicom/DSP3i/DSP3_SR. = 0x0080; |
| 901 | SetDSP3cxx . . $ SuperFamicom/DSP3i/SetDSP3. = &DSP3_Resetcxx . . $ SuperFamicom/DSP3i/DSP3_Reset(49f6e7a06ebc5aa8).; |
| 902 | return; |
| 903 | } |
| 904 | |
| 905 | DSP3_DRcxx . . $ SuperFamicom/DSP3i/DSP3_DR. = (uint8cxx . . $ uint8#)(op1e_xcxx . . $ SuperFamicom/DSP3i/op1e_x.) | ((uint8cxx . . $ uint8#)(op1e_ycxx . . $ SuperFamicom/DSP3i/op1e_y.)<<8); |
| 906 | DSP3_OP03cxx . . $ SuperFamicom/DSP3i/DSP3_OP03(49f6e7a06ebc5aa8).(); |
| 907 | |
| 908 | op1e_cellcxx . . $ SuperFamicom/DSP3i/op1e_cell. = DSP3_DRcxx . . $ SuperFamicom/DSP3i/DSP3_DR.; |
| 909 | |
| 910 | DSP3_SRcxx . . $ SuperFamicom/DSP3i/DSP3_SR. = 0x0080; |
| 911 | SetDSP3cxx . . $ SuperFamicom/DSP3i/SetDSP3. = &DSP3_OP1E_C2cxx . . $ SuperFamicom/DSP3i/DSP3_OP1E_C2(49f6e7a06ebc5aa8).; |
| 912 | } |
| 913 | |
| 914 | |
| 915 | void DSP3_OP1E_C2cxx . . $ SuperFamicom/DSP3i/DSP3_OP1E_C2(49f6e7a06ebc5aa8).() |
| 916 | { |
| 917 | DSP3_DRcxx . . $ SuperFamicom/DSP3i/DSP3_DR. = op1e_weightcxx . . $ SuperFamicom/DSP3i/op1e_weight.[ op1e_cellcxx . . $ SuperFamicom/DSP3i/op1e_cell. ]; |
| 918 | |
| 919 | DSP3_OP1E_Dcxx . . $ SuperFamicom/DSP3i/DSP3_OP1E_D(9698444918e4f66a).( (int16cxx . . $ int16#)(op1e_turncxx . . $ SuperFamicom/DSP3i/op1e_turn.+2), &op1e_xcxx . . $ SuperFamicom/DSP3i/op1e_x., &op1e_ycxx . . $ SuperFamicom/DSP3i/op1e_y. ); |
| 920 | op1e_lcv_stepscxx . . $ SuperFamicom/DSP3i/op1e_lcv_steps.--; |
| 921 | |
| 922 | DSP3_SRcxx . . $ SuperFamicom/DSP3i/DSP3_SR. = 0x0084; |
| 923 | SetDSP3cxx . . $ SuperFamicom/DSP3i/SetDSP3. = &DSP3_OP1E_C1cxx . . $ SuperFamicom/DSP3i/DSP3_OP1E_C1(49f6e7a06ebc5aa8).; |
| 924 | } |
| 925 | |
| 926 | |
| 927 | void DSP3_OP1E_Dcxx . . $ SuperFamicom/DSP3i/DSP3_OP1E_D(9698444918e4f66a).( int16cxx . . $ int16# move, int16cxx . . $ int16# *lo, int16cxx . . $ int16# *hi ) |
| 928 | { |
| 929 | uint32cxx . . $ uint32# dataOfs = ((move << 1) + 0x03b2) & 0x03ff; |
| 930 | int16cxx . . $ int16# Lo; |
| 931 | int16cxx . . $ int16# Hi; |
| 932 | |
| 933 | DSP3_AddHicxx . . $ SuperFamicom/DSP3i/DSP3_AddHi. = DSP3_DataROMcxx . . $ SuperFamicom/DSP3i/DSP3_DataROM.[dataOfs]; |
| 934 | DSP3_AddLocxx . . $ SuperFamicom/DSP3i/DSP3_AddLo. = DSP3_DataROMcxx . . $ SuperFamicom/DSP3i/DSP3_DataROM.[dataOfs + 1]; |
| 935 | |
| 936 | Lo = (uint8cxx . . $ uint8#)(*lo); |
| 937 | Hi = (uint8cxx . . $ uint8#)(*hi); |
| 938 | |
| 939 | if (Lo & 1) Hi += (DSP3_AddLocxx . . $ SuperFamicom/DSP3i/DSP3_AddLo. & 1); |
| 940 | |
| 941 | DSP3_AddLocxx . . $ SuperFamicom/DSP3i/DSP3_AddLo. += Lo; |
| 942 | DSP3_AddHicxx . . $ SuperFamicom/DSP3i/DSP3_AddHi. += Hi; |
| 943 | |
| 944 | if (DSP3_AddLocxx . . $ SuperFamicom/DSP3i/DSP3_AddLo. < 0) |
| 945 | DSP3_AddLocxx . . $ SuperFamicom/DSP3i/DSP3_AddLo. += DSP3_WinLocxx . . $ SuperFamicom/DSP3i/DSP3_WinLo.; |
| 946 | else |
| 947 | if (DSP3_AddLocxx . . $ SuperFamicom/DSP3i/DSP3_AddLo. >= DSP3_WinLocxx . . $ SuperFamicom/DSP3i/DSP3_WinLo.) |
| 948 | DSP3_AddLocxx . . $ SuperFamicom/DSP3i/DSP3_AddLo. -= DSP3_WinLocxx . . $ SuperFamicom/DSP3i/DSP3_WinLo.; |
| 949 | |
| 950 | if (DSP3_AddHicxx . . $ SuperFamicom/DSP3i/DSP3_AddHi. < 0) |
| 951 | DSP3_AddHicxx . . $ SuperFamicom/DSP3i/DSP3_AddHi. += DSP3_WinHicxx . . $ SuperFamicom/DSP3i/DSP3_WinHi.; |
| 952 | else |
| 953 | if (DSP3_AddHicxx . . $ SuperFamicom/DSP3i/DSP3_AddHi. >= DSP3_WinHicxx . . $ SuperFamicom/DSP3i/DSP3_WinHi.) |
| 954 | DSP3_AddHicxx . . $ SuperFamicom/DSP3i/DSP3_AddHi. -= DSP3_WinHicxx . . $ SuperFamicom/DSP3i/DSP3_WinHi.; |
| 955 | |
| 956 | *lo = DSP3_AddLocxx . . $ SuperFamicom/DSP3i/DSP3_AddLo.; |
| 957 | *hi = DSP3_AddHicxx . . $ SuperFamicom/DSP3i/DSP3_AddHi.; |
| 958 | } |
| 959 | |
| 960 | |
| 961 | void DSP3_OP1E_D1cxx . . $ SuperFamicom/DSP3i/DSP3_OP1E_D1(9698444918e4f66a).( int16cxx . . $ int16# move, int16cxx . . $ int16# *lo, int16cxx . . $ int16# *hi ) |
| 962 | { |
| 963 | //uint32 dataOfs = ((move << 1) + 0x03b2) & 0x03ff; |
| 964 | int16cxx . . $ int16# Lo; |
| 965 | int16cxx . . $ int16# Hi; |
| 966 | |
| 967 | const unsigned short HiAdd[] = { |
| 968 | 0x00, 0xFF, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, |
| 969 | 0x00, 0xFF, 0xFF, 0x00, 0x01, 0x00, 0xFF, 0x00 |
| 970 | }; |
| 971 | const unsigned short LoAdd[] = { |
| 972 | 0x00, 0x00, 0x01, 0x01, 0x00, 0xFF, 0xFF, 0x00 |
| 973 | }; |
| 974 | |
| 975 | if( (*lo) & 1 ) |
| 976 | DSP3_AddHicxx . . $ SuperFamicom/DSP3i/DSP3_AddHi. = HiAdd[ move + 8 ]; |
| 977 | else |
| 978 | DSP3_AddHicxx . . $ SuperFamicom/DSP3i/DSP3_AddHi. = HiAdd[ move + 0 ]; |
| 979 | DSP3_AddLocxx . . $ SuperFamicom/DSP3i/DSP3_AddLo. = LoAdd[ move ]; |
| 980 | |
| 981 | Lo = (uint8cxx . . $ uint8#)(*lo); |
| 982 | Hi = (uint8cxx . . $ uint8#)(*hi); |
| 983 | |
| 984 | if (Lo & 1) Hi += (DSP3_AddLocxx . . $ SuperFamicom/DSP3i/DSP3_AddLo. & 1); |
| 985 | |
| 986 | DSP3_AddLocxx . . $ SuperFamicom/DSP3i/DSP3_AddLo. += Lo; |
| 987 | DSP3_AddHicxx . . $ SuperFamicom/DSP3i/DSP3_AddHi. += Hi; |
| 988 | |
| 989 | *lo = DSP3_AddLocxx . . $ SuperFamicom/DSP3i/DSP3_AddLo.; |
| 990 | *hi = DSP3_AddHicxx . . $ SuperFamicom/DSP3i/DSP3_AddHi.; |
| 991 | } |
| 992 | |
| 993 | |
| 994 | void DSP3_OP10cxx . . $ SuperFamicom/DSP3i/DSP3_OP10(49f6e7a06ebc5aa8).() |
| 995 | { |
| 996 | if( DSP3_DRcxx . . $ SuperFamicom/DSP3i/DSP3_DR. == 0xffff ) { |
| 997 | DSP3_Resetcxx . . $ SuperFamicom/DSP3i/DSP3_Reset(49f6e7a06ebc5aa8).(); |
| 998 | } else { |
| 999 | // absorb 2 bytes |
| 1000 | DSP3_DRcxx . . $ SuperFamicom/DSP3i/DSP3_DR. = DSP3_DRcxx . . $ SuperFamicom/DSP3i/DSP3_DR.; |
| 1001 | } |
| 1002 | } |
| 1003 | |
| 1004 | |
| 1005 | void DSP3_OP0C_Acxx . . $ SuperFamicom/DSP3i/DSP3_OP0C_A(49f6e7a06ebc5aa8).() |
| 1006 | { |
| 1007 | // absorb 2 bytes |
| 1008 | |
| 1009 | DSP3_DRcxx . . $ SuperFamicom/DSP3i/DSP3_DR. = 0; |
| 1010 | SetDSP3cxx . . $ SuperFamicom/DSP3i/SetDSP3. = &DSP3_Resetcxx . . $ SuperFamicom/DSP3i/DSP3_Reset(49f6e7a06ebc5aa8).; |
| 1011 | } |
| 1012 | |
| 1013 | |
| 1014 | void DSP3_OP0Ccxx . . $ SuperFamicom/DSP3i/DSP3_OP0C(49f6e7a06ebc5aa8).() |
| 1015 | { |
| 1016 | // absorb 2 bytes |
| 1017 | |
| 1018 | DSP3_DRcxx . . $ SuperFamicom/DSP3i/DSP3_DR. = 0; |
| 1019 | //SetDSP3 = &DSP3_OP0C_A; |
| 1020 | SetDSP3cxx . . $ SuperFamicom/DSP3i/SetDSP3. = &DSP3_Resetcxx . . $ SuperFamicom/DSP3i/DSP3_Reset(49f6e7a06ebc5aa8).; |
| 1021 | } |
| 1022 | |
| 1023 | |
| 1024 | void DSP3_OP1C_Ccxx . . $ SuperFamicom/DSP3i/DSP3_OP1C_C(49f6e7a06ebc5aa8).() |
| 1025 | { |
| 1026 | // return 2 bytes |
| 1027 | DSP3_DRcxx . . $ SuperFamicom/DSP3i/DSP3_DR. = 0; |
| 1028 | SetDSP3cxx . . $ SuperFamicom/DSP3i/SetDSP3. = &DSP3_Resetcxx . . $ SuperFamicom/DSP3i/DSP3_Reset(49f6e7a06ebc5aa8).; |
| 1029 | } |
| 1030 | |
| 1031 | |
| 1032 | void DSP3_OP1C_Bcxx . . $ SuperFamicom/DSP3i/DSP3_OP1C_B(49f6e7a06ebc5aa8).() |
| 1033 | { |
| 1034 | // absorb 2 bytes |
| 1035 | |
| 1036 | // return 2 bytes |
| 1037 | DSP3_DRcxx . . $ SuperFamicom/DSP3i/DSP3_DR. = 0; |
| 1038 | SetDSP3cxx . . $ SuperFamicom/DSP3i/SetDSP3. = &DSP3_OP1C_Ccxx . . $ SuperFamicom/DSP3i/DSP3_OP1C_C(49f6e7a06ebc5aa8).; |
| 1039 | } |
| 1040 | |
| 1041 | |
| 1042 | void DSP3_OP1C_Acxx . . $ SuperFamicom/DSP3i/DSP3_OP1C_A(49f6e7a06ebc5aa8).() |
| 1043 | { |
| 1044 | // absorb 2 bytes |
| 1045 | |
| 1046 | SetDSP3cxx . . $ SuperFamicom/DSP3i/SetDSP3. = &DSP3_OP1C_Bcxx . . $ SuperFamicom/DSP3i/DSP3_OP1C_B(49f6e7a06ebc5aa8).; |
| 1047 | } |
| 1048 | |
| 1049 | |
| 1050 | void DSP3_OP1Ccxx . . $ SuperFamicom/DSP3i/DSP3_OP1C(49f6e7a06ebc5aa8).() |
| 1051 | { |
| 1052 | // absorb 2 bytes |
| 1053 | |
| 1054 | SetDSP3cxx . . $ SuperFamicom/DSP3i/SetDSP3. = &DSP3_OP1C_Acxx . . $ SuperFamicom/DSP3i/DSP3_OP1C_A(49f6e7a06ebc5aa8).; |
| 1055 | } |
| 1056 | |
| 1057 | |
| 1058 | void DSP3_Commandcxx . . $ SuperFamicom/DSP3i/DSP3_Command(49f6e7a06ebc5aa8).() |
| 1059 | { |
| 1060 | if (DSP3_DRcxx . . $ SuperFamicom/DSP3i/DSP3_DR. < 0x40) |
| 1061 | { |
| 1062 | switch (DSP3_DRcxx . . $ SuperFamicom/DSP3i/DSP3_DR.) |
| 1063 | { |
| 1064 | case 0x02: SetDSP3cxx . . $ SuperFamicom/DSP3i/SetDSP3. = &DSP3_Coordinatecxx . . $ SuperFamicom/DSP3i/DSP3_Coordinate(49f6e7a06ebc5aa8).; break; |
| 1065 | case 0x03: SetDSP3cxx . . $ SuperFamicom/DSP3i/SetDSP3. = &DSP3_OP03cxx . . $ SuperFamicom/DSP3i/DSP3_OP03(49f6e7a06ebc5aa8).; break; |
| 1066 | case 0x06: SetDSP3cxx . . $ SuperFamicom/DSP3i/SetDSP3. = &DSP3_OP06cxx . . $ SuperFamicom/DSP3i/DSP3_OP06(49f6e7a06ebc5aa8).; break; |
| 1067 | case 0x07: SetDSP3cxx . . $ SuperFamicom/DSP3i/SetDSP3. = &DSP3_OP07cxx . . $ SuperFamicom/DSP3i/DSP3_OP07(49f6e7a06ebc5aa8).; return; |
| 1068 | case 0x0c: SetDSP3cxx . . $ SuperFamicom/DSP3i/SetDSP3. = &DSP3_OP0Ccxx . . $ SuperFamicom/DSP3i/DSP3_OP0C(49f6e7a06ebc5aa8).; break; |
| 1069 | case 0x0f: SetDSP3cxx . . $ SuperFamicom/DSP3i/SetDSP3. = &DSP3_TestMemorycxx . . $ SuperFamicom/DSP3i/DSP3_TestMemory(49f6e7a06ebc5aa8).; break; |
| 1070 | case 0x10: SetDSP3cxx . . $ SuperFamicom/DSP3i/SetDSP3. = &DSP3_OP10cxx . . $ SuperFamicom/DSP3i/DSP3_OP10(49f6e7a06ebc5aa8).; break; |
| 1071 | case 0x18: SetDSP3cxx . . $ SuperFamicom/DSP3i/SetDSP3. = &DSP3_Convertcxx . . $ SuperFamicom/DSP3i/DSP3_Convert(49f6e7a06ebc5aa8).; break; |
| 1072 | case 0x1c: SetDSP3cxx . . $ SuperFamicom/DSP3i/SetDSP3. = &DSP3_OP1Ccxx . . $ SuperFamicom/DSP3i/DSP3_OP1C(49f6e7a06ebc5aa8).; break; |
| 1073 | case 0x1e: SetDSP3cxx . . $ SuperFamicom/DSP3i/SetDSP3. = &DSP3_OP1Ecxx . . $ SuperFamicom/DSP3i/DSP3_OP1E(49f6e7a06ebc5aa8).; break; |
| 1074 | case 0x1f: SetDSP3cxx . . $ SuperFamicom/DSP3i/SetDSP3. = &DSP3_MemoryDumpcxx . . $ SuperFamicom/DSP3i/DSP3_MemoryDump(49f6e7a06ebc5aa8).; break; |
| 1075 | case 0x38: SetDSP3cxx . . $ SuperFamicom/DSP3i/SetDSP3. = &DSP3_Decodecxx . . $ SuperFamicom/DSP3i/DSP3_Decode(49f6e7a06ebc5aa8).; break; |
| 1076 | case 0x3e: SetDSP3cxx . . $ SuperFamicom/DSP3i/SetDSP3. = &DSP3_OP3Ecxx . . $ SuperFamicom/DSP3i/DSP3_OP3E(49f6e7a06ebc5aa8).; break; |
| 1077 | default: |
| 1078 | return; |
| 1079 | } |
| 1080 | DSP3_SRcxx . . $ SuperFamicom/DSP3i/DSP3_SR. = 0x0080; |
| 1081 | DSP3_Indexcxx . . $ SuperFamicom/DSP3i/DSP3_Index. = 0; |
| 1082 | } |
| 1083 | } |
| 1084 | |
| 1085 | uint8cxx . . $ uint8# dsp3_bytecxx . . $ SuperFamicom/DSP3i/dsp3_byte.; |
| 1086 | uint16cxx . . $ uint16# dsp3_addresscxx . . $ SuperFamicom/DSP3i/dsp3_address.; |
| 1087 | |
| 1088 | void DSP3SetBytecxx . . $ SuperFamicom/DSP3i/DSP3SetByte(49f6e7a06ebc5aa8).() |
| 1089 | { |
| 1090 | if (dsp3_addresscxx . . $ SuperFamicom/DSP3i/dsp3_address. < 0xC000) |
| 1091 | { |
| 1092 | if (DSP3_SRcxx . . $ SuperFamicom/DSP3i/DSP3_SR. & 0x04) |
| 1093 | { |
| 1094 | DSP3_DRcxx . . $ SuperFamicom/DSP3i/DSP3_DR. = (DSP3_DRcxx . . $ SuperFamicom/DSP3i/DSP3_DR. & 0xff00) + dsp3_bytecxx . . $ SuperFamicom/DSP3i/dsp3_byte.; |
| 1095 | (*SetDSP3cxx . . $ SuperFamicom/DSP3i/SetDSP3.)(); |
| 1096 | } |
| 1097 | else |
| 1098 | { |
| 1099 | DSP3_SRcxx . . $ SuperFamicom/DSP3i/DSP3_SR. ^= 0x10; |
| 1100 | |
| 1101 | if (DSP3_SRcxx . . $ SuperFamicom/DSP3i/DSP3_SR. & 0x10) |
| 1102 | DSP3_DRcxx . . $ SuperFamicom/DSP3i/DSP3_DR. = (DSP3_DRcxx . . $ SuperFamicom/DSP3i/DSP3_DR. & 0xff00) + dsp3_bytecxx . . $ SuperFamicom/DSP3i/dsp3_byte.; |
| 1103 | else |
| 1104 | { |
| 1105 | DSP3_DRcxx . . $ SuperFamicom/DSP3i/DSP3_DR. = (DSP3_DRcxx . . $ SuperFamicom/DSP3i/DSP3_DR. & 0x00ff) + (dsp3_bytecxx . . $ SuperFamicom/DSP3i/dsp3_byte. << 8); |
| 1106 | (*SetDSP3cxx . . $ SuperFamicom/DSP3i/SetDSP3.)(); |
| 1107 | } |
| 1108 | } |
| 1109 | } |
| 1110 | } |
| 1111 | |
| 1112 | void DSP3GetBytecxx . . $ SuperFamicom/DSP3i/DSP3GetByte(49f6e7a06ebc5aa8).() |
| 1113 | { |
| 1114 | if (dsp3_addresscxx . . $ SuperFamicom/DSP3i/dsp3_address. < 0xC000) |
| 1115 | { |
| 1116 | if (DSP3_SRcxx . . $ SuperFamicom/DSP3i/DSP3_SR. & 0x04) |
| 1117 | { |
| 1118 | dsp3_bytecxx . . $ SuperFamicom/DSP3i/dsp3_byte. = (uint8cxx . . $ uint8#) DSP3_DRcxx . . $ SuperFamicom/DSP3i/DSP3_DR.; |
| 1119 | (*SetDSP3cxx . . $ SuperFamicom/DSP3i/SetDSP3.)(); |
| 1120 | } |
| 1121 | else |
| 1122 | { |
| 1123 | DSP3_SRcxx . . $ SuperFamicom/DSP3i/DSP3_SR. ^= 0x10; |
| 1124 | |
| 1125 | if (DSP3_SRcxx . . $ SuperFamicom/DSP3i/DSP3_SR. & 0x10) |
| 1126 | dsp3_bytecxx . . $ SuperFamicom/DSP3i/dsp3_byte. = (uint8cxx . . $ uint8#) (DSP3_DRcxx . . $ SuperFamicom/DSP3i/DSP3_DR.); |
| 1127 | else |
| 1128 | { |
| 1129 | dsp3_bytecxx . . $ SuperFamicom/DSP3i/dsp3_byte. = (uint8cxx . . $ uint8#) (DSP3_DRcxx . . $ SuperFamicom/DSP3i/DSP3_DR. >> 8); |
| 1130 | (*SetDSP3cxx . . $ SuperFamicom/DSP3i/SetDSP3.)(); |
| 1131 | } |
| 1132 | } |
| 1133 | |
| 1134 | } |
| 1135 | else |
| 1136 | { |
| 1137 | dsp3_bytecxx . . $ SuperFamicom/DSP3i/dsp3_byte. = (uint8cxx . . $ uint8#) DSP3_SRcxx . . $ SuperFamicom/DSP3i/DSP3_SR.; |
| 1138 | } |
| 1139 | } |
| 1140 | |
| 1141 | void InitDSP3cxx . . $ SuperFamicom/DSP3i/InitDSP3(49f6e7a06ebc5aa8).() |
| 1142 | { |
| 1143 | DSP3_Resetcxx . . $ SuperFamicom/DSP3i/DSP3_Reset(49f6e7a06ebc5aa8).(); |
| 1144 | } |
| 1145 | |
| 1146 | #endif |