~ubuntu-branches/debian/sid/mame/sid

« back to all changes in this revision

Viewing changes to src/mame/machine/tx1.c

  • Committer: Package Import Robot
  • Author(s): Jordi Mallach, Emmanuel Kasper, Jordi Mallach
  • Date: 2012-06-05 20:02:23 UTC
  • mfrom: (0.3.1) (0.1.4)
  • Revision ID: package-import@ubuntu.com-20120605200223-gnlpogjrg6oqe9md
Tags: 0.146-1
[ Emmanuel Kasper ]
* New upstream release
* Drop patch to fix man pages section and patches to link with flac 
  and jpeg system lib: all this has been pushed upstream by Cesare Falco
* Add DM-Upload-Allowed: yes field.

[ Jordi Mallach ]
* Create a "gnu" TARGETOS stanza that defines NO_AFFINITY_NP.
* Stop setting TARGETOS to "unix" in d/rules. It should be autodetected,
  and set to the appropriate value.
* mame_manpage_section.patch: Change mame's manpage section to 6 (games),
  in the TH declaration.

Show diffs side-by-side

added added

removed removed

Lines of Context:
421
421
 
422
422
        tx1_state *state = machine.driver_data<tx1_state>();
423
423
        math_t &math = state->m_math;
424
 
        const UINT16 *prom = (UINT16*)machine.region("au_data")->base() + (0x8000 >> 1);
 
424
        const UINT16 *prom = (UINT16*)state->memregion("au_data")->base() + (0x8000 >> 1);
425
425
 
426
426
        for (;;)
427
427
        {
479
479
                                        data = math.muxlatch;
480
480
                                else if (dsel == 1)
481
481
                                {
482
 
                                        UINT16 *romdata = (UINT16*)machine.region("au_data")->base();
 
482
                                        UINT16 *romdata = (UINT16*)machine.root_device().memregion("au_data")->base();
483
483
                                        UINT16 addr = get_tx1_datarom_addr(math);
484
484
                                        data = romdata[addr];
485
485
                                }
597
597
        }
598
598
}
599
599
 
600
 
READ16_HANDLER( tx1_math_r )
 
600
READ16_MEMBER(tx1_state::tx1_math_r)
601
601
{
602
 
        tx1_state *state = space->machine().driver_data<tx1_state>();
603
 
        math_t &math = state->m_math;
 
602
        math_t &math = m_math;
604
603
        offset = offset << 1;
605
604
 
606
605
        /* /MLPCS */
619
618
                }
620
619
 
621
620
                /* TODO What do we return? */
622
 
                kick_sn74s516(space->machine(), &math.retval, ins);
 
621
                kick_sn74s516(machine(), &math.retval, ins);
623
622
        }
624
623
        /* /PPSEN */
625
624
        else if (offset < 0x800)
657
656
                TODO make this constant somewhere
658
657
                e.g. math.retval =  math.romptr[ get_tx1_datarom_addr() ];
659
658
            */
660
 
                        UINT16 *romdata = (UINT16*)space->machine().region("au_data")->base();
 
659
                        UINT16 *romdata = (UINT16*)machine().root_device().memregion("au_data")->base();
661
660
                        UINT16 addr = get_tx1_datarom_addr(math);
662
661
                        math.retval = romdata[addr];
663
662
                }
684
683
                        if (math.mux != TX1_SEL_ILDEN)
685
684
                        {
686
685
                                INC_PROM_ADDR;
687
 
                                tx1_update_state(space->machine());
 
686
                                tx1_update_state(machine());
688
687
 
689
688
                                // MUST RETURN HERE?
690
689
                                return math.retval;
703
702
        if (offset & TX1_INSLD)
704
703
        {
705
704
                math.promaddr = (offset << 2) & 0x1ff;
706
 
                tx1_update_state(space->machine());
 
705
                tx1_update_state(machine());
707
706
        }
708
707
        else if (offset & TX1_CNTST)
709
708
        {
710
709
                INC_PROM_ADDR;
711
 
                tx1_update_state(space->machine());
 
710
                tx1_update_state(machine());
712
711
        }
713
712
 
714
713
        return math.retval;
715
714
}
716
715
 
717
 
WRITE16_HANDLER( tx1_math_w )
 
