1
0
mirror of https://github.com/TomHarte/CLK.git synced 2026-04-20 10:17:05 +00:00

Resolve various compiler warnings: primarily ~'s promotion to int.

This commit is contained in:
Thomas Harte
2026-03-25 13:57:32 -04:00
parent c2456a4003
commit 05a85b6ba9
28 changed files with 388 additions and 405 deletions
@@ -20,14 +20,14 @@ enum Interrupts: uint8_t {
template <typename BusHandlerT, Personality personality>
template <int port> void MOS6526<BusHandlerT, personality>::set_port_output() {
const uint8_t output = output_[port] | (~data_direction_[port]);
const uint8_t output = output_[port] | uint8_t(~data_direction_[port]);
port_handler_.set_port_output(Port(port), output);
}
template <typename BusHandlerT, Personality personality>
template <int port> uint8_t MOS6526<BusHandlerT, personality>::get_port_input() {
// Avoid bothering the port handler if there's no input active.
const uint8_t input_mask = ~data_direction_[port];
const auto input_mask = uint8_t(~data_direction_[port]);
const uint8_t input = input_mask ? port_handler_.get_port_input(Port(port)) : 0x00;
return (input & input_mask) | (output_[port] & data_direction_[port]);
}
+1 -1
View File
@@ -164,7 +164,7 @@ private:
mutable uint8_t previous_output = 0x00;
uint8_t output() const {
return data | ~direction;
return uint8_t(data | ~direction);
}
uint8_t input(const uint8_t bus) const {
return (data & direction) | (bus & ~direction);
+1 -1
View File
@@ -118,7 +118,7 @@ uint8_t Executor::read(uint16_t address) {
void Executor::set_port_output(const int port) {
// Force 'output' to a 1 anywhere that a bit is set as input.
port_handler_.set_port_output(port, port_outputs_[port] | ~port_directions_[port]);
port_handler_.set_port_output(port, uint8_t(port_outputs_[port] | ~port_directions_[port]));
}
void Executor::write(uint16_t address, const uint8_t value) {
@@ -153,9 +153,9 @@ void bit_manipulate(
const auto bit = mask_bit(instruction, source);
status.zero_result = destination & (1 << bit);
switch(operation) {
case Operation::BCLR: destination &= ~(1 << bit); break;
case Operation::BCHG: destination ^= (1 << bit); break;
case Operation::BSET: destination |= (1 << bit); break;
case Operation::BCLR: destination &= uint32_t(~(1 << bit)); break;
case Operation::BCHG: destination ^= (1 << bit); break;
case Operation::BSET: destination |= (1 << bit); break;
}
flow_controller.did_bit_op(int(bit));
}
@@ -273,7 +273,7 @@ template <typename IntT> void move(const IntT source, IntT &destination, Status
/// Perform NEG.[b/l/w] on @c source, updating @c status.
template <bool is_extend, typename IntT> void negative(IntT &source, Status &status) {
const IntT result = -source - (is_extend && status.extend_flag ? 1 : 0);
const auto result = IntT(-source - (is_extend && status.extend_flag ? 1 : 0));
if constexpr (is_extend) {
status.zero_result |= result;
+3 -3
View File
@@ -173,7 +173,7 @@ public:
IntT direction() const { return static_cast<IntT>(direction_); }
// Complete value get and set.
void set(uint16_t value) {
void set(const uint16_t value) {
set_from<Flag::Carry>(value & FlagValue::Carry);
set_from<Flag::AuxiliaryCarry>(value & FlagValue::AuxiliaryCarry);
set_from<Flag::Overflow>(value & FlagValue::Overflow);
@@ -183,8 +183,8 @@ public:
set_from<uint8_t, Flag::Sign>(uint8_t(value));
set_from<Flag::Zero>((~value) & FlagValue::Zero);
set_from<Flag::ParityOdd>((~value) & FlagValue::Parity);
set_from<Flag::Zero>(uint16_t(~value) & FlagValue::Zero);
set_from<Flag::ParityOdd>(uint16_t(~value) & FlagValue::Parity);
}
uint16_t get() const {
@@ -387,7 +387,7 @@ void neg(
IntT(-destination))
);
destination = -destination;
destination = IntT(-destination);
context.flags.template set_from<Flag::Carry>(destination);
context.flags.template set_from<Flag::Overflow>(destination == Numeric::top_bit<IntT>());
@@ -79,7 +79,7 @@ void not_(
/*
Flags affected: none.
*/
destination = ~destination;
destination = IntT(~destination);
}
template <typename IntT>
@@ -328,7 +328,7 @@ void sar(
} else {
const auto mask = IntT(1 << (count - 1));
context.flags.template set_from<Flag::Carry>(destination & mask);
destination = (destination >> count) | (sign ? ~(IntT(~0) >> count) : 0);
destination = IntT((destination >> count) | (sign ? ~(IntT(~0) >> count) : 0));
}
context.flags.template set_from<Flag::Overflow>(0);
context.flags.template set_from<IntT, Flag::Sign, Flag::Zero, Flag::ParityOdd>(destination);
+1 -1
View File
@@ -361,7 +361,7 @@ private:
executor_.bus.video().crt().set_scan_target(scan_target);
}
Outputs::Display::ScanStatus get_scaled_scan_status() const override {
return executor_.bus.video().crt().get_scaled_scan_status() * video_divider_;
return executor_.bus.video().crt().get_scaled_scan_status() * float(video_divider_);
}
// MARK: - TimedMachine.
+1 -1
View File
@@ -44,7 +44,7 @@ static constexpr std::array<int16_t, 256> generate_levels() {
const int level = start * (16 - point) + end * point;
result[c] = static_cast<int16_t>((level * 32767) / 3832);
if(is_negative) result[c] = -result[c];
if(is_negative) result[c] = int16_t(-result[c]);
}
return result;
+1 -1
View File
@@ -115,7 +115,7 @@ private:
template <uint16_t pair, int base>
requires ((pair & 1) == 0 && pair >= 0xfe08 && pair <= 0xfe0e && base >= 0 && base < 16 && !(base & 0b1010))
void set_palette_group(const int address, const uint8_t value) {
source_palette_[address & 0b0111] = ~value;
source_palette_[address & 0b0111] = uint8_t(~value);
mapped_palette_[base | 0b0000] = palette_entry<BitIndex{pair + 1, 0}, BitIndex{pair + 1, 4}, BitIndex{pair, 4}>();
mapped_palette_[base | 0b0010] = palette_entry<BitIndex{pair + 1, 1}, BitIndex{pair + 1, 5}, BitIndex{pair, 5}>();
+1 -1
View File
@@ -37,7 +37,7 @@ struct ULA {
}
void fifo_is_empty(const uint8_t mask) {
apply_fifo_mask(0x00, ~mask);
apply_fifo_mask(0x00, uint8_t(~mask));
}
bool has_host_irq() const {
+1 -1
View File
@@ -234,7 +234,7 @@ uint8_t Chipset::DiskController::get_rdy_trk0_wpro_chng() {
(drive.get_is_track_zero() ? 0x10 : 0x00) |
(drive.is_read_only() ? 0x08 : 0x00);
return ~active_high;
return uint8_t(~active_high);
}
void Chipset::DiskController::set_activity_observer(Activity::Observer *observer) {
+321 -334
View File
@@ -8,10 +8,13 @@
#pragma once
#include <concepts>
namespace Amiga {
/// @returns the result of applying the Amiga-format @c minterm to inputs @c a, @c b and @c c.
template <typename IntT> IntT apply_minterm(IntT a, IntT b, IntT c, int minterm) {
template <std::unsigned_integral IntT>
IntT apply_minterm(const IntT a, const IntT b, const IntT c, const uint8_t minterm) {
// Quick implementation notes:
//
@@ -23,362 +26,346 @@ template <typename IntT> IntT apply_minterm(IntT a, IntT b, IntT c, int minterm)
// out of good ideas and automatically generated the rest.
//
switch(minterm) {
default:
case 0x00: return IntT(0);
case 0xff: return IntT(~0);
case 0xf0: return IntT(a);
case 0xcc: return IntT(b);
case 0xaa: return IntT(c);
case 0x0f: return IntT(~a);
case 0x33: return IntT(~b);
case 0x55: return IntT(~c);
case 0xfc: return IntT(a | b);
case 0xfa: return IntT(a | c);
case 0xee: return IntT(b | c);
case 0xfe: return IntT(a | b | c);
case 0xf3: return IntT(a | ~b);
case 0xf5: return IntT(a | ~c);
case 0xdd: return IntT(b | ~c);
case 0xfd: return IntT(a | b | ~c);
case 0xfb: return IntT(a | ~b | c);
case 0xf7: return IntT(a | ~b | ~c);
case 0xcf: return IntT(~a | b);
case 0xaf: return IntT(~a | c);
case 0xbb: return IntT(~b | c);
case 0xef: return IntT(~a | b | c);
case 0xdf: return IntT(~a | b | ~c);
case 0x7f: return IntT(~a | ~b | ~c);
case 0x3c: return IntT(a ^ b);
case 0x5a: return IntT(a ^ c);
case 0x66: return IntT(b ^ c);
case 0x96: return IntT(a ^ b ^ c);
case 0xc3: return IntT(~a ^ b);
case 0xa5: return IntT(~a ^ c);
case 0x99: return IntT(~b ^ c);
case 0x69: return IntT(~a ^ b ^ c);
case 0xc0: return IntT(a & b);
case 0xa0: return IntT(a & c);
case 0x88: return IntT(b & c);
case 0x80: return IntT(a & b & c);
case 0x30: return IntT(a & ~b);
case 0x50: return IntT(a & ~c);
case 0x44: return IntT(b & ~c);
case 0x0c: return IntT(~a & b);
case 0x0a: return IntT(~a & c);
case 0x22: return IntT(~b & c);
case 0x40: return IntT(a & b & ~c);
case 0x20: return IntT(a & ~b & c);
case 0x08: return IntT(~a & b & c);
case 0x10: return IntT(a & ~b & ~c);
case 0x04: return IntT(~a & b & ~c);
case 0x02: return IntT(~a & ~b & c);
case 0x03: return IntT(~a & ~b);
case 0x05: return IntT(~a & ~c);
case 0x11: return IntT(~b & ~c);
case 0x01: return IntT(~a & ~b & ~c);
case 0x70: return IntT(a & ~(b & c));
case 0x4c: return IntT(b & ~(a & c));
case 0x2a: return IntT(c & ~(a & b));
case 0x07: return IntT(~a & ~(b & c));
case 0x13: return IntT(~b & ~(a & c));
case 0x15: return IntT(~c & ~(a & b));
case 0xe0: return IntT(a & (b | c));
case 0xc8: return IntT(b & (a | c));
case 0xa8: return IntT(c & (a | b));
case 0xf0: return a;
case 0xcc: return b;
case 0xaa: return c;
case 0x0e: return IntT(~a & (b | c));
case 0x32: return IntT(~b & (a | c));
case 0x54: return IntT(~c & (a | b));
case 0x0f: return ~a;
case 0x33: return ~b;
case 0x55: return ~c;
case 0x60: return IntT(a & (b ^ c));
case 0x48: return IntT(b & (a ^ c));
case 0x28: return IntT(c & (a ^ b));
case 0x06: return IntT(~a & (b ^ c));
case 0x12: return IntT(~b & (a ^ c));
case 0x14: return IntT(~c & (a ^ b));
case 0x90: return IntT(a & ~(b ^ c));
case 0x84: return IntT(b & ~(a ^ c));
case 0x82: return IntT(c & ~(a ^ b));
case 0x09: return IntT(~a & ~(b ^ c));
case 0x21: return IntT(~b & ~(a ^ c));
case 0x41: return IntT(~c & ~(a ^ b));
case 0xb0: return IntT(a & (~b | c));
case 0xd0: return IntT(a & (b | ~c));
case 0x0b: return IntT(~a & (~b | c));
case 0x0d: return IntT(~a & (b | ~c));
case 0xf6: return IntT(a | (b ^ c));
case 0xde: return IntT(b | (a ^ c));
case 0xbe: return IntT(c | (a ^ b));
case 0x6f: return IntT(~a | (b ^ c));
case 0x7b: return IntT(~b | (a ^ c));
case 0x7d: return IntT(~c | (a ^ b));
case 0x9f: return IntT(~a | ~(b ^ c));
case 0xb7: return IntT(~b | ~(a ^ c));
case 0xd7: return IntT(~c | ~(a ^ b));
case 0xf8: return IntT(a | (b & c));
case 0xec: return IntT(b | (a & c));
case 0xea: return IntT(c | (a & b));
case 0x8f: return IntT(~a | (b & c));
case 0xb3: return IntT(~b | (a & c));
case 0xd5: return IntT(~c | (a & b));
case 0xf1: return IntT(a | ~(b | c));
case 0xcd: return IntT(b | ~(a | c));
case 0xab: return IntT(c | ~(a | b));
case 0x1f: return IntT(~a | ~(b | c));
case 0x37: return IntT(~b | ~(a | c));
case 0x57: return IntT(~c | ~(a | b));
case 0x8c: return IntT(b & (~a | c));
case 0x8a: return IntT(c & (~a | b));
case 0xc4: return IntT(b & (a | ~c));
case 0xa2: return IntT(c & (a | ~b));
case 0x78: return IntT(a ^ (b & c));
case 0x6c: return IntT(b ^ (a & c));
case 0x6a: return IntT(c ^ (a & b));
case 0x87: return IntT(~a ^ (b & c));
case 0x93: return IntT(~b ^ (a & c));
case 0x95: return IntT(~c ^ (a & b));
case 0x1e: return IntT(a ^ (b | c));
case 0x36: return IntT(b ^ (a | c));
case 0x56: return IntT(c ^ (a | b));
case 0x2d: return IntT(a ^ (b | ~c));
case 0x4b: return IntT(a ^ (~b | c));
case 0xe1: return IntT(a ^ ~(b | c));
case 0x39: return IntT(b ^ (a | ~c));
case 0x63: return IntT(b ^ (~a | c));
case 0xc9: return IntT(b ^ ~(a | c));
case 0x59: return IntT(c ^ (a | ~b));
case 0x65: return IntT(c ^ (~a | b));
case 0xa9: return IntT(c ^ ~(a | b));
case 0x24: return IntT((a ^ b) & (b ^ c));
case 0x18: return IntT((a ^ b) & (a ^ c));
case 0x42: return IntT((a ^ c) & (b ^ c));
case 0xa6: return IntT((a & b) ^ (b ^ c));
case 0xc6: return IntT((a & c) ^ (b ^ c));
case 0x5c: return IntT((a | b) ^ (a & c));
case 0x74: return IntT((a | b) ^ (b & c));
case 0x72: return IntT((a | c) ^ (b & c));
case 0x4e: return IntT((b | c) ^ (a & c));
case 0x58: return IntT((a | b) & (a ^ c));
case 0x62: return IntT((a | c) & (b ^ c));
case 0x7e: return IntT((a ^ b) | (a ^ c));
case 0xca: return IntT((a & b) | (~a & c));
case 0xac: return IntT((~a & b) | (a & c));
case 0xa3: return IntT((~a & ~b) | (a & c));
case 0xfc: return a | b;
case 0xfa: return a | c;
case 0xee: return b | c;
case 0xfe: return a | b | c;
case 0xf4: return IntT(a | ((a ^ b) & (b ^ c)));
case 0xf2: return IntT(a | ((a ^ c) & (b ^ c)));
case 0xdc: return IntT(b | ((a ^ b) & (a ^ c)));
case 0xce: return IntT(b | ((a ^ c) & (b ^ c)));
case 0xae: return IntT(c | ((a ^ b) & (b ^ c)));
case 0xba: return IntT(c | ((a ^ b) & (a ^ c)));
case 0x2f: return IntT(~a | ((a ^ b) & (b ^ c)));
case 0x4f: return IntT(~a | ((a ^ c) & (b ^ c)));
case 0x3b: return IntT(~b | ((a ^ b) & (a ^ c)));
case 0x73: return IntT(~b | ((a ^ c) & (b ^ c)));
case 0x75: return IntT(~c | ((a ^ b) & (b ^ c)));
case 0x5d: return IntT(~c | ((a ^ b) & (a ^ c)));
case 0x3f: return IntT(~a | ~b | ((a ^ b) & (b ^ c)));
case 0x77: return IntT(~b | ~c | ((a ^ b) & (b ^ c)));
case 0x27: return IntT(~(a | b) | ((a ^ b) & (b ^ c)));
case 0x47: return IntT(~(a | c) | ((a ^ c) & (b ^ c)));
case 0x53: return IntT(~(b | c) | ((a ^ c) & (b ^ c)));
case 0x43: return IntT(~(a | b | c) | ((a ^ c) & (b ^ c)));
case 0x7a: return IntT((a & ~b) | (a ^ c));
case 0x76: return IntT((a & ~b) | (b ^ c));
case 0x7c: return IntT((a & ~c) | (a ^ b));
case 0x5e: return IntT((~a & b) | (a ^ c));
case 0x6e: return IntT((~a & b) | (b ^ c));
case 0x3e: return IntT((~a & c) | (a ^ b));
case 0xad: return IntT((~a & b) | ~(a ^ c));
case 0xb5: return IntT((a & ~b) | ~(a ^ c));
case 0xcb: return IntT((~a & c) | ~(a ^ b));
case 0xd3: return IntT((a & ~c) | ~(a ^ b));
case 0x9b: return IntT((~a & c) | ~(b ^ c));
case 0xd9: return IntT((a & ~c) | ~(b ^ c));
case 0x9d: return IntT((~a & b) | ~(b ^ c));
case 0xb9: return IntT((a & ~b) | ~(b ^ c));
case 0xf3: return a | ~b;
case 0xf5: return a | ~c;
case 0xdd: return b | ~c;
case 0x9e: return IntT((~a & b) | (a ^ b ^ c));
case 0xb6: return IntT((a & ~b) | (a ^ b ^ c));
case 0xd6: return IntT((a & ~c) | (a ^ b ^ c));
case 0xbf: return IntT(~(a & b) | (a ^ b ^ c));
case 0xfd: return a | b | ~c;
case 0xfb: return a | ~b | c;
case 0xf7: return a | ~b | ~c;
case 0xcf: return ~a | b;
case 0xaf: return ~a | c;
case 0xbb: return ~b | c;
case 0xef: return ~a | b | c;
case 0xdf: return ~a | b | ~c;
case 0x7f: return ~a | ~b | ~c;
case 0x3c: return a ^ b;
case 0x5a: return a ^ c;
case 0x66: return b ^ c;
case 0x96: return a ^ b ^ c;
case 0xc3: return ~a ^ b;
case 0xa5: return ~a ^ c;
case 0x99: return ~b ^ c;
case 0x69: return ~a ^ b ^ c;
case 0xc0: return a & b;
case 0xa0: return a & c;
case 0x88: return b & c;
case 0x80: return a & b & c;
case 0x30: return a & ~b;
case 0x50: return a & ~c;
case 0x44: return b & ~c;
case 0x0c: return ~a & b;
case 0x0a: return ~a & c;
case 0x22: return ~b & c;
case 0x40: return a & b & ~c;
case 0x20: return a & ~b & c;
case 0x08: return ~a & b & c;
case 0x10: return a & ~b & ~c;
case 0x04: return ~a & b & ~c;
case 0x02: return ~a & ~b & c;
case 0x03: return ~a & ~b;
case 0x05: return ~a & ~c;
case 0x11: return ~b & ~c;
case 0x01: return ~a & ~b & ~c;
case 0x70: return a & ~(b & c);
case 0x4c: return b & ~(a & c);
case 0x2a: return c & ~(a & b);
case 0x07: return ~a & ~(b & c);
case 0x13: return ~b & ~(a & c);
case 0x15: return ~c & ~(a & b);
case 0xe0: return a & (b | c);
case 0xc8: return b & (a | c);
case 0xa8: return c & (a | b);
case 0x0e: return ~a & (b | c);
case 0x32: return ~b & (a | c);
case 0x54: return ~c & (a | b);
case 0x60: return a & (b ^ c);
case 0x48: return b & (a ^ c);
case 0x28: return c & (a ^ b);
case 0x06: return ~a & (b ^ c);
case 0x12: return ~b & (a ^ c);
case 0x14: return ~c & (a ^ b);
case 0x90: return a & ~(b ^ c);
case 0x84: return b & ~(a ^ c);
case 0x82: return c & ~(a ^ b);
case 0x09: return ~a & ~(b ^ c);
case 0x21: return ~b & ~(a ^ c);
case 0x41: return ~c & ~(a ^ b);
case 0xb0: return a & (~b | c);
case 0xd0: return a & (b | ~c);
case 0x0b: return ~a & (~b | c);
case 0x0d: return ~a & (b | ~c);
case 0xf6: return a | (b ^ c);
case 0xde: return b | (a ^ c);
case 0xbe: return c | (a ^ b);
case 0x6f: return ~a | (b ^ c);
case 0x7b: return ~b | (a ^ c);
case 0x7d: return ~c | (a ^ b);
case 0x9f: return ~a | ~(b ^ c);
case 0xb7: return ~b | ~(a ^ c);
case 0xd7: return ~c | ~(a ^ b);
case 0xf8: return a | (b & c);
case 0xec: return b | (a & c);
case 0xea: return c | (a & b);
case 0x8f: return ~a | (b & c);
case 0xb3: return ~b | (a & c);
case 0xd5: return ~c | (a & b);
case 0xf1: return a | ~(b | c);
case 0xcd: return b | ~(a | c);
case 0xab: return c | ~(a | b);
case 0x1f: return ~a | ~(b | c);
case 0x37: return ~b | ~(a | c);
case 0x57: return ~c | ~(a | b);
case 0x8c: return b & (~a | c);
case 0x8a: return c & (~a | b);
case 0xc4: return b & (a | ~c);
case 0xa2: return c & (a | ~b);
case 0x78: return a ^ (b & c);
case 0x6c: return b ^ (a & c);
case 0x6a: return c ^ (a & b);
case 0x87: return ~a ^ (b & c);
case 0x93: return ~b ^ (a & c);
case 0x95: return ~c ^ (a & b);
case 0x1e: return a ^ (b | c);
case 0x36: return b ^ (a | c);
case 0x56: return c ^ (a | b);
case 0x2d: return a ^ (b | ~c);
case 0x4b: return a ^ (~b | c);
case 0xe1: return a ^ ~(b | c);
case 0x39: return b ^ (a | ~c);
case 0x63: return b ^ (~a | c);
case 0xc9: return b ^ ~(a | c);
case 0x59: return c ^ (a | ~b);
case 0x65: return c ^ (~a | b);
case 0xa9: return c ^ ~(a | b);
case 0x24: return (a ^ b) & (b ^ c);
case 0x18: return (a ^ b) & (a ^ c);
case 0x42: return (a ^ c) & (b ^ c);
case 0xa6: return (a & b) ^ (b ^ c);
case 0xc6: return (a & c) ^ (b ^ c);
case 0x5c: return (a | b) ^ (a & c);
case 0x74: return (a | b) ^ (b & c);
case 0x72: return (a | c) ^ (b & c);
case 0x4e: return (b | c) ^ (a & c);
case 0x58: return (a | b) & (a ^ c);
case 0x62: return (a | c) & (b ^ c);
case 0x7e: return (a ^ b) | (a ^ c);
case 0xca: return (a & b) | (~a & c);
case 0xac: return (~a & b) | (a & c);
case 0xa3: return (~a & ~b) | (a & c);
case 0xf4: return a | ((a ^ b) & (b ^ c));
case 0xf2: return a | ((a ^ c) & (b ^ c));
case 0xdc: return b | ((a ^ b) & (a ^ c));
case 0xce: return b | ((a ^ c) & (b ^ c));
case 0xae: return c | ((a ^ b) & (b ^ c));
case 0xba: return c | ((a ^ b) & (a ^ c));
case 0x2f: return ~a | ((a ^ b) & (b ^ c));
case 0x4f: return ~a | ((a ^ c) & (b ^ c));
case 0x3b: return ~b | ((a ^ b) & (a ^ c));
case 0x73: return ~b | ((a ^ c) & (b ^ c));
case 0x75: return ~c | ((a ^ b) & (b ^ c));
case 0x5d: return ~c | ((a ^ b) & (a ^ c));
case 0x3f: return ~a | ~b | ((a ^ b) & (b ^ c));
case 0x77: return ~b | ~c | ((a ^ b) & (b ^ c));
case 0x27: return ~(a | b) | ((a ^ b) & (b ^ c));
case 0x47: return ~(a | c) | ((a ^ c) & (b ^ c));
case 0x53: return ~(b | c) | ((a ^ c) & (b ^ c));
case 0x43: return ~(a | b | c) | ((a ^ c) & (b ^ c));
case 0x7a: return (a & ~b) | (a ^ c);
case 0x76: return (a & ~b) | (b ^ c);
case 0x7c: return (a & ~c) | (a ^ b);
case 0x5e: return (~a & b) | (a ^ c);
case 0x6e: return (~a & b) | (b ^ c);
case 0x3e: return (~a & c) | (a ^ b);
case 0xad: return (~a & b) | ~(a ^ c);
case 0xb5: return (a & ~b) | ~(a ^ c);
case 0xcb: return (~a & c) | ~(a ^ b);
case 0xd3: return (a & ~c) | ~(a ^ b);
case 0x9b: return (~a & c) | ~(b ^ c);
case 0xd9: return (a & ~c) | ~(b ^ c);
case 0x9d: return (~a & b) | ~(b ^ c);
case 0xb9: return (a & ~b) | ~(b ^ c);
case 0x9e: return (~a & b) | (a ^ b ^ c);
case 0xb6: return (a & ~b) | (a ^ b ^ c);
case 0xd6: return (a & ~c) | (a ^ b ^ c);
case 0xbf: return ~(a & b) | (a ^ b ^ c);
case 0x6d: return (~a & b) | ~(a ^ b ^ c);
case 0x79: return (a & ~b) | ~(a ^ b ^ c);
case 0x6b: return (~a & c) | ~(a ^ b ^ c);
case 0xe9: return (b & c) | ~(a ^ b ^ c);
case 0xb8: return (a & ~b) | (c & b);
case 0xd8: return (a & ~c) | (b & c);
case 0xe4: return (b & ~c) | (a & c);
case 0xe2: return (c & ~b) | (a & b);
case 0x2c: return (~a & b) | ((a ^ b) & (b ^ c));
case 0x34: return (a & ~b) | ((a ^ b) & (b ^ c));
case 0x4a: return (~a & c) | ((a ^ c) & (b ^ c));
case 0x52: return (a & ~c) | ((a ^ c) & (b ^ c));
case 0x5f: return ~(a & c) | ((a ^ c) & (b ^ c));
case 0x16: return (a & ~(c | b)) | (c & ~(b | a)) | (b & ~(a | c));
case 0x81: return (a ^ ~(c | b)) & (c ^ ~(b | a)) & (b ^ ~(a | c));
case 0x2e: return (~a & (b | c)) | (~b & c);
case 0x3a: return (~b & (a | c)) | (~a & c);
case 0x8b: return (~a & ~b) | (c & b);
case 0x8d: return (~a & ~c) | (b & c);
case 0xb1: return (~b & ~c) | (a & c);
case 0xd1: return (~c & ~b) | (a & b);
case 0x98: return (a & ~(c | b)) | (b & c);
case 0x8e: return (~a & (c | b)) | (b & c);
case 0x46: return (~a | b) & (b ^ c);
case 0xe6: return ((~a | b) & (b ^ c)) ^ (a & c);
case 0xc2: return ((a | ~b) & (b ^ c)) ^ (a & c);
case 0x85: return (~a | b) & ~(a ^ c);
case 0x83: return (~a | c) & ~(a ^ b);
case 0x89: return (~a | c) & ~(b ^ c);
case 0xa1: return (a | ~b) & ~(a ^ c);
case 0x91: return (a | ~b) & ~(b ^ c);
case 0xc1: return (a | ~c) & ~(a ^ b);
case 0x94: return (a | b) & (a ^ b ^ c);
case 0x86: return (b | c) & (a ^ b ^ c);
case 0x92: return (a | c) & (a ^ b ^ c);
case 0x68: return (a | b) & ~(a ^ b ^ c);
case 0x61: return (a | ~b) & ~(a ^ b ^ c);
case 0x49: return (~a | b) & ~(a ^ b ^ c);
case 0x29: return (~a | c) & ~(a ^ b ^ c);
case 0x64: return (a & ~b & c) | (b & ~c);
case 0x6d: return IntT((~a & b) | ~(a ^ b ^ c));
case 0x79: return IntT((a & ~b) | ~(a ^ b ^ c));
case 0x6b: return IntT((~a & c) | ~(a ^ b ^ c));
case 0xe9: return IntT((b & c) | ~(a ^ b ^ c));
case 0xb8: return IntT((a & ~b) | (c & b));
case 0xd8: return IntT((a & ~c) | (b & c));
case 0xe4: return IntT((b & ~c) | (a & c));
case 0xe2: return IntT((c & ~b) | (a & b));
case 0x2c: return IntT((~a & b) | ((a ^ b) & (b ^ c)));
case 0x34: return IntT((a & ~b) | ((a ^ b) & (b ^ c)));
case 0x4a: return IntT((~a & c) | ((a ^ c) & (b ^ c)));
case 0x52: return IntT((a & ~c) | ((a ^ c) & (b ^ c)));
case 0x5f: return IntT(~(a & c) | ((a ^ c) & (b ^ c)));
case 0x16: return IntT((a & ~(c | b)) | (c & ~(b | a)) | (b & ~(a | c)));
case 0x81: return IntT((a ^ ~(c | b)) & (c ^ ~(b | a)) & (b ^ ~(a | c)));
case 0x2e: return IntT((~a & (b | c)) | (~b & c));
case 0x3a: return IntT((~b & (a | c)) | (~a & c));
case 0x8b: return IntT((~a & ~b) | (c & b));
case 0x8d: return IntT((~a & ~c) | (b & c));
case 0xb1: return IntT((~b & ~c) | (a & c));
case 0xd1: return IntT((~c & ~b) | (a & b));
case 0x98: return IntT((a & ~(c | b)) | (b & c));
case 0x8e: return IntT((~a & (c | b)) | (b & c));
case 0x46: return IntT((~a | b) & (b ^ c));
case 0xe6: return IntT(((~a | b) & (b ^ c)) ^ (a & c));
case 0xc2: return IntT(((a | ~b) & (b ^ c)) ^ (a & c));
case 0x85: return IntT((~a | b) & ~(a ^ c));
case 0x83: return IntT((~a | c) & ~(a ^ b));
case 0x89: return IntT((~a | c) & ~(b ^ c));
case 0xa1: return IntT((a | ~b) & ~(a ^ c));
case 0x91: return IntT((a | ~b) & ~(b ^ c));
case 0xc1: return IntT((a | ~c) & ~(a ^ b));
case 0x94: return IntT((a | b) & (a ^ b ^ c));
case 0x86: return IntT((b | c) & (a ^ b ^ c));
case 0x92: return IntT((a | c) & (a ^ b ^ c));
case 0x68: return IntT((a | b) & ~(a ^ b ^ c));
case 0x61: return IntT((a | ~b) & ~(a ^ b ^ c));
case 0x49: return IntT((~a | b) & ~(a ^ b ^ c));
case 0x29: return IntT((~a | c) & ~(a ^ b ^ c));
case 0x64: return IntT((a & ~b & c) | (b & ~c));
//
// From here downwards functions were found automatically.
// Neater versions likely exist of many of the functions below.
//
case 0xe8: return (a & b) | ((b | a) & c);
case 0xd4: return (a & b) | ((b | a) & ~c);
case 0xb2: return (a & ~b) | ((~b | a) & c);
case 0x17: return (~a & ~b) | ((~b | ~a) & ~c);
case 0x1b: return (~a & ~b) | (~b & ~c) | (~a & c);
case 0x1d: return (~a & b) | ((~b | ~a) & ~c);
case 0x2b: return (~a & ~b) | ((~b | ~a) & c);
case 0x35: return (a & ~b) | ((~b | ~a) & ~c);
case 0x4d: return (~a & b) | ((b | ~a) & ~c);
case 0x71: return (a & ~b) | ((~b | a) & ~c);
case 0xbd: return (~a & b) | (~b & ~c) | (a & c);
case 0xc5: return (a & b) | ((b | ~a) & ~c);
case 0xdb: return (a & b) | (~b & ~c) | (~a & c);
case 0xe7: return (~a & ~b) | (b & ~c) | (a & c);
case 0xe8: return IntT((a & b) | ((b | a) & c));
case 0xd4: return IntT((a & b) | ((b | a) & ~c));
case 0xb2: return IntT((a & ~b) | ((~b | a) & c));
case 0x17: return IntT((~a & ~b) | ((~b | ~a) & ~c));
case 0x1b: return IntT((~a & ~b) | (~b & ~c) | (~a & c));
case 0x1d: return IntT((~a & b) | ((~b | ~a) & ~c));
case 0x2b: return IntT((~a & ~b) | ((~b | ~a) & c));
case 0x35: return IntT((a & ~b) | ((~b | ~a) & ~c));
case 0x4d: return IntT((~a & b) | ((b | ~a) & ~c));
case 0x71: return IntT((a & ~b) | ((~b | a) & ~c));
case 0xbd: return IntT((~a & b) | (~b & ~c) | (a & c));
case 0xc5: return IntT((a & b) | ((b | ~a) & ~c));
case 0xdb: return IntT((a & b) | (~b & ~c) | (~a & c));
case 0xe7: return IntT((~a & ~b) | (b & ~c) | (a & c));
case 0x1c: return (~a & b) | (a & ~b & ~c);
case 0x23: return (~a & ~b) | (a & ~b & c);
case 0x31: return (a & ~b) | (~a & ~b & ~c);
case 0x38: return (a & ~b) | (~a & b & c);
case 0x1a: return (~a & c) | (a & ~b & ~c);
case 0x25: return (~a & ~c) | (a & ~b & c);
case 0x45: return (~a & ~c) | (a & b & ~c);
case 0x51: return (a & ~c) | (~a & ~b & ~c);
case 0xa4: return (a & c) | (~a & b & ~c);
case 0x19: return (~b & ~c) | (~a & b & c);
case 0x26: return (~b & c) | (~a & b & ~c);
case 0x1c: return IntT((~a & b) | (a & ~b & ~c));
case 0x23: return IntT((~a & ~b) | (a & ~b & c));
case 0x31: return IntT((a & ~b) | (~a & ~b & ~c));
case 0x38: return IntT((a & ~b) | (~a & b & c));
case 0x1a: return IntT((~a & c) | (a & ~b & ~c));
case 0x25: return IntT((~a & ~c) | (a & ~b & c));
case 0x45: return IntT((~a & ~c) | (a & b & ~c));
case 0x51: return IntT((a & ~c) | (~a & ~b & ~c));
case 0xa4: return IntT((a & c) | (~a & b & ~c));
case 0x19: return IntT((~b & ~c) | (~a & b & c));
case 0x26: return IntT((~b & c) | (~a & b & ~c));
case 0xc7: return (a & b) | (~a & (~b | ~c));
case 0x3d: return (a & ~b) | (~a & (b | ~c));
case 0xbc: return (~a & b) | (a & (~b | c));
case 0xe3: return (~a & ~b) | (a & (b | c));
case 0xa7: return (a & c) | (~a & (~b | ~c));
case 0x5b: return (a & ~c) | (~a & (~b | c));
case 0xda: return (~a & c) | (a & (b | ~c));
case 0xe5: return (~a & ~c) | (a & (b | c));
case 0xc7: return IntT((a & b) | (~a & (~b | ~c)));
case 0x3d: return IntT((a & ~b) | (~a & (b | ~c)));
case 0xbc: return IntT((~a & b) | (a & (~b | c)));
case 0xe3: return IntT((~a & ~b) | (a & (b | c)));
case 0xa7: return IntT((a & c) | (~a & (~b | ~c)));
case 0x5b: return IntT((a & ~c) | (~a & (~b | c)));
case 0xda: return IntT((~a & c) | (a & (b | ~c)));
case 0xe5: return IntT((~a & ~c) | (a & (b | c)));
case 0x67: return (~a & ~b) | ((~a | b) & ~c) | (~b & c);
case 0x97: return (~a & ~b) | ((~a | ~b) & ~c) | (a & b & c);
case 0x67: return IntT((~a & ~b) | ((~a | b) & ~c) | (~b & c));
case 0x97: return IntT((~a & ~b) | ((~a | ~b) & ~c) | (a & b & c));
case 0xb4: return (a & ~b) | (a & c) | (~a & b & ~c);
case 0x9c: return (~a & b) | (b & c) | (a & ~b & ~c);
case 0xb4: return IntT((a & ~b) | (a & c) | (~a & b & ~c));
case 0x9c: return IntT((~a & b) | (b & c) | (a & ~b & ~c));
case 0xd2: return ((~c | b) & a) | (~a & ~b & c);
case 0x9a: return ((~a | b) & c) | (a & ~b & ~c);
case 0xd2: return IntT(((~c | b) & a) | (~a & ~b & c));
case 0x9a: return IntT(((~a | b) & c) | (a & ~b & ~c));
case 0xf9: return a | (~b & ~c) | (b & c);
case 0xed: return b | (~a & ~c) | (a & c);
case 0xeb: return c | (~a & ~b) | (a & b);
case 0xf9: return IntT(a | IntT(~b & ~c) | (b & c));
case 0xed: return IntT(b | IntT(~a & ~c) | (a & c));
case 0xeb: return IntT(c | IntT(~a & ~b) | (a & b));
}
// Should be unreachable.
return 0;
__builtin_unreachable();
}
}
+2 -2
View File
@@ -81,7 +81,7 @@ void GLU::EnsoniqState::set_register(uint16_t address, uint8_t value) {
oscillators[address & 0x1f].table_size = value;
// The most-significant bit that should be used is 16 + (value & 7).
oscillators[address & 0x1f].overflow_mask = ~(0xffffff >> (7 - (value & 7)));
oscillators[address & 0x1f].overflow_mask = uint32_t(~(0xffffff >> (7 - (value & 7))));
break;
default:
@@ -364,7 +364,7 @@ uint8_t GLU::EnsoniqState::Oscillator::sample(uint8_t *ram) {
// The full pointer is composed of the bits of the programmed address not touched by
// the table pointer, plus the table pointer.
const uint16_t sample_address = ((address << 8) & ~table_size_mask) | (table_pointer & table_size_mask);
const auto sample_address = uint16_t(((address << 8) & ~table_size_mask) | (table_pointer & table_size_mask));
// Ignored here: bit 6 should select between RAM banks. But for now this is IIgs-centric,
// and that has only one bank of RAM.
+1 -1
View File
@@ -196,7 +196,7 @@ void TIA::set_colour_palette_entry(size_t index, uint8_t colour) {
if(tv_standard_ == OutputMode::NTSC) {
if(!phase) phase = 255;
else {
phase = -(phase * 127) / 13;
phase = uint8_t(-(phase * 127) / 13);
phase -= 102;
phase &= 127;
}
+3 -2
View File
@@ -398,7 +398,7 @@ public:
case 0xff06: value = video_.read<0xff06>(); break;
case 0xff07: value = video_.read<0xff07>(); break;
case 0xff08: {
const uint8_t keyboard_input =
const auto keyboard_input = uint8_t(
~(
((keyboard_mask_ & 0x01) ? 0x00 : key_states_[0]) |
((keyboard_mask_ & 0x02) ? 0x00 : key_states_[1]) |
@@ -408,7 +408,8 @@ public:
((keyboard_mask_ & 0x20) ? 0x00 : key_states_[5]) |
((keyboard_mask_ & 0x40) ? 0x00 : key_states_[6]) |
((keyboard_mask_ & 0x80) ? 0x00 : key_states_[7])
);
)
);
const uint8_t joystick_mask =
0xff &
+1 -1
View File
@@ -172,7 +172,7 @@ public:
/// Called by the 6522 to set output. The value of Port B selects which part of the keyboard to read.
template <MOS::MOS6522::Port port> void set_port_output(const uint8_t value, const uint8_t mask) {
if(port) activation_mask_ = (value & mask) | (~mask);
if(port) activation_mask_ = uint8_t((value & mask) | ~mask);
}
/// Called by the 6522 to set control line output. Which affects the serial port.
@@ -577,7 +577,7 @@ using BufferingScanTarget = Outputs::Display::BufferingScanTarget;
//
self.uniforms->scale[0] = modals.output_scale.x;
self.uniforms->scale[1] = modals.output_scale.y;
self.uniforms->lineWidth = 1.05f / modals.expected_vertical_lines;
self.uniforms->lineWidth = 1.05f / float(modals.expected_vertical_lines);
self.uniforms->phaseLinkedLuminanceOffset = __fp16(modals.input_data_tweaks.phase_linked_luminance_offset);
[self setAspectRatio];
@@ -676,13 +676,13 @@ using BufferingScanTarget = Outputs::Display::BufferingScanTarget;
);
// Create suitable filters.
_lineBufferPixelsPerLine = NSUInteger(modals.cycles_per_line * cyclesMultiplier);
_lineBufferPixelsPerLine = NSUInteger(float(modals.cycles_per_line) * cyclesMultiplier);
const float colourCyclesPerLine =
float(modals.colour_cycle_numerator) / float(modals.colour_cycle_denominator);
using DecodingPath = Outputs::Display::FilterGenerator::DecodingPath;
Outputs::Display::FilterGenerator generator(
_lineBufferPixelsPerLine,
float(_lineBufferPixelsPerLine),
colourCyclesPerLine,
isSVideoOutput ? DecodingPath::SVideo : DecodingPath::Composite
);
+2 -2
View File
@@ -103,7 +103,7 @@ void CRT::set_new_timing(
std::lock_guard guard(scan_target_lock_);
scan_target_->set_modals(scan_target_modals_);
const float stability_threshold = 1.0f / scan_target_modals_.expected_vertical_lines;
const float stability_threshold = 1.0f / float(scan_target_modals_.expected_vertical_lines);
rect_accumulator_.set_stability_threshold(stability_threshold);
}
@@ -749,7 +749,7 @@ Outputs::Display::Rect CRT::get_rect_for_area(
const float start_y =
float(first_line_after_sync * horizontal_period - vertical_retrace_period) /
float(vertical_scan_period);
const float height = float(number_of_lines * horizontal_period) / vertical_scan_period;
const float height = float(number_of_lines * horizontal_period) / float(vertical_scan_period);
return Outputs::Display::Rect(start_x, start_y, width, height);
}
+2 -2
View File
@@ -98,7 +98,7 @@ float FilterGenerator::suggested_sample_multiplier(
// subcarrier, ignoring the samples per line. This will allow the shaders to do point sampling
// with impunity.
if(input_type == InputDataType::PhaseLinkedLuminance8) {
const float sample_multiplier = per_line_subcarrier_frequency * 8.0f <= buffer_width ? 8.0f : 4.0f;
const float sample_multiplier = per_line_subcarrier_frequency * 8.0f <= float(buffer_width) ? 8.0f : 4.0f;
return sample_multiplier * per_line_subcarrier_frequency / float(samples_per_line);
}
@@ -107,7 +107,7 @@ float FilterGenerator::suggested_sample_multiplier(
// Prefer the minimum integer multiple that is at or above that minimum width.
const float ideal = std::ceil(minimum / float(samples_per_line));
if(ideal * float(samples_per_line) <= buffer_width) {
if(ideal * float(samples_per_line) <= float(buffer_width)) {
return ideal;
}
@@ -360,7 +360,7 @@ void Processor<personality, T, uses_ready_line>::run_for(const Cycles cycles) {
++operand_;
[[fallthrough]];
case OperationSBC:
operand_ = ~operand_;
operand_ = uint8_t(~operand_);
if(flags_.decimal && has_decimal_mode(personality)) {
uint8_t result = a_ + operand_ + flags_.carry;
@@ -399,7 +399,7 @@ void Processor<personality, T, uses_ready_line>::run_for(const Cycles cycles) {
a_ = result;
// fix up in case this was INS.
if(cycle == OperationINS) operand_ = ~operand_;
if(cycle == OperationINS) operand_ = uint8_t(~operand_);
if constexpr (is_65c02(personality)) {
// 65C02 fix: set the N and Z flags based on the final, decimal result.
@@ -466,7 +466,7 @@ void Processor<personality, T, uses_ready_line>::run_for(const Cycles cycles) {
}
// fix up in case this was INS.
if(cycle == OperationINS) operand_ = ~operand_;
if(cycle == OperationINS) operand_ = uint8_t(~operand_);
continue;
// MARK: - Shifts and Rolls
+2 -2
View File
@@ -89,11 +89,11 @@ void adc(RegistersT &registers, const uint8_t operand) {
template <Model model, typename RegistersT>
void sbc(RegistersT &registers, const uint8_t operand) {
if(!has_decimal_mode(model) || !registers.flags.template get<Flag::Decimal>()) {
adc<Model::NES6502>(registers, ~operand); // Lie about the model to carry forward the fact of not-decimal.
adc<Model::NES6502>(registers, uint8_t(~operand)); // Lie about the model to carry forward the fact of not-decimal.
return;
}
const uint8_t operand_complement = ~operand;
const auto operand_complement = uint8_t(~operand);
uint8_t result = registers.a + operand_complement + registers.flags.carry_value();
// All flags are set based only on the decimal result.
@@ -894,7 +894,7 @@ template <typename BusHandler, bool uses_ready_line> void Processor<BusHandler,
case TRB:
assert(data_buffer_.size == 2 - m_flag());
registers_.flags.set_z(data_buffer_.value & registers_.a.full, registers_.m_shift);
data_buffer_.value &= ~registers_.a.full;
data_buffer_.value &= uint32_t(~registers_.a.full);
break;
case TSB:
+23 -23
View File
@@ -167,19 +167,19 @@ struct Processor {
template <Line line>
void set(const bool value) {
const auto set_exception = [&](const Exception exception) {
exceptions_ = (exceptions_ & ~exception) | (value ? exception: 0);
exceptions_ = (exceptions_ & ~uint8_t(exception)) | (value ? uint8_t(exception): 0);
};
// As below, NMI is edge triggered whereas all the rest are level-triggered.
switch(line) {
case Line::PowerOnReset: set_exception(Exception::PowerOnReset); break;
case Line::Reset: set_exception(Exception::Reset); break;
case Line::NMI: if(value) exceptions_ |= Exception::NMI; break;
case Line::IRQ: set_exception(Exception::IRQ); break;
case Line::FIRQ: set_exception(Exception::FIRQ); break;
case Line::MRDY: mrdy_ = value; break;
case Line::Halt: set_exception(Exception::Halt); break;
case Line::DMABusReq: set_exception(Exception::DMABusReq); break;
case Line::PowerOnReset: set_exception(Exception::PowerOnReset); break;
case Line::Reset: set_exception(Exception::Reset); break;
case Line::NMI: if(value) exceptions_ |= uint8_t(Exception::NMI); break;
case Line::IRQ: set_exception(Exception::IRQ); break;
case Line::FIRQ: set_exception(Exception::FIRQ); break;
case Line::MRDY: mrdy_ = value; break;
case Line::Halt: set_exception(Exception::Halt); break;
case Line::DMABusReq: set_exception(Exception::DMABusReq); break;
}
}
@@ -364,7 +364,7 @@ struct Processor {
reset:
registers_.dp = 0;
exceptions_ &= ~(Exception::NMI | Exception::PowerOnReset);
exceptions_ &= ~(uint8_t(Exception::NMI) | uint8_t(Exception::PowerOnReset));
registers_.cc.set<ConditionCode::IRQMask>(true);
registers_.cc.set<ConditionCode::FIRQMask>(true);
@@ -375,7 +375,7 @@ struct Processor {
return;
}
addressed_internal_cycle(Address::Fixed<Vector::Reset>())
if(exceptions_ & (Exception::Halt | Exception::DMABusReq | Exception::Reset)) {
if(exceptions_ & (uint8_t(Exception::Halt) | uint8_t(Exception::DMABusReq) | uint8_t(Exception::Reset))) {
goto reset_spin;
}
@@ -423,27 +423,27 @@ struct Processor {
// Avoid potential accidental detection of SWIs on the interrupt paths.
operation_.operation = Operation::None;
if(exceptions_ & Exception::Halt) {
if(exceptions_ & uint8_t(Exception::Halt)) {
goto halt;
}
if(exceptions_ & (Exception::PowerOnReset | Exception::Reset)) {
if(exceptions_ & (uint8_t(Exception::PowerOnReset) | uint8_t(Exception::Reset))) {
address_ = Vector::Reset;
goto reset;
}
if(exceptions_ & Exception::NMI) {
if(exceptions_ & uint8_t(Exception::NMI)) {
address_ = Vector::NMI;
exceptions_ &= ~Exception::NMI;
exceptions_ &= ~uint8_t(Exception::NMI);
goto nmi_irq;
}
if(exceptions_ & Exception::FIRQ && !registers_.cc.get<ConditionCode::FIRQMask>()) {
if(exceptions_ & uint8_t(Exception::FIRQ) && !registers_.cc.get<ConditionCode::FIRQMask>()) {
address_ = Vector::FIRQ;
goto firq;
}
if(exceptions_ & Exception::IRQ && !registers_.cc.get<ConditionCode::IRQMask>()) {
if(exceptions_ & uint8_t(Exception::IRQ) && !registers_.cc.get<ConditionCode::IRQMask>()) {
address_ = Vector::IRQ;
goto nmi_irq;
}
@@ -801,17 +801,17 @@ struct Processor {
return;
}
if(exceptions_ & Exception::NMI) {
if(exceptions_ & uint8_t(Exception::NMI)) {
address_ = Vector::NMI;
goto interrupt_dispatch;
}
if(exceptions_ & Exception::FIRQ && !registers_.cc.get<ConditionCode::FIRQMask>()) {
if(exceptions_ & uint8_t(Exception::FIRQ) && !registers_.cc.get<ConditionCode::FIRQMask>()) {
address_ = Vector::FIRQ;
goto interrupt_dispatch;
}
if(exceptions_ & Exception::IRQ && !registers_.cc.get<ConditionCode::IRQMask>()) {
if(exceptions_ & uint8_t(Exception::IRQ) && !registers_.cc.get<ConditionCode::IRQMask>()) {
address_ = Vector::IRQ;
goto interrupt_dispatch;
}
@@ -922,7 +922,7 @@ struct Processor {
BusState::SyncAcknowledge
>(Address::Fixed<0xffff>(), Data::NoValue());
if(!(exceptions_ & (Exception::NMI | Exception::IRQ | Exception::FIRQ))) {
if(!(exceptions_ & (uint8_t(Exception::NMI) | uint8_t(Exception::IRQ) | uint8_t(Exception::FIRQ)))) {
goto sync;
}
@@ -1018,7 +1018,7 @@ private:
Registers registers_;
Cycles perform_cost_;
enum Exception: uint8_t {
enum class Exception: uint8_t {
Reset = 1 << 0,
PowerOnReset = 1 << 1,
NMI = 1 << 2,
@@ -1027,7 +1027,7 @@ private:
Halt = 1 << 5,
DMABusReq = 1 << 6, // TODO: implement.
};
uint8_t exceptions_ = Exception::PowerOnReset;
uint8_t exceptions_ = uint8_t(Exception::PowerOnReset);
bool mrdy_ = false;
// Transient storage.
+3 -2
View File
@@ -87,7 +87,7 @@ inline void abx(Registers &registers) {
inline void neg(Registers &registers, uint8_t &value) {
registers.cc.set<ConditionCode::Overflow>(value == 0x80);
registers.cc.set<ConditionCode::Carry>(value);
value = -value;
value = uint8_t(-value);
registers.cc.set_nz(value);
}
@@ -97,7 +97,7 @@ void neg(Registers &registers) {
}
inline void com(Registers &registers, uint8_t &value) {
value = ~value;
value = uint8_t(~value);
registers.cc.set_nz(value);
registers.cc.set<ConditionCode::Overflow>(false);
registers.cc.set<ConditionCode::Carry>(true);
@@ -422,6 +422,7 @@ Cycles perform(
case NOP:
nop_handler();
[[fallthrough]];
case None:
return 0;
+2 -2
View File
@@ -25,7 +25,7 @@ Drive::Drive(
Storage::TimedEventLoop(input_clock_rate),
available_heads_(number_of_heads),
ready_type_(rdy_type) {
set_rotation_speed(revolutions_per_minute);
set_rotation_speed(float(revolutions_per_minute));
const auto seed =
std::default_random_engine::result_type(std::chrono::system_clock::now().time_since_epoch().count());
@@ -392,7 +392,7 @@ void Drive::setup_track() {
// Reseed cycles_since_index_hole_; 99.99% of the time it'll still be correct as is,
// but if the track has rounded one way or the other it may now be very slightly adrift.
cycles_since_index_hole_ = (int((time_found + offset) * cycles_per_revolution_)) % cycles_per_revolution_;
cycles_since_index_hole_ = (int(time_found + offset) * cycles_per_revolution_) % cycles_per_revolution_;
get_next_event(offset);
}
-6
View File
@@ -10,12 +10,6 @@
using namespace Storage::Tape;
namespace {
static constexpr int BitsPerByte = 11;
}
/*
K7 files are a raw dump of source bytes that were encoded in the standard Thomson layout.