Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
dirkwhoffmann committed Jun 5, 2024
1 parent 15d6d02 commit 904b20b
Show file tree
Hide file tree
Showing 8 changed files with 68 additions and 66 deletions.
52 changes: 26 additions & 26 deletions Emulator/Base/OptionTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ namespace vc64 {
enum_long(OPT)
{
// Host
OPT_HOST_REFRESH_RATE, ///< Refresh rate of the host display
OPT_HOST_SAMPLE_RATE, ///< Refresh rate of the host display
OPT_HOST_FRAMEBUF_WIDTH, ///< Current width of the emulator window
OPT_HOST_FRAMEBUF_HEIGHT, ///< Current height of the emulator window
OPT_HOST_REFRESH_RATE, ///< Refresh rate of the host display
OPT_HOST_SAMPLE_RATE, ///< Refresh rate of the host display
OPT_HOST_FRAMEBUF_WIDTH, ///< Current width of the emulator window
OPT_HOST_FRAMEBUF_HEIGHT, ///< Current height of the emulator window

// Emulator
OPT_EMU_WARP_BOOT, ///< Warp-boot time in seconds
Expand Down Expand Up @@ -71,28 +71,28 @@ enum_long(OPT)
///<
// Monitor
OPT_MON_PALETTE, ///< Color palette
OPT_MON_BRIGHTNESS, ///< Monitor brightness
OPT_MON_CONTRAST, ///< Monitor contrast
OPT_MON_SATURATION, ///< Monitor color saturation
OPT_MON_HCENTER,
OPT_MON_VCENTER,
OPT_MON_HZOOM,
OPT_MON_VZOOM,
OPT_MON_UPSCALER,
OPT_MON_BLUR,
OPT_MON_BLUR_RADIUS,
OPT_MON_BLOOM,
OPT_MON_BLOOM_RADIUS,
OPT_MON_BLOOM_BRIGHTNESS,
OPT_MON_BLOOM_WEIGHT,
OPT_MON_DOTMASK,
OPT_MON_DOTMASK_BRIGHTNESS,
OPT_MON_SCANLINES,
OPT_MON_SCANLINE_BRIGHTNESS,
OPT_MON_SCANLINE_WEIGHT,
OPT_MON_DISALIGNMENT,
OPT_MON_DISALIGNMENT_H,
OPT_MON_DISALIGNMENT_V,
OPT_MON_BRIGHTNESS, ///< Brightness
OPT_MON_CONTRAST, ///< Contrast
OPT_MON_SATURATION, ///< Color saturation
OPT_MON_HCENTER, ///< Horizontal centering
OPT_MON_VCENTER, ///< Vertical centering
OPT_MON_HZOOM, ///< Horizontal zoom
OPT_MON_VZOOM, ///< Vertical centering
OPT_MON_UPSCALER, ///< Pixel upscaler
OPT_MON_BLUR, ///< Blur enable
OPT_MON_BLUR_RADIUS, ///< Blur radius
OPT_MON_BLOOM, ///< Bloom enable
OPT_MON_BLOOM_RADIUS, ///< Bloom radius
OPT_MON_BLOOM_BRIGHTNESS, ///< Bloom brightness
OPT_MON_BLOOM_WEIGHT, ///< Bloom weight
OPT_MON_DOTMASK, ///< Dotmask pattern
OPT_MON_DOTMASK_BRIGHTNESS, ///< Dotmask brightness
OPT_MON_SCANLINES, ///< Scanline mode
OPT_MON_SCANLINE_BRIGHTNESS,///< Scanline brightness
OPT_MON_SCANLINE_WEIGHT, ///< Scanline weight
OPT_MON_DISALIGNMENT, ///< Cathode ray disalignment enable
OPT_MON_DISALIGNMENT_H, ///< Horizontal cathode ray disalignment
OPT_MON_DISALIGNMENT_V, ///< Vertical cathode ray disalignment

// Power supply
OPT_POWER_GRID, ///< Power-grid stability (affects TOD)
Expand Down
19 changes: 0 additions & 19 deletions Emulator/Base/Serializable.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

#pragma once

#include "config.h"
#include "Macros.h"
#include "MemUtils.h"
#include "Buffer.h"
Expand Down Expand Up @@ -130,7 +129,6 @@ inline void writeDouble(u8 *& buf, double value)
inline void writeString(u8 *& buf, string value)
{
auto len = value.length();
assert(len < 256);
write8(buf, u8(len));
value.copy((char *)buf, len);
buf += len;
Expand Down Expand Up @@ -186,7 +184,6 @@ class SerCounter
auto& operator<<(string &v)
{
auto len = v.length();
assert(len < 256);
count += 1 + isize(len);
return *this;
}
Expand Down Expand Up @@ -605,29 +602,13 @@ template <class T>
static constexpr bool isSoftResetter(T &worker) {

auto &id = typeid(worker);

assert(id == typeid(SerCounter) ||
id == typeid(SerChecker) ||
id == typeid(SerSoftResetter) ||
id == typeid(SerHardResetter) ||
id == typeid(SerReader) ||
id == typeid(SerWriter));

return id == typeid(SerSoftResetter);
}

template <class T>
static constexpr bool isHardResetter(T &worker) {

auto &id = typeid(worker);

assert(id == typeid(SerCounter) ||
id == typeid(SerChecker) ||
id == typeid(SerSoftResetter) ||
id == typeid(SerHardResetter) ||
id == typeid(SerReader) ||
id == typeid(SerWriter));

return id == typeid(SerHardResetter);
}

Expand Down
1 change: 0 additions & 1 deletion Emulator/Base/TimeDelayed.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ template <class T, isize delay> class TimeDelayed : public Serializable {
// Shift pipeline
i64 diff = referenceTime - timeStamp;
for (isize i = capacity - 1; i >= 0; i--) {
assert((i - diff <= 0) || (i - diff <= capacity));
pipeline[i] = (i - diff > 0) ? pipeline[i - diff] : pipeline[0];
}

Expand Down
4 changes: 2 additions & 2 deletions Emulator/Components/VICII/VICII.h
Original file line number Diff line number Diff line change
Expand Up @@ -1490,8 +1490,8 @@ zBuffer[index] = depth | (zBuffer[index] & 0x10); \
ScreenGeometry getScreenGeometry(void) const;

// Returns the coordinates of a certain sprite
u16 getSpriteX(int nr) const { assert(nr < 8); return reg.current.sprX[nr]; }
u8 getSpriteY(int nr) const { assert(nr < 8); return reg.current.sprY[nr]; }
u16 getSpriteX(int nr) const { return reg.current.sprX[nr]; }
u8 getSpriteY(int nr) const { return reg.current.sprY[nr]; }
};

}
35 changes: 35 additions & 0 deletions Emulator/Media/Cartridges/FlashRom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,13 @@ FlashRom::peek(u32 addr)
return const_cast<const FlashRom*>(this)->spypeek(addr);
}

u8
FlashRom::peek(isize bank, u16 addr)
{
assert(isBankNumber(bank));
return peek((u32)bank * 0x2000 + addr);
}

u8
FlashRom::spypeek(u32 addr) const
{
Expand Down Expand Up @@ -175,6 +182,13 @@ FlashRom::spypeek(u32 addr) const
return result;
}

u8
FlashRom::spypeek(isize bank, u16 addr) const
{
assert(isBankNumber(bank));
return spypeek((u32)bank * 0x2000 + addr);
}

void
FlashRom::poke(u32 addr, u8 value)
{
Expand Down Expand Up @@ -310,6 +324,13 @@ FlashRom::poke(u32 addr, u8 value)
}
}