716
WRITE16_MEMBER(tx1_state::tx1_math_w)
718
717
{
719
 
        tx1_state *state = space->machine().driver_data<tx1_state>();
720
 
        math_t &math = state->m_math;
 
718
        math_t &math = m_math;
721
719
        math.cpulatch = data;
722
720
        offset <<= 1;
723
721
 
738
736
                        ins = (offset >> 1) & 7;
739
737
                }
740
738
 
741
 
                kick_sn74s516(space->machine(), &math.cpulatch, ins);
 
739
                kick_sn74s516(machine(), &math.cpulatch, ins);
742
740
        }
743
741
        /* /PPSEN */
744
742
        else if ((offset & 0xc00) == 0x400)
794
792
        if (offset & TX1_INSLD)
795
793
        {
796
794
                math.promaddr = (offset << 2) & 0x1ff;
797
 
                tx1_update_state(space->machine());
 
795
                tx1_update_state(machine());
798
796
        }
799
797
        else if (offset & TX1_CNTST)
800
798
        {
801
799
                INC_PROM_ADDR;
802
 
                tx1_update_state(space->machine());
 
800
                tx1_update_state(machine());
803
801
        }
804
802
}
805
803
 
806
 
READ16_HANDLER( tx1_spcs_rom_r )
 
804
READ16_MEMBER(tx1_state::tx1_spcs_rom_r)
807
805
{
808
 
        tx1_state *state = space->machine().driver_data<tx1_state>();
809
 
        math_t &math = state->m_math;
810
 
        math.cpulatch = *(UINT16*)((UINT8*)space->machine().region("math_cpu")->base() + 0xfc000 + 0x1000 + offset*2);
 
806
        math_t &math = m_math;
 
807
        math.cpulatch = *(UINT16*)((UINT8*)machine().root_device().memregion("math_cpu")->base() + 0xfc000 + 0x1000 + offset*2);
811
808
 
812
809
        if (math.mux == TX1_SEL_ILDEN)
813
810
        {
818
815
                int ins = math.inslatch & 7;
819
816
 
820
817
                TX1_SET_INS0_BIT;
821
 
                kick_sn74s516(space->machine(), &math.cpulatch, ins);
 
818
                kick_sn74s516(machine(), &math.cpulatch, ins);
822
819
        }
823
820
        else if (math.mux == TX1_SEL_PPSEN)
824
821
        {
860
857
        if (math.mux != TX1_SEL_ILDEN)
861
858
        {
862
859
                INC_PROM_ADDR;
863
 
                tx1_update_state(space->machine());
 
860
                tx1_update_state(machine());
864
861
        }
865
862
 
866
863
        return math.cpulatch;
867
864
 
868
865
}
869
866
 
870
 
READ16_HANDLER( tx1_spcs_ram_r )
 
867
READ16_MEMBER(tx1_state::tx1_spcs_ram_r)
871
868
{
872
 
        tx1_state *state = space->machine().driver_data<tx1_state>();
873
 
        math_t &math = state->m_math;
874
 
        math.cpulatch = state->m_math_ram[offset];
 
869
        math_t &math = m_math;
 
870
        math.cpulatch = m_math_ram[offset];
875
871
 
876
872
        offset <<= 1;
877
873
 
884
880
                int ins = math.inslatch & 7;
885
881
 
886
882
                TX1_SET_INS0_BIT;
887
 
                kick_sn74s516(space->machine(), &math.cpulatch, ins);
 
883
                kick_sn74s516(machine(), &math.cpulatch, ins);
888
884
        }
889
885
        else if (math.mux == TX1_SEL_PPSEN)
890
886
        {
924
920
        if (math.mux != TX1_SEL_ILDEN)
925
921
        {
926
922
                INC_PROM_ADDR;
927
 
                tx1_update_state(space->machine());
 
923
                tx1_update_state(machine());
928
924
        }
929
925
 
930
926
        return math.cpulatch;
931
927
}
932
928
 
933
929
/* Should never occur */
934
 
WRITE16_HANDLER( tx1_spcs_ram_w )
 
930
WRITE16_MEMBER(tx1_state::tx1_spcs_ram_w)
935
931
{
936
 
        tx1_state *state = space->machine().driver_data<tx1_state>();
937
932
        mame_printf_debug("Write to /SPCS RAM?");
938
 
        COMBINE_DATA(&state->m_math_ram[offset]);
 
933
        COMBINE_DATA(&m_math_ram[offset]);
939
934
}
940
935
 
941
936
 
989
984
 
990
985
        tx1_state *state = machine.driver_data<tx1_state>();
991
986
        math_t &math = state->m_math;
992
 
        const UINT16 *prom = (UINT16*)machine.region("au_data")->base() + (0x8000 >> 1);
 
987
        const UINT16 *prom = (UINT16*)state->memregion("au_data")->base() + (0x8000 >> 1);
993
988
 
994
989
        for (;;)
995
990
        {
1022
1017
 
1023
1018
                        if (math.mux == BB_MUX_DPROE)
1024
1019
                        {
1025
 
                                UINT16 *romdata = (UINT16*)machine.region("au_data")->base();
 
1020
                                UINT16 *romdata = (UINT16*)machine.root_device().memregion("au_data")->base();
1026
1021
                                UINT16 addr = get_bb_datarom_addr(math);
1027
1022
                                kick_sn74s516(machine, &romdata[addr], ins);
1028
1023
                        }
1103
1098
        }
1104
1099
}
1105
1100
 
