Skip to content
This repository was archived by the owner on Sep 18, 2021. It is now read-only.

Commit 619188f

Browse files
author
mizapf
committed
ti99: Fixed logging (no whatsnew)
1 parent 6a8ebaa commit 619188f

File tree

3 files changed

+38
-57
lines changed

3 files changed

+38
-57
lines changed

src/mess/machine/smc92x4.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1605,7 +1605,7 @@ static void format_floppy_track(device_t *device, int flags)
16051605
buffer[index++] = curr_sect;
16061606
buffer[index++] = curr_size;
16071607

1608-
if (j==0)
1608+
if (j==0)
16091609
if (VERBOSE>6) LOG("current_floppy=%s, format track %d, head %d\n", current_floppy->tag(), curr_cyl, curr_head);
16101610

16111611
/* Calculate CRC16 (5 bytes for ID) */

src/mess/machine/ti99/gromport.c

+26-48
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ typedef UINT8 (*read8z_device_func) (ATTR_UNUSED device_t *device, ATTR_UNUSED
1616
the first 16 banks. */
1717
#define NUMBER_OF_CARTRIDGE_SLOTS 8
1818

19+
#define VERBOSE 2
20+
#define LOG logerror
21+
1922
typedef int assmfct(device_t *);
2023

2124
DECLARE_LEGACY_CART_SLOT_DEVICE(TI99_CARTRIDGE_PCB_NONE, ti99_cartridge_pcb_none);
@@ -113,15 +116,6 @@ typedef struct _ti99_multicart_state
113116
int gk_slot;
114117
int gk_guest_slot;
115118

116-
/* Legacy support. */
117-
// Counts the number of slots which currently contain legacy format
118-
// cartridge images.
119-
int legacy_slots;
120-
121-
// Counts the number of slots which currently contain new format
122-
// cartridge images.
123-
int multi_slots;
124-
125119
/* Used to cache the switch settings. */
126120
UINT8 gk_switch[8];
127121

@@ -223,19 +217,14 @@ static int get_gk_switch(device_t *cartsys, int number)
223217
return cartslots->gk_switch[number];
224218
}
225219

