From d83d91570e9a4e7e9ca496230ff4af6ac6b8a483 Mon Sep 17 00:00:00 2001 From: stephena Date: Mon, 14 Sep 2015 21:33:50 +0000 Subject: [PATCH] More clang warnings fixed; these apply mostly to 'old-style-C' casts. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@3205 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba --- src/common/EventHandlerSDL2.cxx | 6 +- src/common/FBSurfaceSDL2.cxx | 2 +- src/common/FrameBufferSDL2.cxx | 8 +- src/common/MouseControl.cxx | 4 +- src/common/PNGLibrary.cxx | 22 +- src/common/SoundSDL2.cxx | 39 ++- src/common/tv_filters/NTSCFilter.hxx | 2 +- src/emucore/EventHandler.cxx | 2 +- src/emucore/M6502.cxx | 8 +- src/emucore/M6502.ins | 462 +++++++++++++-------------- src/emucore/M6502.m4 | 94 +++--- src/emucore/MT24LC256.cxx | 14 +- src/emucore/Props.cxx | 2 +- src/emucore/Settings.cxx | 4 +- src/emucore/TIA.cxx | 60 ++-- src/emucore/TIASurface.cxx | 17 +- src/emucore/TrackBall.cxx | 2 +- src/gui/CheckListWidget.cxx | 10 +- src/gui/InputTextDialog.cxx | 12 +- src/gui/Launcher.cxx | 8 +- src/gui/LauncherDialog.cxx | 19 +- src/gui/ListWidget.cxx | 31 +- src/gui/MessageBox.cxx | 4 +- src/gui/ProgressDialog.cxx | 2 +- src/gui/RomAuditDialog.cxx | 2 +- src/gui/StringListWidget.cxx | 2 +- src/gui/TabWidget.cxx | 16 +- src/gui/UIDialog.cxx | 12 +- src/gui/VideoDialog.cxx | 6 +- src/gui/Widget.cxx | 4 +- src/yacc/stella.y | 2 +- src/yacc/y.tab.c | 2 +- 32 files changed, 440 insertions(+), 440 deletions(-) diff --git a/src/common/EventHandlerSDL2.cxx b/src/common/EventHandlerSDL2.cxx index 4a39a3c86..9cd7839bf 100644 --- a/src/common/EventHandlerSDL2.cxx +++ b/src/common/EventHandlerSDL2.cxx @@ -52,9 +52,9 @@ void EventHandlerSDL2::pollEvent() case SDL_KEYDOWN: { if(!myEvent.key.repeat) - handleKeyEvent((StellaKey)myEvent.key.keysym.scancode, - (StellaMod)myEvent.key.keysym.mod, - myEvent.key.type == SDL_KEYDOWN); + handleKeyEvent(StellaKey(myEvent.key.keysym.scancode), + StellaMod(myEvent.key.keysym.mod), + myEvent.key.type == SDL_KEYDOWN); break; } diff --git a/src/common/FBSurfaceSDL2.cxx b/src/common/FBSurfaceSDL2.cxx index ee5eec9ea..677c91ac4 100644 --- a/src/common/FBSurfaceSDL2.cxx +++ b/src/common/FBSurfaceSDL2.cxx @@ -218,7 +218,7 @@ void FBSurfaceSDL2::createSurface(uInt32 width, uInt32 height, //////////////////////////////////////////////////// // These *must* be set for the parent class - myPixels = (uInt32*) mySurface->pixels; + myPixels = reinterpret_cast(mySurface->pixels); myPitch = mySurface->pitch / pf->BytesPerPixel; //////////////////////////////////////////////////// diff --git a/src/common/FrameBufferSDL2.cxx b/src/common/FrameBufferSDL2.cxx index e89d87a67..a3ef73310 100644 --- a/src/common/FrameBufferSDL2.cxx +++ b/src/common/FrameBufferSDL2.cxx @@ -157,7 +157,7 @@ bool FrameBufferSDL2::setVideoMode(const string& title, const VideoMode& mode) { int w, h; SDL_GetWindowSize(myWindow, &w, &h); - if((uInt32)w != mode.screen.w || (uInt32)h != mode.screen.h) + if(uInt32(w) != mode.screen.w || uInt32(h) != mode.screen.h) { SDL_DestroyWindow(myWindow); myWindow = nullptr; @@ -321,8 +321,8 @@ void FrameBufferSDL2::setWindowIcon() const char* line = stella_icon[1 + ncols + h]; for(w = 0; w < 32; w++) { - icon[w + 32 * h] = rgba[(int)line[w]]; - if(rgba[(int)line[w]] & 0xFF000000) + icon[w + 32 * h] = rgba[int(line[w])]; + if(rgba[int(line[w])] & 0xFF000000) mask[h][w >> 3] |= 1 << (7 - (w & 0x07)); } } @@ -338,7 +338,7 @@ void FrameBufferSDL2::setWindowIcon() unique_ptr FrameBufferSDL2::createSurface(uInt32 w, uInt32 h, const uInt32* data) const { - return make_ptr((FrameBufferSDL2&)*this, w, h, data); + return make_ptr(const_cast(*this), w, h, data); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/common/MouseControl.cxx b/src/common/MouseControl.cxx index 87a98f3ac..70c1c55ce 100644 --- a/src/common/MouseControl.cxx +++ b/src/common/MouseControl.cxx @@ -39,8 +39,8 @@ MouseControl::MouseControl(Console& console, const string& mode) mode[0] >= '0' && mode[0] <= '8' && mode[1] >= '0' && mode[1] <= '8') { - Axis xaxis = (Axis) ((int)mode[0] - '0'); - Axis yaxis = (Axis) ((int)mode[1] - '0'); + Axis xaxis = Axis(int(mode[0]) - '0'); + Axis yaxis = Axis(int(mode[1]) - '0'); ostringstream msg; msg << "Mouse X-axis is "; Controller::Type xtype = Controller::Joystick, ytype = Controller::Joystick; diff --git a/src/common/PNGLibrary.cxx b/src/common/PNGLibrary.cxx index 0531e43dd..78253203a 100644 --- a/src/common/PNGLibrary.cxx +++ b/src/common/PNGLibrary.cxx @@ -99,7 +99,7 @@ void PNGLibrary::loadImage(const string& filename, FBSurface& surface) // The PNG read function expects an array of rows, not a single 1-D array for(uInt32 irow = 0, offset = 0; irow < ReadInfo.height; ++irow, offset += ReadInfo.pitch) - ReadInfo.row_pointers[irow] = (png_bytep) (uInt8*)ReadInfo.buffer + offset; + ReadInfo.row_pointers[irow] = png_bytep(ReadInfo.buffer + offset); // Read the entire image in one go png_read_image(png_ptr, ReadInfo.row_pointers); @@ -113,7 +113,7 @@ void PNGLibrary::loadImage(const string& filename, FBSurface& surface) // Cleanup done: if(png_ptr) - png_destroy_read_struct(&png_ptr, info_ptr ? &info_ptr : (png_infopp)0, (png_infopp)0); + png_destroy_read_struct(&png_ptr, info_ptr ? &info_ptr : 0, 0); if(err_message) throw runtime_error(err_message); @@ -136,7 +136,7 @@ void PNGLibrary::saveImage(const string& filename, const VariantList& comments) // Set up pointers into "buffer" byte array png_bytep* rows = new png_bytep[height]; for(png_uint_32 k = 0; k < height; ++k) - rows[k] = (png_bytep) (buffer + k*width*4); + rows[k] = png_bytep(buffer + k*width*4); // And save the image saveImage(out, buffer, rows, width, height, comments); @@ -165,7 +165,7 @@ void PNGLibrary::saveImage(const string& filename, const FBSurface& surface, // Set up pointers into "buffer" byte array png_bytep* rows = new png_bytep[height]; for(png_uint_32 k = 0; k < height; ++k) - rows[k] = (png_bytep) (buffer + k*width*4); + rows[k] = png_bytep(buffer + k*width*4); // And save the image saveImage(out, buffer, rows, width, height, comments); @@ -300,15 +300,15 @@ void PNGLibrary::loadImagetoSurface(FBSurface& surface) void PNGLibrary::writeComments(png_structp png_ptr, png_infop info_ptr, const VariantList& comments) { - uInt32 numComments = (int)comments.size(); + uInt32 numComments = comments.size(); if(numComments == 0) return; unique_ptr text_ptr = make_ptr(numComments); for(uInt32 i = 0; i < numComments; ++i) { - text_ptr[i].key = (char*) comments[i].first.c_str(); - text_ptr[i].text = (char*) comments[i].second.toCString(); + text_ptr[i].key = const_cast(comments[i].first.c_str()); + text_ptr[i].text = const_cast(comments[i].second.toCString()); text_ptr[i].compression = PNG_TEXT_COMPRESSION_NONE; text_ptr[i].text_length = 0; } @@ -318,19 +318,21 @@ void PNGLibrary::writeComments(png_structp png_ptr, png_infop info_ptr, // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void PNGLibrary::png_read_data(png_structp ctx, png_bytep area, png_size_t size) { - ((ifstream *) png_get_io_ptr(ctx))->read((char *)area, size); + (static_cast(png_get_io_ptr(ctx)))->read( + reinterpret_cast(area), size); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void PNGLibrary::png_write_data(png_structp ctx, png_bytep area, png_size_t size) { - ((ofstream *) png_get_io_ptr(ctx))->write((const char *)area, size); + (static_cast(png_get_io_ptr(ctx)))->write( + reinterpret_cast(area), size); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void PNGLibrary::png_io_flush(png_structp ctx) { - ((ofstream *) png_get_io_ptr(ctx))->flush(); + (static_cast(png_get_io_ptr(ctx)))->flush(); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/common/SoundSDL2.cxx b/src/common/SoundSDL2.cxx index 68a2545a0..afe898f6a 100644 --- a/src/common/SoundSDL2.cxx +++ b/src/common/SoundSDL2.cxx @@ -56,7 +56,7 @@ SoundSDL2::SoundSDL2(OSystem& osystem) desired.channels = 2; desired.samples = myOSystem.settings().getInt("fragsize"); desired.callback = callback; - desired.userdata = (void*)this; + desired.userdata = static_cast(this); ostringstream buf; if(SDL_OpenAudio(&desired, &myHardwareSpec) < 0) @@ -69,7 +69,7 @@ SoundSDL2::SoundSDL2(OSystem& osystem) // Make sure the sample buffer isn't to big (if it is the sound code // will not work so we'll need to disable the audio support) - if(((float)myHardwareSpec.samples / (float)myHardwareSpec.freq) >= 0.25) + if((float(myHardwareSpec.samples) / float(myHardwareSpec.freq)) >= 0.25) { buf << "WARNING: Sound device doesn't support realtime audio! Make " << "sure a sound" << endl @@ -81,7 +81,7 @@ SoundSDL2::SoundSDL2(OSystem& osystem) } // Pre-compute fragment-related variables as much as possible - myFragmentSizeLogBase2 = log((double)myHardwareSpec.samples) / log(2.0); + myFragmentSizeLogBase2 = log(myHardwareSpec.samples) / log(2.0); myFragmentSizeLogDiv1 = myFragmentSizeLogBase2 / 60.0; myFragmentSizeLogDiv2 = (myFragmentSizeLogBase2 - 1) / 60.0; @@ -135,10 +135,10 @@ void SoundSDL2::open() // Show some info ostringstream buf; buf << "Sound enabled:" << endl - << " Volume: " << (int)myVolume << endl - << " Frag size: " << (int)myHardwareSpec.samples << endl - << " Frequency: " << (int)myHardwareSpec.freq << endl - << " Channels: " << (int)myHardwareSpec.channels + << " Volume: " << myVolume << endl + << " Frag size: " << uInt32(myHardwareSpec.samples) << endl + << " Frequency: " << uInt32(myHardwareSpec.freq) << endl + << " Channels: " << uInt32(myHardwareSpec.channels) << " (" << chanResult << ")" << endl << endl; myOSystem.logMessage(buf.str(), 1); @@ -255,8 +255,7 @@ void SoundSDL2::set(uInt16 addr, uInt8 value, Int32 cycle) // First, calculate how many seconds would have past since the last // register write on a real 2600 - double delta = (((double)(cycle - myLastRegisterSetCycle)) / - (1193191.66666667)); + double delta = double(cycle - myLastRegisterSetCycle) / 1193191.66666667; // Now, adjust the time based on the frame rate the user has selected. For // the sound to "scale" correctly, we have to know the games real frame @@ -302,8 +301,8 @@ void SoundSDL2::processFragment(Int16* stream, uInt32 length) { // There are no more pending TIA sound register updates so we'll // use the current settings to finish filling the sound fragment - myTIASound.process(stream + ((uInt32)position * channels), - length - (uInt32)position); + myTIASound.process(stream + (uInt32(position) * channels), + length - uInt32(position)); // Since we had to fill the fragment we'll reset the cycle counter // to zero. NOTE: This isn't 100% correct, however, it'll do for @@ -319,7 +318,7 @@ void SoundSDL2::processFragment(Int16* stream, uInt32 length) RegWrite& info = myRegWriteQueue.front(); // How long will the remaining samples in the fragment take to play - double duration = remaining / (double)myHardwareSpec.freq; + double duration = remaining / myHardwareSpec.freq; // Does the register update occur before the end of the fragment? if(info.delta <= duration) @@ -331,9 +330,9 @@ void SoundSDL2::processFragment(Int16* stream, uInt32 length) // Process the fragment upto the next TIA register write. We // round the count passed to process up if needed. double samples = (myHardwareSpec.freq * info.delta); - myTIASound.process(stream + ((uInt32)position * channels), - (uInt32)samples + (uInt32)(position + samples) - - ((uInt32)position + (uInt32)samples)); + myTIASound.process(stream + (uInt32(position) * channels), + uInt32(samples) + uInt32(position + samples) - + (uInt32(position) + uInt32(samples))); position += samples; remaining -= samples; @@ -346,8 +345,8 @@ void SoundSDL2::processFragment(Int16* stream, uInt32 length) // The next register update occurs in the next fragment so finish // this fragment with the current TIA settings and reduce the register // update delay by the corresponding amount of time - myTIASound.process(stream + ((uInt32)position * channels), - length - (uInt32)position); + myTIASound.process(stream + (uInt32(position) * channels), + length - uInt32(position)); info.delta -= duration; break; } @@ -358,13 +357,13 @@ void SoundSDL2::processFragment(Int16* stream, uInt32 length) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void SoundSDL2::callback(void* udata, uInt8* stream, int len) { - SoundSDL2* sound = (SoundSDL2*)udata; + SoundSDL2* sound = static_cast(udata); if(sound->myIsEnabled) { // The callback is requesting 8-bit (unsigned) data, but the TIA sound // emulator deals in 16-bit (signed) data // So, we need to convert the pointer and half the length - sound->processFragment((Int16*)stream, (uInt32)len >> 1); + sound->processFragment(reinterpret_cast(stream), uInt32(len) >> 1); } else SDL_memset(stream, 0, len); // Write 'silence' @@ -428,7 +427,7 @@ bool SoundSDL2::load(Serializer& in) for(int i = 0; i < 6; ++i) in.getByte(); - myLastRegisterSetCycle = (Int32) in.getInt(); + myLastRegisterSetCycle = in.getInt(); } catch(...) { diff --git a/src/common/tv_filters/NTSCFilter.hxx b/src/common/tv_filters/NTSCFilter.hxx index 22e27a27b..3f2a48cc6 100644 --- a/src/common/tv_filters/NTSCFilter.hxx +++ b/src/common/tv_filters/NTSCFilter.hxx @@ -27,7 +27,7 @@ class Settings; #include "atari_ntsc.hxx" #define SCALE_FROM_100(x) ((x/50.0)-1.0) -#define SCALE_TO_100(x) (uInt32)(50*(x+1.0)) +#define SCALE_TO_100(x) uInt32(50*(x+1.0)) /** This class is based on the Blargg NTSC filter code from Atari800, diff --git a/src/emucore/EventHandler.cxx b/src/emucore/EventHandler.cxx index e9a2337ef..c07d79c93 100644 --- a/src/emucore/EventHandler.cxx +++ b/src/emucore/EventHandler.cxx @@ -129,7 +129,7 @@ void EventHandler::reset(State state) // We wait a little while, since 'hold' events may be present, and we want // time for the ROM to process them if(state == S_EMULATE) - SDL_AddTimer(500, resetEventsCallback, (void*)this); + SDL_AddTimer(500, resetEventsCallback, static_cast(this)); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/emucore/M6502.cxx b/src/emucore/M6502.cxx index 2f1659f65..55a382c42 100644 --- a/src/emucore/M6502.cxx +++ b/src/emucore/M6502.cxx @@ -101,7 +101,7 @@ void M6502::reset() myLastAccessWasRead = true; // Load PC from the reset vector - PC = (uInt16)mySystem->peek(0xfffc) | ((uInt16)mySystem->peek(0xfffd) << 8); + PC = uInt16(mySystem->peek(0xfffc)) | (uInt16(mySystem->peek(0xfffd)) << 8); myLastAddress = myLastPeekAddress = myLastPokeAddress = 0; myLastSrcAddressS = myLastSrcAddressA = @@ -262,7 +262,7 @@ void M6502::interruptHandler() mySystem->poke(0x0100 + SP--, PS() & (~0x10)); D = false; I = true; - PC = (uInt16)mySystem->peek(0xFFFE) | ((uInt16)mySystem->peek(0xFFFF) << 8); + PC = uInt16(mySystem->peek(0xFFFE)) | (uInt16(mySystem->peek(0xFFFF)) << 8); } else if(myExecutionStatus & NonmaskableInterruptBit) { @@ -271,7 +271,7 @@ void M6502::interruptHandler() mySystem->poke(0x0100 + SP--, (PC - 1) & 0x00ff); mySystem->poke(0x0100 + SP--, PS() & (~0x10)); D = false; - PC = (uInt16)mySystem->peek(0xFFFA) | ((uInt16)mySystem->peek(0xFFFB) << 8); + PC = uInt16(mySystem->peek(0xFFFA)) | (uInt16(mySystem->peek(0xFFFB)) << 8); } // Clear the interrupt bits in myExecutionStatus @@ -386,7 +386,7 @@ uInt32 M6502::addCondBreak(Expression* e, const string& name) { myBreakConds.emplace_back(unique_ptr(e)); myBreakCondNames.push_back(name); - return (uInt32)myBreakConds.size() - 1; + return myBreakConds.size() - 1; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/emucore/M6502.ins b/src/emucore/M6502.ins index 688fa6a40..426bc8aaa 100644 --- a/src/emucore/M6502.ins +++ b/src/emucore/M6502.ins @@ -281,7 +281,7 @@ case 0x69: notZ = sum & 0xff; C = sum & 0xff00; - A = (uInt8) sum; + A = uInt8(sum); } else { @@ -318,7 +318,7 @@ case 0x65: notZ = sum & 0xff; C = sum & 0xff00; - A = (uInt8) sum; + A = uInt8(sum); } else { @@ -357,7 +357,7 @@ case 0x75: notZ = sum & 0xff; C = sum & 0xff00; - A = (uInt8) sum; + A = uInt8(sum); } else { @@ -383,7 +383,7 @@ break; case 0x6d: { intermediateAddress = peek(PC++, DISASM_CODE); - intermediateAddress |= ((uInt16)peek(PC++, DISASM_CODE) << 8); + intermediateAddress |= (uInt16(peek(PC++, DISASM_CODE)) << 8); operand = peek(intermediateAddress, DISASM_DATA); } { @@ -395,7 +395,7 @@ case 0x6d: notZ = sum & 0xff; C = sum & 0xff00; - A = (uInt8) sum; + A = uInt8(sum); } else { @@ -421,8 +421,8 @@ break; case 0x7d: { uInt16 low = peek(PC++, DISASM_CODE); - uInt16 high = ((uInt16)peek(PC++, DISASM_CODE) << 8); - intermediateAddress = high | (uInt8)(low + X); + uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8); + intermediateAddress = high | uInt8(low + X); operand = peek(intermediateAddress, DISASM_DATA); if((low + X) > 0xFF) { @@ -439,7 +439,7 @@ case 0x7d: notZ = sum & 0xff; C = sum & 0xff00; - A = (uInt8) sum; + A = uInt8(sum); } else { @@ -465,8 +465,8 @@ break; case 0x79: { uInt16 low = peek(PC++, DISASM_CODE); - uInt16 high = ((uInt16)peek(PC++, DISASM_CODE) << 8); - intermediateAddress = high | (uInt8)(low + Y); + uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8); + intermediateAddress = high | uInt8(low + Y); operand = peek(intermediateAddress, DISASM_DATA); if((low + Y) > 0xFF) { @@ -483,7 +483,7 @@ case 0x79: notZ = sum & 0xff; C = sum & 0xff00; - A = (uInt8) sum; + A = uInt8(sum); } else { @@ -512,7 +512,7 @@ case 0x61: peek(pointer, DISASM_DATA); pointer += X; intermediateAddress = peek(pointer++, DISASM_DATA); - intermediateAddress |= ((uInt16)peek(pointer, DISASM_DATA) << 8); + intermediateAddress |= (uInt16(peek(pointer, DISASM_DATA)) << 8); operand = peek(intermediateAddress, DISASM_DATA); } { @@ -524,7 +524,7 @@ case 0x61: notZ = sum & 0xff; C = sum & 0xff00; - A = (uInt8) sum; + A = uInt8(sum); } else { @@ -551,8 +551,8 @@ case 0x71: { uInt8 pointer = peek(PC++, DISASM_CODE); uInt16 low = peek(pointer++, DISASM_DATA); - uInt16 high = ((uInt16)peek(pointer, DISASM_DATA) << 8); - intermediateAddress = high | (uInt8)(low + Y); + uInt16 high = (uInt16(peek(pointer, DISASM_DATA)) << 8); + intermediateAddress = high | uInt8(low + Y); operand = peek(intermediateAddress, DISASM_DATA); if((low + Y) > 0xFF) { @@ -569,7 +569,7 @@ case 0x71: notZ = sum & 0xff; C = sum & 0xff00; - A = (uInt8) sum; + A = uInt8(sum); } else { @@ -665,7 +665,7 @@ break; case 0x2d: { intermediateAddress = peek(PC++, DISASM_CODE); - intermediateAddress |= ((uInt16)peek(PC++, DISASM_CODE) << 8); + intermediateAddress |= (uInt16(peek(PC++, DISASM_CODE)) << 8); operand = peek(intermediateAddress, DISASM_DATA); } { @@ -678,8 +678,8 @@ break; case 0x3d: { uInt16 low = peek(PC++, DISASM_CODE); - uInt16 high = ((uInt16)peek(PC++, DISASM_CODE) << 8); - intermediateAddress = high | (uInt8)(low + X); + uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8); + intermediateAddress = high | uInt8(low + X); operand = peek(intermediateAddress, DISASM_DATA); if((low + X) > 0xFF) { @@ -697,8 +697,8 @@ break; case 0x39: { uInt16 low = peek(PC++, DISASM_CODE); - uInt16 high = ((uInt16)peek(PC++, DISASM_CODE) << 8); - intermediateAddress = high | (uInt8)(low + Y); + uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8); + intermediateAddress = high | uInt8(low + Y); operand = peek(intermediateAddress, DISASM_DATA); if((low + Y) > 0xFF) { @@ -719,7 +719,7 @@ case 0x21: peek(pointer, DISASM_DATA); pointer += X; intermediateAddress = peek(pointer++, DISASM_DATA); - intermediateAddress |= ((uInt16)peek(pointer, DISASM_DATA) << 8); + intermediateAddress |= (uInt16(peek(pointer, DISASM_DATA)) << 8); operand = peek(intermediateAddress, DISASM_DATA); } { @@ -733,8 +733,8 @@ case 0x31: { uInt8 pointer = peek(PC++, DISASM_CODE); uInt16 low = peek(pointer++, DISASM_DATA); - uInt16 high = ((uInt16)peek(pointer, DISASM_DATA) << 8); - intermediateAddress = high | (uInt8)(low + Y); + uInt16 high = (uInt16(peek(pointer, DISASM_DATA)) << 8); + intermediateAddress = high | uInt8(low + Y); operand = peek(intermediateAddress, DISASM_DATA); if((low + Y) > 0xFF) { @@ -868,7 +868,7 @@ break; case 0x0e: { operandAddress = peek(PC++, DISASM_CODE); - operandAddress |= ((uInt16)peek(PC++, DISASM_CODE) << 8); + operandAddress |= (uInt16(peek(PC++, DISASM_CODE)) << 8); operand = peek(operandAddress, DISASM_DATA); poke(operandAddress, operand); } @@ -887,8 +887,8 @@ break; case 0x1e: { uInt16 low = peek(PC++, DISASM_CODE); - uInt16 high = ((uInt16)peek(PC++, DISASM_CODE) << 8); - peek(high | (uInt8)(low + X), DISASM_DATA); + uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8); + peek(high | uInt8(low + X), DISASM_DATA); operandAddress = (high | low) + X; operand = peek(operandAddress, DISASM_DATA); poke(operandAddress, operand); @@ -914,7 +914,7 @@ case 0x90: if(!C) { peek(PC, DISASM_NONE); - uInt16 address = PC + (Int8)operand; + uInt16 address = PC + Int8(operand); if(NOTSAMEPAGE(PC, address)) peek((PC & 0xFF00) | (address & 0x00FF), DISASM_NONE); PC = address; @@ -931,7 +931,7 @@ case 0xb0: if(C) { peek(PC, DISASM_NONE); - uInt16 address = PC + (Int8)operand; + uInt16 address = PC + Int8(operand); if(NOTSAMEPAGE(PC, address)) peek((PC & 0xFF00) | (address & 0x00FF), DISASM_NONE); PC = address; @@ -948,7 +948,7 @@ case 0xf0: if(!notZ) { peek(PC, DISASM_NONE); - uInt16 address = PC + (Int8)operand; + uInt16 address = PC + Int8(operand); if(NOTSAMEPAGE(PC, address)) peek((PC & 0xFF00) | (address & 0x00FF), DISASM_NONE); PC = address; @@ -972,7 +972,7 @@ break; case 0x2C: { intermediateAddress = peek(PC++, DISASM_CODE); - intermediateAddress |= ((uInt16)peek(PC++, DISASM_CODE) << 8); + intermediateAddress |= (uInt16(peek(PC++, DISASM_CODE)) << 8); operand = peek(intermediateAddress, DISASM_DATA); } { @@ -991,7 +991,7 @@ case 0x30: if(N) { peek(PC, DISASM_NONE); - uInt16 address = PC + (Int8)operand; + uInt16 address = PC + Int8(operand); if(NOTSAMEPAGE(PC, address)) peek((PC & 0xFF00) | (address & 0x00FF), DISASM_NONE); PC = address; @@ -1008,7 +1008,7 @@ case 0xD0: if(notZ) { peek(PC, DISASM_NONE); - uInt16 address = PC + (Int8)operand; + uInt16 address = PC + Int8(operand); if(NOTSAMEPAGE(PC, address)) peek((PC & 0xFF00) | (address & 0x00FF), DISASM_NONE); PC = address; @@ -1025,7 +1025,7 @@ case 0x10: if(!N) { peek(PC, DISASM_NONE); - uInt16 address = PC + (Int8)operand; + uInt16 address = PC + Int8(operand); if(NOTSAMEPAGE(PC, address)) peek((PC & 0xFF00) | (address & 0x00FF), DISASM_NONE); PC = address; @@ -1047,7 +1047,7 @@ case 0x00: I = true; PC = peek(0xfffe, DISASM_NONE); - PC |= ((uInt16)peek(0xffff, DISASM_NONE) << 8); + PC |= (uInt16(peek(0xffff, DISASM_NONE)) << 8); } break; @@ -1060,7 +1060,7 @@ case 0x50: if(!V) { peek(PC, DISASM_NONE); - uInt16 address = PC + (Int8)operand; + uInt16 address = PC + Int8(operand); if(NOTSAMEPAGE(PC, address)) peek((PC & 0xFF00) | (address & 0x00FF), DISASM_NONE); PC = address; @@ -1077,7 +1077,7 @@ case 0x70: if(V) { peek(PC, DISASM_NONE); - uInt16 address = PC + (Int8)operand; + uInt16 address = PC + Int8(operand); if(NOTSAMEPAGE(PC, address)) peek((PC & 0xFF00) | (address & 0x00FF), DISASM_NONE); PC = address; @@ -1131,7 +1131,7 @@ case 0xc9: operand = peek(PC++, DISASM_CODE); } { - uInt16 value = (uInt16)A - (uInt16)operand; + uInt16 value = uInt16(A) - uInt16(operand); notZ = value; N = value & 0x0080; @@ -1145,7 +1145,7 @@ case 0xc5: operand = peek(intermediateAddress, DISASM_DATA); } { - uInt16 value = (uInt16)A - (uInt16)operand; + uInt16 value = uInt16(A) - uInt16(operand); notZ = value; N = value & 0x0080; @@ -1161,7 +1161,7 @@ case 0xd5: operand = peek(intermediateAddress, DISASM_DATA); } { - uInt16 value = (uInt16)A - (uInt16)operand; + uInt16 value = uInt16(A) - uInt16(operand); notZ = value; N = value & 0x0080; @@ -1172,11 +1172,11 @@ break; case 0xcd: { intermediateAddress = peek(PC++, DISASM_CODE); - intermediateAddress |= ((uInt16)peek(PC++, DISASM_CODE) << 8); + intermediateAddress |= (uInt16(peek(PC++, DISASM_CODE)) << 8); operand = peek(intermediateAddress, DISASM_DATA); } { - uInt16 value = (uInt16)A - (uInt16)operand; + uInt16 value = uInt16(A) - uInt16(operand); notZ = value; N = value & 0x0080; @@ -1187,8 +1187,8 @@ break; case 0xdd: { uInt16 low = peek(PC++, DISASM_CODE); - uInt16 high = ((uInt16)peek(PC++, DISASM_CODE) << 8); - intermediateAddress = high | (uInt8)(low + X); + uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8); + intermediateAddress = high | uInt8(low + X); operand = peek(intermediateAddress, DISASM_DATA); if((low + X) > 0xFF) { @@ -1197,7 +1197,7 @@ case 0xdd: } } { - uInt16 value = (uInt16)A - (uInt16)operand; + uInt16 value = uInt16(A) - uInt16(operand); notZ = value; N = value & 0x0080; @@ -1208,8 +1208,8 @@ break; case 0xd9: { uInt16 low = peek(PC++, DISASM_CODE); - uInt16 high = ((uInt16)peek(PC++, DISASM_CODE) << 8); - intermediateAddress = high | (uInt8)(low + Y); + uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8); + intermediateAddress = high | uInt8(low + Y); operand = peek(intermediateAddress, DISASM_DATA); if((low + Y) > 0xFF) { @@ -1218,7 +1218,7 @@ case 0xd9: } } { - uInt16 value = (uInt16)A - (uInt16)operand; + uInt16 value = uInt16(A) - uInt16(operand); notZ = value; N = value & 0x0080; @@ -1232,11 +1232,11 @@ case 0xc1: peek(pointer, DISASM_DATA); pointer += X; intermediateAddress = peek(pointer++, DISASM_DATA); - intermediateAddress |= ((uInt16)peek(pointer, DISASM_DATA) << 8); + intermediateAddress |= (uInt16(peek(pointer, DISASM_DATA)) << 8); operand = peek(intermediateAddress, DISASM_DATA); } { - uInt16 value = (uInt16)A - (uInt16)operand; + uInt16 value = uInt16(A) - uInt16(operand); notZ = value; N = value & 0x0080; @@ -1248,8 +1248,8 @@ case 0xd1: { uInt8 pointer = peek(PC++, DISASM_CODE); uInt16 low = peek(pointer++, DISASM_DATA); - uInt16 high = ((uInt16)peek(pointer, DISASM_DATA) << 8); - intermediateAddress = high | (uInt8)(low + Y); + uInt16 high = (uInt16(peek(pointer, DISASM_DATA)) << 8); + intermediateAddress = high | uInt8(low + Y); operand = peek(intermediateAddress, DISASM_DATA); if((low + Y) > 0xFF) { @@ -1258,7 +1258,7 @@ case 0xd1: } } { - uInt16 value = (uInt16)A - (uInt16)operand; + uInt16 value = uInt16(A) - uInt16(operand); notZ = value; N = value & 0x0080; @@ -1272,7 +1272,7 @@ case 0xe0: operand = peek(PC++, DISASM_CODE); } { - uInt16 value = (uInt16)X - (uInt16)operand; + uInt16 value = uInt16(X) - uInt16(operand); notZ = value; N = value & 0x0080; @@ -1286,7 +1286,7 @@ case 0xe4: operand = peek(intermediateAddress, DISASM_DATA); } { - uInt16 value = (uInt16)X - (uInt16)operand; + uInt16 value = uInt16(X) - uInt16(operand); notZ = value; N = value & 0x0080; @@ -1297,11 +1297,11 @@ break; case 0xec: { intermediateAddress = peek(PC++, DISASM_CODE); - intermediateAddress |= ((uInt16)peek(PC++, DISASM_CODE) << 8); + intermediateAddress |= (uInt16(peek(PC++, DISASM_CODE)) << 8); operand = peek(intermediateAddress, DISASM_DATA); } { - uInt16 value = (uInt16)X - (uInt16)operand; + uInt16 value = uInt16(X) - uInt16(operand); notZ = value; N = value & 0x0080; @@ -1315,7 +1315,7 @@ case 0xc0: operand = peek(PC++, DISASM_CODE); } { - uInt16 value = (uInt16)Y - (uInt16)operand; + uInt16 value = uInt16(Y) - uInt16(operand); notZ = value; N = value & 0x0080; @@ -1329,7 +1329,7 @@ case 0xc4: operand = peek(intermediateAddress, DISASM_DATA); } { - uInt16 value = (uInt16)Y - (uInt16)operand; + uInt16 value = uInt16(Y) - uInt16(operand); notZ = value; N = value & 0x0080; @@ -1340,11 +1340,11 @@ break; case 0xcc: { intermediateAddress = peek(PC++, DISASM_CODE); - intermediateAddress |= ((uInt16)peek(PC++, DISASM_CODE) << 8); + intermediateAddress |= (uInt16(peek(PC++, DISASM_CODE)) << 8); operand = peek(intermediateAddress, DISASM_DATA); } { - uInt16 value = (uInt16)Y - (uInt16)operand; + uInt16 value = uInt16(Y) - uInt16(operand); notZ = value; N = value & 0x0080; @@ -1356,7 +1356,7 @@ break; case 0xcf: { operandAddress = peek(PC++, DISASM_CODE); - operandAddress |= ((uInt16)peek(PC++, DISASM_CODE) << 8); + operandAddress |= (uInt16(peek(PC++, DISASM_CODE)) << 8); operand = peek(operandAddress, DISASM_DATA); poke(operandAddress, operand); } @@ -1364,7 +1364,7 @@ case 0xcf: uInt8 value = operand - 1; poke(operandAddress, value); - uInt16 value2 = (uInt16)A - (uInt16)value; + uInt16 value2 = uInt16(A) - uInt16(value); notZ = value2; N = value2 & 0x0080; C = !(value2 & 0x0100); @@ -1374,8 +1374,8 @@ break; case 0xdf: { uInt16 low = peek(PC++, DISASM_CODE); - uInt16 high = ((uInt16)peek(PC++, DISASM_CODE) << 8); - peek(high | (uInt8)(low + X), DISASM_DATA); + uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8); + peek(high | uInt8(low + X), DISASM_DATA); operandAddress = (high | low) + X; operand = peek(operandAddress, DISASM_DATA); poke(operandAddress, operand); @@ -1384,7 +1384,7 @@ case 0xdf: uInt8 value = operand - 1; poke(operandAddress, value); - uInt16 value2 = (uInt16)A - (uInt16)value; + uInt16 value2 = uInt16(A) - uInt16(value); notZ = value2; N = value2 & 0x0080; C = !(value2 & 0x0100); @@ -1394,8 +1394,8 @@ break; case 0xdb: { uInt16 low = peek(PC++, DISASM_CODE); - uInt16 high = ((uInt16)peek(PC++, DISASM_CODE) << 8); - peek(high | (uInt8)(low + Y), DISASM_DATA); + uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8); + peek(high | uInt8(low + Y), DISASM_DATA); operandAddress = (high | low) + Y; operand = peek(operandAddress, DISASM_DATA); poke(operandAddress, operand); @@ -1404,7 +1404,7 @@ case 0xdb: uInt8 value = operand - 1; poke(operandAddress, value); - uInt16 value2 = (uInt16)A - (uInt16)value; + uInt16 value2 = uInt16(A) - uInt16(value); notZ = value2; N = value2 & 0x0080; C = !(value2 & 0x0100); @@ -1421,7 +1421,7 @@ case 0xc7: uInt8 value = operand - 1; poke(operandAddress, value); - uInt16 value2 = (uInt16)A - (uInt16)value; + uInt16 value2 = uInt16(A) - uInt16(value); notZ = value2; N = value2 & 0x0080; C = !(value2 & 0x0100); @@ -1440,7 +1440,7 @@ case 0xd7: uInt8 value = operand - 1; poke(operandAddress, value); - uInt16 value2 = (uInt16)A - (uInt16)value; + uInt16 value2 = uInt16(A) - uInt16(value); notZ = value2; N = value2 & 0x0080; C = !(value2 & 0x0100); @@ -1453,7 +1453,7 @@ case 0xc3: peek(pointer, DISASM_DATA); pointer += X; operandAddress = peek(pointer++, DISASM_DATA); - operandAddress |= ((uInt16)peek(pointer, DISASM_DATA) << 8); + operandAddress |= (uInt16(peek(pointer, DISASM_DATA)) << 8); operand = peek(operandAddress, DISASM_DATA); poke(operandAddress, operand); } @@ -1461,7 +1461,7 @@ case 0xc3: uInt8 value = operand - 1; poke(operandAddress, value); - uInt16 value2 = (uInt16)A - (uInt16)value; + uInt16 value2 = uInt16(A) - uInt16(value); notZ = value2; N = value2 & 0x0080; C = !(value2 & 0x0100); @@ -1472,8 +1472,8 @@ case 0xd3: { uInt8 pointer = peek(PC++, DISASM_CODE); uInt16 low = peek(pointer++, DISASM_DATA); - uInt16 high = ((uInt16)peek(pointer, DISASM_DATA) << 8); - peek(high | (uInt8)(low + Y), DISASM_DATA); + uInt16 high = (uInt16(peek(pointer, DISASM_DATA)) << 8); + peek(high | uInt8(low + Y), DISASM_DATA); operandAddress = (high | low) + Y; operand = peek(operandAddress, DISASM_DATA); poke(operandAddress, operand); @@ -1482,7 +1482,7 @@ case 0xd3: uInt8 value = operand - 1; poke(operandAddress, value); - uInt16 value2 = (uInt16)A - (uInt16)value; + uInt16 value2 = uInt16(A) - uInt16(value); notZ = value2; N = value2 & 0x0080; C = !(value2 & 0x0100); @@ -1525,7 +1525,7 @@ break; case 0xce: { operandAddress = peek(PC++, DISASM_CODE); - operandAddress |= ((uInt16)peek(PC++, DISASM_CODE) << 8); + operandAddress |= (uInt16(peek(PC++, DISASM_CODE)) << 8); operand = peek(operandAddress, DISASM_DATA); poke(operandAddress, operand); } @@ -1541,8 +1541,8 @@ break; case 0xde: { uInt16 low = peek(PC++, DISASM_CODE); - uInt16 high = ((uInt16)peek(PC++, DISASM_CODE) << 8); - peek(high | (uInt8)(low + X), DISASM_DATA); + uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8); + peek(high | uInt8(low + X), DISASM_DATA); operandAddress = (high | low) + X; operand = peek(operandAddress, DISASM_DATA); poke(operandAddress, operand); @@ -1623,7 +1623,7 @@ break; case 0x4d: { intermediateAddress = peek(PC++, DISASM_CODE); - intermediateAddress |= ((uInt16)peek(PC++, DISASM_CODE) << 8); + intermediateAddress |= (uInt16(peek(PC++, DISASM_CODE)) << 8); operand = peek(intermediateAddress, DISASM_DATA); } { @@ -1636,8 +1636,8 @@ break; case 0x5d: { uInt16 low = peek(PC++, DISASM_CODE); - uInt16 high = ((uInt16)peek(PC++, DISASM_CODE) << 8); - intermediateAddress = high | (uInt8)(low + X); + uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8); + intermediateAddress = high | uInt8(low + X); operand = peek(intermediateAddress, DISASM_DATA); if((low + X) > 0xFF) { @@ -1655,8 +1655,8 @@ break; case 0x59: { uInt16 low = peek(PC++, DISASM_CODE); - uInt16 high = ((uInt16)peek(PC++, DISASM_CODE) << 8); - intermediateAddress = high | (uInt8)(low + Y); + uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8); + intermediateAddress = high | uInt8(low + Y); operand = peek(intermediateAddress, DISASM_DATA); if((low + Y) > 0xFF) { @@ -1677,7 +1677,7 @@ case 0x41: peek(pointer, DISASM_DATA); pointer += X; intermediateAddress = peek(pointer++, DISASM_DATA); - intermediateAddress |= ((uInt16)peek(pointer, DISASM_DATA) << 8); + intermediateAddress |= (uInt16(peek(pointer, DISASM_DATA)) << 8); operand = peek(intermediateAddress, DISASM_DATA); } { @@ -1691,8 +1691,8 @@ case 0x51: { uInt8 pointer = peek(PC++, DISASM_CODE); uInt16 low = peek(pointer++, DISASM_DATA); - uInt16 high = ((uInt16)peek(pointer, DISASM_DATA) << 8); - intermediateAddress = high | (uInt8)(low + Y); + uInt16 high = (uInt16(peek(pointer, DISASM_DATA)) << 8); + intermediateAddress = high | uInt8(low + Y); operand = peek(intermediateAddress, DISASM_DATA); if((low + Y) > 0xFF) { @@ -1743,7 +1743,7 @@ break; case 0xee: { operandAddress = peek(PC++, DISASM_CODE); - operandAddress |= ((uInt16)peek(PC++, DISASM_CODE) << 8); + operandAddress |= (uInt16(peek(PC++, DISASM_CODE)) << 8); operand = peek(operandAddress, DISASM_DATA); poke(operandAddress, operand); } @@ -1759,8 +1759,8 @@ break; case 0xfe: { uInt16 low = peek(PC++, DISASM_CODE); - uInt16 high = ((uInt16)peek(PC++, DISASM_CODE) << 8); - peek(high | (uInt8)(low + X), DISASM_DATA); + uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8); + peek(high | uInt8(low + X), DISASM_DATA); operandAddress = (high | low) + X; operand = peek(operandAddress, DISASM_DATA); poke(operandAddress, operand); @@ -1802,7 +1802,7 @@ break; case 0xef: { operandAddress = peek(PC++, DISASM_CODE); - operandAddress |= ((uInt16)peek(PC++, DISASM_CODE) << 8); + operandAddress |= (uInt16(peek(PC++, DISASM_CODE)) << 8); operand = peek(operandAddress, DISASM_DATA); poke(operandAddress, operand); } @@ -1818,7 +1818,7 @@ case 0xef: if(!D) { - A = (uInt8) sum; + A = uInt8(sum); } else { @@ -1841,8 +1841,8 @@ break; case 0xff: { uInt16 low = peek(PC++, DISASM_CODE); - uInt16 high = ((uInt16)peek(PC++, DISASM_CODE) << 8); - peek(high | (uInt8)(low + X), DISASM_DATA); + uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8); + peek(high | uInt8(low + X), DISASM_DATA); operandAddress = (high | low) + X; operand = peek(operandAddress, DISASM_DATA); poke(operandAddress, operand); @@ -1859,7 +1859,7 @@ case 0xff: if(!D) { - A = (uInt8) sum; + A = uInt8(sum); } else { @@ -1882,8 +1882,8 @@ break; case 0xfb: { uInt16 low = peek(PC++, DISASM_CODE); - uInt16 high = ((uInt16)peek(PC++, DISASM_CODE) << 8); - peek(high | (uInt8)(low + Y), DISASM_DATA); + uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8); + peek(high | uInt8(low + Y), DISASM_DATA); operandAddress = (high | low) + Y; operand = peek(operandAddress, DISASM_DATA); poke(operandAddress, operand); @@ -1900,7 +1900,7 @@ case 0xfb: if(!D) { - A = (uInt8) sum; + A = uInt8(sum); } else { @@ -1938,7 +1938,7 @@ case 0xe7: if(!D) { - A = (uInt8) sum; + A = uInt8(sum); } else { @@ -1978,7 +1978,7 @@ case 0xf7: if(!D) { - A = (uInt8) sum; + A = uInt8(sum); } else { @@ -2004,7 +2004,7 @@ case 0xe3: peek(pointer, DISASM_DATA); pointer += X; operandAddress = peek(pointer++, DISASM_DATA); - operandAddress |= ((uInt16)peek(pointer, DISASM_DATA) << 8); + operandAddress |= (uInt16(peek(pointer, DISASM_DATA)) << 8); operand = peek(operandAddress, DISASM_DATA); poke(operandAddress, operand); } @@ -2020,7 +2020,7 @@ case 0xe3: if(!D) { - A = (uInt8) sum; + A = uInt8(sum); } else { @@ -2044,8 +2044,8 @@ case 0xf3: { uInt8 pointer = peek(PC++, DISASM_CODE); uInt16 low = peek(pointer++, DISASM_DATA); - uInt16 high = ((uInt16)peek(pointer, DISASM_DATA) << 8); - peek(high | (uInt8)(low + Y), DISASM_DATA); + uInt16 high = (uInt16(peek(pointer, DISASM_DATA)) << 8); + peek(high | uInt8(low + Y), DISASM_DATA); operandAddress = (high | low) + Y; operand = peek(operandAddress, DISASM_DATA); poke(operandAddress, operand); @@ -2062,7 +2062,7 @@ case 0xf3: if(!D) { - A = (uInt8) sum; + A = uInt8(sum); } else { @@ -2086,7 +2086,7 @@ break; case 0x4c: { operandAddress = peek(PC++, DISASM_CODE); - operandAddress |= ((uInt16)peek(PC++, DISASM_CODE) << 8); + operandAddress |= (uInt16(peek(PC++, DISASM_CODE)) << 8); } { PC = operandAddress; @@ -2096,13 +2096,13 @@ break; case 0x6c: { uInt16 addr = peek(PC++, DISASM_CODE); - addr |= ((uInt16)peek(PC++, DISASM_CODE) << 8); + addr |= (uInt16(peek(PC++, DISASM_CODE)) << 8); // Simulate the error in the indirect addressing mode! uInt16 high = NOTSAMEPAGE(addr, addr + 1) ? (addr & 0xff00) : (addr + 1); operandAddress = peek(addr, DISASM_DATA); - operandAddress |= ((uInt16)peek(high, DISASM_DATA) << 8); + operandAddress |= (uInt16(peek(high, DISASM_DATA)) << 8); } { PC = operandAddress; @@ -2121,7 +2121,7 @@ case 0x20: poke(0x0100 + SP--, PC >> 8); poke(0x0100 + SP--, PC & 0xff); - PC = (low | ((uInt16)peek(PC, DISASM_CODE) << 8)); + PC = (low | (uInt16(peek(PC, DISASM_CODE)) << 8)); } break; @@ -2129,8 +2129,8 @@ break; case 0xbb: { uInt16 low = peek(PC++, DISASM_CODE); - uInt16 high = ((uInt16)peek(PC++, DISASM_CODE) << 8); - intermediateAddress = high | (uInt8)(low + Y); + uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8); + intermediateAddress = high | uInt8(low + Y); operand = peek(intermediateAddress, DISASM_DATA); if((low + Y) > 0xFF) { @@ -2151,7 +2151,7 @@ break; case 0xaf: { intermediateAddress = peek(PC++, DISASM_CODE); - intermediateAddress |= ((uInt16)peek(PC++, DISASM_CODE) << 8); + intermediateAddress |= (uInt16(peek(PC++, DISASM_CODE)) << 8); operand = peek(intermediateAddress, DISASM_DATA); } SET_LAST_PEEK(myLastSrcAddressA, intermediateAddress) @@ -2167,8 +2167,8 @@ break; case 0xbf: { uInt16 low = peek(PC++, DISASM_CODE); - uInt16 high = ((uInt16)peek(PC++, DISASM_CODE) << 8); - intermediateAddress = high | (uInt8)(low + Y); + uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8); + intermediateAddress = high | uInt8(low + Y); operand = peek(intermediateAddress, DISASM_DATA); if((low + Y) > 0xFF) { @@ -2224,7 +2224,7 @@ case 0xa3: peek(pointer, DISASM_DATA); pointer += X; intermediateAddress = peek(pointer++, DISASM_DATA); - intermediateAddress |= ((uInt16)peek(pointer, DISASM_DATA) << 8); + intermediateAddress |= (uInt16(peek(pointer, DISASM_DATA)) << 8); operand = peek(intermediateAddress, DISASM_DATA); } SET_LAST_PEEK(myLastSrcAddressA, intermediateAddress) @@ -2241,8 +2241,8 @@ case 0xb3: { uInt8 pointer = peek(PC++, DISASM_CODE); uInt16 low = peek(pointer++, DISASM_DATA); - uInt16 high = ((uInt16)peek(pointer, DISASM_DATA) << 8); - intermediateAddress = high | (uInt8)(low + Y); + uInt16 high = (uInt16(peek(pointer, DISASM_DATA)) << 8); + intermediateAddress = high | uInt8(low + Y); operand = peek(intermediateAddress, DISASM_DATA); if((low + Y) > 0xFF) { @@ -2307,7 +2307,7 @@ break; case 0xad: { intermediateAddress = peek(PC++, DISASM_CODE); - intermediateAddress |= ((uInt16)peek(PC++, DISASM_CODE) << 8); + intermediateAddress |= (uInt16(peek(PC++, DISASM_CODE)) << 8); operand = peek(intermediateAddress, DISASM_DATA); } SET_LAST_PEEK(myLastSrcAddressA, intermediateAddress) @@ -2321,8 +2321,8 @@ break; case 0xbd: { uInt16 low = peek(PC++, DISASM_CODE); - uInt16 high = ((uInt16)peek(PC++, DISASM_CODE) << 8); - intermediateAddress = high | (uInt8)(low + X); + uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8); + intermediateAddress = high | uInt8(low + X); operand = peek(intermediateAddress, DISASM_DATA); if((low + X) > 0xFF) { @@ -2341,8 +2341,8 @@ break; case 0xb9: { uInt16 low = peek(PC++, DISASM_CODE); - uInt16 high = ((uInt16)peek(PC++, DISASM_CODE) << 8); - intermediateAddress = high | (uInt8)(low + Y); + uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8); + intermediateAddress = high | uInt8(low + Y); operand = peek(intermediateAddress, DISASM_DATA); if((low + Y) > 0xFF) { @@ -2364,7 +2364,7 @@ case 0xa1: peek(pointer, DISASM_DATA); pointer += X; intermediateAddress = peek(pointer++, DISASM_DATA); - intermediateAddress |= ((uInt16)peek(pointer, DISASM_DATA) << 8); + intermediateAddress |= (uInt16(peek(pointer, DISASM_DATA)) << 8); operand = peek(intermediateAddress, DISASM_DATA); } SET_LAST_PEEK(myLastSrcAddressA, intermediateAddress) @@ -2379,8 +2379,8 @@ case 0xb1: { uInt8 pointer = peek(PC++, DISASM_CODE); uInt16 low = peek(pointer++, DISASM_DATA); - uInt16 high = ((uInt16)peek(pointer, DISASM_DATA) << 8); - intermediateAddress = high | (uInt8)(low + Y); + uInt16 high = (uInt16(peek(pointer, DISASM_DATA)) << 8); + intermediateAddress = high | uInt8(low + Y); operand = peek(intermediateAddress, DISASM_DATA); if((low + Y) > 0xFF) { @@ -2443,7 +2443,7 @@ break; case 0xae: { intermediateAddress = peek(PC++, DISASM_CODE); - intermediateAddress |= ((uInt16)peek(PC++, DISASM_CODE) << 8); + intermediateAddress |= (uInt16(peek(PC++, DISASM_CODE)) << 8); operand = peek(intermediateAddress, DISASM_DATA); } SET_LAST_PEEK(myLastSrcAddressX, intermediateAddress) @@ -2457,8 +2457,8 @@ break; case 0xbe: { uInt16 low = peek(PC++, DISASM_CODE); - uInt16 high = ((uInt16)peek(PC++, DISASM_CODE) << 8); - intermediateAddress = high | (uInt8)(low + Y); + uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8); + intermediateAddress = high | uInt8(low + Y); operand = peek(intermediateAddress, DISASM_DATA); if((low + Y) > 0xFF) { @@ -2521,7 +2521,7 @@ break; case 0xac: { intermediateAddress = peek(PC++, DISASM_CODE); - intermediateAddress |= ((uInt16)peek(PC++, DISASM_CODE) << 8); + intermediateAddress |= (uInt16(peek(PC++, DISASM_CODE)) << 8); operand = peek(intermediateAddress, DISASM_DATA); } SET_LAST_PEEK(myLastSrcAddressY, intermediateAddress) @@ -2535,8 +2535,8 @@ break; case 0xbc: { uInt16 low = peek(PC++, DISASM_CODE); - uInt16 high = ((uInt16)peek(PC++, DISASM_CODE) << 8); - intermediateAddress = high | (uInt8)(low + X); + uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8); + intermediateAddress = high | uInt8(low + X); operand = peek(intermediateAddress, DISASM_DATA); if((low + X) > 0xFF) { @@ -2611,7 +2611,7 @@ break; case 0x4e: { operandAddress = peek(PC++, DISASM_CODE); - operandAddress |= ((uInt16)peek(PC++, DISASM_CODE) << 8); + operandAddress |= (uInt16(peek(PC++, DISASM_CODE)) << 8); operand = peek(operandAddress, DISASM_DATA); poke(operandAddress, operand); } @@ -2630,8 +2630,8 @@ break; case 0x5e: { uInt16 low = peek(PC++, DISASM_CODE); - uInt16 high = ((uInt16)peek(PC++, DISASM_CODE) << 8); - peek(high | (uInt8)(low + X), DISASM_DATA); + uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8); + peek(high | uInt8(low + X), DISASM_DATA); operandAddress = (high | low) + X; operand = peek(operandAddress, DISASM_DATA); poke(operandAddress, operand); @@ -2720,7 +2720,7 @@ break; case 0x0c: { intermediateAddress = peek(PC++, DISASM_CODE); - intermediateAddress |= ((uInt16)peek(PC++, DISASM_CODE) << 8); + intermediateAddress |= (uInt16(peek(PC++, DISASM_CODE)) << 8); operand = peek(intermediateAddress, DISASM_DATA); } { @@ -2735,8 +2735,8 @@ case 0xdc: case 0xfc: { uInt16 low = peek(PC++, DISASM_CODE); - uInt16 high = ((uInt16)peek(PC++, DISASM_CODE) << 8); - intermediateAddress = high | (uInt8)(low + X); + uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8); + intermediateAddress = high | uInt8(low + X); operand = peek(intermediateAddress, DISASM_DATA); if((low + X) > 0xFF) { @@ -2794,7 +2794,7 @@ break; case 0x0d: { intermediateAddress = peek(PC++, DISASM_CODE); - intermediateAddress |= ((uInt16)peek(PC++, DISASM_CODE) << 8); + intermediateAddress |= (uInt16(peek(PC++, DISASM_CODE)) << 8); operand = peek(intermediateAddress, DISASM_DATA); } SET_LAST_PEEK(myLastSrcAddressA, intermediateAddress) @@ -2808,8 +2808,8 @@ break; case 0x1d: { uInt16 low = peek(PC++, DISASM_CODE); - uInt16 high = ((uInt16)peek(PC++, DISASM_CODE) << 8); - intermediateAddress = high | (uInt8)(low + X); + uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8); + intermediateAddress = high | uInt8(low + X); operand = peek(intermediateAddress, DISASM_DATA); if((low + X) > 0xFF) { @@ -2828,8 +2828,8 @@ break; case 0x19: { uInt16 low = peek(PC++, DISASM_CODE); - uInt16 high = ((uInt16)peek(PC++, DISASM_CODE) << 8); - intermediateAddress = high | (uInt8)(low + Y); + uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8); + intermediateAddress = high | uInt8(low + Y); operand = peek(intermediateAddress, DISASM_DATA); if((low + Y) > 0xFF) { @@ -2851,7 +2851,7 @@ case 0x01: peek(pointer, DISASM_DATA); pointer += X; intermediateAddress = peek(pointer++, DISASM_DATA); - intermediateAddress |= ((uInt16)peek(pointer, DISASM_DATA) << 8); + intermediateAddress |= (uInt16(peek(pointer, DISASM_DATA)) << 8); operand = peek(intermediateAddress, DISASM_DATA); } SET_LAST_PEEK(myLastSrcAddressA, intermediateAddress) @@ -2866,8 +2866,8 @@ case 0x11: { uInt8 pointer = peek(PC++, DISASM_CODE); uInt16 low = peek(pointer++, DISASM_DATA); - uInt16 high = ((uInt16)peek(pointer, DISASM_DATA) << 8); - intermediateAddress = high | (uInt8)(low + Y); + uInt16 high = (uInt16(peek(pointer, DISASM_DATA)) << 8); + intermediateAddress = high | uInt8(low + Y); operand = peek(intermediateAddress, DISASM_DATA); if((low + Y) > 0xFF) { @@ -2936,7 +2936,7 @@ break; case 0x2f: { operandAddress = peek(PC++, DISASM_CODE); - operandAddress |= ((uInt16)peek(PC++, DISASM_CODE) << 8); + operandAddress |= (uInt16(peek(PC++, DISASM_CODE)) << 8); operand = peek(operandAddress, DISASM_DATA); poke(operandAddress, operand); } @@ -2954,8 +2954,8 @@ break; case 0x3f: { uInt16 low = peek(PC++, DISASM_CODE); - uInt16 high = ((uInt16)peek(PC++, DISASM_CODE) << 8); - peek(high | (uInt8)(low + X), DISASM_DATA); + uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8); + peek(high | uInt8(low + X), DISASM_DATA); operandAddress = (high | low) + X; operand = peek(operandAddress, DISASM_DATA); poke(operandAddress, operand); @@ -2974,8 +2974,8 @@ break; case 0x3b: { uInt16 low = peek(PC++, DISASM_CODE); - uInt16 high = ((uInt16)peek(PC++, DISASM_CODE) << 8); - peek(high | (uInt8)(low + Y), DISASM_DATA); + uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8); + peek(high | uInt8(low + Y), DISASM_DATA); operandAddress = (high | low) + Y; operand = peek(operandAddress, DISASM_DATA); poke(operandAddress, operand); @@ -3033,7 +3033,7 @@ case 0x23: peek(pointer, DISASM_DATA); pointer += X; operandAddress = peek(pointer++, DISASM_DATA); - operandAddress |= ((uInt16)peek(pointer, DISASM_DATA) << 8); + operandAddress |= (uInt16(peek(pointer, DISASM_DATA)) << 8); operand = peek(operandAddress, DISASM_DATA); poke(operandAddress, operand); } @@ -3052,8 +3052,8 @@ case 0x33: { uInt8 pointer = peek(PC++, DISASM_CODE); uInt16 low = peek(pointer++, DISASM_DATA); - uInt16 high = ((uInt16)peek(pointer, DISASM_DATA) << 8); - peek(high | (uInt8)(low + Y), DISASM_DATA); + uInt16 high = (uInt16(peek(pointer, DISASM_DATA)) << 8); + peek(high | uInt8(low + Y), DISASM_DATA); operandAddress = (high | low) + Y; operand = peek(operandAddress, DISASM_DATA); poke(operandAddress, operand); @@ -3133,7 +3133,7 @@ break; case 0x2e: { operandAddress = peek(PC++, DISASM_CODE); - operandAddress |= ((uInt16)peek(PC++, DISASM_CODE) << 8); + operandAddress |= (uInt16(peek(PC++, DISASM_CODE)) << 8); operand = peek(operandAddress, DISASM_DATA); poke(operandAddress, operand); } @@ -3154,8 +3154,8 @@ break; case 0x3e: { uInt16 low = peek(PC++, DISASM_CODE); - uInt16 high = ((uInt16)peek(PC++, DISASM_CODE) << 8); - peek(high | (uInt8)(low + X), DISASM_DATA); + uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8); + peek(high | uInt8(low + X), DISASM_DATA); operandAddress = (high | low) + X; operand = peek(operandAddress, DISASM_DATA); poke(operandAddress, operand); @@ -3237,7 +3237,7 @@ break; case 0x6e: { operandAddress = peek(PC++, DISASM_CODE); - operandAddress |= ((uInt16)peek(PC++, DISASM_CODE) << 8); + operandAddress |= (uInt16(peek(PC++, DISASM_CODE)) << 8); operand = peek(operandAddress, DISASM_DATA); poke(operandAddress, operand); } @@ -3258,8 +3258,8 @@ break; case 0x7e: { uInt16 low = peek(PC++, DISASM_CODE); - uInt16 high = ((uInt16)peek(PC++, DISASM_CODE) << 8); - peek(high | (uInt8)(low + X), DISASM_DATA); + uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8); + peek(high | uInt8(low + X), DISASM_DATA); operandAddress = (high | low) + X; operand = peek(operandAddress, DISASM_DATA); poke(operandAddress, operand); @@ -3282,7 +3282,7 @@ break; case 0x6f: { operandAddress = peek(PC++, DISASM_CODE); - operandAddress |= ((uInt16)peek(PC++, DISASM_CODE) << 8); + operandAddress |= (uInt16(peek(PC++, DISASM_CODE)) << 8); operand = peek(operandAddress, DISASM_DATA); poke(operandAddress, operand); } @@ -3303,7 +3303,7 @@ case 0x6f: notZ = sum & 0xff; C = sum & 0xff00; - A = (uInt8) sum; + A = uInt8(sum); } else { @@ -3329,8 +3329,8 @@ break; case 0x7f: { uInt16 low = peek(PC++, DISASM_CODE); - uInt16 high = ((uInt16)peek(PC++, DISASM_CODE) << 8); - peek(high | (uInt8)(low + X), DISASM_DATA); + uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8); + peek(high | uInt8(low + X), DISASM_DATA); operandAddress = (high | low) + X; operand = peek(operandAddress, DISASM_DATA); poke(operandAddress, operand); @@ -3352,7 +3352,7 @@ case 0x7f: notZ = sum & 0xff; C = sum & 0xff00; - A = (uInt8) sum; + A = uInt8(sum); } else { @@ -3378,8 +3378,8 @@ break; case 0x7b: { uInt16 low = peek(PC++, DISASM_CODE); - uInt16 high = ((uInt16)peek(PC++, DISASM_CODE) << 8); - peek(high | (uInt8)(low + Y), DISASM_DATA); + uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8); + peek(high | uInt8(low + Y), DISASM_DATA); operandAddress = (high | low) + Y; operand = peek(operandAddress, DISASM_DATA); poke(operandAddress, operand); @@ -3401,7 +3401,7 @@ case 0x7b: notZ = sum & 0xff; C = sum & 0xff00; - A = (uInt8) sum; + A = uInt8(sum); } else { @@ -3447,7 +3447,7 @@ case 0x67: notZ = sum & 0xff; C = sum & 0xff00; - A = (uInt8) sum; + A = uInt8(sum); } else { @@ -3495,7 +3495,7 @@ case 0x77: notZ = sum & 0xff; C = sum & 0xff00; - A = (uInt8) sum; + A = uInt8(sum); } else { @@ -3524,7 +3524,7 @@ case 0x63: peek(pointer, DISASM_DATA); pointer += X; operandAddress = peek(pointer++, DISASM_DATA); - operandAddress |= ((uInt16)peek(pointer, DISASM_DATA) << 8); + operandAddress |= (uInt16(peek(pointer, DISASM_DATA)) << 8); operand = peek(operandAddress, DISASM_DATA); poke(operandAddress, operand); } @@ -3545,7 +3545,7 @@ case 0x63: notZ = sum & 0xff; C = sum & 0xff00; - A = (uInt8) sum; + A = uInt8(sum); } else { @@ -3572,8 +3572,8 @@ case 0x73: { uInt8 pointer = peek(PC++, DISASM_CODE); uInt16 low = peek(pointer++, DISASM_DATA); - uInt16 high = ((uInt16)peek(pointer, DISASM_DATA) << 8); - peek(high | (uInt8)(low + Y), DISASM_DATA); + uInt16 high = (uInt16(peek(pointer, DISASM_DATA)) << 8); + peek(high | uInt8(low + Y), DISASM_DATA); operandAddress = (high | low) + Y; operand = peek(operandAddress, DISASM_DATA); poke(operandAddress, operand); @@ -3595,7 +3595,7 @@ case 0x73: notZ = sum & 0xff; C = sum & 0xff00; - A = (uInt8) sum; + A = uInt8(sum); } else { @@ -3627,7 +3627,7 @@ case 0x40: peek(0x0100 + SP++, DISASM_NONE); PS(peek(0x0100 + SP++, DISASM_NONE)); PC = peek(0x0100 + SP++, DISASM_NONE); - PC |= ((uInt16)peek(0x0100 + SP, DISASM_NONE) << 8); + PC |= (uInt16(peek(0x0100 + SP, DISASM_NONE)) << 8); } break; @@ -3639,7 +3639,7 @@ case 0x60: { peek(0x0100 + SP++, DISASM_NONE); PC = peek(0x0100 + SP++, DISASM_NONE); - PC |= ((uInt16)peek(0x0100 + SP, DISASM_NONE) << 8); + PC |= (uInt16(peek(0x0100 + SP, DISASM_NONE)) << 8); peek(PC++, DISASM_CODE); } break; @@ -3648,7 +3648,7 @@ break; case 0x8f: { operandAddress = peek(PC++, DISASM_CODE); - operandAddress |= ((uInt16)peek(PC++, DISASM_CODE) << 8); + operandAddress |= (uInt16(peek(PC++, DISASM_CODE)) << 8); } { poke(operandAddress, A & X); @@ -3681,7 +3681,7 @@ case 0x83: peek(pointer, DISASM_DATA); pointer += X; operandAddress = peek(pointer++, DISASM_DATA); - operandAddress |= ((uInt16)peek(pointer, DISASM_DATA) << 8); + operandAddress |= (uInt16(peek(pointer, DISASM_DATA)) << 8); } { poke(operandAddress, A & X); @@ -3703,7 +3703,7 @@ case 0xeb: if(!D) { - A = (uInt8) sum; + A = uInt8(sum); } else { @@ -3737,7 +3737,7 @@ case 0xe5: if(!D) { - A = (uInt8) sum; + A = uInt8(sum); } else { @@ -3773,7 +3773,7 @@ case 0xf5: if(!D) { - A = (uInt8) sum; + A = uInt8(sum); } else { @@ -3796,7 +3796,7 @@ break; case 0xed: { intermediateAddress = peek(PC++, DISASM_CODE); - intermediateAddress |= ((uInt16)peek(PC++, DISASM_CODE) << 8); + intermediateAddress |= (uInt16(peek(PC++, DISASM_CODE)) << 8); operand = peek(intermediateAddress, DISASM_DATA); } { @@ -3808,7 +3808,7 @@ case 0xed: if(!D) { - A = (uInt8) sum; + A = uInt8(sum); } else { @@ -3831,8 +3831,8 @@ break; case 0xfd: { uInt16 low = peek(PC++, DISASM_CODE); - uInt16 high = ((uInt16)peek(PC++, DISASM_CODE) << 8); - intermediateAddress = high | (uInt8)(low + X); + uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8); + intermediateAddress = high | uInt8(low + X); operand = peek(intermediateAddress, DISASM_DATA); if((low + X) > 0xFF) { @@ -3849,7 +3849,7 @@ case 0xfd: if(!D) { - A = (uInt8) sum; + A = uInt8(sum); } else { @@ -3872,8 +3872,8 @@ break; case 0xf9: { uInt16 low = peek(PC++, DISASM_CODE); - uInt16 high = ((uInt16)peek(PC++, DISASM_CODE) << 8); - intermediateAddress = high | (uInt8)(low + Y); + uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8); + intermediateAddress = high | uInt8(low + Y); operand = peek(intermediateAddress, DISASM_DATA); if((low + Y) > 0xFF) { @@ -3890,7 +3890,7 @@ case 0xf9: if(!D) { - A = (uInt8) sum; + A = uInt8(sum); } else { @@ -3916,7 +3916,7 @@ case 0xe1: peek(pointer, DISASM_DATA); pointer += X; intermediateAddress = peek(pointer++, DISASM_DATA); - intermediateAddress |= ((uInt16)peek(pointer, DISASM_DATA) << 8); + intermediateAddress |= (uInt16(peek(pointer, DISASM_DATA)) << 8); operand = peek(intermediateAddress, DISASM_DATA); } { @@ -3928,7 +3928,7 @@ case 0xe1: if(!D) { - A = (uInt8) sum; + A = uInt8(sum); } else { @@ -3952,8 +3952,8 @@ case 0xf1: { uInt8 pointer = peek(PC++, DISASM_CODE); uInt16 low = peek(pointer++, DISASM_DATA); - uInt16 high = ((uInt16)peek(pointer, DISASM_DATA) << 8); - intermediateAddress = high | (uInt8)(low + Y); + uInt16 high = (uInt16(peek(pointer, DISASM_DATA)) << 8); + intermediateAddress = high | uInt8(low + Y); operand = peek(intermediateAddress, DISASM_DATA); if((low + Y) > 0xFF) { @@ -3970,7 +3970,7 @@ case 0xf1: if(!D) { - A = (uInt8) sum; + A = uInt8(sum); } else { @@ -3996,7 +3996,7 @@ case 0xcb: operand = peek(PC++, DISASM_CODE); } { - uInt16 value = (uInt16)(X & A) - (uInt16)operand; + uInt16 value = uInt16(X & A) - uInt16(operand); X = (value & 0xff); notZ = X; @@ -4039,8 +4039,8 @@ break; case 0x9f: { uInt16 low = peek(PC++, DISASM_CODE); - uInt16 high = ((uInt16)peek(PC++, DISASM_CODE) << 8); - peek(high | (uInt8)(low + Y), DISASM_DATA); + uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8); + peek(high | uInt8(low + Y), DISASM_DATA); operandAddress = (high | low) + Y; } { @@ -4054,8 +4054,8 @@ case 0x93: { uInt8 pointer = peek(PC++, DISASM_CODE); uInt16 low = peek(pointer++, DISASM_DATA); - uInt16 high = ((uInt16)peek(pointer, DISASM_DATA) << 8); - peek(high | (uInt8)(low + Y), DISASM_DATA); + uInt16 high = (uInt16(peek(pointer, DISASM_DATA)) << 8); + peek(high | uInt8(low + Y), DISASM_DATA); operandAddress = (high | low) + Y; } { @@ -4069,8 +4069,8 @@ break; case 0x9b: { uInt16 low = peek(PC++, DISASM_CODE); - uInt16 high = ((uInt16)peek(PC++, DISASM_CODE) << 8); - peek(high | (uInt8)(low + Y), DISASM_DATA); + uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8); + peek(high | uInt8(low + Y), DISASM_DATA); operandAddress = (high | low) + Y; } { @@ -4085,8 +4085,8 @@ break; case 0x9e: { uInt16 low = peek(PC++, DISASM_CODE); - uInt16 high = ((uInt16)peek(PC++, DISASM_CODE) << 8); - peek(high | (uInt8)(low + Y), DISASM_DATA); + uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8); + peek(high | uInt8(low + Y), DISASM_DATA); operandAddress = (high | low) + Y; } { @@ -4100,8 +4100,8 @@ break; case 0x9c: { uInt16 low = peek(PC++, DISASM_CODE); - uInt16 high = ((uInt16)peek(PC++, DISASM_CODE) << 8); - peek(high | (uInt8)(low + X), DISASM_DATA); + uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8); + peek(high | uInt8(low + X), DISASM_DATA); operandAddress = (high | low) + X; } { @@ -4115,7 +4115,7 @@ break; case 0x0f: { operandAddress = peek(PC++, DISASM_CODE); - operandAddress |= ((uInt16)peek(PC++, DISASM_CODE) << 8); + operandAddress |= (uInt16(peek(PC++, DISASM_CODE)) << 8); operand = peek(operandAddress, DISASM_DATA); poke(operandAddress, operand); } @@ -4135,8 +4135,8 @@ break; case 0x1f: { uInt16 low = peek(PC++, DISASM_CODE); - uInt16 high = ((uInt16)peek(PC++, DISASM_CODE) << 8); - peek(high | (uInt8)(low + X), DISASM_DATA); + uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8); + peek(high | uInt8(low + X), DISASM_DATA); operandAddress = (high | low) + X; operand = peek(operandAddress, DISASM_DATA); poke(operandAddress, operand); @@ -4157,8 +4157,8 @@ break; case 0x1b: { uInt16 low = peek(PC++, DISASM_CODE); - uInt16 high = ((uInt16)peek(PC++, DISASM_CODE) << 8); - peek(high | (uInt8)(low + Y), DISASM_DATA); + uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8); + peek(high | uInt8(low + Y), DISASM_DATA); operandAddress = (high | low) + Y; operand = peek(operandAddress, DISASM_DATA); poke(operandAddress, operand); @@ -4222,7 +4222,7 @@ case 0x03: peek(pointer, DISASM_DATA); pointer += X; operandAddress = peek(pointer++, DISASM_DATA); - operandAddress |= ((uInt16)peek(pointer, DISASM_DATA) << 8); + operandAddress |= (uInt16(peek(pointer, DISASM_DATA)) << 8); operand = peek(operandAddress, DISASM_DATA); poke(operandAddress, operand); } @@ -4243,8 +4243,8 @@ case 0x13: { uInt8 pointer = peek(PC++, DISASM_CODE); uInt16 low = peek(pointer++, DISASM_DATA); - uInt16 high = ((uInt16)peek(pointer, DISASM_DATA) << 8); - peek(high | (uInt8)(low + Y), DISASM_DATA); + uInt16 high = (uInt16(peek(pointer, DISASM_DATA)) << 8); + peek(high | uInt8(low + Y), DISASM_DATA); operandAddress = (high | low) + Y; operand = peek(operandAddress, DISASM_DATA); poke(operandAddress, operand); @@ -4266,7 +4266,7 @@ break; case 0x4f: { operandAddress = peek(PC++, DISASM_CODE); - operandAddress |= ((uInt16)peek(PC++, DISASM_CODE) << 8); + operandAddress |= (uInt16(peek(PC++, DISASM_CODE)) << 8); operand = peek(operandAddress, DISASM_DATA); poke(operandAddress, operand); } @@ -4286,8 +4286,8 @@ break; case 0x5f: { uInt16 low = peek(PC++, DISASM_CODE); - uInt16 high = ((uInt16)peek(PC++, DISASM_CODE) << 8); - peek(high | (uInt8)(low + X), DISASM_DATA); + uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8); + peek(high | uInt8(low + X), DISASM_DATA); operandAddress = (high | low) + X; operand = peek(operandAddress, DISASM_DATA); poke(operandAddress, operand); @@ -4308,8 +4308,8 @@ break; case 0x5b: { uInt16 low = peek(PC++, DISASM_CODE); - uInt16 high = ((uInt16)peek(PC++, DISASM_CODE) << 8); - peek(high | (uInt8)(low + Y), DISASM_DATA); + uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8); + peek(high | uInt8(low + Y), DISASM_DATA); operandAddress = (high | low) + Y; operand = peek(operandAddress, DISASM_DATA); poke(operandAddress, operand); @@ -4373,7 +4373,7 @@ case 0x43: peek(pointer, DISASM_DATA); pointer += X; operandAddress = peek(pointer++, DISASM_DATA); - operandAddress |= ((uInt16)peek(pointer, DISASM_DATA) << 8); + operandAddress |= (uInt16(peek(pointer, DISASM_DATA)) << 8); operand = peek(operandAddress, DISASM_DATA); poke(operandAddress, operand); } @@ -4394,8 +4394,8 @@ case 0x53: { uInt8 pointer = peek(PC++, DISASM_CODE); uInt16 low = peek(pointer++, DISASM_DATA); - uInt16 high = ((uInt16)peek(pointer, DISASM_DATA) << 8); - peek(high | (uInt8)(low + Y), DISASM_DATA); + uInt16 high = (uInt16(peek(pointer, DISASM_DATA)) << 8); + peek(high | uInt8(low + Y), DISASM_DATA); operandAddress = (high | low) + Y; operand = peek(operandAddress, DISASM_DATA); poke(operandAddress, operand); @@ -4440,7 +4440,7 @@ break; case 0x8d: { operandAddress = peek(PC++, DISASM_CODE); - operandAddress |= ((uInt16)peek(PC++, DISASM_CODE) << 8); + operandAddress |= (uInt16(peek(PC++, DISASM_CODE)) << 8); } { poke(operandAddress, A); @@ -4450,8 +4450,8 @@ break; case 0x9d: { uInt16 low = peek(PC++, DISASM_CODE); - uInt16 high = ((uInt16)peek(PC++, DISASM_CODE) << 8); - peek(high | (uInt8)(low + X), DISASM_DATA); + uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8); + peek(high | uInt8(low + X), DISASM_DATA); operandAddress = (high | low) + X; } { @@ -4462,8 +4462,8 @@ break; case 0x99: { uInt16 low = peek(PC++, DISASM_CODE); - uInt16 high = ((uInt16)peek(PC++, DISASM_CODE) << 8); - peek(high | (uInt8)(low + Y), DISASM_DATA); + uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8); + peek(high | uInt8(low + Y), DISASM_DATA); operandAddress = (high | low) + Y; } { @@ -4477,7 +4477,7 @@ case 0x81: peek(pointer, DISASM_DATA); pointer += X; operandAddress = peek(pointer++, DISASM_DATA); - operandAddress |= ((uInt16)peek(pointer, DISASM_DATA) << 8); + operandAddress |= (uInt16(peek(pointer, DISASM_DATA)) << 8); } { poke(operandAddress, A); @@ -4488,8 +4488,8 @@ case 0x91: { uInt8 pointer = peek(PC++, DISASM_CODE); uInt16 low = peek(pointer++, DISASM_DATA); - uInt16 high = ((uInt16)peek(pointer, DISASM_DATA) << 8); - peek(high | (uInt8)(low + Y), DISASM_DATA); + uInt16 high = (uInt16(peek(pointer, DISASM_DATA)) << 8); + peek(high | uInt8(low + Y), DISASM_DATA); operandAddress = (high | low) + Y; } { @@ -4525,7 +4525,7 @@ break; case 0x8e: { operandAddress = peek(PC++, DISASM_CODE); - operandAddress |= ((uInt16)peek(PC++, DISASM_CODE) << 8); + operandAddress |= (uInt16(peek(PC++, DISASM_CODE)) << 8); } { poke(operandAddress, X); @@ -4560,7 +4560,7 @@ break; case 0x8c: { operandAddress = peek(PC++, DISASM_CODE); - operandAddress |= ((uInt16)peek(PC++, DISASM_CODE) << 8); + operandAddress |= (uInt16(peek(PC++, DISASM_CODE)) << 8); } { poke(operandAddress, Y); diff --git a/src/emucore/M6502.m4 b/src/emucore/M6502.m4 index 46ddba99d..b34dd6a9b 100644 --- a/src/emucore/M6502.m4 +++ b/src/emucore/M6502.m4 @@ -63,26 +63,26 @@ define(M6502_IMMEDIATE_READ, `{ define(M6502_ABSOLUTE_READ, `{ intermediateAddress = peek(PC++, DISASM_CODE); - intermediateAddress |= ((uInt16)peek(PC++, DISASM_CODE) << 8); + intermediateAddress |= (uInt16(peek(PC++, DISASM_CODE)) << 8); operand = peek(intermediateAddress, DISASM_DATA); }') define(M6502_ABSOLUTE_WRITE, `{ operandAddress = peek(PC++, DISASM_CODE); - operandAddress |= ((uInt16)peek(PC++, DISASM_CODE) << 8); + operandAddress |= (uInt16(peek(PC++, DISASM_CODE)) << 8); }') define(M6502_ABSOLUTE_READMODIFYWRITE, `{ operandAddress = peek(PC++, DISASM_CODE); - operandAddress |= ((uInt16)peek(PC++, DISASM_CODE) << 8); + operandAddress |= (uInt16(peek(PC++, DISASM_CODE)) << 8); operand = peek(operandAddress, DISASM_DATA); poke(operandAddress, operand); }') define(M6502_ABSOLUTEX_READ, `{ uInt16 low = peek(PC++, DISASM_CODE); - uInt16 high = ((uInt16)peek(PC++, DISASM_CODE) << 8); - intermediateAddress = high | (uInt8)(low + X); + uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8); + intermediateAddress = high | uInt8(low + X); operand = peek(intermediateAddress, DISASM_DATA); if((low + X) > 0xFF) { @@ -93,15 +93,15 @@ define(M6502_ABSOLUTEX_READ, `{ define(M6502_ABSOLUTEX_WRITE, `{ uInt16 low = peek(PC++, DISASM_CODE); - uInt16 high = ((uInt16)peek(PC++, DISASM_CODE) << 8); - peek(high | (uInt8)(low + X), DISASM_DATA); + uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8); + peek(high | uInt8(low + X), DISASM_DATA); operandAddress = (high | low) + X; }') define(M6502_ABSOLUTEX_READMODIFYWRITE, `{ uInt16 low = peek(PC++, DISASM_CODE); - uInt16 high = ((uInt16)peek(PC++, DISASM_CODE) << 8); - peek(high | (uInt8)(low + X), DISASM_DATA); + uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8); + peek(high | uInt8(low + X), DISASM_DATA); operandAddress = (high | low) + X; operand = peek(operandAddress, DISASM_DATA); poke(operandAddress, operand); @@ -109,8 +109,8 @@ define(M6502_ABSOLUTEX_READMODIFYWRITE, `{ define(M6502_ABSOLUTEY_READ, `{ uInt16 low = peek(PC++, DISASM_CODE); - uInt16 high = ((uInt16)peek(PC++, DISASM_CODE) << 8); - intermediateAddress = high | (uInt8)(low + Y); + uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8); + intermediateAddress = high | uInt8(low + Y); operand = peek(intermediateAddress, DISASM_DATA); if((low + Y) > 0xFF) { @@ -121,15 +121,15 @@ define(M6502_ABSOLUTEY_READ, `{ define(M6502_ABSOLUTEY_WRITE, `{ uInt16 low = peek(PC++, DISASM_CODE); - uInt16 high = ((uInt16)peek(PC++, DISASM_CODE) << 8); - peek(high | (uInt8)(low + Y), DISASM_DATA); + uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8); + peek(high | uInt8(low + Y), DISASM_DATA); operandAddress = (high | low) + Y; }') define(M6502_ABSOLUTEY_READMODIFYWRITE, `{ uInt16 low = peek(PC++, DISASM_CODE); - uInt16 high = ((uInt16)peek(PC++, DISASM_CODE) << 8); - peek(high | (uInt8)(low + Y), DISASM_DATA); + uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8); + peek(high | uInt8(low + Y), DISASM_DATA); operandAddress = (high | low) + Y; operand = peek(operandAddress, DISASM_DATA); poke(operandAddress, operand); @@ -194,13 +194,13 @@ define(M6502_ZEROY_READMODIFYWRITE, `{ define(M6502_INDIRECT, `{ uInt16 addr = peek(PC++, DISASM_CODE); - addr |= ((uInt16)peek(PC++, DISASM_CODE) << 8); + addr |= (uInt16(peek(PC++, DISASM_CODE)) << 8); // Simulate the error in the indirect addressing mode! uInt16 high = NOTSAMEPAGE(addr, addr + 1) ? (addr & 0xff00) : (addr + 1); operandAddress = peek(addr, DISASM_DATA); - operandAddress |= ((uInt16)peek(high, DISASM_DATA) << 8); + operandAddress |= (uInt16(peek(high, DISASM_DATA)) << 8); }') define(M6502_INDIRECTX_READ, `{ @@ -208,7 +208,7 @@ define(M6502_INDIRECTX_READ, `{ peek(pointer, DISASM_DATA); pointer += X; intermediateAddress = peek(pointer++, DISASM_DATA); - intermediateAddress |= ((uInt16)peek(pointer, DISASM_DATA) << 8); + intermediateAddress |= (uInt16(peek(pointer, DISASM_DATA)) << 8); operand = peek(intermediateAddress, DISASM_DATA); }') @@ -217,7 +217,7 @@ define(M6502_INDIRECTX_WRITE, `{ peek(pointer, DISASM_DATA); pointer += X; operandAddress = peek(pointer++, DISASM_DATA); - operandAddress |= ((uInt16)peek(pointer, DISASM_DATA) << 8); + operandAddress |= (uInt16(peek(pointer, DISASM_DATA)) << 8); }') define(M6502_INDIRECTX_READMODIFYWRITE, `{ @@ -225,7 +225,7 @@ define(M6502_INDIRECTX_READMODIFYWRITE, `{ peek(pointer, DISASM_DATA); pointer += X; operandAddress = peek(pointer++, DISASM_DATA); - operandAddress |= ((uInt16)peek(pointer, DISASM_DATA) << 8); + operandAddress |= (uInt16(peek(pointer, DISASM_DATA)) << 8); operand = peek(operandAddress, DISASM_DATA); poke(operandAddress, operand); }') @@ -233,8 +233,8 @@ define(M6502_INDIRECTX_READMODIFYWRITE, `{ define(M6502_INDIRECTY_READ, `{ uInt8 pointer = peek(PC++, DISASM_CODE); uInt16 low = peek(pointer++, DISASM_DATA); - uInt16 high = ((uInt16)peek(pointer, DISASM_DATA) << 8); - intermediateAddress = high | (uInt8)(low + Y); + uInt16 high = (uInt16(peek(pointer, DISASM_DATA)) << 8); + intermediateAddress = high | uInt8(low + Y); operand = peek(intermediateAddress, DISASM_DATA); if((low + Y) > 0xFF) { @@ -246,16 +246,16 @@ define(M6502_INDIRECTY_READ, `{ define(M6502_INDIRECTY_WRITE, `{ uInt8 pointer = peek(PC++, DISASM_CODE); uInt16 low = peek(pointer++, DISASM_DATA); - uInt16 high = ((uInt16)peek(pointer, DISASM_DATA) << 8); - peek(high | (uInt8)(low + Y), DISASM_DATA); + uInt16 high = (uInt16(peek(pointer, DISASM_DATA)) << 8); + peek(high | uInt8(low + Y), DISASM_DATA); operandAddress = (high | low) + Y; }') define(M6502_INDIRECTY_READMODIFYWRITE, `{ uInt8 pointer = peek(PC++, DISASM_CODE); uInt16 low = peek(pointer++, DISASM_DATA); - uInt16 high = ((uInt16)peek(pointer, DISASM_DATA) << 8); - peek(high | (uInt8)(low + Y), DISASM_DATA); + uInt16 high = (uInt16(peek(pointer, DISASM_DATA)) << 8); + peek(high | uInt8(low + Y), DISASM_DATA); operandAddress = (high | low) + Y; operand = peek(operandAddress, DISASM_DATA); poke(operandAddress, operand); @@ -266,7 +266,7 @@ define(M6502_BCC, `{ if(!C) { peek(PC, DISASM_NONE); - uInt16 address = PC + (Int8)operand; + uInt16 address = PC + Int8(operand); if(NOTSAMEPAGE(PC, address)) peek((PC & 0xFF00) | (address & 0x00FF), DISASM_NONE); PC = address; @@ -277,7 +277,7 @@ define(M6502_BCS, `{ if(C) { peek(PC, DISASM_NONE); - uInt16 address = PC + (Int8)operand; + uInt16 address = PC + Int8(operand); if(NOTSAMEPAGE(PC, address)) peek((PC & 0xFF00) | (address & 0x00FF), DISASM_NONE); PC = address; @@ -288,7 +288,7 @@ define(M6502_BEQ, `{ if(!notZ) { peek(PC, DISASM_NONE); - uInt16 address = PC + (Int8)operand; + uInt16 address = PC + Int8(operand); if(NOTSAMEPAGE(PC, address)) peek((PC & 0xFF00) | (address & 0x00FF), DISASM_NONE); PC = address; @@ -299,7 +299,7 @@ define(M6502_BMI, `{ if(N) { peek(PC, DISASM_NONE); - uInt16 address = PC + (Int8)operand; + uInt16 address = PC + Int8(operand); if(NOTSAMEPAGE(PC, address)) peek((PC & 0xFF00) | (address & 0x00FF), DISASM_NONE); PC = address; @@ -310,7 +310,7 @@ define(M6502_BNE, `{ if(notZ) { peek(PC, DISASM_NONE); - uInt16 address = PC + (Int8)operand; + uInt16 address = PC + Int8(operand); if(NOTSAMEPAGE(PC, address)) peek((PC & 0xFF00) | (address & 0x00FF), DISASM_NONE); PC = address; @@ -321,7 +321,7 @@ define(M6502_BPL, `{ if(!N) { peek(PC, DISASM_NONE); - uInt16 address = PC + (Int8)operand; + uInt16 address = PC + Int8(operand); if(NOTSAMEPAGE(PC, address)) peek((PC & 0xFF00) | (address & 0x00FF), DISASM_NONE); PC = address; @@ -332,7 +332,7 @@ define(M6502_BVC, `{ if(!V) { peek(PC, DISASM_NONE); - uInt16 address = PC + (Int8)operand; + uInt16 address = PC + Int8(operand); if(NOTSAMEPAGE(PC, address)) peek((PC & 0xFF00) | (address & 0x00FF), DISASM_NONE); PC = address; @@ -343,7 +343,7 @@ define(M6502_BVS, `{ if(V) { peek(PC, DISASM_NONE); - uInt16 address = PC + (Int8)operand; + uInt16 address = PC + Int8(operand); if(NOTSAMEPAGE(PC, address)) peek((PC & 0xFF00) | (address & 0x00FF), DISASM_NONE); PC = address; @@ -359,7 +359,7 @@ define(M6502_ADC, `{ notZ = sum & 0xff; C = sum & 0xff00; - A = (uInt8) sum; + A = uInt8(sum); } else { @@ -495,7 +495,7 @@ define(M6502_BRK, `{ I = true; PC = peek(0xfffe, DISASM_NONE); - PC |= ((uInt16)peek(0xffff, DISASM_NONE) << 8); + PC |= (uInt16(peek(0xffff, DISASM_NONE)) << 8); }') define(M6502_CLC, `{ @@ -515,7 +515,7 @@ define(M6502_CLV, `{ }') define(M6502_CMP, `{ - uInt16 value = (uInt16)A - (uInt16)operand; + uInt16 value = uInt16(A) - uInt16(operand); notZ = value; N = value & 0x0080; @@ -523,7 +523,7 @@ define(M6502_CMP, `{ }') define(M6502_CPX, `{ - uInt16 value = (uInt16)X - (uInt16)operand; + uInt16 value = uInt16(X) - uInt16(operand); notZ = value; N = value & 0x0080; @@ -531,7 +531,7 @@ define(M6502_CPX, `{ }') define(M6502_CPY, `{ - uInt16 value = (uInt16)Y - (uInt16)operand; + uInt16 value = uInt16(Y) - uInt16(operand); notZ = value; N = value & 0x0080; @@ -542,7 +542,7 @@ define(M6502_DCP, `{ uInt8 value = operand - 1; poke(operandAddress, value); - uInt16 value2 = (uInt16)A - (uInt16)value; + uInt16 value2 = uInt16(A) - uInt16(value); notZ = value2; N = value2 & 0x0080; C = !(value2 & 0x0100); @@ -609,7 +609,7 @@ define(M6502_ISB, `{ if(!D) { - A = (uInt8) sum; + A = uInt8(sum); } else { @@ -642,7 +642,7 @@ define(M6502_JSR, `{ poke(0x0100 + SP--, PC >> 8); poke(0x0100 + SP--, PC & 0xff); - PC = (low | ((uInt16)peek(PC, DISASM_CODE) << 8)); + PC = (low | (uInt16(peek(PC, DISASM_CODE)) << 8)); }') define(M6502_LAS, `{ @@ -812,7 +812,7 @@ define(M6502_RRA, `{ notZ = sum & 0xff; C = sum & 0xff00; - A = (uInt8) sum; + A = uInt8(sum); } else { @@ -838,13 +838,13 @@ define(M6502_RTI, `{ peek(0x0100 + SP++, DISASM_NONE); PS(peek(0x0100 + SP++, DISASM_NONE)); PC = peek(0x0100 + SP++, DISASM_NONE); - PC |= ((uInt16)peek(0x0100 + SP, DISASM_NONE) << 8); + PC |= (uInt16(peek(0x0100 + SP, DISASM_NONE)) << 8); }') define(M6502_RTS, `{ peek(0x0100 + SP++, DISASM_NONE); PC = peek(0x0100 + SP++, DISASM_NONE); - PC |= ((uInt16)peek(0x0100 + SP, DISASM_NONE) << 8); + PC |= (uInt16(peek(0x0100 + SP, DISASM_NONE)) << 8); peek(PC++, DISASM_CODE); }') @@ -861,7 +861,7 @@ define(M6502_SBC, `{ if(!D) { - A = (uInt8) sum; + A = uInt8(sum); } else { @@ -881,7 +881,7 @@ define(M6502_SBC, `{ }') define(M6502_SBX, `{ - uInt16 value = (uInt16)(X & A) - (uInt16)operand; + uInt16 value = uInt16(X & A) - uInt16(operand); X = (value & 0xff); notZ = X; diff --git a/src/emucore/MT24LC256.cxx b/src/emucore/MT24LC256.cxx index f47b5f9a9..44ed47bf3 100644 --- a/src/emucore/MT24LC256.cxx +++ b/src/emucore/MT24LC256.cxx @@ -78,10 +78,10 @@ MT24LC256::MT24LC256(const string& filename, const System& system) { // Get length of file; it must be 32768 in.seekg(0, ios::end); - if((int)in.tellg() == 32768) + if(in.tellg() == 32768) { in.seekg(0, ios::beg); - in.read((char*)myData, 32768); + in.read(reinterpret_cast(myData), 32768); myDataFileExists = true; } } @@ -100,7 +100,7 @@ MT24LC256::~MT24LC256() { ofstream out(myDataFile, ios_base::binary); if(out.is_open()) - out.write((char*)myData, 32768); + out.write(reinterpret_cast(myData), 32768); } } @@ -258,7 +258,7 @@ void MT24LC256::jpee_clock_fall() { if (!jpee_pptr) { - jpee_packet[0] = (uInt8)jpee_nb; + jpee_packet[0] = uInt8(jpee_nb); if (jpee_smallmode && ((jpee_nb & 0xF0) == 0xA0)) { jpee_packet[1] = (jpee_nb >> 1) & 7; @@ -300,7 +300,7 @@ void MT24LC256::jpee_clock_fall() { if (!jpee_pptr) { - jpee_packet[0] = (uInt8)jpee_nb; + jpee_packet[0] = uInt8(jpee_nb); if (jpee_smallmode) jpee_pptr=2; else @@ -309,7 +309,7 @@ void MT24LC256::jpee_clock_fall() else if (jpee_pptr < 70) { JPEE_LOG1("I2C_SENT(%02X)",jpee_nb & 0xFF); - jpee_packet[jpee_pptr++] = (uInt8)jpee_nb; + jpee_packet[jpee_pptr++] = uInt8(jpee_nb); jpee_address = (jpee_packet[1] << 8) | jpee_packet[2]; if (jpee_pptr > 2) jpee_ad_known = 1; @@ -370,7 +370,7 @@ bool MT24LC256::jpee_timercheck(int mode) if(myTimerActive) { uInt32 elapsed = mySystem.cycles() - myCyclesWhenTimerSet; - myTimerActive = elapsed < (uInt32)(5000000.0 / 838.0); + myTimerActive = elapsed < uInt32(5000000.0 / 838.0); } return myTimerActive; } diff --git a/src/emucore/Props.cxx b/src/emucore/Props.cxx index fa058163c..7342aea83 100644 --- a/src/emucore/Props.cxx +++ b/src/emucore/Props.cxx @@ -255,7 +255,7 @@ PropertyType Properties::getPropertyType(const string& name) { for(int i = 0; i < LastPropType; ++i) if(ourPropertyNames[i] == name) - return (PropertyType)i; + return PropertyType(i); // Otherwise, indicate that the item wasn't found return LastPropType; diff --git a/src/emucore/Settings.cxx b/src/emucore/Settings.cxx index a4db46735..c0e5010f9 100644 --- a/src/emucore/Settings.cxx +++ b/src/emucore/Settings.cxx @@ -569,7 +569,7 @@ int Settings::setInternal(const string& key, const Variant& value, { int idx = -1; - if(pos >= 0 && pos < (int)myInternalSettings.size() && + if(pos >= 0 && pos < int(myInternalSettings.size()) && myInternalSettings[pos].key == key) { idx = pos; @@ -624,7 +624,7 @@ int Settings::setExternal(const string& key, const Variant& value, { int idx = -1; - if(pos >= 0 && pos < (int)myExternalSettings.size() && + if(pos >= 0 && pos < int(myExternalSettings.size()) && myExternalSettings[pos].key == key) { idx = pos; diff --git a/src/emucore/TIA.cxx b/src/emucore/TIA.cxx index 96a9e086d..0dd72b958 100644 --- a/src/emucore/TIA.cxx +++ b/src/emucore/TIA.cxx @@ -377,13 +377,13 @@ bool TIA::load(Serializer& in) if(in.getString() != device) return false; - myClockWhenFrameStarted = (Int32) in.getInt(); - myClockStartDisplay = (Int32) in.getInt(); - myClockStopDisplay = (Int32) in.getInt(); - myClockAtLastUpdate = (Int32) in.getInt(); - myClocksToEndOfScanLine = (Int32) in.getInt(); + myClockWhenFrameStarted = in.getInt(); + myClockStartDisplay = in.getInt(); + myClockStopDisplay = in.getInt(); + myClockAtLastUpdate = in.getInt(); + myClocksToEndOfScanLine = in.getInt(); myScanlineCountForLastFrame = in.getInt(); - myVSYNCFinishClock = (Int32) in.getInt(); + myVSYNCFinishClock = in.getInt(); myEnabledObjects = in.getByte(); myDisabledObjects = in.getByte(); @@ -424,24 +424,24 @@ bool TIA::load(Serializer& in) myCurrentGRP1 = in.getByte(); myDumpEnabled = in.getBool(); - myDumpDisabledCycle = (Int32) in.getInt(); + myDumpDisabledCycle = in.getInt(); - myPOSP0 = (Int16) in.getShort(); - myPOSP1 = (Int16) in.getShort(); - myPOSM0 = (Int16) in.getShort(); - myPOSM1 = (Int16) in.getShort(); - myPOSBL = (Int16) in.getShort(); + myPOSP0 = in.getShort(); + myPOSP1 = in.getShort(); + myPOSM0 = in.getShort(); + myPOSM1 = in.getShort(); + myPOSBL = in.getShort(); - myMotionClockP0 = (Int32) in.getInt(); - myMotionClockP1 = (Int32) in.getInt(); - myMotionClockM0 = (Int32) in.getInt(); - myMotionClockM1 = (Int32) in.getInt(); - myMotionClockBL = (Int32) in.getInt(); + myMotionClockP0 = in.getInt(); + myMotionClockP1 = in.getInt(); + myMotionClockM0 = in.getInt(); + myMotionClockM1 = in.getInt(); + myMotionClockBL = in.getInt(); - myStartP0 = (Int32) in.getInt(); - myStartP1 = (Int32) in.getInt(); - myStartM0 = (Int32) in.getInt(); - myStartM1 = (Int32) in.getInt(); + myStartP0 = in.getInt(); + myStartP1 = in.getInt(); + myStartM0 = in.getInt(); + myStartM1 = in.getInt(); mySuppressP0 = in.getByte(); mySuppressP1 = in.getByte(); @@ -452,8 +452,8 @@ bool TIA::load(Serializer& in) myHMM1mmr = in.getBool(); myHMBLmmr = in.getBool(); - myCurrentHMOVEPos = (Int32) in.getInt(); - myPreviousHMOVEPos = (Int32) in.getInt(); + myCurrentHMOVEPos = in.getInt(); + myPreviousHMOVEPos = in.getInt(); myHMOVEBlankEnabled = in.getBool(); myFrameCounter = in.getInt(); @@ -674,7 +674,7 @@ inline void TIA::endFrame() // Make sure currentFrameBuffer() doesn't return a pointer that // results in memory being accessed outside of the 160*320 bytes // allocated for the frame buffer - if(myNextFrameJitter < -(Int32)(myFrameYStart)) + if(myNextFrameJitter < -Int32(myFrameYStart)) myNextFrameJitter = myFrameYStart; } else if(myNextFrameJitter > 1) @@ -684,7 +684,7 @@ inline void TIA::endFrame() // Make sure currentFrameBuffer() doesn't return a pointer that // results in memory being accessed outside of the 160*320 bytes // allocated for the frame buffer - if(myNextFrameJitter > 320 - (Int32)myFrameYStart - (Int32)myFrameHeight) + if(myNextFrameJitter > 320 - Int32(myFrameYStart) - Int32(myFrameHeight)) myNextFrameJitter = 320 - myFrameYStart - myFrameHeight; } else @@ -1292,7 +1292,7 @@ inline uInt8 TIA::dumpedInputPort(int resistance) else { // Constant here is derived from '1.6 * 0.01e-6 * 228 / 3' - uInt32 needed = (uInt32) + uInt32 needed = uInt32 (1.216e-6 * resistance * myScanlineCountForLastFrame * myFramerate); if((mySystem->cycles() - myDumpDisabledCycle) > needed) return 0x80; @@ -1314,7 +1314,7 @@ uInt8 TIA::peek(uInt16 addr) // valid bits in a TIA read), and selectively enable them uInt8 value = 0x3F & (!myTIAPinsDriven ? mySystem->getDataBusState() : mySystem->getDataBusState(0xFF)); - uInt16 collision = myCollision & (uInt16)myCollisionEnabledMask; + uInt16 collision = myCollision & uInt16(myCollisionEnabledMask); switch(addr & 0x000f) { @@ -1423,7 +1423,7 @@ bool TIA::poke(uInt16 addr, uInt8 value) updateFrame(clock + delay); // If a VSYNC hasn't been generated in time go ahead and end the frame - if(((clock - myClockWhenFrameStarted) / 228) >= (Int32)myMaximumNumberOfScanlines) + if(((clock - myClockWhenFrameStarted) / 228) >= Int32(myMaximumNumberOfScanlines)) { mySystem->m6502().stop(); myPartialFrameFlag = false; @@ -1624,7 +1624,7 @@ bool TIA::poke(uInt16 addr, uInt8 value) case PF1: // Playfield register byte 1 { - myPF = (myPF & 0x000FF00F) | ((uInt32)value << 4); + myPF = (myPF & 0x000FF00F) | (uInt32(value) << 4); if(myPF == 0) myEnabledObjects &= ~PFBit; @@ -1641,7 +1641,7 @@ bool TIA::poke(uInt16 addr, uInt8 value) case PF2: // Playfield register byte 2 { - myPF = (myPF & 0x00000FFF) | ((uInt32)value << 12); + myPF = (myPF & 0x00000FFF) | (uInt32(value) << 12); if(myPF == 0) myEnabledObjects &= ~PFBit; diff --git a/src/emucore/TIASurface.cxx b/src/emucore/TIASurface.cxx index c7f1440fe..aa1ea67c6 100644 --- a/src/emucore/TIASurface.cxx +++ b/src/emucore/TIASurface.cxx @@ -70,14 +70,14 @@ void TIASurface::initialize(const Console& console, const VideoMode& mode) bool p_enable = console.properties().get(Display_Phosphor) == "YES"; int p_blend = atoi(console.properties().get(Display_PPBlend).c_str()); enablePhosphor(p_enable, p_blend); - setNTSC((NTSCFilter::Preset)myOSystem.settings().getInt("tv.filter"), false); + setNTSC(NTSCFilter::Preset(myOSystem.settings().getInt("tv.filter")), false); // Scanline repeating is sensitive to non-integral vertical resolution, // so rounding is performed to eliminate it // This won't be 100% accurate, but non-integral scaling isn't 100% // accurate anyway mySLineSurface->setSrcSize(1, int(2 * float(mode.image.height()) / - floor(((float)mode.image.height() / myTIA->height()) + 0.5))); + floor((float(mode.image.height()) / myTIA->height()) + 0.5))); #if 0 cerr << "INITIALIZE:\n" @@ -109,9 +109,9 @@ void TIASurface::setPalette(const uInt32* tia_palette, const uInt32* rgb_palette uInt8 gj = (rgb_palette[j] >> 8) & 0xff; uInt8 bj = rgb_palette[j] & 0xff; - Uint8 r = (Uint8) getPhosphor(ri, rj); - Uint8 g = (Uint8) getPhosphor(gi, gj); - Uint8 b = (Uint8) getPhosphor(bi, bj); + uInt8 r = getPhosphor(ri, rj); + uInt8 g = getPhosphor(gi, gj); + uInt8 b = getPhosphor(bi, bj); myPhosphorPalette[i][j] = myFB.mapRGB(r, g, b); } @@ -169,7 +169,7 @@ void TIASurface::setNTSC(NTSCFilter::Preset preset, bool show) const string& mode = myNTSCFilter.setPreset(preset); buf << "TV filtering (" << mode << " mode)"; } - myOSystem.settings().setValue("tv.filter", (int)preset); + myOSystem.settings().setValue("tv.filter", int(preset)); if(show) myFB.showMessage(buf.str()); } @@ -326,7 +326,7 @@ void TIASurface::render() { uInt32 pos = screenofsY; for(uInt32 x = 0; x < width; ++x) - buffer[pos++] = (uInt32) myPalette[currentFrame[bufofsY + x]]; + buffer[pos++] = myPalette[currentFrame[bufofsY + x]]; bufofsY += width; screenofsY += pitch; @@ -343,8 +343,7 @@ void TIASurface::render() for(uInt32 x = 0; x < width; ++x) { const uInt32 bufofs = bufofsY + x; - buffer[pos++] = (uInt32) - myPhosphorPalette[currentFrame[bufofs]][previousFrame[bufofs]]; + buffer[pos++] = myPhosphorPalette[currentFrame[bufofs]][previousFrame[bufofs]]; } bufofsY += width; screenofsY += pitch; diff --git a/src/emucore/TrackBall.cxx b/src/emucore/TrackBall.cxx index 4a3bc1e43..d3142cf4a 100644 --- a/src/emucore/TrackBall.cxx +++ b/src/emucore/TrackBall.cxx @@ -54,7 +54,7 @@ TrackBall::~TrackBall() // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - uInt8 TrackBall::read() { - int scanline = ((System&)mySystem).tia().scanlines(); + int scanline = mySystem.tia().scanlines(); if(myScanCountV > scanline) myScanCountV = 0; if(myScanCountH > scanline) myScanCountH = 0; diff --git a/src/gui/CheckListWidget.cxx b/src/gui/CheckListWidget.cxx index 03ffd2554..f883a3066 100644 --- a/src/gui/CheckListWidget.cxx +++ b/src/gui/CheckListWidget.cxx @@ -64,8 +64,8 @@ void CheckListWidget::setList(const StringList& list, const BoolArray& state) _checkList[i]->setFlags(WIDGET_ENABLED); // Then turn off any extras - if((int)_stateList.size() < _rows) - for(int i = (int)_stateList.size(); i < _rows; ++i) + if(int(_stateList.size()) < _rows) + for(int i = int(_stateList.size()); i < _rows; ++i) _checkList[i]->clearFlags(WIDGET_ENABLED); ListWidget::recalc(); @@ -74,7 +74,7 @@ void CheckListWidget::setList(const StringList& list, const BoolArray& state) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void CheckListWidget::setLine(int line, const string& str, const bool& state) { - if(line >= (int)_list.size()) + if(line >= int(_list.size())) return; _list[line] = str; @@ -86,7 +86,7 @@ void CheckListWidget::drawWidget(bool hilite) { //cerr << "CheckListWidget::drawWidget\n"; FBSurface& s = _boss->dialog().surface(); - int i, pos, len = (int)_list.size(); + int i, pos, len = _list.size(); // Draw a thin frame around the list and to separate columns s.hLine(_x, _y, _x + _w - 1, kColor); @@ -151,7 +151,7 @@ GUI::Rect CheckListWidget::getEditRect() const // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool CheckListWidget::getState(int line) { - if(line >= 0 && line < (int)_stateList.size()) + if(line >= 0 && line < int(_stateList.size())) return _stateList[line]; else return false; diff --git a/src/gui/InputTextDialog.cxx b/src/gui/InputTextDialog.cxx index 6dc129ebd..8eeb279b9 100644 --- a/src/gui/InputTextDialog.cxx +++ b/src/gui/InputTextDialog.cxx @@ -72,14 +72,14 @@ void InputTextDialog::initialize(const GUI::Font& lfont, const GUI::Font& nfont, // Calculate real dimensions _w = fontWidth * 35; - _h = lineHeight * 4 + (int)labels.size() * (lineHeight + 5); + _h = lineHeight * 4 + labels.size() * (lineHeight + 5); // Determine longest label for(i = 0; i < labels.size(); ++i) { if(labels[i].length() > lwidth) { - lwidth = (int)labels[i].length(); + lwidth = labels[i].length(); maxIdx = i; } } @@ -163,7 +163,7 @@ void InputTextDialog::setTitle(const string& title) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - const string& InputTextDialog::getResult(int idx) { - if((uInt32)idx < myInput.size()) + if(uInt32(idx) < myInput.size()) return myInput[idx]->getText(); else return EmptyString; @@ -172,21 +172,21 @@ const string& InputTextDialog::getResult(int idx) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void InputTextDialog::setText(const string& str, int idx) { - if((uInt32)idx < myInput.size()) + if(uInt32(idx) < myInput.size()) myInput[idx]->setText(str); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void InputTextDialog::setTextFilter(const EditableWidget::TextFilter& f, int idx) { - if((uInt32)idx < myInput.size()) + if(uInt32(idx) < myInput.size()) myInput[idx]->setTextFilter(f); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void InputTextDialog::setFocus(int idx) { - if((uInt32)idx < myInput.size()) + if(uInt32(idx) < myInput.size()) Dialog::setFocus(getFocusList()[idx]); } diff --git a/src/gui/Launcher.cxx b/src/gui/Launcher.cxx index 046385b54..a3518c162 100644 --- a/src/gui/Launcher.cxx +++ b/src/gui/Launcher.cxx @@ -37,10 +37,10 @@ Launcher::Launcher(OSystem& osystem) // The launcher dialog is resizable, within certain bounds // We check those bounds now - myWidth = BSPF_max(myWidth, (uInt32)FrameBuffer::kFBMinW); - myHeight = BSPF_max(myHeight, (uInt32)FrameBuffer::kFBMinH); - myWidth = BSPF_min(myWidth, (uInt32)d.w); - myHeight = BSPF_min(myHeight, (uInt32)d.h); + myWidth = BSPF_max(myWidth, uInt32(FrameBuffer::kFBMinW)); + myHeight = BSPF_max(myHeight, uInt32(FrameBuffer::kFBMinH)); + myWidth = BSPF_min(myWidth, uInt32(d.w)); + myHeight = BSPF_min(myHeight, uInt32(d.h)); myOSystem.settings().setValue("launcherres", GUI::Size(myWidth, myHeight)); diff --git a/src/gui/LauncherDialog.cxx b/src/gui/LauncherDialog.cxx index cac466523..958eb123a 100644 --- a/src/gui/LauncherDialog.cxx +++ b/src/gui/LauncherDialog.cxx @@ -275,7 +275,7 @@ void LauncherDialog::updateListing(const string& nameToSelect) // Now fill the list widget with the contents of the GameList StringList l; - for (int i = 0; i < (int) myGameList->size(); ++i) + for(uInt32 i = 0; i < myGameList->size(); ++i) l.push_back(myGameList->name(i)); myList->setList(l); @@ -398,30 +398,29 @@ bool LauncherDialog::matchPattern(const string& s, const string& pattern) const const char* haystack = s.c_str(); const char* needle = pattern.c_str(); - uInt8 b = tolower((uInt8) *needle); + uInt8 b = tolower(*needle); needle++; - for (;; haystack++) + for(;; haystack++) { - if (*haystack == '\0') /* No match */ + if(*haystack == '\0') /* No match */ return false; /* The first character matches */ - if (tolower ((uInt8) *haystack) == b) + if(tolower(*haystack) == b) { const char* rhaystack = haystack + 1; const char* rneedle = needle; - for (;; rhaystack++, rneedle++) + for(;; rhaystack++, rneedle++) { - if (*rneedle == '\0') /* Found a match */ + if(*rneedle == '\0') /* Found a match */ return true; - if (*rhaystack == '\0') /* No match */ + if(*rhaystack == '\0') /* No match */ return false; /* Nothing in this round */ - if (tolower ((uInt8) *rhaystack) - != tolower ((uInt8) *rneedle)) + if(tolower(*rhaystack) != tolower(*rneedle)) break; } } diff --git a/src/gui/ListWidget.cxx b/src/gui/ListWidget.cxx index f512b2584..6ec70fca5 100644 --- a/src/gui/ListWidget.cxx +++ b/src/gui/ListWidget.cxx @@ -68,7 +68,7 @@ ListWidget::~ListWidget() // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void ListWidget::setSelected(int item) { - if(item < 0 || item >= (int)_list.size()) + if(item < 0 || item >= int(_list.size())) { setDirty(); // Simply redraw and exit return; @@ -117,7 +117,7 @@ void ListWidget::setSelected(const string& item) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void ListWidget::setHighlighted(int item) { - if(item < -1 || item >= (int)_list.size()) + if(item < -1 || item >= int(_list.size())) return; if(isEnabled()) @@ -140,14 +140,14 @@ void ListWidget::setHighlighted(int item) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - const string& ListWidget::getSelectedString() const { - return (_selectedItem >= 0 && _selectedItem < (int)_list.size()) + return (_selectedItem >= 0 && _selectedItem < int(_list.size())) ? _list[_selectedItem] : EmptyString; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void ListWidget::scrollTo(int item) { - int size = (int)_list.size(); + int size = _list.size(); if (item >= size) item = size - 1; if (item < 0) @@ -163,7 +163,7 @@ void ListWidget::scrollTo(int item) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void ListWidget::recalc() { - int size = (int)_list.size(); + int size = _list.size(); if (_currentPos >= size) _currentPos = size - 1; @@ -175,7 +175,7 @@ void ListWidget::recalc() _editMode = false; - _scrollBar->_numEntries = (int)_list.size(); + _scrollBar->_numEntries = _list.size(); _scrollBar->_entriesPerPage = _rows; // Reset to normal data entry @@ -199,7 +199,7 @@ void ListWidget::handleMouseDown(int x, int y, int button, int clickCount) // First check whether the selection changed int newSelectedItem; newSelectedItem = findItem(x, y); - if (newSelectedItem >= (int)_list.size()) + if (newSelectedItem >= int(_list.size())) return; if (_selectedItem != newSelectedItem) @@ -340,6 +340,7 @@ bool ListWidget::handleEvent(Event::Type e) bool handled = true; int oldSelectedItem = _selectedItem; + int size = _list.size(); switch(e) { @@ -359,7 +360,7 @@ bool ListWidget::handleEvent(Event::Type e) break; case Event::UIDown: - if (_selectedItem < (int)_list.size() - 1) + if (_selectedItem < size - 1) _selectedItem++; break; @@ -371,8 +372,8 @@ bool ListWidget::handleEvent(Event::Type e) case Event::UIPgDown: _selectedItem += _rows - 1; - if (_selectedItem >= (int)_list.size() ) - _selectedItem = (int)_list.size() - 1; + if (_selectedItem >= size) + _selectedItem = size - 1; break; case Event::UIHome: @@ -380,7 +381,7 @@ bool ListWidget::handleEvent(Event::Type e) break; case Event::UIEnd: - _selectedItem = (int)_list.size() - 1; + _selectedItem = size - 1; break; case Event::UIPrevDir: @@ -417,7 +418,7 @@ void ListWidget::handleCommand(CommandSender* sender, int cmd, int data, int id) switch (cmd) { case kSetPositionCmd: - if (_currentPos != (int)data) + if (_currentPos != data) { _currentPos = data; setDirty(); @@ -444,10 +445,10 @@ void ListWidget::scrollToCurrent(int item) _currentPos = item - _rows + 1; } - if (_currentPos < 0 || _rows > (int)_list.size()) + if (_currentPos < 0 || _rows > int(_list.size())) _currentPos = 0; - else if (_currentPos + _rows > (int)_list.size()) - _currentPos = (int)_list.size() - _rows; + else if (_currentPos + _rows > int(_list.size())) + _currentPos = int(_list.size()) - _rows; int oldScrollPos = _scrollBar->_currentPos; _scrollBar->_currentPos = _currentPos; diff --git a/src/gui/MessageBox.cxx b/src/gui/MessageBox.cxx index 9be1714c1..32e897ba8 100644 --- a/src/gui/MessageBox.cxx +++ b/src/gui/MessageBox.cxx @@ -74,9 +74,9 @@ void MessageBox::addText(const GUI::Font& font, const StringList& text) // Set real dimensions int str_w = 0; for(const auto& s: text) - str_w = BSPF_max((int)s.length(), str_w); + str_w = BSPF_max(int(s.length()), str_w); _w = BSPF_min(str_w * fontWidth + 20, _w); - _h = BSPF_min((uInt32)((text.size() + 2) * lineHeight + 20), (uInt32)_h); + _h = BSPF_min(uInt32((text.size() + 2) * lineHeight + 20), uInt32(_h)); xpos = 10; ypos = 10; for(const auto& s: text) diff --git a/src/gui/ProgressDialog.cxx b/src/gui/ProgressDialog.cxx index a95d811ee..57e216c25 100644 --- a/src/gui/ProgressDialog.cxx +++ b/src/gui/ProgressDialog.cxx @@ -74,7 +74,7 @@ void ProgressDialog::setRange(int start, int finish, int step) { myStart = start; myFinish = finish; - myStep = (int)((step / 100.0) * (myFinish - myStart + 1)); + myStep = int((step / 100.0) * (myFinish - myStart + 1)); mySlider->setMinValue(myStart); mySlider->setMaxValue(myFinish); diff --git a/src/gui/RomAuditDialog.cxx b/src/gui/RomAuditDialog.cxx index d4c41234d..e231ccc3b 100644 --- a/src/gui/RomAuditDialog.cxx +++ b/src/gui/RomAuditDialog.cxx @@ -129,7 +129,7 @@ void RomAuditDialog::auditRoms() // the ROMs, since this is usually a time-consuming operation ProgressDialog progress(this, instance().frameBuffer().font(), "Auditing ROM files ..."); - progress.setRange(0, (int)files.size() - 1, 5); + progress.setRange(0, files.size() - 1, 5); // Create a entry for the GameList for each file Properties props; diff --git a/src/gui/StringListWidget.cxx b/src/gui/StringListWidget.cxx index 37db654aa..8a8f5e412 100644 --- a/src/gui/StringListWidget.cxx +++ b/src/gui/StringListWidget.cxx @@ -48,7 +48,7 @@ void StringListWidget::setList(const StringList& list) void StringListWidget::drawWidget(bool hilite) { FBSurface& s = _boss->dialog().surface(); - int i, pos, len = (int)_list.size(); + int i, pos, len = _list.size(); // Draw a thin frame around the list. s.hLine(_x, _y, _x + _w - 1, kColor); diff --git a/src/gui/TabWidget.cxx b/src/gui/TabWidget.cxx index 7ad0b4090..ec728743f 100644 --- a/src/gui/TabWidget.cxx +++ b/src/gui/TabWidget.cxx @@ -70,7 +70,7 @@ int TabWidget::addTab(const string& title) { // Add a new tab page _tabs.push_back(Tab(title)); - int numTabs = (int)_tabs.size(); + int numTabs = _tabs.size(); // Determine the new tab width int newWidth = _font.getStringWidth(title) + 2 * kTabPadding; @@ -90,7 +90,7 @@ int TabWidget::addTab(const string& title) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void TabWidget::setActiveTab(int tabID, bool show) { - assert(0 <= tabID && tabID < (int)_tabs.size()); + assert(0 <= tabID && tabID < int(_tabs.size())); if (_activeTab != -1) { @@ -110,7 +110,7 @@ void TabWidget::setActiveTab(int tabID, bool show) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void TabWidget::disableTab(int tabID) { - assert(0 <= tabID && tabID < (int)_tabs.size()); + assert(0 <= tabID && tabID < int(_tabs.size())); _tabs[tabID].enabled = false; // TODO - also disable all widgets belonging to this tab @@ -152,12 +152,12 @@ void TabWidget::cycleTab(int direction) { tabID--; if(tabID == -1) - tabID = (int)_tabs.size() - 1; + tabID = int(_tabs.size()) - 1; } else if(direction == 1) // Go to the next tab, wrap around at end { tabID++; - if(tabID == (int)_tabs.size()) + if(tabID == int(_tabs.size())) tabID = 0; } @@ -169,7 +169,7 @@ void TabWidget::cycleTab(int direction) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void TabWidget::setParentWidget(int tabID, Widget* parent) { - assert(0 <= tabID && tabID < (int)_tabs.size()); + assert(0 <= tabID && tabID < int(_tabs.size())); _tabs[tabID].parentWidget = parent; } @@ -184,7 +184,7 @@ void TabWidget::handleMouseDown(int x, int y, int button, int clickCount) if (x >= 0 && x % (_tabWidth + kTabSpacing) < _tabWidth) { tabID = x / (_tabWidth + kTabSpacing); - if (tabID >= (int)_tabs.size()) + if (tabID >= int(_tabs.size())) tabID = -1; } @@ -284,7 +284,7 @@ void TabWidget::drawWidget(bool hilite) // Iterate over all tabs and draw them int i, x = _x + kTabLeftOffset; - for (i = 0; i < (int)_tabs.size(); ++i) + for (i = 0; i < int(_tabs.size()); ++i) { uInt32 fontcolor = _tabs[i].enabled ? kTextColor : kColor; uInt32 boxcolor = (i == _activeTab) ? kColor : kShadowColor; diff --git a/src/gui/UIDialog.cxx b/src/gui/UIDialog.cxx index 0e8e755b9..ea37ccce7 100644 --- a/src/gui/UIDialog.cxx +++ b/src/gui/UIDialog.cxx @@ -315,8 +315,8 @@ void UIDialog::loadConfig() const GUI::Size& ls = instance().settings().getSize("launcherres"); uInt32 w = ls.w, h = ls.h; - w = BSPF_max(w, (uInt32)FrameBuffer::kFBMinW); - h = BSPF_max(h, (uInt32)FrameBuffer::kFBMinH); + w = BSPF_max(w, uInt32(FrameBuffer::kFBMinW)); + h = BSPF_max(h, uInt32(FrameBuffer::kFBMinH)); w = BSPF_min(w, instance().frameBuffer().desktopSize().w); h = BSPF_min(h, instance().frameBuffer().desktopSize().h); @@ -341,8 +341,8 @@ void UIDialog::loadConfig() // Debugger size const GUI::Size& ds = instance().settings().getSize("dbg.res"); w = ds.w, h = ds.h; - w = BSPF_max(w, (uInt32)DebuggerDialog::kSmallFontMinW); - h = BSPF_max(h, (uInt32)DebuggerDialog::kSmallFontMinH); + w = BSPF_max(w, uInt32(DebuggerDialog::kSmallFontMinW)); + h = BSPF_max(h, uInt32(DebuggerDialog::kSmallFontMinH)); w = BSPF_min(w, ds.w); h = BSPF_min(h, ds.h); @@ -437,8 +437,8 @@ void UIDialog::setDefaults() case 1: // Debugger options { #ifdef DEBUGGER_SUPPORT - uInt32 w = BSPF_min(instance().frameBuffer().desktopSize().w, (uInt32)DebuggerDialog::kMediumFontMinW); - uInt32 h = BSPF_min(instance().frameBuffer().desktopSize().h, (uInt32)DebuggerDialog::kMediumFontMinH); + uInt32 w = BSPF_min(instance().frameBuffer().desktopSize().w, uInt32(DebuggerDialog::kMediumFontMinW)); + uInt32 h = BSPF_min(instance().frameBuffer().desktopSize().h, uInt32(DebuggerDialog::kMediumFontMinH)); myDebuggerWidthSlider->setValue(w); myDebuggerWidthLabel->setValue(w); myDebuggerHeightSlider->setValue(h); diff --git a/src/gui/VideoDialog.cxx b/src/gui/VideoDialog.cxx index 213f2df70..36a2c4eb1 100644 --- a/src/gui/VideoDialog.cxx +++ b/src/gui/VideoDialog.cxx @@ -370,7 +370,7 @@ void VideoDialog::loadConfig() myTVMode->setSelected( instance().settings().getString("tv.filter"), "0"); int preset = instance().settings().getInt("tv.filter"); - handleTVModeChange((NTSCFilter::Preset)preset); + handleTVModeChange(NTSCFilter::Preset(preset)); // TV Custom adjustables loadTVAdjustables(NTSCFilter::PRESET_CUSTOM); @@ -562,7 +562,7 @@ void VideoDialog::loadTVAdjustables(NTSCFilter::Preset preset) { NTSCFilter::Adjustable adj; instance().frameBuffer().tiaSurface().ntsc().getAdjustables( - adj, (NTSCFilter::Preset)preset); + adj, NTSCFilter::Preset(preset)); myTVSharp->setValue(adj.sharpness); myTVSharpLabel->setValue(adj.sharpness); myTVHue->setValue(adj.hue); @@ -616,7 +616,7 @@ void VideoDialog::handleCommand(CommandSender* sender, int cmd, break; case kTVModeChanged: - handleTVModeChange((NTSCFilter::Preset)myTVMode->getSelectedTag().toInt()); + handleTVModeChange(NTSCFilter::Preset(myTVMode->getSelectedTag().toInt())); case kTVSharpChanged: myTVSharpLabel->setValue(myTVSharp->getValue()); break; diff --git a/src/gui/Widget.cxx b/src/gui/Widget.cxx index e471ad4ab..bde8d0267 100644 --- a/src/gui/Widget.cxx +++ b/src/gui/Widget.cxx @@ -201,7 +201,7 @@ Widget* Widget::setFocusForChain(GuiObject* boss, WidgetArray& arr, bool emitFocusEvents) { FBSurface& s = boss->dialog().surface(); - int size = (int)arr.size(), pos = -1; + int size = arr.size(), pos = -1; Widget* tmp; for(int i = 0; i < size; ++i) { @@ -605,7 +605,7 @@ void SliderWidget::handleMouseMoved(int x, int y, int button) { // TODO: when the mouse is dragged outside the widget, the slider should // snap back to the old value. - if(isEnabled() && _isDragging && x >= (int)_labelWidth) + if(isEnabled() && _isDragging && x >= int(_labelWidth)) setValue(posToValue(x - _labelWidth)); } diff --git a/src/yacc/stella.y b/src/yacc/stella.y index c8064a246..a30d2508d 100644 --- a/src/yacc/stella.y +++ b/src/yacc/stella.y @@ -17,7 +17,7 @@ void yyerror(const char *e) { errMsg = e; // be extra paranoid about deletion - if(lastExp && dynamic_cast(lastExp)) + if(lastExp && reinterpret_cast(lastExp)) delete lastExp; lastExp = nullptr; diff --git a/src/yacc/y.tab.c b/src/yacc/y.tab.c index 96105223d..ac032ce6c 100644 --- a/src/yacc/y.tab.c +++ b/src/yacc/y.tab.c @@ -82,7 +82,7 @@ void yyerror(const char *e) { errMsg = e; // be extra paranoid about deletion - if(lastExp && dynamic_cast(lastExp)) + if(lastExp && reinterpret_cast(lastExp)) delete lastExp; lastExp = nullptr;