cleanup: (nw)

* fix header #including itself
* prefer things that can be scoped over #define
* get some local constants out of global scope
* tighten up scope and constness of a few locals
This commit is contained in:
Vas Crabb 2017-12-09 17:33:38 +11:00
parent 00c9b62a24
commit 3175dca4f4
3 changed files with 21 additions and 18 deletions

View File

@ -13,10 +13,10 @@
*********************************************************************/ *********************************************************************/
#include "emu.h" #include "emu.h"
#include "imagedev/flopdrv.h"
#include "formats/agat840k_hle_dsk.h"
#include "agat840k_hle.h" #include "agat840k_hle.h"
#include "formats/agat840k_hle_dsk.h"
//#define VERBOSE 1 //#define VERBOSE 1
#include "logmacro.h" #include "logmacro.h"
@ -175,14 +175,18 @@ void a2bus_agat840k_hle_device::device_reset()
} }
for (int j = 0; j < 21; j++) for (int j = 0; j < 21; j++)
{ {
int k, cksum = 0, s = (j * 1) % 21; const int s = (j * 1) % 21;
int cksum = 0;
m_floppy->floppy_drive_read_sector_data(t & 1, s, buf, 256); m_floppy->floppy_drive_read_sector_data(t & 1, s, buf, 256);
#define BAUX 22 enum
#define BLOB (256 + 19 + BAUX) {
BAUX = 22,
BLOB = 256 + 19 + BAUX
};
for (k = 0; k < 256; k++) for (int k = 0; k < 256; k++)
{ {
if (cksum > 255) { cksum++; cksum &= 255; } if (cksum > 255) { cksum++; cksum &= 255; }
cksum += buf[k]; cksum += buf[k];
@ -211,13 +215,11 @@ void a2bus_agat840k_hle_device::device_reset()
elem[13 + (BLOB * j) + 17 + 257] = 0x5a; elem[13 + (BLOB * j) + 17 + 257] = 0x5a;
// gap3 // gap3
for (k = 0; k < BAUX; k++) for (int k = 0; k < BAUX; k++)
{ {
elem[13 + (BLOB * j) + 17 + 258 + k] = 0xaa; elem[13 + (BLOB * j) + 17 + 258 + k] = 0xaa;
} }
} }
#undef BAUX
#undef BLOB
t++; t++;
if ((t & 1) == 0) if ((t & 1) == 0)
@ -407,9 +409,7 @@ WRITE8_MEMBER(a2bus_agat840k_hle_device::d14_o_c)
// data are latched in by write to PC4 // data are latched in by write to PC4
READ8_MEMBER(a2bus_agat840k_hle_device::d15_i_a) READ8_MEMBER(a2bus_agat840k_hle_device::d15_i_a)
{ {
u16 data = 0; const u16 data = m_tracks[(2 * m_floppy->floppy_drive_get_current_track()) + m_side][m_count_read];
data = m_tracks[(2 * m_floppy->floppy_drive_get_current_track()) + m_side][m_count_read];
LOG("sector data: %02x @ %4d (head %d track %2d)%s\n", data & 0xff, m_count_read, LOG("sector data: %02x @ %4d (head %d track %2d)%s\n", data & 0xff, m_count_read,
m_side, m_floppy->floppy_drive_get_current_track(), m_side, m_floppy->floppy_drive_get_current_track(),
BIT(data, 14) ? " volume" : (BIT(data, 13) ? " cksum" : "")); BIT(data, 14) ? " volume" : (BIT(data, 13) ? " cksum" : ""));

View File

@ -14,22 +14,26 @@
#pragma once #pragma once
#include "a2bus.h" #include "a2bus.h"
#include "imagedev/flopdrv.h"
#include "machine/i8255.h" #include "machine/i8255.h"
#define MXCSR_SYNC 0x40
#define MXCSR_TR 0x80
//************************************************************************** //**************************************************************************
// TYPE DEFINITIONS // TYPE DEFINITIONS
//************************************************************************** //**************************************************************************
class a2bus_agat840k_hle_device: class a2bus_agat840k_hle_device:
public device_t, public device_t,
public device_a2bus_card_interface public device_a2bus_card_interface
{ {
public: public:
enum : u8
{
MXCSR_SYNC = 0x40,
MXCSR_TR = 0x80
};
// construction/destruction // construction/destruction
a2bus_agat840k_hle_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); a2bus_agat840k_hle_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);

View File

@ -5,7 +5,6 @@
#pragma once #pragma once
#include "video/dp8510.h"
class dp8510_device : public device_t class dp8510_device : public device_t
{ {