1106
 
READ16_HANDLER( buggyboy_math_r )
 
1101
READ16_MEMBER(tx1_state::buggyboy_math_r)
1107
1102
{
1108
 
        tx1_state *state = space->machine().driver_data<tx1_state>();
1109
 
        math_t &math = state->m_math;
 
1103
        math_t &math = m_math;
1110
1104
        offset = offset << 1;
1111
1105
 
1112
1106
        /* /MLPCS */
1125
1119
                }
1126
1120
 
1127
1121
                /* TODO What do we return? */
1128
 
                kick_sn74s516(space->machine(), &math.retval, ins);
 
1122
                kick_sn74s516(machine(), &math.retval, ins);
1129
1123
 
1130
1124
                /* TODO */
1131
1125
                //if (math.mux == BB_MUX_PPSEN)
1139
1133
        /* /DPROE */
1140
1134
        else if ((offset & 0xc00) == 0xc00)
1141
1135
        {
1142
 
                UINT16 *romdata = (UINT16*)space->machine().region("au_data")->base();
 
1136
                UINT16 *romdata = (UINT16*)machine().root_device().memregion("au_data")->base();
1143
1137
                UINT16 addr = get_bb_datarom_addr(math);
1144
1138
 
1145
1139
                math.retval = romdata[addr];
1154
1148
                        if (math.mux != BB_MUX_ILDEN)
1155
1149
                        {
1156
1150
                                INC_PROM_ADDR;
1157
 
                                buggyboy_update_state(space->machine());
 
1151
                                buggyboy_update_state(machine());
1158
1152
                        }
1159
1153
                }
1160
1154
        }
1170
1164
        if (offset & BB_INSLD)
1171
1165
        {
1172
1166
                math.promaddr = (offset << 2) & 0x1ff;
1173
 
                buggyboy_update_state(space->machine());
 
1167
                buggyboy_update_state(machine());
1174
1168
        }
1175
1169
        else if (offset & BB_CNTST)
1176
1170
        {
1177
1171
                INC_PROM_ADDR;
1178
 
                buggyboy_update_state(space->machine());
 
1172
                buggyboy_update_state(machine());
1179
1173
        }
1180
1174
 
1181
1175
        return math.retval;
1182
1176
}
1183
1177
 
1184
 
WRITE16_HANDLER( buggyboy_math_w )
 
1178
WRITE16_MEMBER(tx1_state::buggyboy_math_w)
1185
1179
{
1186
 
        tx1_state *state = space->machine().driver_data<tx1_state>();
1187
 
        math_t &math = state->m_math;
 
1180
        math_t &math = m_math;
1188
1181
        math.cpulatch = data;
1189
1182
 
1190
1183
        offset <<= 1;
1204
1197
                        ins = (offset >> 1) & 7;
1205
1198
                }
1206
1199
 
1207
 
                kick_sn74s516(space->machine(), &math.cpulatch, ins);
 
1200
                kick_sn74s516(machine(), &math.cpulatch, ins);
1208
1201
        }
1209
1202
        /* /PPSEN */
1210
1203
        else if ((offset & 0xc00) == 0x400)
1246
1239
                else
1247
1240
                {
1248
1241
                        mame_printf_debug("BB_DSEL was not 3 for P->S load!\n");
1249
 
                        debugger_break(space->machine());
 
1242
                        debugger_break(machine());
1250
1243
                }
