util/cdrom.cpp: Disable debug log message when parsing TOC.

Also some miscellaneous cleanup/consistency.
This commit is contained in:
Vas Crabb 2021-04-24 23:53:04 +10:00
parent 77462451e7
commit 4e6cea2f8f
3 changed files with 59 additions and 61 deletions

View file

@ -455,9 +455,7 @@ inline void upd7220_device::reset_figs_param()
//-------------------------------------------------
inline uint16_t upd7220_device::read_vram()
{
uint16_t data;
data = readword(m_ead*2);
uint16_t const data = readword(m_ead*2);
m_ead += x_dir[m_figs.m_dir] + (y_dir[m_figs.m_dir] * m_pitch);
m_ead &= 0x3ffff;
@ -477,8 +475,7 @@ inline void upd7220_device::rdat(uint8_t type, uint8_t mod)
while (m_figs.m_dc && m_fifo_ptr < (type ? 15 : 14))
{
uint16_t data;
data = read_vram();
uint16_t const data = read_vram();
switch(type)
{
case 0:
@ -547,17 +544,13 @@ inline void upd7220_device::write_vram(uint8_t type, uint8_t mod, uint16_t data)
inline void upd7220_device::wdat(uint8_t type, uint8_t mod)
{
uint16_t result;
if (type == 1)
if(type == 1)
{
logerror("uPD7220 invalid type 1 WDAT parameter\n");
return;
}
result = 0;
result = m_pr[1] | (m_pr[2] << 8);
uint16_t result = m_pr[1] | (m_pr[2] << 8);
switch(type)
{
@ -953,7 +946,6 @@ void upd7220_device::draw_arc(int x, int y)
void upd7220_device::draw_rectangle(int x, int y)
{
int i;
const int rect_x_dir[8] = { 0, 1, 0,-1, 1, 1,-1,-1 };
const int rect_y_dir[8] = { 1, 0,-1, 0, 1,-1,-1, 1 };
uint8_t rect_type,rect_dir;
@ -964,7 +956,7 @@ void upd7220_device::draw_rectangle(int x, int y)
rect_type = (m_figs.m_dir & 1) << 2;
rect_dir = rect_type | (((m_figs.m_dir >> 1) + 0) & 3);
for(i = 0;i < m_figs.m_d;i++)
for(int i = 0; i < m_figs.m_d; i++)
{
draw_pixel(x,y,i,pattern);
x+=rect_x_dir[rect_dir];
@ -973,7 +965,7 @@ void upd7220_device::draw_rectangle(int x, int y)
rect_dir = rect_type | (((m_figs.m_dir >> 1) + 1) & 3);
for(i = 0;i < m_figs.m_d2;i++)
for(int i = 0; i < m_figs.m_d2; i++)
{
draw_pixel(x,y,i,pattern);
x+=rect_x_dir[rect_dir];
@ -982,7 +974,7 @@ void upd7220_device::draw_rectangle(int x, int y)
rect_dir = rect_type | (((m_figs.m_dir >> 1) + 2) & 3);
for(i = 0;i < m_figs.m_d;i++)
for(int i = 0; i < m_figs.m_d; i++)
{
draw_pixel(x,y,i,pattern);
x+=rect_x_dir[rect_dir];
@ -991,7 +983,7 @@ void upd7220_device::draw_rectangle(int x, int y)
rect_dir = rect_type | (((m_figs.m_dir >> 1) + 3) & 3);
for(i = 0;i < m_figs.m_d2;i++)
for(int i = 0; i < m_figs.m_d2; i++)
{
draw_pixel(x,y,i,pattern);
x+=rect_x_dir[rect_dir];
@ -1000,7 +992,6 @@ void upd7220_device::draw_rectangle(int x, int y)
m_ead = (x >> 4) + (y * (m_pitch >> m_figs.m_gd));
m_dad = x & 0x0f;
}
@ -1679,18 +1670,19 @@ WRITE_LINE_MEMBER( upd7220_device::lpen_w )
void upd7220_device::update_text(bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
uint32_t addr, sad;
uint32_t sad;
uint16_t len;
int im, wd;
int y, sy = 0;
int sy = 0;
for (int area = 0; area < 4; area++)
{
get_text_partition(area, &sad, &len, &im, &wd);
int y;
for (y = sy; y < sy + len; y++)
{
addr = sad + (y * m_pitch);
uint32_t const addr = sad + (y * m_pitch);
if (!m_draw_text_cb.isnull())
m_draw_text_cb(bitmap, addr, (y * m_lr) + m_vbp, wd, m_pitch, m_lr, m_dc, m_ead);
@ -1707,9 +1699,9 @@ void upd7220_device::update_text(bitmap_rgb32 &bitmap, const rectangle &cliprect
void upd7220_device::draw_graphics_line(bitmap_rgb32 &bitmap, uint32_t addr, int y, int wd, int pitch)
{
int sx, al = bitmap.cliprect().height();
int al = bitmap.cliprect().height();
for (sx = 0; sx < pitch; sx++)
for (int sx = 0; sx < pitch; sx++)
{
if((sx << 4) < m_aw * 16 && y < al)
m_display_cb(bitmap, y, sx << 4, addr);
@ -1725,18 +1717,18 @@ void upd7220_device::draw_graphics_line(bitmap_rgb32 &bitmap, uint32_t addr, int
void upd7220_device::update_graphics(bitmap_rgb32 &bitmap, const rectangle &cliprect, int force_bitmap)
{
uint32_t addr, sad;
uint32_t sad;
uint16_t len;
int im, wd, area;
int im, wd;
int y = 0, tsy = 0, bsy = 0;
bool mixed = ((m_mode & UPD7220_MODE_DISPLAY_MASK) == UPD7220_MODE_DISPLAY_MIXED);
uint8_t interlace = ((m_mode & UPD7220_MODE_INTERLACE_MASK) == UPD7220_MODE_INTERLACE_ON) ? 0 : 1;
for (area = 0; area < 4; area++)
for(int area = 0; area < 4; area++)
{
get_graphics_partition(area, &sad, &len, &im, &wd);
if (im || force_bitmap)
if(im || force_bitmap)
{
if(area >= 3) // TODO: most likely to be correct, Quarth (PC-98xx) definitely draws with area 2. We might see an area 3 someday ...
break;
@ -1744,13 +1736,13 @@ void upd7220_device::update_graphics(bitmap_rgb32 &bitmap, const rectangle &clip
if(!interlace)
len <<= 1;
for (y = 0; y < len; y++)
for(y = 0; y < len; y++)
{
/* TODO: again correct?
Quarth (PC-98xx) doesn't seem to use pitch here and it definitely wants bsy to be /2 to make scrolling to work.
Xevious (PC-98xx) wants the pitch to be fixed at 80, and wants bsy to be /1
Dragon Buster (PC-98xx) contradicts with Xevious with regards of the pitch tho ... */
addr = ((sad << 1) & 0x3ffff) + ((y / (mixed ? 1 : m_lr)) * (m_pitch << (im ? 0 : 1)));
uint32_t const addr = ((sad << 1) & 0x3ffff) + ((y / (mixed ? 1 : m_lr)) * (m_pitch << (im ? 0 : 1)));
if (!m_display_cb.isnull())
draw_graphics_line(bitmap, addr, y + bsy + m_vbp, wd, (m_pitch << interlace));
@ -1760,11 +1752,11 @@ void upd7220_device::update_graphics(bitmap_rgb32 &bitmap, const rectangle &clip
{
if(m_lr)
{
for (y = 0; y < len; y+=m_lr)
for(y = 0; y < len; y += m_lr)
{
addr = (sad & 0x3ffff) + ((y / m_lr) * m_pitch);
uint32_t const addr = (sad & 0x3ffff) + ((y / m_lr) * m_pitch);
if (!m_draw_text_cb.isnull())
if(!m_draw_text_cb.isnull())
m_draw_text_cb(bitmap, addr, y + tsy + m_vbp, wd, m_pitch, m_lr, m_dc, m_ead);
}
}

View file

@ -180,7 +180,7 @@ static inline uint32_t logical_to_chd_lba(cdrom_file *file, uint32_t loglba, uin
uint32_t chdlba, physlba;
int track;
/* loop until our current LBA is less than the start LBA of the next track */
// loop until our current LBA is less than the start LBA of the next track
for (track = 0; track < file->cdtoc.numtrks; track++)
{
if (loglba < file->cdtoc.tracks[track + 1].logframeofs)
@ -217,12 +217,12 @@ cdrom_file *cdrom_open(const char *inputfile)
cdrom_file *file;
uint32_t physofs, logofs;
/* allocate memory for the CD-ROM file */
// allocate memory for the CD-ROM file
file = new (std::nothrow) cdrom_file();
if (file == nullptr)
return nullptr;
/* setup the CDROM module and get the disc info */
// set up the CD-ROM module and get the disc info
chd_error err = chdcd_parse_toc(inputfile, file->cdtoc, file->track_info);
if (err != CHDERR_NONE)
{
@ -231,7 +231,7 @@ cdrom_file *cdrom_open(const char *inputfile)
return nullptr;
}
/* fill in the data */
// fill in the data
file->chd = nullptr;
LOG(("CD has %d tracks\n", file->cdtoc.numtrks));
@ -291,7 +291,7 @@ cdrom_file *cdrom_open(const char *inputfile)
file->cdtoc.tracks[i].logframes);*/
}
/* fill out dummy entries for the last track to help our search */
// fill out dummy entries for the last track to help our search
file->cdtoc.tracks[i].physframeofs = physofs;
file->cdtoc.tracks[i].logframeofs = logofs;
file->cdtoc.tracks[i].chdframeofs = 0;
@ -317,12 +317,7 @@ cdrom_file *cdrom_open(const char *inputfile)
cdrom_file *cdrom_open(chd_file *chd)
{
int i;
cdrom_file *file;
uint32_t physofs, chdofs, logofs;
chd_error err;
/* punt if no CHD */
// punt if no CHD
if (!chd)
return nullptr;
@ -333,15 +328,15 @@ cdrom_file *cdrom_open(chd_file *chd)
return nullptr;
/* allocate memory for the CD-ROM file */
file = new (std::nothrow) cdrom_file();
if (file == nullptr)
cdrom_file *file = new (std::nothrow) cdrom_file();
if (!file)
return nullptr;
/* fill in the data */
file->chd = chd;
/* read the CD-ROM metadata */
err = cdrom_parse_metadata(chd, &file->cdtoc);
chd_error err = cdrom_parse_metadata(chd, &file->cdtoc);
if (err != CHDERR_NONE)
{
delete file;
@ -353,7 +348,8 @@ cdrom_file *cdrom_open(chd_file *chd)
/* calculate the starting frame for each track, keeping in mind that CHDMAN
pads tracks out with extra frames to fit 4-frame size boundries
*/
physofs = chdofs = logofs = 0;
uint32_t physofs = 0, chdofs = 0, logofs = 0;
int i;
for (i = 0; i < file->cdtoc.numtrks; i++)
{
file->cdtoc.tracks[i].logframeofs = 0;
@ -388,7 +384,7 @@ cdrom_file *cdrom_open(chd_file *chd)
chdofs += file->cdtoc.tracks[i].extraframes;
logofs += file->cdtoc.tracks[i].frames;
printf("Track %02d is format %d subtype %d datasize %d subsize %d frames %d extraframes %d pregap %d pgmode %d presize %d postgap %d logofs %d physofs %d chdofs %d logframes %d\n", i+1,
/* printf("Track %02d is format %d subtype %d datasize %d subsize %d frames %d extraframes %d pregap %d pgmode %d presize %d postgap %d logofs %d physofs %d chdofs %d logframes %d\n", i+1,
file->cdtoc.tracks[i].trktype,
file->cdtoc.tracks[i].subtype,
file->cdtoc.tracks[i].datasize,
@ -402,10 +398,10 @@ cdrom_file *cdrom_open(chd_file *chd)
file->cdtoc.tracks[i].logframeofs,
file->cdtoc.tracks[i].physframeofs,
file->cdtoc.tracks[i].chdframeofs,
file->cdtoc.tracks[i].logframes);
file->cdtoc.tracks[i].logframes);*/
}
/* fill out dummy entries for the last track to help our search */
// fill out dummy entries for the last track to help our search
file->cdtoc.tracks[i].physframeofs = physofs;
file->cdtoc.tracks[i].logframeofs = logofs;
file->cdtoc.tracks[i].chdframeofs = chdofs;
@ -569,7 +565,7 @@ uint32_t cdrom_read_data(cdrom_file *file, uint32_t lbasector, void *buffer, uin
chdsector = logical_to_chd_lba(file, lbasector, tracknum);
}
/* copy out the requested sector */
// copy out the requested sector
uint32_t tracktype = file->cdtoc.tracks[tracknum].trktype;
if ((datatype == tracktype) || (datatype == CD_TRACK_RAW_DONTCARE))
@ -578,13 +574,13 @@ uint32_t cdrom_read_data(cdrom_file *file, uint32_t lbasector, void *buffer, uin
}
else
{
/* return 2048 bytes of mode 1 data from a 2352 byte mode 1 raw sector */
// return 2048 bytes of mode 1 data from a 2352 byte mode 1 raw sector
if ((datatype == CD_TRACK_MODE1) && (tracktype == CD_TRACK_MODE1_RAW))
{
return (read_partial_sector(file, buffer, lbasector, chdsector, tracknum, 16, 2048, phys) == CHDERR_NONE);
}
/* return 2352 byte mode 1 raw sector from 2048 bytes of mode 1 data */
// return 2352 byte mode 1 raw sector from 2048 bytes of mode 1 data
if ((datatype == CD_TRACK_MODE1_RAW) && (tracktype == CD_TRACK_MODE1))
{
auto *bufptr = (uint8_t *)buffer;
@ -600,19 +596,19 @@ uint32_t cdrom_read_data(cdrom_file *file, uint32_t lbasector, void *buffer, uin
return (read_partial_sector(file, bufptr+16, lbasector, chdsector, tracknum, 0, 2048, phys) == CHDERR_NONE);
}
/* return 2048 bytes of mode 1 data from a mode2 form1 or raw sector */
// return 2048 bytes of mode 1 data from a mode2 form1 or raw sector
if ((datatype == CD_TRACK_MODE1) && ((tracktype == CD_TRACK_MODE2_FORM1)||(tracktype == CD_TRACK_MODE2_RAW)))
{
return (read_partial_sector(file, buffer, lbasector, chdsector, tracknum, 24, 2048, phys) == CHDERR_NONE);
}
/* return 2048 bytes of mode 1 data from a mode2 form2 or XA sector */
// return 2048 bytes of mode 1 data from a mode2 form2 or XA sector
if ((datatype == CD_TRACK_MODE1) && (tracktype == CD_TRACK_MODE2_FORM_MIX))
{
return (read_partial_sector(file, buffer, lbasector, chdsector, tracknum, 8, 2048, phys) == CHDERR_NONE);
}
/* return mode 2 2336 byte data from a 2352 byte mode 1 or 2 raw sector (skip the header) */
// return mode 2 2336 byte data from a 2352 byte mode 1 or 2 raw sector (skip the header)
if ((datatype == CD_TRACK_MODE2) && ((tracktype == CD_TRACK_MODE1_RAW) || (tracktype == CD_TRACK_MODE2_RAW)))
{
return (read_partial_sector(file, buffer, lbasector, chdsector, tracknum, 16, 2336, phys) == CHDERR_NONE);

View file

@ -5,13 +5,21 @@
Funky Jet
*************************************************************************/
#ifndef MAME_INCLUDES_FUNKYJET_H
#define MAME_INCLUDES_FUNKYJET_H
#include "screen.h"
#pragma once
#include "cpu/h6280/h6280.h"
#include "video/decospr.h"
#include "video/deco16ic.h"
// mame
#include "machine/deco146.h"
#include "video/deco16ic.h"
#include "video/decospr.h"
// devices
#include "cpu/h6280/h6280.h"
// emu
#include "screen.h"
class funkyjet_state : public driver_device
@ -34,11 +42,11 @@ public:
void init_funkyjet();
private:
/* memory pointers */
// memory pointers
required_shared_ptr<uint16_t> m_spriteram;
required_shared_ptr_array<uint16_t, 2> m_pf_rowscroll;
/* devices */
// devices
required_device<screen_device> m_screen;
required_device<cpu_device> m_maincpu;
required_device<h6280_device> m_audiocpu;
@ -53,3 +61,5 @@ private:
void funkyjet_map(address_map &map);
void sound_map(address_map &map);
};
#endif // MAME_INCLUDES_FUNKYJET_H