226-
static int in_legacy_mode(device_t *device)
227-
{
228-
ti99_multicart_state *cartslots = get_safe_token(device);
229-
return ((cartslots->legacy_slots>0) && (cartslots->multi_slots==0));
230-
}
231-
232220
/*
233221
Activates a slot in the multi-cartridge extender.
234222
*/
235223
static void cartridge_slot_set(device_t *cartsys, UINT8 slotnumber)
236224
{
237225
ti99_multicart_state *cartslots = get_safe_token(cartsys);
238-
// if (cartslots->active_slot != slotnumber) printf("Setting cartslot to %d\n", slotnumber);
226+
if (VERBOSE>2)
227+
if (cartslots->active_slot != slotnumber) LOG("ti99: gromport: Setting cartslot to %d\n", slotnumber);
239228
if (cartslots->fixed_slot==AUTO)
240229
cartslots->active_slot = slotnumber;
241230
else
@@ -302,6 +291,8 @@ static cartridge_t *assemble_common(device_t *cartslot)
302291
int slotnumber = get_index_from_tagname(cartslot)-1;
303292
assert(slotnumber>=0 && slotnumber<NUMBER_OF_CARTRIDGE_SLOTS);
304293

294+
if (VERBOSE>1) LOG("ti99: gromport: mounting cartridge in slot %d\n", slotnumber);
295+
305296
/* There is a cartridge in this slot, check the maximum slot number. */
306297
if (cartslots->next_free_slot <= slotnumber)
307298
{
@@ -326,7 +317,6 @@ static cartridge_t *assemble_common(device_t *cartslot)
326317
{
327318
cartridge->rom_ptr = (UINT8 *)socketcont;
328319
cartridge->rom_size = reslength;
329-
// printf("set rom ptr = %lx, romlength = %04x, data = %02x %02x\n", cartridge->rom_ptr, cartridge->rom_size, cartridge->rom_ptr[0], cartridge->rom_ptr[1]);
330320
}
331321

332322
socketcont = cartslot_get_socket(cartslot, "rom2_socket");
@@ -376,8 +366,7 @@ static void set_pointers(device_t *pcb, int index)
376366

377367
/*****************************************************************************
378368
Cartridge type: None
379-
This PCB device is just a pseudo device; the legacy mode is handled
380-
by dedicated functions.
369+
This PCB device is just a pseudo device
381370
******************************************************************************/
382371
static DEVICE_START(ti99_pcb_none)
383372
{
@@ -416,7 +405,7 @@ static READ8Z_DEVICE_HANDLER( read_cart_std )
416405

417406
static WRITE8_DEVICE_HANDLER( write_cart_std )
418407
{
419-
logerror("Write access to cartridge ROM at address %04x ignored\n", offset);
408+
if (VERBOSE>1) LOG("ti99: gromport: Write access to cartridge ROM at address %04x ignored\n", offset);
420409
}
421410

422411
/*
@@ -529,12 +518,12 @@ static int assemble_paged(device_t *image)
529518
cart = assemble_common(image);
530519
if (cart->rom_ptr==NULL)
531520
{
532-
logerror("Missing ROM for paged cartridge");
521+
if (VERBOSE>1) LOG("ti99: gromport: Missing ROM for paged cartridge");
533522
return IMAGE_INIT_FAIL;
534523
}
535524
if (cart->rom2_ptr==NULL)
536525
{
537-
logerror("Missing second ROM for paged cartridge");
526+
if (VERBOSE>1) LOG("ti99: gromport: Missing second ROM for paged cartridge");
538527
return IMAGE_INIT_FAIL;
539528
}
540529

@@ -579,13 +568,13 @@ static WRITE8_DEVICE_HANDLER( write_cart_minimem )
579568

580569
if ((offset & 0x1000)==0x0000)
581570
{
582-
logerror("Write access to cartridge ROM at address %04x ignored", offset);
571+
if (VERBOSE>1) LOG("ti99: gromport: Write access to cartridge ROM at address %04x ignored", offset);
583572
}
584573
else
585574
{
586575
if (cartridge->ram_ptr==NULL)
587576
{
588-
logerror("No cartridge RAM at address %04x", offset);
577+
if (VERBOSE>1) LOG("ti99: gromport: No cartridge RAM at address %04x", offset);
589578
/* TODO: Check for consistency with the GROM memory handling. */
590579
}
591580
else
@@ -602,19 +591,19 @@ static int assemble_minimem(device_t *image)
602591
cart = assemble_common(image);
603592
if (cart->grom_size==0)
604593
{
605-
logerror("Missing GROM for Mini Memory");
594+
if (VERBOSE>1) LOG("ti99: gromport: Missing GROM for Mini Memory");
606595
// should not fail here because there may be variations of
607596
// cartridges which do not use all parts
608597
// return IMAGE_INIT_FAIL;
609598
}
610599
if (cart->rom_size==0)
611600
{
612-
logerror("Missing ROM for Mini Memory");
601+
if (VERBOSE>1) LOG("ti99: gromport: Missing ROM for Mini Memory");
613602
// return IMAGE_INIT_FAIL;
614603
}
615604
if (cart->ram_size==0)
616605
{
617-
logerror("Missing RAM for Mini Memory");
606+
if (VERBOSE>1) LOG("ti99: gromport: Missing RAM for Mini Memory");
618607
// return IMAGE_INIT_FAIL;
619608
}
620609

@@ -674,7 +663,7 @@ static READ8Z_DEVICE_HANDLER( read_cart_cru )
674663
// BNKS1 LDCR R1,0 Switch Banks
675664
// SRL R0,1 Restore Bank Number (optional)
676665
// RT
677-
logerror("Superspace: CRU accessed at %04x\n", offset);
666+
if (VERBOSE>1) LOG("ti99: gromport: Superspace: CRU accessed at %04x\n", offset);
678667
if ((offset & 1) == 0 || offset > 7)
679668
*value = 0;
680669

@@ -689,7 +678,7 @@ static WRITE8_DEVICE_HANDLER( write_cart_cru )
689678
cartridge_t *cartridge = pcb->cartridge;
690679
// data is bit
691680
// offset is address
692-
logerror("Superspace: CRU accessed at %04x\n", offset);
681+
if (VERBOSE>1) LOG("ti99: gromport: Superspace: CRU accessed at %04x\n", offset);
693682
if (offset < 8)
694683
{
695684
if (data != 0)
@@ -731,7 +720,7 @@ static WRITE8_DEVICE_HANDLER( write_cart_super )
731720

732721
if (cartridge->ram_ptr==NULL)
733722
{
734-
logerror("No cartridge RAM at address %04x", offset);
723+
if (VERBOSE>1) LOG("ti99: gromport: No cartridge RAM at address %04x", offset);
735724
}
736725
else
737726
{
@@ -747,7 +736,7 @@ static int assemble_super(device_t *image)
747736
cart = assemble_common(image);
748737
if (cart->ram_size==0)
749738
{
750-
logerror("Missing RAM for SuperSpace");
739+
if (VERBOSE>1) LOG("ti99: gromport: Missing RAM for SuperSpace");
751740
return IMAGE_INIT_FAIL;
752741
}
753742
return IMAGE_INIT_PASS;
@@ -925,7 +914,7 @@ static int assemble_paged379i(device_t *image)
925914
cart = assemble_common(image);
926915
if (cart->rom_ptr==NULL)
927916
{
928-
logerror("Missing ROM for paged cartridge");
917+
if (VERBOSE>1) LOG("ti99: gromport: Missing ROM for paged cartridge");
929918
return IMAGE_INIT_FAIL;
930919
}
931920
set_paged379i_bank(cart, 15);
@@ -1032,7 +1021,7 @@ static int assemble_pagedcru(device_t *image)
10321021
cart = assemble_common(image);
10331022
if (cart->rom_ptr==NULL)
10341023
{
1035-
logerror("Missing ROM for pagedcru cartridge");
1024+
if (VERBOSE>1) LOG("ti99: gromport: Missing ROM for pagedcru cartridge");
10361025
return IMAGE_INIT_FAIL;
10371026
}
10381027
cart->rom_page = 0;
@@ -1065,13 +1054,13 @@ static int assemble_gramkracker(device_t *image)
10651054

10661055
if (cart->grom_ptr==NULL)
10671056
{
1068-
logerror("Missing loader GROM for GRAM Kracker system");
1057+
if (VERBOSE>1) LOG("ti99: gromport: Missing loader GROM for GRAM Kracker system");
10691058
return IMAGE_INIT_FAIL;
10701059
}
10711060

10721061
if (cart->ram_size < 81920)
10731062
{
1074-
logerror("Missing or insufficient RAM for GRAM Kracker system");
1063+
if (VERBOSE>1) LOG("ti99: gromport: Missing or insufficient RAM for GRAM Kracker system");
10751064
return IMAGE_INIT_FAIL;
10761065
}
10771066

@@ -1482,7 +1471,7 @@ static DEVICE_IMAGE_LOAD( ti99_cartridge )
14821471
// otherwise one cannot make use of multicart handling within such a
14831472
// custom LOAD function.
14841473
multicart_open_error me = multicart_open(image.device().machine().options(), image.filename(), image.device().machine().system().name, MULTICART_FLAGS_LOAD_RESOURCES, &cart->mc);
1485-
1474+
if (VERBOSE>1) LOG("ti99: gromport: opened %s as cartridge\n", image.filename());
14861475
// Now that we have loaded the image files, let the PCB put them all
14871476
// together. This means we put the images in a structure which allows
14881477
// for a quick access by the memory handlers. Every PCB defines an
@@ -2027,11 +2016,6 @@ static READ8Z_DEVICE_HANDLER( ti99_cart_gk_rz )
20272016
if (cartslots->gk_guest_slot != -1)
20282017
{
20292018
gkguestcart = &cartslots->cartridge[cartslots->gk_guest_slot];
2030-
// Legacy mode is not supported with the GK
2031-
if (in_legacy_mode(device))
2032-
{
2033-
return;
2034-
}
20352019
// printf("accessing cartridge in slot %d\n", slot);
20362020
ti99_pcb_t *pcbdef = get_safe_pcb_token(gkguestcart->pcb);
20372021
// printf("address=%lx, offset=%lx\n", pcbdef, offset);
@@ -2082,12 +2066,6 @@ static WRITE8_DEVICE_HANDLER( ti99_cart_gk_w )
20822066
if (cartslots->gk_guest_slot != -1)
20832067
{
20842068
gkguestcart = &cartslots->cartridge[cartslots->gk_guest_slot];
2085-
// Legacy mode is not supported with the GK
2086-
if (in_legacy_mode(device))
2087-
{
2088-
return;
2089-
}
2090-
20912069
ti99_pcb_t *pcbdef = get_safe_pcb_token(gkguestcart->pcb);
20922070
(*pcbdef->write)(gkguestcart->pcb, offset, data);
20932071
}
@@ -2152,7 +2130,7 @@ static WRITE8_DEVICE_HANDLER( ti99_cart_cru_gk_w )
21522130

21532131
/*****************************************************************************/
21542132
#define TI99_CARTRIDGE_SLOT(p) MCFG_MULTICARTSLOT_ADD(p) \
2155-
MCFG_MULTICARTSLOT_EXTENSION_LIST("rpk,bin") \
2133+
MCFG_MULTICARTSLOT_EXTENSION_LIST("rpk") \
21562134
MCFG_MULTICARTSLOT_PCBTYPE(0, "none", TI99_CARTRIDGE_PCB_NONE) \
21572135
MCFG_MULTICARTSLOT_PCBTYPE(1, "standard", TI99_CARTRIDGE_PCB_STD) \
21582136
MCFG_MULTICARTSLOT_PCBTYPE(2, "paged", TI99_CARTRIDGE_PCB_PAGED) \

src/mess/machine/ti99/hfdc.c

+11-8
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@
2525
#define CLK_ADDR 0x0fe0
2626
#define RAM_ADDR 0x1000
2727

28+
#define VERBOSE 1
29+
#define LOG logerror
30+
2831
typedef ti99_pebcard_config ti99_hfdc_config;
2932

3033
typedef struct _ti99_hfdc_state
@@ -115,7 +118,7 @@ static void set_geometry(device_t *drive, floppy_type_t type)
115118
if (drive!=NULL)
116119
floppy_drive_set_geometry(drive, type);
117120
else
118-
logerror("ti99/HFDC: Drive not found\n");
121+
if (VERBOSE>0) LOG("ti99: HFDC: Drive not found\n");
119122
}
120123

121124
static void set_all_geometries(device_t *device, floppy_type_t type)
@@ -261,7 +264,7 @@ static WRITE8_DEVICE_HANDLER( cru_w )
261264
break;
262265

263266
default:
264-
logerror("ti99/HFDC: Attempt to set undefined CRU bit %d\n", bit);
267+
if (VERBOSE>1) LOG("ti99: HFDC: Attempt to set undefined CRU bit %d\n", bit);
265268
}
266269
}
267270
}
@@ -296,7 +299,7 @@ static READ8Z_DEVICE_HANDLER( data_r )
296299
// Tape: 4fc0...4fcf
297300
if ((offset & 0x1ff0)==TAPE_ADDR)
298301
{
299-
logerror("ti99/HFDC: Tape support not available (access to address %04x)\n", offset);
302+
if (VERBOSE>0) LOG("ti99: HFDC: Tape support not available (access to address %04x)\n", offset);
300303
return;
301304
}
302305

@@ -346,7 +349,7 @@ static WRITE8_DEVICE_HANDLER( data_w )
346349
// Tape: 4fc0...4fcf
347350
if ((offset & 0x1ff0)==TAPE_ADDR)
348351
{
349-
logerror("ti99/HFDC: Tape support not available (access to address %04x)\n", offset);
352+
if (VERBOSE>0) LOG("ti99: HFDC: Tape support not available (access to address %04x)\n", offset);
350353
return;
351354
}
352355

@@ -408,7 +411,7 @@ static WRITE8_DEVICE_HANDLER( auxbus_out )
408411
switch (offset)
409412
{
410413
case INPUT_STATUS:
411-
logerror("ti99/HFDC: Invalid operation: S0=S1=0, but tried to write (expected: read drive status)\n");
414+
if (VERBOSE>1) LOG("ti99: HFDC: Invalid operation: S0=S1=0, but tried to write (expected: read drive status)\n");
412415
break;
413416

414417
case OUTPUT_DMA_ADDR:
@@ -462,7 +465,7 @@ static device_t *current_floppy(device_t *controller)
462465

463466
if (disk_unit<0)
464467
{
465-
logerror("No unit selected\n");
468+
if (VERBOSE>1) LOG("ti99: HFDC: No unit selected\n");
466469
return NULL;
467470
}
468471

@@ -688,7 +691,7 @@ static DEVICE_RESET( ti99_hfdc )
688691
if (input_port_read(device->machine(), "MODE")==GENMOD)
689692
{
690693
// GenMod card modification
691-
logerror("HFDC: Configuring for GenMod\n");
694+
if (VERBOSE>0) LOG("ti99: HFDC: Configuring for GenMod\n");
692695
card->select_mask = 0x1fe000;
693696
card->select_value = 0x174000;
694697
}
@@ -723,7 +726,7 @@ static DEVICE_RESET( ti99_hfdc )
723726
}
724727
else
725728
{
726-
logerror("hfdc: Image %s is null\n", flopname[i]);
729+
if (VERBOSE>0) LOG("ti99: HFDC: Image %s is null\n", flopname[i]);
727730
}
728731
}
729732

0 commit comments

Comments
 (0)