void
FlashRom::poke(isize bank, u16 addr, u8 value)
{
assert(isBankNumber(bank));
poke((u32)bank * 0x2000 + addr, value);
}

bool
FlashRom::doByteProgram(u32 addr, u8 value)
{
Expand All @@ -319,6 +340,13 @@ FlashRom::doByteProgram(u32 addr, u8 value)
return rom[addr] == value;
}

bool
FlashRom::doByteProgram(isize bank, u16 addr, u8 value)
{
assert(isBankNumber(bank));
return doByteProgram((u32)bank * 0x2000 + addr, value);
}

void
FlashRom::doChipErase() {

Expand All @@ -335,4 +363,11 @@ FlashRom::doSectorErase(u32 addr)
memset(rom + (addr & 0x0000), 0xFF, sectorSize);
}

void
FlashRom::doSectorErase(isize bank, u16 addr)
{
assert(isBankNumber(bank));
doSectorErase((u32)bank * 0x2000 + addr);
}

}
19 changes: 5 additions & 14 deletions Emulator/Media/Cartridges/FlashRom.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,16 +140,13 @@ class FlashRom final : public SubComponent {
public:

u8 peek(u32 addr);
u8 peek(isize bank, u16 addr) {
assert(isBankNumber(bank)); return peek((u32)bank * 0x2000 + addr); }
u8 peek(isize bank, u16 addr);

u8 spypeek(u32 addr) const;
u8 spypeek(isize bank, u16 addr) const {
assert(isBankNumber(bank)); return spypeek((u32)bank * 0x2000 + addr); }
u8 spypeek(isize bank, u16 addr) const;

void poke(u32 addr, u8 value);
void poke(isize bank, u16 addr, u8 value) {
assert(isBankNumber(bank)); poke((u32)bank * 0x2000 + addr, value); }
void poke(isize bank, u16 addr, u8 value);


//
Expand All @@ -164,17 +161,11 @@ class FlashRom final : public SubComponent {

// Performs a "Byte Program" operation
bool doByteProgram(u32 addr, u8 value);

// Convenience wrapper with bank,offset addressing
bool doByteProgram(isize bank, u16 addr, u8 value) {
assert(isBankNumber(bank)); return doByteProgram((u32)bank * 0x2000 + addr, value); }
bool doByteProgram(isize bank, u16 addr, u8 value);

// Performs a "Sector Erase" operation
void doSectorErase(u32 addr);

// Convenience wrapper with bank,offset addressing
void doSectorErase(isize bank, u16 addr) {
assert(isBankNumber(bank)); doSectorErase((u32)bank * 0x2000 + addr); }
void doSectorErase(isize bank, u16 addr);

// Performs a "Chip Erase" operation
void doChipErase();
Expand Down
1 change: 0 additions & 1 deletion Emulator/Utilities/IOUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#include "Macros.h"
#include "IOUtils.h"

#include <assert.h>
#include <algorithm>
#include <bitset>
#include <fstream>
Expand Down
3 changes: 0 additions & 3 deletions Emulator/Utilities/RingBuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

#pragma once

#include "config.h"
#include "Types.h"
#include <utility>

Expand Down Expand Up @@ -70,13 +69,11 @@ template <class T, isize capacity> struct Array

T operator [] (isize i) const
{
assert(i >= 0 && i < capacity);
return elements[i];
}

T& operator [] (isize i)
{
assert(i >= 0 && i < capacity);
return elements[i];
}

Expand Down

0 comments on commit 904b20b

Please sign in to comment.