1251
1244
        }
1252
1245
        else
1253
1246
        {
1254
1247
                mame_printf_debug("Buggy Boy unknown math state!\n");
1255
 
                debugger_break(space->machine());
 
1248
                debugger_break(machine());
1256
1249
        }
1257
1250
 
1258
1251
        if (offset & BB_INSLD)
1259
1252
        {
1260
1253
                math.promaddr = (offset << 2) & 0x1ff;
1261
 
                buggyboy_update_state(space->machine());
 
1254
                buggyboy_update_state(machine());
1262
1255
        }
1263
1256
        else if (offset & BB_CNTST)
1264
1257
        {
1265
1258
                INC_PROM_ADDR;
1266
 
                buggyboy_update_state(space->machine());
 
1259
                buggyboy_update_state(machine());
1267
1260
        }
1268
1261
}
1269
1262
 
1270
1263
/*
1271
1264
    This is for ROM range 0x5000-0x7fff
1272
1265
*/
1273
 
READ16_HANDLER( buggyboy_spcs_rom_r )
 
1266
READ16_MEMBER(tx1_state::buggyboy_spcs_rom_r)
1274
1267
{
1275
 
        tx1_state *state = space->machine().driver_data<tx1_state>();
1276
 
        math_t &math = state->m_math;
1277
 
        math.cpulatch = *(UINT16*)((UINT8*)space->machine().region("math_cpu")->base() + 0xfc000 + 0x1000 + offset*2);
 
1268
        math_t &math = m_math;
 
1269
        math.cpulatch = *(UINT16*)((UINT8*)machine().root_device().memregion("math_cpu")->base() + 0xfc000 + 0x1000 + offset*2);
1278
1270
 
1279
1271
        if (math.mux == BB_MUX_ILDEN)
1280
1272
        {
1285
1277
                int ins = math.inslatch & 7;
1286
1278
 
1287
1279
                BB_SET_INS0_BIT;
1288
 
                kick_sn74s516(space->machine(), &math.cpulatch, ins);
 
1280
                kick_sn74s516(machine(), &math.cpulatch, ins);
1289
1281
        }
1290
1282
        else if (math.mux == BB_MUX_PPSEN)
1291
1283
        {
1327
1319
        if (math.mux != BB_MUX_ILDEN)
1328
1320
        {
1329
1321
                INC_PROM_ADDR;
1330
 
                buggyboy_update_state(space->machine());
 
1322
                buggyboy_update_state(machine());
1331
1323
        }
1332
1324
 
1333
1325
        return math.cpulatch;
1334
1326
}
1335
1327
 
1336
 
WRITE16_HANDLER( buggyboy_spcs_ram_w )
 
1328
WRITE16_MEMBER(tx1_state::buggyboy_spcs_ram_w)
1337
1329
{
1338
 
        tx1_state *state = space->machine().driver_data<tx1_state>();
1339
 
        COMBINE_DATA(&state->m_math_ram[offset]);
 
1330
        COMBINE_DATA(&m_math_ram[offset]);
1340
1331
}
1341
1332
 
1342
 
READ16_HANDLER( buggyboy_spcs_ram_r )
 
1333
READ16_MEMBER(tx1_state::buggyboy_spcs_ram_r)
1343
1334
{
1344
 
        tx1_state *state = space->machine().driver_data<tx1_state>();
1345
 
        math_t &math = state->m_math;
1346
 
        math.cpulatch = state->m_math_ram[offset];
 
1335
        math_t &math = m_math;
 
1336
        math.cpulatch = m_math_ram[offset];
1347
1337
 
1348
1338
        offset <<= 1;
1349
1339
 
1356
1346
                int ins = math.inslatch & 7;
1357
1347
 
1358
1348
                BB_SET_INS0_BIT;
1359
 
                kick_sn74s516(space->machine(), &math.cpulatch, ins);
 
1349
                kick_sn74s516(machine(), &math.cpulatch, ins);
1360
1350
        }
1361
1351
        else if (math.mux == BB_MUX_PPSEN)
1362
1352
        {
1398
1388
        if (math.mux != BB_MUX_ILDEN)
1399
1389
        {
1400
1390
                INC_PROM_ADDR;
1401
 
                buggyboy_update_state(space->machine());
 
1391
                buggyboy_update_state(machine());
1402
1392
        }
1403
1393
 
1404
1394
        return math.cpulatch;