text
stringlengths
1
1.05M
// Copyright 2011 the V8 project 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 "src/parsing/func-name-inferrer.h" #include "src/ast/ast.h" #include "src/ast/ast-value-factory.h" #include "src/list-inl.h" namespace v8 { namespace internal { FuncNameInferrer::FuncNameInferrer(AstValueFactory* ast_value_factory, Zone* zone) : ast_value_factory_(ast_value_factory), entries_stack_(10, zone), names_stack_(5, zone), funcs_to_infer_(4, zone), zone_(zone) { } void FuncNameInferrer::PushEnclosingName(const AstRawString* name) { // Enclosing name is a name of a constructor function. To check // that it is really a constructor, we check that it is not empty // and starts with a capital letter. if (!name->IsEmpty() && unibrow::Uppercase::Is(name->FirstCharacter())) { names_stack_.Add(Name(name, kEnclosingConstructorName), zone()); } } void FuncNameInferrer::PushLiteralName(const AstRawString* name) { if (IsOpen() && name != ast_value_factory_->prototype_string()) { names_stack_.Add(Name(name, kLiteralName), zone()); } } void FuncNameInferrer::PushVariableName(const AstRawString* name) { if (IsOpen() && name != ast_value_factory_->dot_result_string()) { names_stack_.Add(Name(name, kVariableName), zone()); } } void FuncNameInferrer::RemoveAsyncKeywordFromEnd() { DCHECK(names_stack_.length() > 0); DCHECK(names_stack_.last().name->IsOneByteEqualTo("async")); names_stack_.RemoveLast(); } const AstString* FuncNameInferrer::MakeNameFromStack() { return MakeNameFromStackHelper(0, ast_value_factory_->empty_string()); } const AstString* FuncNameInferrer::MakeNameFromStackHelper( int pos, const AstString* prev) { if (pos >= names_stack_.length()) return prev; if (pos < names_stack_.length() - 1 && names_stack_.at(pos).type == kVariableName && names_stack_.at(pos + 1).type == kVariableName) { // Skip consecutive variable declarations. return MakeNameFromStackHelper(pos + 1, prev); } else { if (prev->length() > 0) { const AstRawString* name = names_stack_.at(pos).name; if (prev->length() + name->length() + 1 > String::kMaxLength) return prev; const AstConsString* curr = ast_value_factory_->NewConsString( ast_value_factory_->dot_string(), name); curr = ast_value_factory_->NewConsString(prev, curr); return MakeNameFromStackHelper(pos + 1, curr); } else { return MakeNameFromStackHelper(pos + 1, names_stack_.at(pos).name); } } } void FuncNameInferrer::InferFunctionsNames() { const AstString* func_name = MakeNameFromStack(); for (int i = 0; i < funcs_to_infer_.length(); ++i) { funcs_to_infer_[i]->set_raw_inferred_name(func_name); } funcs_to_infer_.Rewind(0); } } // namespace internal } // namespace v8
// 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. #ifndef __STOUT_IP_HPP__ #define __STOUT_IP_HPP__ // For 'sockaddr'. #ifndef __WINDOWS__ #include <arpa/inet.h> #endif // __WINDOWS__ #if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) #include <ifaddrs.h> #endif // __linux__ || __APPLE__ || __FreeBSD__ #include <stdint.h> #include <stdio.h> #include <string.h> #ifdef __APPLE__ #include <net/if.h> #include <net/if_dl.h> #include <net/if_types.h> #endif // __APPLE__ // Note: Header grouping and ordering is considered before // inclusion/exclusion by platform. // For 'inet_pton', 'inet_ntop'. #ifdef __WINDOWS__ #include <Ws2tcpip.h> #else #include <netinet/in.h> #include <sys/socket.h> #endif // __WINDOWS__ #include <sys/types.h> #include <iostream> #include <string> #include <vector> #include <boost/functional/hash.hpp> #include <stout/abort.hpp> #include <stout/bits.hpp> #include <stout/error.hpp> #include <stout/none.hpp> #include <stout/numify.hpp> #include <stout/option.hpp> #include <stout/os/strerror.hpp> #include <stout/result.hpp> #include <stout/stringify.hpp> #include <stout/strings.hpp> #include <stout/try.hpp> #include <stout/unreachable.hpp> #ifdef __WINDOWS__ #include <stout/windows.hpp> #endif // __WINDOWS__ namespace net { // Represents an IP. class IP { public: // Creates an IP from the given string that has the dot-decimal // format. For example: // 10.0.0.1 // 192.168.1.100 // 172.158.1.23 static Try<IP> parse(const std::string& value, int family); // Creates an IP from a struct sockaddr_storage. static Try<IP> create(const struct sockaddr_storage& _storage); // Creates an IP from a struct sockaddr. static Try<IP> create(const struct sockaddr& _storage); // Creates an IP from struct in_addr. Note that by standard, struct // in_addr stores the IP address in network order. explicit IP(const struct in_addr& _storage) : family_(AF_INET) { clear(); storage_.in_ = _storage; } // Creates an IP from a 32 bit unsigned integer. Note that the // integer stores the IP address in host order. explicit IP(uint32_t _storage) : family_(AF_INET) { clear(); storage_.in_.s_addr = htonl(_storage); } // Returns the family type. int family() const { return family_; } // Returns the struct in_addr storage. Try<struct in_addr> in() const { if (family_ == AF_INET) { return storage_.in_; } else { return Error("Unsupported family type: " + stringify(family_)); } } // Checks if this IP is for loopback (e.g., INADDR_LOOPBACK). bool isLoopback() const { switch (family_) { case AF_INET: return storage_.in_.s_addr == htonl(INADDR_LOOPBACK); default: UNREACHABLE(); } } // Checks if this IP is for any incoming address (e.g., INADDR_ANY). bool isAny() const { switch (family_) { case AF_INET: return storage_.in_.s_addr == htonl(INADDR_ANY); default: UNREACHABLE(); } } bool operator==(const IP& that) const { if (family_ != that.family_) { return false; } else { return memcmp(&storage_, &that.storage_, sizeof(storage_)) == 0; } } bool operator!=(const IP& that) const { return !(*this == that); } bool operator<(const IP& that) const { if (family_ != that.family_) { return family_ < that.family_; } else { return memcmp(&storage_, &that.storage_, sizeof(storage_)) < 0; } } bool operator>(const IP& that) const { if (family_ != that.family_) { return family_ > that.family_; } else { return memcmp(&storage_, &that.storage_, sizeof(storage_)) > 0; } } private: // NOTE: We need to clear the union when creating an IP because the // equality check uses memcmp. void clear() { memset(&storage_, 0, sizeof(storage_)); } union Storage { struct in_addr in_; }; int family_; Storage storage_; }; inline Try<IP> IP::parse(const std::string& value, int family) { Storage storage; switch (family) { case AF_INET: { if (inet_pton(AF_INET, value.c_str(), &storage.in_) == 0) { return Error("Failed to parse the IP"); } return IP(storage.in_); } default: { return Error("Unsupported family type: " + stringify(family)); } } } inline Try<IP> IP::create(const struct sockaddr_storage& _storage) { // According to POSIX: (IEEE Std 1003.1, 2004) // // (1) `sockaddr_storage` is "aligned at an appropriate boundary so that // pointers to it can be cast as pointers to protocol-specific address // structures and used to access the fields of those structures without // alignment problems." // // (2) "When a `sockaddr_storage` structure is cast as a `sockaddr` // structure, the `ss_family` field of the `sockaddr_storage` structure // shall map onto the `sa_family` field of the `sockaddr` structure." // // Therefore, casting from `const sockaddr_storage*` to `const sockaddr*` // (then subsequently dereferencing the `const sockaddr*`) should be safe. // Note that casting in the reverse direction (`const sockaddr*` to // `const sockaddr_storage*`) would NOT be safe, since the former might // not be aligned appropriately. const auto* addr = reinterpret_cast<const struct sockaddr*>(&_storage); return create(*addr); } inline Try<IP> IP::create(const struct sockaddr& _storage) { switch (_storage.sa_family) { case AF_INET: { const auto* addr = reinterpret_cast<const struct sockaddr_in*>(&_storage); return IP(addr->sin_addr); } default: { return Error("Unsupported family type: " + stringify(_storage.sa_family)); } } } // Returns the string representation of the given IP using the // canonical dot-decimal form. For example: "10.0.0.1". inline std::ostream& operator<<(std::ostream& stream, const IP& ip) { switch (ip.family()) { case AF_INET: { char buffer[INET_ADDRSTRLEN]; struct in_addr in = ip.in().get(); if (inet_ntop(AF_INET, &in, buffer, sizeof(buffer)) == NULL) { // We do not expect inet_ntop to fail because all parameters // passed in are valid. ABORT("Failed to get human-readable IP for " + stringify(ntohl(in.s_addr)) + ": " + os::strerror(errno)); } stream << buffer; return stream; } default: { UNREACHABLE(); } } } // Represents an IP network. We store the IP address and the IP // netmask which defines the subnet. class IPNetwork { public: // Returns the IPv4 network for loopback (i.e., 127.0.0.1/8). static IPNetwork LOOPBACK_V4(); // Creates an IP network from the given string that has the // dot-decimal format with subnet prefix). // For example: // 10.0.0.1/8 // 192.168.1.100/24 // 172.158.1.23 static Try<IPNetwork> parse(const std::string& value, int family); // Creates an IP network from the given IP address and netmask. // Returns error if the netmask is not valid (e.g., not contiguous). static Try<IPNetwork> create(const IP& address, const IP& netmask); // Creates an IP network from an IP address and a subnet prefix. // Returns error if the prefix is not valid. static Try<IPNetwork> create(const IP& address, int prefix); // Returns the first available IP network of a given link device. // The link device is specified using its name (e.g., eth0). Returns // error if the link device is not found. Returns none if the link // device is found, but does not have an IP network. // TODO(jieyu): It is uncommon, but likely that a link device has // multiple IP networks. In that case, consider returning the // primary IP network instead of the first one. static Result<IPNetwork> fromLinkDevice(const std::string& name, int family); IP address() const { return address_; } IP netmask() const { return netmask_; } // Returns the prefix of the subnet defined by the IP netmask. int prefix() const { switch (netmask_.family()) { case AF_INET: { return bits::countSetBits(ntohl(netmask_.in().get().s_addr)); } default: { UNREACHABLE(); } } } bool operator==(const IPNetwork& that) const { return address_ == that.address_ && netmask_ == that.netmask_; } bool operator!=(const IPNetwork& that) const { return !(*this == that); } private: IPNetwork(const IP& _address, const IP& _netmask) : address_(_address), netmask_(_netmask) {} IP address_; IP netmask_; }; inline Try<IPNetwork> IPNetwork::parse(const std::string& value, int family) { std::vector<std::string> tokens = strings::split(value, "/"); if (tokens.size() != 2) { return Error( "Unexpected number of '/' detected: " + stringify(tokens.size())); } // Parse the IP address. Try<IP> address = IP::parse(tokens[0], family); if (address.isError()) { return Error("Failed to parse the IP address: " + address.error()); } // Parse the subnet prefix. Try<int> prefix = numify<int>(tokens[1]); if (prefix.isError()) { return Error("Subnet prefix is not a number"); } return create(address.get(), prefix.get()); } inline IPNetwork IPNetwork::LOOPBACK_V4() { return parse("127.0.0.1/8", AF_INET).get(); } inline Try<IPNetwork> IPNetwork::create(const IP& address, const IP& netmask) { if (address.family() != netmask.family()) { return Error( "The network families of the IP address '" + stringify(address.family()) + "' and the IP netmask '" + stringify(netmask.family()) + "' do not match"); } switch (address.family()) { case AF_INET: { uint32_t mask = ntohl(netmask.in().get().s_addr); if (((~mask + 1) & (~mask)) != 0) { return Error("Netmask is not valid"); } return IPNetwork(address, netmask); } default: { UNREACHABLE(); } } } inline Try<IPNetwork> IPNetwork::create(const IP& address, int prefix) { if (prefix < 0) { return Error("Subnet prefix is negative"); } switch (address.family()) { case AF_INET: { if (prefix > 32) { return Error("Subnet prefix is larger than 32"); } // Avoid left-shifting by 32 bits when prefix is 0. uint32_t mask = 0; if (prefix > 0) { mask = 0xffffffff << (32 - prefix); } return IPNetwork(address, IP(mask)); } default: { UNREACHABLE(); } } } inline Result<IPNetwork> IPNetwork::fromLinkDevice( const std::string& name, int family) { #if !defined(__linux__) && !defined(__APPLE__) && !defined(__FreeBSD__) return Error("Not implemented"); #else if (family != AF_INET) { return Error("Unsupported family type: " + stringify(family)); } struct ifaddrs* ifaddr = NULL; if (getifaddrs(&ifaddr) == -1) { return ErrnoError(); } // Indicates whether the link device is found or not. bool found = false; for (struct ifaddrs* ifa = ifaddr; ifa != NULL; ifa = ifa->ifa_next) { if (ifa->ifa_name != NULL && !strcmp(ifa->ifa_name, name.c_str())) { found = true; if (ifa->ifa_addr != NULL && ifa->ifa_addr->sa_family == family) { IP address = IP::create(*ifa->ifa_addr).get(); if (ifa->ifa_netmask != NULL && ifa->ifa_netmask->sa_family == family) { IP netmask = IP::create(*ifa->ifa_netmask).get(); freeifaddrs(ifaddr); Try<IPNetwork> network = IPNetwork::create(address, netmask); if (network.isError()) { return Error(network.error()); } return network.get(); } freeifaddrs(ifaddr); // Note that this is the case where netmask is not specified. // We've seen such cases when VPN is used. In that case, a // default /32 prefix is used. Try<IPNetwork> network = IPNetwork::create(address, 32); if (network.isError()) { return Error(network.error()); } return network.get(); } } } freeifaddrs(ifaddr); if (!found) { return Error("Cannot find the link device"); } return None(); #endif } // Returns the string representation of the given IP network using the // canonical dot-decimal form with prefix. For example: "10.0.0.1/8". inline std::ostream& operator<<(std::ostream& stream, const IPNetwork& network) { stream << network.address() << "/" << network.prefix(); return stream; } } // namespace net { namespace std { template <> struct hash<net::IP> { typedef size_t result_type; typedef net::IP argument_type; result_type operator()(const argument_type& ip) const { size_t seed = 0; switch (ip.family()) { case AF_INET: boost::hash_combine(seed, htonl(ip.in().get().s_addr)); return seed; default: UNREACHABLE(); } } }; } // namespace std { #endif // __STOUT_IP_HPP__
/* Copyright (c) Facebook, Inc. and its affiliates. This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. */ #include "compile.h" #include "ir.h" #include <chrono> #include <iostream> #include <random> void rand(float *data, int N) { std::random_device rd; std::mt19937 e2(rd()); std::normal_distribution<> dist(2, 2); for (auto i = 0; i < N; ++i) { data[i] = dist(e2); } } // assumes LCA=K, LCB=N void ref_mm(const float *A, const float *B, int M, int N, int K, float *C, float alpha = 0) { for (auto n = 0; n < N; ++n) { for (auto m = 0; m < M; ++m) { float tmp = 0; for (auto k = 0; k < K; ++k) { tmp += A[m * K + k] * B[k * N + n]; } C[m * N + n] = alpha * C[m * N + n] + tmp; } } } int main() { // std::cerr << "1\n"; // std::cerr << "2\n"; //{ // IR ir; // auto a = ir.create_var("a"); // auto b = ir.create_var("b"); // auto r0 = ir.create_node("read", {}, {a, b}); // auto r1 = ir.create_node("read", {}, {a, b}); // auto add = ir.create_node("add", {r0, r1}, {a, b}); // auto w = ir.create_node("write", {add}, {a, b}); // ir.set_inputs({r0, r1}); // ir.set_priority(r1, 10); // LoopTree lt(ir); // std::cerr << "dumping:\n"; // std::cerr << lt.dump(); //} //{ // IR ir; // auto a = ir.create_var("a"); // auto b = ir.create_var("b"); // auto c = ir.create_var("c"); // auto r0 = ir.create_node("read", {}, {a, b}); // auto r1 = ir.create_node("read", {}, {b, c}); // auto mul = ir.create_node("mul", {r0, r1}, {a, b, c}); // auto add = ir.create_node("add", {mul}, {a, c}); // auto w = ir.create_node("write", {add}, {a, c}); // ir.set_inputs({r0, r1}); // ir.set_priority(r1, 10); // ir.set_priority(r0, 100); // ir.set_order(r1, {{b, -1}, {c, -1}}); // LoopTree lt(ir); // std::cerr << "dumping:\n"; // std::cerr << lt.dump(); //} //{ // IR ir; // auto a = ir.create_var("a"); // auto b = ir.create_var("b"); // auto c = ir.create_var("c"); // auto r0 = ir.create_node("read", {}, {a, b}); // auto r1 = ir.create_node("read", {}, {b, c}); // auto mul = ir.create_node("mul", {r0, r1}, {a, b, c}); // auto add = ir.create_node("add", {mul}, {a, c}); // auto w = ir.create_node("write", {add}, {a, c}); // ir.set_inputs({r0, r1}); // ir.set_priority(r1, 10); // ir.set_priority(r0, 100); // ir.set_order(r0, {{b, 20}, {b, 35}, {b, 7}, {a, 32}}); // ir.set_order(r1, {{b, 20}, {b, 35}, {c, 30}}); // LoopTree lt(ir); // std::cerr << "dumping:\n"; // std::cerr << lt.dump(); //} //{ // IR ir; // auto a = ir.create_var("a"); // auto b = ir.create_var("b"); // auto r0 = ir.create_node("read", {}, {a, b}); // auto r1 = ir.create_node("read", {}, {a, b}); // auto add = ir.create_node("add", {r1, r0}, {a, b}); // auto w = ir.create_node("write", {add}, {a, b}); // for (auto v : { r0, r1, add, w }) { // ir.set_order(v, {{a, {3, 1}}, {b, {5, 0}}}); // } // ir.set_inputs({r0, r1}); // ir.set_outputs({w}); // LoopTree lt(ir); // float in0[16]; // float in1[16]; // float out[16]; // for (auto i = 0; i < 16; ++i) { // in0[i] = i; // in1[i] = 3; // } // exec(lt, {in0, in1, out}); // for (auto i = 0; i < 16; ++i) { // std::cerr << out[i] << "\n"; // } //} if (0) { IR ir; auto a = ir.create_var("a"); auto r0 = ir.create_node("read", {}, {a}); auto r1 = ir.create_node("read", {}, {a}); auto add = ir.create_node("add", {r1, r0}, {a}); auto w = ir.create_node("write", {add}, {a}); for (auto v : {r0, r1, add, w}) { ir.set_order(v, {{a, {3, 1}}, {a, {2, 1}}, {a, {2, 0}}}); } ir.set_order(add, {{a, {3, 1}}, {a, {5, 0}}}); ir.set_inputs({r0, r1}); ir.set_outputs({w}); LoopTree lt(ir); std::cerr << lt.dump(); float in0[16]; float in1[16]; float out[16]; for (auto i = 0; i < 16; ++i) { in0[i] = i; in1[i] = 3; } exec(lt, {in0, in1, out}); for (auto i = 0; i < 16; ++i) { std::cerr << out[i] << "\n"; } } if (0) { IR ir; constexpr int N = 16; auto a = ir.create_var("a"); auto r0 = ir.create_node("read", {}, {a}); auto r1 = ir.create_node("read", {}, {a}); auto add = ir.create_node("add", {r1, r0}, {a}); auto w = ir.create_node("write", {add}, {a}); for (auto v : {r0, r1, add, w}) { ir.set_order(v, {{a, {N, 0}}}); } ir.set_inputs({r0, r1}); ir.set_outputs({w}); LoopTree lt(ir); std::cerr << lt.dump(); float in0[N]; float in1[N]; float out[N]; for (auto i = 0; i < N; ++i) { in0[i] = i; in1[i] = 3; } exec(lt, {in0, in1, out}); for (auto i = 0; i < 16; ++i) { std::cerr << out[i] << "\n"; } } if (0) { IR ir; constexpr int M = 16; constexpr int N = 16; constexpr int K = 16; auto m = ir.create_var("m"); auto n = ir.create_var("n"); auto k = ir.create_var("k"); auto r0 = ir.create_node("read", {}, {m, k}); auto r1 = ir.create_node("read", {}, {k, n}); auto mul = ir.create_node("mul", {r1, r0}, {m, k, n}); auto add = ir.create_node("add", {mul}, {m, n}); auto w = ir.create_node("write", {add}, {m, n}); ir.set_order(r0, {{m, {M, 0}}, {k, {K, 0}}}); // ir.set_order(r1, {{k, {K, 0}}, {n, {N, 0}}}); // ir.set_order(r0, {{k, {K, 0}}, {m, {M, 0}}}); ir.set_order(r1, {{m, {M, 0}}, {n, {N, 0}}, {k, {K, 0}}}); ir.set_priority(r1, 10); ir.set_priority(r0, 0); // ir.set_order(mul, {{m, {M, 0}}, {k, {K, 0}}, {n, {N, 0}}}); // ir.set_order(add, {{m, {M, 0}}, {k, {K, 0}}, {n, {N, 0}}}); ir.set_order(mul, {{m, {M, 0}}, {n, {N, 0}}, {k, {K, 0}}}); ir.set_order(add, {{m, {M, 0}}, {n, {N, 0}}, {k, {K, 0}}}); ir.set_order(w, {{m, {M, 0}}, {n, {N, 0}}}); ir.set_inputs({r0, r1}); ir.set_outputs({w}); LoopTree lt(ir); std::cerr << lt.dump(); float in0[M * K]; float in1[N * K]; float out[M * N]; rand(in0, M * K); rand(in1, N * K); for (auto i = 0; i < M * N; ++i) { // in0[i] = 1; // in1[i] = i; } exec(lt, {in0, in1, out}); // for (auto i = 0; i < 4; ++i) { // std::cerr << out[i] << "\n"; //} float out_ref[M * N]; ref_mm(in0, in1, M, N, K, out_ref); float max_diff = 0; for (auto i = 0; i < M * N; ++i) { max_diff = std::max(max_diff, std::abs(out_ref[i] - out[i])); // std::cerr << out[i] << " vs ref " << out_ref[i] << "\n"; } std::cerr << "max diff " << max_diff << "\n"; } if (0) { IR ir; constexpr int M = 16; constexpr int N = 16; constexpr int K = 16; auto m = ir.create_var("m"); auto n = ir.create_var("n"); auto k = ir.create_var("k"); auto r0 = ir.create_node("read", {}, {m, k}); auto r1 = ir.create_node("read", {}, {k, n}); auto mul = ir.create_node("mul", {r1, r0}, {m, k, n}); auto add = ir.create_node("add", {mul}, {m, n}); auto w = ir.create_node("write", {add}, {m, n}); ir.set_order(r0, {{m, {M, 0}}, {k, {K, 0}}}); // ir.set_order(r1, {{k, {K, 0}}, {n, {N, 0}}}); // ir.set_order(r0, {{k, {K, 0}}, {m, {M, 0}}}); ir.set_order(r1, {{m, {M, 0}}, {n, {N, 0}}, {k, {K, 0}}}); ir.set_priority(r1, 10); ir.set_priority(r0, 0); // ir.set_order(mul, {{m, {M, 0}}, {k, {K, 0}}, {n, {N, 0}}}); // ir.set_order(add, {{m, {M, 0}}, {k, {K, 0}}, {n, {N, 0}}}); ir.set_order(mul, {{m, {M, 0}}, {n, {N, 0}}, {k, {K, 0}}}); ir.set_order(add, {{m, {3, 1}}, {n, {N, 0}}, {k, {K, 0}}, {m, {5, 0}}}); // ir.set_order(add, {{m, {2, 0}}, {n, {N, 0}}, {k, {K, 0}}, {m, {2, 0}}}); ir.set_order(w, {{m, {M, 0}}, {n, {N, 0}}}); ir.set_inputs({r0, r1}); ir.set_outputs({w}); LoopTree lt(ir); std::cerr << lt.dump(); float in0[M * K]; float in1[N * K]; float out[M * N]; rand(in0, M * K); rand(in1, N * K); for (auto i = 0; i < M * N; ++i) { // in0[i] = 1; // in1[i] = i; } exec(lt, {in0, in1, out}); for (auto i = 0; i < 4; ++i) { // std::cerr << out[i] << "\n"; } float out_ref[M * N]; ref_mm(in0, in1, M, N, K, out_ref); float max_diff = 0; for (auto i = 0; i < M * N; ++i) { max_diff = std::max(max_diff, std::abs(out_ref[i] - out[i])); // std::cerr << out[i] << " vs ref " << out_ref[i] << "\n"; } std::cerr << "max diff " << max_diff << "\n"; } if (0) { IR ir; constexpr int N = 128; auto a = ir.create_var("a"); auto r0 = ir.create_node("read", {}, {a}); auto r1 = ir.create_node("read", {}, {a}); auto add = ir.create_node("add", {r0, r1}, {a}); auto w = ir.create_node("write", {add}, {a}); for (auto v : {r0, r1, add, w}) { ir.set_order(v, {{a, {N, 0}}}); } ir.set_inputs({r0, r1}); ir.set_outputs({w}); ir.set_priority(r1, 10); LoopTree lt(ir); auto start = std::chrono::steady_clock::now(); auto iters = 1000; for (auto i = 0; i < iters; ++i) { lt = LoopTree(ir); } auto end = std::chrono::steady_clock::now(); std::chrono::duration<double> diff = end - start; std::cerr << iters / diff.count() << " iters/sec\n"; std::cerr << "dumping:\n"; std::cerr << lt.dump(); float in0[N]; float in1[N]; float out[N]; rand(in0, N); rand(in1, N); exec(lt, {in0, in1, out}); float out_ref[N]; for (auto i = 0; i < N; ++i) { out_ref[i] = in0[i] + in1[i]; } float max_diff = 0; for (auto i = 0; i < N; ++i) { max_diff = std::max(max_diff, std::abs(out_ref[i] - out[i])); } std::cerr << "max diff " << max_diff << "\n"; } if (0) { IR ir; constexpr int N = 128; auto a = ir.create_var("a"); auto r0 = ir.create_node("read", {}, {a}); auto r1 = ir.create_node("read", {}, {a}); auto add = ir.create_node("add", {r0, r1}, {a}); auto w = ir.create_node("write", {add}, {a}); for (auto v : {r0, r1, add, w}) { ir.set_order(v, {{a, {N, 0}}}); ir.disable_reuse(v, 0); } ir.set_inputs({r0, r1}); ir.set_outputs({w}); ir.set_priority(r1, 10); LoopTree lt(ir); auto start = std::chrono::steady_clock::now(); auto iters = 1000; for (auto i = 0; i < iters; ++i) { lt = LoopTree(ir); } auto end = std::chrono::steady_clock::now(); std::chrono::duration<double> diff = end - start; std::cerr << iters / diff.count() << " iters/sec\n"; std::cerr << "dumping:\n"; std::cerr << lt.dump(); float in0[N]; float in1[N]; float out[N]; rand(in0, N); rand(in1, N); exec(lt, {in0, in1, out}); float out_ref[N]; for (auto i = 0; i < N; ++i) { out_ref[i] = in0[i] + in1[i]; } float max_diff = 0; for (auto i = 0; i < 6; ++i) { max_diff = std::max(max_diff, std::abs(out_ref[i] - out[i])); std::cerr << "inp " << in0[i] << " + " << in1[i] << " "; std::cerr << "out " << out[i] << " vs " << out_ref[i] << "\n"; } std::cerr << "max diff " << max_diff << "\n"; } if (0) { IR ir; constexpr int N = 16; auto a = ir.create_var("a"); auto b = ir.create_var("b"); auto r = ir.create_node("read", {}, {a, b}); auto add = ir.create_node("add", {r}, {}); auto w = ir.create_node("write", {add}, {}); ir.set_inputs({r}); ir.set_outputs({w}); std::cerr << LoopTree(ir).dump() << "\n"; std::cerr << dot(ir) << "\n"; ir = split_node(ir, add, {b}); std::cerr << " -- split -- \n"; std::cerr << LoopTree(ir).dump() << "\n"; std::cerr << dot(ir) << "\n"; } { IR ir; constexpr int N = 16; auto a = ir.create_var("a"); auto b = ir.create_var("b"); auto r = ir.create_node("read", {}, {a, b}); auto add = ir.create_node("add", {r}, {}); auto w = ir.create_node("write", {add}, {}); ir.set_inputs({r}); ir.set_outputs({w}); ir = split_node(ir, add, {b}); auto lt = LoopTree(ir); std::cout << lt.dump(); lt.walk([&](LoopTree::TreeRef ref, int) { if (lt.node(ref).kind != LoopTree::LOOP) { return; } std::cout << "parallel L" << ref << ": "; std::cout << trivially_parallel(lt, ref) << "\n"; }); } }
@256 D=A @SP M=D @133 0;JMP @R15 M=D @SP AM=M-1 D=M A=A-1 D=M-D M=0 @END_EQ D;JNE @SP A=M-1 M=-1 (END_EQ) @R15 A=M 0;JMP @R15 M=D @SP AM=M-1 D=M A=A-1 D=M-D M=0 @END_GT D;JLE @SP A=M-1 M=-1 (END_GT) @R15 A=M 0;JMP @R15 M=D @SP AM=M-1 D=M A=A-1 D=M-D M=0 @END_LT D;JGE @SP A=M-1 M=-1 (END_LT) @R15 A=M 0;JMP @5 D=A @LCL A=M-D D=M @R13 M=D @SP AM=M-1 D=M @ARG A=M M=D D=A @SP M=D+1 @LCL D=M @R14 AM=D-1 D=M @THAT M=D @R14 AM=M-1 D=M @THIS M=D @R14 AM=M-1 D=M @ARG M=D @R14 AM=M-1 D=M @LCL M=D @R13 A=M 0;JMP @SP A=M M=D @LCL D=M @SP AM=M+1 M=D @ARG D=M @SP AM=M+1 M=D @THIS D=M @SP AM=M+1 M=D @THAT D=M @SP AM=M+1 M=D @4 D=A @R13 D=D+M @SP D=M-D @ARG M=D @SP MD=M+1 @LCL M=D @R14 A=M 0;JMP @0 D=A @R13 M=D @sys.init D=A @R14 M=D @RET_ADDRESS_CALL0 D=A @95 0;JMP (RET_ADDRESS_CALL0) (apple.new) @2 D=A @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @memory.alloc D=A @R14 M=D @RET_ADDRESS_CALL1 D=A @95 0;JMP (RET_ADDRESS_CALL1) @SP AM=M-1 D=M @THIS M=D @SP M=M+1 A=M-1 M=0 @SP AM=M-1 D=M @THIS A=M M=D @SP M=M+1 A=M-1 M=0 @SP AM=M-1 D=M @THIS A=M+1 M=D @THIS D=M @SP AM=M+1 A=A-1 M=D @54 0;JMP (apple.dispose) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THIS M=D @THIS D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @memory.dealloc D=A @R14 M=D @RET_ADDRESS_CALL2 D=A @95 0;JMP (RET_ADDRESS_CALL2) @SP AM=M-1 D=M M=D @SP M=M+1 A=M-1 M=0 @54 0;JMP (apple.equals) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THIS M=D @THIS A=M D=M @SP AM=M+1 A=A-1 M=D @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_EQ0 D=A @6 0;JMP (RET_ADDRESS_EQ0) @SP AM=M-1 D=M @apple.equals$if_true0 D;JNE @apple.equals$if_false0 0;JMP (apple.equals$if_true0) @THIS A=M+1 D=M @SP AM=M+1 A=A-1 M=D @ARG A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_EQ1 D=A @6 0;JMP (RET_ADDRESS_EQ1) @SP AM=M-1 D=M @apple.equals$if_true1 D;JNE @apple.equals$if_false1 0;JMP (apple.equals$if_true1) @SP M=M+1 A=M-1 M=0 @SP A=M-1 M=!M @54 0;JMP (apple.equals$if_false1) (apple.equals$if_false0) @SP M=M+1 A=M-1 M=0 @54 0;JMP (apple.paint) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THIS M=D @SP M=M+1 A=M-1 M=0 @SP A=M-1 M=!M @1 D=A @R13 M=D @screen.setcolor D=A @R14 M=D @RET_ADDRESS_CALL3 D=A @95 0;JMP (RET_ADDRESS_CALL3) @SP AM=M-1 D=M M=D @THIS A=M D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @gameboard.posx D=A @R14 M=D @RET_ADDRESS_CALL4 D=A @95 0;JMP (RET_ADDRESS_CALL4) @4 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @THIS A=M+1 D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @gameboard.posy D=A @R14 M=D @RET_ADDRESS_CALL5 D=A @95 0;JMP (RET_ADDRESS_CALL5) @4 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @3 D=A @SP AM=M+1 A=A-1 M=D @3 D=A @R13 M=D @screen.drawcircle D=A @R14 M=D @RET_ADDRESS_CALL6 D=A @95 0;JMP (RET_ADDRESS_CALL6) @SP AM=M-1 D=M M=D @SP M=M+1 A=M-1 M=0 @54 0;JMP (apple.erase) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THIS M=D @SP M=M+1 A=M-1 M=0 @1 D=A @R13 M=D @screen.setcolor D=A @R14 M=D @RET_ADDRESS_CALL7 D=A @95 0;JMP (RET_ADDRESS_CALL7) @SP AM=M-1 D=M M=D @THIS A=M D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @gameboard.posx D=A @R14 M=D @RET_ADDRESS_CALL8 D=A @95 0;JMP (RET_ADDRESS_CALL8) @4 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @THIS A=M+1 D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @gameboard.posy D=A @R14 M=D @RET_ADDRESS_CALL9 D=A @95 0;JMP (RET_ADDRESS_CALL9) @4 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @3 D=A @SP AM=M+1 A=A-1 M=D @3 D=A @R13 M=D @screen.drawcircle D=A @R14 M=D @RET_ADDRESS_CALL10 D=A @95 0;JMP (RET_ADDRESS_CALL10) @SP AM=M-1 D=M M=D @SP M=M+1 A=M-1 M=0 @54 0;JMP (apple.move) @4 D=A (LOOP_apple.move) D=D-1 @SP AM=M+1 A=A-1 M=0 @LOOP_apple.move D;JGT @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THIS M=D @SP M=M+1 A=M-1 M=0 @SP A=M-1 M=!M @SP AM=M-1 D=M @LCL A=M+1 A=A+1 M=D @0 D=A @R13 M=D @gameboard.gethead D=A @R14 M=D @RET_ADDRESS_CALL11 D=A @95 0;JMP (RET_ADDRESS_CALL11) @SP AM=M-1 D=M @LCL A=M+1 A=A+1 A=A+1 M=D (apple.move$while_exp0) @LCL A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @SP A=M-1 M=!M @SP AM=M-1 D=M @apple.move$while_end0 D;JNE @0 D=A @R13 M=D @random.nextint32 D=A @R14 M=D @RET_ADDRESS_CALL12 D=A @95 0;JMP (RET_ADDRESS_CALL12) @SP AM=M-1 D=M @LCL A=M M=D @0 D=A @R13 M=D @random.nextint32 D=A @R14 M=D @RET_ADDRESS_CALL13 D=A @95 0;JMP (RET_ADDRESS_CALL13) @SP AM=M-1 D=M @LCL A=M+1 M=D @LCL D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @3 D=A @R13 M=D @node.inyourlist D=A @R14 M=D @RET_ADDRESS_CALL14 D=A @95 0;JMP (RET_ADDRESS_CALL14) @SP AM=M-1 D=M @LCL A=M+1 A=A+1 M=D @LCL A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @SP A=M-1 M=!M @SP AM=M-1 D=M @apple.move$if_true0 D;JNE @apple.move$if_false0 0;JMP (apple.move$if_true0) @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @gameboard.isonmine D=A @R14 M=D @RET_ADDRESS_CALL15 D=A @95 0;JMP (RET_ADDRESS_CALL15) @SP AM=M-1 D=M @LCL A=M+1 A=A+1 M=D (apple.move$if_false0) @apple.move$while_exp0 0;JMP (apple.move$while_end0) @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THIS A=M M=D @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THIS A=M+1 M=D @THIS D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @apple.paint D=A @R14 M=D @RET_ADDRESS_CALL16 D=A @95 0;JMP (RET_ADDRESS_CALL16) @SP AM=M-1 D=M M=D @SP M=M+1 A=M-1 M=0 @54 0;JMP (apple.getx) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THIS M=D @THIS A=M D=M @SP AM=M+1 A=A-1 M=D @54 0;JMP (apple.gety) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THIS M=D @THIS A=M+1 D=M @SP AM=M+1 A=A-1 M=D @54 0;JMP (gameboard.clearmemory) @gameboard.0 D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @node.dispose D=A @R14 M=D @RET_ADDRESS_CALL17 D=A @95 0;JMP (RET_ADDRESS_CALL17) @SP AM=M-1 D=M M=D @gameboard.2 D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @apple.dispose D=A @R14 M=D @RET_ADDRESS_CALL18 D=A @95 0;JMP (RET_ADDRESS_CALL18) @SP AM=M-1 D=M M=D @gameboard.5 D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @string.dispose D=A @R14 M=D @RET_ADDRESS_CALL19 D=A @95 0;JMP (RET_ADDRESS_CALL19) @SP AM=M-1 D=M M=D @gameboard.10 D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @string.dispose D=A @R14 M=D @RET_ADDRESS_CALL20 D=A @95 0;JMP (RET_ADDRESS_CALL20) @SP AM=M-1 D=M M=D @THIS D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @gameboard.disposemines D=A @R14 M=D @RET_ADDRESS_CALL21 D=A @95 0;JMP (RET_ADDRESS_CALL21) @SP AM=M-1 D=M M=D @gameboard.6 D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @array.dispose D=A @R14 M=D @RET_ADDRESS_CALL22 D=A @95 0;JMP (RET_ADDRESS_CALL22) @SP AM=M-1 D=M M=D @SP M=M+1 A=M-1 M=0 @54 0;JMP (gameboard.disposemines) @SP A=M M=0 AD=A+1 M=0 @SP M=D+1 @SP M=M+1 A=M-1 M=0 @SP AM=M-1 D=M @LCL A=M M=D (gameboard.disposemines$while_exp0) @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @gameboard.7 D=M @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_LT0 D=A @38 0;JMP (RET_ADDRESS_LT0) @SP A=M-1 M=!M @SP AM=M-1 D=M @gameboard.disposemines$while_end0 D;JNE @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @gameboard.6 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M M=D @R5 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @LCL A=M+1 M=D @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @mine.dispose D=A @R14 M=D @RET_ADDRESS_CALL23 D=A @95 0;JMP (RET_ADDRESS_CALL23) @SP AM=M-1 D=M M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @LCL A=M M=D @gameboard.disposemines$while_exp0 0;JMP (gameboard.disposemines$while_end0) @SP M=M+1 A=M-1 M=0 @54 0;JMP (gameboard.init) @5 D=A (LOOP_gameboard.init) D=D-1 @SP AM=M+1 A=A-1 M=0 @LOOP_gameboard.init D;JGT @SP M=M+1 A=M-1 M=0 @1 D=A @R13 M=D @screen.setcolor D=A @R14 M=D @RET_ADDRESS_CALL24 D=A @95 0;JMP (RET_ADDRESS_CALL24) @SP AM=M-1 D=M M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @511 D=A @SP AM=M+1 A=A-1 M=D @255 D=A @SP AM=M+1 A=A-1 M=D @4 D=A @R13 M=D @screen.drawrectangle D=A @R14 M=D @RET_ADDRESS_CALL25 D=A @95 0;JMP (RET_ADDRESS_CALL25) @SP AM=M-1 D=M M=D @SP M=M+1 A=M-1 M=0 @SP A=M-1 M=!M @1 D=A @R13 M=D @screen.setcolor D=A @R14 M=D @RET_ADDRESS_CALL26 D=A @95 0;JMP (RET_ADDRESS_CALL26) @SP AM=M-1 D=M M=D @255 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @255 D=A @SP AM=M+1 A=A-1 M=D @255 D=A @SP AM=M+1 A=A-1 M=D @4 D=A @R13 M=D @screen.drawline D=A @R14 M=D @RET_ADDRESS_CALL27 D=A @95 0;JMP (RET_ADDRESS_CALL27) @SP AM=M-1 D=M M=D @16 D=A @SP AM=M+1 A=A-1 M=D @16 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @node.new D=A @R14 M=D @RET_ADDRESS_CALL28 D=A @95 0;JMP (RET_ADDRESS_CALL28) @SP AM=M-1 D=M @gameboard.0 M=D @17 D=A @SP AM=M+1 A=A-1 M=D @16 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @node.new D=A @R14 M=D @RET_ADDRESS_CALL29 D=A @95 0;JMP (RET_ADDRESS_CALL29) @SP AM=M-1 D=M @LCL A=M M=D @18 D=A @SP AM=M+1 A=A-1 M=D @16 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @node.new D=A @R14 M=D @RET_ADDRESS_CALL30 D=A @95 0;JMP (RET_ADDRESS_CALL30) @SP AM=M-1 D=M @gameboard.1 M=D @gameboard.0 D=M @SP AM=M+1 A=A-1 M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @node.setnext D=A @R14 M=D @RET_ADDRESS_CALL31 D=A @95 0;JMP (RET_ADDRESS_CALL31) @SP AM=M-1 D=M M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @gameboard.0 D=M @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @node.setprev D=A @R14 M=D @RET_ADDRESS_CALL32 D=A @95 0;JMP (RET_ADDRESS_CALL32) @SP AM=M-1 D=M M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @gameboard.1 D=M @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @node.setnext D=A @R14 M=D @RET_ADDRESS_CALL33 D=A @95 0;JMP (RET_ADDRESS_CALL33) @SP AM=M-1 D=M M=D @gameboard.1 D=M @SP AM=M+1 A=A-1 M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @node.setprev D=A @R14 M=D @RET_ADDRESS_CALL34 D=A @95 0;JMP (RET_ADDRESS_CALL34) @SP AM=M-1 D=M M=D @gameboard.0 D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @node.paint D=A @R14 M=D @RET_ADDRESS_CALL35 D=A @95 0;JMP (RET_ADDRESS_CALL35) @SP AM=M-1 D=M M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @node.paint D=A @R14 M=D @RET_ADDRESS_CALL36 D=A @95 0;JMP (RET_ADDRESS_CALL36) @SP AM=M-1 D=M M=D @gameboard.1 D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @node.paint D=A @R14 M=D @RET_ADDRESS_CALL37 D=A @95 0;JMP (RET_ADDRESS_CALL37) @SP AM=M-1 D=M M=D @SP M=M+1 A=M-1 M=0 @SP AM=M-1 D=M @gameboard.3 M=D @SP M=M+1 A=M-1 M=0 @SP AM=M-1 D=M @gameboard.4 M=D @7 D=A @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @string.new D=A @R14 M=D @RET_ADDRESS_CALL38 D=A @95 0;JMP (RET_ADDRESS_CALL38) @83 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL39 D=A @95 0;JMP (RET_ADDRESS_CALL39) @67 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL40 D=A @95 0;JMP (RET_ADDRESS_CALL40) @79 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL41 D=A @95 0;JMP (RET_ADDRESS_CALL41) @82 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL42 D=A @95 0;JMP (RET_ADDRESS_CALL42) @69 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL43 D=A @95 0;JMP (RET_ADDRESS_CALL43) @58 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL44 D=A @95 0;JMP (RET_ADDRESS_CALL44) @32 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL45 D=A @95 0;JMP (RET_ADDRESS_CALL45) @SP AM=M-1 D=M @gameboard.5 M=D @22 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @2 D=A @R13 M=D @output.movecursor D=A @R14 M=D @RET_ADDRESS_CALL46 D=A @95 0;JMP (RET_ADDRESS_CALL46) @SP AM=M-1 D=M M=D @gameboard.5 D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @output.printstring D=A @R14 M=D @RET_ADDRESS_CALL47 D=A @95 0;JMP (RET_ADDRESS_CALL47) @SP AM=M-1 D=M M=D @gameboard.4 D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @output.printint D=A @R14 M=D @RET_ADDRESS_CALL48 D=A @95 0;JMP (RET_ADDRESS_CALL48) @SP AM=M-1 D=M M=D @THIS D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @gameboard.initmines D=A @R14 M=D @RET_ADDRESS_CALL49 D=A @95 0;JMP (RET_ADDRESS_CALL49) @SP AM=M-1 D=M M=D @0 D=A @R13 M=D @apple.new D=A @R14 M=D @RET_ADDRESS_CALL50 D=A @95 0;JMP (RET_ADDRESS_CALL50) @SP AM=M-1 D=M @gameboard.2 M=D @gameboard.2 D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @apple.move D=A @R14 M=D @RET_ADDRESS_CALL51 D=A @95 0;JMP (RET_ADDRESS_CALL51) @SP AM=M-1 D=M M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M @gameboard.9 M=D @200 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @gameboard.8 M=D @7 D=A @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @string.new D=A @R14 M=D @RET_ADDRESS_CALL52 D=A @95 0;JMP (RET_ADDRESS_CALL52) @76 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL53 D=A @95 0;JMP (RET_ADDRESS_CALL53) @69 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL54 D=A @95 0;JMP (RET_ADDRESS_CALL54) @86 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL55 D=A @95 0;JMP (RET_ADDRESS_CALL55) @69 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL56 D=A @95 0;JMP (RET_ADDRESS_CALL56) @76 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL57 D=A @95 0;JMP (RET_ADDRESS_CALL57) @58 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL58 D=A @95 0;JMP (RET_ADDRESS_CALL58) @32 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL59 D=A @95 0;JMP (RET_ADDRESS_CALL59) @SP AM=M-1 D=M @gameboard.10 M=D @21 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @2 D=A @R13 M=D @output.movecursor D=A @R14 M=D @RET_ADDRESS_CALL60 D=A @95 0;JMP (RET_ADDRESS_CALL60) @SP AM=M-1 D=M M=D @gameboard.10 D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @output.printstring D=A @R14 M=D @RET_ADDRESS_CALL61 D=A @95 0;JMP (RET_ADDRESS_CALL61) @SP AM=M-1 D=M M=D @gameboard.9 D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @output.printint D=A @R14 M=D @RET_ADDRESS_CALL62 D=A @95 0;JMP (RET_ADDRESS_CALL62) @SP AM=M-1 D=M M=D @4 D=A @SP AM=M+1 A=A-1 M=D @10 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @output.movecursor D=A @R14 M=D @RET_ADDRESS_CALL63 D=A @95 0;JMP (RET_ADDRESS_CALL63) @SP AM=M-1 D=M M=D @11 D=A @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @string.new D=A @R14 M=D @RET_ADDRESS_CALL64 D=A @95 0;JMP (RET_ADDRESS_CALL64) @77 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL65 D=A @95 0;JMP (RET_ADDRESS_CALL65) @73 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL66 D=A @95 0;JMP (RET_ADDRESS_CALL66) @78 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL67 D=A @95 0;JMP (RET_ADDRESS_CALL67) @69 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL68 D=A @95 0;JMP (RET_ADDRESS_CALL68) @68 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL69 D=A @95 0;JMP (RET_ADDRESS_CALL69) @32 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL70 D=A @95 0;JMP (RET_ADDRESS_CALL70) @83 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL71 D=A @95 0;JMP (RET_ADDRESS_CALL71) @78 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL72 D=A @95 0;JMP (RET_ADDRESS_CALL72) @65 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL73 D=A @95 0;JMP (RET_ADDRESS_CALL73) @75 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL74 D=A @95 0;JMP (RET_ADDRESS_CALL74) @69 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL75 D=A @95 0;JMP (RET_ADDRESS_CALL75) @1 D=A @R13 M=D @output.printstring D=A @R14 M=D @RET_ADDRESS_CALL76 D=A @95 0;JMP (RET_ADDRESS_CALL76) @SP AM=M-1 D=M M=D @SP M=M+1 A=M-1 M=0 @54 0;JMP (gameboard.initmines) @8 D=A (LOOP_gameboard.initmines) D=D-1 @SP AM=M+1 A=A-1 M=0 @LOOP_gameboard.initmines D;JGT @gameboard.7 D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_EQ2 D=A @6 0;JMP (RET_ADDRESS_EQ2) @SP AM=M-1 D=M @gameboard.initmines$if_true0 D;JNE @gameboard.initmines$if_false0 0;JMP (gameboard.initmines$if_true0) @SP M=M+1 A=M-1 M=0 @54 0;JMP (gameboard.initmines$if_false0) @gameboard.7 D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @array.new D=A @R14 M=D @RET_ADDRESS_CALL77 D=A @95 0;JMP (RET_ADDRESS_CALL77) @SP AM=M-1 D=M @gameboard.6 M=D @SP M=M+1 A=M-1 M=0 @SP AM=M-1 D=M @LCL A=M M=D (gameboard.initmines$while_exp0) @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @gameboard.7 D=M @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_LT1 D=A @38 0;JMP (RET_ADDRESS_LT1) @SP A=M-1 M=!M @SP AM=M-1 D=M @gameboard.initmines$while_end0 D;JNE @0 D=A @R13 M=D @random.nextint32 D=A @R14 M=D @RET_ADDRESS_CALL78 D=A @95 0;JMP (RET_ADDRESS_CALL78) @SP AM=M-1 D=M @LCL A=M+1 A=A+1 M=D @0 D=A @R13 M=D @random.nextint32 D=A @R14 M=D @RET_ADDRESS_CALL79 D=A @95 0;JMP (RET_ADDRESS_CALL79) @SP AM=M-1 D=M @LCL A=M+1 A=A+1 A=A+1 M=D @SP M=M+1 A=M-1 M=0 @SP A=M-1 M=!M @SP AM=M-1 D=M @LCL A=M+1 A=A+1 A=A+1 A=A+1 M=D (gameboard.initmines$while_exp1) @LCL D=M @4 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP A=M-1 M=!M @SP AM=M-1 D=M @gameboard.initmines$while_end1 D;JNE @0 D=A @R13 M=D @random.nextint32 D=A @R14 M=D @RET_ADDRESS_CALL80 D=A @95 0;JMP (RET_ADDRESS_CALL80) @SP AM=M-1 D=M @LCL A=M+1 A=A+1 M=D @0 D=A @R13 M=D @random.nextint32 D=A @R14 M=D @RET_ADDRESS_CALL81 D=A @95 0;JMP (RET_ADDRESS_CALL81) @SP AM=M-1 D=M @LCL A=M+1 A=A+1 A=A+1 M=D @gameboard.0 D=M @SP AM=M+1 A=A-1 M=D @LCL A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @LCL D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @3 D=A @R13 M=D @node.inyourlist D=A @R14 M=D @RET_ADDRESS_CALL82 D=A @95 0;JMP (RET_ADDRESS_CALL82) @SP AM=M-1 D=M @LCL A=M+1 A=A+1 A=A+1 A=A+1 A=A+1 M=D @LCL D=M @5 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP A=M-1 M=!M @SP AM=M-1 D=M @gameboard.initmines$if_true1 D;JNE @gameboard.initmines$if_false1 0;JMP (gameboard.initmines$if_true1) @SP M=M+1 A=M-1 M=0 @SP AM=M-1 D=M @LCL A=M+1 M=D @SP M=M+1 A=M-1 M=0 @SP AM=M-1 D=M @LCL A=M+1 A=A+1 A=A+1 A=A+1 A=A+1 A=A+1 M=D (gameboard.initmines$while_exp2) @LCL D=M @6 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP A=M-1 M=!M @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_LT2 D=A @38 0;JMP (RET_ADDRESS_LT2) @SP AM=M-1 D=M A=A-1 M=D&M @SP A=M-1 M=!M @SP AM=M-1 D=M @gameboard.initmines$while_end2 D;JNE @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @gameboard.6 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M M=D @R5 D=M @SP AM=M+1 A=A-1 M=D @LCL D=M @7 D=D+A @R3 M=D @SP AM=M-1 D=M @R3 A=M M=D @LCL D=M @7 A=D+A D=M @SP AM=M+1 A=A-1 M=D @LCL A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @LCL D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @3 D=A @R13 M=D @mine.equals D=A @R14 M=D @RET_ADDRESS_CALL83 D=A @95 0;JMP (RET_ADDRESS_CALL83) @SP AM=M-1 D=M @LCL A=M+1 A=A+1 A=A+1 A=A+1 A=A+1 A=A+1 M=D @LCL D=M @6 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP A=M-1 M=!M @SP AM=M-1 D=M @gameboard.initmines$if_true2 D;JNE @gameboard.initmines$if_false2 0;JMP (gameboard.initmines$if_true2) @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @LCL A=M+1 M=D (gameboard.initmines$if_false2) @gameboard.initmines$while_exp2 0;JMP (gameboard.initmines$while_end2) (gameboard.initmines$if_false1) @LCL D=M @6 A=D+A D=M @SP AM=M+1 A=A-1 M=D @LCL D=M @5 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D|M @SP AM=M-1 D=M @LCL A=M+1 A=A+1 A=A+1 A=A+1 M=D @gameboard.initmines$while_exp1 0;JMP (gameboard.initmines$while_end1) @LCL A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @LCL D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @mine.new D=A @R14 M=D @RET_ADDRESS_CALL84 D=A @95 0;JMP (RET_ADDRESS_CALL84) @LCL D=M @7 D=D+A @R3 M=D @SP AM=M-1 D=M @R3 A=M M=D @LCL D=M @7 A=D+A D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @mine.paint D=A @R14 M=D @RET_ADDRESS_CALL85 D=A @95 0;JMP (RET_ADDRESS_CALL85) @SP AM=M-1 D=M M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @gameboard.6 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @THAT M=D @LCL D=M @7 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THAT A=M M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @LCL A=M M=D @gameboard.initmines$while_exp0 0;JMP (gameboard.initmines$while_end0) @SP M=M+1 A=M-1 M=0 @54 0;JMP (gameboard.run) @SP A=M M=0 AD=A+1 M=0 @SP M=D+1 @130 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @LCL A=M M=D (gameboard.run$while_exp0) @gameboard.3 D=M @SP AM=M+1 A=A-1 M=D @SP A=M-1 M=!M @SP A=M-1 M=!M @SP AM=M-1 D=M @gameboard.run$while_end0 D;JNE @0 D=A @R13 M=D @keyboard.keypressed D=A @R14 M=D @RET_ADDRESS_CALL86 D=A @95 0;JMP (RET_ADDRESS_CALL86) @SP AM=M-1 D=M @LCL A=M+1 M=D @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_EQ3 D=A @6 0;JMP (RET_ADDRESS_EQ3) @SP A=M-1 M=!M @SP AM=M-1 D=M @gameboard.run$if_true0 D;JNE @gameboard.run$if_false0 0;JMP (gameboard.run$if_true0) @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @129 D=A @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_GT0 D=A @22 0;JMP (RET_ADDRESS_GT0) @SP AM=M-1 D=M @gameboard.run$if_true1 D;JNE @gameboard.run$if_false1 0;JMP (gameboard.run$if_true1) @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @134 D=A @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_LT3 D=A @38 0;JMP (RET_ADDRESS_LT3) @SP AM=M-1 D=M @gameboard.run$if_true2 D;JNE @gameboard.run$if_false2 0;JMP (gameboard.run$if_true2) @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=M-D @1 D=A @R13 M=D @math.abs D=A @R14 M=D @RET_ADDRESS_CALL87 D=A @95 0;JMP (RET_ADDRESS_CALL87) @2 D=A @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_EQ4 D=A @6 0;JMP (RET_ADDRESS_EQ4) @SP A=M-1 M=!M @SP AM=M-1 D=M @gameboard.run$if_true3 D;JNE @gameboard.run$if_false3 0;JMP (gameboard.run$if_true3) @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @LCL A=M M=D (gameboard.run$if_false3) (gameboard.run$if_false2) @gameboard.run$if_end1 0;JMP (gameboard.run$if_false1) @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @81 D=A @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_EQ5 D=A @6 0;JMP (RET_ADDRESS_EQ5) @SP AM=M-1 D=M @gameboard.run$if_true4 D;JNE @gameboard.run$if_false4 0;JMP (gameboard.run$if_true4) @SP M=M+1 A=M-1 M=0 @SP A=M-1 M=!M @SP AM=M-1 D=M @gameboard.3 M=D (gameboard.run$if_false4) (gameboard.run$if_end1) (gameboard.run$if_false0) @gameboard.0 D=M @SP AM=M+1 A=A-1 M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @node.step D=A @R14 M=D @RET_ADDRESS_CALL88 D=A @95 0;JMP (RET_ADDRESS_CALL88) @SP AM=M-1 D=M M=D @gameboard.4 D=M @SP AM=M+1 A=A-1 M=D @48 D=A @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_EQ6 D=A @6 0;JMP (RET_ADDRESS_EQ6) @SP AM=M-1 D=M @gameboard.run$if_true5 D;JNE @gameboard.run$if_false5 0;JMP (gameboard.run$if_true5) @7 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @output.movecursor D=A @R14 M=D @RET_ADDRESS_CALL89 D=A @95 0;JMP (RET_ADDRESS_CALL89) @SP AM=M-1 D=M M=D @7 D=A @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @string.new D=A @R14 M=D @RET_ADDRESS_CALL90 D=A @95 0;JMP (RET_ADDRESS_CALL90) @89 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL91 D=A @95 0;JMP (RET_ADDRESS_CALL91) @79 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL92 D=A @95 0;JMP (RET_ADDRESS_CALL92) @85 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL93 D=A @95 0;JMP (RET_ADDRESS_CALL93) @32 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL94 D=A @95 0;JMP (RET_ADDRESS_CALL94) @87 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL95 D=A @95 0;JMP (RET_ADDRESS_CALL95) @73 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL96 D=A @95 0;JMP (RET_ADDRESS_CALL96) @78 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL97 D=A @95 0;JMP (RET_ADDRESS_CALL97) @1 D=A @R13 M=D @output.printstring D=A @R14 M=D @RET_ADDRESS_CALL98 D=A @95 0;JMP (RET_ADDRESS_CALL98) @SP AM=M-1 D=M M=D @SP M=M+1 A=M-1 M=0 @54 0;JMP (gameboard.run$if_false5) @gameboard.8 D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @sys.wait D=A @R14 M=D @RET_ADDRESS_CALL99 D=A @95 0;JMP (RET_ADDRESS_CALL99) @SP AM=M-1 D=M M=D @gameboard.run$while_exp0 0;JMP (gameboard.run$while_end0) @SP M=M+1 A=M-1 M=0 @54 0;JMP (gameboard.success) @gameboard.2 D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @apple.move D=A @R14 M=D @RET_ADDRESS_CALL100 D=A @95 0;JMP (RET_ADDRESS_CALL100) @SP AM=M-1 D=M M=D @gameboard.4 D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @gameboard.4 M=D @gameboard.4 D=M @SP AM=M+1 A=A-1 M=D @7 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D&M @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_EQ7 D=A @6 0;JMP (RET_ADDRESS_EQ7) @SP AM=M-1 D=M @gameboard.success$if_true0 D;JNE @gameboard.success$if_false0 0;JMP (gameboard.success$if_true0) @gameboard.8 D=M @SP AM=M+1 A=A-1 M=D @50 D=A @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_GT1 D=A @22 0;JMP (RET_ADDRESS_GT1) @SP AM=M-1 D=M @gameboard.success$if_true1 D;JNE @gameboard.success$if_false1 0;JMP (gameboard.success$if_true1) @gameboard.8 D=M @SP AM=M+1 A=A-1 M=D @30 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=M-D @SP AM=M-1 D=M @gameboard.8 M=D @gameboard.9 D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @gameboard.9 M=D @21 D=A @SP AM=M+1 A=A-1 M=D @7 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @output.movecursor D=A @R14 M=D @RET_ADDRESS_CALL101 D=A @95 0;JMP (RET_ADDRESS_CALL101) @SP AM=M-1 D=M M=D @gameboard.9 D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @output.printint D=A @R14 M=D @RET_ADDRESS_CALL102 D=A @95 0;JMP (RET_ADDRESS_CALL102) @SP AM=M-1 D=M M=D (gameboard.success$if_false1) (gameboard.success$if_false0) @22 D=A @SP AM=M+1 A=A-1 M=D @7 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @output.movecursor D=A @R14 M=D @RET_ADDRESS_CALL103 D=A @95 0;JMP (RET_ADDRESS_CALL103) @SP AM=M-1 D=M M=D @gameboard.4 D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @output.printint D=A @R14 M=D @RET_ADDRESS_CALL104 D=A @95 0;JMP (RET_ADDRESS_CALL104) @SP AM=M-1 D=M M=D @SP M=M+1 A=M-1 M=0 @54 0;JMP (gameboard.isonmine) @3 D=A (LOOP_gameboard.isonmine) D=D-1 @SP AM=M+1 A=A-1 M=0 @LOOP_gameboard.isonmine D;JGT @gameboard.7 D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_EQ8 D=A @6 0;JMP (RET_ADDRESS_EQ8) @SP AM=M-1 D=M @gameboard.isonmine$if_true0 D;JNE @gameboard.isonmine$if_false0 0;JMP (gameboard.isonmine$if_true0) @SP M=M+1 A=M-1 M=0 @54 0;JMP (gameboard.isonmine$if_false0) @SP M=M+1 A=M-1 M=0 @SP AM=M-1 D=M @LCL A=M M=D (gameboard.isonmine$while_exp0) @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @gameboard.7 D=M @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_LT4 D=A @38 0;JMP (RET_ADDRESS_LT4) @SP A=M-1 M=!M @SP AM=M-1 D=M @gameboard.isonmine$while_end0 D;JNE @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @gameboard.6 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M M=D @R5 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @LCL A=M+1 A=A+1 M=D @LCL A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @3 D=A @R13 M=D @mine.equals D=A @R14 M=D @RET_ADDRESS_CALL105 D=A @95 0;JMP (RET_ADDRESS_CALL105) @SP AM=M-1 D=M @LCL A=M+1 M=D @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @gameboard.isonmine$if_true1 D;JNE @gameboard.isonmine$if_false1 0;JMP (gameboard.isonmine$if_true1) @SP M=M+1 A=M-1 M=0 @SP A=M-1 M=!M @54 0;JMP (gameboard.isonmine$if_false1) @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @LCL A=M M=D @gameboard.isonmine$while_exp0 0;JMP (gameboard.isonmine$while_end0) @SP M=M+1 A=M-1 M=0 @54 0;JMP (gameboard.gethead) @gameboard.0 D=M @SP AM=M+1 A=A-1 M=D @54 0;JMP (gameboard.sethead) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @gameboard.0 M=D @SP M=M+1 A=M-1 M=0 @54 0;JMP (gameboard.gettail) @gameboard.1 D=M @SP AM=M+1 A=A-1 M=D @54 0;JMP (gameboard.settail) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @gameboard.1 M=D @SP M=M+1 A=M-1 M=0 @54 0;JMP (gameboard.setminescount) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @gameboard.7 M=D @SP M=M+1 A=M-1 M=0 @54 0;JMP (gameboard.getapple) @gameboard.2 D=M @SP AM=M+1 A=A-1 M=D @54 0;JMP (gameboard.posx) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @8 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @math.multiply D=A @R14 M=D @RET_ADDRESS_CALL106 D=A @95 0;JMP (RET_ADDRESS_CALL106) @256 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @54 0;JMP (gameboard.posy) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @8 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @math.multiply D=A @R14 M=D @RET_ADDRESS_CALL107 D=A @95 0;JMP (RET_ADDRESS_CALL107) @54 0;JMP (main.main) @SP A=M M=0 AD=A+1 M=0 @SP M=D+1 @THIS D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @main.getinput D=A @R14 M=D @RET_ADDRESS_CALL108 D=A @95 0;JMP (RET_ADDRESS_CALL108) @SP AM=M-1 D=M M=D @0 D=A @R13 M=D @gameboard.init D=A @R14 M=D @RET_ADDRESS_CALL109 D=A @95 0;JMP (RET_ADDRESS_CALL109) @SP AM=M-1 D=M M=D @0 D=A @R13 M=D @gameboard.run D=A @R14 M=D @RET_ADDRESS_CALL110 D=A @95 0;JMP (RET_ADDRESS_CALL110) @SP AM=M-1 D=M M=D @0 D=A @R13 M=D @gameboard.clearmemory D=A @R14 M=D @RET_ADDRESS_CALL111 D=A @95 0;JMP (RET_ADDRESS_CALL111) @SP AM=M-1 D=M M=D @SP M=M+1 A=M-1 M=0 @54 0;JMP (main.getinput) @SP AM=M+1 A=A-1 M=0 @29 D=A @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @string.new D=A @R14 M=D @RET_ADDRESS_CALL112 D=A @95 0;JMP (RET_ADDRESS_CALL112) @72 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL113 D=A @95 0;JMP (RET_ADDRESS_CALL113) @79 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL114 D=A @95 0;JMP (RET_ADDRESS_CALL114) @87 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL115 D=A @95 0;JMP (RET_ADDRESS_CALL115) @32 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL116 D=A @95 0;JMP (RET_ADDRESS_CALL116) @77 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL117 D=A @95 0;JMP (RET_ADDRESS_CALL117) @65 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL118 D=A @95 0;JMP (RET_ADDRESS_CALL118) @78 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL119 D=A @95 0;JMP (RET_ADDRESS_CALL119) @89 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL120 D=A @95 0;JMP (RET_ADDRESS_CALL120) @32 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL121 D=A @95 0;JMP (RET_ADDRESS_CALL121) @77 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL122 D=A @95 0;JMP (RET_ADDRESS_CALL122) @73 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL123 D=A @95 0;JMP (RET_ADDRESS_CALL123) @78 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL124 D=A @95 0;JMP (RET_ADDRESS_CALL124) @69 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL125 D=A @95 0;JMP (RET_ADDRESS_CALL125) @83 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL126 D=A @95 0;JMP (RET_ADDRESS_CALL126) @32 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL127 D=A @95 0;JMP (RET_ADDRESS_CALL127) @68 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL128 D=A @95 0;JMP (RET_ADDRESS_CALL128) @79 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL129 D=A @95 0;JMP (RET_ADDRESS_CALL129) @32 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL130 D=A @95 0;JMP (RET_ADDRESS_CALL130) @89 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL131 D=A @95 0;JMP (RET_ADDRESS_CALL131) @79 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL132 D=A @95 0;JMP (RET_ADDRESS_CALL132) @85 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL133 D=A @95 0;JMP (RET_ADDRESS_CALL133) @32 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL134 D=A @95 0;JMP (RET_ADDRESS_CALL134) @87 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL135 D=A @95 0;JMP (RET_ADDRESS_CALL135) @65 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL136 D=A @95 0;JMP (RET_ADDRESS_CALL136) @78 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL137 D=A @95 0;JMP (RET_ADDRESS_CALL137) @84 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL138 D=A @95 0;JMP (RET_ADDRESS_CALL138) @32 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL139 D=A @95 0;JMP (RET_ADDRESS_CALL139) @58 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL140 D=A @95 0;JMP (RET_ADDRESS_CALL140) @32 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL141 D=A @95 0;JMP (RET_ADDRESS_CALL141) @1 D=A @R13 M=D @keyboard.readint D=A @R14 M=D @RET_ADDRESS_CALL142 D=A @95 0;JMP (RET_ADDRESS_CALL142) @SP AM=M-1 D=M @LCL A=M M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @10 D=A @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_GT2 D=A @22 0;JMP (RET_ADDRESS_GT2) @SP AM=M-1 D=M @main.getinput$if_true0 D;JNE @main.getinput$if_false0 0;JMP (main.getinput$if_true0) @25 D=A @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @string.new D=A @R14 M=D @RET_ADDRESS_CALL143 D=A @95 0;JMP (RET_ADDRESS_CALL143) @79 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL144 D=A @95 0;JMP (RET_ADDRESS_CALL144) @78 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL145 D=A @95 0;JMP (RET_ADDRESS_CALL145) @76 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL146 D=A @95 0;JMP (RET_ADDRESS_CALL146) @89 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL147 D=A @95 0;JMP (RET_ADDRESS_CALL147) @32 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL148 D=A @95 0;JMP (RET_ADDRESS_CALL148) @49 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL149 D=A @95 0;JMP (RET_ADDRESS_CALL149) @48 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL150 D=A @95 0;JMP (RET_ADDRESS_CALL150) @32 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL151 D=A @95 0;JMP (RET_ADDRESS_CALL151) @77 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL152 D=A @95 0;JMP (RET_ADDRESS_CALL152) @73 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL153 D=A @95 0;JMP (RET_ADDRESS_CALL153) @78 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL154 D=A @95 0;JMP (RET_ADDRESS_CALL154) @69 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL155 D=A @95 0;JMP (RET_ADDRESS_CALL155) @83 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL156 D=A @95 0;JMP (RET_ADDRESS_CALL156) @32 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL157 D=A @95 0;JMP (RET_ADDRESS_CALL157) @65 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL158 D=A @95 0;JMP (RET_ADDRESS_CALL158) @82 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL159 D=A @95 0;JMP (RET_ADDRESS_CALL159) @69 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL160 D=A @95 0;JMP (RET_ADDRESS_CALL160) @32 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL161 D=A @95 0;JMP (RET_ADDRESS_CALL161) @65 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL162 D=A @95 0;JMP (RET_ADDRESS_CALL162) @76 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL163 D=A @95 0;JMP (RET_ADDRESS_CALL163) @76 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL164 D=A @95 0;JMP (RET_ADDRESS_CALL164) @79 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL165 D=A @95 0;JMP (RET_ADDRESS_CALL165) @87 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL166 D=A @95 0;JMP (RET_ADDRESS_CALL166) @69 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL167 D=A @95 0;JMP (RET_ADDRESS_CALL167) @68 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL168 D=A @95 0;JMP (RET_ADDRESS_CALL168) @1 D=A @R13 M=D @output.printstring D=A @R14 M=D @RET_ADDRESS_CALL169 D=A @95 0;JMP (RET_ADDRESS_CALL169) @SP AM=M-1 D=M M=D @0 D=A @R13 M=D @sys.halt D=A @R14 M=D @RET_ADDRESS_CALL170 D=A @95 0;JMP (RET_ADDRESS_CALL170) @SP AM=M-1 D=M M=D (main.getinput$if_false0) @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @gameboard.setminescount D=A @R14 M=D @RET_ADDRESS_CALL171 D=A @95 0;JMP (RET_ADDRESS_CALL171) @SP AM=M-1 D=M M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @random.setb D=A @R14 M=D @RET_ADDRESS_CALL172 D=A @95 0;JMP (RET_ADDRESS_CALL172) @SP AM=M-1 D=M M=D @24 D=A @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @string.new D=A @R14 M=D @RET_ADDRESS_CALL173 D=A @95 0;JMP (RET_ADDRESS_CALL173) @69 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL174 D=A @95 0;JMP (RET_ADDRESS_CALL174) @78 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL175 D=A @95 0;JMP (RET_ADDRESS_CALL175) @84 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL176 D=A @95 0;JMP (RET_ADDRESS_CALL176) @69 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL177 D=A @95 0;JMP (RET_ADDRESS_CALL177) @82 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL178 D=A @95 0;JMP (RET_ADDRESS_CALL178) @32 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL179 D=A @95 0;JMP (RET_ADDRESS_CALL179) @78 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL180 D=A @95 0;JMP (RET_ADDRESS_CALL180) @85 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL181 D=A @95 0;JMP (RET_ADDRESS_CALL181) @77 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL182 D=A @95 0;JMP (RET_ADDRESS_CALL182) @66 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL183 D=A @95 0;JMP (RET_ADDRESS_CALL183) @69 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL184 D=A @95 0;JMP (RET_ADDRESS_CALL184) @82 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL185 D=A @95 0;JMP (RET_ADDRESS_CALL185) @32 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL186 D=A @95 0;JMP (RET_ADDRESS_CALL186) @85 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL187 D=A @95 0;JMP (RET_ADDRESS_CALL187) @80 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL188 D=A @95 0;JMP (RET_ADDRESS_CALL188) @32 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL189 D=A @95 0;JMP (RET_ADDRESS_CALL189) @84 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL190 D=A @95 0;JMP (RET_ADDRESS_CALL190) @79 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL191 D=A @95 0;JMP (RET_ADDRESS_CALL191) @32 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL192 D=A @95 0;JMP (RET_ADDRESS_CALL192) @51 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL193 D=A @95 0;JMP (RET_ADDRESS_CALL193) @48 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL194 D=A @95 0;JMP (RET_ADDRESS_CALL194) @32 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL195 D=A @95 0;JMP (RET_ADDRESS_CALL195) @58 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL196 D=A @95 0;JMP (RET_ADDRESS_CALL196) @32 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL197 D=A @95 0;JMP (RET_ADDRESS_CALL197) @1 D=A @R13 M=D @keyboard.readint D=A @R14 M=D @RET_ADDRESS_CALL198 D=A @95 0;JMP (RET_ADDRESS_CALL198) @SP AM=M-1 D=M @LCL A=M M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @random.setseed D=A @R14 M=D @RET_ADDRESS_CALL199 D=A @95 0;JMP (RET_ADDRESS_CALL199) @SP AM=M-1 D=M M=D @SP M=M+1 A=M-1 M=0 @54 0;JMP (main.gameover) @7 D=A @SP AM=M+1 A=A-1 M=D @11 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @output.movecursor D=A @R14 M=D @RET_ADDRESS_CALL200 D=A @95 0;JMP (RET_ADDRESS_CALL200) @SP AM=M-1 D=M M=D @9 D=A @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @string.new D=A @R14 M=D @RET_ADDRESS_CALL201 D=A @95 0;JMP (RET_ADDRESS_CALL201) @71 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL202 D=A @95 0;JMP (RET_ADDRESS_CALL202) @65 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL203 D=A @95 0;JMP (RET_ADDRESS_CALL203) @77 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL204 D=A @95 0;JMP (RET_ADDRESS_CALL204) @69 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL205 D=A @95 0;JMP (RET_ADDRESS_CALL205) @32 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL206 D=A @95 0;JMP (RET_ADDRESS_CALL206) @79 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL207 D=A @95 0;JMP (RET_ADDRESS_CALL207) @86 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL208 D=A @95 0;JMP (RET_ADDRESS_CALL208) @69 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL209 D=A @95 0;JMP (RET_ADDRESS_CALL209) @82 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL210 D=A @95 0;JMP (RET_ADDRESS_CALL210) @1 D=A @R13 M=D @output.printstring D=A @R14 M=D @RET_ADDRESS_CALL211 D=A @95 0;JMP (RET_ADDRESS_CALL211) @SP AM=M-1 D=M M=D @0 D=A @R13 M=D @gameboard.clearmemory D=A @R14 M=D @RET_ADDRESS_CALL212 D=A @95 0;JMP (RET_ADDRESS_CALL212) @SP AM=M-1 D=M M=D @0 D=A @R13 M=D @sys.halt D=A @R14 M=D @RET_ADDRESS_CALL213 D=A @95 0;JMP (RET_ADDRESS_CALL213) @SP AM=M-1 D=M M=D @SP M=M+1 A=M-1 M=0 @54 0;JMP (mine.new) @2 D=A @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @memory.alloc D=A @R14 M=D @RET_ADDRESS_CALL214 D=A @95 0;JMP (RET_ADDRESS_CALL214) @SP AM=M-1 D=M @THIS M=D @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THIS A=M M=D @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THIS A=M+1 M=D @THIS D=M @SP AM=M+1 A=A-1 M=D @54 0;JMP (mine.dispose) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THIS M=D @THIS D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @memory.dealloc D=A @R14 M=D @RET_ADDRESS_CALL215 D=A @95 0;JMP (RET_ADDRESS_CALL215) @SP AM=M-1 D=M M=D @SP M=M+1 A=M-1 M=0 @54 0;JMP (mine.paint) @SP A=M M=0 AD=A+1 M=0 @SP M=D+1 @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THIS M=D @THIS A=M D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @gameboard.posx D=A @R14 M=D @RET_ADDRESS_CALL216 D=A @95 0;JMP (RET_ADDRESS_CALL216) @SP AM=M-1 D=M @LCL A=M M=D @THIS A=M+1 D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @gameboard.posy D=A @R14 M=D @RET_ADDRESS_CALL217 D=A @95 0;JMP (RET_ADDRESS_CALL217) @SP AM=M-1 D=M @LCL A=M+1 M=D @SP M=M+1 A=M-1 M=0 @SP A=M-1 M=!M @1 D=A @R13 M=D @screen.setcolor D=A @R14 M=D @RET_ADDRESS_CALL218 D=A @95 0;JMP (RET_ADDRESS_CALL218) @SP AM=M-1 D=M M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @4 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @7 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @3 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @4 D=A @R13 M=D @screen.drawline D=A @R14 M=D @RET_ADDRESS_CALL219 D=A @95 0;JMP (RET_ADDRESS_CALL219) @SP AM=M-1 D=M M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @7 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @4 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @4 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @7 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @4 D=A @R13 M=D @screen.drawline D=A @R14 M=D @RET_ADDRESS_CALL220 D=A @95 0;JMP (RET_ADDRESS_CALL220) @SP AM=M-1 D=M M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @3 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @7 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @4 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @4 D=A @R13 M=D @screen.drawline D=A @R14 M=D @RET_ADDRESS_CALL221 D=A @95 0;JMP (RET_ADDRESS_CALL221) @SP AM=M-1 D=M M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @3 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @3 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @4 D=A @R13 M=D @screen.drawline D=A @R14 M=D @RET_ADDRESS_CALL222 D=A @95 0;JMP (RET_ADDRESS_CALL222) @SP AM=M-1 D=M M=D @SP M=M+1 A=M-1 M=0 @54 0;JMP (mine.equals) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THIS M=D @THIS A=M D=M @SP AM=M+1 A=A-1 M=D @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_EQ9 D=A @6 0;JMP (RET_ADDRESS_EQ9) @SP AM=M-1 D=M @mine.equals$if_true0 D;JNE @mine.equals$if_false0 0;JMP (mine.equals$if_true0) @THIS A=M+1 D=M @SP AM=M+1 A=A-1 M=D @ARG A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_EQ10 D=A @6 0;JMP (RET_ADDRESS_EQ10) @SP AM=M-1 D=M @mine.equals$if_true1 D;JNE @mine.equals$if_false1 0;JMP (mine.equals$if_true1) @SP M=M+1 A=M-1 M=0 @SP A=M-1 M=!M @54 0;JMP (mine.equals$if_false1) (mine.equals$if_false0) @SP M=M+1 A=M-1 M=0 @54 0;JMP (node.new) @4 D=A @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @memory.alloc D=A @R14 M=D @RET_ADDRESS_CALL223 D=A @95 0;JMP (RET_ADDRESS_CALL223) @SP AM=M-1 D=M @THIS M=D @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THIS A=M M=D @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THIS A=M+1 M=D @SP M=M+1 A=M-1 M=0 @SP AM=M-1 D=M @THIS A=M+1 A=A+1 M=D @SP M=M+1 A=M-1 M=0 @SP AM=M-1 D=M @THIS A=M+1 A=A+1 A=A+1 M=D @THIS D=M @SP AM=M+1 A=A-1 M=D @54 0;JMP (node.dispose) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THIS M=D @THIS A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_EQ11 D=A @6 0;JMP (RET_ADDRESS_EQ11) @SP A=M-1 M=!M @SP AM=M-1 D=M @node.dispose$if_true0 D;JNE @node.dispose$if_false0 0;JMP (node.dispose$if_true0) @THIS A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @node.dispose D=A @R14 M=D @RET_ADDRESS_CALL224 D=A @95 0;JMP (RET_ADDRESS_CALL224) @SP AM=M-1 D=M M=D (node.dispose$if_false0) @THIS D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_EQ12 D=A @6 0;JMP (RET_ADDRESS_EQ12) @SP A=M-1 M=!M @SP AM=M-1 D=M @node.dispose$if_true1 D;JNE @node.dispose$if_false1 0;JMP (node.dispose$if_true1) @THIS D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @2 D=A @R13 M=D @node.setnext D=A @R14 M=D @RET_ADDRESS_CALL225 D=A @95 0;JMP (RET_ADDRESS_CALL225) @SP AM=M-1 D=M M=D (node.dispose$if_false1) @THIS D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @memory.dealloc D=A @R14 M=D @RET_ADDRESS_CALL226 D=A @95 0;JMP (RET_ADDRESS_CALL226) @SP AM=M-1 D=M M=D @SP M=M+1 A=M-1 M=0 @54 0;JMP (node.step) @7 D=A (LOOP_node.step) D=D-1 @SP AM=M+1 A=A-1 M=0 @LOOP_node.step D;JGT @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THIS M=D @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @130 D=A @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_EQ13 D=A @6 0;JMP (RET_ADDRESS_EQ13) @SP AM=M-1 D=M @node.step$if_true0 D;JNE @node.step$if_false0 0;JMP (node.step$if_true0) @THIS A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @LCL A=M+1 M=D @THIS A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=M-D @SP AM=M-1 D=M @LCL A=M M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_LT5 D=A @38 0;JMP (RET_ADDRESS_LT5) @SP AM=M-1 D=M @node.step$if_true1 D;JNE @node.step$if_false1 0;JMP (node.step$if_true1) @0 D=A @R13 M=D @main.gameover D=A @R14 M=D @RET_ADDRESS_CALL227 D=A @95 0;JMP (RET_ADDRESS_CALL227) @SP AM=M-1 D=M M=D (node.step$if_false1) @node.step$if_end0 0;JMP (node.step$if_false0) @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @131 D=A @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_EQ14 D=A @6 0;JMP (RET_ADDRESS_EQ14) @SP AM=M-1 D=M @node.step$if_true2 D;JNE @node.step$if_false2 0;JMP (node.step$if_true2) @THIS A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @LCL A=M M=D @THIS A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=M-D @SP AM=M-1 D=M @LCL A=M+1 M=D @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_LT6 D=A @38 0;JMP (RET_ADDRESS_LT6) @SP AM=M-1 D=M @node.step$if_true3 D;JNE @node.step$if_false3 0;JMP (node.step$if_true3) @0 D=A @R13 M=D @main.gameover D=A @R14 M=D @RET_ADDRESS_CALL228 D=A @95 0;JMP (RET_ADDRESS_CALL228) @SP AM=M-1 D=M M=D (node.step$if_false3) @node.step$if_end2 0;JMP (node.step$if_false2) @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @132 D=A @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_EQ15 D=A @6 0;JMP (RET_ADDRESS_EQ15) @SP AM=M-1 D=M @node.step$if_true4 D;JNE @node.step$if_false4 0;JMP (node.step$if_true4) @THIS A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @LCL A=M+1 M=D @THIS A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @LCL A=M M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @31 D=A @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_GT3 D=A @22 0;JMP (RET_ADDRESS_GT3) @SP AM=M-1 D=M @node.step$if_true5 D;JNE @node.step$if_false5 0;JMP (node.step$if_true5) @0 D=A @R13 M=D @main.gameover D=A @R14 M=D @RET_ADDRESS_CALL229 D=A @95 0;JMP (RET_ADDRESS_CALL229) @SP AM=M-1 D=M M=D (node.step$if_false5) @node.step$if_end4 0;JMP (node.step$if_false4) @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @133 D=A @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_EQ16 D=A @6 0;JMP (RET_ADDRESS_EQ16) @SP AM=M-1 D=M @node.step$if_true6 D;JNE @node.step$if_false6 0;JMP (node.step$if_true6) @THIS A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @LCL A=M M=D @THIS A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @LCL A=M+1 M=D @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @31 D=A @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_GT4 D=A @22 0;JMP (RET_ADDRESS_GT4) @SP AM=M-1 D=M @node.step$if_true7 D;JNE @node.step$if_false7 0;JMP (node.step$if_true7) @0 D=A @R13 M=D @main.gameover D=A @R14 M=D @RET_ADDRESS_CALL230 D=A @95 0;JMP (RET_ADDRESS_CALL230) @SP AM=M-1 D=M M=D (node.step$if_false7) @node.step$if_end6 0;JMP (node.step$if_false6) @101 D=A @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @sys.error D=A @R14 M=D @RET_ADDRESS_CALL231 D=A @95 0;JMP (RET_ADDRESS_CALL231) @SP AM=M-1 D=M M=D (node.step$if_end6) (node.step$if_end4) (node.step$if_end2) (node.step$if_end0) @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @gameboard.isonmine D=A @R14 M=D @RET_ADDRESS_CALL232 D=A @95 0;JMP (RET_ADDRESS_CALL232) @SP AM=M-1 D=M @node.step$if_true8 D;JNE @node.step$if_false8 0;JMP (node.step$if_true8) @0 D=A @R13 M=D @main.gameover D=A @R14 M=D @RET_ADDRESS_CALL233 D=A @95 0;JMP (RET_ADDRESS_CALL233) @SP AM=M-1 D=M M=D (node.step$if_false8) @0 D=A @R13 M=D @gameboard.getapple D=A @R14 M=D @RET_ADDRESS_CALL234 D=A @95 0;JMP (RET_ADDRESS_CALL234) @SP AM=M-1 D=M @LCL A=M+1 A=A+1 A=A+1 A=A+1 A=A+1 A=A+1 M=D @LCL D=M @6 A=D+A D=M @SP AM=M+1 A=A-1 M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @3 D=A @R13 M=D @apple.equals D=A @R14 M=D @RET_ADDRESS_CALL235 D=A @95 0;JMP (RET_ADDRESS_CALL235) @SP AM=M-1 D=M @node.step$if_true9 D;JNE @node.step$if_false9 0;JMP (node.step$if_true9) @0 D=A @R13 M=D @gameboard.success D=A @R14 M=D @RET_ADDRESS_CALL236 D=A @95 0;JMP (RET_ADDRESS_CALL236) @SP AM=M-1 D=M M=D @node.step$if_end9 0;JMP (node.step$if_false9) @0 D=A @R13 M=D @gameboard.gettail D=A @R14 M=D @RET_ADDRESS_CALL237 D=A @95 0;JMP (RET_ADDRESS_CALL237) @SP AM=M-1 D=M @LCL A=M+1 A=A+1 A=A+1 A=A+1 M=D @LCL D=M @4 A=D+A D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @node.getprev D=A @R14 M=D @RET_ADDRESS_CALL238 D=A @95 0;JMP (RET_ADDRESS_CALL238) @SP AM=M-1 D=M @LCL A=M+1 A=A+1 A=A+1 A=A+1 A=A+1 M=D @LCL D=M @5 A=D+A D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @gameboard.settail D=A @R14 M=D @RET_ADDRESS_CALL239 D=A @95 0;JMP (RET_ADDRESS_CALL239) @SP AM=M-1 D=M M=D @LCL D=M @4 A=D+A D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @node.erase D=A @R14 M=D @RET_ADDRESS_CALL240 D=A @95 0;JMP (RET_ADDRESS_CALL240) @SP AM=M-1 D=M M=D @LCL D=M @4 A=D+A D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @node.dispose D=A @R14 M=D @RET_ADDRESS_CALL241 D=A @95 0;JMP (RET_ADDRESS_CALL241) @SP AM=M-1 D=M M=D (node.step$if_end9) @0 D=A @R13 M=D @gameboard.gethead D=A @R14 M=D @RET_ADDRESS_CALL242 D=A @95 0;JMP (RET_ADDRESS_CALL242) @SP AM=M-1 D=M @LCL A=M+1 A=A+1 A=A+1 M=D @LCL D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @3 D=A @R13 M=D @node.inyourlist D=A @R14 M=D @RET_ADDRESS_CALL243 D=A @95 0;JMP (RET_ADDRESS_CALL243) @SP AM=M-1 D=M @node.step$if_true10 D;JNE @node.step$if_false10 0;JMP (node.step$if_true10) @0 D=A @R13 M=D @main.gameover D=A @R14 M=D @RET_ADDRESS_CALL244 D=A @95 0;JMP (RET_ADDRESS_CALL244) @SP AM=M-1 D=M M=D (node.step$if_false10) @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @node.new D=A @R14 M=D @RET_ADDRESS_CALL245 D=A @95 0;JMP (RET_ADDRESS_CALL245) @SP AM=M-1 D=M @LCL A=M+1 A=A+1 M=D @LCL A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @THIS D=M @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @node.setnext D=A @R14 M=D @RET_ADDRESS_CALL246 D=A @95 0;JMP (RET_ADDRESS_CALL246) @SP AM=M-1 D=M M=D @LCL A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THIS A=M+1 A=A+1 A=A+1 M=D @LCL A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @node.paint D=A @R14 M=D @RET_ADDRESS_CALL247 D=A @95 0;JMP (RET_ADDRESS_CALL247) @SP AM=M-1 D=M M=D @LCL A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @gameboard.sethead D=A @R14 M=D @RET_ADDRESS_CALL248 D=A @95 0;JMP (RET_ADDRESS_CALL248) @SP AM=M-1 D=M M=D @SP M=M+1 A=M-1 M=0 @54 0;JMP (node.checkposition) @SP A=M M=0 AD=A+1 M=0 @SP M=D+1 @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THIS M=D @THIS A=M D=M @SP AM=M+1 A=A-1 M=D @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_EQ17 D=A @6 0;JMP (RET_ADDRESS_EQ17) @SP AM=M-1 D=M @LCL A=M M=D @THIS A=M+1 D=M @SP AM=M+1 A=A-1 M=D @ARG A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_EQ18 D=A @6 0;JMP (RET_ADDRESS_EQ18) @SP AM=M-1 D=M @LCL A=M+1 M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D&M @SP AM=M-1 D=M @node.checkposition$if_true0 D;JNE @node.checkposition$if_false0 0;JMP (node.checkposition$if_true0) @0 D=A @R13 M=D @main.gameover D=A @R14 M=D @RET_ADDRESS_CALL249 D=A @95 0;JMP (RET_ADDRESS_CALL249) @SP AM=M-1 D=M M=D (node.checkposition$if_false0) @THIS A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_EQ19 D=A @6 0;JMP (RET_ADDRESS_EQ19) @SP A=M-1 M=!M @SP AM=M-1 D=M @node.checkposition$if_true1 D;JNE @node.checkposition$if_false1 0;JMP (node.checkposition$if_true1) @THIS A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @ARG A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @3 D=A @R13 M=D @node.checkposition D=A @R14 M=D @RET_ADDRESS_CALL250 D=A @95 0;JMP (RET_ADDRESS_CALL250) @SP AM=M-1 D=M M=D (node.checkposition$if_false1) @SP M=M+1 A=M-1 M=0 @54 0;JMP (node.paint) @SP A=M M=0 AD=A+1 M=0 @SP M=D+1 @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THIS M=D @THIS A=M D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @gameboard.posx D=A @R14 M=D @RET_ADDRESS_CALL251 D=A @95 0;JMP (RET_ADDRESS_CALL251) @SP AM=M-1 D=M @LCL A=M M=D @THIS A=M+1 D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @gameboard.posy D=A @R14 M=D @RET_ADDRESS_CALL252 D=A @95 0;JMP (RET_ADDRESS_CALL252) @SP AM=M-1 D=M @LCL A=M+1 M=D @SP M=M+1 A=M-1 M=0 @SP A=M-1 M=!M @1 D=A @R13 M=D @screen.setcolor D=A @R14 M=D @RET_ADDRESS_CALL253 D=A @95 0;JMP (RET_ADDRESS_CALL253) @SP AM=M-1 D=M M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @7 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @7 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @4 D=A @R13 M=D @screen.drawrectangle D=A @R14 M=D @RET_ADDRESS_CALL254 D=A @95 0;JMP (RET_ADDRESS_CALL254) @SP AM=M-1 D=M M=D @SP M=M+1 A=M-1 M=0 @54 0;JMP (node.erase) @SP A=M M=0 AD=A+1 M=0 @SP M=D+1 @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THIS M=D @THIS A=M D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @gameboard.posx D=A @R14 M=D @RET_ADDRESS_CALL255 D=A @95 0;JMP (RET_ADDRESS_CALL255) @SP AM=M-1 D=M @LCL A=M M=D @THIS A=M+1 D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @gameboard.posy D=A @R14 M=D @RET_ADDRESS_CALL256 D=A @95 0;JMP (RET_ADDRESS_CALL256) @SP AM=M-1 D=M @LCL A=M+1 M=D @SP M=M+1 A=M-1 M=0 @1 D=A @R13 M=D @screen.setcolor D=A @R14 M=D @RET_ADDRESS_CALL257 D=A @95 0;JMP (RET_ADDRESS_CALL257) @SP AM=M-1 D=M M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @7 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @7 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @4 D=A @R13 M=D @screen.drawrectangle D=A @R14 M=D @RET_ADDRESS_CALL258 D=A @95 0;JMP (RET_ADDRESS_CALL258) @SP AM=M-1 D=M M=D @SP M=M+1 A=M-1 M=0 @54 0;JMP (node.getnext) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THIS M=D @THIS A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @54 0;JMP (node.setnext) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THIS M=D @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THIS A=M+1 A=A+1 M=D @SP M=M+1 A=M-1 M=0 @54 0;JMP (node.getprev) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THIS M=D @THIS D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @54 0;JMP (node.setprev) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THIS M=D @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THIS A=M+1 A=A+1 A=A+1 M=D @SP M=M+1 A=M-1 M=0 @54 0;JMP (node.inyourlist) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THIS M=D @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @THIS A=M D=M @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_EQ20 D=A @6 0;JMP (RET_ADDRESS_EQ20) @SP AM=M-1 D=M @node.inyourlist$if_true0 D;JNE @node.inyourlist$if_false0 0;JMP (node.inyourlist$if_true0) @ARG A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @THIS A=M+1 D=M @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_EQ21 D=A @6 0;JMP (RET_ADDRESS_EQ21) @SP AM=M-1 D=M @node.inyourlist$if_true1 D;JNE @node.inyourlist$if_false1 0;JMP (node.inyourlist$if_true1) @SP M=M+1 A=M-1 M=0 @SP A=M-1 M=!M @54 0;JMP (node.inyourlist$if_false1) (node.inyourlist$if_false0) @THIS A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_EQ22 D=A @6 0;JMP (RET_ADDRESS_EQ22) @SP AM=M-1 D=M @node.inyourlist$if_true2 D;JNE @node.inyourlist$if_false2 0;JMP (node.inyourlist$if_true2) @SP M=M+1 A=M-1 M=0 @54 0;JMP (node.inyourlist$if_false2) @THIS A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @ARG A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @3 D=A @R13 M=D @node.inyourlist D=A @R14 M=D @RET_ADDRESS_CALL259 D=A @95 0;JMP (RET_ADDRESS_CALL259) @54 0;JMP (random.setseed) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @31 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D&M @SP AM=M-1 D=M @random.0 M=D @SP M=M+1 A=M-1 M=0 @SP AM=M-1 D=M @random.2 M=D @SP M=M+1 A=M-1 M=0 @54 0;JMP (random.setb) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=D+M @31 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D&M @SP AM=M-1 D=M @random.1 M=D @SP M=M+1 A=M-1 M=0 @SP AM=M-1 D=M @random.2 M=D @SP M=M+1 A=M-1 M=0 @54 0;JMP (random.nextint32) @5 D=A @SP AM=M+1 A=A-1 M=D @random.0 D=M @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @math.multiply D=A @R14 M=D @RET_ADDRESS_CALL260 D=A @95 0;JMP (RET_ADDRESS_CALL260) @random.1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @random.0 M=D @random.0 D=M @SP AM=M+1 A=A-1 M=D @31 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D&M @SP AM=M-1 D=M @random.0 M=D @random.2 D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @random.2 M=D @random.2 D=M @SP AM=M+1 A=A-1 M=D @32 D=A @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_GT5 D=A @22 0;JMP (RET_ADDRESS_GT5) @SP AM=M-1 D=M @random.nextint32$if_true0 D;JNE @random.nextint32$if_false0 0;JMP (random.nextint32$if_true0) @SP M=M+1 A=M-1 M=0 @SP AM=M-1 D=M @random.2 M=D @random.1 D=M @SP AM=M+1 A=A-1 M=D @2 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @31 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D&M @SP AM=M-1 D=M @random.1 M=D (random.nextint32$if_false0) @random.0 D=M @SP AM=M+1 A=A-1 M=D @54 0;JMP (array.new) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_GT6 D=A @22 0;JMP (RET_ADDRESS_GT6) @SP A=M-1 M=!M @SP AM=M-1 D=M @array.new$if_true0 D;JNE @array.new$if_false0 0;JMP (array.new$if_true0) @2 D=A @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @sys.error D=A @R14 M=D @RET_ADDRESS_CALL261 D=A @95 0;JMP (RET_ADDRESS_CALL261) @SP AM=M-1 D=M M=D (array.new$if_false0) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @memory.alloc D=A @R14 M=D @RET_ADDRESS_CALL262 D=A @95 0;JMP (RET_ADDRESS_CALL262) @54 0;JMP (array.dispose) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THIS M=D @THIS D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @memory.dealloc D=A @R14 M=D @RET_ADDRESS_CALL263 D=A @95 0;JMP (RET_ADDRESS_CALL263) @SP AM=M-1 D=M M=D @SP M=M+1 A=M-1 M=0 @54 0;JMP (keyboard.init) @SP M=M+1 A=M-1 M=0 @54 0;JMP (keyboard.keypressed) @24576 D=A @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @memory.peek D=A @R14 M=D @RET_ADDRESS_CALL264 D=A @95 0;JMP (RET_ADDRESS_CALL264) @54 0;JMP (keyboard.readchar) @SP A=M M=0 AD=A+1 M=0 @SP M=D+1 (keyboard.readchar$while_exp0) @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_EQ23 D=A @6 0;JMP (RET_ADDRESS_EQ23) @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_GT7 D=A @22 0;JMP (RET_ADDRESS_GT7) @SP AM=M-1 D=M A=A-1 M=D|M @SP A=M-1 M=!M @SP AM=M-1 D=M @keyboard.readchar$while_end0 D;JNE @0 D=A @R13 M=D @keyboard.keypressed D=A @R14 M=D @RET_ADDRESS_CALL265 D=A @95 0;JMP (RET_ADDRESS_CALL265) @SP AM=M-1 D=M @LCL A=M M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_GT8 D=A @22 0;JMP (RET_ADDRESS_GT8) @SP AM=M-1 D=M @keyboard.readchar$if_true0 D;JNE @keyboard.readchar$if_false0 0;JMP (keyboard.readchar$if_true0) @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @LCL A=M+1 M=D (keyboard.readchar$if_false0) @keyboard.readchar$while_exp0 0;JMP (keyboard.readchar$while_end0) @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @output.printchar D=A @R14 M=D @RET_ADDRESS_CALL266 D=A @95 0;JMP (RET_ADDRESS_CALL266) @SP AM=M-1 D=M M=D @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @54 0;JMP (keyboard.readline) @6 D=A (LOOP_keyboard.readline) D=D-1 @SP AM=M+1 A=A-1 M=0 @LOOP_keyboard.readline D;JGT @80 D=A @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @string.new D=A @R14 M=D @RET_ADDRESS_CALL267 D=A @95 0;JMP (RET_ADDRESS_CALL267) @SP AM=M-1 D=M @LCL A=M+1 A=A+1 A=A+1 A=A+1 M=D @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @output.printstring D=A @R14 M=D @RET_ADDRESS_CALL268 D=A @95 0;JMP (RET_ADDRESS_CALL268) @SP AM=M-1 D=M M=D @0 D=A @R13 M=D @string.newline D=A @R14 M=D @RET_ADDRESS_CALL269 D=A @95 0;JMP (RET_ADDRESS_CALL269) @SP AM=M-1 D=M @LCL A=M+1 M=D @0 D=A @R13 M=D @string.backspace D=A @R14 M=D @RET_ADDRESS_CALL270 D=A @95 0;JMP (RET_ADDRESS_CALL270) @SP AM=M-1 D=M @LCL A=M+1 A=A+1 M=D (keyboard.readline$while_exp0) @LCL D=M @5 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP A=M-1 M=!M @SP A=M-1 M=!M @SP AM=M-1 D=M @keyboard.readline$while_end0 D;JNE @0 D=A @R13 M=D @keyboard.readchar D=A @R14 M=D @RET_ADDRESS_CALL271 D=A @95 0;JMP (RET_ADDRESS_CALL271) @SP AM=M-1 D=M @LCL A=M M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_EQ24 D=A @6 0;JMP (RET_ADDRESS_EQ24) @SP AM=M-1 D=M @LCL A=M+1 A=A+1 A=A+1 A=A+1 A=A+1 M=D @LCL D=M @5 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP A=M-1 M=!M @SP AM=M-1 D=M @keyboard.readline$if_true0 D;JNE @keyboard.readline$if_false0 0;JMP (keyboard.readline$if_true0) @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @LCL A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_EQ25 D=A @6 0;JMP (RET_ADDRESS_EQ25) @SP AM=M-1 D=M @keyboard.readline$if_true1 D;JNE @keyboard.readline$if_false1 0;JMP (keyboard.readline$if_true1) @LCL D=M @4 A=D+A D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @string.eraselastchar D=A @R14 M=D @RET_ADDRESS_CALL272 D=A @95 0;JMP (RET_ADDRESS_CALL272) @SP AM=M-1 D=M M=D @keyboard.readline$if_end1 0;JMP (keyboard.readline$if_false1) @LCL D=M @4 A=D+A D=M @SP AM=M+1 A=A-1 M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL273 D=A @95 0;JMP (RET_ADDRESS_CALL273) @SP AM=M-1 D=M M=D (keyboard.readline$if_end1) (keyboard.readline$if_false0) @keyboard.readline$while_exp0 0;JMP (keyboard.readline$while_end0) @LCL D=M @4 A=D+A D=M @SP AM=M+1 A=A-1 M=D @54 0;JMP (keyboard.readint) @SP AM=M+1 A=A-1 M=0 @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @keyboard.readline D=A @R14 M=D @RET_ADDRESS_CALL274 D=A @95 0;JMP (RET_ADDRESS_CALL274) @SP AM=M-1 D=M @LCL A=M M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @string.intvalue D=A @R14 M=D @RET_ADDRESS_CALL275 D=A @95 0;JMP (RET_ADDRESS_CALL275) @54 0;JMP (math.init) @SP AM=M+1 A=A-1 M=0 @16 D=A @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @array.new D=A @R14 M=D @RET_ADDRESS_CALL276 D=A @95 0;JMP (RET_ADDRESS_CALL276) @SP AM=M-1 D=M @math.1 M=D @16 D=A @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @array.new D=A @R14 M=D @RET_ADDRESS_CALL277 D=A @95 0;JMP (RET_ADDRESS_CALL277) @SP AM=M-1 D=M @math.0 M=D @SP M=M+1 A=M-1 M=0 @math.0 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @THAT M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M @THAT A=M M=D (math.init$while_exp0) @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @15 D=A @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_LT7 D=A @38 0;JMP (RET_ADDRESS_LT7) @SP A=M-1 M=!M @SP AM=M-1 D=M @math.init$while_end0 D;JNE @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @LCL A=M M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @math.0 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @THAT M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=M-D @math.0 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M M=D @R5 D=M @SP AM=M+1 A=A-1 M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=M-D @math.0 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M M=D @R5 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @THAT A=M M=D @math.init$while_exp0 0;JMP (math.init$while_end0) @SP M=M+1 A=M-1 M=0 @54 0;JMP (math.abs) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_LT8 D=A @38 0;JMP (RET_ADDRESS_LT8) @SP AM=M-1 D=M @math.abs$if_true0 D;JNE @math.abs$if_false0 0;JMP (math.abs$if_true0) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP A=M-1 D=!M M=D+1 @SP AM=M-1 D=M @ARG A=M M=D (math.abs$if_false0) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @54 0;JMP (math.multiply) @5 D=A (LOOP_math.multiply) D=D-1 @SP AM=M+1 A=A-1 M=0 @LOOP_math.multiply D;JGT @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_LT9 D=A @38 0;JMP (RET_ADDRESS_LT9) @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_GT9 D=A @22 0;JMP (RET_ADDRESS_GT9) @SP AM=M-1 D=M A=A-1 M=D&M @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_GT10 D=A @22 0;JMP (RET_ADDRESS_GT10) @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_LT10 D=A @38 0;JMP (RET_ADDRESS_LT10) @SP AM=M-1 D=M A=A-1 M=D&M @SP AM=M-1 D=M A=A-1 M=D|M @SP AM=M-1 D=M @LCL A=M+1 A=A+1 A=A+1 A=A+1 M=D @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @math.abs D=A @R14 M=D @RET_ADDRESS_CALL278 D=A @95 0;JMP (RET_ADDRESS_CALL278) @SP AM=M-1 D=M @ARG A=M M=D @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @math.abs D=A @R14 M=D @RET_ADDRESS_CALL279 D=A @95 0;JMP (RET_ADDRESS_CALL279) @SP AM=M-1 D=M @ARG A=M+1 M=D @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_LT11 D=A @38 0;JMP (RET_ADDRESS_LT11) @SP AM=M-1 D=M @math.multiply$if_true0 D;JNE @math.multiply$if_false0 0;JMP (math.multiply$if_true0) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @LCL A=M+1 M=D @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @ARG A=M M=D @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @ARG A=M+1 M=D (math.multiply$if_false0) (math.multiply$while_exp0) @LCL A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_LT12 D=A @38 0;JMP (RET_ADDRESS_LT12) @SP A=M-1 M=!M @SP AM=M-1 D=M @math.multiply$while_end0 D;JNE @LCL D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @math.0 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M M=D @R5 D=M @SP AM=M+1 A=A-1 M=D @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D&M @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_GT11 D=A @22 0;JMP (RET_ADDRESS_GT11) @SP AM=M-1 D=M @math.multiply$if_true1 D;JNE @math.multiply$if_false1 0;JMP (math.multiply$if_true1) @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @LCL A=M M=D @LCL A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @LCL D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @math.0 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M M=D @R5 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @LCL A=M+1 A=A+1 M=D (math.multiply$if_false1) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @ARG A=M M=D @LCL D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @LCL A=M+1 A=A+1 A=A+1 M=D @math.multiply$while_exp0 0;JMP (math.multiply$while_end0) @LCL D=M @4 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @math.multiply$if_true2 D;JNE @math.multiply$if_false2 0;JMP (math.multiply$if_true2) @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP A=M-1 D=!M M=D+1 @SP AM=M-1 D=M @LCL A=M M=D (math.multiply$if_false2) @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @54 0;JMP (math.divide) @4 D=A (LOOP_math.divide) D=D-1 @SP AM=M+1 A=A-1 M=0 @LOOP_math.divide D;JGT @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_EQ26 D=A @6 0;JMP (RET_ADDRESS_EQ26) @SP AM=M-1 D=M @math.divide$if_true0 D;JNE @math.divide$if_false0 0;JMP (math.divide$if_true0) @3 D=A @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @sys.error D=A @R14 M=D @RET_ADDRESS_CALL280 D=A @95 0;JMP (RET_ADDRESS_CALL280) @SP AM=M-1 D=M M=D (math.divide$if_false0) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_LT13 D=A @38 0;JMP (RET_ADDRESS_LT13) @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_GT12 D=A @22 0;JMP (RET_ADDRESS_GT12) @SP AM=M-1 D=M A=A-1 M=D&M @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_GT13 D=A @22 0;JMP (RET_ADDRESS_GT13) @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_LT14 D=A @38 0;JMP (RET_ADDRESS_LT14) @SP AM=M-1 D=M A=A-1 M=D&M @SP AM=M-1 D=M A=A-1 M=D|M @SP AM=M-1 D=M @LCL A=M+1 A=A+1 M=D @SP M=M+1 A=M-1 M=0 @math.1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @THAT M=D @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @math.abs D=A @R14 M=D @RET_ADDRESS_CALL281 D=A @95 0;JMP (RET_ADDRESS_CALL281) @SP AM=M-1 D=M @THAT A=M M=D @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @math.abs D=A @R14 M=D @RET_ADDRESS_CALL282 D=A @95 0;JMP (RET_ADDRESS_CALL282) @SP AM=M-1 D=M @ARG A=M M=D (math.divide$while_exp0) @LCL D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP A=M-1 M=!M @SP A=M-1 M=!M @SP AM=M-1 D=M @math.divide$while_end0 D;JNE @32767 D=A @SP AM=M+1 A=A-1 M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @math.1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M M=D @R5 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=M-D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @math.1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M M=D @R5 D=M @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_LT15 D=A @38 0;JMP (RET_ADDRESS_LT15) @SP AM=M-1 D=M @LCL A=M+1 A=A+1 A=A+1 M=D @LCL D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP A=M-1 M=!M @SP AM=M-1 D=M @math.divide$if_true1 D;JNE @math.divide$if_false1 0;JMP (math.divide$if_true1) @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=D+M @math.1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @THAT M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @math.1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M M=D @R5 D=M @SP AM=M+1 A=A-1 M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @math.1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M M=D @R5 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @THAT A=M M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=D+M @math.1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M M=D @R5 D=M @SP AM=M+1 A=A-1 M=D @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_GT14 D=A @22 0;JMP (RET_ADDRESS_GT14) @SP AM=M-1 D=M @LCL A=M+1 A=A+1 A=A+1 M=D @LCL D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP A=M-1 M=!M @SP AM=M-1 D=M @math.divide$if_true2 D;JNE @math.divide$if_false2 0;JMP (math.divide$if_true2) @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @LCL A=M M=D (math.divide$if_false2) (math.divide$if_false1) @math.divide$while_exp0 0;JMP (math.divide$while_end0) (math.divide$while_exp1) @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP A=M-1 D=!M M=D+1 @RET_ADDRESS_GT15 D=A @22 0;JMP (RET_ADDRESS_GT15) @SP A=M-1 M=!M @SP AM=M-1 D=M @math.divide$while_end1 D;JNE @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @math.1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M M=D @R5 D=M @SP AM=M+1 A=A-1 M=D @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_GT16 D=A @22 0;JMP (RET_ADDRESS_GT16) @SP A=M-1 M=!M @SP AM=M-1 D=M @math.divide$if_true3 D;JNE @math.divide$if_false3 0;JMP (math.divide$if_true3) @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @math.0 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M M=D @R5 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @LCL A=M+1 M=D @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @math.1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M M=D @R5 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=M-D @SP AM=M-1 D=M @ARG A=M M=D (math.divide$if_false3) @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=M-D @SP AM=M-1 D=M @LCL A=M M=D @math.divide$while_exp1 0;JMP (math.divide$while_end1) @LCL A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @math.divide$if_true4 D;JNE @math.divide$if_false4 0;JMP (math.divide$if_true4) @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP A=M-1 D=!M M=D+1 @SP AM=M-1 D=M @LCL A=M+1 M=D (math.divide$if_false4) @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @54 0;JMP (math.sqrt) @SP A=M M=0 AD=A+1 M=0 @SP M=D+1 @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_LT16 D=A @38 0;JMP (RET_ADDRESS_LT16) @SP AM=M-1 D=M @math.sqrt$if_true0 D;JNE @math.sqrt$if_false0 0;JMP (math.sqrt$if_true0) @4 D=A @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @sys.error D=A @R14 M=D @RET_ADDRESS_CALL283 D=A @95 0;JMP (RET_ADDRESS_CALL283) @SP AM=M-1 D=M M=D (math.sqrt$if_false0) @7 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @LCL A=M M=D (math.sqrt$while_exp0) @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP A=M-1 D=!M M=D+1 @RET_ADDRESS_GT17 D=A @22 0;JMP (RET_ADDRESS_GT17) @SP A=M-1 M=!M @SP AM=M-1 D=M @math.sqrt$while_end0 D;JNE @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @math.0 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M M=D @R5 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @math.0 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M M=D @R5 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @2 D=A @R13 M=D @math.multiply D=A @R14 M=D @RET_ADDRESS_CALL284 D=A @95 0;JMP (RET_ADDRESS_CALL284) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_GT18 D=A @22 0;JMP (RET_ADDRESS_GT18) @SP A=M-1 M=!M @SP AM=M-1 D=M @math.sqrt$if_true1 D;JNE @math.sqrt$if_false1 0;JMP (math.sqrt$if_true1) @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @math.0 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M M=D @R5 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @LCL A=M+1 M=D (math.sqrt$if_false1) @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=M-D @SP AM=M-1 D=M @LCL A=M M=D @math.sqrt$while_exp0 0;JMP (math.sqrt$while_end0) @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @54 0;JMP (math.max) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_GT19 D=A @22 0;JMP (RET_ADDRESS_GT19) @SP AM=M-1 D=M @math.max$if_true0 D;JNE @math.max$if_false0 0;JMP (math.max$if_true0) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @ARG A=M+1 M=D (math.max$if_false0) @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @54 0;JMP (math.min) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_LT17 D=A @38 0;JMP (RET_ADDRESS_LT17) @SP AM=M-1 D=M @math.min$if_true0 D;JNE @math.min$if_false0 0;JMP (math.min$if_true0) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @ARG A=M+1 M=D (math.min$if_false0) @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @54 0;JMP (memory.init) @SP M=M+1 A=M-1 M=0 @SP AM=M-1 D=M @memory.0 M=D @2048 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @memory.1 M=D @16383 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @memory.2 M=D @SP M=M+1 A=M-1 M=0 @54 0;JMP (memory.peek) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @memory.0 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M M=D @R5 D=M @SP AM=M+1 A=A-1 M=D @54 0;JMP (memory.poke) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @memory.0 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @THAT M=D @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THAT A=M M=D @SP M=M+1 A=M-1 M=0 @54 0;JMP (memory.alloc) @SP AM=M+1 A=A-1 M=0 @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @RET_ADDRESS_LT18 D=A @38 0;JMP (RET_ADDRESS_LT18) @SP AM=M-1 D=M @memory.alloc$if_true0 D;JNE @memory.alloc$if_false0 0;JMP (memory.alloc$if_true0) @5 D=A @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @sys.error D=A @R14 M=D @RET_ADDRESS_CALL285 D=A @95 0;JMP (RET_ADDRESS_CALL285) @SP AM=M-1 D=M M=D (memory.alloc$if_false0) @memory.1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @LCL A=M M=D @memory.1 D=M @SP AM=M+1 A=A-1 M=D @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @memory.1 M=D @memory.1 D=M @SP AM=M+1 A=A-1 M=D @memory.2 D=M @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_GT20 D=A @22 0;JMP (RET_ADDRESS_GT20) @SP AM=M-1 D=M @memory.alloc$if_true1 D;JNE @memory.alloc$if_false1 0;JMP (memory.alloc$if_true1) @6 D=A @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @sys.error D=A @R14 M=D @RET_ADDRESS_CALL286 D=A @95 0;JMP (RET_ADDRESS_CALL286) @SP AM=M-1 D=M M=D (memory.alloc$if_false1) @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @54 0;JMP (memory.dealloc) @SP M=M+1 A=M-1 M=0 @54 0;JMP (output.init) @SP AM=M+1 A=A-1 M=0 @16384 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @output.4 M=D @SP M=M+1 A=M-1 M=0 @SP A=M-1 M=!M @SP AM=M-1 D=M @output.2 M=D @32 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @output.1 M=D @SP M=M+1 A=M-1 M=0 @SP AM=M-1 D=M @output.0 M=D @6 D=A @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @string.new D=A @R14 M=D @RET_ADDRESS_CALL287 D=A @95 0;JMP (RET_ADDRESS_CALL287) @SP AM=M-1 D=M @output.3 M=D @91 D=A @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @array.new D=A @R14 M=D @RET_ADDRESS_CALL288 D=A @95 0;JMP (RET_ADDRESS_CALL288) @SP AM=M-1 D=M @output.5 M=D @91 D=A @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @array.new D=A @R14 M=D @RET_ADDRESS_CALL289 D=A @95 0;JMP (RET_ADDRESS_CALL289) @SP AM=M-1 D=M @output.6 M=D @SP M=M+1 A=M-1 M=0 @63 D=A @SP AM=M+1 A=A-1 M=D @63 D=A @SP AM=M+1 A=A-1 M=D @63 D=A @SP AM=M+1 A=A-1 M=D @63 D=A @SP AM=M+1 A=A-1 M=D @63 D=A @SP AM=M+1 A=A-1 M=D @63 D=A @SP AM=M+1 A=A-1 M=D @63 D=A @SP AM=M+1 A=A-1 M=D @63 D=A @SP AM=M+1 A=A-1 M=D @63 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @11 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL290 D=A @95 0;JMP (RET_ADDRESS_CALL290) @SP AM=M-1 D=M M=D (output.init$while_exp0) @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @64 D=A @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_LT19 D=A @38 0;JMP (RET_ADDRESS_LT19) @SP A=M-1 M=!M @SP AM=M-1 D=M @output.init$while_end0 D;JNE @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @LCL A=M M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @output.5 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @THAT M=D @SP M=M+1 A=M-1 M=0 @output.5 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M M=D @R5 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THAT A=M M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @output.6 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @THAT M=D @SP M=M+1 A=M-1 M=0 @output.6 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M M=D @R5 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THAT A=M M=D @output.init$while_exp0 0;JMP (output.init$while_end0) @48 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @30 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @30 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @11 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL291 D=A @95 0;JMP (RET_ADDRESS_CALL291) @SP AM=M-1 D=M M=D @49 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @14 D=A @SP AM=M+1 A=A-1 M=D @15 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @63 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @11 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL292 D=A @95 0;JMP (RET_ADDRESS_CALL292) @SP AM=M-1 D=M M=D @50 D=A @SP AM=M+1 A=A-1 M=D @30 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @48 D=A @SP AM=M+1 A=A-1 M=D @24 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @6 D=A @SP AM=M+1 A=A-1 M=D @3 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @63 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @11 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL293 D=A @95 0;JMP (RET_ADDRESS_CALL293) @SP AM=M-1 D=M M=D @51 D=A @SP AM=M+1 A=A-1 M=D @30 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @48 D=A @SP AM=M+1 A=A-1 M=D @48 D=A @SP AM=M+1 A=A-1 M=D @28 D=A @SP AM=M+1 A=A-1 M=D @48 D=A @SP AM=M+1 A=A-1 M=D @48 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @30 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @11 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL294 D=A @95 0;JMP (RET_ADDRESS_CALL294) @SP AM=M-1 D=M M=D @52 D=A @SP AM=M+1 A=A-1 M=D @16 D=A @SP AM=M+1 A=A-1 M=D @24 D=A @SP AM=M+1 A=A-1 M=D @28 D=A @SP AM=M+1 A=A-1 M=D @26 D=A @SP AM=M+1 A=A-1 M=D @25 D=A @SP AM=M+1 A=A-1 M=D @63 D=A @SP AM=M+1 A=A-1 M=D @24 D=A @SP AM=M+1 A=A-1 M=D @24 D=A @SP AM=M+1 A=A-1 M=D @60 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @11 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL295 D=A @95 0;JMP (RET_ADDRESS_CALL295) @SP AM=M-1 D=M M=D @53 D=A @SP AM=M+1 A=A-1 M=D @63 D=A @SP AM=M+1 A=A-1 M=D @3 D=A @SP AM=M+1 A=A-1 M=D @3 D=A @SP AM=M+1 A=A-1 M=D @31 D=A @SP AM=M+1 A=A-1 M=D @48 D=A @SP AM=M+1 A=A-1 M=D @48 D=A @SP AM=M+1 A=A-1 M=D @48 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @30 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @11 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL296 D=A @95 0;JMP (RET_ADDRESS_CALL296) @SP AM=M-1 D=M M=D @54 D=A @SP AM=M+1 A=A-1 M=D @28 D=A @SP AM=M+1 A=A-1 M=D @6 D=A @SP AM=M+1 A=A-1 M=D @3 D=A @SP AM=M+1 A=A-1 M=D @3 D=A @SP AM=M+1 A=A-1 M=D @31 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @30 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @11 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL297 D=A @95 0;JMP (RET_ADDRESS_CALL297) @SP AM=M-1 D=M M=D @55 D=A @SP AM=M+1 A=A-1 M=D @63 D=A @SP AM=M+1 A=A-1 M=D @49 D=A @SP AM=M+1 A=A-1 M=D @48 D=A @SP AM=M+1 A=A-1 M=D @48 D=A @SP AM=M+1 A=A-1 M=D @24 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @11 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL298 D=A @95 0;JMP (RET_ADDRESS_CALL298) @SP AM=M-1 D=M M=D @56 D=A @SP AM=M+1 A=A-1 M=D @30 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @30 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @30 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @11 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL299 D=A @95 0;JMP (RET_ADDRESS_CALL299) @SP AM=M-1 D=M M=D @57 D=A @SP AM=M+1 A=A-1 M=D @30 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @62 D=A @SP AM=M+1 A=A-1 M=D @48 D=A @SP AM=M+1 A=A-1 M=D @48 D=A @SP AM=M+1 A=A-1 M=D @24 D=A @SP AM=M+1 A=A-1 M=D @14 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @11 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL300 D=A @95 0;JMP (RET_ADDRESS_CALL300) @SP AM=M-1 D=M M=D @65 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @30 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @63 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @11 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL301 D=A @95 0;JMP (RET_ADDRESS_CALL301) @SP AM=M-1 D=M M=D @66 D=A @SP AM=M+1 A=A-1 M=D @31 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @31 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @31 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @11 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL302 D=A @95 0;JMP (RET_ADDRESS_CALL302) @SP AM=M-1 D=M M=D @67 D=A @SP AM=M+1 A=A-1 M=D @28 D=A @SP AM=M+1 A=A-1 M=D @54 D=A @SP AM=M+1 A=A-1 M=D @35 D=A @SP AM=M+1 A=A-1 M=D @3 D=A @SP AM=M+1 A=A-1 M=D @3 D=A @SP AM=M+1 A=A-1 M=D @3 D=A @SP AM=M+1 A=A-1 M=D @35 D=A @SP AM=M+1 A=A-1 M=D @54 D=A @SP AM=M+1 A=A-1 M=D @28 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @11 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL303 D=A @95 0;JMP (RET_ADDRESS_CALL303) @SP AM=M-1 D=M M=D @68 D=A @SP AM=M+1 A=A-1 M=D @15 D=A @SP AM=M+1 A=A-1 M=D @27 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @27 D=A @SP AM=M+1 A=A-1 M=D @15 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @11 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL304 D=A @95 0;JMP (RET_ADDRESS_CALL304) @SP AM=M-1 D=M M=D @69 D=A @SP AM=M+1 A=A-1 M=D @63 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @35 D=A @SP AM=M+1 A=A-1 M=D @11 D=A @SP AM=M+1 A=A-1 M=D @15 D=A @SP AM=M+1 A=A-1 M=D @11 D=A @SP AM=M+1 A=A-1 M=D @35 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @63 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @11 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL305 D=A @95 0;JMP (RET_ADDRESS_CALL305) @SP AM=M-1 D=M M=D @70 D=A @SP AM=M+1 A=A-1 M=D @63 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @35 D=A @SP AM=M+1 A=A-1 M=D @11 D=A @SP AM=M+1 A=A-1 M=D @15 D=A @SP AM=M+1 A=A-1 M=D @11 D=A @SP AM=M+1 A=A-1 M=D @3 D=A @SP AM=M+1 A=A-1 M=D @3 D=A @SP AM=M+1 A=A-1 M=D @3 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @11 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL306 D=A @95 0;JMP (RET_ADDRESS_CALL306) @SP AM=M-1 D=M M=D @71 D=A @SP AM=M+1 A=A-1 M=D @28 D=A @SP AM=M+1 A=A-1 M=D @54 D=A @SP AM=M+1 A=A-1 M=D @35 D=A @SP AM=M+1 A=A-1 M=D @3 D=A @SP AM=M+1 A=A-1 M=D @59 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @54 D=A @SP AM=M+1 A=A-1 M=D @44 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @11 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL307 D=A @95 0;JMP (RET_ADDRESS_CALL307) @SP AM=M-1 D=M M=D @72 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @63 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @11 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL308 D=A @95 0;JMP (RET_ADDRESS_CALL308) @SP AM=M-1 D=M M=D @73 D=A @SP AM=M+1 A=A-1 M=D @30 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @30 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @11 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL309 D=A @95 0;JMP (RET_ADDRESS_CALL309) @SP AM=M-1 D=M M=D @74 D=A @SP AM=M+1 A=A-1 M=D @60 D=A @SP AM=M+1 A=A-1 M=D @24 D=A @SP AM=M+1 A=A-1 M=D @24 D=A @SP AM=M+1 A=A-1 M=D @24 D=A @SP AM=M+1 A=A-1 M=D @24 D=A @SP AM=M+1 A=A-1 M=D @24 D=A @SP AM=M+1 A=A-1 M=D @27 D=A @SP AM=M+1 A=A-1 M=D @27 D=A @SP AM=M+1 A=A-1 M=D @14 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @11 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL310 D=A @95 0;JMP (RET_ADDRESS_CALL310) @SP AM=M-1 D=M M=D @75 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @27 D=A @SP AM=M+1 A=A-1 M=D @15 D=A @SP AM=M+1 A=A-1 M=D @27 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @11 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL311 D=A @95 0;JMP (RET_ADDRESS_CALL311) @SP AM=M-1 D=M M=D @76 D=A @SP AM=M+1 A=A-1 M=D @3 D=A @SP AM=M+1 A=A-1 M=D @3 D=A @SP AM=M+1 A=A-1 M=D @3 D=A @SP AM=M+1 A=A-1 M=D @3 D=A @SP AM=M+1 A=A-1 M=D @3 D=A @SP AM=M+1 A=A-1 M=D @3 D=A @SP AM=M+1 A=A-1 M=D @35 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @63 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @11 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL312 D=A @95 0;JMP (RET_ADDRESS_CALL312) @SP AM=M-1 D=M M=D @77 D=A @SP AM=M+1 A=A-1 M=D @33 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @63 D=A @SP AM=M+1 A=A-1 M=D @63 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @11 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL313 D=A @95 0;JMP (RET_ADDRESS_CALL313) @SP AM=M-1 D=M M=D @78 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @55 D=A @SP AM=M+1 A=A-1 M=D @55 D=A @SP AM=M+1 A=A-1 M=D @63 D=A @SP AM=M+1 A=A-1 M=D @59 D=A @SP AM=M+1 A=A-1 M=D @59 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @11 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL314 D=A @95 0;JMP (RET_ADDRESS_CALL314) @SP AM=M-1 D=M M=D @79 D=A @SP AM=M+1 A=A-1 M=D @30 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @30 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @11 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL315 D=A @95 0;JMP (RET_ADDRESS_CALL315) @SP AM=M-1 D=M M=D @80 D=A @SP AM=M+1 A=A-1 M=D @31 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @31 D=A @SP AM=M+1 A=A-1 M=D @3 D=A @SP AM=M+1 A=A-1 M=D @3 D=A @SP AM=M+1 A=A-1 M=D @3 D=A @SP AM=M+1 A=A-1 M=D @3 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @11 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL316 D=A @95 0;JMP (RET_ADDRESS_CALL316) @SP AM=M-1 D=M M=D @81 D=A @SP AM=M+1 A=A-1 M=D @30 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @63 D=A @SP AM=M+1 A=A-1 M=D @59 D=A @SP AM=M+1 A=A-1 M=D @30 D=A @SP AM=M+1 A=A-1 M=D @48 D=A @SP AM=M+1 A=A-1 M=D @11 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL317 D=A @95 0;JMP (RET_ADDRESS_CALL317) @SP AM=M-1 D=M M=D @82 D=A @SP AM=M+1 A=A-1 M=D @31 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @31 D=A @SP AM=M+1 A=A-1 M=D @27 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @11 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL318 D=A @95 0;JMP (RET_ADDRESS_CALL318) @SP AM=M-1 D=M M=D @83 D=A @SP AM=M+1 A=A-1 M=D @30 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @6 D=A @SP AM=M+1 A=A-1 M=D @28 D=A @SP AM=M+1 A=A-1 M=D @48 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @30 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @11 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL319 D=A @95 0;JMP (RET_ADDRESS_CALL319) @SP AM=M-1 D=M M=D @84 D=A @SP AM=M+1 A=A-1 M=D @63 D=A @SP AM=M+1 A=A-1 M=D @63 D=A @SP AM=M+1 A=A-1 M=D @45 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @30 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @11 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL320 D=A @95 0;JMP (RET_ADDRESS_CALL320) @SP AM=M-1 D=M M=D @85 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @30 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @11 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL321 D=A @95 0;JMP (RET_ADDRESS_CALL321) @SP AM=M-1 D=M M=D @86 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @30 D=A @SP AM=M+1 A=A-1 M=D @30 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @11 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL322 D=A @95 0;JMP (RET_ADDRESS_CALL322) @SP AM=M-1 D=M M=D @87 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @63 D=A @SP AM=M+1 A=A-1 M=D @63 D=A @SP AM=M+1 A=A-1 M=D @63 D=A @SP AM=M+1 A=A-1 M=D @18 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @11 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL323 D=A @95 0;JMP (RET_ADDRESS_CALL323) @SP AM=M-1 D=M M=D @88 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @30 D=A @SP AM=M+1 A=A-1 M=D @30 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @30 D=A @SP AM=M+1 A=A-1 M=D @30 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @11 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL324 D=A @95 0;JMP (RET_ADDRESS_CALL324) @SP AM=M-1 D=M M=D @89 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @30 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @30 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @11 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL325 D=A @95 0;JMP (RET_ADDRESS_CALL325) @SP AM=M-1 D=M M=D @90 D=A @SP AM=M+1 A=A-1 M=D @63 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @49 D=A @SP AM=M+1 A=A-1 M=D @24 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @6 D=A @SP AM=M+1 A=A-1 M=D @35 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @63 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @11 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL326 D=A @95 0;JMP (RET_ADDRESS_CALL326) @SP AM=M-1 D=M M=D @32 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @11 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL327 D=A @95 0;JMP (RET_ADDRESS_CALL327) @SP AM=M-1 D=M M=D @33 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @30 D=A @SP AM=M+1 A=A-1 M=D @30 D=A @SP AM=M+1 A=A-1 M=D @30 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @12 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @11 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL328 D=A @95 0;JMP (RET_ADDRESS_CALL328) @SP AM=M-1 D=M M=D @40 D=A @SP AM=M+1 A=A-1 M=D @24 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @6 D=A @SP AM=M+1 A=A-1 M=D @6 D=A @SP AM=M+1 A=A-1 M=D @6 D=A @SP AM=M+1 A=A-1 M=D @6 D=A @SP AM=M+1 A=A-1 M=D @6 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @24 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @11 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL329 D=A @95 0;JMP (RET_ADDRESS_CALL329) @SP AM=M-1 D=M M=D @41 D=A @SP AM=M+1 A=A-1 M=D @6 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @24 D=A @SP AM=M+1 A=A-1 M=D @24 D=A @SP AM=M+1 A=A-1 M=D @24 D=A @SP AM=M+1 A=A-1 M=D @24 D=A @SP AM=M+1 A=A-1 M=D @24 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @6 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @11 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL330 D=A @95 0;JMP (RET_ADDRESS_CALL330) @SP AM=M-1 D=M M=D @44 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @12 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @6 D=A @SP AM=M+1 A=A-1 M=D @11 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL331 D=A @95 0;JMP (RET_ADDRESS_CALL331) @SP AM=M-1 D=M M=D @45 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @63 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @11 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL332 D=A @95 0;JMP (RET_ADDRESS_CALL332) @SP AM=M-1 D=M M=D @46 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @12 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @11 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL333 D=A @95 0;JMP (RET_ADDRESS_CALL333) @SP AM=M-1 D=M M=D @58 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @12 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @12 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @11 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL334 D=A @95 0;JMP (RET_ADDRESS_CALL334) @SP AM=M-1 D=M M=D @63 D=A @SP AM=M+1 A=A-1 M=D @30 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @24 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @12 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @11 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL335 D=A @95 0;JMP (RET_ADDRESS_CALL335) @SP AM=M-1 D=M M=D @SP M=M+1 A=M-1 M=0 @54 0;JMP (output.create) @3 D=A (LOOP_output.create) D=D-1 @SP AM=M+1 A=A-1 M=0 @LOOP_output.create D;JGT @10 D=A @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @array.new D=A @R14 M=D @RET_ADDRESS_CALL336 D=A @95 0;JMP (RET_ADDRESS_CALL336) @SP AM=M-1 D=M @LCL A=M+1 M=D @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @output.5 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @THAT M=D @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THAT A=M M=D @SP M=M+1 A=M-1 M=0 @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @THAT M=D @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THAT A=M M=D @SP M=M+1 A=M-1 M=1 @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @THAT M=D @ARG A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THAT A=M M=D @2 D=A @SP AM=M+1 A=A-1 M=D @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @THAT M=D @ARG D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THAT A=M M=D @3 D=A @SP AM=M+1 A=A-1 M=D @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @THAT M=D @ARG D=M @4 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THAT A=M M=D @4 D=A @SP AM=M+1 A=A-1 M=D @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @THAT M=D @ARG D=M @5 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THAT A=M M=D @5 D=A @SP AM=M+1 A=A-1 M=D @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @THAT M=D @ARG D=M @6 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THAT A=M M=D @6 D=A @SP AM=M+1 A=A-1 M=D @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @THAT M=D @ARG D=M @7 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THAT A=M M=D @7 D=A @SP AM=M+1 A=A-1 M=D @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @THAT M=D @ARG D=M @8 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THAT A=M M=D @8 D=A @SP AM=M+1 A=A-1 M=D @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @THAT M=D @ARG D=M @9 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THAT A=M M=D @9 D=A @SP AM=M+1 A=A-1 M=D @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @THAT M=D @ARG D=M @10 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THAT A=M M=D @10 D=A @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @array.new D=A @R14 M=D @RET_ADDRESS_CALL337 D=A @95 0;JMP (RET_ADDRESS_CALL337) @SP AM=M-1 D=M @LCL A=M+1 A=A+1 M=D @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @output.6 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @THAT M=D @LCL A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THAT A=M M=D (output.create$while_exp0) @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @10 D=A @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_LT20 D=A @38 0;JMP (RET_ADDRESS_LT20) @SP A=M-1 M=!M @SP AM=M-1 D=M @output.create$while_end0 D;JNE @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @LCL A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @THAT M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M M=D @R5 D=M @SP AM=M+1 A=A-1 M=D @256 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @math.multiply D=A @R14 M=D @RET_ADDRESS_CALL338 D=A @95 0;JMP (RET_ADDRESS_CALL338) @SP AM=M-1 D=M @THAT A=M M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @LCL A=M M=D @output.create$while_exp0 0;JMP (output.create$while_end0) @SP M=M+1 A=M-1 M=0 @54 0;JMP (output.drawchar) @5 D=A (LOOP_output.drawchar) D=D-1 @SP AM=M+1 A=A-1 M=0 @LOOP_output.drawchar D;JGT @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @LCL A=M+1 A=A+1 M=D @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @90 D=A @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_GT21 D=A @22 0;JMP (RET_ADDRESS_GT21) @SP AM=M-1 D=M @output.drawchar$if_true0 D;JNE @output.drawchar$if_false0 0;JMP (output.drawchar$if_true0) @SP M=M+1 A=M-1 M=0 @SP AM=M-1 D=M @LCL A=M+1 A=A+1 M=D (output.drawchar$if_false0) @LCL A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @output.6 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M M=D @R5 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @LCL A=M+1 A=A+1 A=A+1 M=D @output.2 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @output.drawchar$if_true1 D;JNE @output.drawchar$if_false1 0;JMP (output.drawchar$if_true1) @LCL A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @output.5 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M M=D @R5 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @LCL A=M+1 A=A+1 A=A+1 M=D (output.drawchar$if_false1) @output.1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @LCL A=M M=D (output.drawchar$while_exp0) @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @10 D=A @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_LT21 D=A @38 0;JMP (RET_ADDRESS_LT21) @SP A=M-1 M=!M @SP AM=M-1 D=M @output.drawchar$while_end0 D;JNE @output.2 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @output.drawchar$if_true2 D;JNE @output.drawchar$if_false2 0;JMP (output.drawchar$if_true2) @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @output.4 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M M=D @R5 D=M @SP AM=M+1 A=A-1 M=D @32512 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D&M @SP AM=M-1 D=M @LCL A=M+1 A=A+1 A=A+1 A=A+1 M=D @output.drawchar$if_end2 0;JMP (output.drawchar$if_false2) @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @output.4 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M M=D @R5 D=M @SP AM=M+1 A=A-1 M=D @255 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D&M @SP AM=M-1 D=M @LCL A=M+1 A=A+1 A=A+1 A=A+1 M=D (output.drawchar$if_end2) @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @output.4 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @THAT M=D @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @LCL D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M M=D @R5 D=M @SP AM=M+1 A=A-1 M=D @LCL D=M @4 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D|M @SP AM=M-1 D=M @THAT A=M M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @32 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @LCL A=M M=D @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @LCL A=M+1 M=D @output.drawchar$while_exp0 0;JMP (output.drawchar$while_end0) @SP M=M+1 A=M-1 M=0 @54 0;JMP (output.movecursor) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_LT22 D=A @38 0;JMP (RET_ADDRESS_LT22) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @22 D=A @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_GT22 D=A @22 0;JMP (RET_ADDRESS_GT22) @SP AM=M-1 D=M A=A-1 M=D|M @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_LT23 D=A @38 0;JMP (RET_ADDRESS_LT23) @SP AM=M-1 D=M A=A-1 M=D|M @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @63 D=A @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_GT23 D=A @22 0;JMP (RET_ADDRESS_GT23) @SP AM=M-1 D=M A=A-1 M=D|M @SP AM=M-1 D=M @output.movecursor$if_true0 D;JNE @output.movecursor$if_false0 0;JMP (output.movecursor$if_true0) @19 D=A @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @sys.error D=A @R14 M=D @RET_ADDRESS_CALL339 D=A @95 0;JMP (RET_ADDRESS_CALL339) @SP AM=M-1 D=M M=D (output.movecursor$if_false0) @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @2 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @math.divide D=A @R14 M=D @RET_ADDRESS_CALL340 D=A @95 0;JMP (RET_ADDRESS_CALL340) @SP AM=M-1 D=M @output.0 M=D @32 D=A @SP AM=M+1 A=A-1 M=D @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @352 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @math.multiply D=A @R14 M=D @RET_ADDRESS_CALL341 D=A @95 0;JMP (RET_ADDRESS_CALL341) @SP AM=M-1 D=M A=A-1 M=D+M @output.0 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @output.1 M=D @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @output.0 D=M @SP AM=M+1 A=A-1 M=D @2 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @math.multiply D=A @R14 M=D @RET_ADDRESS_CALL342 D=A @95 0;JMP (RET_ADDRESS_CALL342) @RET_ADDRESS_EQ27 D=A @6 0;JMP (RET_ADDRESS_EQ27) @SP AM=M-1 D=M @output.2 M=D @32 D=A @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @output.drawchar D=A @R14 M=D @RET_ADDRESS_CALL343 D=A @95 0;JMP (RET_ADDRESS_CALL343) @SP AM=M-1 D=M M=D @SP M=M+1 A=M-1 M=0 @54 0;JMP (output.printchar) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @0 D=A @R13 M=D @string.newline D=A @R14 M=D @RET_ADDRESS_CALL344 D=A @95 0;JMP (RET_ADDRESS_CALL344) @RET_ADDRESS_EQ28 D=A @6 0;JMP (RET_ADDRESS_EQ28) @SP AM=M-1 D=M @output.printchar$if_true0 D;JNE @output.printchar$if_false0 0;JMP (output.printchar$if_true0) @0 D=A @R13 M=D @output.println D=A @R14 M=D @RET_ADDRESS_CALL345 D=A @95 0;JMP (RET_ADDRESS_CALL345) @SP AM=M-1 D=M M=D @output.printchar$if_end0 0;JMP (output.printchar$if_false0) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @0 D=A @R13 M=D @string.backspace D=A @R14 M=D @RET_ADDRESS_CALL346 D=A @95 0;JMP (RET_ADDRESS_CALL346) @RET_ADDRESS_EQ29 D=A @6 0;JMP (RET_ADDRESS_EQ29) @SP AM=M-1 D=M @output.printchar$if_true1 D;JNE @output.printchar$if_false1 0;JMP (output.printchar$if_true1) @0 D=A @R13 M=D @output.backspace D=A @R14 M=D @RET_ADDRESS_CALL347 D=A @95 0;JMP (RET_ADDRESS_CALL347) @SP AM=M-1 D=M M=D @output.printchar$if_end1 0;JMP (output.printchar$if_false1) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @output.drawchar D=A @R14 M=D @RET_ADDRESS_CALL348 D=A @95 0;JMP (RET_ADDRESS_CALL348) @SP AM=M-1 D=M M=D @output.2 D=M @SP AM=M+1 A=A-1 M=D @SP A=M-1 M=!M @SP AM=M-1 D=M @output.printchar$if_true2 D;JNE @output.printchar$if_false2 0;JMP (output.printchar$if_true2) @output.0 D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @output.0 M=D @output.1 D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @output.1 M=D @output.0 D=M @SP AM=M+1 A=A-1 M=D @32 D=A @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_EQ30 D=A @6 0;JMP (RET_ADDRESS_EQ30) @SP AM=M-1 D=M @output.printchar$if_true3 D;JNE @output.printchar$if_false3 0;JMP (output.printchar$if_true3) @0 D=A @R13 M=D @output.println D=A @R14 M=D @RET_ADDRESS_CALL349 D=A @95 0;JMP (RET_ADDRESS_CALL349) @SP AM=M-1 D=M M=D (output.printchar$if_false3) (output.printchar$if_false2) @output.2 D=M @SP AM=M+1 A=A-1 M=D @SP A=M-1 M=!M @SP AM=M-1 D=M @output.2 M=D (output.printchar$if_end1) (output.printchar$if_end0) @SP M=M+1 A=M-1 M=0 @54 0;JMP (output.printstring) @SP A=M M=0 AD=A+1 M=0 @SP M=D+1 @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @string.length D=A @R14 M=D @RET_ADDRESS_CALL350 D=A @95 0;JMP (RET_ADDRESS_CALL350) @SP AM=M-1 D=M @LCL A=M+1 M=D (output.printstring$while_exp0) @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_LT24 D=A @38 0;JMP (RET_ADDRESS_LT24) @SP A=M-1 M=!M @SP AM=M-1 D=M @output.printstring$while_end0 D;JNE @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.charat D=A @R14 M=D @RET_ADDRESS_CALL351 D=A @95 0;JMP (RET_ADDRESS_CALL351) @1 D=A @R13 M=D @output.printchar D=A @R14 M=D @RET_ADDRESS_CALL352 D=A @95 0;JMP (RET_ADDRESS_CALL352) @SP AM=M-1 D=M M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @LCL A=M M=D @output.printstring$while_exp0 0;JMP (output.printstring$while_end0) @SP M=M+1 A=M-1 M=0 @54 0;JMP (output.printint) @output.3 D=M @SP AM=M+1 A=A-1 M=D @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.setint D=A @R14 M=D @RET_ADDRESS_CALL353 D=A @95 0;JMP (RET_ADDRESS_CALL353) @SP AM=M-1 D=M M=D @output.3 D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @output.printstring D=A @R14 M=D @RET_ADDRESS_CALL354 D=A @95 0;JMP (RET_ADDRESS_CALL354) @SP AM=M-1 D=M M=D @SP M=M+1 A=M-1 M=0 @54 0;JMP (output.println) @output.1 D=M @SP AM=M+1 A=A-1 M=D @352 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @output.0 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=M-D @SP AM=M-1 D=M @output.1 M=D @SP M=M+1 A=M-1 M=0 @SP AM=M-1 D=M @output.0 M=D @SP M=M+1 A=M-1 M=0 @SP A=M-1 M=!M @SP AM=M-1 D=M @output.2 M=D @output.1 D=M @SP AM=M+1 A=A-1 M=D @8128 D=A @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_EQ31 D=A @6 0;JMP (RET_ADDRESS_EQ31) @SP AM=M-1 D=M @output.println$if_true0 D;JNE @output.println$if_false0 0;JMP (output.println$if_true0) @32 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @output.1 M=D (output.println$if_false0) @SP M=M+1 A=M-1 M=0 @54 0;JMP (output.backspace) @output.2 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @output.backspace$if_true0 D;JNE @output.backspace$if_false0 0;JMP (output.backspace$if_true0) @output.0 D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_GT24 D=A @22 0;JMP (RET_ADDRESS_GT24) @SP AM=M-1 D=M @output.backspace$if_true1 D;JNE @output.backspace$if_false1 0;JMP (output.backspace$if_true1) @output.0 D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=M-D @SP AM=M-1 D=M @output.0 M=D @output.1 D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=M-D @SP AM=M-1 D=M @output.1 M=D @SP M=M+1 A=M-1 M=0 @SP AM=M-1 D=M @output.2 M=D (output.backspace$if_false1) @output.backspace$if_end0 0;JMP (output.backspace$if_false0) @SP M=M+1 A=M-1 M=0 @SP A=M-1 M=!M @SP AM=M-1 D=M @output.2 M=D (output.backspace$if_end0) @32 D=A @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @output.drawchar D=A @R14 M=D @RET_ADDRESS_CALL355 D=A @95 0;JMP (RET_ADDRESS_CALL355) @SP AM=M-1 D=M M=D @SP M=M+1 A=M-1 M=0 @54 0;JMP (screen.init) @SP AM=M+1 A=A-1 M=0 @16384 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @screen.1 M=D @SP M=M+1 A=M-1 M=0 @SP A=M-1 M=!M @SP AM=M-1 D=M @screen.2 M=D @17 D=A @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @array.new D=A @R14 M=D @RET_ADDRESS_CALL356 D=A @95 0;JMP (RET_ADDRESS_CALL356) @SP AM=M-1 D=M @screen.0 M=D @SP M=M+1 A=M-1 M=0 @screen.0 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @THAT M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M @THAT A=M M=D (screen.init$while_exp0) @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @16 D=A @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_LT25 D=A @38 0;JMP (RET_ADDRESS_LT25) @SP A=M-1 M=!M @SP AM=M-1 D=M @screen.init$while_end0 D;JNE @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @LCL A=M M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @screen.0 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @THAT M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=M-D @screen.0 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M M=D @R5 D=M @SP AM=M+1 A=A-1 M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=M-D @screen.0 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M M=D @R5 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @THAT A=M M=D @screen.init$while_exp0 0;JMP (screen.init$while_end0) @SP M=M+1 A=M-1 M=0 @54 0;JMP (screen.clearscreen) @SP AM=M+1 A=A-1 M=0 (screen.clearscreen$while_exp0) @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @8192 D=A @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_LT26 D=A @38 0;JMP (RET_ADDRESS_LT26) @SP A=M-1 M=!M @SP AM=M-1 D=M @screen.clearscreen$while_end0 D;JNE @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @screen.1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @THAT M=D @SP M=M+1 A=M-1 M=0 @SP AM=M-1 D=M @THAT A=M M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @LCL A=M M=D @screen.clearscreen$while_exp0 0;JMP (screen.clearscreen$while_end0) @SP M=M+1 A=M-1 M=0 @54 0;JMP (screen.updatelocation) @screen.2 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @screen.updatelocation$if_true0 D;JNE @screen.updatelocation$if_false0 0;JMP (screen.updatelocation$if_true0) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @screen.1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @THAT M=D @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @screen.1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M M=D @R5 D=M @SP AM=M+1 A=A-1 M=D @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D|M @SP AM=M-1 D=M @THAT A=M M=D @screen.updatelocation$if_end0 0;JMP (screen.updatelocation$if_false0) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @screen.1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @THAT M=D @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @screen.1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M M=D @R5 D=M @SP AM=M+1 A=A-1 M=D @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP A=M-1 M=!M @SP AM=M-1 D=M A=A-1 M=D&M @SP AM=M-1 D=M @THAT A=M M=D (screen.updatelocation$if_end0) @SP M=M+1 A=M-1 M=0 @54 0;JMP (screen.setcolor) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @screen.2 M=D @SP M=M+1 A=M-1 M=0 @54 0;JMP (screen.drawpixel) @3 D=A (LOOP_screen.drawpixel) D=D-1 @SP AM=M+1 A=A-1 M=0 @LOOP_screen.drawpixel D;JGT @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_LT27 D=A @38 0;JMP (RET_ADDRESS_LT27) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @511 D=A @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_GT25 D=A @22 0;JMP (RET_ADDRESS_GT25) @SP AM=M-1 D=M A=A-1 M=D|M @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_LT28 D=A @38 0;JMP (RET_ADDRESS_LT28) @SP AM=M-1 D=M A=A-1 M=D|M @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @255 D=A @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_GT26 D=A @22 0;JMP (RET_ADDRESS_GT26) @SP AM=M-1 D=M A=A-1 M=D|M @SP AM=M-1 D=M @screen.drawpixel$if_true0 D;JNE @screen.drawpixel$if_false0 0;JMP (screen.drawpixel$if_true0) @7 D=A @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @sys.error D=A @R14 M=D @RET_ADDRESS_CALL357 D=A @95 0;JMP (RET_ADDRESS_CALL357) @SP AM=M-1 D=M M=D (screen.drawpixel$if_false0) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @16 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @math.divide D=A @R14 M=D @RET_ADDRESS_CALL358 D=A @95 0;JMP (RET_ADDRESS_CALL358) @SP AM=M-1 D=M @LCL A=M M=D @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @16 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @math.multiply D=A @R14 M=D @RET_ADDRESS_CALL359 D=A @95 0;JMP (RET_ADDRESS_CALL359) @SP AM=M-1 D=M A=A-1 M=M-D @SP AM=M-1 D=M @LCL A=M+1 M=D @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @32 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @math.multiply D=A @R14 M=D @RET_ADDRESS_CALL360 D=A @95 0;JMP (RET_ADDRESS_CALL360) @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @LCL A=M+1 A=A+1 M=D @LCL A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @screen.0 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M M=D @R5 D=M @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @screen.updatelocation D=A @R14 M=D @RET_ADDRESS_CALL361 D=A @95 0;JMP (RET_ADDRESS_CALL361) @SP AM=M-1 D=M M=D @SP M=M+1 A=M-1 M=0 @54 0;JMP (screen.drawconditional) @ARG A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @screen.drawconditional$if_true0 D;JNE @screen.drawconditional$if_false0 0;JMP (screen.drawconditional$if_true0) @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @screen.drawpixel D=A @R14 M=D @RET_ADDRESS_CALL362 D=A @95 0;JMP (RET_ADDRESS_CALL362) @SP AM=M-1 D=M M=D @screen.drawconditional$if_end0 0;JMP (screen.drawconditional$if_false0) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @screen.drawpixel D=A @R14 M=D @RET_ADDRESS_CALL363 D=A @95 0;JMP (RET_ADDRESS_CALL363) @SP AM=M-1 D=M M=D (screen.drawconditional$if_end0) @SP M=M+1 A=M-1 M=0 @54 0;JMP (screen.drawline) @11 D=A (LOOP_screen.drawline) D=D-1 @SP AM=M+1 A=A-1 M=0 @LOOP_screen.drawline D;JGT @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_LT29 D=A @38 0;JMP (RET_ADDRESS_LT29) @ARG A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @511 D=A @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_GT27 D=A @22 0;JMP (RET_ADDRESS_GT27) @SP AM=M-1 D=M A=A-1 M=D|M @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_LT30 D=A @38 0;JMP (RET_ADDRESS_LT30) @SP AM=M-1 D=M A=A-1 M=D|M @ARG D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @255 D=A @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_GT28 D=A @22 0;JMP (RET_ADDRESS_GT28) @SP AM=M-1 D=M A=A-1 M=D|M @SP AM=M-1 D=M @screen.drawline$if_true0 D;JNE @screen.drawline$if_false0 0;JMP (screen.drawline$if_true0) @8 D=A @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @sys.error D=A @R14 M=D @RET_ADDRESS_CALL364 D=A @95 0;JMP (RET_ADDRESS_CALL364) @SP AM=M-1 D=M M=D (screen.drawline$if_false0) @ARG A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=M-D @1 D=A @R13 M=D @math.abs D=A @R14 M=D @RET_ADDRESS_CALL365 D=A @95 0;JMP (RET_ADDRESS_CALL365) @SP AM=M-1 D=M @LCL A=M+1 A=A+1 A=A+1 M=D @ARG D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=M-D @1 D=A @R13 M=D @math.abs D=A @R14 M=D @RET_ADDRESS_CALL366 D=A @95 0;JMP (RET_ADDRESS_CALL366) @SP AM=M-1 D=M @LCL A=M+1 A=A+1 M=D @LCL D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @LCL A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_LT31 D=A @38 0;JMP (RET_ADDRESS_LT31) @SP AM=M-1 D=M @LCL A=M+1 A=A+1 A=A+1 A=A+1 A=A+1 A=A+1 M=D @LCL D=M @6 A=D+A D=M @SP AM=M+1 A=A-1 M=D @ARG D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_LT32 D=A @38 0;JMP (RET_ADDRESS_LT32) @SP AM=M-1 D=M A=A-1 M=D&M @LCL D=M @6 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP A=M-1 M=!M @ARG A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_LT33 D=A @38 0;JMP (RET_ADDRESS_LT33) @SP AM=M-1 D=M A=A-1 M=D&M @SP AM=M-1 D=M A=A-1 M=D|M @SP AM=M-1 D=M @screen.drawline$if_true1 D;JNE @screen.drawline$if_false1 0;JMP (screen.drawline$if_true1) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @LCL A=M+1 A=A+1 A=A+1 A=A+1 M=D @ARG A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @ARG A=M M=D @LCL D=M @4 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @ARG A=M+1 A=A+1 M=D @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @LCL A=M+1 A=A+1 A=A+1 A=A+1 M=D @ARG D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @ARG A=M+1 M=D @LCL D=M @4 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @ARG A=M+1 A=A+1 A=A+1 M=D (screen.drawline$if_false1) @LCL D=M @6 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @screen.drawline$if_true2 D;JNE @screen.drawline$if_false2 0;JMP (screen.drawline$if_true2) @LCL D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @LCL A=M+1 A=A+1 A=A+1 A=A+1 M=D @LCL A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @LCL A=M+1 A=A+1 A=A+1 M=D @LCL D=M @4 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @LCL A=M+1 A=A+1 M=D @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @LCL A=M+1 M=D @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @LCL A=M M=D @ARG D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @LCL D=M @8 D=D+A @R3 M=D @SP AM=M-1 D=M @R3 A=M M=D @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @ARG A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_GT29 D=A @22 0;JMP (RET_ADDRESS_GT29) @LCL D=M @7 D=D+A @R3 M=D @SP AM=M-1 D=M @R3 A=M M=D @screen.drawline$if_end2 0;JMP (screen.drawline$if_false2) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @LCL A=M+1 M=D @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @LCL A=M M=D @ARG A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @LCL D=M @8 D=D+A @R3 M=D @SP AM=M-1 D=M @R3 A=M M=D @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @ARG D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_GT30 D=A @22 0;JMP (RET_ADDRESS_GT30) @LCL D=M @7 D=D+A @R3 M=D @SP AM=M-1 D=M @R3 A=M M=D (screen.drawline$if_end2) @2 D=A @SP AM=M+1 A=A-1 M=D @LCL A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @math.multiply D=A @R14 M=D @RET_ADDRESS_CALL367 D=A @95 0;JMP (RET_ADDRESS_CALL367) @LCL D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=M-D @SP AM=M-1 D=M @LCL A=M+1 A=A+1 A=A+1 A=A+1 A=A+1 M=D @2 D=A @SP AM=M+1 A=A-1 M=D @LCL A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @math.multiply D=A @R14 M=D @RET_ADDRESS_CALL368 D=A @95 0;JMP (RET_ADDRESS_CALL368) @LCL D=M @9 D=D+A @R3 M=D @SP AM=M-1 D=M @R3 A=M M=D @2 D=A @SP AM=M+1 A=A-1 M=D @LCL A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @LCL D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=M-D @2 D=A @R13 M=D @math.multiply D=A @R14 M=D @RET_ADDRESS_CALL369 D=A @95 0;JMP (RET_ADDRESS_CALL369) @LCL D=M @10 D=D+A @R3 M=D @SP AM=M-1 D=M @R3 A=M M=D @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @LCL D=M @6 A=D+A D=M @SP AM=M+1 A=A-1 M=D @3 D=A @R13 M=D @screen.drawconditional D=A @R14 M=D @RET_ADDRESS_CALL370 D=A @95 0;JMP (RET_ADDRESS_CALL370) @SP AM=M-1 D=M M=D (screen.drawline$while_exp0) @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @LCL D=M @8 A=D+A D=M @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_LT34 D=A @38 0;JMP (RET_ADDRESS_LT34) @SP A=M-1 M=!M @SP AM=M-1 D=M @screen.drawline$while_end0 D;JNE @LCL D=M @5 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_LT35 D=A @38 0;JMP (RET_ADDRESS_LT35) @SP AM=M-1 D=M @screen.drawline$if_true3 D;JNE @screen.drawline$if_false3 0;JMP (screen.drawline$if_true3) @LCL D=M @5 A=D+A D=M @SP AM=M+1 A=A-1 M=D @LCL D=M @9 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @LCL A=M+1 A=A+1 A=A+1 A=A+1 A=A+1 M=D @screen.drawline$if_end3 0;JMP (screen.drawline$if_false3) @LCL D=M @5 A=D+A D=M @SP AM=M+1 A=A-1 M=D @LCL D=M @10 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @LCL A=M+1 A=A+1 A=A+1 A=A+1 A=A+1 M=D @LCL D=M @7 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @screen.drawline$if_true4 D;JNE @screen.drawline$if_false4 0;JMP (screen.drawline$if_true4) @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=M-D @SP AM=M-1 D=M @LCL A=M M=D @screen.drawline$if_end4 0;JMP (screen.drawline$if_false4) @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @LCL A=M M=D (screen.drawline$if_end4) (screen.drawline$if_end3) @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @LCL A=M+1 M=D @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @LCL D=M @6 A=D+A D=M @SP AM=M+1 A=A-1 M=D @3 D=A @R13 M=D @screen.drawconditional D=A @R14 M=D @RET_ADDRESS_CALL371 D=A @95 0;JMP (RET_ADDRESS_CALL371) @SP AM=M-1 D=M M=D @screen.drawline$while_exp0 0;JMP (screen.drawline$while_end0) @SP M=M+1 A=M-1 M=0 @54 0;JMP (screen.drawrectangle) @9 D=A (LOOP_screen.drawrectangle) D=D-1 @SP AM=M+1 A=A-1 M=0 @LOOP_screen.drawrectangle D;JGT @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @ARG A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_GT31 D=A @22 0;JMP (RET_ADDRESS_GT31) @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @ARG D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_GT32 D=A @22 0;JMP (RET_ADDRESS_GT32) @SP AM=M-1 D=M A=A-1 M=D|M @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_LT36 D=A @38 0;JMP (RET_ADDRESS_LT36) @SP AM=M-1 D=M A=A-1 M=D|M @ARG A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @511 D=A @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_GT33 D=A @22 0;JMP (RET_ADDRESS_GT33) @SP AM=M-1 D=M A=A-1 M=D|M @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_LT37 D=A @38 0;JMP (RET_ADDRESS_LT37) @SP AM=M-1 D=M A=A-1 M=D|M @ARG D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @255 D=A @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_GT34 D=A @22 0;JMP (RET_ADDRESS_GT34) @SP AM=M-1 D=M A=A-1 M=D|M @SP AM=M-1 D=M @screen.drawrectangle$if_true0 D;JNE @screen.drawrectangle$if_false0 0;JMP (screen.drawrectangle$if_true0) @9 D=A @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @sys.error D=A @R14 M=D @RET_ADDRESS_CALL372 D=A @95 0;JMP (RET_ADDRESS_CALL372) @SP AM=M-1 D=M M=D (screen.drawrectangle$if_false0) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @16 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @math.divide D=A @R14 M=D @RET_ADDRESS_CALL373 D=A @95 0;JMP (RET_ADDRESS_CALL373) @SP AM=M-1 D=M @LCL A=M+1 A=A+1 A=A+1 M=D @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @LCL D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @16 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @math.multiply D=A @R14 M=D @RET_ADDRESS_CALL374 D=A @95 0;JMP (RET_ADDRESS_CALL374) @SP AM=M-1 D=M A=A-1 M=M-D @LCL D=M @7 D=D+A @R3 M=D @SP AM=M-1 D=M @R3 A=M M=D @ARG A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @16 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @math.divide D=A @R14 M=D @RET_ADDRESS_CALL375 D=A @95 0;JMP (RET_ADDRESS_CALL375) @SP AM=M-1 D=M @LCL A=M+1 A=A+1 A=A+1 A=A+1 M=D @ARG A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @LCL D=M @4 A=D+A D=M @SP AM=M+1 A=A-1 M=D @16 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @math.multiply D=A @R14 M=D @RET_ADDRESS_CALL376 D=A @95 0;JMP (RET_ADDRESS_CALL376) @SP AM=M-1 D=M A=A-1 M=M-D @LCL D=M @8 D=D+A @R3 M=D @SP AM=M-1 D=M @R3 A=M M=D @LCL D=M @7 A=D+A D=M @SP AM=M+1 A=A-1 M=D @screen.0 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M M=D @R5 D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=M-D @SP A=M-1 M=!M @SP AM=M-1 D=M @LCL A=M+1 A=A+1 A=A+1 A=A+1 A=A+1 A=A+1 M=D @LCL D=M @8 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=D+M @screen.0 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M M=D @R5 D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=M-D @SP AM=M-1 D=M @LCL A=M+1 A=A+1 A=A+1 A=A+1 A=A+1 M=D @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @32 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @math.multiply D=A @R14 M=D @RET_ADDRESS_CALL377 D=A @95 0;JMP (RET_ADDRESS_CALL377) @LCL D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @LCL A=M M=D @LCL D=M @4 A=D+A D=M @SP AM=M+1 A=A-1 M=D @LCL D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=M-D @SP AM=M-1 D=M @LCL A=M+1 A=A+1 M=D (screen.drawrectangle$while_exp0) @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @ARG D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_GT35 D=A @22 0;JMP (RET_ADDRESS_GT35) @SP A=M-1 M=!M @SP A=M-1 M=!M @SP AM=M-1 D=M @screen.drawrectangle$while_end0 D;JNE @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @LCL A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @LCL A=M+1 M=D @LCL A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_EQ32 D=A @6 0;JMP (RET_ADDRESS_EQ32) @SP AM=M-1 D=M @screen.drawrectangle$if_true1 D;JNE @screen.drawrectangle$if_false1 0;JMP (screen.drawrectangle$if_true1) @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @LCL D=M @5 A=D+A D=M @SP AM=M+1 A=A-1 M=D @LCL D=M @6 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D&M @2 D=A @R13 M=D @screen.updatelocation D=A @R14 M=D @RET_ADDRESS_CALL378 D=A @95 0;JMP (RET_ADDRESS_CALL378) @SP AM=M-1 D=M M=D @screen.drawrectangle$if_end1 0;JMP (screen.drawrectangle$if_false1) @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @LCL D=M @6 A=D+A D=M @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @screen.updatelocation D=A @R14 M=D @RET_ADDRESS_CALL379 D=A @95 0;JMP (RET_ADDRESS_CALL379) @SP AM=M-1 D=M M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @LCL A=M M=D (screen.drawrectangle$while_exp1) @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_LT38 D=A @38 0;JMP (RET_ADDRESS_LT38) @SP A=M-1 M=!M @SP AM=M-1 D=M @screen.drawrectangle$while_end1 D;JNE @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP A=M-1 D=!M M=D+1 @2 D=A @R13 M=D @screen.updatelocation D=A @R14 M=D @RET_ADDRESS_CALL380 D=A @95 0;JMP (RET_ADDRESS_CALL380) @SP AM=M-1 D=M M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @LCL A=M M=D @screen.drawrectangle$while_exp1 0;JMP (screen.drawrectangle$while_end1) @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @LCL D=M @5 A=D+A D=M @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @screen.updatelocation D=A @R14 M=D @RET_ADDRESS_CALL381 D=A @95 0;JMP (RET_ADDRESS_CALL381) @SP AM=M-1 D=M M=D (screen.drawrectangle$if_end1) @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @ARG A=M+1 M=D @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @32 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @LCL A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=M-D @SP AM=M-1 D=M @LCL A=M M=D @screen.drawrectangle$while_exp0 0;JMP (screen.drawrectangle$while_end0) @SP M=M+1 A=M-1 M=0 @54 0;JMP (screen.drawhorizontal) @11 D=A (LOOP_screen.drawhorizontal) D=D-1 @SP AM=M+1 A=A-1 M=0 @LOOP_screen.drawhorizontal D;JGT @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @ARG A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @math.min D=A @R14 M=D @RET_ADDRESS_CALL382 D=A @95 0;JMP (RET_ADDRESS_CALL382) @LCL D=M @7 D=D+A @R3 M=D @SP AM=M-1 D=M @R3 A=M M=D @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @ARG A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @math.max D=A @R14 M=D @RET_ADDRESS_CALL383 D=A @95 0;JMP (RET_ADDRESS_CALL383) @LCL D=M @8 D=D+A @R3 M=D @SP AM=M-1 D=M @R3 A=M M=D @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP A=M-1 D=!M M=D+1 @RET_ADDRESS_GT36 D=A @22 0;JMP (RET_ADDRESS_GT36) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @256 D=A @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_LT39 D=A @38 0;JMP (RET_ADDRESS_LT39) @SP AM=M-1 D=M A=A-1 M=D&M @LCL D=M @7 A=D+A D=M @SP AM=M+1 A=A-1 M=D @512 D=A @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_LT40 D=A @38 0;JMP (RET_ADDRESS_LT40) @SP AM=M-1 D=M A=A-1 M=D&M @LCL D=M @8 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP A=M-1 D=!M M=D+1 @RET_ADDRESS_GT37 D=A @22 0;JMP (RET_ADDRESS_GT37) @SP AM=M-1 D=M A=A-1 M=D&M @SP AM=M-1 D=M @screen.drawhorizontal$if_true0 D;JNE @screen.drawhorizontal$if_false0 0;JMP (screen.drawhorizontal$if_true0) @LCL D=M @7 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @2 D=A @R13 M=D @math.max D=A @R14 M=D @RET_ADDRESS_CALL384 D=A @95 0;JMP (RET_ADDRESS_CALL384) @LCL D=M @7 D=D+A @R3 M=D @SP AM=M-1 D=M @R3 A=M M=D @LCL D=M @8 A=D+A D=M @SP AM=M+1 A=A-1 M=D @511 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @math.min D=A @R14 M=D @RET_ADDRESS_CALL385 D=A @95 0;JMP (RET_ADDRESS_CALL385) @LCL D=M @8 D=D+A @R3 M=D @SP AM=M-1 D=M @R3 A=M M=D @LCL D=M @7 A=D+A D=M @SP AM=M+1 A=A-1 M=D @16 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @math.divide D=A @R14 M=D @RET_ADDRESS_CALL386 D=A @95 0;JMP (RET_ADDRESS_CALL386) @SP AM=M-1 D=M @LCL A=M+1 M=D @LCL D=M @7 A=D+A D=M @SP AM=M+1 A=A-1 M=D @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @16 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @math.multiply D=A @R14 M=D @RET_ADDRESS_CALL387 D=A @95 0;JMP (RET_ADDRESS_CALL387) @SP AM=M-1 D=M A=A-1 M=M-D @LCL D=M @9 D=D+A @R3 M=D @SP AM=M-1 D=M @R3 A=M M=D @LCL D=M @8 A=D+A D=M @SP AM=M+1 A=A-1 M=D @16 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @math.divide D=A @R14 M=D @RET_ADDRESS_CALL388 D=A @95 0;JMP (RET_ADDRESS_CALL388) @SP AM=M-1 D=M @LCL A=M+1 A=A+1 M=D @LCL D=M @8 A=D+A D=M @SP AM=M+1 A=A-1 M=D @LCL A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @16 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @math.multiply D=A @R14 M=D @RET_ADDRESS_CALL389 D=A @95 0;JMP (RET_ADDRESS_CALL389) @SP AM=M-1 D=M A=A-1 M=M-D @LCL D=M @10 D=D+A @R3 M=D @SP AM=M-1 D=M @R3 A=M M=D @LCL D=M @9 A=D+A D=M @SP AM=M+1 A=A-1 M=D @screen.0 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M M=D @R5 D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=M-D @SP A=M-1 M=!M @SP AM=M-1 D=M @LCL A=M+1 A=A+1 A=A+1 A=A+1 A=A+1 M=D @LCL D=M @10 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=D+M @screen.0 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M M=D @R5 D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=M-D @SP AM=M-1 D=M @LCL A=M+1 A=A+1 A=A+1 A=A+1 M=D @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @32 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @math.multiply D=A @R14 M=D @RET_ADDRESS_CALL390 D=A @95 0;JMP (RET_ADDRESS_CALL390) @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @LCL A=M M=D @LCL A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=M-D @SP AM=M-1 D=M @LCL A=M+1 A=A+1 A=A+1 A=A+1 A=A+1 A=A+1 M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @LCL D=M @6 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @LCL A=M+1 A=A+1 A=A+1 M=D @LCL D=M @6 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_EQ33 D=A @6 0;JMP (RET_ADDRESS_EQ33) @SP AM=M-1 D=M @screen.drawhorizontal$if_true1 D;JNE @screen.drawhorizontal$if_false1 0;JMP (screen.drawhorizontal$if_true1) @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @LCL D=M @4 A=D+A D=M @SP AM=M+1 A=A-1 M=D @LCL D=M @5 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D&M @2 D=A @R13 M=D @screen.updatelocation D=A @R14 M=D @RET_ADDRESS_CALL391 D=A @95 0;JMP (RET_ADDRESS_CALL391) @SP AM=M-1 D=M M=D @screen.drawhorizontal$if_end1 0;JMP (screen.drawhorizontal$if_false1) @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @LCL D=M @5 A=D+A D=M @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @screen.updatelocation D=A @R14 M=D @RET_ADDRESS_CALL392 D=A @95 0;JMP (RET_ADDRESS_CALL392) @SP AM=M-1 D=M M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @LCL A=M M=D (screen.drawhorizontal$while_exp0) @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @LCL D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_LT41 D=A @38 0;JMP (RET_ADDRESS_LT41) @SP A=M-1 M=!M @SP AM=M-1 D=M @screen.drawhorizontal$while_end0 D;JNE @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP A=M-1 D=!M M=D+1 @2 D=A @R13 M=D @screen.updatelocation D=A @R14 M=D @RET_ADDRESS_CALL393 D=A @95 0;JMP (RET_ADDRESS_CALL393) @SP AM=M-1 D=M M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @LCL A=M M=D @screen.drawhorizontal$while_exp0 0;JMP (screen.drawhorizontal$while_end0) @LCL D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @LCL D=M @4 A=D+A D=M @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @screen.updatelocation D=A @R14 M=D @RET_ADDRESS_CALL394 D=A @95 0;JMP (RET_ADDRESS_CALL394) @SP AM=M-1 D=M M=D (screen.drawhorizontal$if_end1) (screen.drawhorizontal$if_false0) @SP M=M+1 A=M-1 M=0 @54 0;JMP (screen.drawsymetric) @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @ARG D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=M-D @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @ARG A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @ARG A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=M-D @3 D=A @R13 M=D @screen.drawhorizontal D=A @R14 M=D @RET_ADDRESS_CALL395 D=A @95 0;JMP (RET_ADDRESS_CALL395) @SP AM=M-1 D=M M=D @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @ARG D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @ARG A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @ARG A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=M-D @3 D=A @R13 M=D @screen.drawhorizontal D=A @R14 M=D @RET_ADDRESS_CALL396 D=A @95 0;JMP (RET_ADDRESS_CALL396) @SP AM=M-1 D=M M=D @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @ARG A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=M-D @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @ARG D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=M-D @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @ARG D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @3 D=A @R13 M=D @screen.drawhorizontal D=A @R14 M=D @RET_ADDRESS_CALL397 D=A @95 0;JMP (RET_ADDRESS_CALL397) @SP AM=M-1 D=M M=D @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @ARG A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @ARG D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=M-D @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @ARG D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @3 D=A @R13 M=D @screen.drawhorizontal D=A @R14 M=D @RET_ADDRESS_CALL398 D=A @95 0;JMP (RET_ADDRESS_CALL398) @SP AM=M-1 D=M M=D @SP M=M+1 A=M-1 M=0 @54 0;JMP (screen.drawcircle) @3 D=A (LOOP_screen.drawcircle) D=D-1 @SP AM=M+1 A=A-1 M=0 @LOOP_screen.drawcircle D;JGT @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_LT42 D=A @38 0;JMP (RET_ADDRESS_LT42) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @511 D=A @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_GT38 D=A @22 0;JMP (RET_ADDRESS_GT38) @SP AM=M-1 D=M A=A-1 M=D|M @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_LT43 D=A @38 0;JMP (RET_ADDRESS_LT43) @SP AM=M-1 D=M A=A-1 M=D|M @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @255 D=A @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_GT39 D=A @22 0;JMP (RET_ADDRESS_GT39) @SP AM=M-1 D=M A=A-1 M=D|M @SP AM=M-1 D=M @screen.drawcircle$if_true0 D;JNE @screen.drawcircle$if_false0 0;JMP (screen.drawcircle$if_true0) @12 D=A @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @sys.error D=A @R14 M=D @RET_ADDRESS_CALL399 D=A @95 0;JMP (RET_ADDRESS_CALL399) @SP AM=M-1 D=M M=D (screen.drawcircle$if_false0) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @ARG A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=M-D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_LT44 D=A @38 0;JMP (RET_ADDRESS_LT44) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @ARG A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @511 D=A @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_GT40 D=A @22 0;JMP (RET_ADDRESS_GT40) @SP AM=M-1 D=M A=A-1 M=D|M @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @ARG A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=M-D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_LT45 D=A @38 0;JMP (RET_ADDRESS_LT45) @SP AM=M-1 D=M A=A-1 M=D|M @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @ARG A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @255 D=A @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_GT41 D=A @22 0;JMP (RET_ADDRESS_GT41) @SP AM=M-1 D=M A=A-1 M=D|M @SP AM=M-1 D=M @screen.drawcircle$if_true1 D;JNE @screen.drawcircle$if_false1 0;JMP (screen.drawcircle$if_true1) @13 D=A @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @sys.error D=A @R14 M=D @RET_ADDRESS_CALL400 D=A @95 0;JMP (RET_ADDRESS_CALL400) @SP AM=M-1 D=M M=D (screen.drawcircle$if_false1) @ARG A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @LCL A=M+1 M=D @SP M=M+1 A=M-1 M=1 @ARG A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=M-D @SP AM=M-1 D=M @LCL A=M+1 A=A+1 M=D @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @4 D=A @R13 M=D @screen.drawsymetric D=A @R14 M=D @RET_ADDRESS_CALL401 D=A @95 0;JMP (RET_ADDRESS_CALL401) @SP AM=M-1 D=M M=D (screen.drawcircle$while_exp0) @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_GT42 D=A @22 0;JMP (RET_ADDRESS_GT42) @SP A=M-1 M=!M @SP AM=M-1 D=M @screen.drawcircle$while_end0 D;JNE @LCL A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_LT46 D=A @38 0;JMP (RET_ADDRESS_LT46) @SP AM=M-1 D=M @screen.drawcircle$if_true2 D;JNE @screen.drawcircle$if_false2 0;JMP (screen.drawcircle$if_true2) @LCL A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @2 D=A @SP AM=M+1 A=A-1 M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @math.multiply D=A @R14 M=D @RET_ADDRESS_CALL402 D=A @95 0;JMP (RET_ADDRESS_CALL402) @SP AM=M-1 D=M A=A-1 M=D+M @3 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @LCL A=M+1 A=A+1 M=D @screen.drawcircle$if_end2 0;JMP (screen.drawcircle$if_false2) @LCL A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @2 D=A @SP AM=M+1 A=A-1 M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=M-D @2 D=A @R13 M=D @math.multiply D=A @R14 M=D @RET_ADDRESS_CALL403 D=A @95 0;JMP (RET_ADDRESS_CALL403) @SP AM=M-1 D=M A=A-1 M=D+M @5 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @LCL A=M+1 A=A+1 M=D @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=M-D @SP AM=M-1 D=M @LCL A=M+1 M=D (screen.drawcircle$if_end2) @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @LCL A=M M=D @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @4 D=A @R13 M=D @screen.drawsymetric D=A @R14 M=D @RET_ADDRESS_CALL404 D=A @95 0;JMP (RET_ADDRESS_CALL404) @SP AM=M-1 D=M M=D @screen.drawcircle$while_exp0 0;JMP (screen.drawcircle$while_end0) @SP M=M+1 A=M-1 M=0 @54 0;JMP (string.new) @3 D=A @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @memory.alloc D=A @R14 M=D @RET_ADDRESS_CALL405 D=A @95 0;JMP (RET_ADDRESS_CALL405) @SP AM=M-1 D=M @THIS M=D @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_GT43 D=A @22 0;JMP (RET_ADDRESS_GT43) @SP A=M-1 M=!M @SP AM=M-1 D=M @string.new$if_true0 D;JNE @string.new$if_false0 0;JMP (string.new$if_true0) @14 D=A @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @sys.error D=A @R14 M=D @RET_ADDRESS_CALL406 D=A @95 0;JMP (RET_ADDRESS_CALL406) @SP AM=M-1 D=M M=D (string.new$if_false0) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @array.new D=A @R14 M=D @RET_ADDRESS_CALL407 D=A @95 0;JMP (RET_ADDRESS_CALL407) @SP AM=M-1 D=M @THIS A=M+1 M=D @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THIS A=M M=D @SP M=M+1 A=M-1 M=0 @SP AM=M-1 D=M @THIS A=M+1 A=A+1 M=D @THIS D=M @SP AM=M+1 A=A-1 M=D @54 0;JMP (string.dispose) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THIS M=D @THIS A=M+1 D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @array.dispose D=A @R14 M=D @RET_ADDRESS_CALL408 D=A @95 0;JMP (RET_ADDRESS_CALL408) @SP AM=M-1 D=M M=D @THIS D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @memory.dealloc D=A @R14 M=D @RET_ADDRESS_CALL409 D=A @95 0;JMP (RET_ADDRESS_CALL409) @SP AM=M-1 D=M M=D @SP M=M+1 A=M-1 M=0 @54 0;JMP (string.length) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THIS M=D @THIS A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @54 0;JMP (string.charat) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THIS M=D @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_LT47 D=A @38 0;JMP (RET_ADDRESS_LT47) @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @THIS A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_GT44 D=A @22 0;JMP (RET_ADDRESS_GT44) @SP AM=M-1 D=M A=A-1 M=D|M @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @THIS A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_EQ34 D=A @6 0;JMP (RET_ADDRESS_EQ34) @SP AM=M-1 D=M A=A-1 M=D|M @SP AM=M-1 D=M @string.charat$if_true0 D;JNE @string.charat$if_false0 0;JMP (string.charat$if_true0) @15 D=A @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @sys.error D=A @R14 M=D @RET_ADDRESS_CALL410 D=A @95 0;JMP (RET_ADDRESS_CALL410) @SP AM=M-1 D=M M=D (string.charat$if_false0) @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @THIS A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M M=D @R5 D=M @SP AM=M+1 A=A-1 M=D @54 0;JMP (string.setcharat) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THIS M=D @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_LT48 D=A @38 0;JMP (RET_ADDRESS_LT48) @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @THIS A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_GT45 D=A @22 0;JMP (RET_ADDRESS_GT45) @SP AM=M-1 D=M A=A-1 M=D|M @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @THIS A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_EQ35 D=A @6 0;JMP (RET_ADDRESS_EQ35) @SP AM=M-1 D=M A=A-1 M=D|M @SP AM=M-1 D=M @string.setcharat$if_true0 D;JNE @string.setcharat$if_false0 0;JMP (string.setcharat$if_true0) @16 D=A @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @sys.error D=A @R14 M=D @RET_ADDRESS_CALL411 D=A @95 0;JMP (RET_ADDRESS_CALL411) @SP AM=M-1 D=M M=D (string.setcharat$if_false0) @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @THIS A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @THAT M=D @ARG A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THAT A=M M=D @SP M=M+1 A=M-1 M=0 @54 0;JMP (string.appendchar) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THIS M=D @THIS A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @THIS A=M D=M @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_EQ36 D=A @6 0;JMP (RET_ADDRESS_EQ36) @SP AM=M-1 D=M @string.appendchar$if_true0 D;JNE @string.appendchar$if_false0 0;JMP (string.appendchar$if_true0) @17 D=A @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @sys.error D=A @R14 M=D @RET_ADDRESS_CALL412 D=A @95 0;JMP (RET_ADDRESS_CALL412) @SP AM=M-1 D=M M=D (string.appendchar$if_false0) @THIS A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @THIS A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @THAT M=D @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THAT A=M M=D @THIS A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @THIS A=M+1 A=A+1 M=D @THIS D=M @SP AM=M+1 A=A-1 M=D @54 0;JMP (string.eraselastchar) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THIS M=D @THIS A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_EQ37 D=A @6 0;JMP (RET_ADDRESS_EQ37) @SP AM=M-1 D=M @string.eraselastchar$if_true0 D;JNE @string.eraselastchar$if_false0 0;JMP (string.eraselastchar$if_true0) @18 D=A @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @sys.error D=A @R14 M=D @RET_ADDRESS_CALL413 D=A @95 0;JMP (RET_ADDRESS_CALL413) @SP AM=M-1 D=M M=D (string.eraselastchar$if_false0) @THIS A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=M-D @SP AM=M-1 D=M @THIS A=M+1 A=A+1 M=D @SP M=M+1 A=M-1 M=0 @54 0;JMP (string.intvalue) @5 D=A (LOOP_string.intvalue) D=D-1 @SP AM=M+1 A=A-1 M=0 @LOOP_string.intvalue D;JGT @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THIS M=D @SP M=M+1 A=M-1 M=0 @SP A=M-1 M=!M @SP AM=M-1 D=M @LCL A=M+1 A=A+1 A=A+1 M=D @SP M=M+1 A=M-1 M=0 @THIS A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M M=D @R5 D=M @SP AM=M+1 A=A-1 M=D @45 D=A @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_EQ38 D=A @6 0;JMP (RET_ADDRESS_EQ38) @SP AM=M-1 D=M @string.intvalue$if_true0 D;JNE @string.intvalue$if_false0 0;JMP (string.intvalue$if_true0) @SP M=M+1 A=M-1 M=0 @SP A=M-1 M=!M @SP AM=M-1 D=M @LCL A=M+1 A=A+1 A=A+1 A=A+1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M @LCL A=M M=D (string.intvalue$if_false0) (string.intvalue$while_exp0) @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @THIS A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_LT49 D=A @38 0;JMP (RET_ADDRESS_LT49) @LCL D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D&M @SP A=M-1 M=!M @SP AM=M-1 D=M @string.intvalue$while_end0 D;JNE @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @THIS A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M M=D @R5 D=M @SP AM=M+1 A=A-1 M=D @48 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=M-D @SP AM=M-1 D=M @LCL A=M+1 A=A+1 M=D @LCL A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_LT50 D=A @38 0;JMP (RET_ADDRESS_LT50) @LCL A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @9 D=A @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_GT46 D=A @22 0;JMP (RET_ADDRESS_GT46) @SP AM=M-1 D=M A=A-1 M=D|M @SP A=M-1 M=!M @SP AM=M-1 D=M @LCL A=M+1 A=A+1 A=A+1 M=D @LCL D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @string.intvalue$if_true1 D;JNE @string.intvalue$if_false1 0;JMP (string.intvalue$if_true1) @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @10 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @math.multiply D=A @R14 M=D @RET_ADDRESS_CALL414 D=A @95 0;JMP (RET_ADDRESS_CALL414) @LCL A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @LCL A=M+1 M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @LCL A=M M=D (string.intvalue$if_false1) @string.intvalue$while_exp0 0;JMP (string.intvalue$while_end0) @LCL D=M @4 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @string.intvalue$if_true2 D;JNE @string.intvalue$if_false2 0;JMP (string.intvalue$if_true2) @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP A=M-1 D=!M M=D+1 @SP AM=M-1 D=M @LCL A=M+1 M=D (string.intvalue$if_false2) @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @54 0;JMP (string.setint) @4 D=A (LOOP_string.setint) D=D-1 @SP AM=M+1 A=A-1 M=0 @LOOP_string.setint D;JGT @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THIS M=D @6 D=A @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @array.new D=A @R14 M=D @RET_ADDRESS_CALL415 D=A @95 0;JMP (RET_ADDRESS_CALL415) @SP AM=M-1 D=M @LCL A=M+1 A=A+1 M=D @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_LT51 D=A @38 0;JMP (RET_ADDRESS_LT51) @SP AM=M-1 D=M @string.setint$if_true0 D;JNE @string.setint$if_false0 0;JMP (string.setint$if_true0) @SP M=M+1 A=M-1 M=0 @SP A=M-1 M=!M @SP AM=M-1 D=M @LCL A=M+1 A=A+1 A=A+1 M=D @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP A=M-1 D=!M M=D+1 @SP AM=M-1 D=M @ARG A=M+1 M=D (string.setint$if_false0) @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @LCL A=M+1 M=D (string.setint$while_exp0) @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_GT47 D=A @22 0;JMP (RET_ADDRESS_GT47) @SP A=M-1 M=!M @SP AM=M-1 D=M @string.setint$while_end0 D;JNE @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @10 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @math.divide D=A @R14 M=D @RET_ADDRESS_CALL416 D=A @95 0;JMP (RET_ADDRESS_CALL416) @SP AM=M-1 D=M @LCL A=M+1 M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @LCL A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @THAT M=D @48 D=A @SP AM=M+1 A=A-1 M=D @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @10 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @math.multiply D=A @R14 M=D @RET_ADDRESS_CALL417 D=A @95 0;JMP (RET_ADDRESS_CALL417) @SP AM=M-1 D=M A=A-1 M=M-D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @THAT A=M M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @LCL A=M M=D @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @ARG A=M+1 M=D @string.setint$while_exp0 0;JMP (string.setint$while_end0) @LCL D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @string.setint$if_true1 D;JNE @string.setint$if_false1 0;JMP (string.setint$if_true1) @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @LCL A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @THAT M=D @45 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THAT A=M M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @LCL A=M M=D (string.setint$if_false1) @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_EQ39 D=A @6 0;JMP (RET_ADDRESS_EQ39) @SP AM=M-1 D=M @string.setint$if_true2 D;JNE @string.setint$if_false2 0;JMP (string.setint$if_true2) @SP M=M+1 A=M-1 M=0 @THIS A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @THAT M=D @48 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THAT A=M M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M @THIS A=M+1 A=A+1 M=D @string.setint$if_end2 0;JMP (string.setint$if_false2) @SP M=M+1 A=M-1 M=0 @SP AM=M-1 D=M @THIS A=M+1 A=A+1 M=D (string.setint$while_exp1) @THIS A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_LT52 D=A @38 0;JMP (RET_ADDRESS_LT52) @SP A=M-1 M=!M @SP AM=M-1 D=M @string.setint$while_end1 D;JNE @THIS A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @THIS A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @THAT M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @THIS A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M A=A-1 M=M-D @LCL A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M M=D @R5 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THAT A=M M=D @THIS A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @THIS A=M+1 A=A+1 M=D @string.setint$while_exp1 0;JMP (string.setint$while_end1) (string.setint$if_end2) @LCL A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @array.dispose D=A @R14 M=D @RET_ADDRESS_CALL418 D=A @95 0;JMP (RET_ADDRESS_CALL418) @SP AM=M-1 D=M M=D @SP M=M+1 A=M-1 M=0 @54 0;JMP (string.newline) @128 D=A @SP AM=M+1 A=A-1 M=D @54 0;JMP (string.backspace) @129 D=A @SP AM=M+1 A=A-1 M=D @54 0;JMP (string.doublequote) @34 D=A @SP AM=M+1 A=A-1 M=D @54 0;JMP (sys.init) @0 D=A @R13 M=D @memory.init D=A @R14 M=D @RET_ADDRESS_CALL419 D=A @95 0;JMP (RET_ADDRESS_CALL419) @SP AM=M-1 D=M M=D @0 D=A @R13 M=D @math.init D=A @R14 M=D @RET_ADDRESS_CALL420 D=A @95 0;JMP (RET_ADDRESS_CALL420) @SP AM=M-1 D=M M=D @0 D=A @R13 M=D @screen.init D=A @R14 M=D @RET_ADDRESS_CALL421 D=A @95 0;JMP (RET_ADDRESS_CALL421) @SP AM=M-1 D=M M=D @0 D=A @R13 M=D @output.init D=A @R14 M=D @RET_ADDRESS_CALL422 D=A @95 0;JMP (RET_ADDRESS_CALL422) @SP AM=M-1 D=M M=D @0 D=A @R13 M=D @keyboard.init D=A @R14 M=D @RET_ADDRESS_CALL423 D=A @95 0;JMP (RET_ADDRESS_CALL423) @SP AM=M-1 D=M M=D @0 D=A @R13 M=D @main.main D=A @R14 M=D @RET_ADDRESS_CALL424 D=A @95 0;JMP (RET_ADDRESS_CALL424) @SP AM=M-1 D=M M=D (sys.init$while_exp0) @SP M=M+1 A=M-1 M=0 @SP A=M-1 M=!M @SP A=M-1 M=!M @SP AM=M-1 D=M @sys.init$while_end0 D;JNE @sys.init$while_exp0 0;JMP (sys.init$while_end0) (sys.halt) (sys.halt$while_exp0) @SP M=M+1 A=M-1 M=0 @SP A=M-1 M=!M @SP A=M-1 M=!M @SP AM=M-1 D=M @sys.halt$while_end0 D;JNE @sys.halt$while_exp0 0;JMP (sys.halt$while_end0) (sys.wait) @SP AM=M+1 A=A-1 M=0 @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_LT53 D=A @38 0;JMP (RET_ADDRESS_LT53) @SP AM=M-1 D=M @sys.wait$if_true0 D;JNE @sys.wait$if_false0 0;JMP (sys.wait$if_true0) @SP M=M+1 A=M-1 M=1 @1 D=A @R13 M=D @sys.error D=A @R14 M=D @RET_ADDRESS_CALL425 D=A @95 0;JMP (RET_ADDRESS_CALL425) @SP AM=M-1 D=M M=D (sys.wait$if_false0) (sys.wait$while_exp0) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_GT48 D=A @22 0;JMP (RET_ADDRESS_GT48) @SP A=M-1 M=!M @SP AM=M-1 D=M @sys.wait$while_end0 D;JNE @50 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @LCL A=M M=D (sys.wait$while_exp1) @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_GT49 D=A @22 0;JMP (RET_ADDRESS_GT49) @SP A=M-1 M=!M @SP AM=M-1 D=M @sys.wait$while_end1 D;JNE @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=M-D @SP AM=M-1 D=M @LCL A=M M=D @sys.wait$while_exp1 0;JMP (sys.wait$while_end1) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=M-D @SP AM=M-1 D=M @ARG A=M M=D @sys.wait$while_exp0 0;JMP (sys.wait$while_end0) @SP M=M+1 A=M-1 M=0 @54 0;JMP (sys.error) @3 D=A @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @string.new D=A @R14 M=D @RET_ADDRESS_CALL426 D=A @95 0;JMP (RET_ADDRESS_CALL426) @69 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL427 D=A @95 0;JMP (RET_ADDRESS_CALL427) @82 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL428 D=A @95 0;JMP (RET_ADDRESS_CALL428) @82 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL429 D=A @95 0;JMP (RET_ADDRESS_CALL429) @1 D=A @R13 M=D @output.printstring D=A @R14 M=D @RET_ADDRESS_CALL430 D=A @95 0;JMP (RET_ADDRESS_CALL430) @SP AM=M-1 D=M M=D @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @output.printint D=A @R14 M=D @RET_ADDRESS_CALL431 D=A @95 0;JMP (RET_ADDRESS_CALL431) @SP AM=M-1 D=M M=D (sys.error$while_exp0) @SP M=M+1 A=M-1 M=0 @SP A=M-1 M=!M @SP A=M-1 M=!M @SP AM=M-1 D=M @sys.error$while_end0 D;JNE @sys.error$while_exp0 0;JMP (sys.error$while_end0)
; A153257: a(n) = n^3-(n+1)^2. ; -1,-3,-1,11,39,89,167,279,431,629,879,1187,1559,2001,2519,3119,3807,4589,5471,6459,7559,8777,10119,11591,13199,14949,16847,18899,21111,23489,26039,28767,31679,34781,38079,41579,45287,49209,53351,57719 mov $1,$0 pow $0,2 sub $0,2 sub $1,1 mul $0,$1 sub $0,3
.constant_pool .const 0 string [start] .const 1 string [constructor] .const 2 string [e] .const 3 string [elemento] .const 4 string [oi] .const 5 string [x] .const 6 string [msg] .const 7 string [msg=] .const 8 int [2] .const 9 string [io.writeln] .end .entity start .valid_context_when (always) .method constructor .var 0 element e newelem 3 --> [elemento] stvar 0 --> [e] ldconst 4 --> [oi] ldvar 0 --> [e] mcall 5 --> [x] exit .end .end .entity elemento .valid_context_when (always) .method x .param 0 string msg ldconst 7 --> [msg=] ldparam 0 --> [msg] ldconst 8 --> [2] lcall 9 --> [io.writeln] ret .end .end
; A070399: a(n) = 6^n mod 31. ; 1,6,5,30,25,26,1,6,5,30,25,26,1,6,5,30,25,26,1,6,5,30,25,26,1,6,5,30,25,26,1,6,5,30,25,26,1,6,5,30,25,26,1,6,5,30,25,26,1,6,5,30,25,26,1,6,5,30,25,26,1,6,5,30,25,26,1,6,5,30,25,26,1,6,5,30,25,26,1,6,5,30,25,26,1,6,5,30,25,26,1,6,5,30,25,26,1,6,5,30,25,26,1,6,5,30,25,26,1,6,5,30,25,26,1,6,5,30,25,26,1,6,5,30,25,26,1,6,5,30,25,26,1,6,5,30,25,26,1,6,5,30,25,26,1,6,5,30,25,26,1,6,5,30,25,26,1,6,5,30,25,26,1,6,5,30,25,26,1,6,5,30,25,26,1,6,5,30,25,26,1,6,5,30,25,26,1,6,5,30,25,26,1,6,5,30,25,26,1,6,5,30,25,26,1,6,5,30,25,26,1,6,5,30,25,26,1,6,5,30,25,26,1,6,5,30,25,26,1,6,5,30,25,26,1,6,5,30,25,26,1,6,5,30,25,26,1,6,5,30 mov $1,1 mov $2,$0 lpb $2,1 mul $1,6 mod $1,31 sub $2,1 lpe
; A050509: House numbers (version 2): a(n) = (n+1)^3 + (n+1)*Sum_{i=0..n} i. ; 1,10,36,88,175,306,490,736,1053,1450,1936,2520,3211,4018,4950,6016,7225,8586,10108,11800,13671,15730,17986,20448,23125,26026,29160,32536,36163,40050,44206,48640,53361,58378,63700,69336,75295,81586,88218,95200,102541,110250,118336,126808,135675,144946,154630,164736,175273,186250,197676,209560,221911,234738,248050,261856,276165,290986,306328,322200,338611,355570,373086,391168,409825,429066,448900,469336,490383,512050,534346,557280,580861,605098,630000,655576,681835,708786,736438,764800,793881,823690,854236,885528,917575,950386,983970,1018336,1053493,1089450,1126216,1163800,1202211,1241458,1281550,1322496,1364305,1406986,1450548,1495000 add $0,1 mul $0,3 mov $1,$0 bin $1,2 mul $0,$1 div $0,9
; A256020: a(n) = Sum_{i=1..n-1} (i^4 * a(i)), a(1)=1. ; 1,1,17,1394,358258,224269508,290877551876,698687879606152,2862524242746404744,18783884080901907930128,187857624693099981209210128,2750611340756369924865254694176,57039427373264843131930786593127712,1629160124635190449534207126672913710144 seq $0,255434 ; Product_{k=0..n} (k^4+1). add $0,1 div $0,2
; A044807: Numbers n such that string 9,4 occurs in the base 10 representation of n but not of n+1. ; Submitted by Christian Krause ; 94,194,294,394,494,594,694,794,894,949,994,1094,1194,1294,1394,1494,1594,1694,1794,1894,1949,1994,2094,2194,2294,2394,2494,2594,2694,2794,2894,2949,2994,3094,3194,3294,3394,3494,3594 add $0,1 mul $0,10 add $0,2 mov $1,$0 add $0,7 div $0,11 mul $0,22 sub $1,3 div $1,11 add $1,3 mul $1,14 add $0,$1 add $0,$1 sub $0,13 mul $0,4 div $0,10 mul $0,5 sub $0,91
; A113935: a(n) = prime(n) + 3. ; 5,6,8,10,14,16,20,22,26,32,34,40,44,46,50,56,62,64,70,74,76,82,86,92,100,104,106,110,112,116,130,134,140,142,152,154,160,166,170,176,182,184,194,196,200,202,214,226,230,232,236,242,244,254,260,266,272,274,280,284,286,296,310,314,316,320,334,340,350,352,356,362,370,376,382,386,392,400,404,412,422,424,434,436,442,446,452,460,464,466,470,482,490,494,502,506,512,524,526,544 seq $0,6005 ; The odd prime numbers together with 1. trn $0,2 add $0,5
; A156066: Numbers n with property that n^2 is a square arising in A154138. ; Submitted by Christian Krause ; 2,3,9,16,52,93,303,542,1766,3159,10293,18412,59992,107313,349659,625466,2037962,3645483,11878113,21247432,69230716,123839109,403506183,721787222,2351806382,4206884223,13707332109,24519518116,79892186272,142910224473,465645785523,832941828722,2713982526866,4854740747859,15818249375673,28295502658432,92195513727172,164918275202733,537354832987359,961214148557966,3131933484196982,5602366616145063,18254246072194533,32652985548312412,106393542948970216,190315546673729409,620107011621626763 mov $2,1 lpb $0 sub $0,1 add $1,1 mov $3,$0 add $3,$0 mod $3,4 mul $3,$2 add $1,$3 add $2,$1 lpe mov $0,$2 add $0,1
.global s_prepare_buffers s_prepare_buffers: push %r14 push %r15 push %r9 push %rbx push %rcx push %rdi push %rdx push %rsi lea addresses_WC_ht+0x3070, %r9 cmp $51939, %rbx mov (%r9), %r15d nop nop xor $44216, %rdx lea addresses_normal_ht+0xd45a, %r9 nop nop inc %r14 vmovups (%r9), %ymm6 vextracti128 $1, %ymm6, %xmm6 vpextrq $0, %xmm6, %rdi nop inc %r9 lea addresses_A_ht+0x81a, %rsi lea addresses_normal_ht+0x1a81a, %rdi nop nop and $43237, %rbx mov $93, %rcx rep movsw nop nop nop sub $16446, %rcx lea addresses_D_ht+0xbd1a, %r9 nop xor $38932, %r15 mov (%r9), %r14 nop nop nop nop nop inc %r14 lea addresses_normal_ht+0x1381a, %rdi nop sub $24287, %rbx mov $0x6162636465666768, %rdx movq %rdx, %xmm0 vmovups %ymm0, (%rdi) cmp %rdi, %rdi lea addresses_WC_ht+0x1600a, %rsi xor %rdx, %rdx movups (%rsi), %xmm7 vpextrq $1, %xmm7, %rdi nop nop nop nop nop xor $10428, %r14 lea addresses_A_ht+0x1bfcf, %rsi lea addresses_normal_ht+0x1001a, %rdi inc %r14 mov $87, %rcx rep movsw nop nop nop nop nop dec %rsi lea addresses_WT_ht+0x10282, %r14 dec %r9 vmovups (%r14), %ymm5 vextracti128 $0, %ymm5, %xmm5 vpextrq $0, %xmm5, %r15 nop sub $52812, %r9 pop %rsi pop %rdx pop %rdi pop %rcx pop %rbx pop %r9 pop %r15 pop %r14 ret .global s_faulty_load s_faulty_load: push %r11 push %r12 push %r14 push %r8 push %rbx push %rcx // Faulty Load lea addresses_UC+0xe01a, %r11 nop nop sub $34596, %rcx movups (%r11), %xmm7 vpextrq $0, %xmm7, %r14 lea oracles, %rbx and $0xff, %r14 shlq $12, %r14 mov (%rbx,%r14,1), %r14 pop %rcx pop %rbx pop %r8 pop %r14 pop %r12 pop %r11 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'size': 2, 'NT': False, 'type': 'addresses_UC', 'same': False, 'AVXalign': True, 'congruent': 0}} [Faulty Load] {'OP': 'LOAD', 'src': {'size': 16, 'NT': False, 'type': 'addresses_UC', 'same': True, 'AVXalign': False, 'congruent': 0}} <gen_prepare_buffer> {'OP': 'LOAD', 'src': {'size': 4, 'NT': False, 'type': 'addresses_WC_ht', 'same': False, 'AVXalign': False, 'congruent': 1}} {'OP': 'LOAD', 'src': {'size': 32, 'NT': False, 'type': 'addresses_normal_ht', 'same': False, 'AVXalign': False, 'congruent': 6}} {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_A_ht', 'congruent': 10}, 'dst': {'same': False, 'type': 'addresses_normal_ht', 'congruent': 9}} {'OP': 'LOAD', 'src': {'size': 8, 'NT': False, 'type': 'addresses_D_ht', 'same': False, 'AVXalign': False, 'congruent': 8}} {'OP': 'STOR', 'dst': {'size': 32, 'NT': False, 'type': 'addresses_normal_ht', 'same': False, 'AVXalign': False, 'congruent': 11}} {'OP': 'LOAD', 'src': {'size': 16, 'NT': False, 'type': 'addresses_WC_ht', 'same': False, 'AVXalign': False, 'congruent': 4}} {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_A_ht', 'congruent': 0}, 'dst': {'same': True, 'type': 'addresses_normal_ht', 'congruent': 9}} {'OP': 'LOAD', 'src': {'size': 32, 'NT': False, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': False, 'congruent': 3}} {'00': 21829} 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 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 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 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 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 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 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 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 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 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 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 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 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 */
; Listing generated by Microsoft (R) Optimizing Compiler Version 19.00.23506.0 TITLE D:\Projects\TaintAnalysis\AntiTaint\Epilog\src\func-alloca.c .686P .XMM include listing.inc .model flat INCLUDELIB MSVCRT INCLUDELIB OLDNAMES PUBLIC ___local_stdio_printf_options PUBLIC ___local_stdio_scanf_options PUBLIC __vfprintf_l PUBLIC _printf PUBLIC __vfscanf_l PUBLIC _scanf PUBLIC _func PUBLIC _main PUBLIC ??_C@_02DPKJAMEF@?$CFd?$AA@ ; `string' EXTRN __imp____acrt_iob_func:PROC EXTRN __imp____stdio_common_vfprintf:PROC EXTRN __imp____stdio_common_vfscanf:PROC EXTRN _gets:PROC EXTRN __alloca_probe_16:PROC _DATA SEGMENT COMM ?_OptionsStorage@?1??__local_stdio_printf_options@@9@9:QWORD ; `__local_stdio_printf_options'::`2'::_OptionsStorage COMM ?_OptionsStorage@?1??__local_stdio_scanf_options@@9@9:QWORD ; `__local_stdio_scanf_options'::`2'::_OptionsStorage _DATA ENDS ; COMDAT ??_C@_02DPKJAMEF@?$CFd?$AA@ CONST SEGMENT ??_C@_02DPKJAMEF@?$CFd?$AA@ DB '%d', 00H ; `string' CONST ENDS ; Function compile flags: /Ogtp ; File d:\projects\taintanalysis\antitaint\epilog\src\func-alloca.c ; COMDAT _main _TEXT SEGMENT _main PROC ; COMDAT ; 21 : func(); call _func ; 22 : return 0; xor eax, eax ; 23 : } ret 0 _main ENDP _TEXT ENDS ; Function compile flags: /Ogtp ; File d:\projects\taintanalysis\antitaint\epilog\src\func-alloca.c ; COMDAT _func _TEXT SEGMENT _sz$ = -4 ; size = 4 _func PROC ; COMDAT ; 10 : { push ebp mov ebp, esp push ecx push esi ; 11 : int sz; ; 12 : char *buf; ; 13 : scanf("%d", &sz); lea eax, DWORD PTR _sz$[ebp] push eax push OFFSET ??_C@_02DPKJAMEF@?$CFd?$AA@ call _scanf ; 14 : buf = (char*)alloca(sz); mov eax, DWORD PTR _sz$[ebp] add esp, 8 call __alloca_probe_16 mov esi, esp ; 15 : gets(buf); push esi call _gets ; 16 : printf(buf); push esi call _printf add esp, 8 ; 17 : } lea esp, DWORD PTR [ebp-8] pop esi mov esp, ebp pop ebp ret 0 _func ENDP _TEXT ENDS ; Function compile flags: /Ogtp ; File c:\program files (x86)\windows kits\10\include\10.0.10240.0\ucrt\stdio.h ; COMDAT _scanf _TEXT SEGMENT __Format$ = 8 ; size = 4 _scanf PROC ; COMDAT ; 1276 : { push ebp mov ebp, esp ; 1277 : int _Result; ; 1278 : va_list _ArgList; ; 1279 : __crt_va_start(_ArgList, _Format); ; 1280 : _Result = _vfscanf_l(stdin, _Format, NULL, _ArgList); lea eax, DWORD PTR __Format$[ebp+4] push eax push 0 push DWORD PTR __Format$[ebp] push 0 call DWORD PTR __imp____acrt_iob_func add esp, 4 push eax call __vfscanf_l add esp, 16 ; 00000010H ; 1281 : __crt_va_end(_ArgList); ; 1282 : return _Result; ; 1283 : } pop ebp ret 0 _scanf ENDP _TEXT ENDS ; Function compile flags: /Ogtp ; File c:\program files (x86)\windows kits\10\include\10.0.10240.0\ucrt\stdio.h ; COMDAT __vfscanf_l _TEXT SEGMENT __Stream$ = 8 ; size = 4 __Format$ = 12 ; size = 4 __Locale$ = 16 ; size = 4 __ArgList$ = 20 ; size = 4 __vfscanf_l PROC ; COMDAT ; 1058 : { push ebp mov ebp, esp ; 1059 : return __stdio_common_vfscanf( push DWORD PTR __ArgList$[ebp] push DWORD PTR __Locale$[ebp] push DWORD PTR __Format$[ebp] push DWORD PTR __Stream$[ebp] call ___local_stdio_scanf_options push DWORD PTR [eax+4] push DWORD PTR [eax] call DWORD PTR __imp____stdio_common_vfscanf add esp, 24 ; 00000018H ; 1060 : _CRT_INTERNAL_LOCAL_SCANF_OPTIONS, ; 1061 : _Stream, _Format, _Locale, _ArgList); ; 1062 : } pop ebp ret 0 __vfscanf_l ENDP _TEXT ENDS ; Function compile flags: /Ogtp ; File c:\program files (x86)\windows kits\10\include\10.0.10240.0\ucrt\stdio.h ; COMDAT _printf _TEXT SEGMENT __Format$ = 8 ; size = 4 _printf PROC ; COMDAT ; 950 : { push ebp mov ebp, esp ; 951 : int _Result; ; 952 : va_list _ArgList; ; 953 : __crt_va_start(_ArgList, _Format); ; 954 : _Result = _vfprintf_l(stdout, _Format, NULL, _ArgList); lea eax, DWORD PTR __Format$[ebp+4] push eax push 0 push DWORD PTR __Format$[ebp] push 1 call DWORD PTR __imp____acrt_iob_func add esp, 4 push eax call __vfprintf_l add esp, 16 ; 00000010H ; 955 : __crt_va_end(_ArgList); ; 956 : return _Result; ; 957 : } pop ebp ret 0 _printf ENDP _TEXT ENDS ; Function compile flags: /Ogtp ; File c:\program files (x86)\windows kits\10\include\10.0.10240.0\ucrt\stdio.h ; COMDAT __vfprintf_l _TEXT SEGMENT __Stream$ = 8 ; size = 4 __Format$ = 12 ; size = 4 __Locale$ = 16 ; size = 4 __ArgList$ = 20 ; size = 4 __vfprintf_l PROC ; COMDAT ; 638 : { push ebp mov ebp, esp ; 639 : return __stdio_common_vfprintf(_CRT_INTERNAL_LOCAL_PRINTF_OPTIONS, _Stream, _Format, _Locale, _ArgList); push DWORD PTR __ArgList$[ebp] push DWORD PTR __Locale$[ebp] push DWORD PTR __Format$[ebp] push DWORD PTR __Stream$[ebp] call ___local_stdio_printf_options push DWORD PTR [eax+4] push DWORD PTR [eax] call DWORD PTR __imp____stdio_common_vfprintf add esp, 24 ; 00000018H ; 640 : } pop ebp ret 0 __vfprintf_l ENDP _TEXT ENDS ; Function compile flags: /Ogtp ; File c:\program files (x86)\windows kits\10\include\10.0.10240.0\ucrt\corecrt_stdio_config.h ; COMDAT ___local_stdio_scanf_options _TEXT SEGMENT ___local_stdio_scanf_options PROC ; COMDAT ; 83 : static unsigned __int64 _OptionsStorage; ; 84 : return &_OptionsStorage; mov eax, OFFSET ?_OptionsStorage@?1??__local_stdio_scanf_options@@9@9 ; `__local_stdio_scanf_options'::`2'::_OptionsStorage ; 85 : } ret 0 ___local_stdio_scanf_options ENDP _TEXT ENDS ; Function compile flags: /Ogtp ; File c:\program files (x86)\windows kits\10\include\10.0.10240.0\ucrt\corecrt_stdio_config.h ; COMDAT ___local_stdio_printf_options _TEXT SEGMENT ___local_stdio_printf_options PROC ; COMDAT ; 74 : static unsigned __int64 _OptionsStorage; ; 75 : return &_OptionsStorage; mov eax, OFFSET ?_OptionsStorage@?1??__local_stdio_printf_options@@9@9 ; `__local_stdio_printf_options'::`2'::_OptionsStorage ; 76 : } ret 0 ___local_stdio_printf_options ENDP _TEXT ENDS END
// Copyright (c) 2018-2019 The PIVX developers // Copyright (c) 2019-2020 The TERRACREDIT developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "zcreditchain.h" #include "zcredit/zcreditmodule.h" #include "invalid.h" #include "main.h" #include "txdb.h" #include "guiinterface.h" // 6 comes from OPCODE (1) + vch.size() (1) + BIGNUM size (4) #define SCRIPT_OFFSET 6 // For Script size (BIGNUM/Uint256 size) #define BIGNUM_SIZE 4 bool BlockToMintValueVector(const CBlock& block, const libzerocoin::CoinDenomination denom, std::vector<CBigNum>& vValues) { for (const CTransaction& tx : block.vtx) { if(!tx.HasZerocoinMintOutputs()) continue; for (const CTxOut& txOut : tx.vout) { if(!txOut.IsZerocoinMint()) continue; CValidationState state; libzerocoin::PublicCoin coin(Params().Zerocoin_Params(false)); if(!TxOutToPublicCoin(txOut, coin, state)) return false; if (coin.getDenomination() != denom) continue; vValues.push_back(coin.getValue()); } } return true; } bool BlockToPubcoinList(const CBlock& block, std::list<libzerocoin::PublicCoin>& listPubcoins, bool fFilterInvalid) { for (const CTransaction& tx : block.vtx) { if(!tx.HasZerocoinMintOutputs()) continue; // Filter out mints that have used invalid outpoints if (fFilterInvalid) { bool fValid = true; for (const CTxIn& in : tx.vin) { if (!ValidOutPoint(in.prevout, INT_MAX)) { fValid = false; break; } } if (!fValid) continue; } uint256 txHash = tx.GetHash(); for (unsigned int i = 0; i < tx.vout.size(); i++) { //Filter out mints that use invalid outpoints - edge case: invalid spend with minted change if (fFilterInvalid && !ValidOutPoint(COutPoint(txHash, i), INT_MAX)) break; const CTxOut txOut = tx.vout[i]; if(!txOut.IsZerocoinMint()) continue; CValidationState state; libzerocoin::PublicCoin pubCoin(Params().Zerocoin_Params(false)); if(!TxOutToPublicCoin(txOut, pubCoin, state)) return false; listPubcoins.emplace_back(pubCoin); } } return true; } //return a list of zerocoin mints contained in a specific block bool BlockToZerocoinMintList(const CBlock& block, std::list<CZerocoinMint>& vMints, bool fFilterInvalid) { for (const CTransaction& tx : block.vtx) { if(!tx.HasZerocoinMintOutputs()) continue; // Filter out mints that have used invalid outpoints if (fFilterInvalid) { bool fValid = true; for (const CTxIn& in : tx.vin) { if (!ValidOutPoint(in.prevout, INT_MAX)) { fValid = false; break; } } if (!fValid) continue; } uint256 txHash = tx.GetHash(); for (unsigned int i = 0; i < tx.vout.size(); i++) { //Filter out mints that use invalid outpoints - edge case: invalid spend with minted change if (fFilterInvalid && !ValidOutPoint(COutPoint(txHash, i), INT_MAX)) break; const CTxOut txOut = tx.vout[i]; if(!txOut.IsZerocoinMint()) continue; CValidationState state; libzerocoin::PublicCoin pubCoin(Params().Zerocoin_Params(false)); if(!TxOutToPublicCoin(txOut, pubCoin, state)) return false; //version should not actually matter here since it is just a reference to the pubcoin, not to the privcoin uint8_t version = 1; CZerocoinMint mint = CZerocoinMint(pubCoin.getDenomination(), pubCoin.getValue(), 0, 0, false, version, nullptr); mint.SetTxHash(tx.GetHash()); vMints.push_back(mint); } } return true; } void FindMints(std::vector<CMintMeta> vMintsToFind, std::vector<CMintMeta>& vMintsToUpdate, std::vector<CMintMeta>& vMissingMints) { // see which mints are in our public zerocoin database. The mint should be here if it exists, unless // something went wrong for (CMintMeta meta : vMintsToFind) { uint256 txHash; if (!zerocoinDB->ReadCoinMint(meta.hashPubcoin, txHash)) { vMissingMints.push_back(meta); continue; } // make sure the txhash and block height meta data are correct for this mint CTransaction tx; uint256 hashBlock; if (!GetTransaction(txHash, tx, hashBlock, true)) { LogPrintf("%s : cannot find tx %s\n", __func__, txHash.GetHex()); vMissingMints.push_back(meta); continue; } if (!mapBlockIndex.count(hashBlock)) { LogPrintf("%s : cannot find block %s\n", __func__, hashBlock.GetHex()); vMissingMints.push_back(meta); continue; } //see if this mint is spent uint256 hashTxSpend = 0; bool fSpent = zerocoinDB->ReadCoinSpend(meta.hashSerial, hashTxSpend); //if marked as spent, check that it actually made it into the chain CTransaction txSpend; uint256 hashBlockSpend; if (fSpent && !GetTransaction(hashTxSpend, txSpend, hashBlockSpend, true)) { LogPrintf("%s : cannot find spend tx %s\n", __func__, hashTxSpend.GetHex()); meta.isUsed = false; vMintsToUpdate.push_back(meta); continue; } //The mint has been incorrectly labelled as spent in zerocoinDB and needs to be undone int nHeightTx = 0; uint256 hashSerial = meta.hashSerial; uint256 txidSpend; if (fSpent && !IsSerialInBlockchain(hashSerial, nHeightTx, txidSpend)) { LogPrintf("%s : cannot find block %s. Erasing coinspend from zerocoinDB.\n", __func__, hashBlockSpend.GetHex()); meta.isUsed = false; vMintsToUpdate.push_back(meta); continue; } // is the denomination correct? for (auto& out : tx.vout) { if (!out.IsZerocoinMint()) continue; libzerocoin::PublicCoin pubcoin(Params().Zerocoin_Params(meta.nVersion < libzerocoin::PrivateCoin::PUBKEY_VERSION)); CValidationState state; TxOutToPublicCoin(out, pubcoin, state); if (GetPubCoinHash(pubcoin.getValue()) == meta.hashPubcoin && pubcoin.getDenomination() != meta.denom) { LogPrintf("%s: found mismatched denom pubcoinhash = %s\n", __func__, meta.hashPubcoin.GetHex()); meta.denom = pubcoin.getDenomination(); vMintsToUpdate.emplace_back(meta); } } // if meta data is correct, then no need to update if (meta.txid == txHash && meta.nHeight == mapBlockIndex[hashBlock]->nHeight && meta.isUsed == fSpent) continue; //mark this mint for update meta.txid = txHash; meta.nHeight = mapBlockIndex[hashBlock]->nHeight; meta.isUsed = fSpent; LogPrintf("%s: found updates for pubcoinhash = %s\n", __func__, meta.hashPubcoin.GetHex()); vMintsToUpdate.push_back(meta); } } int GetZerocoinStartHeight() { return Params().Zerocoin_StartHeight(); } bool GetZerocoinMint(const CBigNum& bnPubcoin, uint256& txHash) { txHash = 0; return zerocoinDB->ReadCoinMint(bnPubcoin, txHash); } bool IsPubcoinInBlockchain(const uint256& hashPubcoin, uint256& txid) { txid = 0; return zerocoinDB->ReadCoinMint(hashPubcoin, txid); } bool IsSerialKnown(const CBigNum& bnSerial) { uint256 txHash = 0; return zerocoinDB->ReadCoinSpend(bnSerial, txHash); } bool IsSerialInBlockchain(const CBigNum& bnSerial, int& nHeightTx) { uint256 txHash = 0; // if not in zerocoinDB then its not in the blockchain if (!zerocoinDB->ReadCoinSpend(bnSerial, txHash)) return false; return IsTransactionInChain(txHash, nHeightTx); } bool IsSerialInBlockchain(const uint256& hashSerial, int& nHeightTx, uint256& txidSpend) { CTransaction tx; return IsSerialInBlockchain(hashSerial, nHeightTx, txidSpend, tx); } bool IsSerialInBlockchain(const uint256& hashSerial, int& nHeightTx, uint256& txidSpend, CTransaction& tx) { txidSpend = 0; // if not in zerocoinDB then its not in the blockchain if (!zerocoinDB->ReadCoinSpend(hashSerial, txidSpend)) return false; return IsTransactionInChain(txidSpend, nHeightTx, tx); } std::string ReindexZerocoinDB() { if (!zerocoinDB->WipeCoins("spends") || !zerocoinDB->WipeCoins("mints")) { return _("Failed to wipe zerocoinDB"); } uiInterface.ShowProgress(_("Reindexing zerocoin database..."), 0); CBlockIndex* pindex = chainActive[Params().Zerocoin_StartHeight()]; std::vector<std::pair<libzerocoin::CoinSpend, uint256> > vSpendInfo; std::vector<std::pair<libzerocoin::PublicCoin, uint256> > vMintInfo; while (pindex) { uiInterface.ShowProgress(_("Reindexing zerocoin database..."), std::max(1, std::min(99, (int)((double)(pindex->nHeight - Params().Zerocoin_StartHeight()) / (double)(chainActive.Height() - Params().Zerocoin_StartHeight()) * 100)))); if (pindex->nHeight % 1000 == 0) LogPrintf("Reindexing zerocoin : block %d...\n", pindex->nHeight); CBlock block; if (!ReadBlockFromDisk(block, pindex)) { return _("Reindexing zerocoin failed"); } for (const CTransaction& tx : block.vtx) { for (unsigned int i = 0; i < tx.vin.size(); i++) { if (tx.IsCoinBase()) break; if (tx.ContainsZerocoins()) { uint256 txid = tx.GetHash(); //Record Serials if (tx.HasZerocoinSpendInputs()) { for (auto& in : tx.vin) { bool isPublicSpend = in.IsZerocoinPublicSpend(); if (!in.IsZerocoinSpend() && !isPublicSpend) continue; if (isPublicSpend) { libzerocoin::ZerocoinParams* params = Params().Zerocoin_Params(false); PublicCoinSpend publicSpend(params); CValidationState state; if (!ZCREDITModule::ParseZerocoinPublicSpend(in, tx, state, publicSpend)){ return _("Failed to parse public spend"); } vSpendInfo.push_back(std::make_pair(publicSpend, txid)); } else { libzerocoin::CoinSpend spend = TxInToZerocoinSpend(in); vSpendInfo.push_back(std::make_pair(spend, txid)); } } } //Record mints if (tx.HasZerocoinMintOutputs()) { for (auto& out : tx.vout) { if (!out.IsZerocoinMint()) continue; CValidationState state; libzerocoin::PublicCoin coin(Params().Zerocoin_Params(pindex->nHeight < Params().Zerocoin_Block_V2_Start())); TxOutToPublicCoin(out, coin, state); vMintInfo.push_back(std::make_pair(coin, txid)); } } } } } // Flush the zerocoinDB to disk every 100 blocks if (pindex->nHeight % 100 == 0) { if ((!vSpendInfo.empty() && !zerocoinDB->WriteCoinSpendBatch(vSpendInfo)) || (!vMintInfo.empty() && !zerocoinDB->WriteCoinMintBatch(vMintInfo))) return _("Error writing zerocoinDB to disk"); vSpendInfo.clear(); vMintInfo.clear(); } pindex = chainActive.Next(pindex); } uiInterface.ShowProgress("", 100); // Final flush to disk in case any remaining information exists if ((!vSpendInfo.empty() && !zerocoinDB->WriteCoinSpendBatch(vSpendInfo)) || (!vMintInfo.empty() && !zerocoinDB->WriteCoinMintBatch(vMintInfo))) return _("Error writing zerocoinDB to disk"); uiInterface.ShowProgress("", 100); return ""; } bool RemoveSerialFromDB(const CBigNum& bnSerial) { return zerocoinDB->EraseCoinSpend(bnSerial); } libzerocoin::CoinSpend TxInToZerocoinSpend(const CTxIn& txin) { // extract the CoinSpend from the txin std::vector<char, zero_after_free_allocator<char> > dataTxIn; dataTxIn.insert(dataTxIn.end(), txin.scriptSig.begin() + BIGNUM_SIZE, txin.scriptSig.end()); CDataStream serializedCoinSpend(dataTxIn, SER_NETWORK, PROTOCOL_VERSION); libzerocoin::ZerocoinParams* paramsAccumulator = Params().Zerocoin_Params(chainActive.Height() < Params().Zerocoin_Block_V2_Start()); libzerocoin::CoinSpend spend(Params().Zerocoin_Params(true), paramsAccumulator, serializedCoinSpend); return spend; } bool TxOutToPublicCoin(const CTxOut& txout, libzerocoin::PublicCoin& pubCoin, CValidationState& state) { CBigNum publicZerocoin; std::vector<unsigned char> vchZeroMint; vchZeroMint.insert(vchZeroMint.end(), txout.scriptPubKey.begin() + SCRIPT_OFFSET, txout.scriptPubKey.begin() + txout.scriptPubKey.size()); publicZerocoin.setvch(vchZeroMint); libzerocoin::CoinDenomination denomination = libzerocoin::AmountToZerocoinDenomination(txout.nValue); LogPrint("zero", "%s ZCPRINT denomination %d pubcoin %s\n", __func__, denomination, publicZerocoin.GetHex()); if (denomination == libzerocoin::ZQ_ERROR) return state.DoS(100, error("TxOutToPublicCoin : txout.nValue is not correct")); libzerocoin::PublicCoin checkPubCoin(Params().Zerocoin_Params(false), publicZerocoin, denomination); pubCoin = checkPubCoin; return true; } //return a list of zerocoin spends contained in a specific block, list may have many denominations std::list<libzerocoin::CoinDenomination> ZerocoinSpendListFromBlock(const CBlock& block, bool fFilterInvalid) { std::list<libzerocoin::CoinDenomination> vSpends; for (const CTransaction& tx : block.vtx) { if (!tx.HasZerocoinSpendInputs()) continue; for (const CTxIn& txin : tx.vin) { bool isPublicSpend = txin.IsZerocoinPublicSpend(); if (!txin.IsZerocoinSpend() && !isPublicSpend) continue; if (fFilterInvalid && !isPublicSpend) { libzerocoin::CoinSpend spend = TxInToZerocoinSpend(txin); if (invalid_out::ContainsSerial(spend.getCoinSerialNumber())) continue; } libzerocoin::CoinDenomination c = libzerocoin::IntToZerocoinDenomination(txin.nSequence); vSpends.push_back(c); } } return vSpends; }
// Copyright (c) 2014 GitHub, Inc. // Use of this source code is governed by the MIT license that can be // found in the LICENSE file. #include "shell/browser/ui/views/menu_bar.h" #include <memory> #include <set> #include <sstream> #include "shell/browser/ui/views/submenu_button.h" #include "shell/common/keyboard_util.h" #include "ui/aura/window.h" #include "ui/base/models/menu_model.h" #include "ui/native_theme/common_theme.h" #include "ui/views/background.h" #include "ui/views/layout/box_layout.h" #include "ui/views/widget/widget.h" #if defined(USE_X11) #include "chrome/browser/ui/libgtkui/gtk_util.h" #endif #if defined(OS_WIN) #include "ui/gfx/color_utils.h" #endif namespace electron { namespace { // Default color of the menu bar. const SkColor kDefaultColor = SkColorSetARGB(255, 233, 233, 233); } // namespace const char MenuBar::kViewClassName[] = "ElectronMenuBar"; MenuBarColorUpdater::MenuBarColorUpdater(MenuBar* menu_bar) : menu_bar_(menu_bar) {} MenuBarColorUpdater::~MenuBarColorUpdater() {} void MenuBarColorUpdater::OnDidChangeFocus(views::View* focused_before, views::View* focused_now) { if (menu_bar_) { // if we've changed window focus, update menu bar colors const auto had_focus = menu_bar_->has_focus_; menu_bar_->has_focus_ = focused_now != nullptr; if (menu_bar_->has_focus_ != had_focus) menu_bar_->UpdateViewColors(); } } MenuBar::MenuBar(RootView* window) : background_color_(kDefaultColor), window_(window), color_updater_(new MenuBarColorUpdater(this)) { RefreshColorCache(); UpdateViewColors(); SetFocusBehavior(FocusBehavior::ALWAYS); SetLayoutManager(std::make_unique<views::BoxLayout>( views::BoxLayout::Orientation::kHorizontal)); window_->GetFocusManager()->AddFocusChangeListener(color_updater_.get()); } MenuBar::~MenuBar() { window_->GetFocusManager()->RemoveFocusChangeListener(color_updater_.get()); } void MenuBar::SetMenu(AtomMenuModel* model) { menu_model_ = model; RebuildChildren(); } void MenuBar::SetAcceleratorVisibility(bool visible) { for (auto* child : GetChildrenInZOrder()) static_cast<SubmenuButton*>(child)->SetAcceleratorVisibility(visible); } MenuBar::View* MenuBar::FindAccelChild(base::char16 key) { for (auto* child : GetChildrenInZOrder()) { if (static_cast<SubmenuButton*>(child)->accelerator() == key) return child; } return nullptr; } bool MenuBar::HasAccelerator(base::char16 key) { return FindAccelChild(key) != nullptr; } void MenuBar::ActivateAccelerator(base::char16 key) { auto* child = FindAccelChild(key); if (child) static_cast<SubmenuButton*>(child)->Activate(nullptr); } int MenuBar::GetItemCount() const { return menu_model_ ? menu_model_->GetItemCount() : 0; } bool MenuBar::GetMenuButtonFromScreenPoint(const gfx::Point& screenPoint, AtomMenuModel** menu_model, views::MenuButton** button) { if (!GetBoundsInScreen().Contains(screenPoint)) return false; auto children = GetChildrenInZOrder(); for (int i = 0, n = children.size(); i < n; ++i) { if (children[i]->GetBoundsInScreen().Contains(screenPoint) && (menu_model_->GetTypeAt(i) == AtomMenuModel::TYPE_SUBMENU)) { *menu_model = menu_model_->GetSubmenuModelAt(i); *button = static_cast<views::MenuButton*>(children[i]); return true; } } return false; } void MenuBar::OnBeforeExecuteCommand() { if (GetPaneFocusTraversable() != nullptr) { RemovePaneFocus(); } window_->RestoreFocus(); } void MenuBar::OnMenuClosed() { SetAcceleratorVisibility(true); } bool MenuBar::AcceleratorPressed(const ui::Accelerator& accelerator) { views::View* focused_view = GetFocusManager()->GetFocusedView(); if (!ContainsForFocusSearch(this, focused_view)) return false; switch (accelerator.key_code()) { case ui::VKEY_MENU: case ui::VKEY_ESCAPE: { RemovePaneFocus(); window_->RestoreFocus(); return true; } case ui::VKEY_LEFT: GetFocusManager()->AdvanceFocus(true); return true; case ui::VKEY_RIGHT: GetFocusManager()->AdvanceFocus(false); return true; case ui::VKEY_HOME: GetFocusManager()->SetFocusedViewWithReason( GetFirstFocusableChild(), views::FocusManager::FocusChangeReason::kFocusTraversal); return true; case ui::VKEY_END: GetFocusManager()->SetFocusedViewWithReason( GetLastFocusableChild(), views::FocusManager::FocusChangeReason::kFocusTraversal); return true; default: { for (auto* child : GetChildrenInZOrder()) { auto* button = static_cast<SubmenuButton*>(child); bool shifted = false; auto keycode = electron::KeyboardCodeFromCharCode(button->accelerator(), &shifted); if (keycode == accelerator.key_code()) { const gfx::Point p(0, 0); auto event = accelerator.ToKeyEvent(); OnMenuButtonClicked(button, p, &event); return true; } } return false; } } } bool MenuBar::SetPaneFocus(views::View* initial_focus) { // TODO(zcbenz): Submit patch to upstream Chromium to fix the crash. // // Without this check, Electron would crash when running tests. // // Check failed: rules_->CanFocusWindow(window, nullptr). // logging::LogMessage::~LogMessage // wm::FocusController::SetFocusedWindow // wm::FocusController::ResetFocusWithinActiveWindow // views::View::OnFocus // views::Button::OnFocus // views::LabelButton::OnFocus // views::View::Focus // views::FocusManager::SetFocusedViewWithReason // views::AccessiblePaneView::SetPaneFocus // electron::MenuBar::SetPaneFocus if (initial_focus && initial_focus->GetWidget()) { aura::Window* window = initial_focus->GetWidget()->GetNativeWindow(); if (!window || !window->GetRootWindow()) return false; } bool result = views::AccessiblePaneView::SetPaneFocus(initial_focus); if (result) { std::set<ui::KeyboardCode> reg; for (auto* child : GetChildrenInZOrder()) { auto* button = static_cast<SubmenuButton*>(child); bool shifted = false; auto keycode = electron::KeyboardCodeFromCharCode(button->accelerator(), &shifted); // We want the menu items to activate if the user presses the accelerator // key, even without alt, since we are now focused on the menu bar if (keycode != ui::VKEY_UNKNOWN && reg.find(keycode) != reg.end()) { reg.insert(keycode); focus_manager()->RegisterAccelerator( ui::Accelerator(keycode, ui::EF_NONE), ui::AcceleratorManager::kNormalPriority, this); } } // We want to remove focus / hide menu bar when alt is pressed again focus_manager()->RegisterAccelerator( ui::Accelerator(ui::VKEY_MENU, ui::EF_ALT_DOWN), ui::AcceleratorManager::kNormalPriority, this); } return result; } void MenuBar::RemovePaneFocus() { views::AccessiblePaneView::RemovePaneFocus(); SetAcceleratorVisibility(false); std::set<ui::KeyboardCode> unreg; for (auto* child : GetChildrenInZOrder()) { auto* button = static_cast<SubmenuButton*>(child); bool shifted = false; auto keycode = electron::KeyboardCodeFromCharCode(button->accelerator(), &shifted); if (keycode != ui::VKEY_UNKNOWN && unreg.find(keycode) != unreg.end()) { unreg.insert(keycode); focus_manager()->UnregisterAccelerator( ui::Accelerator(keycode, ui::EF_NONE), this); } } focus_manager()->UnregisterAccelerator( ui::Accelerator(ui::VKEY_MENU, ui::EF_ALT_DOWN), this); } const char* MenuBar::GetClassName() const { return kViewClassName; } void MenuBar::OnMenuButtonClicked(views::Button* source, const gfx::Point& point, const ui::Event* event) { // Hide the accelerator when a submenu is activated. SetAcceleratorVisibility(false); if (!menu_model_) return; if (!window_->HasFocus()) window_->RequestFocus(); int id = source->tag(); AtomMenuModel::ItemType type = menu_model_->GetTypeAt(id); if (type != AtomMenuModel::TYPE_SUBMENU) { menu_model_->ActivatedAt(id, 0); return; } // Deleted in MenuDelegate::OnMenuClosed MenuDelegate* menu_delegate = new MenuDelegate(this); menu_delegate->RunMenu(menu_model_->GetSubmenuModelAt(id), source, event != nullptr && event->IsKeyEvent() ? ui::MENU_SOURCE_KEYBOARD : ui::MENU_SOURCE_MOUSE); menu_delegate->AddObserver(this); } void MenuBar::RefreshColorCache() { const ui::NativeTheme* theme = GetNativeTheme(); if (theme) { #if defined(USE_X11) background_color_ = libgtkui::GetBgColor("GtkMenuBar#menubar"); enabled_color_ = libgtkui::GetFgColor( "GtkMenuBar#menubar GtkMenuItem#menuitem GtkLabel"); disabled_color_ = libgtkui::GetFgColor( "GtkMenuBar#menubar GtkMenuItem#menuitem:disabled GtkLabel"); #else background_color_ = ui::GetAuraColor(ui::NativeTheme::kColorId_MenuBackgroundColor, theme); #endif } } void MenuBar::OnThemeChanged() { RefreshColorCache(); UpdateViewColors(); } void MenuBar::RebuildChildren() { RemoveAllChildViews(true); for (int i = 0, n = GetItemCount(); i < n; ++i) { auto* button = new SubmenuButton(menu_model_->GetLabelAt(i), this, background_color_); button->set_tag(i); AddChildView(button); } UpdateViewColors(); } void MenuBar::UpdateViewColors() { // set menubar background color SetBackground(views::CreateSolidBackground(background_color_)); // set child colors if (menu_model_ == nullptr) return; #if defined(USE_X11) const auto& textColor = has_focus_ ? enabled_color_ : disabled_color_; for (auto* child : GetChildrenInZOrder()) { auto* button = static_cast<SubmenuButton*>(child); button->SetTextColor(views::Button::STATE_NORMAL, textColor); button->SetTextColor(views::Button::STATE_DISABLED, disabled_color_); button->SetTextColor(views::Button::STATE_PRESSED, enabled_color_); button->SetTextColor(views::Button::STATE_HOVERED, textColor); button->SetUnderlineColor(textColor); } #elif defined(OS_WIN) for (auto* child : GetChildrenInZOrder()) { auto* button = static_cast<SubmenuButton*>(child); button->SetUnderlineColor(color_utils::GetSysSkColor(COLOR_MENUTEXT)); } #endif } } // namespace electron
; ; $Id: tuc24_ref.asm,v 1.8 2012/03/02 14:34:03 yaronm Exp $ ; ; This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file. ; ; Copyright 2007-2020 Broadcom Inc. All rights reserved. ; ; ; This is the default program for the 5650 reference board (BCM95650R24) ; ; To start it, use the following commands from BCM: ; ; 0:led load tuc24_ref.hex ; *:led start ; ; ; The BCM5650 reference board has 12 columns of 4 LEDs each, as shown below: ; ; L02 L04 L06 L08 L10 L12 L14 L16 L18 L20 L22 L24 ; A02 A04 A06 A08 A10 A12 A14 A16 A18 A20 A22 A24 ; L01 L03 L05 L07 L09 L11 L13 L15 L17 L19 L21 L23 ; A01 A03 A05 A07 A09 A11 A13 A15 A17 A19 A21 A23 ; ; For the FE ports, there are two bits per LED with the following colors: ; ZERO, ZERO Black ; ZERO, ONE Amber ; ONE, ZERO Green ; ; Also, there are 4 LEDs for the GE ports, as shown below: ; LG2 AG2 LG4 AG4 ; LG1 AG1 LG3 AG3 ; ; For the GE ports, there is one bit per LED with the following colors: ; ZERO Green ; ONE Black ; ; The bits are shifted out in the following order: ; A02, L02, A01, L01,..., A24, L24, A23, L23, LG1, AG1, ..., LG4, AG4 ; ; Current implementation: ; ; L01 reflects port 1 link status ; A01 reflects port 1 activity ; ; Link up/down info cannot be derived from LINKEN or LINKUP, as the LED ; processor does not actually have access to link status. This program ; assumes link status is kept current in bit 0 of RAM byte (0x80 + portnum). ; Generally, a program running on the main CPU must update these ; locations on link change; see linkscan callback in ; $SDK/src/appl/diag/ledproc.c. ; ; Current implementation: ; ; L01 reflects port 1 link status: ; Black: no link ; Amber: 10 Mb/s ; Green: 100 Mb/s ; Alternating green/amber: 1000 Mb/s ; Very brief flashes of black at 1 Hz: half duplex ; Longer periods of black: collisions in progress ; ; A01 reflects port 1 activity (even if port is down) ; Black: idle ; Green: RX (pulse extended to 1/3 sec) ; Amber: TX (pulse extended to 1/3 sec, takes precedence over RX) ; Green/Amber alternating at 6 Hz: both RX and TX ; ; ; Due to the different treatment and output ordering of the two types of ; ports, there are a number of complex transformations performed on the ; data. In addition, the limited program space of the LED processor ; necessitates some optimizations for code length that make the following ; assembly somewhat unclear. Comments have been added to clarify some of ; steps below. ; MIN_FE_PORT EQU 0 MAX_FE_PORT EQU 23 NUM_FE_PORT EQU 24 MIN_GE_PORT EQU 24 MAX_GE_PORT EQU 27 NUM_GE_PORT EQU 4 MIN_PORT EQU 0 MAX_PORT EQU 27 NUM_PORT EQU 28 PACK_SRC EQU 0 PACK_DST EQU 128 PACK_BITS EQU ((NUM_FE_PORT*4) + (NUM_GE_PORT*2)) PACK_FE_NUM EQU (NUM_FE_PORT/2) PACK_NUM EQU (PACK_BITS/8) ; Instead of an enumeration, these values are the concatenation of the ; ONE/ZERO definitions at the bottom of the file. This allows the ; "uncache" routine below to be more efficient. CACHE_BLACK EQU 0xff CACHE_AMBER EQU 0xfe CACHE_GREEN EQU 0xef TICKS EQU 1 SECOND_TICKS EQU (30*TICKS) ; The TX/RX activity lights will be extended for ACT_EXT_TICKS ; so they will be more visible. ACT_EXT_TICKS EQU (SECOND_TICKS/3) HD_OFF_TICKS EQU (SECOND_TICKS/20) HD_ON_TICKS EQU (SECOND_TICKS-HD_ON_TICKS) TXRX_ALT_TICKS EQU (SECOND_TICKS/6) ; ; Main Update Routine ; ; This routine is called once per tick. ; update: sub a,a ; ld a,MIN_FE_PORT (but only one instr) up1: port a ld (PORT_NUM),a cmp a,MIN_GE_PORT jc up_fe call link_status_ge ; First LED for this port call activity_ge ; Second LED for this port jmp next_port up_fe: call activity ; Lower LED for this port call link_status ; Upper LED for this port ; Copy from cache to pack location ld a,(ACT_CACHE) call uncache ld a,(LINK_CACHE) call uncache next_port: ld a,(PORT_NUM) inc a cmp a,NUM_PORT jnz up1 ; Update various timers ld b,HD_COUNT inc (b) ld a,(b) cmp a,HD_ON_TICKS+HD_OFF_TICKS jc up3 ld (b),0 up3: ld b,TXRX_ALT_COUNT inc (b) ld a,(b) cmp a,TXRX_ALT_TICKS jc up4 ld (b),0 up4: ; ; This bit is a workaround for a bug in the 5665 LED processor. ; ; The pack instruction should put the data into data mem at 0x80. ; However, the internal register to store this address is only 7 bits. ; So the data is packed starting at address 0. ; This leads to two caveats: ; ; 1) Port 0 data _MUST_ be consumed before the first pack instruction. ; ; 2) The output data must be moved from location 0 to location 128. ; ; sub b,b ; ld b,PACK_SRC (but only one instr) packflip: ld a,(b) ror a ror a ror a ror a and a,0xf ld (PACKFLIP_CACHE),a ld a,(b) rol a rol a rol a rol a and a,0xf0 or a,(PACKFLIP_CACHE) ld (b),a inc b cmp b,PACK_FE_NUM jnz packflip sub b,b ; ld b,PACK_SRC (but only one instr) ld a,PACK_DST packmove: ld (a),(b) inc a inc b cmp b,PACK_NUM jnz packmove send PACK_BITS ; ; activity ; ; This routine calculates the activity LED for the current port. ; It extends the activity lights using timers (new activity overrides ; and resets the timers). ; ; Inputs: (PORT_NUM) ; Outputs: Two bits sent to LED stream ; activity: pushst RX pop jnc act1 ld b,RX_TIMERS ; Start RX LED extension timer add b,(PORT_NUM) ld a,ACT_EXT_TICKS ld (b),a act1: pushst TX pop jnc act2 ld b,TX_TIMERS ; Start TX LED extension timer add b,(PORT_NUM) ld a,ACT_EXT_TICKS ld (b),a act2: ld b,TX_TIMERS ; Check TX LED extension timer add b,(PORT_NUM) dec (b) jnc act3 ; TX active? inc (b) ld b,RX_TIMERS ; Check RX LED extension timer add b,(PORT_NUM) dec (b) ; Extend LED green if only RX active ld a,ACT_CACHE jnc led_green inc (b) jmp led_black ; No activity act3: ; TX is active, see if RX also active ld b,RX_TIMERS add b,(PORT_NUM) dec (b) ; RX also active? jnc act4 inc (b) ld a,ACT_CACHE jmp led_amber ; Only TX active act4: ; Both TX and RX active ld b,(TXRX_ALT_COUNT) cmp b,TXRX_ALT_TICKS/2 ld a,ACT_CACHE jc led_amber ; Fast alternation of green/amber jmp led_green ; ; link_status ; ; This routine calculates the link status LED for the current port. ; ; Inputs: (PORT_NUM) ; Outputs: Two bits sent to LED stream ; Destroys: a, b ; link_status: pushst DUPLEX ; Skip blink code if full duplex pop jc ls1 ld a,(HD_COUNT) ; Provide blink for half duplex cmp a,HD_OFF_TICKS ld a,LINK_CACHE ; Cache address for led setting jc led_black ls1: ld a,(PORT_NUM) ; Check for link down call get_link ld a,LINK_CACHE ; Cache address for led setting jnc led_black pushst COLL ; Check for collision pop jc led_black pushst SPEED_C ; Check for 100Mb speed pop jc led_green pushst SPEED_M ; Check for 10Mb (i.e. not 100 or 1000) pop jnc led_amber ; ; get_link ; ; This routine finds the link status LED for a port. ; Link info is in bit 0 of the byte read from PORTDATA[port] ; ; Inputs: Port number in a ; Outputs: Carry flag set if link is up, clear if link is down. ; Destroys: a, b ; get_link: ld b,PORTDATA add b,a ld b,(b) tst b,0 ret ; ; led_black, led_amber, led_green ; ; Inputs: Cache address in a ; Outputs: byte encoding two bits for color ; Destroys: None ; led_black: ld (a),CACHE_BLACK ret led_amber: ld (a),CACHE_AMBER ret led_green: ld (a),CACHE_GREEN ret ; uncache ; ; Inputs: LED bit pair byte-encoded in a ; Outputs: Two bits to the LED stream indicating color ; Destroys: None ; uncache: pushst a pack ror a ror a ror a ror a pushst a pack ret ; GE routines ; ; Inputs: LED bit pair in a ; Outputs: Two bits to the LED stream indicating color ; Destroys: None ; ; It is now safe to pack here, since the GE ports are beyond the pack area. activity_ge: ld a,ZERO ; On (ZERO) pushst RX pop jc act_led_set pushst TX pop jc act_led_set inc a ; On (ZERO) -> Off (ONE) act_led_set: pushst a pack ret link_status_ge: ld a,(PORT_NUM) ; Check for link down ld b,PORTDATA add b,a ld b,(b) tst b,0 ld a,ONE ; Off (ONE) jnc ls_led_clear dec a ; Off (ONE) -> On (ZERO) ls_led_clear: pushst a pack ret ; Variables (SDK software initializes LED memory from 0x80-0xff to 0) ; TXRX_ALT_COUNT equ 0xff HD_COUNT equ 0xfe PORT_NUM equ 0xfc LINK_CACHE equ 0xfb ACT_CACHE equ 0xfa PACKFLIP_CACHE equ 0xf9 ; ; Port data, which must be updated continually by main CPU's ; linkscan task. See $SDK/src/appl/diag/ledproc.c for examples. ; In this program, bit 0 is assumed to contain the link up/down status. ; PORTDATA equ 0xa0 ; Size 28 bytes ; ; LED extension timers ; RX_TIMERS equ 0xc0+0 ; NUM_PORT bytes TX_TIMERS equ 0xc0+NUM_PORT ; NUM_PORT bytes ; ; Symbolic names for the bits of the port status fields ; RX equ 0x0 ; received packet TX equ 0x1 ; transmitted packet COLL equ 0x2 ; collision indicator SPEED_C equ 0x3 ; 100 Mbps SPEED_M equ 0x4 ; 1000 Mbps DUPLEX equ 0x5 ; half/full duplex FLOW equ 0x6 ; flow control capable LINKUP equ 0x7 ; link down/up status LINKEN equ 0x8 ; link disabled/enabled status ZERO equ 0xE ; always 0 ONE equ 0xF ; always 1
; A246306: Numbers k such that cos(k) > cos(k+1) < cos(k+2) < cos(k+3) > cos(k+4). ; 0,6,13,19,25,32,38,44,50,57,63,69,76,82,88,94,101,107,113,120,126,132,138,145,151,157,164,170,176,182,189,195,201,207,214,220,226,233,239,245,251,258,264,270,277,283,289,295,302,308,314,321,327,333,339,346,352,358,365,371,377,383,390,396,402,409,415,421,427,434,440,446,453,459,465,471,478,484,490,497,503,509,515,522,528,534,540,547,553,559,566,572,578,584,591,597,603,610,616,622,628,635,641,647,654,660,666,672,679,685,691,698,704,710,716,723,729,735,742,748,754,760,767,773,779,786,792,798,804,811,817,823,830,836,842,848,855,861,867,874,880,886,892,899,905,911,917,924,930,936,943,949,955,961,968,974,980,987,993,999,1005,1012,1018,1024,1031,1037,1043,1049,1056,1062,1068,1075,1081,1087,1093,1100,1106,1112,1119,1125,1131,1137,1144,1150,1156,1163,1169,1175,1181,1188,1194,1200,1207,1213,1219,1225,1232,1238,1244,1250,1257,1263,1269,1276,1282,1288,1294,1301,1307,1313,1320,1326,1332,1338,1345,1351,1357,1364,1370,1376,1382,1389,1395,1401,1408,1414,1420,1426,1433,1439,1445,1452,1458,1464,1470,1477,1483,1489,1496,1502,1508,1514,1521,1527,1533,1540,1546,1552,1558,1565 add $0,367 cal $0,246394 ; Nonnegative integers k satisfying cos(k) <= 0 and cos(k+1) >= 0. mov $1,$0 sub $1,2310
/* //@HEADER // ************************************************************************ // // KokkosKernels 0.9: Linear Algebra and Graph Kernels // Copyright 2017 Sandia Corporation // // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, // the U.S. Government retains certain rights in this software. // // 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, 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 the Corporation nor the names of the // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "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 SANDIA CORPORATION OR THE // 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. // // Questions? Contact Siva Rajamanickam (srajama@sandia.gov) // // ************************************************************************ //@HEADER */ #define KOKKOSKERNELS_IMPL_COMPILE_LIBRARY true #include "KokkosKernels_config.h" #if defined (KOKKOSKERNELS_INST_KOKKOS_COMPLEX_DOUBLE_) \ && defined (KOKKOSKERNELS_INST_LAYOUTLEFT) \ && defined (KOKKOSKERNELS_INST_EXECSPACE_CUDA) \ && defined (KOKKOSKERNELS_INST_MEMSPACE_CUDASPACE) \ && defined (KOKKOSKERNELS_INST_ORDINAL_INT64_T) \ && defined (KOKKOSKERNELS_INST_OFFSET_SIZE_T) #include "KokkosSparse_spmv_struct_spec.hpp" namespace KokkosSparse { namespace Impl { KOKKOSSPARSE_SPMV_STRUCT_ETI_SPEC_INST(Kokkos::complex<double>, int64_t, size_t, Kokkos::LayoutLeft, Kokkos::Cuda, Kokkos::CudaSpace) } // Impl } // KokkosSparse #endif
// Licensed to the Apache Software Foundation (ASF) under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you 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 "agent/cgroups_mgr.h" #include <asm/unistd.h> #include <linux/magic.h> #include <sys/stat.h> #include <sys/sysmacros.h> #include <sys/vfs.h> #include <unistd.h> #include <fstream> #include <future> #include <map> #include <sstream> #include "common/logging.h" #include "olap/data_dir.h" #include "olap/storage_engine.h" #include "runtime/exec_env.h" #include "runtime/load_path_mgr.h" using std::string; using std::map; using std::vector; using std::stringstream; using apache::thrift::TException; using apache::thrift::transport::TTransportException; namespace doris { static CgroupsMgr* s_global_cg_mgr; const std::string CgroupsMgr::_s_system_user = "system"; const std::string CgroupsMgr::_s_system_group = "normal"; std::map<TResourceType::type, std::string> CgroupsMgr::_s_resource_cgroups = { {TResourceType::type::TRESOURCE_CPU_SHARE, "cpu.shares"}, {TResourceType::type::TRESOURCE_IO_SHARE, "blkio.weight"}}; CgroupsMgr::CgroupsMgr(ExecEnv* exec_env, const string& root_cgroups_path) : _exec_env(exec_env), _root_cgroups_path(root_cgroups_path), _is_cgroups_init_success(false), _cur_version(-1) { if (s_global_cg_mgr == nullptr) { s_global_cg_mgr = this; } } CgroupsMgr::~CgroupsMgr() {} AgentStatus CgroupsMgr::update_local_cgroups(const TFetchResourceResult& new_fetched_resource) { std::lock_guard<std::mutex> lck(_update_cgroups_mtx); if (!_is_cgroups_init_success) { return AgentStatus::DORIS_ERROR; } if (_cur_version >= new_fetched_resource.resourceVersion) { return AgentStatus::DORIS_SUCCESS; } const std::map<std::string, TUserResource>& new_user_resource = new_fetched_resource.resourceByUser; if (!_local_users.empty()) { std::set<std::string>::const_iterator old_it = _local_users.begin(); for (; old_it != _local_users.end(); ++old_it) { if (new_user_resource.count(*old_it) == 0) { this->delete_user_cgroups(*old_it); } } } // Clear local users set, because it will be inserted again _local_users.clear(); std::map<std::string, TUserResource>::const_iterator new_it = new_user_resource.begin(); for (; new_it != new_user_resource.end(); ++new_it) { const string& user_name = new_it->first; const std::map<std::string, int32_t>& level_share = new_it->second.shareByGroup; std::map<std::string, int32_t> user_share; const std::map<TResourceType::type, int32_t>& resource_share = new_it->second.resource.resourceByType; std::map<TResourceType::type, int32_t>::const_iterator resource_it = resource_share.begin(); for (; resource_it != resource_share.end(); ++resource_it) { if (_s_resource_cgroups.count(resource_it->first) > 0) { user_share[_s_resource_cgroups[resource_it->first]] = resource_it->second; } } modify_user_cgroups(user_name, user_share, level_share); _config_user_disk_throttle(user_name, resource_share); // Insert user to local user's set _local_users.insert(user_name); } // Using resource version, not subscribe version _cur_version = new_fetched_resource.resourceVersion; return AgentStatus::DORIS_SUCCESS; } void CgroupsMgr::_config_user_disk_throttle( std::string user_name, const std::map<TResourceType::type, int32_t>& resource_share) { int64_t hdd_read_iops = _get_resource_value(TResourceType::type::TRESOURCE_HDD_READ_IOPS, resource_share); int64_t hdd_write_iops = _get_resource_value(TResourceType::type::TRESOURCE_HDD_WRITE_IOPS, resource_share); int64_t hdd_read_mbps = _get_resource_value(TResourceType::type::TRESOURCE_HDD_READ_MBPS, resource_share); int64_t hdd_write_mbps = _get_resource_value(TResourceType::type::TRESOURCE_HDD_WRITE_MBPS, resource_share); int64_t ssd_read_iops = _get_resource_value(TResourceType::type::TRESOURCE_SSD_READ_IOPS, resource_share); int64_t ssd_write_iops = _get_resource_value(TResourceType::type::TRESOURCE_SSD_WRITE_IOPS, resource_share); int64_t ssd_read_mbps = _get_resource_value(TResourceType::type::TRESOURCE_SSD_READ_MBPS, resource_share); int64_t ssd_write_mbps = _get_resource_value(TResourceType::type::TRESOURCE_SSD_WRITE_MBPS, resource_share); _config_disk_throttle(user_name, "", hdd_read_iops, hdd_write_iops, hdd_read_mbps, hdd_write_mbps, ssd_read_iops, ssd_write_iops, ssd_read_mbps, ssd_write_mbps); _config_disk_throttle(user_name, "low", hdd_read_iops, hdd_write_iops, hdd_read_mbps, hdd_write_mbps, ssd_read_iops, ssd_write_iops, ssd_read_mbps, ssd_write_mbps); _config_disk_throttle(user_name, "normal", hdd_read_iops, hdd_write_iops, hdd_read_mbps, hdd_write_mbps, ssd_read_iops, ssd_write_iops, ssd_read_mbps, ssd_write_mbps); _config_disk_throttle(user_name, "high", hdd_read_iops, hdd_write_iops, hdd_read_mbps, hdd_write_mbps, ssd_read_iops, ssd_write_iops, ssd_read_mbps, ssd_write_mbps); } int64_t CgroupsMgr::_get_resource_value( const TResourceType::type resource_type, const std::map<TResourceType::type, int32_t>& resource_share) { int64_t resource_value = -1; std::map<TResourceType::type, int32_t>::const_iterator it = resource_share.find(resource_type); if (it != resource_share.end()) { resource_value = it->second; } return resource_value; } AgentStatus CgroupsMgr::_config_disk_throttle(std::string user_name, std::string level, int64_t hdd_read_iops, int64_t hdd_write_iops, int64_t hdd_read_mbps, int64_t hdd_write_mbps, int64_t ssd_read_iops, int64_t ssd_write_iops, int64_t ssd_read_mbps, int64_t ssd_write_mbps) { string cgroups_path = this->_root_cgroups_path + "/" + user_name + "/" + level; string read_bps_path = cgroups_path + "/blkio.throttle.read_bps_device"; string write_bps_path = cgroups_path + "/blkio.throttle.write_bps_device"; string read_iops_path = cgroups_path + "/blkio.throttle.read_iops_device"; string write_iops_path = cgroups_path + "/blkio.throttle.write_iops_device"; if (!is_file_exist(cgroups_path.c_str())) { if (!std::filesystem::create_directory(cgroups_path)) { LOG(ERROR) << "Create cgroups: " << cgroups_path << " failed"; return AgentStatus::DORIS_ERROR; } } // add olap engine data path here auto stores = StorageEngine::instance()->get_stores(); // buld load data path, it is alreay in data path // _exec_env->load_path_mgr()->get_load_data_path(&data_paths); std::stringstream ctrl_cmd; for (auto store : stores) { // check disk type int64_t read_iops = hdd_read_iops; int64_t write_iops = hdd_write_iops; int64_t read_mbps = hdd_read_mbps; int64_t write_mbps = hdd_write_mbps; // if user set hdd not ssd, then use hdd for ssd if (store->is_ssd_disk()) { read_iops = ssd_read_iops == -1 ? hdd_read_iops : ssd_read_iops; write_iops = ssd_write_iops == -1 ? hdd_write_iops : ssd_write_iops; read_mbps = ssd_read_mbps == -1 ? hdd_read_mbps : ssd_read_mbps; write_mbps = ssd_write_mbps == -1 ? hdd_write_mbps : ssd_write_mbps; } struct stat file_stat; if (stat(store->path().c_str(), &file_stat) != 0) { continue; } int major_number = major(file_stat.st_dev); int minor_number = minor(file_stat.st_dev); minor_number = (minor_number / 16) * 16; if (read_iops != -1) { ctrl_cmd << major_number << ":" << minor_number << " " << read_iops; _echo_cmd_to_cgroup(ctrl_cmd, read_iops_path); ctrl_cmd.clear(); ctrl_cmd.str(std::string()); } if (write_iops != -1) { ctrl_cmd << major_number << ":" << minor_number << " " << write_iops; _echo_cmd_to_cgroup(ctrl_cmd, write_iops_path); ctrl_cmd.clear(); ctrl_cmd.str(std::string()); } if (read_mbps != -1) { ctrl_cmd << major_number << ":" << minor_number << " " << (read_mbps << 20); _echo_cmd_to_cgroup(ctrl_cmd, read_bps_path); ctrl_cmd.clear(); ctrl_cmd.str(std::string()); } if (write_mbps != -1) { ctrl_cmd << major_number << ":" << minor_number << " " << (write_mbps << 20); _echo_cmd_to_cgroup(ctrl_cmd, write_bps_path); ctrl_cmd.clear(); ctrl_cmd.str(std::string()); } } return AgentStatus::DORIS_SUCCESS; } AgentStatus CgroupsMgr::modify_user_cgroups(const string& user_name, const map<string, int32_t>& user_share, const map<string, int32_t>& level_share) { // Check if the user's cgroups exists, if not create it string user_cgroups_path = this->_root_cgroups_path + "/" + user_name; if (!is_file_exist(user_cgroups_path.c_str())) { if (!std::filesystem::create_directory(user_cgroups_path)) { LOG(ERROR) << "Create cgroups for user " << user_name << " failed"; return AgentStatus::DORIS_ERROR; } } // Traverse the user resource share map to append share value to cgroup's file for (map<string, int32_t>::const_iterator user_resource = user_share.begin(); user_resource != user_share.end(); ++user_resource) { string resource_file_name = user_resource->first; int32_t user_share_weight = user_resource->second; // Append the share_weight value to the file string user_resource_path = user_cgroups_path + "/" + resource_file_name; std::ofstream user_cgroups(user_resource_path.c_str(), std::ios::out | std::ios::app); if (!user_cgroups.is_open()) { return AgentStatus::DORIS_ERROR; } user_cgroups << user_share_weight << std::endl; user_cgroups.close(); LOG(INFO) << "Append " << user_share_weight << " to " << user_resource_path; for (map<string, int32_t>::const_iterator level_resource = level_share.begin(); level_resource != level_share.end(); ++level_resource) { // Append resource share to level shares string level_name = level_resource->first; int32_t level_share_weight = level_resource->second; // Check if the level cgroups exist string level_cgroups_path = user_cgroups_path + "/" + level_name; if (!is_file_exist(level_cgroups_path.c_str())) { if (!std::filesystem::create_directory(level_cgroups_path)) { return AgentStatus::DORIS_ERROR; } } // Append the share_weight value to the file string level_resource_path = level_cgroups_path + "/" + resource_file_name; std::ofstream level_cgroups(level_resource_path.c_str(), std::ios::out | std::ios::app); if (!level_cgroups.is_open()) { return AgentStatus::DORIS_ERROR; } level_cgroups << level_share_weight << std::endl; level_cgroups.close(); LOG(INFO) << "Append " << level_share_weight << " to " << level_resource_path; } } return AgentStatus::DORIS_SUCCESS; } AgentStatus CgroupsMgr::init_cgroups() { std::string root_cgroups_tasks_path = this->_root_cgroups_path + "/tasks"; // Check if the root cgroups exists if (is_directory(this->_root_cgroups_path.c_str()) && is_file_exist(root_cgroups_tasks_path.c_str())) { // Check the folder's virtual filesystem to find whether it is a cgroup file system #ifndef BE_TEST struct statfs fs_type; statfs(root_cgroups_tasks_path.c_str(), &fs_type); if (fs_type.f_type != CGROUP_SUPER_MAGIC) { LOG(ERROR) << _root_cgroups_path << " is not a cgroups file system."; _is_cgroups_init_success = false; return AgentStatus::DORIS_ERROR; } #endif // Check if current user have write permission to cgroup folder if (access(_root_cgroups_path.c_str(), W_OK) != 0) { LOG(ERROR) << "Doris does not have write permission to " << _root_cgroups_path; _is_cgroups_init_success = false; return AgentStatus::DORIS_ERROR; } // If root folder exists, then delete all subfolders under it std::filesystem::directory_iterator item_begin(this->_root_cgroups_path); std::filesystem::directory_iterator item_end; for (; item_begin != item_end; item_begin++) { if (is_directory(item_begin->path().string().c_str())) { // Delete the sub folder if (delete_user_cgroups(item_begin->path().filename().string()) != AgentStatus::DORIS_SUCCESS) { LOG(ERROR) << "Could not clean subfolder " << item_begin->path().string(); _is_cgroups_init_success = false; return AgentStatus::DORIS_ERROR; } } } LOG(INFO) << "Initialize doris cgroups successfully under folder " << _root_cgroups_path; _is_cgroups_init_success = true; return AgentStatus::DORIS_SUCCESS; } else { VLOG_NOTICE << "Could not find a valid cgroups path for resource isolation," << "current value is " << _root_cgroups_path << ". ignore it."; _is_cgroups_init_success = false; return AgentStatus::DORIS_ERROR; } } #define gettid() syscall(__NR_gettid) void CgroupsMgr::apply_cgroup(const string& user_name, const string& level) { if (s_global_cg_mgr == nullptr) { return; } s_global_cg_mgr->assign_to_cgroups(user_name, level); } AgentStatus CgroupsMgr::assign_to_cgroups(const string& user_name, const string& level) { if (!_is_cgroups_init_success) { return AgentStatus::DORIS_ERROR; } int64_t tid = gettid(); return assign_thread_to_cgroups(tid, user_name, level); } AgentStatus CgroupsMgr::assign_thread_to_cgroups(int64_t thread_id, const string& user_name, const string& level) { if (!_is_cgroups_init_success) { return AgentStatus::DORIS_ERROR; } string tasks_path = _root_cgroups_path + "/" + user_name + "/" + level + "/tasks"; if (!is_file_exist(_root_cgroups_path + "/" + user_name)) { tasks_path = this->_root_cgroups_path + "/" + _default_user_name + "/" + _default_level + "/tasks"; } else if (!is_file_exist(_root_cgroups_path + "/" + user_name + "/" + level)) { tasks_path = this->_root_cgroups_path + "/" + user_name + "/tasks"; } if (!is_file_exist(tasks_path.c_str())) { LOG(ERROR) << "Cgroups path " << tasks_path << " not exist!"; return AgentStatus::DORIS_ERROR; } std::ofstream tasks(tasks_path.c_str(), std::ios::out | std::ios::app); if (!tasks.is_open()) { // This means doris could not open this file. May be it does not have access to it LOG(ERROR) << "Echo thread: " << thread_id << " to " << tasks_path << " failed!"; return AgentStatus::DORIS_ERROR; } // Append thread id to the tasks file directly tasks << thread_id << std::endl; tasks.close(); return AgentStatus::DORIS_SUCCESS; } AgentStatus CgroupsMgr::delete_user_cgroups(const string& user_name) { string user_cgroups_path = this->_root_cgroups_path + "/" + user_name; if (is_file_exist(user_cgroups_path.c_str())) { // Delete sub cgroups --> level cgroups std::filesystem::directory_iterator item_begin(user_cgroups_path); std::filesystem::directory_iterator item_end; for (; item_begin != item_end; item_begin++) { if (is_directory(item_begin->path().string().c_str())) { string cur_cgroups_path = item_begin->path().string(); if (this->drop_cgroups(cur_cgroups_path) < 0) { return AgentStatus::DORIS_ERROR; } } } // Delete user cgroups if (this->drop_cgroups(user_cgroups_path) < 0) { return AgentStatus::DORIS_ERROR; } } return AgentStatus::DORIS_SUCCESS; } AgentStatus CgroupsMgr::drop_cgroups(const string& deleted_cgroups_path) { // Try to delete the cgroups folder // If failed then there maybe exist active tasks under it and try to relocate them // Currently, try 10 times to relocate and delete the cgroups. int32_t i = 0; while (is_file_exist(deleted_cgroups_path) && rmdir(deleted_cgroups_path.c_str()) < 0 && i < this->_drop_retry_times) { this->relocate_tasks(deleted_cgroups_path, this->_root_cgroups_path); ++i; #ifdef BE_TEST std::filesystem::remove_all(deleted_cgroups_path); #endif if (i == this->_drop_retry_times) { LOG(ERROR) << "drop cgroups under path: " << deleted_cgroups_path << " failed."; return AgentStatus::DORIS_ERROR; } } return AgentStatus::DORIS_SUCCESS; } AgentStatus CgroupsMgr::relocate_tasks(const string& src_cgroups, const string& dest_cgroups) { string src_tasks_path = src_cgroups + "/tasks"; string dest_tasks_path = dest_cgroups + "/tasks"; std::ifstream src_tasks(src_tasks_path.c_str()); if (!src_tasks) { return AgentStatus::DORIS_ERROR; } std::ofstream dest_tasks(dest_tasks_path.c_str(), std::ios::out | std::ios::app); if (!dest_tasks) { return AgentStatus::DORIS_ERROR; } int64_t taskid; while (src_tasks >> taskid) { dest_tasks << taskid << std::endl; // If the thread id or process id not exists, then error occurs in the stream. // Clear the error state for every append. dest_tasks.clear(); } src_tasks.close(); dest_tasks.close(); return AgentStatus::DORIS_SUCCESS; } void CgroupsMgr::_echo_cmd_to_cgroup(stringstream& ctrl_cmd, string& cgroups_path) { std::ofstream cgroups_stream(cgroups_path.c_str(), std::ios::out | std::ios::app); if (cgroups_stream.is_open()) { cgroups_stream << ctrl_cmd.str() << std::endl; cgroups_stream.close(); } } bool CgroupsMgr::is_directory(const char* file_path) { struct stat file_stat; if (stat(file_path, &file_stat) != 0) { return false; } if (S_ISDIR(file_stat.st_mode)) { return true; } else { return false; } } bool CgroupsMgr::is_file_exist(const char* file_path) { struct stat file_stat; if (stat(file_path, &file_stat) != 0) { return false; } return true; } bool CgroupsMgr::is_file_exist(const std::string& file_path) { return is_file_exist(file_path.c_str()); } } // namespace doris
/* * MIT License * * Parametric Cubic Spline Library * Copyright (c) 2021-, Michael Heidingsfeld * * 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 "gtest/gtest.h" int main(int argc, char **argv) { ::testing::InitGoogleTest(&argc, argv); int ret = RUN_ALL_TESTS(); return ret; }
; A142014: Primes congruent to 10 mod 31. ; Submitted by Christian Krause ; 41,103,227,599,661,971,1033,1777,1901,2087,2273,2459,2521,2707,3079,3203,3389,3637,3761,3823,3947,4133,4567,4691,4877,5683,5807,5869,6427,6551,6737,7109,7481,7853,8039,8101,8287,8597,8783,8969,9341,9403,10271,10333,10457,10891,11821,12007,12379,12503,12689,13309,13619,13681,14177,14549,14797,14983,15107,15541,15727,15913,16223,16657,16843,17029,17401,17959,18269,18517,19013,19447,19571,19819,20129,20563,20749,20873,21059,21121,21493,21617,21803,22051,23167,23291,23539,23663,23911,24097,24407 mov $1,4 mov $2,$0 pow $2,2 lpb $2 add $1,36 mov $3,$1 seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0. sub $0,$3 add $1,26 mov $4,$0 max $4,0 cmp $4,$0 mul $2,$4 sub $2,1 lpe mov $0,$1 add $0,37
; =============================================================== ; Jun 2007 ; =============================================================== ; ; uint zx_saddr2cx(void *saddr) ; ; Character x coordinate corresponding to screen address. ; ; =============================================================== SECTION code_clib SECTION code_arch PUBLIC asm_zx_saddr2cx asm_zx_saddr2cx: ld a,l and $1f ld l,a ld h,0 ret
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Copyright (c) Berkeley Softworks 1993 -- All Rights Reserved PROJECT: PC GEOS MODULE: PostScript driver FILE: adobeLJ2cartfTC1Info.asm AUTHOR: Dave Durran 13 April 1993 REVISION HISTORY: Name Date Description ---- ---- ----------- dave 4/13/93 Initial revision parsed from pscriptalj2.asm DESCRIPTION: This file contains the device information for the PostScript printer: Adobe LaserJet II Cartridge Other Printers Supported by this resource: $Id: adobeLJ2cartfTC1Info.asm,v 1.1 97/04/18 11:56:11 newdeal Exp $ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ;---------------------------------------------------------------------------- ; Adobe LaserJet 2 Cartridge with Extra Font Cart 1 ;---------------------------------------------------------------------------- adobeLJ2fTC1Info segment resource ; info blocks PrinterInfo < ; ---- PrinterType ------------- < PT_RASTER, BMF_MONO>, ; ---- PrinterConnections ------ < IC_NO_IEEE488, CC_NO_CUSTOM, SC_NO_SCSI, RC_RS232C, CC_CENTRONICS, FC_FILE, AC_APPLETALK >, ; ---- PrinterSmarts ----------- PS_PDL, ;-------Custom Entry Routine------- NULL, ;-------Custom Exit Routine------- NULL, ; ---- Mode Info Offsets ------- NULL, NULL, offset adobeLJ2fTC1hiRes, ; PM_GRAPHICS_HI_RES NULL, NULL, ; ---- Font Geometry ----------- NULL, ; ---- Symbol Set list ----------- NULL, ; ---- PaperMargins ------------ < PR_MARGIN_LEFT, ; Tractor Margins PR_MARGIN_TRACTOR, PR_MARGIN_RIGHT, PR_MARGIN_TRACTOR >, < PR_MARGIN_LEFT, ; ASF Margins PR_MARGIN_TOP, PR_MARGIN_RIGHT, PR_MARGIN_BOTTOM >, ; ---- PaperInputOptions ------- < MF_MANUAL1, TF_NO_TRACTOR, ASF_TRAY1 >, ; ---- PaperOutputOptions ------ < OC_COPIES, PS_NORMAL, OD_SIMPLEX, SO_NO_STAPLER, OS_NO_SORTER, OB_NO_OUTPUTBIN >, ; 612, ; paper width (points). NULL, ; Main UI NoSettingsDialogBox, ; Options UI offset PrintEvalDummyASF ; UI eval Routine > ;---------------------------------------------------------------------------- ; Graphics modes info ;---------------------------------------------------------------------------- adobeLJ2fTC1hiRes GraphicsProperties < 300, ; xres 300, ; yres 1, ; band height 1, ; bytes/column. 1, ; interleaves BMF_MONO, ; color format NULL > ; color correction ;---------------------------------------------------------------------------- ; PostScript Info ;---------------------------------------------------------------------------- ; This structure holds PostScript-specific info about the printer. It ; *must* be placed directly after the hires GraphicProperties struct PSInfoStruct < PSFL_ADOBE_TC1, ; PSFontList 0x0001, ; PSLevel flags ALJ2C1_PROLOG_LEN, ; prolog length offset adobeLJ2fTC1Prolog ; ptr to prolog > ; (see pscriptConstant.def) ; this sets up a transfer function that is described in Computer ; Graphics and Applications, May 1991 issue, Jim Blinn's column. ; Basically, it corrects for the perceived darkening of greys when ; printing. The hardcoded values are empirical values arrived at ; through experimentation (see the article for details). adobeLJ2fTC1Prolog label byte char "GWDict begin", NL char "/SDC { 85 35 currentscreen 3 1 roll pop pop setscreen", NL char "{dup dup 0.3681 mul -1.145 add mul 1.7769 add mul}", NL char "currenttransfer CP settransfer} bdef", NL char "end", NL adobeLJ2fTC1EndProlog label byte ALJ2C1_PROLOG_LEN equ offset adobeLJ2fTC1EndProlog - offset adobeLJ2fTC1Prolog adobeLJ2fTC1Info ends
/* * Copyright (c) 2018 Andrew Kelley * * This file is part of zig, which is MIT licensed. * See http://opensource.org/licenses/MIT */ #ifndef ZIG_COMPILER_HPP #define ZIG_COMPILER_HPP #include "buffer.hpp" #include "error.hpp" Buf *get_stage1_cache_path(); Error get_compiler_id(Buf **result); Buf *get_zig_lib_dir(); Buf *get_zig_special_dir(); Buf *get_zig_std_dir(); #endif
; A157855: 103680000n^2 - 46108800n + 5126401. ; 62697601,327628801,799920001,1479571201,2366582401,3460953601,4762684801,6271776001,7988227201,9912038401,12043209601,14381740801,16927632001,19680883201,22641494401,25809465601,29184796801,32767488001,36557539201,40554950401,44759721601,49171852801,53791344001,58618195201,63652406401,68893977601,74342908801,79999200001,85862851201,91933862401,98212233601,104697964801,111391056001,118291507201,125399318401,132714489601,140237020801,147966912001,155904163201,164048774401,172400745601,180960076801,189726768001,198700819201,207882230401,217271001601,226867132801,236670624001,246681475201,256899686401,267325257601,277958188801,288798480001,299846131201,311101142401,322563513601,334233244801,346110336001,358194787201,370486598401,382985769601,395692300801,408606192001,421727443201,435056054401,448592025601,462335356801,476286048001,490444099201,504809510401,519382281601,534162412801,549149904001,564344755201,579746966401,595356537601,611173468801,627197760001,643429411201,659868422401,676514793601,693368524801,710429616001,727698067201,745173878401,762857049601,780747580801,798845472001,817150723201,835663334401,854383305601,873310636801,892445328001,911787379201,931336790401,951093561601,971057692801,991229184001,1011608035201,1032194246401 seq $0,157853 ; 3600n^2 - 1601n + 178. sub $0,2177 mul $0,28800 add $0,62697601
/**************************************************************************** Copyright (c) 2013 Zynga Inc. Copyright (c) 2013-2014 Chukong Technologies Inc. http://www.cocos2d-x.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 "CCFontAtlas.h" #include "CCFontFreeType.h" #include "ccUTF8.h" #include "CCDirector.h" #include "CCEventListenerCustom.h" #include "CCEventDispatcher.h" #include "CCEventType.h" NS_CC_BEGIN const int FontAtlas::CacheTextureWidth = 1024; const int FontAtlas::CacheTextureHeight = 1024; const char* FontAtlas::EVENT_PURGE_TEXTURES = "__cc_FontAtlasPurgeTextures"; FontAtlas::FontAtlas(Font &theFont) : _font(&theFont) , _currentPageData(nullptr) , _fontAscender(0) , _toForegroundListener(nullptr) , _toBackgroundListener(nullptr) , _antialiasEnabled(true) { _font->retain(); FontFreeType* fontTTf = dynamic_cast<FontFreeType*>(_font); if (fontTTf) { _commonLineHeight = _font->getFontMaxHeight(); _fontAscender = fontTTf->getFontAscender(); auto texture = new Texture2D; _currentPage = 0; _currentPageOrigX = 0; _currentPageOrigY = 0; _letterPadding = 0; if(fontTTf->isDistanceFieldEnabled()) { _letterPadding += 2 * FontFreeType::DistanceMapSpread; } _currentPageDataSize = CacheTextureWidth * CacheTextureHeight; if(fontTTf->getOutlineSize() > 0) { _currentPageDataSize *= 2; } _currentPageData = new unsigned char[_currentPageDataSize]; memset(_currentPageData, 0, _currentPageDataSize); auto pixelFormat = fontTTf->getOutlineSize() > 0 ? Texture2D::PixelFormat::AI88 : Texture2D::PixelFormat::A8; texture->initWithData(_currentPageData, _currentPageDataSize, pixelFormat, CacheTextureWidth, CacheTextureHeight, Size(CacheTextureWidth,CacheTextureHeight) ); addTexture(texture,0); texture->release(); #if CC_ENABLE_CACHE_TEXTURE_DATA auto eventDispatcher = Director::getInstance()->getEventDispatcher(); _toBackgroundListener = EventListenerCustom::create(EVENT_COME_TO_BACKGROUND, CC_CALLBACK_1(FontAtlas::listenToBackground, this)); eventDispatcher->addEventListenerWithFixedPriority(_toBackgroundListener, 1); _toForegroundListener = EventListenerCustom::create(EVENT_COME_TO_FOREGROUND, CC_CALLBACK_1(FontAtlas::listenToForeground, this)); eventDispatcher->addEventListenerWithFixedPriority(_toForegroundListener, 1); #endif } } FontAtlas::~FontAtlas() { #if CC_ENABLE_CACHE_TEXTURE_DATA FontFreeType* fontTTf = dynamic_cast<FontFreeType*>(_font); if (fontTTf) { auto eventDispatcher = Director::getInstance()->getEventDispatcher(); if (_toForegroundListener) { eventDispatcher->removeEventListener(_toForegroundListener); _toForegroundListener = nullptr; } if (_toBackgroundListener) { eventDispatcher->removeEventListener(_toBackgroundListener); _toBackgroundListener = nullptr; } } #endif _font->release(); relaseTextures(); delete []_currentPageData; } void FontAtlas::relaseTextures() { for( auto &item: _atlasTextures) { item.second->release(); } _atlasTextures.clear(); } void FontAtlas::purgeTexturesAtlas() { FontFreeType* fontTTf = dynamic_cast<FontFreeType*>(_font); if (fontTTf && _atlasTextures.size() > 1) { for( auto &item: _atlasTextures) { if (item.first != 0) { item.second->release(); } } auto temp = _atlasTextures[0]; _atlasTextures.clear(); _atlasTextures[0] = temp; _fontLetterDefinitions.clear(); memset(_currentPageData,0,_currentPageDataSize); _currentPage = 0; _currentPageOrigX = 0; _currentPageOrigY = 0; auto eventDispatcher = Director::getInstance()->getEventDispatcher(); eventDispatcher->dispatchCustomEvent(EVENT_PURGE_TEXTURES,this); } } void FontAtlas::listenToBackground(EventCustom *event) { #if CC_ENABLE_CACHE_TEXTURE_DATA FontFreeType* fontTTf = dynamic_cast<FontFreeType*>(_font); if (fontTTf && _atlasTextures.size() > 1) { for( auto &item: _atlasTextures) { if (item.first != 0) { item.second->release(); } } auto temp = _atlasTextures[0]; _atlasTextures.clear(); _atlasTextures[0] = temp; _fontLetterDefinitions.clear(); memset(_currentPageData,0,_currentPageDataSize); _currentPage = 0; _currentPageOrigX = 0; _currentPageOrigY = 0; } #endif } void FontAtlas::listenToForeground(EventCustom *event) { #if CC_ENABLE_CACHE_TEXTURE_DATA FontFreeType* fontTTf = dynamic_cast<FontFreeType*>(_font); if (fontTTf) { if (_currentPageOrigX == 0 && _currentPageOrigY == 0) { auto eventDispatcher = Director::getInstance()->getEventDispatcher(); eventDispatcher->dispatchCustomEvent(EVENT_PURGE_TEXTURES,this); } else { auto pixelFormat = fontTTf->getOutlineSize() > 0 ? Texture2D::PixelFormat::AI88 : Texture2D::PixelFormat::A8; _atlasTextures[_currentPage]->initWithData(_currentPageData, _currentPageDataSize, pixelFormat, CacheTextureWidth, CacheTextureHeight, Size(CacheTextureWidth,CacheTextureHeight) ); } } #endif } void FontAtlas::addLetterDefinition(const FontLetterDefinition &letterDefinition) { _fontLetterDefinitions[letterDefinition.letteCharUTF16] = letterDefinition; } bool FontAtlas::getLetterDefinitionForChar(unsigned short letteCharUTF16, FontLetterDefinition &outDefinition) { auto outIterator = _fontLetterDefinitions.find(letteCharUTF16); if (outIterator != _fontLetterDefinitions.end()) { outDefinition = (*outIterator).second; return true; } else { outDefinition.validDefinition = false; return false; } } bool FontAtlas::prepareLetterDefinitions(unsigned short *utf16String) { FontFreeType* fontTTf = dynamic_cast<FontFreeType*>(_font); if(fontTTf == nullptr) return false; int length = cc_wcslen(utf16String); float offsetAdjust = _letterPadding / 2; long bitmapWidth; long bitmapHeight; Rect tempRect; FontLetterDefinition tempDef; auto scaleFactor = CC_CONTENT_SCALE_FACTOR(); auto pixelFormat = fontTTf->getOutlineSize() > 0 ? Texture2D::PixelFormat::AI88 : Texture2D::PixelFormat::A8; bool existNewLetter = false; int bottomHeight = _commonLineHeight - _fontAscender; float startY = _currentPageOrigY; for (int i = 0; i < length; ++i) { auto outIterator = _fontLetterDefinitions.find(utf16String[i]); if (outIterator == _fontLetterDefinitions.end()) { existNewLetter = true; auto bitmap = fontTTf->getGlyphBitmap(utf16String[i],bitmapWidth,bitmapHeight,tempRect,tempDef.xAdvance); if (bitmap) { tempDef.validDefinition = true; tempDef.letteCharUTF16 = utf16String[i]; tempDef.width = tempRect.size.width + _letterPadding; tempDef.height = tempRect.size.height + _letterPadding; tempDef.offsetX = tempRect.origin.x + offsetAdjust; tempDef.offsetY = _fontAscender + tempRect.origin.y - offsetAdjust; tempDef.clipBottom = bottomHeight - (tempDef.height + tempRect.origin.y + offsetAdjust); if (_currentPageOrigX + tempDef.width > CacheTextureWidth) { _currentPageOrigY += _commonLineHeight; _currentPageOrigX = 0; if(_currentPageOrigY + _commonLineHeight >= CacheTextureHeight) { auto data = _currentPageData + CacheTextureWidth * (int)startY; _atlasTextures[_currentPage]->updateWithData(data, 0, startY, CacheTextureWidth, CacheTextureHeight - startY); startY = 0.0f; _currentPageOrigY = 0; memset(_currentPageData, 0, _currentPageDataSize); _currentPage++; auto tex = new Texture2D; if (_antialiasEnabled) { tex->setAntiAliasTexParameters(); } else { tex->setAliasTexParameters(); } tex->initWithData(_currentPageData, _currentPageDataSize, pixelFormat, CacheTextureWidth, CacheTextureHeight, Size(CacheTextureWidth,CacheTextureHeight) ); addTexture(tex,_currentPage); tex->release(); } } fontTTf->renderCharAt(_currentPageData,_currentPageOrigX,_currentPageOrigY,bitmap,bitmapWidth,bitmapHeight); tempDef.U = _currentPageOrigX; tempDef.V = _currentPageOrigY; tempDef.textureID = _currentPage; _currentPageOrigX += tempDef.width + 1; // take from pixels to points tempDef.width = tempDef.width / scaleFactor; tempDef.height = tempDef.height / scaleFactor; tempDef.U = tempDef.U / scaleFactor; tempDef.V = tempDef.V / scaleFactor; } else{ if(tempDef.xAdvance) tempDef.validDefinition = true; else tempDef.validDefinition = false; tempDef.letteCharUTF16 = utf16String[i]; tempDef.width = 0; tempDef.height = 0; tempDef.U = 0; tempDef.V = 0; tempDef.offsetX = 0; tempDef.offsetY = 0; tempDef.textureID = 0; tempDef.clipBottom = 0; _currentPageOrigX += 1; } _fontLetterDefinitions[tempDef.letteCharUTF16] = tempDef; } } if(existNewLetter) { auto data = _currentPageData + CacheTextureWidth * (int)startY; _atlasTextures[_currentPage]->updateWithData(data, 0, startY, CacheTextureWidth, _currentPageOrigY - startY + _commonLineHeight); } return true; } void FontAtlas::addTexture(Texture2D *texture, int slot) { texture->retain(); _atlasTextures[slot] = texture; } Texture2D* FontAtlas::getTexture(int slot) { return _atlasTextures[slot]; } float FontAtlas::getCommonLineHeight() const { return _commonLineHeight; } void FontAtlas::setCommonLineHeight(float newHeight) { _commonLineHeight = newHeight; } const Font * FontAtlas::getFont() const { return _font; } void FontAtlas::setAliasTexParameters() { if (_antialiasEnabled) { _antialiasEnabled = false; for (const auto & tex : _atlasTextures) { tex.second->setAliasTexParameters(); } } } void FontAtlas::setAntiAliasTexParameters() { if (! _antialiasEnabled) { _antialiasEnabled = true; for (const auto & tex : _atlasTextures) { tex.second->setAntiAliasTexParameters(); } } } NS_CC_END
// @file keypattern.cpp /** * Copyright (C) 2012 10gen Inc. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License, version 3, * as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * * As a special exception, the copyright holders give permission to link the * code of portions of this program with the OpenSSL library under certain * conditions as described in each individual source file and distribute * linked combinations including the program with the OpenSSL library. You * must comply with the GNU Affero General Public License in all respects for * all of the code used other than as permitted herein. If you modify file(s) * with this exception, you may extend this exception to your version of the * file(s), but you are not obligated to do so. If you do not wish to do so, * delete this exception statement from your version. If you delete this * exception statement from all source files in the program, then also delete * it in the license file. */ #include "mongo/db/keypattern.h" #include "mongo/db/index_names.h" namespace mongo { KeyPattern::KeyPattern(const BSONObj& pattern) : _pattern(pattern) {} bool KeyPattern::isIdKeyPattern(const BSONObj& pattern) { BSONObjIterator i(pattern); BSONElement e = i.next(); // _id index must have form exactly {_id : 1} or {_id : -1}. // Allows an index of form {_id : "hashed"} to exist but // do not consider it to be the primary _id index return (0 == strcmp(e.fieldName(), "_id")) && (e.numberInt() == 1 || e.numberInt() == -1) && i.next().eoo(); } bool KeyPattern::isOrderedKeyPattern(const BSONObj& pattern) { return IndexNames::BTREE == IndexNames::findPluginName(pattern); } bool KeyPattern::isHashedKeyPattern(const BSONObj& pattern) { return IndexNames::HASHED == IndexNames::findPluginName(pattern); } StringBuilder& operator<<(StringBuilder& sb, const KeyPattern& keyPattern) { // Rather than return BSONObj::toString() we construct a keyPattern string manually. This allows // us to avoid the cost of writing numeric direction to the str::stream which will then undergo // expensive number to string conversion. sb << "{ "; bool first = true; for (auto&& elem : keyPattern._pattern) { if (first) { first = false; } else { sb << ", "; } if (mongo::String == elem.type()) { sb << elem; } else if (elem.number() >= 0) { // The canonical check as to whether a key pattern element is "ascending" or // "descending" is (elem.number() >= 0). This is defined by the Ordering class. sb << elem.fieldNameStringData() << ": 1"; } else { sb << elem.fieldNameStringData() << ": -1"; } } sb << " }"; return sb; } BSONObj KeyPattern::extendRangeBound(const BSONObj& bound, bool makeUpperInclusive) const { BSONObjBuilder newBound(bound.objsize()); BSONObjIterator src(bound); BSONObjIterator pat(_pattern); while (src.more()) { massert(16649, str::stream() << "keyPattern " << _pattern << " shorter than bound " << bound, pat.more()); BSONElement srcElt = src.next(); BSONElement patElt = pat.next(); massert(16634, str::stream() << "field names of bound " << bound << " do not match those of keyPattern " << _pattern, str::equals(srcElt.fieldName(), patElt.fieldName())); newBound.append(srcElt); } while (pat.more()) { BSONElement patElt = pat.next(); // for non 1/-1 field values, like {a : "hashed"}, treat order as ascending int order = patElt.isNumber() ? patElt.numberInt() : 1; // flip the order semantics if this is an upper bound if (makeUpperInclusive) order *= -1; if (order > 0) { newBound.appendMinKey(patElt.fieldName()); } else { newBound.appendMaxKey(patElt.fieldName()); } } return newBound.obj(); } BSONObj KeyPattern::globalMin() const { return extendRangeBound(BSONObj(), false); } BSONObj KeyPattern::globalMax() const { return extendRangeBound(BSONObj(), true); } } // namespace mongo
; Aufgabe Nr.: Speichermodul fuer uP- Praktikum II ; Autor: Joerg Vollandt ; erstellt am : 21.05.1994 ; letzte Aenderung am : 01.08.1994 ; Bemerkung : Makros ; ; Dateiname : makro1.asm ; ;--------------------------------------------------------------------- ; Funktion : Direkter Bitmove- Befehl ; Aufrufparameter : - ; Ruechgabeparameter : - ; Veraenderte Register : PSW ; Stackbedarf : ; Zeitbedarf : ; MOVB MACRO ZIEL,QUELLE MOV C,QUELLE MOV ZIEL,C ENDM ;--------------------------------------------------------------------- ; Funktion : String auf LCD ausgaben. ; Aufrufparameter : - ; Ruechgabeparameter : - ; Veraenderte Register : ; Stackbedarf : ; Zeitbedarf : ; LCD MACRO POS,STRG PUSH ACC PUSH DPH PUSH DPL MOV A,#POS LCALL LCD_SET_DD_RAM_ADDRESS MOV DPTR,#STR_ADR LCALL LCD_WRITE_STRING LJMP WEITER STR_ADR DB STRG,0 WEITER: POP DPL POP DPH POP ACC ENDM ;--------------------------------------------------------------------- ; Funktion : A, B, PSW, DPTR, R0 - R7 auf Stack retten ; Aufrufparameter : PUSH_ALL ; Ruechgabeparameter : - ; Veraenderte Register : - ; Stackbedarf : 2 ; Zeitbedarf : ; PUSH_ALL MACRO PUSH ACC PUSH B PUSH PSW PUSH_DPTR PUSH AR0 PUSH AR1 PUSH AR2 PUSH AR3 PUSH AR4 PUSH AR5 PUSH AR6 PUSH AR7 ENDM ;--------------------------------------------------------------------- ; Funktion : A, B, PSW, DPTR, R0 - R7 von Stack holen ; Aufrufparameter : POP_ALL ; Ruechgabeparameter : - ; Veraenderte Register : - ; Stackbedarf : 2 ; Zeitbedarf : ; POP_ALL MACRO POP AR7 POP AR6 POP AR5 POP AR4 POP AR3 POP AR2 POP AR1 POP AR0 POP_DPTR POP PSW POP B POP ACC ENDM ;--------------------------------------------------------------------- ; Funktion : DPTR pushen und popen. ; Aufrufparameter : - ; Ruechgabeparameter : - ; Veraenderte Register : ; Stackbedarf : ; Zeitbedarf : ; PUSH_DPTR MACRO PUSH DPL PUSH DPH ENDM POP_DPTR MACRO POP DPH POP DPL ENDM ;--------------------------------------------------------------------- ; Funktion : DPTR decreminieren. ; Aufrufparameter : - ; Ruechgabeparameter : - ; Veraenderte Register : ; Stackbedarf : ; Zeitbedarf : ; ifdef joerg DEC_DPTR MACRO INC DPL DJNZ DPL,DEC_DPTR1 DEC DPH DEC_DPTR1: DEC DPL ENDM endif ;--------------------------------------------------------------------- ; Funktion : Addieren und subtraieren mit DPTR. ; Aufrufparameter : - ; Ruechgabeparameter : - ; Veraenderte Register : ; Stackbedarf : ; Zeitbedarf : ; ADD_DPTR MACRO WERT PUSH PSW PUSH ACC MOV A,#(WERT#256) ADD A,DPL MOV DPL,A MOV A,#(WERT/256) ADDC A,DPH MOV DPH,A POP ACC POP PSW ENDM SUBB_DPTR MACRO WERT PUSH PSW PUSH ACC MOV A,DPL CLR C SUBB A,#(WERT#256) MOV DPL,A MOV A,DPH SUBB A,#(WERT/256) MOV DPH,A POP ACC POP PSW ENDM ;--------------------------------------------------------------------- ; Funktion : Rechnen mit 16- Bit- Werten im ext. RAM (L,H). ; Aufrufparameter : DPTR = Wert ; Ruechgabeparameter : DPTR = Wert ; Veraenderte Register : ; Stackbedarf : ; Zeitbedarf : ; SET_16 MACRO NAME PUSH ACC PUSH_DPTR PUSH DPH PUSH DPL MOV DPTR,#NAME POP ACC MOVX @DPTR,A INC DPTR POP ACC MOVX @DPTR,A POP_DPTR POP ACC ENDM GET_16 MACRO NAME PUSH ACC MOV DPTR,#NAME MOVX A,@DPTR PUSH ACC INC DPTR MOVX A,@DPTR MOV DPH,A POP DPL POP ACC ENDM ;--------------------------------------------------------------------- ; Funktion : Scheduler. ; Aufrufparameter : ACC = Zeichen ; Ruechgabeparameter : - ; Veraenderte Register : ; Stackbedarf : ; Zeitbedarf : ; IFCALL MACRO CONST,ROUTINE CJNE A,#CONST,IFCALL1 LCALL ROUTINE IFCALL1: ENDM IFMAKE MACRO CONST,CODE CJNE A,#CONST,IFMAKE1 CODE IFMAKE1: ENDM ;--------------------------------------------------------------------- ; Funktion : Warten bis Netzwerk freiund Message senden. ; Aufrufparameter : ACC = Zeichen ; Ruechgabeparameter : - ; Veraenderte Register : ; Stackbedarf : ; Zeitbedarf : ; SEND_NET MACRO push acc SEND_NET1: LCALL READ_STATUS JB ACC.1,SEND_NET1 pop acc LCALL SEND_MESSAGE ENDM ;--------------------------------------------------------------------- ; Funktion : Message senden. ; Aufrufparameter : - ; Ruechgabeparameter : - ; Veraenderte Register : - ; Stackbedarf : ; Zeitbedarf : ; post_Message1 macro Modul,Msg ; if MY_SLAVE_ADR = uC_Modul ; call ADR_Msg ; interne Message ; elseif PUSH ACC WAIT_NET: LCALL READ_STATUS JB ACC.1,WAIT_NET PUSH DPL PUSH DPH MOV DPTR,#ModulNetAdr_Tab MOV A,#Modul MOVC A,@A+DPTR POP DPH POP DPL MOV R0,#Modul MOV R1,#Msg LCALL SEND_MESSAGE ; Message ins Netz POP ACC ; endif endm ;--------------------------------------------------------------------- ; Funktion : Message senden, alle Parameter im Mkroaufruf, B automatisch. ; Aufrufparameter : - ; Ruechgabeparameter : - ; Veraenderte Register : R0- R7 ; Stackbedarf : ; Zeitbedarf : ; post_Message2 macro Modul,Msg,PARA1,PARA2,PARA3,PARA4,PARA5,PARA6 Parameteranzahl SET 2 ; min. Modulnr. und Msg.-Nr. PUSH ACC PUSH B IF "PARA1"<>"" MOV R2,PARA1 Parameteranzahl SET Parameteranzahl+1 ENDIF IF "PARA2"<>"" MOV R3,PARA2 Parameteranzahl SET Parameteranzahl+1 ENDIF IF "PARA3"<>"" MOV R4,PARA3 Parameteranzahl SET Parameteranzahl+1 ENDIF IF "PARA4"<>"" MOV R5,PARA4 Parameteranzahl SET Parameteranzahl+1 ENDIF IF "PARA5"<>"" MOV R6,PARA5 Parameteranzahl SET Parameteranzahl+1 ENDIF IF "PARA6"<>"" MOV R7,PARA6 Parameteranzahl SET Parameteranzahl+1 ENDIF PUSH DPL PUSH DPH MOV DPTR,#ModulNetAdr_Tab MOV A,Modul MOVC A,@A+DPTR POP DPH POP DPL MOV R0,Modul MOV R1,Msg MOV B,#Parameteranzahl PUSH ACC WAIT_NET: LCALL READ_STATUS JB ACC.1,WAIT_NET POP ACC LCALL SEND_MESSAGE ; Message ins Netz POP B POP ACC endm ;--------------------------------------------------------------------- ; Funktion : Message ausgeben ; Aufrufparameter : wie definiert ; Ruechgabeparameter : - ; Veraenderte Register : ; Stackbedarf : ; Zeitbedarf : ; TEST_MESSAGE_HEX MACRO POS PUSH ACC MOV A,#POS LCALL LCD_SET_DD_RAM_ADDRESS POP ACC PUSH ACC LCALL A_LCD MOV A,#' ' LCALL LCD_WRITE_CHAR MOV A,B LCALL A_LCD MOV A,#' ' LCALL LCD_WRITE_CHAR MOV A,R0 LCALL A_LCD MOV A,#' ' LCALL LCD_WRITE_CHAR MOV A,R1 LCALL A_LCD MOV A,#' ' LCALL LCD_WRITE_CHAR MOV A,R2 LCALL A_LCD MOV A,#' ' LCALL LCD_WRITE_CHAR MOV A,R3 LCALL A_LCD MOV A,#' ' LCALL LCD_WRITE_CHAR MOV A,R4 LCALL A_LCD MOV A,#' ' LCALL LCD_WRITE_CHAR MOV A,R5 LCALL A_LCD MOV A,#' ' LCALL LCD_WRITE_CHAR MOV A,R6 LCALL A_LCD MOV A,#' ' LCALL LCD_WRITE_CHAR MOV A,R7 LCALL A_LCD POP ACC ENDM ;--------------------------------------------------------------------- ; Funktion : Fehlerbehandlung ; Aufrufparameter : Fehlernr. ; Ruechgabeparameter : - ; Veraenderte Register : ; Stackbedarf : ; Zeitbedarf : ; ERROR MACRO NR ENDM ;--------------------------------------------------------------------- ;--------------------------------------------------------------------- TEST_MESSAGE MACRO POS,SCHALTER IF SCHALTER<=TEST_LEVEL PUSH ACC MOV A,#POS LCALL LCD_SET_DD_RAM_ADDRESS MOV A,R0 LCALL LCD_WRITE_CHAR MOV A,R1 LCALL LCD_WRITE_CHAR MOV A,R2 LCALL LCD_WRITE_CHAR MOV A,R3 LCALL LCD_WRITE_CHAR MOV A,R4 LCALL LCD_WRITE_CHAR MOV A,R5 LCALL LCD_WRITE_CHAR MOV A,R6 LCALL LCD_WRITE_CHAR MOV A,R7 LCALL LCD_WRITE_CHAR POP ACC ENDIF ENDM ;--------------------------------------------------------------------- MAKE_MESSAGE MACRO ADR,STRG IF 0=0 MOV A,#0 MOV DPTR,#STR_ADR MOVC A,@A+DPTR MOV R0,A MOV A,#0 INC DPTR MOVC A,@A+DPTR MOV R1,A MOV A,#0 INC DPTR MOVC A,@A+DPTR MOV R2,A MOV A,#0 INC DPTR MOVC A,@A+DPTR MOV R3,A MOV A,#0 INC DPTR MOVC A,@A+DPTR MOV R4,A MOV A,#0 INC DPTR MOVC A,@A+DPTR MOV R5,A MOV A,#0 INC DPTR MOVC A,@A+DPTR MOV R6,A MOV A,#0 INC DPTR MOVC A,@A+DPTR MOV R7,A MOV A,#ADR MOV B,#8 LJMP WEITER STR_ADR DB STRG WEITER: NOP ENDIF ENDM ;--------------------------------------------------------------------- MAKE_MESSAGE_HEX MACRO ADR,L,A0,A1,A2,A3,A4,A5,A6,A7 IF 0=0 MOV R0,#A0 MOV R1,#A1 MOV R2,#A2 MOV R3,#A3 MOV R4,#A4 MOV R5,#A5 MOV R6,#A6 MOV R7,#A7 MOV A,#ADR MOV B,#L ENDIF ENDM ;---------------------------------------------------------------------
include include1.asm init: ld a, 0 mac1 ld a, 2 end init
#include <cstdarg> #include <sstream> #include <string> #include "StringFormatter.hpp" using std::string; using std::stringstream; string StringFormatter::format(const char *format, va_list args) { const char *p; char *sval; char cval; int ival; double dval; stringstream sstream; for (p = format; *p; p++) { if (*p != '%') { sstream << *p; continue; } switch (*++p) { case 'c': cval = (char)va_arg(args, int); sstream << cval; break; case 'd': ival = va_arg(args, int); sstream << ival; break; case 'f': dval = va_arg(args, double); sstream << dval; break; case 's': for (sval = va_arg(args, char *); *sval; sval++) { sstream << *sval; } break; default: sstream << *p; break; } ++format; } return sstream.str(); }
; A064216: Replace each p^e with prevprime(p)^e in the prime factorization of odd numbers; inverse of sequence A048673 considered as a permutation of the natural numbers. ; 1,2,3,5,4,7,11,6,13,17,10,19,9,8,23,29,14,15,31,22,37,41,12,43,25,26,47,21,34,53,59,20,33,61,38,67,71,18,35,73,16,79,39,46,83,55,58,51,89,28,97,101,30,103,107,62,109,57,44,65,49,74,27,113,82,127,85,24,131,137,86,77,69,50,139,149,52,87,151,94,95,157,42,163,121,68,167,45,106,173,179,118,93,91,40,181,191,66,193,197,122,115,111,76,119,199,134,123,145,142,143,211,36,223,227,70,229,129,146,233,239,32,75,187,158,241,133,78,251,155,92,257,141,166,263,269,110,63,271,116,277,281,102,185,169,178,283,159,56,209,205,194,177,293,202,307,311,60,313,161,206,221,99,214,215,317,124,183,331,218,203,125,114,337,347,88,349,201,130,353,289,98,213,359,148,235,367,54,253,373,226,379,105,164,383,247,254,219,389,170,397,319,48,217,401,262,265,237,274,409,419,172,117,295,154,421,431,138,323,433,100,439,249,278,443,259,298,165,449,104,457,461,174,463,305,302,287,153,188,467,341,190,267,479,314,487,299,84,335,491 mul $0,2 cal $0,64989 ; Multiplicative with a(2^e) = 1 and a(p^e) = prevprime(p)^e for odd primes p. mov $1,$0
/*============================================================================= Copyright (c) 2015,2018 Kohei Takahashi Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) ==============================================================================*/ #include <boost/config.hpp> #ifdef BOOST_NO_CXX11_VARIADIC_TEMPLATES # error "does not meet requirements" #endif #include <boost/fusion/support/detail/index_sequence.hpp> #include <boost/mpl/assert.hpp> #include <boost/type_traits/is_same.hpp> using namespace boost::fusion; BOOST_MPL_ASSERT((boost::is_same<detail::make_index_sequence<0>::type, detail::index_sequence<> >)); BOOST_MPL_ASSERT((boost::is_same<detail::make_index_sequence<1>::type, detail::index_sequence<0> >)); BOOST_MPL_ASSERT((boost::is_same<detail::make_index_sequence<2>::type, detail::index_sequence<0, 1> >)); BOOST_MPL_ASSERT((boost::is_same<detail::make_index_sequence<3>::type, detail::index_sequence<0, 1, 2> >)); BOOST_MPL_ASSERT((boost::is_same<detail::make_index_sequence<4>::type, detail::index_sequence<0, 1, 2, 3> >)); BOOST_MPL_ASSERT((boost::is_same<detail::make_index_sequence<5>::type, detail::index_sequence<0, 1, 2, 3, 4> >)); BOOST_MPL_ASSERT((boost::is_same<detail::make_index_sequence<6>::type, detail::index_sequence<0, 1, 2, 3, 4, 5> >)); BOOST_MPL_ASSERT((boost::is_same<detail::make_index_sequence<7>::type, detail::index_sequence<0, 1, 2, 3, 4, 5, 6> >)); BOOST_MPL_ASSERT((boost::is_same<detail::make_index_sequence<8>::type, detail::index_sequence<0, 1, 2, 3, 4, 5, 6, 7> >)); BOOST_MPL_ASSERT((boost::is_same<detail::make_index_sequence<15>::type, detail::index_sequence<0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14> >)); BOOST_MPL_ASSERT((boost::is_same<detail::make_index_sequence<16>::type, detail::index_sequence<0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15> >)); BOOST_MPL_ASSERT((boost::is_same<detail::make_index_sequence<17>::type, detail::index_sequence<0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16> >));
; A095340: Total number of nodes in all labeled graphs on n nodes. ; 1,4,24,256,5120,196608,14680064,2147483648,618475290624,351843720888320,396316767208603648,885443715538058477568,3929008913747544817795072,34662321099990647697175478272,608472288109550112718417538580480,21267647932558653966460912964485513216,1480908860839924192992606291543055256256512,205523667749658222872393179600727299639115513856,56869951711820094353141784210656004860851647112282112,31385508676933403819178947116038332080511777222320172564480 add $0,1 mov $1,$0 mov $2,$0 sub $2,$0 add $2,1 lpb $1 mul $0,$2 sub $1,1 mul $2,2 lpe
/* * File : context.asm * This file is part of RT-Thread RTOS * COPYRIGHT (C) 2009, RT-Thread Development Team * * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at * http://www.rt-thread.org/license/LICENSE * * Change Logs: * Date Author Notes * 2010-04-09 fify the first version * 2010-04-19 fify rewrite rt_hw_interrupt_disable/enable fuction * 2010-04-20 fify move peripheral ISR to bsp/interrupts.s34 * * For : Renesas M16C * Toolchain : IAR's EW for M16C v3.401 */ RSEG CSTACK RSEG ISTACK RSEG CODE(1) EXTERN rt_interrupt_from_thread EXTERN rt_interrupt_to_thread PUBLIC rt_hw_interrupt_disable PUBLIC rt_hw_interrupt_enable PUBLIC rt_hw_context_switch_to PUBLIC os_context_switch rt_hw_interrupt_disable: STC FLG, R0 ;fify 20100419 FCLR I RTS rt_hw_interrupt_enable: LDC R0, FLG ;fify 20100419 RTS .EVEN os_context_switch: PUSHM R0,R1,R2,R3,A0,A1,SB,FB MOV.W rt_interrupt_from_thread, A0 STC ISP, [A0] MOV.W rt_interrupt_to_thread, A0 LDC [A0], ISP POPM R0,R1,R2,R3,A0,A1,SB,FB ; Restore registers from the new task's stack REIT ; Return from interrup /* * void rt_hw_context_switch_to(rt_uint32 to); * r0 --> to * this fucntion is used to perform the first thread switch */ rt_hw_context_switch_to: MOV.W R0, A0 LDC [A0], ISP POPM R0,R1,R2,R3,A0,A1,SB,FB REIT END
; A001444: Bending a piece of wire of length n+1 (configurations that can only be brought into coincidence by turning the figure over are counted as different). ; 1,2,6,15,45,126,378,1107,3321,9882,29646,88695,266085,797526,2392578,7175547,21526641,64573362,193720086,581140575,1743421725,5230206126,15690618378,47071677987,141215033961,423644570442,1270933711326,3812799539655,11438398618965,34315191073926,102945573221778,308836705316427,926510115949281,2779530304801122,8338590914403366 mov $3,$0 lpb $0 mov $2,$0 cal $2,302507 ; a(n) = 4*(3^n-1). mov $0,$3 div $0,2 add $1,$2 mov $3,1 lpe div $1,8 add $1,1
// Copyright 2018 The Fuchsia 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 "src/developer/debug/zxdb/symbols/dwarf_symbol_factory.h" #include "gtest/gtest.h" #include "src/developer/debug/zxdb/common/string_util.h" #include "src/developer/debug/zxdb/symbols/array_type.h" #include "src/developer/debug/zxdb/symbols/base_type.h" #include "src/developer/debug/zxdb/symbols/collection.h" #include "src/developer/debug/zxdb/symbols/data_member.h" #include "src/developer/debug/zxdb/symbols/dwarf_test_util.h" #include "src/developer/debug/zxdb/symbols/enumeration.h" #include "src/developer/debug/zxdb/symbols/function.h" #include "src/developer/debug/zxdb/symbols/function_type.h" #include "src/developer/debug/zxdb/symbols/inherited_from.h" #include "src/developer/debug/zxdb/symbols/modified_type.h" #include "src/developer/debug/zxdb/symbols/module_symbols_impl.h" #include "src/developer/debug/zxdb/symbols/symbol.h" #include "src/developer/debug/zxdb/symbols/test_symbol_module.h" #include "src/developer/debug/zxdb/symbols/variable.h" namespace zxdb { namespace { const char kDoStructCallName[] = "DoStructCall"; const char kGetIntPtrName[] = "GetIntPtr"; const char kGetStructMemberPtrName[] = "GetStructMemberPtr"; const char kPassRValueRefName[] = "PassRValueRef"; const char kCallInlineMemberName[] = "CallInlineMember"; const char kCallInlineName[] = "CallInline"; // Returns the function symbol with the given name. The name is assumed to // exit as this function will EXPECT_* it to be valid. Returns empty refptr on // failure. fxl::RefPtr<const Function> GetFunctionWithName(ModuleSymbolsImpl& module, const std::string& name) { DwarfSymbolFactory* factory = module.symbol_factory(); llvm::DWARFUnit* unit = GetUnitWithNameEndingIn( module.context(), module.compile_units(), "/type_test.cc"); EXPECT_TRUE(unit); if (!unit) return nullptr; // Find the GetIntPtr function. llvm::DWARFDie function_die = GetFirstDieOfTagAndName( module.context(), unit, llvm::dwarf::DW_TAG_subprogram, name); EXPECT_TRUE(function_die); if (!function_die) return nullptr; // Should make a valid lazy reference to the function DIE. LazySymbol lazy_function = factory->MakeLazy(function_die); EXPECT_TRUE(lazy_function); if (!lazy_function) return nullptr; // Deserialize to a function object. const Symbol* function_symbol = lazy_function.Get(); EXPECT_EQ(DwarfTag::kSubprogram, function_symbol->tag()); return fxl::RefPtr<const Function>(function_symbol->AsFunction()); } } // namespace TEST(DwarfSymbolFactory, Function) { ModuleSymbolsImpl module(TestSymbolModule::GetTestFileName(), ""); Err err = module.Load(); EXPECT_FALSE(err.has_error()) << err.msg(); // Find the GetIntPtr function. fxl::RefPtr<const Function> function = GetFunctionWithName(module, kGetIntPtrName); ASSERT_TRUE(function); // Unmangled name. EXPECT_EQ(kGetIntPtrName, function->GetAssignedName()); // Mangled name. This tries not to depend on the exact name mangling rules // while validating that it's reasonable. The mangled name shouldn't be // exactly the same as the unmangled name, but should at least contain it. EXPECT_NE(kGetIntPtrName, function->linkage_name()); EXPECT_NE(std::string::npos, function->linkage_name().find(kGetIntPtrName)); // Declaration location. EXPECT_TRUE(function->decl_line().is_valid()); EXPECT_TRUE(StringEndsWith(function->decl_line().file(), "/type_test.cc")) << function->decl_line().file(); EXPECT_EQ(12, function->decl_line().line()); // Note: return type tested by ModifiedBaseType. } TEST(DwarfSymbolFactory, PtrToMemberFunction) { ModuleSymbolsImpl module(TestSymbolModule::GetTestFileName(), ""); Err err = module.Load(); EXPECT_FALSE(err.has_error()) << err.msg(); // Find the GetIntPtr function. fxl::RefPtr<const Function> get_function = GetFunctionWithName(module, kGetStructMemberPtrName); ASSERT_TRUE(get_function); // Get the return type, this is a typedef (because functions can't return // pointers to member functions). auto return_typedef = get_function->return_type().Get()->AsModifiedType(); ASSERT_TRUE(return_typedef); // The typedef references the member pointer. The type name encapsulates all // return values and parameters so this tests everything at once. const Symbol* member = return_typedef->modified().Get(); EXPECT_EQ("int (my_ns::Struct::*)(my_ns::Struct*, char)", member->GetFullName()); } TEST(DwarfSymbolFactory, InlinedMemberFunction) { ModuleSymbolsImpl module(TestSymbolModule::GetTestFileName(), ""); Err err = module.Load(); EXPECT_FALSE(err.has_error()) << err.msg(); // Find the CallInline function. fxl::RefPtr<const Function> call_function = GetFunctionWithName(module, kCallInlineMemberName); ASSERT_TRUE(call_function); // It should have one inner block that's the inline function. ASSERT_EQ(1u, call_function->inner_blocks().size()); const Function* inline_func = call_function->inner_blocks()[0].Get()->AsFunction(); ASSERT_TRUE(inline_func); EXPECT_EQ(DwarfTag::kInlinedSubroutine, inline_func->tag()); EXPECT_EQ("ForInline::InlinedFunction", inline_func->GetFullName()); // The inline function should have two parameters, "this" and "param". ASSERT_EQ(2u, inline_func->parameters().size()); const Variable* this_param = inline_func->parameters()[0].Get()->AsVariable(); ASSERT_TRUE(this_param); EXPECT_EQ("this", this_param->GetAssignedName()); const Variable* param_param = inline_func->parameters()[1].Get()->AsVariable(); ASSERT_TRUE(param_param); EXPECT_EQ("param", param_param->GetAssignedName()); // The object pointer on the function should refer to the "this" pointer // retrieved above. This is tricky because normally the object pointer is // on the "abstract origin" of the inlined routine, and will refer to a // "this" parameter specified on the abstract origin. We need to correlate // it to the one on the inlined instance to get the location correct. EXPECT_EQ(this_param, inline_func->GetObjectPointerVariable()); } TEST(DwarfSymbolFactory, InlinedFunction) { ModuleSymbolsImpl module(TestSymbolModule::GetTestFileName(), ""); Err err = module.Load(); EXPECT_FALSE(err.has_error()) << err.msg(); // Find the CallInline function. fxl::RefPtr<const Function> call_function = GetFunctionWithName(module, kCallInlineName); ASSERT_TRUE(call_function); // It should have one inner block that's the inline function. ASSERT_EQ(1u, call_function->inner_blocks().size()); const Function* inline_func = call_function->inner_blocks()[0].Get()->AsFunction(); ASSERT_TRUE(inline_func); EXPECT_EQ(DwarfTag::kInlinedSubroutine, inline_func->tag()); // Parameter decoding is tested by the InlinedMemberFunction test above. Here // we care that the enclosing namespace is correct because of the different // ways these inlined routines are declared. EXPECT_EQ("my_ns::InlinedFunction", inline_func->GetFullName()); // The containing block of the inline function should be the calling // function. Note that the objects may not be the same. ASSERT_TRUE(inline_func->containing_block()); auto containing_func = inline_func->containing_block().Get()->AsFunction(); ASSERT_TRUE(containing_func); EXPECT_EQ(kCallInlineName, containing_func->GetFullName()); } TEST(DwarfSymbolFactory, ModifiedBaseType) { ModuleSymbolsImpl module(TestSymbolModule::GetTestFileName(), ""); Err err = module.Load(); EXPECT_FALSE(err.has_error()) << err.msg(); // Find the GetIntPtr function. fxl::RefPtr<const Function> function = GetFunctionWithName(module, kGetIntPtrName); ASSERT_TRUE(function); // Get the return type, this references a "pointer" modifier. EXPECT_TRUE(function->return_type().is_valid()); const ModifiedType* ptr_mod = function->return_type().Get()->AsModifiedType(); ASSERT_TRUE(ptr_mod) << "Tag = " << static_cast<int>( function->return_type().Get()->tag()); EXPECT_EQ(DwarfTag::kPointerType, ptr_mod->tag()); EXPECT_EQ("const int*", ptr_mod->GetFullName()); // The modified type should be a "const" modifier. const ModifiedType* const_mod = ptr_mod->modified().Get()->AsModifiedType(); ASSERT_TRUE(const_mod) << "Tag = " << static_cast<int>( function->return_type().Get()->tag()); EXPECT_EQ(DwarfTag::kConstType, const_mod->tag()); EXPECT_EQ("const int", const_mod->GetFullName()); // The modified type should be the int base type. const BaseType* base = const_mod->modified().Get()->AsBaseType(); ASSERT_TRUE(base); EXPECT_EQ(DwarfTag::kBaseType, base->tag()); EXPECT_EQ("int", base->GetFullName()); // Validate the BaseType parameters. EXPECT_EQ(BaseType::kBaseTypeSigned, base->base_type()); EXPECT_EQ("int", base->GetAssignedName()); // Try to be flexible about the size of ints on the platform. EXPECT_TRUE(base->byte_size() == 4 || base->byte_size() == 8); // This is not a bitfield. EXPECT_EQ(0u, base->bit_size()); EXPECT_EQ(0u, base->bit_offset()); } TEST(DwarfSymbolFactory, RValueRef) { ModuleSymbolsImpl module(TestSymbolModule::GetTestFileName(), ""); Err err = module.Load(); EXPECT_FALSE(err.has_error()) << err.msg(); // Find the GetIntPtr function. fxl::RefPtr<const Function> function = GetFunctionWithName(module, kPassRValueRefName); ASSERT_TRUE(function); // Should have one parameter of rvalue ref type. ASSERT_EQ(1u, function->parameters().size()); const Variable* var = function->parameters()[0].Get()->AsVariable(); ASSERT_TRUE(var); const ModifiedType* modified = var->type().Get()->AsModifiedType(); ASSERT_TRUE(modified); EXPECT_EQ(DwarfTag::kRvalueReferenceType, modified->tag()); EXPECT_EQ("int&&", modified->GetFullName()); } TEST(DwarfSymbolFactory, ArrayType) { ModuleSymbolsImpl module(TestSymbolModule::GetTestFileName(), ""); Err err = module.Load(); EXPECT_FALSE(err.has_error()) << err.msg(); // Find the GetString function. const char kGetString[] = "GetString"; fxl::RefPtr<const Function> function = GetFunctionWithName(module, kGetString); ASSERT_TRUE(function); // Find the "str_array" variable in the function. ASSERT_EQ(1u, function->variables().size()); const Variable* str_array = function->variables()[0].Get()->AsVariable(); ASSERT_TRUE(str_array); EXPECT_EQ("str_array", str_array->GetAssignedName()); // It should be an array type with length 14. const ArrayType* array_type = str_array->type().Get()->AsArrayType(); ASSERT_TRUE(array_type); EXPECT_EQ(14u, array_type->num_elts()); EXPECT_EQ("const char[14]", array_type->GetFullName()); // The inner type should be a "char". const Type* elt_type = array_type->value_type(); ASSERT_TRUE(elt_type); EXPECT_EQ("const char", elt_type->GetFullName()); } TEST(DwarfSymbolFactory, Array2D) { ModuleSymbolsImpl module(TestSymbolModule::GetTestFileName(), ""); Err err = module.Load(); EXPECT_FALSE(err.has_error()) << err.msg(); // Find the My2DArray function. const char kMy2DArray[] = "My2DArray"; fxl::RefPtr<const Function> function = GetFunctionWithName(module, kMy2DArray); ASSERT_TRUE(function); // Find the "array" variable in the function. It's declared as: // // int array[3][4] // ASSERT_EQ(1u, function->variables().size()); const Variable* array = function->variables()[0].Get()->AsVariable(); ASSERT_TRUE(array); EXPECT_EQ("array", array->GetAssignedName()); // It should be an array type with length 3 (outer dimension). const ArrayType* outer_array_type = array->type().Get()->AsArrayType(); ASSERT_TRUE(outer_array_type); EXPECT_EQ(3u, outer_array_type->num_elts()); EXPECT_EQ("int[3][4]", outer_array_type->GetFullName()); // The inner array type should be a int[4]. const Type* inner_type = outer_array_type->value_type(); ASSERT_TRUE(inner_type); const ArrayType* inner_array_type = inner_type->AsArrayType(); ASSERT_TRUE(inner_array_type); EXPECT_EQ(4u, inner_array_type->num_elts()); EXPECT_EQ("int[4]", inner_array_type->GetFullName()); // The final contained type type should be a "int". const Type* elt_type = inner_array_type->value_type(); ASSERT_TRUE(elt_type); EXPECT_EQ("int", elt_type->GetFullName()); } TEST(DwarfSymbolFactory, Collection) { ModuleSymbolsImpl module(TestSymbolModule::GetTestFileName(), ""); Err err = module.Load(); EXPECT_FALSE(err.has_error()) << err.msg(); // Find the GetStruct function. const char kGetStruct[] = "GetStruct"; fxl::RefPtr<const Function> function = GetFunctionWithName(module, kGetStruct); ASSERT_TRUE(function); // The return type should be the struct. auto* struct_type = function->return_type().Get()->AsCollection(); ASSERT_TRUE(struct_type); EXPECT_EQ("my_ns::Struct", struct_type->GetFullName()); // The struct has three data members and two base classes. ASSERT_EQ(3u, struct_type->data_members().size()); ASSERT_EQ(2u, struct_type->inherited_from().size()); // The first thing should be Base1 at offset 0. auto* base1 = struct_type->inherited_from()[0].Get()->AsInheritedFrom(); ASSERT_TRUE(base1); auto* base1_type = base1->from().Get()->AsType(); EXPECT_EQ("my_ns::Base1", base1_type->GetFullName()); EXPECT_EQ(0u, base1->offset()); // It should be followed by Base2. To allow flexibility in packing without // breaking this test, all offsets below check only that the offset is // greater than the previous one and a multiple of 4. auto* base2 = struct_type->inherited_from()[1].Get()->AsInheritedFrom(); ASSERT_TRUE(base2); auto* base2_type = base2->from().Get()->AsType(); EXPECT_EQ("my_ns::Base2", base2_type->GetFullName()); EXPECT_LT(0u, base2->offset()); EXPECT_TRUE(base2->offset() % 4 == 0); // The base classes should be followed by the data members on the struct. auto* member_a = struct_type->data_members()[0].Get()->AsDataMember(); ASSERT_TRUE(member_a); auto* member_a_type = member_a->type().Get()->AsType(); EXPECT_EQ("int", member_a_type->GetFullName()); EXPECT_LT(base2->offset(), member_a->member_location()); EXPECT_TRUE(member_a->member_location() % 4 == 0); // The second data member should be "Struct* member_b". auto* member_b = struct_type->data_members()[1].Get()->AsDataMember(); ASSERT_TRUE(member_b); auto* member_b_type = member_b->type().Get()->AsType(); EXPECT_EQ("my_ns::Struct*", member_b_type->GetFullName()); EXPECT_LT(member_a->member_location(), member_b->member_location()); EXPECT_TRUE(member_b->member_location() % 4 == 0); // The third data member is "const void* v". Void is weird because it will // be represented as a modified pointer type of nothing. auto* member_v = struct_type->data_members()[2].Get()->AsDataMember(); ASSERT_TRUE(member_v); auto* member_v_type = member_v->type().Get()->AsType(); EXPECT_EQ("const void*", member_v_type->GetFullName()); EXPECT_LT(member_b->member_location(), member_v->member_location()); EXPECT_TRUE(member_v->member_location() % 4 == 0); } TEST(DwarfSymbolFactory, Enum) { ModuleSymbolsImpl module(TestSymbolModule::GetTestFileName(), ""); Err err = module.Load(); EXPECT_FALSE(err.has_error()) << err.msg(); // Find the GetStruct function. const char kGetStruct[] = "GetStructWithEnums"; fxl::RefPtr<const Function> function = GetFunctionWithName(module, kGetStruct); ASSERT_TRUE(function); // The return type should be the struct. auto* struct_type = function->return_type().Get()->AsCollection(); ASSERT_TRUE(struct_type); EXPECT_EQ("StructWithEnums", struct_type->GetFullName()); // There are three enum members defined in the struct. ASSERT_EQ(3u, struct_type->data_members().size()); // First is a regular enum with no values. auto regular_enum = struct_type->data_members()[0] .Get() ->AsDataMember() ->type() .Get() ->AsEnumeration(); ASSERT_TRUE(regular_enum); EXPECT_EQ("StructWithEnums::RegularEnum", regular_enum->GetFullName()); EXPECT_TRUE(regular_enum->values().empty()); // Second is an anonymous signed enum with two values. We don't bother to // test the enumerator values on this one since some aspects will be // compiler-dependent. auto anon_enum = struct_type->data_members()[1] .Get() ->AsDataMember() ->type() .Get() ->AsEnumeration(); ASSERT_TRUE(anon_enum); EXPECT_EQ("StructWithEnums::(anon enum)", anon_enum->GetFullName()); EXPECT_TRUE(anon_enum->is_signed()); EXPECT_EQ(2u, anon_enum->values().size()); // Third is a type enum with two values. auto typed_enum = struct_type->data_members()[2] .Get() ->AsDataMember() ->type() .Get() ->AsEnumeration(); ASSERT_TRUE(typed_enum); EXPECT_EQ("StructWithEnums::TypedEnum", typed_enum->GetFullName()); EXPECT_TRUE(typed_enum->is_signed()); ASSERT_EQ(2u, typed_enum->values().size()); EXPECT_EQ(1u, typed_enum->byte_size()); // Since this is typed, the values should be known. The map contains the // signed values casted to an unsigned int. auto first_value = *typed_enum->values().begin(); auto second_value = *(++typed_enum->values().begin()); EXPECT_EQ(1u, first_value.first); EXPECT_EQ("TYPED_B", first_value.second); EXPECT_EQ(static_cast<uint64_t>(-1), second_value.first); EXPECT_EQ("TYPED_A", second_value.second); } // Tests nested code blocks, variables, and parameters. TEST(DwarfSymbolFactory, CodeBlocks) { ModuleSymbolsImpl module(TestSymbolModule::GetTestFileName(), ""); Err err = module.Load(); EXPECT_FALSE(err.has_error()) << err.msg(); // Find the DoStructCall function. fxl::RefPtr<const Function> function = GetFunctionWithName(module, kDoStructCallName); ASSERT_TRUE(function); // It should have two parameters, arg1 and arg2. const Variable* struct_arg = nullptr; const Variable* int_arg = nullptr; ASSERT_EQ(2u, function->parameters().size()); for (const auto& param : function->parameters()) { const Variable* cur_var = param.Get()->AsVariable(); ASSERT_TRUE(cur_var); // Each parameter should decode to a variable. if (cur_var->GetAssignedName() == "arg1") struct_arg = cur_var; else if (cur_var->GetAssignedName() == "arg2") int_arg = cur_var; } // Both args should have valid locations with non-empty expressions. This // doesn't test the actual programs because that could vary by build. ASSERT_FALSE(struct_arg->location().is_null()); EXPECT_FALSE(struct_arg->location().locations()[0].expression.empty()); ASSERT_FALSE(int_arg->location().is_null()); EXPECT_FALSE(int_arg->location().locations()[0].expression.empty()); // Validate the arg1 type (const Struct&). ASSERT_TRUE(struct_arg); const Type* struct_arg_type = struct_arg->type().Get()->AsType(); ASSERT_TRUE(struct_arg_type); EXPECT_EQ("const my_ns::Struct&", struct_arg_type->GetFullName()); // Validate the arg2 type (int). ASSERT_TRUE(int_arg); const Type* int_arg_type = int_arg->type().Get()->AsType(); ASSERT_TRUE(int_arg_type); EXPECT_EQ("int", int_arg_type->GetFullName()); // The function block should have one variable (var1). ASSERT_EQ(1u, function->variables().size()); const Variable* var1 = function->variables()[0].Get()->AsVariable(); ASSERT_TRUE(var1); const Type* var1_type = var1->type().Get()->AsType(); ASSERT_TRUE(var1_type); EXPECT_EQ("volatile int", var1_type->GetFullName()); // There should be one child lexical scope. ASSERT_EQ(1u, function->inner_blocks().size()); const CodeBlock* inner = function->inner_blocks()[0].Get()->AsCodeBlock(); // The lexical scope should have one child variable. ASSERT_EQ(1u, inner->variables().size()); const Variable* var2 = inner->variables()[0].Get()->AsVariable(); ASSERT_TRUE(var2); const Type* var2_type = var2->type().Get()->AsType(); ASSERT_TRUE(var2_type); EXPECT_EQ("volatile my_ns::Struct", var2_type->GetFullName()); // The lexical scope should have no other children. EXPECT_TRUE(inner->inner_blocks().empty()); } // Tests both nullptr_t and typedef decoding (which is how it's encoded). TEST(DwarfSymbolFactory, NullPtrTTypedef) { ModuleSymbolsImpl module(TestSymbolModule::GetTestFileName(), ""); Err err = module.Load(); EXPECT_FALSE(err.has_error()) << err.msg(); // Find the GetNullPtrT function. const char kGetNullPtrT[] = "GetNullPtrT"; fxl::RefPtr<const Function> function = GetFunctionWithName(module, kGetNullPtrT); ASSERT_TRUE(function); // The return type should be nullptr_t. auto* nullptr_t_type = function->return_type().Get()->AsType(); ASSERT_TRUE(nullptr_t_type); EXPECT_EQ("nullptr_t", nullptr_t_type->GetFullName()); // The standard defined nullptr_t as "typedef decltype(nullptr) nullptr_t" auto* typedef_type = nullptr_t_type->AsModifiedType(); ASSERT_TRUE(typedef_type); EXPECT_EQ(DwarfTag::kTypedef, typedef_type->tag()); // Check the type underlying the typedef. auto* underlying = typedef_type->modified().Get()->AsType(); ASSERT_TRUE(underlying); EXPECT_EQ("decltype(nullptr)", underlying->GetFullName()); // Currently Clang defines this as an "unspecified" type. Since this isn't // specified, it's possible this may change in the future, but if it does we // need to check to make sure everything works properly. EXPECT_EQ(DwarfTag::kUnspecifiedType, underlying->tag()); // The decoder should have forced the size to be the size of a pointer. EXPECT_EQ(8u, underlying->byte_size()); } // TODO(brettw) test using statements. See GetUsing() in type_test.cc } // namespace zxdb
// Copyright (c) 2014-2015 The Dash developers // Copyright (c) 2015-2019 The Bitstock developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "netbase.h" #include "masternodeconfig.h" #include "util.h" #include "guiinterface.h" #include <base58.h> CMasternodeConfig masternodeConfig; CMasternodeConfig::CMasternodeEntry* CMasternodeConfig::add(std::string alias, std::string ip, std::string privKey, std::string txHash, std::string outputIndex) { CMasternodeEntry cme(alias, ip, privKey, txHash, outputIndex); entries.push_back(cme); return &(entries[entries.size()-1]); } void CMasternodeConfig::remove(std::string alias) { int pos = -1; for (int i = 0; i < ((int) entries.size()); ++i) { CMasternodeEntry e = entries[i]; if (e.getAlias() == alias) { pos = i; break; } } entries.erase(entries.begin() + pos); } bool CMasternodeConfig::read(std::string& strErr) { int linenumber = 1; boost::filesystem::path pathMasternodeConfigFile = GetMasternodeConfigFile(); boost::filesystem::ifstream streamConfig(pathMasternodeConfigFile); if (!streamConfig.good()) { FILE* configFile = fopen(pathMasternodeConfigFile.string().c_str(), "a"); if (configFile != NULL) { std::string strHeader = "# Masternode config file\n" "# Format: alias IP:port masternodeprivkey collateral_output_txid collateral_output_index\n" "# Example: mn1 127.0.0.2:4316 93HaYBVUCYjEMeeH1Y4sBGLALQZE1Yc1K64xiqgX37tGBDQL8Xg 2bcd3c84c84f87eaa86e4e56834c92927a07f9e18718810b92e0d0324456a67c 0" "#\n"; fwrite(strHeader.c_str(), std::strlen(strHeader.c_str()), 1, configFile); fclose(configFile); } return true; // Nothing to read, so just return } for (std::string line; std::getline(streamConfig, line); linenumber++) { if (line.empty()) continue; std::istringstream iss(line); std::string comment, alias, ip, privKey, txHash, outputIndex; if (iss >> comment) { if (comment.at(0) == '#') continue; iss.str(line); iss.clear(); } if (!(iss >> alias >> ip >> privKey >> txHash >> outputIndex)) { iss.str(line); iss.clear(); if (!(iss >> alias >> ip >> privKey >> txHash >> outputIndex)) { strErr = _("Could not parse masternode.conf") + "\n" + strprintf(_("Line: %d"), linenumber) + "\n\"" + line + "\""; streamConfig.close(); return false; } } int port = 0; std::string hostname = ""; SplitHostPort(ip, port, hostname); if(port == 0 || hostname == "") { strErr = _("Failed to parse host:port string") + "\n"+ strprintf(_("Line: %d"), linenumber) + "\n\"" + line + "\""; streamConfig.close(); return false; } if (Params().NetworkID() == CBaseChainParams::MAIN) { if (port != 4316) { strErr = _("Invalid port detected in masternode.conf") + "\n" + strprintf(_("Line: %d"), linenumber) + "\n\"" + line + "\"" + "\n" + _("(must be 4316 for mainnet)"); streamConfig.close(); return false; } } else if (port == 4316) { strErr = _("Invalid port detected in masternode.conf") + "\n" + strprintf(_("Line: %d"), linenumber) + "\n\"" + line + "\"" + "\n" + _("(4316 could be used only on mainnet)"); streamConfig.close(); return false; } add(alias, ip, privKey, txHash, outputIndex); } streamConfig.close(); return true; } bool CMasternodeConfig::CMasternodeEntry::castOutputIndex(int &n) const { try { n = std::stoi(outputIndex); } catch (const std::exception& e) { LogPrintf("%s: %s on getOutputIndex\n", __func__, e.what()); return false; } return true; }
; A010815: From Euler's Pentagonal Theorem: coefficient of q^n in Product_{m>=1} (1 - q^m). ; Submitted by Jon Maiga ; 1,-1,-1,0,0,1,0,1,0,0,0,0,-1,0,0,-1,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,-1,0,0,0,0,-1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,-1,0,0,0,0,0,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0 seq $0,116916 ; Expansion of q^(-1/8) * (eta(q)^3 + 3 * eta(q^9)^3) in powers of q^3. mod $0,3 dif $0,-2
// This file is part of www.nand2tetris.org // and the book "The Elements of Computing Systems" // by Nisan and Schocken, MIT Press. // File name: projects/04/Fill.asm // Runs an infinite loop that listens to the keyboard input. // When a key is pressed (any key), the program blackens the screen, // i.e. writes "black" in every pixel; // the screen should remain fully black as long as the key is pressed. // When no key is pressed, the program clears the screen, i.e. writes // "white" in every pixel; // the screen should remain fully clear as long as no key is pressed. // Put your code here. (LOOP) @FILL //Forever fill the screen, but with what?? 0;JMP @LOOP 0;JMP (FILL) @SCREEN D=M @WORDCURSOR M=D (LOOPSCREEN) //WORDCURSOR=SCREEN @WORDCURSOR D=M @KBD D=D-M //CURSOR-KBD (addresses) @LOOPSCREENEND D;JGE //if (CURSOR-KBD>=0) end screen iteration that is screen memory ended // INNER LOOP BIT BY BIT ACCESS @BITCURSOR M=0 //BITCURSOR=WORDCURSOR (LOOPWORD) @BITCURSOR D=M @ISWORDENDED @15 D=D-A //B-15 @LOOPWORDEND D;JGT //if bit iterated entirely over word @FILLBIT 0;JMP (AFTERFILL) @BITCURSOR M=M+1 //Next BIT @LOOPWORD 0;JMP (LOOPWORDEND) // ---------------------------- @WORDCURSOR M=M+1 //Next word @LOOPSCREEN 0;JMP (LOOPSCREENEND) @LOOP 0;JMP //After filling the screen recheck if key is still pressed (FILLBIT) @BITCURSOR //the pixel //I was changing the cursor bit!! D=M //BITCURSOR @PIXEL A=D //RAM[BITCURSOR]=-1 M=-1 @AFTERFILL 0;JMP (FILLBIT1) @KBD D=M @ZERO D;JEQ //How does it work with multibits?? @MINUSONE 0;JMP (ZERO) @KEY M=0 @AFTER 0;JMP (MINUSONE) @KEY M=-1 (AFTER) //Key= 0 or -1 (in M) @BITCURSOR //the pixel //I was changing the cursor bit!! D=M @PIXEL A=D @KEY D=M @PIXEL M=D //PIXEL now have 0 or -1 (according to key) // Now we actually access that pixel @AFTERFILL 0;JMP
;---------------------------------------------------------------------------------- ; Tiny Basic port to MKHBC-8-R1 6502 computer ; by Marek Karcz 2012. ; ; Based on the work by: ; ; ================= ORIGINAL HEADER ====================================== ; ; OMS-02 Firmware ; ; Bill O'Neill - Last update: 2008/12/06 ; ; Tiny Basic and minimal Monitor (BIOS) ; ; This version is for the assembler that comes with ; Michal Kowalski's 6502 emulator. To run it, load it ; into the emulator, assemle it, begin debug mode then, ; set the PC to $1CF0 then run. ; ; The emulator was used to help figure out Tiny Basic ; and this code is only documented to that extent. ; ; It should be easy enough to configure this to run any- ; where in memory or convert it to assemble with any 6502 ; assembler. The current location is being used as this is ; to be placed into a controller I designed (OMS-02) around ; a 6507 CPU (a 6502 variant) that has only 8k off memory. ; The memory map for the OMS-02 is; ; ; $0000-$0FFF RAM ; $1000-$13FF I/O space (ACIA is at $1200) ; $1400-$1FFF Tiny Basic and simple monitor ; ; ; Next steps: ; Write a BREAK routine that will enable a break if any charater is typed at the console ; More comments to document this code ; Investigate using assembler variables and directives to make it easy to re-locate this code ; ; ============ END OF ORIGINAL HEADER ========================================= ; ; Revision history (MKHBC-8-R1 port): ; ; 1/4/2012: ; TB port created. ; ; 1/5/2012: ; Version 1.0.1. ; Added 2-byte peek routine. ; ; 1/11/2012: ; Figured out jump addresses for routines and used symbolic labels ; instead of hardcoded addresses. Relocated TB to $0400 (from $1400). ; ; 2/15/2016 ; Ported to my own 6502 emulator. ; ; 3/30/2016 ; ; Changed char input address from blocking to non-blocking. ; ; ;-------------------------------------------------------------------------------------- .segment "BEGN" .ORG $0000 .segment "BASIC" ; ; Tiny Basic starts here ; .ORG $4400 ; Start of Basic. First 1K of ROM is shaded by I/O on the OMS-02 SOBAS: C_00BC = $00BC ; These are needed because my assembler C_20 = $20 ; does not hanle standard 6502 notation C_22 = $22 ; properly C_24 = $24 ; C_2A = $2A ; I may just fix this someday - HA! C_2C = $2C ; C_2E = $2E ; C_B8 = $B8 ; C_BC = $BC ; C_C1 = $C1 ; C_C2 = $C2 ; C_C6 = $C6 ; SR_V_L = SOBAS + $1E ; Base address for subroutine vector lo byte SR_V_H = SOBAS + $1F ; Base address for subroutine vector hi byte CV: jmp COLD_S ; Cold start vector WV: jmp WARM_S ; Warm start vector IN_V: jmp GetCh ; Input routine address. OUT_V: jmp PutCh ; Output routine address. BREAK: nop ; Begin dummy break routine clc ; Clear the carry flag rts ; End break routine ; ; Some codes ; BSC: .byte $5f ; Backspace code LSC: .byte $18 ; Line cancel code PCC: .byte $80 ; Pad character control TMC: .byte $00 ; Tape mode control ;SSS: .byte $04 ; Spare Stack size. (was $04 but documentation suggests $20 ?) SSS: .byte $20 ; Spare Stack size. (was $04 but documentation suggests $20 ?) ; ; Code fragment ; Seems to store or retreive a byte to/from memory and the accumulator ; --- ; M.K.: I think this code it is used from Tiny Basic programs by calling USR to store/retrieve ; data (since TB does not support arrays, this is one way to emulate them). ; This location is at exactly 20 bytes distance from the start of TB code. ; TB programs typically make USR calls to locations: ; SOBAS+20 ; SOBAS+24 ; E.g: ; LET S=_SOBAS_ REM (_SOBAS_ is TB start) ; LET B=_ARRAY_SIZE_+2 (_ARRAY_SIZE_ is the size of 2-dim array) ; Get byte from location V(I,J), store in Z. ; LET Z=USR(S+20,V+B*I+J,0) ; Store Z in location V(I,J) ; LET Z=USR(S+24,V+B*I+J,Z) ; From TB documentation: ; For your convenience two subroutines have been included in the TINY BASIC interpreter to access memory. ; If S contains the address of the beginning of the TINY BASIC interpreter (256 for standard 6800, 512 ; for standard 6502, etc.), then location S+20 (hex 0114) is the entry point of a subroutine to read one ; byte from the memory address in the index register, and location S+24 (hex 0118) is the entry point of ; a subroutine to store one byte into memory. ;------------------------------------------------- ; USR (address) ; USR (address,Xreg) ; USR (address,Xreg,Areg) ; ; This function is actually a machine-language subroutine call to the address in the first argument. ; If the second argument is included the index registers contain that value on entry to the subroutine, ; with the most significant part in X. If the third argument is included, the accumulators contain that ; value on entry to the subroutine, with the least significant part in A. On exit, the value in the ; Accumulators (for the 6800; A and Y for the 6502) becomes the value of the function, with the least ; significant part in A. All three arguments are evaluated as normal expressions. ; It should be noted that machine language subroutine addresses are 16-bit Binary numbers. TINY BASIC ; evaluates all expressions to 16-bit binary numbers, so any valid expression may be used to define a ; subroutine address. However, most addresses are expressed in hexadecimal whereas TINY BASIC only accepts ; numerical constants in decimal. Thus to jump to a subroutine at hex address 40AF, you must code USR(16559). ; Hex address FFB5 is similarly 65461 in decimal, though the equivalent (-75) may be easier to use. ; OneBytePeek: stx $C3 ; read one byte from memory address in the index register bcc LBL008 OneBytePoke: stx $C3 ; store one byte into memory sta (C_C2),Y rts LBL008: lda (C_C2),Y ldy #$00 rts ; These seem to be addresses associated with the IL branch instructions ;.byte $62,$15, $64,$15, $D8,$15, $05,$16, $33,$16, $FD,$15 .byte <JUMP01,>JUMP01 .byte <LBL027,>LBL027 .byte <JUMP02,>JUMP02 .byte <JUMP03,>JUMP03 .byte <JUMP04,>JUMP04 .byte <JUMP05,>JUMP05 ; NOTE: The original comment below is obsolete now, since I found the jump ; addresses locations and put them in this table. Now assembler will ; take care of the reallocation. ; START OF ORIGINAL COMMENT ; This appears to be a table of ; execution addresses to jump to ML routines ; that handle the the IL instructions. ; You cannot add code to or relocate this program ; without updating these ; END OF ORIGINAL COMMENT ;.byte $9F,$17, $42,$1B, $3F,$1B, $7A,$17, $FC,$18, $95,$17, $9F,$17, $9F,$17 .byte <LBL067,>LBL067 .byte <LBL132,>LBL132 .byte <JUMP06,>JUMP06 .byte <JUMP07,>JUMP07 .byte <LBL035,>LBL035 .byte <LBL097,>LBL097 .byte <LBL067,>LBL067 .byte <LBL067,>LBL067 ;.byte $BD,$1A, $C1,$1A, $8A,$1A, $9B,$1A, $E9,$1A, $61,$17, $51,$17, $41,$1A .byte <JUMP08,>JUMP08 .byte <JUMP09,>JUMP09 .byte <JUMP10,>JUMP10 .byte <JUMP11,>JUMP11 .byte <JUMP12,>JUMP12 .byte <JUMP13,>JUMP13 .byte <JUMP14,>JUMP14 .byte <LBL071,>LBL071 ;.byte $52,$1A, $4F,$1A, $62,$1A, $E7,$19, $CD,$16, $06,$17, $9F,$17, $15,$18 .byte <JUMP15,>JUMP15 .byte <JUMP16,>JUMP16 .byte <JUMP17,>JUMP17 .byte <JUMP18,>JUMP18 .byte <JUMP19,>JUMP19 .byte <JUMP20,>JUMP20 .byte <LBL067,>LBL067 .byte <JUMP21,>JUMP21 ;.byte $A7,$17, $B7,$16, $BF,$16, $83,$18, $A1,$16, $9F,$17, $9F,$17, $A8,$18 .byte <JUMP22,>JUMP22 .byte <JUMP23,>JUMP23 .byte <LBL047,>LBL047 .byte <LBL081,>LBL081 .byte <LBL013,>LBL013 .byte <LBL067,>LBL067 .byte <LBL067,>LBL067 .byte <JUMP24,>JUMP24 ;.byte $4F,$1B, $4D,$1B, $07,$19, $AA,$14, $37,$17, $BD,$14, $1B,$1B, $B1,$1A .byte <JUMP25,>JUMP25 .byte <JUMP26,>JUMP26 .byte <JUMP27,>JUMP27 .byte <MEM_T2,>MEM_T2 .byte <JUMP28,>JUMP28 .byte <WARM_S,>WARM_S .byte <JUMP29,>JUMP29 .byte <JUMP30,>JUMP30 .byte $20,$41, $54,$20 ; No idea ???? .byte $80 ; No idea LBL002: .byte <ILTBL ;$70 ; $70 - lo byte of IL address LBL003: .byte >ILTBL ;$1B ; $1B - hi byte of IL address ; ;Begin Cold Start ; ; ; ; Load start of free ram ($1C00) into locations $0020 and $0022 ; The memory between $1000 and $1Bff (3 kB) is free for assembler programs ; that can be loaded and used simultaneously with TB. ; $1C00 to the end of writable memory is the BASIC memory space. ; COLD_S: lda #$00 ; Load accumulator with lo byte of lower and upper prg memory limits sta $20 ; Store in $20 sta $22 ; Store in $22 lda #$50 ; Load accumulator with hi byte of lower and upper prg memory limits sta $21 ; Store in $21 sta $23 ; Store in $23 ; NOTE: $22,$23 vector will be updated by routine below to be the upper RAM limit for TB. ; ; ; Begin test for free ram ; As a result, memory locations $20,$21 will contain lo,hi byte order address of lower RAM boundary ; and $22,$23 upper RAM boundary respectively. ; ldy #$01 ; Load register Y with $01 MEM_T: lda (C_22),Y ; Load accumulator With the contents of a byte of memory tax ; Save it to X eor #$FF ; Next 4 instuctions test to see if this memeory location sta (C_22),Y ; is ram by trying to write something new to it - new value cmp (C_22),Y ; gets created by XORing the old value with $FF - store the php ; result of the test on the stack to look at later txa ; Retrieve the old memory value sta (C_22),Y ; Put it back where it came from inc $22 ; Increment $22 (for next memory location) bne SKP_PI ; Goto $14A6 if we don't need to increment page inc $23 ; Increment $23 (for next memory page) SKP_PI: plp ; Now look at the result of the memory test beq MEM_T ; Go test the next mempry location if the last one was ram dey ; If last memory location did not test as ram, decrement Y (should be $00 now) MEM_T2: cld ; Make sure we're not in decimal mode lda $20 ; Load up the low-order by of the start of free ram adc SSS ; Add to the spare stack size sta $24 ; Store the result in $0024 tya ; Retrieve Y adc $21 ; And add it to the high order byte of the start of free ram (this does not look right) sta $25 ; Store the result in $0025 tya ; Retrieve Y again sta (C_20),Y ; Store A in the first byte of program memory iny ; Increment Y sta (C_20),Y ; Store A in the second byte of program memory ; ;Begin Warm Start; ; WARM_S: lda $22 sta $C6 sta $26 lda $23 sta $C7 sta $27 jsr LBL001 ; Go print CR, LF and pad charachters LBL014: lda LBL002 sta $2A lda LBL003 sta $2B lda #$80 sta $C1 lda #$30 sta $C0 ldx #$00 stx $BE stx $C2 dex txs LBL006: cld jsr LBL004 ; Go read a byte from the TBIL table jsr LBL005 jmp LBL006 ; ; ; .byte $83 ; No idea about this .byte $65 ; No idea about this ; ; ; Routine to service the TBIL Instructions ; LBL005: cmp #$30 ; bcs LBL011 ; If it's $30 or higher, it's a Branch or Jump - go handle it cmp #$08 ; bcc LBL007 ; If it's less than $08 it's a stack exchange - go handle it asl ; Multiply the OP code by 2 tax ; Transfer it to X LBL022: lda SR_V_H,X ; Get the hi byte of the OP Code handling routine pha ; and save it on the stack lda SR_V_L,X ; Get the lo byte pha ; and save it on the stack php ; save the processor status too rti ; now go execute the OP Code handling routine ; ; ; Routine to handle the stack exchange ; LBL007: adc $C1 tax lda (C_C1),Y pha lda $00,X sta (C_C1),Y pla sta $00,X rts ; ; ; LBL015: jsr LBL001 ; Go print CR, LF and pad charachters lda #$21 ; Load an ASCII DC2 jsr OUT_V ; Go print it lda $2A ; Load the current TBIL pointer (lo) sec ; Set the carry flag sbc LBL002 ; Subtract the TBIL table origin (lo) tax ; Move the difference to X lda $2B ; Load the current TBIL pointer (hi) sbc LBL003 ; Subtract the TBIL table origin (hi) jsr LBL010 lda $BE beq LBL012 lda #$7E sta $2A lda #$20 sta $2B jsr LBL013 ldx $28 lda $29 jsr LBL010 LBL012: lda #$07 ; ASCII Bell jsr OUT_V ; Go ring Bell jsr LBL001 ; Go print CR, LF and pad charachters LBL060: lda $26 sta $C6 lda $27 sta $C7 jmp LBL014 ; ; ; LBL115: ldx #$7C LBL048: cpx $C1 LBL019: bcc LBL015 ldx $C1 inc $C1 inc $C1 clc rts ; ; ; JUMP01: dec $BD LBL027: lda $BD beq LBL015 LBL017: lda $BC sta $2A lda $BD sta $2B rts ; ; Branch handling routine ; LBL011: cmp #$40 ; bcs LBL016 ; If it's not a Jump, go to branch handler pha jsr LBL004 ; Go read a byte from the TBIL table adc LBL002 sta $BC pla pha and #$07 adc LBL003 sta $BD pla and #$08 bne LBL017 lda $BC ldx $2A sta $2A stx $BC lda $BD ldx $2B sta $2B stx $BD LBL126: lda $C6 sbc #$01 sta $C6 bcs LBL018 dec $C7 LBL018: cmp $24 lda $C7 sbc $25 bcc LBL019 lda $BC sta (C_C6),Y iny lda $BD sta (C_C6),Y rts ; ;Branch handler ; LBL016: pha lsr lsr lsr lsr and #$0E tax pla cmp #$60 and #$1F bcs LBL020 ora #$E0 LBL020: clc beq LBL021 adc $2A sta $BC tya adc $2B LBL021: sta $BD JMP LBL022 ; ; ; JUMP02: lda $2C sta $B8 lda $2D sta $B9 LBL025: jsr LBL023 jsr LBL024 eor (C_2A),Y tax jsr LBL004 ; Go read a byte from the TBIL table txa beq LBL025 asl beq LBL026 lda $B8 sta $2C lda $B9 sta $2D LBL028: jmp LBL027 JUMP05: jsr LBL023 cmp #$0D bne LBL028 LBL026: rts ; ; ; JUMP03: jsr LBL023 cmp #$5B bcs LBL028 cmp #$41 bcc LBL028 asl jsr LBL029 LBL024: ldy #$00 lda (C_2C),Y inc $2C bne LBL030 inc $2D LBL030: cmp #$0D clc rts ; ; LBL031: jsr LBL024 LBL023: lda (C_2C),Y cmp #$20 beq LBL031 cmp #$3A clc bpl LBL032 cmp #$30 LBL032: rts ; ; ; JUMP04: jsr LBL023 bcc LBL028 sty $BC sty $BD LBL033: lda $BC ldx $BD asl $BC rol $BD asl $BC rol $BD clc adc $BC sta $BC txa adc $BD asl $BC rol sta $BD jsr LBL024 and #$0F adc $BC sta $BC tya adc $BD sta $BD jsr LBL023 bcs LBL033 jmp LBL034 LBL061: jsr LBL035 lda $BC ora $BD beq LBL036 LBL065: lda $20 sta $2C lda $21 sta $2D LBL040: jsr LBL037 beq LBL038 lda $28 cmp $BC lda $29 sbc $BD bcs LBL038 LBL039: jsr LBL024 bne LBL039 jmp LBL040 LBL038: lda $28 eor $BC bne LBL041 lda $29 eor $BD LBL041: rts ; ; ; LBL043: jsr LBL042 LBL013: jsr LBL004 ; Entry point for TBIL PC (print literal) - Go read a byte from the TBIL table bpl LBL043 ; LBL042: inc $BF bmi LBL044 jmp OUT_V ; Go print it LBL044: dec $BF LBL045: rts ; ; ; LBL046: cmp #$22 beq LBL045 jsr LBL042 JUMP23: jsr LBL024 bne LBL046 LBL036: jmp LBL015 LBL047: lda #$20 jsr LBL042 lda $BF and #$87 bmi LBL045 bne LBL047 rts ; ; ; JUMP19: ldx #$7B jsr LBL048 inc $C1 inc $C1 inc $C1 sec lda $03,X sbc $00,X sta $00,X lda $04,X sbc $01,X bvc LBL052 eor #$80 ora #$01 LBL052: bmi LBL053 bne LBL054 ora $00,X beq LBL049 LBL054: lsr $02,X LBL049: lsr $02,X LBL053: lsr $02,X bcc LBL050 LBL004: ldy #$00 ; Read a byte from the TBIL Table lda (C_2A),Y ; inc $2A ; Increment TBIL Table pointer as required bne LBL051 ; inc $2B ; LBL051: ora #$00 ; Check for $00 and set the 'Z' flag acordingly LBL050: rts ; Return ; ; ; JUMP20: lda $BE beq LBL055 LBL056: jsr LBL024 bne LBL056 jsr LBL037 beq LBL057 LBL062: jsr LBL058 jsr BREAK bcs LBL059 lda $C4 sta $2A lda $C5 sta $2B rts ; ; ; LBL059: lda LBL002 sta $2A lda LBL003 sta $2B LBL057: jmp LBL015 LBL055: sta $BF jmp LBL060 JUMP28: lda $20 sta $2C lda $21 sta $2D jsr LBL037 beq LBL057 lda $2A sta $C4 lda $2B sta $C5 LBL058: lda #$01 sta $BE rts ; ; ; JUMP14: jsr LBL061 beq LBL062 LBL066: lda $BC sta $28 lda $BD sta $29 jmp LBL015 JUMP13: jsr LBL063 jsr LBL064 jsr LBL065 bne LBL066 rts ; ; ; LBL037: jsr LBL024 sta $28 jsr LBL024 sta $29 ora $28 rts ; ; ; JUMP07: jsr LBL035 jsr LBL034 LBL034: lda $BD LBL131: jsr LBL029 lda $BC LBL029: ldx $C1 dex sta $00,X stx $C1 cpx $C0 bne LBL067 LBL068: jmp LBL015 LBL097: ldx $C1 cpx #$80 bpl LBL068 lda $00,X inc $C1 LBL067: rts ; ; ; LBL010: sta $BD stx $BC jmp LBL069 JUMP22: ldx $C1 ; entry point to TBIL PN (print number) lda $01,X bpl LBL070 jsr LBL071 lda #$2D jsr LBL042 LBL070: jsr LBL035 LBL069: lda #$1F sta $B8 sta $BA lda #$2A sta $B9 sta $BB ldx $BC ldy $BD sec LBL072: inc $B8 txa sbc #$10 tax tya sbc #$27 tay bcs LBL072 LBL073: dec $B9 txa adc #$E8 tax tya adc #$03 tay bcc LBL073 txa LBL074: sec inc $BA sbc #$64 bcs LBL074 dey bpl LBL074 LBL075: dec $BB adc #$0A bcc LBL075 ora #$30 sta $BC lda #$20 sta $BD ldx #$FB LBL199: stx $C3 lda $BD,X ora $BD cmp #$20 beq LBL076 ldy #$30 sty $BD ora $BD jsr LBL042 LBL076: ldx $C3 inx bne LBL199 rts ; ; ; JUMP21: lda $2D pha lda $2C pha lda $20 sta $2C lda $21 sta $2D lda $24 ldx $25 jsr LBL077 beq LBL078 jsr LBL077 LBL078: lda $2C sec sbc $B6 lda $2D sbc $B7 bcs LBL079 jsr LBL037 beq LBL079 ldx $28 lda $29 jsr LBL010 lda #$20 LBL080: jsr LBL042 jsr BREAK bcs LBL079 jsr LBL024 bne LBL080 jsr LBL081 jmp LBL078 LBL077: sta $B6 inc $B6 bne LBL082 inx LBL082: stx $B7 ldy $C1 cpy #$80 beq LBL083 jsr LBL061 LBL099: lda $2C ldx $2D sec sbc #$02 bcs LBL084 dex LBL084: sta $2C jmp LBL085 LBL079: pla sta $2C pla sta $2D LBL083: rts LBL081: lda $BF bmi LBL083 ; ; ; Routine to handle CR, LF and pad characters in the ouput ; LBL001: lda #$0D ; Load up a CR jsr OUT_V ; Go print it lda PCC ; Load the pad character code and #$7F ; Test to see - sta $BF ; how many pad charachters to print beq LBL086 ; Skip if 0 LBL088: jsr LBL087 ; Go print pad charcter dec $BF ; One less bne LBL088 ; Loop until 0 LBL086: lda #$0A ; Load up a LF jmp LBL089 ; Go print it ; ; ; LBL092: ldy TMC LBL091: sty $BF bcs LBL090 JUMP24: lda #$30 ; Entry pont for TBIL GL (get input line) sta $2C sta $C0 sty $2D jsr LBL034 LBL090: eor $80 sta $80 jsr IN_V ldy #$00 ldx $C0 and #$7F beq LBL090 cmp #$7F beq LBL090 cmp #$13 beq LBL091 cmp #$0A beq LBL092 cmp LSC beq LBL093 cmp BSC bne LBL094 cpx #$30 bne LBL095 LBL093: ldx $2C sty $BF lda #$0D LBL094: cpx $C1 bmi LBL096 lda #$07 jsr LBL042 jmp LBL090 LBL096: sta $00,X inx inx LBL095: dex stx $C0 cmp #$0D bne LBL090 jsr LBL081 LBL035: jsr LBL097 sta $BC jsr LBL097 sta $BD rts ; ; ; JUMP27: jsr LBL098 jsr LBL061 php jsr LBL099 sta $B8 stx $B9 lda $BC sta $B6 lda $BD sta $B7 ldx #$00 plp bne LBL100 jsr LBL037 dex dex LBL101: dex jsr LBL024 bne LBL101 LBL100: sty $28 sty $29 jsr LBL098 lda #$0D cmp (C_2C),Y beq LBL102 inx inx inx LBL103: inx iny cmp (C_2C),Y bne LBL103 lda $B6 sta $28 lda $B7 sta $29 LBL102: lda $B8 sta $BC lda $B9 sta $BD clc ldy #$00 txa beq LBL104 bpl LBL105 adc $2E sta $B8 lda $2F sbc #$00 sta $B9 LBL109: lda (C_2E),Y sta (C_B8),Y ldx $2E cpx $24 bne LBL106 lda $2F cmp $25 beq LBL107 LBL106: inx stx $2E bne LBL108 inc $2F LBL108: inc $B8 bne LBL109 inc $B9 bne LBL109 LBL105: adc $24 sta $B8 sta $2E tya adc $25 sta $B9 sta $2F lda $2E sbc $C6 lda $2F sbc $C7 bcc LBL110 dec $2A jmp LBL015 LBL110: lda (C_24),Y sta (C_2E),Y ldx $24 bne LBL111 dec $25 LBL111: dec $24 ldx $2E bne LBL112 dec $2F LBL112: dex stx $2E cpx $BC bne LBL110 ldx $2F cpx $BD bne LBL110 LBL107: lda $B8 sta $24 lda $B9 sta $25 LBL104: lda $28 ora $29 beq LBL113 lda $28 sta (C_BC),Y iny lda $29 sta (C_BC),Y LBL114: iny sty $B6 jsr LBL024 php ldy $B6 sta (C_BC),Y plp bne LBL114 LBL113: jmp LBL014 JUMP18: jsr LBL115 lda $03,X and #$80 beq LBL116 lda #$FF LBL116: sta $BC sta $BD pha adc $02,X sta $02,X pla pha adc $03,X sta $03,X pla eor $01,X sta $BB bpl LBL117 jsr LBL118 LBL117: ldy #$11 lda $00,X ora $01,X bne LBL119 jmp LBL015 LBL119: sec lda $BC sbc $00,X pha lda $BD sbc $01,X pha eor $BD bmi LBL120 pla sta $BD pla sta $BC sec jmp LBL121 LBL120: pla pla clc LBL121: rol $02,X rol $03,X rol $BC rol $BD dey bne LBL119 lda $BB bpl LBL122 LBL071: ldx $C1 LBL118: sec tya sbc $00,X sta $00,X tya sbc $01,X sta $01,X LBL122: rts ; ; ; JUMP16: jsr LBL071 JUMP15: jsr LBL115 lda $00,X adc $02,X sta $02,X lda $01,X adc $03,X sta $03,X rts ; ; ; JUMP17: jsr LBL115 ldy #$10 lda $02,X sta $BC lda $03,X sta $BD LBL124: asl $02,X rol $03,X rol $BC rol $BD bcc LBL123 clc lda $02,X adc $00,X sta $02,X lda $03,X adc $01,X sta $03,X LBL123: dey bne LBL124 rts ; ; ; JUMP10: jsr LBL097 tax lda $00,X ldy $01,X dec $C1 ldx $C1 sty $00,X jmp LBL029 JUMP11: ldx #$7D jsr LBL048 lda $01,X pha lda $00,X pha jsr LBL097 tax pla sta $00,X pla sta $01,X rts JUMP30: jsr LBL063 lda $BC sta $2A lda $BD sta $2B rts ; ; ; JUMP08: ldx #$2C ; Entry point to Save Basic Pointer SB bne LBL125 JUMP09: ldx #$2E LBL125: lda $00,X cmp #$80 bcs LBL098 lda $01,X bne LBL098 lda $2C sta $2E lda $2D sta $2F rts ; ; ; LBL098: lda $2C ldy $2E sty $2C sta $2E lda $2D ldy $2F sty $2D sta $2F ldy #$00 rts ; ; ; JUMP12: lda $28 sta $BC lda $29 sta $BD jsr LBL126 lda $C6 sta $26 lda $C7 LBL064: sta $27 LBL129: rts ; ; ; LBL063: lda (C_C6),Y sta $BC jsr LBL127 lda (C_C6),Y sta $BD LBL127: inc $C6 bne LBL128 inc $C7 LBL128: lda $22 cmp $C6 lda $23 sbc $C7 bcs LBL129 jmp LBL015 JUMP29: jsr LBL130 sta $BC tya jmp LBL131 LBL130: jsr LBL035 lda $BC sta $B6 jsr LBL035 lda $BD sta $B7 ldy $BC jsr LBL035 ldx $B7 lda $B6 clc jmp (C_00BC) JUMP06: jsr LBL132 LBL132: jsr LBL004 ; Go read a byte from the TBIL Table jmp LBL029 LBL085: stx $2D cpx #$00 rts ; ; ; JUMP26: ldy #$02 JUMP25: sty $BC ldy #$29 sty $BD ldy #$00 lda (C_BC),Y cmp #$08 bne LBL133 jmp LBL117 LBL133: rts ; ; ; Subroutine to decide which pad character to print ; LBL089: jsr OUT_V ; Entry point with a charater to print first LBL087: lda #$FF ; Normal entry point - Set pad to $FF bit PCC ; Check if the pad flag is on bmi LBL134 ; Skip it if not lda #$00 ; set pad to $00 LBL134: jmp OUT_V ; Go print it ; ; TBIL Tables ; ILTBL: .byte $24, $3A, $91, $27, $10, $E1, $59, $C5, $2A, $56, $10, $11, $2C, $8B, $4C .byte $45, $D4, $A0, $80, $BD, $30, $BC, $E0, $13, $1D, $94, $47, $CF, $88, $54 .byte $CF, $30, $BC, $E0, $10, $11, $16, $80, $53, $55, $C2, $30, $BC, $E0, $14 .byte $16, $90, $50, $D2, $83, $49, $4E, $D4, $E5, $71, $88, $BB, $E1, $1D, $8F .byte $A2, $21, $58, $6F, $83, $AC, $22, $55, $83, $BA, $24, $93, $E0, $23, $1D .byte $30, $BC, $20, $48, $91, $49, $C6, $30, $BC, $31, $34, $30, $BC, $84, $54 .byte $48, $45, $CE, $1C, $1D, $38, $0D, $9A, $49, $4E, $50, $55, $D4, $A0, $10 .byte $E7, $24, $3F, $20, $91, $27, $E1, $59, $81, $AC, $30, $BC, $13, $11, $82 .byte $AC, $4D, $E0, $1D, $89, $52, $45, $54, $55, $52, $CE, $E0, $15, $1D, $85 .byte $45, $4E, $C4, $E0, $2D, $98, $4C, $49, $53, $D4, $EC, $24, $00, $00, $00 .byte $00, $0A, $80, $1F, $24, $93, $23, $1D, $30, $BC, $E1, $50, $80, $AC, $59 .byte $85, $52, $55, $CE, $38, $0A, $86, $43, $4C, $45, $41, $D2, $2B, $84, $52 .byte $45, $CD, $1D, $A0, $80, $BD, $38, $14, $85, $AD, $30, $D3, $17, $64, $81 .byte $AB, $30, $D3, $85, $AB, $30, $D3, $18, $5A, $85, $AD, $30, $D3, $19, $54 .byte $2F, $30, $E2, $85, $AA, $30, $E2, $1A, $5A, $85, $AF, $30, $E2, $1B, $54 .byte $2F, $98, $52, $4E, $C4, $0A, $80, $80, $12, $0A, $09, $29, $1A, $0A, $1A .byte $85, $18, $13, $09, $80, $12, $01, $0B, $31, $30, $61, $72, $0B, $04, $02 .byte $03, $05, $03, $1B, $1A, $19, $0B, $09, $06, $0A, $00, $00, $1C, $17, $2F .byte $8F, $55, $53, $D2, $80, $A8, $30, $BC, $31, $2A, $31, $2A, $80, $A9, $2E .byte $2F, $A2, $12, $2F, $C1, $2F, $80, $A8, $30, $BC, $80, $A9, $2F, $83, $AC .byte $38, $BC, $0B, $2F, $80, $A8, $52, $2F, $84, $BD, $09, $02, $2F, $8E, $BC .byte $84, $BD, $09, $93, $2F, $84, $BE, $09, $05, $2F, $09, $91, $2F, $80, $BE .byte $84, $BD, $09, $06, $2F, $84, $BC, $09, $95, $2F, $09, $04, $2F, $00, $00 .byte $00 ; ; End of Tiny Basic .segment "MAIN" .org $4CF0 ; Address of main program ; Code needs work below here, BIOS must be changed for MKHBC-8-R1 ;FBLK: ; ; Set some symbols ; ;ACIARW = $1200 ; Base address of ACIA ;ACIAST = ACIARW+$01 ; ACIA status register ;ACIACM = ACIARW+$02 ; ACIA commnad register ;ACIACN = ACIARW+$03 ; ACIA control register ; ; Begin base system initialization ; ; jmp main ; no 6522 on MKHBC-8-R1 ;-------------------- ; sta ACIAST ; Do a soft reset on the ACIA ; lda #$0B ; Set it up for : ; sta ACIACM ; no echo, no parity, RTS low, No IRQ, DTR low ; lda #$1A ; and : ; sta ACIACN ; 2400, 8 bits, 1 stop bit, external Rx clock ;-------------------- main: cli cld jsr CLRSC ; Go clear the screen ldy #$00 ; Offset for welcome message and prompt jsr SNDMSG ; Go print it ST_LP: JSR GetCh ; Go get a character from the console cmp #$43 ; Check for 'C' BNE IS_WRM ; If not branch to next check jmp COLD_S ; Otherwise cold-start Tiny Basic IS_WRM: cmp #$57 ; Check for 'W' BNE PRMPT ; If not, branch to re-prompt them jmp WARM_S ; Otherwise warm-start Tiny Basic PRMPT: ldy #$00 ; Offset of prompt jsr SNDMSG ; Go print the prompt jmp ST_LP ; Go get the response .segment "MESG" .org $4E00 ; Address of message area MBLK: ; ; The message block begins at $4E00 and is at most 256 bytes long. ; Messages terminate with an FF. ; .byte "MKHBC-8-R2 TINY BASIC 6502 PORT" .byte $0D, $0A ;, $0A .byte "Adapted from OMEGA MICRO SYSTEMS." .byte $0D, $0A ;, $0A .byte "Version: 1.0.3, 3/31/2016" .byte $0D, $0A ;, $0A .byte "(NOTE: Use upper case letters.)" .byte $0D, $0A ;, $0A .byte "Boot ([C]old/[W]arm)? " .byte $07, $FF .segment "SUBR" .org $4F00 ;address of subroutine area SBLK: ; ; Begin BIOS subroutines ; ; M.O.S. API defines. StrPtr = $E0 ;SNDCHR = PutCh ;RCCHR = GetCh ; ; Clear the screen ; ESC = $1b ; 2-BYTE PEEK USR FUNCTION ; For TINY BASIC IL ASSEMBLER VERSION 0 TwoBytePeek: STX $C3 ;($C2=00) LDA ($C2),Y ;GET MSB PHA ;SAVE IT INY LDA ($C2),Y ;GET LSB TAX PLA TAY ;Y=MSB TXA RTS ;ClrScrCode: ; .BYTE ESC,"[2J",0 ;clear screen sequence (ANSI). ;ClearScreen: ; lda #<ClrScrCode ; sta StrPtr ; lda #>ClrScrCode ; sta StrPtr+1 ; jsr Puts ; rts CLRSC: ldx #$19 ; Load X - we're going tp print 25 lines lda #$0D ; CR jsr PutCh ; Send a carriage retuen lda #$0A ; LF CSLP: jsr PutCh ; Send the line feed dex ; One less to do bne CSLP ; Go send another untill we're done rts ; Return ; ; Print a message. ; This sub expects the messsage offset from MBLK in X. ; SNDMSG: lda MBLK,y ; Get a character from teh message block cmp #$FF ; Look for end of message marker beq EXSM ; Finish up if it is jsr PutCh ; Otherwise send the character iny ; Increment the pointer jmp SNDMSG ; Go get next character EXSM: rts ; Return ; ; Get a character from the character input device ; Runs into SNDCHR to provide echo ; RCCHR: lda $E001 ; Check if a character typed (for emulator, non-blocking) beq RCCHR ; Loop until we get one (for emulator) cmp #'a' ; < 'a'? bcc SNDCHR ; yes, done cmp #'{' ; >= '{'? bcs SNDCHR ; yes, done and #$5f ; convert to upper case ; ; Send a character to the character output device ; SNDCHR: sta $FE ; Save the character to be printed cmp #$FF ; Check for a bunch of characters beq EXSC ; that we don't want to print to cmp #$00 ; the terminal and discard them to beq EXSC ; clean up the output cmp #$91 ; beq EXSC ; cmp #$93 ; beq EXSC ; cmp #$80 ; beq EXSC ; SCLP: lda $FE ; Restore the character sta $E000 ; Transmit it (for emulator) EXSC: rts ; Return ; Kernel jump table ;GetCh = $FFED ;PutCh = $FFF0 ;Gets = $FFF3 ;Puts = $FFF6 ; String I/O not used at this time. STRIN: rts STROUT: rts ; Vector jumps handlers NmiHandle: rti RstHandle: jmp main IrqHandle: rti .segment "KERN" .ORG $FFED GetCh: jmp RCCHR PutCh: jmp SNDCHR Gets: jmp STRIN Puts: jmp STROUT .segment "VECT" .ORG $FFFA .byte <NmiHandle, >NmiHandle, <RstHandle, >RstHandle, <IrqHandle, >IrqHandle ;--------------------------- END ----------------------------------------------------------------------
; A085441: a(n) = Sum_{i=1..n} binomial(i+1,2)^6. ; 1,730,47386,1047386,12438011,98204132,580094436,2756876772,11060642397,38741283022,121395233038,346594833742,914464085783,2254559726408,5240543726408,11568062614344,24395756421273,49397866465794,96443747465794,182209868465794,334149783550675,596404391103404,1038437187083180,1767437187083180,2945857353098805,4815862056188406,7732958575251510,12211702184360566,18987111575126191,29096333191516816,43986174148448912,65653411221443216,96826308434470577,141197571798236202,203721074007236202,290987135352859818,411693994669231147,577236394918729588,802435995622729588,1106442667046729588,1513840682142948749,2055999470288411678,2772715005933178974,3714195155334178974,4943450481678694599,6539161205629637080,8599101333946356184,11244212509728166360,14623433017784806985,18919401719200822610,24355172619966071186,31202093437675342290,39789021064645114371,50513068391415879996,63852100717111879996,80379226108052453692,100779552759203947621,125869517861095789382,156619126885384789382,194177479794553789382,239902001686439312223,295391840045938443552,362525939350698132768,443506356534442132768,540907438034144023393,657731541132968268154,797472049371855126458,964184504265992092154,1162566753770938482779,1398049102255652998404,1676895537531470617860,2006317208149592648964,2394599429124862015165,2851243606898543655790,3387125595164168655790,4014672122614015913966,4748057072204955288695,5603419539696839043176,6599105757510855043176,7755937138937031043176,9097506877959093359097,10650507732053303717026,12445093819870956942562,14515279483370805942562,16899378495390929083187,19640487139527468199628,22787014950233716080332,26393267178006787935948,30520083338156862951573,35235536512749379842198,40615698404695267806934,46745475491488599081238,53719521994634581970959,61643235770283173361584,70633843637925029361584,80821583098188617758640,92350987848803694372369,105382284990703323488970,120092912325093948488970,136679164678234573488970 lpb $0 mov $2,$0 sub $0,1 add $2,2 bin $2,2 pow $2,6 add $1,$2 lpe add $1,1 mov $0,$1
; A202638: y-values in the solution to x^2 - 7*y^2 = -3. ; Submitted by Christian Krause ; 1,2,14,31,223,494,3554,7873,56641,125474,902702,1999711,14386591,31869902,229282754,507918721,3654137473,8094829634,58236916814,129009355423,928136531551,2056054857134,14791947588002,32767868358721,235743024876481,522229838882402,3757096450435694,8322909553759711,59877800182094623,132644323021272974,954287706463078274,2113986258786607873,15208725503227157761,33691135817564452994,242385320345171445902,536944186822244640031,3862956400019515976671,8557415853338349787502,61564917079967084180834 mov $4,$0 mov $6,2 lpb $6 mov $0,$4 mov $2,0 sub $6,1 add $0,$6 mul $0,2 mov $1,4 mov $3,1 lpb $0 sub $0,1 add $2,$3 mov $3,$1 mov $1,$2 dif $2,4 add $3,$2 lpe mov $0,$3 div $0,7 mov $7,$6 mul $7,$0 add $5,$7 lpe min $4,1 mul $4,$0 mov $0,$5 sub $0,$4
// Copyright (c) 2016 Tin Project. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include <time.h> #include "base/basictypes.h" #include "base/time/time.h" namespace tin { /* Available from 2.6.32 onwards. */ #ifndef CLOCK_MONOTONIC_COARSE # define CLOCK_MONOTONIC_COARSE 6 #endif int64 Now() { int64 t = base::Time::Now().ToTimeT(); // to nano seconds. return t * 1000000000LL; } #if !defined(OS_MACOSX) int64 MonoNow() { static clock_t fast_clock_id = -1; struct timespec t; // ignore data race currently, it's harmless. if (fast_clock_id == -1) { if (clock_getres(CLOCK_MONOTONIC_COARSE, &t) == 0 && t.tv_nsec <= 1 * 1000 * 1000) { fast_clock_id = CLOCK_MONOTONIC_COARSE; } else { fast_clock_id = CLOCK_MONOTONIC; } } clock_t clock_id = fast_clock_id; if (clock_gettime(clock_id, &t)) return 0; /* Not really possible. */ return t.tv_sec * 1000000000LL + t.tv_nsec; } #else int64 MonoNow() { int64 t = base::TimeTicks::Now().ToInternalValue() * 1000; // to nano seconds. return t; } #endif int32 NowSeconds() { int64 millisecond = Now() / 1000000000LL; return static_cast<uint32>(millisecond); } } // namespace tin
/*========================================================================= Program: Visualization Toolkit Module: vtkExtractEdges.cxx Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen All rights reserved. See Copyright.txt or http://www.kitware.com/Copyright.htm for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notice for more information. =========================================================================*/ #include "vtkExtractEdges.h" #include "vtkCellArray.h" #include "vtkCellData.h" #include "vtkDataSet.h" #include "vtkEdgeTable.h" #include "vtkGenericCell.h" #include "vtkInformation.h" #include "vtkInformationVector.h" #include "vtkMergePoints.h" #include "vtkObjectFactory.h" #include "vtkPointData.h" #include "vtkPolyData.h" #include "vtkIncrementalPointLocator.h" vtkStandardNewMacro(vtkExtractEdges); //---------------------------------------------------------------------------- // Construct object. vtkExtractEdges::vtkExtractEdges() { this->Locator = NULL; } //---------------------------------------------------------------------------- vtkExtractEdges::~vtkExtractEdges() { if ( this->Locator ) { this->Locator->UnRegister(this); this->Locator = NULL; } } //---------------------------------------------------------------------------- // Generate feature edges for mesh int vtkExtractEdges::RequestData( vtkInformation *vtkNotUsed(request), vtkInformationVector **inputVector, vtkInformationVector *outputVector) { // get the info objects vtkInformation *inInfo = inputVector[0]->GetInformationObject(0); vtkInformation *outInfo = outputVector->GetInformationObject(0); // get the input and output vtkDataSet *input = vtkDataSet::SafeDownCast( inInfo->Get(vtkDataObject::DATA_OBJECT())); vtkPolyData *output = vtkPolyData::SafeDownCast( outInfo->Get(vtkDataObject::DATA_OBJECT())); vtkPoints *newPts; vtkCellArray *newLines; vtkIdType numCells, cellNum, numPts, newId; int edgeNum, numEdgePts, numCellEdges; int i, abort = 0; vtkIdType pts[2]; vtkIdType pt1 = 0, pt2; double x[3]; vtkEdgeTable *edgeTable; vtkGenericCell *cell; vtkCell *edge; vtkPointData *pd, *outPD; vtkCellData *cd, *outCD; vtkDebugMacro(<<"Executing edge extractor"); // Check input // numPts=input->GetNumberOfPoints(); if ( (numCells=input->GetNumberOfCells()) < 1 || numPts < 1 ) { return 1; } // Set up processing // edgeTable = vtkEdgeTable::New(); edgeTable->InitEdgeInsertion(numPts); newPts = vtkPoints::New(); newPts->Allocate(numPts); newLines = vtkCellArray::New(); newLines->EstimateSize(numPts*4,2); pd = input->GetPointData(); outPD = output->GetPointData(); outPD->CopyAllocate(pd,numPts); cd = input->GetCellData(); outCD = output->GetCellData(); outCD->CopyAllocate(cd,numCells); cell = vtkGenericCell::New(); vtkIdList *edgeIds, *HEedgeIds=vtkIdList::New(); vtkPoints *edgePts, *HEedgePts=vtkPoints::New(); // Get our locator for merging points // if ( this->Locator == NULL ) { this->CreateDefaultLocator(); } this->Locator->InitPointInsertion (newPts, input->GetBounds()); // Loop over all cells, extracting non-visited edges. // vtkIdType tenth = numCells/10 + 1; for (cellNum=0; cellNum < numCells && !abort; cellNum++ ) { if ( ! (cellNum % tenth) ) //manage progress reports / early abort { this->UpdateProgress (static_cast<double>(cellNum) / numCells); abort = this->GetAbortExecute(); } input->GetCell(cellNum,cell); numCellEdges = cell->GetNumberOfEdges(); for (edgeNum=0; edgeNum < numCellEdges; edgeNum++ ) { edge = cell->GetEdge(edgeNum); numEdgePts = edge->GetNumberOfPoints(); // Tessellate higher-order edges if ( ! edge->IsLinear() ) { edge->Triangulate(0, HEedgeIds, HEedgePts); edgeIds = HEedgeIds; edgePts = HEedgePts; for ( i=0; i < (edgeIds->GetNumberOfIds()/2); i++ ) { pt1 = edgeIds->GetId(2*i); pt2 = edgeIds->GetId(2*i+1); edgePts->GetPoint(2*i, x); if ( this->Locator->InsertUniquePoint(x, pts[0]) ) { outPD->CopyData (pd,pt1,pts[0]); } edgePts->GetPoint(2*i+1, x); if ( this->Locator->InsertUniquePoint(x, pts[1]) ) { outPD->CopyData (pd,pt2,pts[1]); } if ( edgeTable->IsEdge(pt1,pt2) == -1 ) { edgeTable->InsertEdge(pt1, pt2); newId = newLines->InsertNextCell(2,pts); outCD->CopyData(cd, cellNum, newId); } } } //if non-linear edge else // linear edges { edgeIds = edge->PointIds; edgePts = edge->Points; for ( i=0; i < numEdgePts; i++, pt1=pt2, pts[0]=pts[1] ) { pt2 = edgeIds->GetId(i); edgePts->GetPoint(i, x); if ( this->Locator->InsertUniquePoint(x, pts[1]) ) { outPD->CopyData (pd,pt2,pts[1]); } if ( i > 0 && edgeTable->IsEdge(pt1,pt2) == -1 ) { edgeTable->InsertEdge(pt1, pt2); newId = newLines->InsertNextCell(2,pts); outCD->CopyData(cd, cellNum, newId); } }//if linear edge } }//for all edges of cell }//for all cells vtkDebugMacro(<<"Created " << newLines->GetNumberOfCells() << " edges"); // Update ourselves. // HEedgeIds->Delete(); HEedgePts->Delete(); edgeTable->Delete(); cell->Delete(); output->SetPoints(newPts); newPts->Delete(); output->SetLines(newLines); newLines->Delete(); output->Squeeze(); return 1; } //---------------------------------------------------------------------------- // Specify a spatial locator for merging points. By // default an instance of vtkMergePoints is used. void vtkExtractEdges::SetLocator(vtkIncrementalPointLocator *locator) { if ( this->Locator == locator ) { return; } if ( this->Locator ) { this->Locator->UnRegister(this); this->Locator = NULL; } if ( locator ) { locator->Register(this); } this->Locator = locator; this->Modified(); } //---------------------------------------------------------------------------- void vtkExtractEdges::CreateDefaultLocator() { if ( this->Locator == NULL ) { vtkMergePoints *locator = vtkMergePoints::New(); this->SetLocator(locator); locator->Delete(); } } //---------------------------------------------------------------------------- int vtkExtractEdges::FillInputPortInformation(int, vtkInformation *info) { info->Set(vtkAlgorithm::INPUT_REQUIRED_DATA_TYPE(), "vtkDataSet"); return 1; } //---------------------------------------------------------------------------- void vtkExtractEdges::PrintSelf(ostream& os, vtkIndent indent) { this->Superclass::PrintSelf(os,indent); if ( this->Locator ) { os << indent << "Locator: " << this->Locator << "\n"; } else { os << indent << "Locator: (none)\n"; } } //---------------------------------------------------------------------------- vtkMTimeType vtkExtractEdges::GetMTime() { vtkMTimeType mTime=this-> Superclass::GetMTime(); vtkMTimeType time; if ( this->Locator != NULL ) { time = this->Locator->GetMTime(); mTime = ( time > mTime ? time : mTime ); } return mTime; }
%define BE(a) ( ((((a)>>24)&0xFF) << 0) + ((((a)>>16)&0xFF) << 8) + ((((a)>>8)&0xFF) << 16) + ((((a)>>0)&0xFF) << 24)) ftyp_start: dd BE(ftyp_end - ftyp_start) dd "ftyp" db 0x6D, 0x69, 0x66, 0x31 ; brand(32) ('mif1') db 0x00, 0x00, 0x00, 0x00 ; version(32) db 0x6D, 0x69, 0x66, 0x31 ; compatible_brand(32) ('mif1') ftyp_end: meta_start: dd BE(meta_end - meta_start) dd "meta" db 0x00 ; version(8) db 0x00, 0x00, 0x00 ; flags(24) hdlr_start: dd BE(hdlr_end - hdlr_start) dd "hdlr" db 0x00 ; version(8) db 0x00, 0x00, 0x00 ; flags(24) db 0x00, 0x00, 0x00, 0x00 ; pre_defined(32) db 0x70, 0x69, 0x63, 0x74 ; handler_type(32) ('pict') db 0x00, 0x00, 0x00, 0x00 ; reserved1(32) db 0x00, 0x00, 0x00, 0x00 ; reserved2(32) db 0x00, 0x00, 0x00, 0x00 ; reserved3(32) db 0x70 ; name(8) ('p') db 0x69 ; name(8) ('i') db 0x63 ; name(8) ('c') db 0x74 ; name(8) ('t') db 0x00 ; name(8) hdlr_end: iloc_start: dd BE(iloc_end - iloc_start) dd "iloc" db 0x01 ; version(8) db 0x00, 0x00, 0x00 ; flags(24) db 0x44 ; offset_size(4) ('D') length_size(4) ('D') db 0x40 ; base_offset_size(4) ('@') index_size(4) ('@') db 0x00, 0x01 ; item_count(16) db 0x00, 0x01 ; item_ID(16) db 0x00, 0x00 ; reserved2(12) construction_method(4) db 0x00, 0x00 ; data_reference_index(16) dd BE(mdat_start - ftyp_start + 8) ; base_offset(32) db 0x00, 0x01 ; extent_count(16) db 0x00, 0x00, 0x00, 0x00 ; extent_offset(32) db 0x00, 0x00, 0x00, 0x01 ; extent_length(32) iloc_end: idat_start: dd BE(idat_end - idat_start) dd "idat" idat_end: iinf_start: dd BE(iinf_end - iinf_start) dd "iinf" db 0x00 ; version(8) db 0x00, 0x00, 0x00 ; flags(24) db 0x00, 0x01 ; entry_count(16) infe_start: dd BE(infe_end - infe_start) dd "infe" db 0x02 ; version(8) db 0x00, 0x00, 0x00 ; flags(24) db 0x00, 0x01 ; item_ID(16) db 0x00, 0x00 ; item_protection_index(16) db 0x61, 0x61, 0x61, 0x61 ; item_type(32) ('aaaa') db 0x69 ; item_name(8) ('i') db 0x6D ; item_name(8) ('m') db 0x61 ; item_name(8) ('a') db 0x67 ; item_name(8) ('g') db 0x65 ; item_name(8) ('e') db 0x00 ; item_name(8) infe_end: iinf_end: pitm_start: dd BE(pitm_end - pitm_start) dd "pitm" db 0x00 ; version(8) db 0x00, 0x00, 0x00 ; flags(24) db 0x00, 0x01 ; item_ID(16) pitm_end: iprp_start: dd BE(iprp_end - iprp_start) dd "iprp" ipco_start: dd BE(ipco_end - ipco_start) dd "ipco" avcC_start: dd BE(avcC_end - avcC_start) dd "avcC" db 0x00 ; configurationVersion(8) db 0x42 ; AVCProfileIndication(8) ('B') db 0x00 ; profile_compatibility(8) db 0x00 ; AVCLevelIndication(8) db 0x00 ; reserved7(6) lengthSizeMinusOne(2) db 0x00 ; reserved8(3) numOfSequenceParameterSets(5) db 0x00 ; numOfPictureParameterSets(8) avcC_end: ispe_start: dd BE(ispe_end - ispe_start) dd "ispe" db 0x00 ; version(8) db 0x00, 0x00, 0x00 ; flags(24) db 0x00, 0x00, 0x01, 0x40 ; image_width(32) db 0x00, 0x00, 0x00, 0xF0 ; image_height(32) ispe_end: pixi_start: dd BE(pixi_end - pixi_start) dd "pixi" pixi_end: ipco_end: ipma_start: dd BE(ipma_end - ipma_start) dd "ipma" db 0x00 ; version(8) db 0x00, 0x00, 0x00 ; flags(24) db 0x00, 0x00, 0x00, 0x01 ; entry_count(32) db 0x00, 0x01 ; item_ID(16) db 0x03 ; association_count(8) db 0x81 ; essential(1) property_index(7) db 0x02 ; essential(1) property_index(7) db 0x03 ; essential(1) property_index(7) ipma_end: iprp_end: meta_end: mdat_start: dd BE(mdat_end - mdat_start) dd "mdat" db 0x00, 0x00 mdat_end: ; vim: syntax=nasm
; A111199: Numbers n such that 4k + 9 is prime. ; 1,2,5,7,8,11,13,16,20,22,23,25,26,32,35,37,41,43,46,47,55,56,58,62,65,67,68,71,76,77,82,85,86,91,95,97,98,100,103,106,110,112,113,125,128,133,137,140,142,146,148,151,152,158,161,163,166,167,173,175,181,187,188,190,191,197,200,203,205,211,212,217,218,230,232,233,236,242,247,250,251,253,256,260,263,265,271,272,275,277,280,286,293,296,298,301,302,305,307,310 mov $1,1 add $1,$0 seq $1,5098 ; Numbers n such that 4n + 1 is prime. sub $1,2 mov $0,$1
; ****************************************************** ; Prob 9_10.1.........Study the LCD Interface and Write a code for LCD using AVR Micro controller . for AVR ; ****************************************************** .include "C:\VMLAB\include\m8def.inc" ; Define here Reset and interrupt vectors, if any reset: rjmp start reti ; Addr $01 reti ; Addr $02 reti ; Addr $03 reti ; Addr $04 reti ; Addr $05 reti ; Addr $06 Use 'rjmp myVector' reti ; Addr $07 to define a interrupt vector reti ; Addr $08 reti ; Addr $09 reti ; Addr $0A reti ; Addr $0B This is just an example reti ; Addr $0C Not all MCUs have the same reti ; Addr $0D number of interrupt vectors reti ; Addr $0E reti ; Addr $0F reti ; Addr $10 ; Program starts here after Reset start: LDI R21,HIGH(RAMEND) OUT SPH,R21 LDI R21,LOW(RAMEND) OUT SPL,R21 LDI R20,0XFF OUT DDRB,R20 OUT DDRD,R20 LDI R20,0X33 CALL COMMAND CALL DELAY_2MS LDI R20,0X32 CALL COMMAND CALL DELAY_2MS LDI R20,0X28 CALL COMMAND CALL DELAY_2MS LDI R20,0X0E CALL COMMAND CALL DELAY_2MS LDI R20,0X01 CALL COMMAND CALL DELAY_2MS LDI R20,0X06 CALL COMMAND CALL DELAY_2MS LDI R20,'H' CALL DATA LDI R20,'I' CALL DATA LDI R20,0XC0 CALL COMMAND LDI R20,'A' CALL DATA forever: rjmp forever COMMAND: MOV R19,R20 ANDI R19,0XF0 OUT PORTD,R19 CBI PORTB,5 SBI PORTB,4 CALL SHORTDELAY CBI PORTB,4 CALL DELAY_100US MOV R19,R20 SWAP R19 ANDI R19,0XF0 OUT PORTD,R19 SBI PORTB,4 CALL SHORTDELAY CBI PORTB,4 CALL DELAY_100US RET DATA: MOV R19,R20 ANDI R19,0XF0 OUT PORTD,R19 SBI PORTB,5 SBI PORTB,4 CALL SHORTDELAY CBI PORTB,4 CALL DELAY_100US MOV R19,R20 SWAP R19 ANDI R19,0XF0 OUT PORTD,R19 SBI PORTB,4 CALL SHORTDELAY CBI PORTB,4 CALL DELAY_100US RET SHORTDELAY: NOP NOP RET DELAY_100US: PUSH R17 LDI R17,60 D: CALL SHORTDELAY DEC R17 BRNE D POP R17 RET DELAY_2MS: LDI R17, -250 OUT TCNT0,R17 LDI R17,0X03 OUT TCCR0,R17 AGAIN1: IN R20,TIFR SBRS R20,TOV0 RJMP AGAIN1 LDI R17,0X00 OUT TCCR0,R17 LDI R17,(1<<TOV0) OUT TIFR,R17 RET
; int isspace(int c) SECTION code_ctype PUBLIC isspace EXTERN asm_isspace, error_zc isspace: inc h dec h jp nz, error_zc ld a,l call asm_isspace ld l,h ret c inc l ret
/** * \file QryWdbeUntRef1NError.cpp * API code for job QryWdbeUntRef1NError (implementation) * \copyright (C) 2016-2020 MPSI Technologies GmbH * \author Alexander Wirthmueller (auto-generation) * \date created: 5 Dec 2020 */ // IP header --- ABOVE #include "QryWdbeUntRef1NError.h" using namespace std; using namespace Sbecore; using namespace Xmlio; /****************************************************************************** class QryWdbeUntRef1NError::StatApp ******************************************************************************/ QryWdbeUntRef1NError::StatApp::StatApp( const uint firstcol , const uint jnumFirstdisp , const uint ncol , const uint ndisp ) : Block() { this->firstcol = firstcol; this->jnumFirstdisp = jnumFirstdisp; this->ncol = ncol; this->ndisp = ndisp; mask = {FIRSTCOL, JNUMFIRSTDISP, NCOL, NDISP}; }; bool QryWdbeUntRef1NError::StatApp::readXML( xmlXPathContext* docctx , string basexpath , bool addbasetag ) { clear(); bool basefound; if (addbasetag) basefound = checkUclcXPaths(docctx, basexpath, basexpath, "StatAppQryWdbeUntRef1NError"); else basefound = checkXPath(docctx, basexpath); string itemtag = "StatitemAppQryWdbeUntRef1NError"; if (basefound) { if (extractUintAttrUclc(docctx, basexpath, itemtag, "Si", "sref", "firstcol", firstcol)) add(FIRSTCOL); if (extractUintAttrUclc(docctx, basexpath, itemtag, "Si", "sref", "jnumFirstdisp", jnumFirstdisp)) add(JNUMFIRSTDISP); if (extractUintAttrUclc(docctx, basexpath, itemtag, "Si", "sref", "ncol", ncol)) add(NCOL); if (extractUintAttrUclc(docctx, basexpath, itemtag, "Si", "sref", "ndisp", ndisp)) add(NDISP); }; return basefound; }; set<uint> QryWdbeUntRef1NError::StatApp::comm( const StatApp* comp ) { set<uint> items; if (firstcol == comp->firstcol) insert(items, FIRSTCOL); if (jnumFirstdisp == comp->jnumFirstdisp) insert(items, JNUMFIRSTDISP); if (ncol == comp->ncol) insert(items, NCOL); if (ndisp == comp->ndisp) insert(items, NDISP); return(items); }; set<uint> QryWdbeUntRef1NError::StatApp::diff( const StatApp* comp ) { set<uint> commitems; set<uint> diffitems; commitems = comm(comp); diffitems = {FIRSTCOL, JNUMFIRSTDISP, NCOL, NDISP}; for (auto it = commitems.begin(); it != commitems.end(); it++) diffitems.erase(*it); return(diffitems); }; /****************************************************************************** class QryWdbeUntRef1NError::StatShr ******************************************************************************/ QryWdbeUntRef1NError::StatShr::StatShr( const uint ntot , const uint jnumFirstload , const uint nload ) : Block() { this->ntot = ntot; this->jnumFirstload = jnumFirstload; this->nload = nload; mask = {NTOT, JNUMFIRSTLOAD, NLOAD}; }; bool QryWdbeUntRef1NError::StatShr::readXML( xmlXPathContext* docctx , string basexpath , bool addbasetag ) { clear(); bool basefound; if (addbasetag) basefound = checkUclcXPaths(docctx, basexpath, basexpath, "StatShrQryWdbeUntRef1NError"); else basefound = checkXPath(docctx, basexpath); string itemtag = "StatitemShrQryWdbeUntRef1NError"; if (basefound) { if (extractUintAttrUclc(docctx, basexpath, itemtag, "Si", "sref", "ntot", ntot)) add(NTOT); if (extractUintAttrUclc(docctx, basexpath, itemtag, "Si", "sref", "jnumFirstload", jnumFirstload)) add(JNUMFIRSTLOAD); if (extractUintAttrUclc(docctx, basexpath, itemtag, "Si", "sref", "nload", nload)) add(NLOAD); }; return basefound; }; set<uint> QryWdbeUntRef1NError::StatShr::comm( const StatShr* comp ) { set<uint> items; if (ntot == comp->ntot) insert(items, NTOT); if (jnumFirstload == comp->jnumFirstload) insert(items, JNUMFIRSTLOAD); if (nload == comp->nload) insert(items, NLOAD); return(items); }; set<uint> QryWdbeUntRef1NError::StatShr::diff( const StatShr* comp ) { set<uint> commitems; set<uint> diffitems; commitems = comm(comp); diffitems = {NTOT, JNUMFIRSTLOAD, NLOAD}; for (auto it = commitems.begin(); it != commitems.end(); it++) diffitems.erase(*it); return(diffitems); }; /****************************************************************************** class QryWdbeUntRef1NError::StgIac ******************************************************************************/ QryWdbeUntRef1NError::StgIac::StgIac( const uint jnum , const uint jnumFirstload , const uint nload ) : Block() { this->jnum = jnum; this->jnumFirstload = jnumFirstload; this->nload = nload; mask = {JNUM, JNUMFIRSTLOAD, NLOAD}; }; bool QryWdbeUntRef1NError::StgIac::readXML( xmlXPathContext* docctx , string basexpath , bool addbasetag ) { clear(); bool basefound; if (addbasetag) basefound = checkUclcXPaths(docctx, basexpath, basexpath, "StgIacQryWdbeUntRef1NError"); else basefound = checkXPath(docctx, basexpath); string itemtag = "StgitemIacQryWdbeUntRef1NError"; if (basefound) { if (extractUintAttrUclc(docctx, basexpath, itemtag, "Si", "sref", "jnum", jnum)) add(JNUM); if (extractUintAttrUclc(docctx, basexpath, itemtag, "Si", "sref", "jnumFirstload", jnumFirstload)) add(JNUMFIRSTLOAD); if (extractUintAttrUclc(docctx, basexpath, itemtag, "Si", "sref", "nload", nload)) add(NLOAD); }; return basefound; }; void QryWdbeUntRef1NError::StgIac::writeXML( xmlTextWriter* wr , string difftag , bool shorttags ) { if (difftag.length() == 0) difftag = "StgIacQryWdbeUntRef1NError"; string itemtag; if (shorttags) itemtag = "Si"; else itemtag = "StgitemIacQryWdbeUntRef1NError"; xmlTextWriterStartElement(wr, BAD_CAST difftag.c_str()); writeUintAttr(wr, itemtag, "sref", "jnum", jnum); writeUintAttr(wr, itemtag, "sref", "jnumFirstload", jnumFirstload); writeUintAttr(wr, itemtag, "sref", "nload", nload); xmlTextWriterEndElement(wr); }; set<uint> QryWdbeUntRef1NError::StgIac::comm( const StgIac* comp ) { set<uint> items; if (jnum == comp->jnum) insert(items, JNUM); if (jnumFirstload == comp->jnumFirstload) insert(items, JNUMFIRSTLOAD); if (nload == comp->nload) insert(items, NLOAD); return(items); }; set<uint> QryWdbeUntRef1NError::StgIac::diff( const StgIac* comp ) { set<uint> commitems; set<uint> diffitems; commitems = comm(comp); diffitems = {JNUM, JNUMFIRSTLOAD, NLOAD}; for (auto it = commitems.begin(); it != commitems.end(); it++) diffitems.erase(*it); return(diffitems); };
; A189154: Number of n X 2 binary arrays without the pattern 0 0 1 1 diagonally, vertically or horizontally ; 4,16,64,225,784,2704,9216,31329,106276,360000,1218816,4124961,13957696,47224384,159769600,540516001,1828588644,6186137104,20927672896,70798034241,239508444816,810252019600,2741064339456,9272956793409,31370192828100,106124610822400,359017002689536,1214545849612225,4108779232057600,13899900676665600,47023027347460096,159077762384818369,538156215976246596,1820569439128204944,6158942298444289600,20835552555400694049,70486169412903805584,238453003109347685136,806680731327231222784,2728981366560749546401,9232077834223306972900,31231895600750068657216,105656746003387713904896,357434211445786615119841,1209191275942693342970944,4090664785279453623950400,13838619843230885908079616,46815715590922244748175969,158376431401290758182382244,535783629638050574741206416,1812543035906411021151153216,6131789168758659544329152641,20743694171820596840355696400,70175414720127149139968190736,237401727500961233617464868864,803124291394832421310457105025,2716950016405587439032841908100,9191376068112559268661156791296,31094202512138103729783160934400,105190933620932469049478658545025,355858379443048090659406683366400,1203860274462214882485899583292416,4072630136450625276559963543977984,13777609063257138930459520640278401,46609317600684257185180545353608324,157678192001760536194344944332195600,533421502669223005492849167324902464 add $0,2 seq $0,8937 ; a(n) = Sum_{k=0..n} T(k) where T(n) are the tribonacci numbers A000073. pow $0,2
/* 21days 特定类型异常 */ #include <iostream> #include <exception> using namespace std; int main() { cout << "Enter number of integers you wish to reserve" << endl; try { int input = 0; cin >> input; // Request memory space and then return it int* pReservedInts = new int[input]; // -1 delete[] pReservedInts; } catch(std::bad_alloc& exp) { cout << "Exception..." << exp.what() << endl; cout << "Go to end, sorry !" << endl; } catch(...) { cout << "Exception... Go to end, Sorry." << endl; } return 0; }
/*! \file */ /* ************************************************************************ * Copyright (c) 2020 Advanced Micro Devices, Inc. * * 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 "testing.hpp" template <typename T> void testing_csrgeam_bad_arg(const Arguments& arg) { static const size_t safe_size = 100; T h_alpha = 0.6; T h_beta = 0.2; // Create rocsparse handle rocsparse_local_handle handle; // Create matrix descriptors rocsparse_local_mat_descr descrA; rocsparse_local_mat_descr descrB; rocsparse_local_mat_descr descrC; // Allocate memory on device device_vector<rocsparse_int> dcsr_row_ptr_A(safe_size); device_vector<rocsparse_int> dcsr_col_ind_A(safe_size); device_vector<T> dcsr_val_A(safe_size); device_vector<rocsparse_int> dcsr_row_ptr_B(safe_size); device_vector<rocsparse_int> dcsr_col_ind_B(safe_size); device_vector<T> dcsr_val_B(safe_size); device_vector<rocsparse_int> dcsr_row_ptr_C(safe_size); device_vector<rocsparse_int> dcsr_col_ind_C(safe_size); device_vector<T> dcsr_val_C(safe_size); if(!dcsr_row_ptr_A || !dcsr_col_ind_A || !dcsr_val_A || !dcsr_row_ptr_B || !dcsr_col_ind_B || !dcsr_val_B || !dcsr_row_ptr_C || !dcsr_col_ind_C || !dcsr_val_C) { CHECK_HIP_ERROR(hipErrorOutOfMemory); return; } rocsparse_int nnz_C; // Test rocsparse_csrgeam_nnz() EXPECT_ROCSPARSE_STATUS(rocsparse_csrgeam_nnz(nullptr, safe_size, safe_size, descrA, safe_size, dcsr_row_ptr_A, dcsr_col_ind_A, descrB, safe_size, dcsr_row_ptr_B, dcsr_col_ind_B, descrC, dcsr_row_ptr_C, &nnz_C), rocsparse_status_invalid_handle); EXPECT_ROCSPARSE_STATUS(rocsparse_csrgeam_nnz(handle, safe_size, safe_size, nullptr, safe_size, dcsr_row_ptr_A, dcsr_col_ind_A, descrB, safe_size, dcsr_row_ptr_B, dcsr_col_ind_B, descrC, dcsr_row_ptr_C, &nnz_C), rocsparse_status_invalid_pointer); EXPECT_ROCSPARSE_STATUS(rocsparse_csrgeam_nnz(handle, safe_size, safe_size, descrA, safe_size, nullptr, dcsr_col_ind_A, descrB, safe_size, dcsr_row_ptr_B, dcsr_col_ind_B, descrC, dcsr_row_ptr_C, &nnz_C), rocsparse_status_invalid_pointer); EXPECT_ROCSPARSE_STATUS(rocsparse_csrgeam_nnz(handle, safe_size, safe_size, descrA, safe_size, dcsr_row_ptr_A, nullptr, descrB, safe_size, dcsr_row_ptr_B, dcsr_col_ind_B, descrC, dcsr_row_ptr_C, &nnz_C), rocsparse_status_invalid_pointer); EXPECT_ROCSPARSE_STATUS(rocsparse_csrgeam_nnz(handle, safe_size, safe_size, descrA, safe_size, dcsr_row_ptr_A, dcsr_col_ind_A, nullptr, safe_size, dcsr_row_ptr_B, dcsr_col_ind_B, descrC, dcsr_row_ptr_C, &nnz_C), rocsparse_status_invalid_pointer); EXPECT_ROCSPARSE_STATUS(rocsparse_csrgeam_nnz(handle, safe_size, safe_size, descrA, safe_size, dcsr_row_ptr_A, dcsr_col_ind_A, descrB, safe_size, nullptr, dcsr_col_ind_B, descrC, dcsr_row_ptr_C, &nnz_C), rocsparse_status_invalid_pointer); EXPECT_ROCSPARSE_STATUS(rocsparse_csrgeam_nnz(handle, safe_size, safe_size, descrA, safe_size, dcsr_row_ptr_A, dcsr_col_ind_A, descrB, safe_size, dcsr_row_ptr_B, nullptr, descrC, dcsr_row_ptr_C, &nnz_C), rocsparse_status_invalid_pointer); EXPECT_ROCSPARSE_STATUS(rocsparse_csrgeam_nnz(handle, safe_size, safe_size, descrA, safe_size, dcsr_row_ptr_A, dcsr_col_ind_A, descrB, safe_size, dcsr_row_ptr_B, dcsr_col_ind_B, nullptr, dcsr_row_ptr_C, &nnz_C), rocsparse_status_invalid_pointer); EXPECT_ROCSPARSE_STATUS(rocsparse_csrgeam_nnz(handle, safe_size, safe_size, descrA, safe_size, dcsr_row_ptr_A, dcsr_col_ind_A, descrB, safe_size, dcsr_row_ptr_B, dcsr_col_ind_B, descrC, nullptr, &nnz_C), rocsparse_status_invalid_pointer); EXPECT_ROCSPARSE_STATUS(rocsparse_csrgeam_nnz(handle, safe_size, safe_size, descrA, safe_size, dcsr_row_ptr_A, dcsr_col_ind_A, descrB, safe_size, dcsr_row_ptr_B, dcsr_col_ind_B, descrC, dcsr_row_ptr_C, nullptr), rocsparse_status_invalid_pointer); // Test rocsparse_csrgeam() EXPECT_ROCSPARSE_STATUS(rocsparse_csrgeam<T>(nullptr, safe_size, safe_size, &h_alpha, descrA, safe_size, dcsr_val_A, dcsr_row_ptr_A, dcsr_col_ind_A, &h_beta, descrB, safe_size, dcsr_val_B, dcsr_row_ptr_B, dcsr_col_ind_B, descrC, dcsr_val_C, dcsr_row_ptr_C, dcsr_col_ind_C), rocsparse_status_invalid_handle); EXPECT_ROCSPARSE_STATUS(rocsparse_csrgeam<T>(handle, safe_size, safe_size, nullptr, descrA, safe_size, dcsr_val_A, dcsr_row_ptr_A, dcsr_col_ind_A, &h_beta, descrB, safe_size, dcsr_val_B, dcsr_row_ptr_B, dcsr_col_ind_B, descrC, dcsr_val_C, dcsr_row_ptr_C, dcsr_col_ind_C), rocsparse_status_invalid_pointer); EXPECT_ROCSPARSE_STATUS(rocsparse_csrgeam<T>(handle, safe_size, safe_size, &h_alpha, nullptr, safe_size, dcsr_val_A, dcsr_row_ptr_A, dcsr_col_ind_A, &h_beta, descrB, safe_size, dcsr_val_B, dcsr_row_ptr_B, dcsr_col_ind_B, descrC, dcsr_val_C, dcsr_row_ptr_C, dcsr_col_ind_C), rocsparse_status_invalid_pointer); EXPECT_ROCSPARSE_STATUS(rocsparse_csrgeam<T>(handle, safe_size, safe_size, &h_alpha, descrA, safe_size, nullptr, dcsr_row_ptr_A, dcsr_col_ind_A, &h_beta, descrB, safe_size, dcsr_val_B, dcsr_row_ptr_B, dcsr_col_ind_B, descrC, dcsr_val_C, dcsr_row_ptr_C, dcsr_col_ind_C), rocsparse_status_invalid_pointer); EXPECT_ROCSPARSE_STATUS(rocsparse_csrgeam<T>(handle, safe_size, safe_size, &h_alpha, descrA, safe_size, dcsr_val_A, nullptr, dcsr_col_ind_A, &h_beta, descrB, safe_size, dcsr_val_B, dcsr_row_ptr_B, dcsr_col_ind_B, descrC, dcsr_val_C, dcsr_row_ptr_C, dcsr_col_ind_C), rocsparse_status_invalid_pointer); EXPECT_ROCSPARSE_STATUS(rocsparse_csrgeam<T>(handle, safe_size, safe_size, &h_alpha, descrA, safe_size, dcsr_val_A, dcsr_row_ptr_A, nullptr, &h_beta, descrB, safe_size, dcsr_val_B, dcsr_row_ptr_B, dcsr_col_ind_B, descrC, dcsr_val_C, dcsr_row_ptr_C, dcsr_col_ind_C), rocsparse_status_invalid_pointer); EXPECT_ROCSPARSE_STATUS(rocsparse_csrgeam<T>(handle, safe_size, safe_size, &h_alpha, descrA, safe_size, dcsr_val_A, dcsr_row_ptr_A, dcsr_col_ind_A, nullptr, descrB, safe_size, dcsr_val_B, dcsr_row_ptr_B, dcsr_col_ind_B, descrC, dcsr_val_C, dcsr_row_ptr_C, dcsr_col_ind_C), rocsparse_status_invalid_pointer); EXPECT_ROCSPARSE_STATUS(rocsparse_csrgeam<T>(handle, safe_size, safe_size, &h_alpha, descrA, safe_size, dcsr_val_A, dcsr_row_ptr_A, dcsr_col_ind_A, &h_beta, nullptr, safe_size, dcsr_val_B, dcsr_row_ptr_B, dcsr_col_ind_B, descrC, dcsr_val_C, dcsr_row_ptr_C, dcsr_col_ind_C), rocsparse_status_invalid_pointer); EXPECT_ROCSPARSE_STATUS(rocsparse_csrgeam<T>(handle, safe_size, safe_size, &h_alpha, descrA, safe_size, dcsr_val_A, dcsr_row_ptr_A, dcsr_col_ind_A, &h_beta, descrB, safe_size, nullptr, dcsr_row_ptr_B, dcsr_col_ind_B, descrC, dcsr_val_C, dcsr_row_ptr_C, dcsr_col_ind_C), rocsparse_status_invalid_pointer); EXPECT_ROCSPARSE_STATUS(rocsparse_csrgeam<T>(handle, safe_size, safe_size, &h_alpha, descrA, safe_size, dcsr_val_A, dcsr_row_ptr_A, dcsr_col_ind_A, &h_beta, descrB, safe_size, dcsr_val_B, nullptr, dcsr_col_ind_B, descrC, dcsr_val_C, dcsr_row_ptr_C, dcsr_col_ind_C), rocsparse_status_invalid_pointer); EXPECT_ROCSPARSE_STATUS(rocsparse_csrgeam<T>(handle, safe_size, safe_size, &h_alpha, descrA, safe_size, dcsr_val_A, dcsr_row_ptr_A, dcsr_col_ind_A, &h_beta, descrB, safe_size, dcsr_val_B, dcsr_row_ptr_B, nullptr, descrC, dcsr_val_C, dcsr_row_ptr_C, dcsr_col_ind_C), rocsparse_status_invalid_pointer); EXPECT_ROCSPARSE_STATUS(rocsparse_csrgeam<T>(handle, safe_size, safe_size, &h_alpha, descrA, safe_size, dcsr_val_A, dcsr_row_ptr_A, dcsr_col_ind_A, &h_beta, descrB, safe_size, dcsr_val_B, dcsr_row_ptr_B, dcsr_col_ind_B, nullptr, dcsr_val_C, dcsr_row_ptr_C, dcsr_col_ind_C), rocsparse_status_invalid_pointer); EXPECT_ROCSPARSE_STATUS(rocsparse_csrgeam<T>(handle, safe_size, safe_size, &h_alpha, descrA, safe_size, dcsr_val_A, dcsr_row_ptr_A, dcsr_col_ind_A, &h_beta, descrB, safe_size, dcsr_val_B, dcsr_row_ptr_B, dcsr_col_ind_B, descrC, nullptr, dcsr_row_ptr_C, dcsr_col_ind_C), rocsparse_status_invalid_pointer); EXPECT_ROCSPARSE_STATUS(rocsparse_csrgeam<T>(handle, safe_size, safe_size, &h_alpha, descrA, safe_size, dcsr_val_A, dcsr_row_ptr_A, dcsr_col_ind_A, &h_beta, descrB, safe_size, dcsr_val_B, dcsr_row_ptr_B, dcsr_col_ind_B, descrC, dcsr_val_C, nullptr, dcsr_col_ind_C), rocsparse_status_invalid_pointer); EXPECT_ROCSPARSE_STATUS(rocsparse_csrgeam<T>(handle, safe_size, safe_size, &h_alpha, descrA, safe_size, dcsr_val_A, dcsr_row_ptr_A, dcsr_col_ind_A, &h_beta, descrB, safe_size, dcsr_val_B, dcsr_row_ptr_B, dcsr_col_ind_B, descrC, dcsr_val_C, dcsr_row_ptr_C, nullptr), rocsparse_status_invalid_pointer); // Testing invalid sizes EXPECT_ROCSPARSE_STATUS(rocsparse_csrgeam_nnz(handle, -1, safe_size, descrA, safe_size, dcsr_row_ptr_A, dcsr_col_ind_A, descrB, safe_size, dcsr_row_ptr_B, dcsr_col_ind_B, descrC, dcsr_row_ptr_C, &nnz_C), rocsparse_status_invalid_size); EXPECT_ROCSPARSE_STATUS(rocsparse_csrgeam_nnz(handle, safe_size, -1, descrA, safe_size, dcsr_row_ptr_A, dcsr_col_ind_A, descrB, safe_size, dcsr_row_ptr_B, dcsr_col_ind_B, descrC, dcsr_row_ptr_C, &nnz_C), rocsparse_status_invalid_size); EXPECT_ROCSPARSE_STATUS(rocsparse_csrgeam_nnz(handle, safe_size, safe_size, descrA, -1, dcsr_row_ptr_A, dcsr_col_ind_A, descrB, safe_size, dcsr_row_ptr_B, dcsr_col_ind_B, descrC, dcsr_row_ptr_C, &nnz_C), rocsparse_status_invalid_size); EXPECT_ROCSPARSE_STATUS(rocsparse_csrgeam_nnz(handle, safe_size, safe_size, descrA, safe_size, dcsr_row_ptr_A, dcsr_col_ind_A, descrB, -1, dcsr_row_ptr_B, dcsr_col_ind_B, descrC, dcsr_row_ptr_C, &nnz_C), rocsparse_status_invalid_size); EXPECT_ROCSPARSE_STATUS(rocsparse_csrgeam<T>(handle, -1, safe_size, &h_alpha, descrA, safe_size, dcsr_val_A, dcsr_row_ptr_A, dcsr_col_ind_A, &h_beta, descrB, safe_size, dcsr_val_B, dcsr_row_ptr_B, dcsr_col_ind_B, descrC, dcsr_val_C, dcsr_row_ptr_C, dcsr_col_ind_C), rocsparse_status_invalid_size); EXPECT_ROCSPARSE_STATUS(rocsparse_csrgeam<T>(handle, safe_size, -1, &h_alpha, descrA, safe_size, dcsr_val_A, dcsr_row_ptr_A, dcsr_col_ind_A, &h_beta, descrB, safe_size, dcsr_val_B, dcsr_row_ptr_B, dcsr_col_ind_B, descrC, dcsr_val_C, dcsr_row_ptr_C, dcsr_col_ind_C), rocsparse_status_invalid_size); EXPECT_ROCSPARSE_STATUS(rocsparse_csrgeam<T>(handle, safe_size, safe_size, &h_alpha, descrA, -1, dcsr_val_A, dcsr_row_ptr_A, dcsr_col_ind_A, &h_beta, descrB, safe_size, dcsr_val_B, dcsr_row_ptr_B, dcsr_col_ind_B, descrC, dcsr_val_C, dcsr_row_ptr_C, dcsr_col_ind_C), rocsparse_status_invalid_size); EXPECT_ROCSPARSE_STATUS(rocsparse_csrgeam<T>(handle, safe_size, safe_size, &h_alpha, descrA, safe_size, dcsr_val_A, dcsr_row_ptr_A, dcsr_col_ind_A, &h_beta, descrB, -1, dcsr_val_B, dcsr_row_ptr_B, dcsr_col_ind_B, descrC, dcsr_val_C, dcsr_row_ptr_C, dcsr_col_ind_C), rocsparse_status_invalid_size); } template <typename T> void testing_csrgeam(const Arguments& arg) { rocsparse_int M = arg.M; rocsparse_int N = arg.N; rocsparse_index_base baseA = arg.baseA; rocsparse_index_base baseB = arg.baseB; rocsparse_index_base baseC = arg.baseC; static constexpr bool full_rank = false; rocsparse_matrix_factory<T> matrix_factory(arg, arg.timing ? false : true, full_rank); rocsparse_matrix_factory_random<T> matrix_factory_random(full_rank); T h_alpha = arg.get_alpha<T>(); T h_beta = arg.get_beta<T>(); // Create rocsparse handle rocsparse_local_handle handle; // Create matrix descriptor rocsparse_local_mat_descr descrA; rocsparse_local_mat_descr descrB; rocsparse_local_mat_descr descrC; // Set matrix index base CHECK_ROCSPARSE_ERROR(rocsparse_set_mat_index_base(descrA, baseA)); CHECK_ROCSPARSE_ERROR(rocsparse_set_mat_index_base(descrB, baseB)); CHECK_ROCSPARSE_ERROR(rocsparse_set_mat_index_base(descrC, baseC)); // Argument sanity check before allocating invalid memory if(M <= 0 || N <= 0) { static const size_t safe_size = 100; // Allocate memory on device device_vector<rocsparse_int> dcsr_row_ptr_A(safe_size); device_vector<rocsparse_int> dcsr_col_ind_A(safe_size); device_vector<T> dcsr_val_A(safe_size); device_vector<rocsparse_int> dcsr_row_ptr_B(safe_size); device_vector<rocsparse_int> dcsr_col_ind_B(safe_size); device_vector<T> dcsr_val_B(safe_size); device_vector<rocsparse_int> dcsr_row_ptr_C(safe_size); device_vector<rocsparse_int> dcsr_col_ind_C(safe_size); device_vector<T> dcsr_val_C(safe_size); if(!dcsr_row_ptr_A || !dcsr_col_ind_A || !dcsr_val_A || !dcsr_row_ptr_B || !dcsr_col_ind_B || !dcsr_val_B || !dcsr_row_ptr_C || !dcsr_col_ind_C || !dcsr_val_C) { CHECK_HIP_ERROR(hipErrorOutOfMemory); return; } CHECK_ROCSPARSE_ERROR(rocsparse_set_pointer_mode(handle, rocsparse_pointer_mode_host)); rocsparse_int nnz_C; rocsparse_status status_1 = rocsparse_csrgeam_nnz(handle, M, N, descrA, safe_size, dcsr_row_ptr_A, dcsr_col_ind_A, descrB, safe_size, dcsr_row_ptr_B, dcsr_col_ind_B, descrC, dcsr_row_ptr_C, &nnz_C); rocsparse_status status_2 = rocsparse_csrgeam<T>(handle, M, N, &h_alpha, descrA, safe_size, dcsr_val_A, dcsr_row_ptr_A, dcsr_col_ind_A, &h_beta, descrB, safe_size, dcsr_val_B, dcsr_row_ptr_B, dcsr_col_ind_B, descrC, dcsr_val_C, dcsr_row_ptr_C, dcsr_col_ind_C); // alpha == nullptr && beta != nullptr EXPECT_ROCSPARSE_STATUS( status_1, (M < 0 || N < 0) ? rocsparse_status_invalid_size : rocsparse_status_success); EXPECT_ROCSPARSE_STATUS( status_2, (M < 0 || N < 0) ? rocsparse_status_invalid_size : rocsparse_status_success); return; } // Allocate host memory for matrices host_vector<rocsparse_int> hcsr_row_ptr_A; host_vector<rocsparse_int> hcsr_col_ind_A; host_vector<T> hcsr_val_A; host_vector<rocsparse_int> hcsr_row_ptr_B; host_vector<rocsparse_int> hcsr_col_ind_B; host_vector<T> hcsr_val_B; // Sample matrix rocsparse_int nnz_A = 4; rocsparse_int nnz_B = 4; rocsparse_int hnnz_C_gold; rocsparse_int hnnz_C_1; rocsparse_int hnnz_C_2; // Sample A matrix_factory.init_csr(hcsr_row_ptr_A, hcsr_col_ind_A, hcsr_val_A, M, N, nnz_A, baseA); // Sample B matrix_factory_random.init_csr(hcsr_row_ptr_B, hcsr_col_ind_B, hcsr_val_B, M, N, nnz_B, baseB); // Allocate device memory device_vector<rocsparse_int> dcsr_row_ptr_A(M + 1); device_vector<rocsparse_int> dcsr_col_ind_A(nnz_A); device_vector<T> dcsr_val_A(nnz_A); device_vector<rocsparse_int> dcsr_row_ptr_B(M + 1); device_vector<rocsparse_int> dcsr_col_ind_B(nnz_B); device_vector<T> dcsr_val_B(nnz_B); device_vector<T> d_alpha(1); device_vector<T> d_beta(1); device_vector<rocsparse_int> dcsr_row_ptr_C_1(M + 1); device_vector<rocsparse_int> dcsr_row_ptr_C_2(M + 1); device_vector<rocsparse_int> dnnz_C_2(1); if(!dcsr_row_ptr_A || !dcsr_col_ind_A || !dcsr_val_A || !dcsr_row_ptr_B || !dcsr_col_ind_B || !dcsr_val_B || !d_alpha || !d_beta || !dcsr_row_ptr_C_1 || !dcsr_row_ptr_C_2 || !dnnz_C_2) { CHECK_HIP_ERROR(hipErrorOutOfMemory); return; } // Copy data from CPU to device CHECK_HIP_ERROR(hipMemcpy( dcsr_row_ptr_A, hcsr_row_ptr_A, sizeof(rocsparse_int) * (M + 1), hipMemcpyHostToDevice)); CHECK_HIP_ERROR(hipMemcpy( dcsr_col_ind_A, hcsr_col_ind_A, sizeof(rocsparse_int) * nnz_A, hipMemcpyHostToDevice)); CHECK_HIP_ERROR(hipMemcpy(dcsr_val_A, hcsr_val_A, sizeof(T) * nnz_A, hipMemcpyHostToDevice)); CHECK_HIP_ERROR(hipMemcpy( dcsr_row_ptr_B, hcsr_row_ptr_B, sizeof(rocsparse_int) * (M + 1), hipMemcpyHostToDevice)); CHECK_HIP_ERROR(hipMemcpy( dcsr_col_ind_B, hcsr_col_ind_B, sizeof(rocsparse_int) * nnz_B, hipMemcpyHostToDevice)); CHECK_HIP_ERROR(hipMemcpy(dcsr_val_B, hcsr_val_B, sizeof(T) * nnz_B, hipMemcpyHostToDevice)); CHECK_HIP_ERROR(hipMemcpy(d_alpha, &h_alpha, sizeof(T), hipMemcpyHostToDevice)); CHECK_HIP_ERROR(hipMemcpy(d_beta, &h_beta, sizeof(T), hipMemcpyHostToDevice)); if(arg.unit_check) { // Obtain nnz of C // Pointer mode host CHECK_ROCSPARSE_ERROR(rocsparse_set_pointer_mode(handle, rocsparse_pointer_mode_host)); CHECK_ROCSPARSE_ERROR(rocsparse_csrgeam_nnz(handle, M, N, descrA, nnz_A, dcsr_row_ptr_A, dcsr_col_ind_A, descrB, nnz_B, dcsr_row_ptr_B, dcsr_col_ind_B, descrC, dcsr_row_ptr_C_1, &hnnz_C_1)); // Pointer mode device CHECK_ROCSPARSE_ERROR(rocsparse_set_pointer_mode(handle, rocsparse_pointer_mode_device)); CHECK_ROCSPARSE_ERROR(rocsparse_csrgeam_nnz(handle, M, N, descrA, nnz_A, dcsr_row_ptr_A, dcsr_col_ind_A, descrB, nnz_B, dcsr_row_ptr_B, dcsr_col_ind_B, descrC, dcsr_row_ptr_C_2, dnnz_C_2)); // Copy output to host host_vector<rocsparse_int> hcsr_row_ptr_C_1(M + 1); host_vector<rocsparse_int> hcsr_row_ptr_C_2(M + 1); CHECK_HIP_ERROR( hipMemcpy(&hnnz_C_2, dnnz_C_2, sizeof(rocsparse_int), hipMemcpyDeviceToHost)); CHECK_HIP_ERROR(hipMemcpy(hcsr_row_ptr_C_1, dcsr_row_ptr_C_1, sizeof(rocsparse_int) * (M + 1), hipMemcpyDeviceToHost)); CHECK_HIP_ERROR(hipMemcpy(hcsr_row_ptr_C_2, dcsr_row_ptr_C_2, sizeof(rocsparse_int) * (M + 1), hipMemcpyDeviceToHost)); // CPU csrgemm_nnz host_vector<rocsparse_int> hcsr_row_ptr_C_gold(M + 1); host_csrgeam_nnz<T>(M, N, h_alpha, hcsr_row_ptr_A, hcsr_col_ind_A, h_beta, hcsr_row_ptr_B, hcsr_col_ind_B, hcsr_row_ptr_C_gold, &hnnz_C_gold, baseA, baseB, baseC); // Check nnz of C unit_check_general(1, 1, 1, &hnnz_C_gold, &hnnz_C_1); unit_check_general(1, 1, 1, &hnnz_C_gold, &hnnz_C_2); // Check row pointers of C unit_check_general<rocsparse_int>(1, M + 1, 1, hcsr_row_ptr_C_gold, hcsr_row_ptr_C_1); unit_check_general<rocsparse_int>(1, M + 1, 1, hcsr_row_ptr_C_gold, hcsr_row_ptr_C_2); // Allocate device memory for C device_vector<rocsparse_int> dcsr_col_ind_C_1(hnnz_C_1); device_vector<rocsparse_int> dcsr_col_ind_C_2(hnnz_C_2); device_vector<T> dcsr_val_C_1(hnnz_C_1); device_vector<T> dcsr_val_C_2(hnnz_C_2); if(!dcsr_col_ind_C_1 || !dcsr_col_ind_C_2 || !dcsr_val_C_1 || !dcsr_val_C_2) { CHECK_HIP_ERROR(hipErrorOutOfMemory); return; } // Perform matrix matrix multiplication // Pointer mode host CHECK_ROCSPARSE_ERROR(rocsparse_set_pointer_mode(handle, rocsparse_pointer_mode_host)); CHECK_ROCSPARSE_ERROR(rocsparse_csrgeam<T>(handle, M, N, &h_alpha, descrA, nnz_A, dcsr_val_A, dcsr_row_ptr_A, dcsr_col_ind_A, &h_beta, descrB, nnz_B, dcsr_val_B, dcsr_row_ptr_B, dcsr_col_ind_B, descrC, dcsr_val_C_1, dcsr_row_ptr_C_1, dcsr_col_ind_C_1)); // Pointer mode device CHECK_ROCSPARSE_ERROR(rocsparse_set_pointer_mode(handle, rocsparse_pointer_mode_device)); CHECK_ROCSPARSE_ERROR(rocsparse_csrgeam<T>(handle, M, N, d_alpha, descrA, nnz_A, dcsr_val_A, dcsr_row_ptr_A, dcsr_col_ind_A, d_beta, descrB, nnz_B, dcsr_val_B, dcsr_row_ptr_B, dcsr_col_ind_B, descrC, dcsr_val_C_2, dcsr_row_ptr_C_2, dcsr_col_ind_C_2)); // Copy output to host host_vector<rocsparse_int> hcsr_col_ind_C_1(hnnz_C_1); host_vector<rocsparse_int> hcsr_col_ind_C_2(hnnz_C_2); host_vector<T> hcsr_val_C_1(hnnz_C_1); host_vector<T> hcsr_val_C_2(hnnz_C_2); CHECK_HIP_ERROR(hipMemcpy(hcsr_col_ind_C_1, dcsr_col_ind_C_1, sizeof(rocsparse_int) * hnnz_C_1, hipMemcpyDeviceToHost)); CHECK_HIP_ERROR(hipMemcpy(hcsr_col_ind_C_2, dcsr_col_ind_C_2, sizeof(rocsparse_int) * hnnz_C_2, hipMemcpyDeviceToHost)); CHECK_HIP_ERROR( hipMemcpy(hcsr_val_C_1, dcsr_val_C_1, sizeof(T) * hnnz_C_1, hipMemcpyDeviceToHost)); CHECK_HIP_ERROR( hipMemcpy(hcsr_val_C_2, dcsr_val_C_2, sizeof(T) * hnnz_C_2, hipMemcpyDeviceToHost)); // CPU csrgemm host_vector<rocsparse_int> hcsr_col_ind_C_gold(hnnz_C_gold); host_vector<T> hcsr_val_C_gold(hnnz_C_gold); host_csrgeam<T>(M, N, h_alpha, hcsr_row_ptr_A, hcsr_col_ind_A, hcsr_val_A, h_beta, hcsr_row_ptr_B, hcsr_col_ind_B, hcsr_val_B, hcsr_row_ptr_C_gold, hcsr_col_ind_C_gold, hcsr_val_C_gold, baseA, baseB, baseC); // Check C unit_check_general<rocsparse_int>(1, hnnz_C_gold, 1, hcsr_col_ind_C_gold, hcsr_col_ind_C_1); unit_check_general<rocsparse_int>(1, hnnz_C_gold, 1, hcsr_col_ind_C_gold, hcsr_col_ind_C_2); near_check_general<T>(1, hnnz_C_gold, 1, hcsr_val_C_gold, hcsr_val_C_1); near_check_general<T>(1, hnnz_C_gold, 1, hcsr_val_C_gold, hcsr_val_C_2); } if(arg.timing) { int number_cold_calls = 2; int number_hot_calls = arg.iters; rocsparse_int nnz_C; CHECK_ROCSPARSE_ERROR(rocsparse_set_pointer_mode(handle, rocsparse_pointer_mode_host)); // Warm up for(int iter = 0; iter < number_cold_calls; ++iter) { CHECK_ROCSPARSE_ERROR(rocsparse_csrgeam_nnz(handle, M, N, descrA, nnz_A, dcsr_row_ptr_A, dcsr_col_ind_A, descrB, nnz_B, dcsr_row_ptr_B, dcsr_col_ind_B, descrC, dcsr_row_ptr_C_1, &nnz_C)); device_vector<rocsparse_int> dcsr_col_ind_C(nnz_C); device_vector<T> dcsr_val_C(nnz_C); if(!dcsr_col_ind_C || !dcsr_val_C) { CHECK_HIP_ERROR(hipErrorOutOfMemory); return; } CHECK_ROCSPARSE_ERROR(rocsparse_csrgeam<T>(handle, M, N, &h_alpha, descrA, nnz_A, dcsr_val_A, dcsr_row_ptr_A, dcsr_col_ind_A, &h_beta, descrB, nnz_B, dcsr_val_B, dcsr_row_ptr_B, dcsr_col_ind_B, descrC, dcsr_val_C, dcsr_row_ptr_C_1, dcsr_col_ind_C)); } double gpu_analysis_time_used = get_time_us(); CHECK_ROCSPARSE_ERROR(rocsparse_csrgeam_nnz(handle, M, N, descrA, nnz_A, dcsr_row_ptr_A, dcsr_col_ind_A, descrB, nnz_B, dcsr_row_ptr_B, dcsr_col_ind_B, descrC, dcsr_row_ptr_C_1, &nnz_C)); gpu_analysis_time_used = get_time_us() - gpu_analysis_time_used; device_vector<rocsparse_int> dcsr_col_ind_C(nnz_C); device_vector<T> dcsr_val_C(nnz_C); if(!dcsr_col_ind_C || !dcsr_val_C) { CHECK_HIP_ERROR(hipErrorOutOfMemory); return; } double gpu_solve_time_used = get_time_us(); // Performance run for(int iter = 0; iter < number_hot_calls; ++iter) { CHECK_ROCSPARSE_ERROR(rocsparse_csrgeam<T>(handle, M, N, &h_alpha, descrA, nnz_A, dcsr_val_A, dcsr_row_ptr_A, dcsr_col_ind_A, &h_beta, descrB, nnz_B, dcsr_val_B, dcsr_row_ptr_B, dcsr_col_ind_B, descrC, dcsr_val_C, dcsr_row_ptr_C_1, dcsr_col_ind_C)); } gpu_solve_time_used = (get_time_us() - gpu_solve_time_used) / number_hot_calls; double gpu_gflops = csrgeam_gflop_count<T>(nnz_A, nnz_B, nnz_C, &h_alpha, &h_beta) / gpu_solve_time_used * 1e6; double gpu_gbyte = csrgeam_gbyte_count<T>(M, nnz_A, nnz_B, nnz_C, &h_alpha, &h_beta) / gpu_solve_time_used * 1e6; std::cout.precision(2); std::cout.setf(std::ios::fixed); std::cout.setf(std::ios::left); std::cout << std::setw(12) << "M" << std::setw(12) << "N" << std::setw(12) << "nnz_A" << std::setw(12) << "nnz_B" << std::setw(12) << "nnz_C" << std::setw(12) << "alpha" << std::setw(12) << "beta" << std::setw(12) << "GFlop/s" << std::setw(12) << "GB/s" << std::setw(16) << "nnz msec" << std::setw(16) << "gemm msec" << std::setw(12) << "iter" << std::setw(12) << "verified" << std::endl; std::cout << std::setw(12) << M << std::setw(12) << N << std::setw(12) << nnz_A << std::setw(12) << nnz_B << std::setw(12) << nnz_C << std::setw(12) << h_alpha << std::setw(12) << h_beta << std::setw(12) << gpu_gflops << std::setw(12) << gpu_gbyte << std::setw(16) << gpu_analysis_time_used / 1e3 << std::setw(16) << gpu_solve_time_used / 1e3 << std::setw(12) << number_hot_calls << std::setw(12) << (arg.unit_check ? "yes" : "no") << std::endl; } } #define INSTANTIATE(TYPE) \ template void testing_csrgeam_bad_arg<TYPE>(const Arguments& arg); \ template void testing_csrgeam<TYPE>(const Arguments& arg) INSTANTIATE(float); INSTANTIATE(double); INSTANTIATE(rocsparse_float_complex); INSTANTIATE(rocsparse_double_complex);
#include <Core/ServerUUID.h> #include <IO/ReadBufferFromFile.h> #include <IO/WriteBufferFromFile.h> #include <IO/ReadHelpers.h> #include <IO/WriteHelpers.h> #include <base/logger_useful.h> namespace DB { namespace ErrorCodes { extern const int CANNOT_CREATE_FILE; } void ServerUUID::load(const fs::path & server_uuid_file, Poco::Logger * log) { /// Write a uuid file containing a unique uuid if the file doesn't already exist during server start. if (fs::exists(server_uuid_file)) { try { UUID uuid; ReadBufferFromFile in(server_uuid_file); readUUIDText(uuid, in); assertEOF(in); server_uuid = uuid; return; } catch (...) { /// As for now it's ok to just overwrite it, because persistency in not essential. LOG_ERROR(log, "Cannot read server UUID from file {}: {}. Will overwrite it", server_uuid_file.string(), getCurrentExceptionMessage(true)); } } try { UUID new_uuid = UUIDHelpers::generateV4(); auto uuid_str = toString(new_uuid); WriteBufferFromFile out(server_uuid_file); out.write(uuid_str.data(), uuid_str.size()); out.sync(); out.finalize(); server_uuid = new_uuid; } catch (...) { throw Exception(ErrorCodes::CANNOT_CREATE_FILE, "Caught Exception {} while writing the Server UUID file {}", getCurrentExceptionMessage(false), server_uuid_file.string()); } } }
// Copyright 2019 Google LLC // // 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/simplesat/variable_environment/variable_environment.h" #include "src/simplesat/variable_environment/environment_stack.h" #include "src/simplesat/variable_environment/linear_variable_selector.h" #include "googletest/include/gtest/gtest.h" #include "absl/memory/memory.h" namespace simplesat { namespace test { namespace { TEST(CnfVariableEnvironmentStack, CnfVariableEnvironmentRoundTripTest) { std::unique_ptr<VariableSelector> selector = absl::make_unique<LinearVariableSelector>(3); VariableEnvironmentStack stack(3, selector); stack.push(); stack.assign(0, VariableState::STRUE); stack.assign(1, VariableState::SFALSE); stack.assign(2, VariableState::SUNBOUND); EXPECT_EQ(stack.lookup(0), VariableState::STRUE); EXPECT_EQ(stack.lookup(1), VariableState::SFALSE); EXPECT_EQ(stack.lookup(2), VariableState::SUNBOUND); EXPECT_EQ(stack.current_level(), 1); stack.pop(); EXPECT_EQ(stack.current_level(), 0); EXPECT_EQ(stack.lookup(0), VariableState::SUNBOUND); EXPECT_EQ(stack.lookup(1), VariableState::SUNBOUND); EXPECT_EQ(stack.lookup(2), VariableState::SUNBOUND); } } // namespace } // namespace test } // namespace simplesat
; A058207: Three steps forward, two steps back. ; 0,1,2,3,2,1,2,3,4,3,2,3,4,5,4,3,4,5,6,5,4,5,6,7,6,5,6,7,8,7,6,7,8,9,8,7,8,9,10,9,8,9,10,11,10,9,10,11,12,11,10,11,12,13,12,11,12,13,14,13,12,13,14,15,14,13,14,15,16,15,14,15,16,17,16,15,16,17,18,17,16,17,18,19,18,17,18,19,20,19,18,19,20,21,20,19,20,21,22,21 sub $2,$0 lpb $0 sub $0,4 add $2,6 trn $0,$2 add $0,$2 lpe
; A198770: 11*5^n-1. ; 10,54,274,1374,6874,34374,171874,859374,4296874,21484374,107421874,537109374,2685546874,13427734374,67138671874,335693359374,1678466796874,8392333984374,41961669921874,209808349609374,1049041748046874,5245208740234374,26226043701171874,131130218505859374,655651092529296874,3278255462646484374,16391277313232421874,81956386566162109374,409781932830810546874,2048909664154052734374,10244548320770263671874,51222741603851318359374,256113708019256591796874,1280568540096282958984374,6402842700481414794921874,32014213502407073974609374,160071067512035369873046874,800355337560176849365234374,4001776687800884246826171874,20008883439004421234130859374,100044417195022106170654296874,500222085975110530853271484374,2501110429875552654266357421874,12505552149377763271331787109374,62527760746888816356658935546874,312638803734444081783294677734374,1563194018672220408916473388671874,7815970093361102044582366943359374,39079850466805510222911834716796874,195399252334027551114559173583984374,976996261670137755572795867919921874 mov $1,5 pow $1,$0 mul $1,11 sub $1,1 mov $0,$1
; A055955: a(n) = n - reversal of base 7 digits of n (written in base 10). ; 0,0,0,0,0,0,0,6,0,-6,-12,-18,-24,-30,12,6,0,-6,-12,-18,-24,18,12,6,0,-6,-12,-18,24,18,12,6,0,-6,-12,30,24,18,12,6,0,-6,36,30,24,18,12,6,0,48,0,-48,-96,-144,-192,-240,48,0,-48,-96,-144,-192,-240,48,0,-48,-96,-144,-192,-240,48,0,-48,-96,-144,-192,-240 mov $1,$0 seq $1,30106 ; Base 7 reversal of n (written in base 10). sub $0,$1
; A349071: a(n) = T(n, 2*n), where T(n, x) is the Chebyshev polynomial of the first kind. ; Submitted by Christian Krause ; 1,2,31,846,32257,1580050,94558751,6686381534,545471324161,50428155189474,5210183616019999,594949288292777902,74404881332329766401,10114032809617941274226,1484781814660796486716447,234114571438498509048719550,39459584112457284328544403457,7079854480014105553951124894914,1347244863951964910799211013493791,271018717782593589742107061701613838,57466170323134019485514250338815680001,12809795414457703979888332515728933635026,2994709921687980902368522841945472223434271 mov $3,$0 mul $3,2 lpb $0 sub $0,1 add $1,1 mov $2,$3 sub $2,1 mul $2,2 mul $2,$1 add $4,2 add $4,$2 add $1,$4 lpe mov $0,$2 div $0,2 add $0,1
<% from pwnlib.shellcraft.i386.linux import syscall %> <%page args="n, groups"/> <%docstring> Invokes the syscall setgroups. See 'man 2 setgroups' for more information. Arguments: n(size_t): n groups(gid_t): groups </%docstring> ${syscall('SYS_setgroups', n, groups)}
## binsearch .data array: .word 1 4 7 10 15 arraySize: .word 5 msg: .asciiz "Enter the number that you want to search for:\n" .text main: li $v0,4 la $a0,msg syscall li $v0,5 syscall move $t5, $v0 la $s0, array xor $a0, $a0, $a0 lw $a1, arraySize jal search ##retval in $a0 li $v0,1 syscall li $v0,10 syscall search: blt $a1, $a0, notfound add $t1, $a0, $a1 sra $t1, $t1, 1 ## mid in $t2 mul $t2, $t1, 4 ## *(int*)(arr+mid) add $t2, $t2, $s0 lw $t2, 0($t2) beq $t2, $t5, found blt $t2, $t5, left #t2 less than right: move $a1, $t1 sub $a1, $a1, 1 #right = mid-1 j search left: move $a0, $t1 #left = mid+1 add $a0, $a0, 1 j search notfound: li $a0,-1 jr $ra found: move $a0, $t1 jr $ra
; A032832: Numbers whose set of base-8 digits is {3,4}. ; Submitted by Jon Maiga ; 3,4,27,28,35,36,219,220,227,228,283,284,291,292,1755,1756,1763,1764,1819,1820,1827,1828,2267,2268,2275,2276,2331,2332,2339,2340,14043,14044,14051,14052,14107,14108,14115,14116,14555,14556,14563,14564,14619,14620,14627,14628,18139,18140,18147,18148,18203,18204,18211,18212,18651,18652,18659,18660,18715,18716,18723,18724,112347,112348,112355,112356,112411,112412,112419,112420,112859,112860,112867,112868,112923,112924,112931,112932,116443,116444,116451,116452,116507,116508,116515,116516,116955 add $0,2 mov $3,7 lpb $0 sub $1,$3 mov $2,$0 div $0,2 mul $2,2 mod $2,4 mul $2,$3 add $1,$2 mul $3,8 lpe mov $0,$1 sub $0,63 div $0,14 add $0,4
#include "Platform.inc" #include "FarCalls.inc" #include "TestFixture.inc" #include "../ResetMocks.inc" radix decimal extern main BrownOutResetTest code global testArrange global testAssert testArrange: fcall initialiseResetMocks testAct: fcall main testAssert: banksel calledInitialiseAfterBrownOutReset .assert "calledInitialiseAfterBrownOutReset != 0, 'BOR condition did not call initialiseAfterBrownOutReset.'" .assert "calledInitialiseAfterPowerOnReset == 0, 'BOR condition called initialiseAfterPowerOnReset.'" .assert "calledInitialiseAfterMclrReset == 0, 'BOR condition called initialiseAfterMclrReset.'" .done end
MAIN: PUSH BYTE 2 PUSH BYTE 144 DIV BYTE OUT EXIT
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r12 push %rbp push %rbx push %rcx push %rdi push %rdx push %rsi lea addresses_WC_ht+0x1d2f8, %rdi and $10031, %rdx movw $0x6162, (%rdi) nop nop nop nop xor $21638, %rbp lea addresses_normal_ht+0xf2f8, %rsi lea addresses_A_ht+0x17338, %rdi nop nop nop nop nop dec %r10 mov $56, %rcx rep movsb cmp $22597, %rdx lea addresses_A_ht+0xf718, %rsi lea addresses_normal_ht+0x6ff8, %rdi xor %r12, %r12 mov $1, %rcx rep movsl nop and $62528, %rbx lea addresses_WC_ht+0x10738, %rsi add $3483, %rdi and $0xffffffffffffffc0, %rsi vmovaps (%rsi), %ymm2 vextracti128 $1, %ymm2, %xmm2 vpextrq $0, %xmm2, %r12 nop nop nop nop nop cmp %rbp, %rbp lea addresses_WT_ht+0xd118, %r10 nop cmp %r12, %r12 mov $0x6162636465666768, %rbx movq %rbx, %xmm4 vmovups %ymm4, (%r10) nop nop nop nop sub %rbx, %rbx lea addresses_UC_ht+0x1e40c, %rdi nop nop nop nop nop dec %rsi mov $0x6162636465666768, %r10 movq %r10, %xmm5 movups %xmm5, (%rdi) nop nop nop sub %r12, %r12 lea addresses_normal_ht+0x1aaf8, %r10 nop nop nop xor $47529, %rbp mov $0x6162636465666768, %rsi movq %rsi, %xmm0 movups %xmm0, (%r10) nop nop nop nop and $64742, %r10 lea addresses_UC_ht+0x91a2, %rsi lea addresses_WT_ht+0x18cdd, %rdi nop nop dec %rbx mov $73, %rcx rep movsl nop nop nop nop nop cmp %rsi, %rsi pop %rsi pop %rdx pop %rdi pop %rcx pop %rbx pop %rbp pop %r12 pop %r10 ret .global s_faulty_load s_faulty_load: push %r12 push %r14 push %r8 push %r9 push %rax push %rbp push %rdi // Store lea addresses_PSE+0x1a6f8, %rax nop nop add %r12, %r12 movl $0x51525354, (%rax) nop nop nop xor %r9, %r9 // Store lea addresses_UC+0x8e90, %rdi nop nop nop xor $57162, %rbp mov $0x5152535455565758, %r14 movq %r14, %xmm2 vmovups %ymm2, (%rdi) add %r9, %r9 // Store lea addresses_UC+0xc4f8, %r9 nop xor %r8, %r8 mov $0x5152535455565758, %rdi movq %rdi, (%r9) nop nop nop add %rbp, %rbp // Store lea addresses_A+0x16ef8, %rdi nop nop nop nop xor $20501, %r14 mov $0x5152535455565758, %rbp movq %rbp, %xmm0 vmovups %ymm0, (%rdi) nop nop nop nop nop dec %r8 // Faulty Load lea addresses_PSE+0x1a6f8, %rax nop add %r8, %r8 vmovntdqa (%rax), %ymm4 vextracti128 $0, %ymm4, %xmm4 vpextrq $0, %xmm4, %r12 lea oracles, %r9 and $0xff, %r12 shlq $12, %r12 mov (%r9,%r12,1), %r12 pop %rdi pop %rbp pop %rax pop %r9 pop %r8 pop %r14 pop %r12 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_PSE', 'AVXalign': False, 'congruent': 0, 'size': 8, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_PSE', 'AVXalign': False, 'congruent': 0, 'size': 4, 'same': True, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC', 'AVXalign': False, 'congruent': 3, 'size': 32, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC', 'AVXalign': False, 'congruent': 7, 'size': 8, 'same': False, 'NT': True}} {'OP': 'STOR', 'dst': {'type': 'addresses_A', 'AVXalign': False, 'congruent': 9, 'size': 32, 'same': False, 'NT': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_PSE', 'AVXalign': False, 'congruent': 0, 'size': 32, 'same': True, 'NT': True}} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 9, 'size': 2, 'same': False, 'NT': False}} {'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 8, 'same': True}, 'dst': {'type': 'addresses_A_ht', 'congruent': 5, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 7, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'AVXalign': True, 'congruent': 6, 'size': 32, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': False, 'congruent': 3, 'size': 32, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 1, 'size': 16, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': False, 'congruent': 10, 'size': 16, 'same': False, 'NT': False}} {'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 0, 'same': False}} {'54': 21590, '00': 239} 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 00 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 00 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 00 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 00 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 00 54 54 54 54 54 54 54 54 54 54 54 54 54 00 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 00 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 00 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 00 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 00 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 */
; int wa_stack_push(wa_stack_t *s, void *item) SECTION code_clib SECTION code_adt_wa_stack PUBLIC _wa_stack_push EXTERN _w_array_append defc _wa_stack_push = _w_array_append
; A131765: Series reversion of x*(1-5x)/(1-x) . ; Submitted by Jon Maiga ; 1,4,36,404,5076,68324,963396,14046964,210062196,3204118724,49656709476,779690085204,12376867734036,198301332087204,3202580085625476,52080967814444724,852103170531254196,14016301507253656964,231657964424021151396,3845191251378786562324,64071061232110557269076,1071325589130572667618404,17970503555169104835780036,302314837602989393019622004,5099353009114031717636517876,86225439836708431978394349124,1461299718993719759883693696996,24817297498717379095180786954964,422295464454181584081293569192596 mov $1,1 mov $2,1 mov $3,$0 mov $4,2 lpb $3 mul $1,$3 mul $2,4 sub $3,1 mul $1,$3 mul $1,5 add $5,$4 div $1,$5 add $2,$1 add $4,2 lpe mov $0,$2
#include <eosio/chain/generated_transaction_object.hpp> #include <eosio/chain/resource_limits.hpp> #include <eosio/testing/tester.hpp> #include <eosio/testing/tester_network.hpp> #include <fc/variant_object.hpp> #include <boost/test/unit_test.hpp> #include <contracts.hpp> #ifdef NON_VALIDATING_TEST #define TESTER tester #else #define TESTER validating_tester #endif using namespace eosio; using namespace eosio::chain; using namespace eosio::testing; using mvo = fc::mutable_variant_object; template<class Tester = TESTER> class whitelist_blacklist_tester { public: whitelist_blacklist_tester() {} void init( bool bootstrap = true ) { FC_ASSERT( !chain, "chain is already up" ); chain.emplace(tempdir, [&](controller::config& cfg) { cfg.sender_bypass_whiteblacklist = sender_bypass_whiteblacklist; cfg.actor_whitelist = actor_whitelist; cfg.actor_blacklist = actor_blacklist; cfg.contract_whitelist = contract_whitelist; cfg.contract_blacklist = contract_blacklist; cfg.action_blacklist = action_blacklist; }, !shutdown_called); wdump((last_produced_block)); chain->set_last_produced_block_map( last_produced_block ); if( !bootstrap ) return; chain->create_accounts({N(eosio.token), N(alice), N(bob), N(charlie)}); chain->set_code(N(eosio.token), contracts::eosio_token_wasm() ); chain->set_abi(N(eosio.token), contracts::eosio_token_abi().data() ); chain->push_action( N(eosio.token), N(create), N(eosio.token), mvo() ( "issuer", "eosio.token" ) ( "maximum_supply", "1000000.00 TOK" ) ); chain->push_action( N(eosio.token), N(issue), N(eosio.token), mvo() ( "to", "eosio.token" ) ( "quantity", "1000000.00 TOK" ) ( "memo", "issue" ) ); chain->produce_blocks(); } void shutdown() { FC_ASSERT( chain.valid(), "chain is not up" ); last_produced_block = chain->get_last_produced_block_map(); wdump((last_produced_block)); chain.reset(); shutdown_called = true; } transaction_trace_ptr transfer( account_name from, account_name to, string quantity = "1.00 TOK" ) { return chain->push_action( N(eosio.token), N(transfer), from, mvo() ( "from", from ) ( "to", to ) ( "quantity", quantity ) ( "memo", "" ) ); } private: fc::temp_directory tempdir; // Must come before chain public: fc::optional<Tester> chain; flat_set<account_name> sender_bypass_whiteblacklist; flat_set<account_name> actor_whitelist; flat_set<account_name> actor_blacklist; flat_set<account_name> contract_whitelist; flat_set<account_name> contract_blacklist; flat_set< pair<account_name, action_name> > action_blacklist; map<account_name, block_id_type> last_produced_block; bool shutdown_called = false; }; struct transfer_args { account_name from; account_name to; asset quantity; string memo; }; FC_REFLECT( transfer_args, (from)(to)(quantity)(memo) ) BOOST_AUTO_TEST_SUITE(whitelist_blacklist_tests) BOOST_AUTO_TEST_CASE( actor_whitelist ) { try { whitelist_blacklist_tester<> test; test.actor_whitelist = {config::system_account_name, N(eosio.token), N(alice)}; test.init(); test.transfer( N(eosio.token), N(alice), "1000.00 TOK" ); test.transfer( N(alice), N(bob), "100.00 TOK" ); BOOST_CHECK_EXCEPTION( test.transfer( N(bob), N(alice) ), actor_whitelist_exception, fc_exception_message_is("authorizing actor(s) in transaction are not on the actor whitelist: [\"bob\"]") ); signed_transaction trx; trx.actions.emplace_back( vector<permission_level>{{N(alice),config::active_name}, {N(bob),config::active_name}}, N(eosio.token), N(transfer), fc::raw::pack(transfer_args{ .from = N(alice), .to = N(bob), .quantity = asset::from_string("10.00 TOK"), .memo = "" }) ); test.chain->set_transaction_headers(trx); trx.sign( test.chain->get_private_key( N(alice), "active" ), test.chain->control->get_chain_id() ); trx.sign( test.chain->get_private_key( N(bob), "active" ), test.chain->control->get_chain_id() ); BOOST_CHECK_EXCEPTION( test.chain->push_transaction( trx ), actor_whitelist_exception, fc_exception_message_starts_with("authorizing actor(s) in transaction are not on the actor whitelist: [\"bob\"]") ); test.chain->produce_blocks(); } FC_LOG_AND_RETHROW() } BOOST_AUTO_TEST_CASE( actor_blacklist ) { try { whitelist_blacklist_tester<> test; test.actor_blacklist = {N(bob)}; test.init(); test.transfer( N(eosio.token), N(alice), "1000.00 TOK" ); test.transfer( N(alice), N(bob), "100.00 TOK" ); BOOST_CHECK_EXCEPTION( test.transfer( N(bob), N(alice) ), actor_blacklist_exception, fc_exception_message_starts_with("authorizing actor(s) in transaction are on the actor blacklist: [\"bob\"]") ); signed_transaction trx; trx.actions.emplace_back( vector<permission_level>{{N(alice),config::active_name}, {N(bob),config::active_name}}, N(eosio.token), N(transfer), fc::raw::pack(transfer_args{ .from = N(alice), .to = N(bob), .quantity = asset::from_string("10.00 TOK"), .memo = "" }) ); test.chain->set_transaction_headers(trx); trx.sign( test.chain->get_private_key( N(alice), "active" ), test.chain->control->get_chain_id() ); trx.sign( test.chain->get_private_key( N(bob), "active" ), test.chain->control->get_chain_id() ); BOOST_CHECK_EXCEPTION( test.chain->push_transaction( trx ), actor_blacklist_exception, fc_exception_message_starts_with("authorizing actor(s) in transaction are on the actor blacklist: [\"bob\"]") ); test.chain->produce_blocks(); } FC_LOG_AND_RETHROW() } BOOST_AUTO_TEST_CASE( contract_whitelist ) { try { whitelist_blacklist_tester<> test; test.contract_whitelist = {config::system_account_name, N(eosio.token), N(bob)}; test.init(); test.transfer( N(eosio.token), N(alice), "1000.00 TOK" ); test.transfer( N(alice), N(eosio.token) ); test.transfer( N(alice), N(bob) ); test.transfer( N(alice), N(charlie), "100.00 TOK" ); test.transfer( N(charlie), N(alice) ); test.chain->produce_blocks(); test.chain->set_code(N(bob), contracts::eosio_token_wasm() ); test.chain->set_abi(N(bob), contracts::eosio_token_abi().data() ); test.chain->produce_blocks(); test.chain->set_code(N(charlie), contracts::eosio_token_wasm() ); test.chain->set_abi(N(charlie), contracts::eosio_token_abi().data() ); test.chain->produce_blocks(); test.transfer( N(alice), N(bob) ); BOOST_CHECK_EXCEPTION( test.transfer( N(alice), N(charlie) ), contract_whitelist_exception, fc_exception_message_is("account 'charlie' is not on the contract whitelist") ); test.chain->push_action( N(bob), N(create), N(bob), mvo() ( "issuer", "bob" ) ( "maximum_supply", "1000000.00 CUR" ) ); BOOST_CHECK_EXCEPTION( test.chain->push_action( N(charlie), N(create), N(charlie), mvo() ( "issuer", "charlie" ) ( "maximum_supply", "1000000.00 CUR" ) ), contract_whitelist_exception, fc_exception_message_starts_with("account 'charlie' is not on the contract whitelist") ); test.chain->produce_blocks(); } FC_LOG_AND_RETHROW() } BOOST_AUTO_TEST_CASE( contract_blacklist ) { try { whitelist_blacklist_tester<> test; test.contract_blacklist = {N(charlie)}; test.init(); test.transfer( N(eosio.token), N(alice), "1000.00 TOK" ); test.transfer( N(alice), N(eosio.token) ); test.transfer( N(alice), N(bob) ); test.transfer( N(alice), N(charlie), "100.00 TOK" ); test.transfer( N(charlie), N(alice) ); test.chain->produce_blocks(); test.chain->set_code(N(bob), contracts::eosio_token_wasm() ); test.chain->set_abi(N(bob), contracts::eosio_token_abi().data() ); test.chain->produce_blocks(); test.chain->set_code(N(charlie), contracts::eosio_token_wasm() ); test.chain->set_abi(N(charlie), contracts::eosio_token_abi().data() ); test.chain->produce_blocks(); test.transfer( N(alice), N(bob) ); BOOST_CHECK_EXCEPTION( test.transfer( N(alice), N(charlie) ), contract_blacklist_exception, fc_exception_message_is("account 'charlie' is on the contract blacklist") ); test.chain->push_action( N(bob), N(create), N(bob), mvo() ( "issuer", "bob" ) ( "maximum_supply", "1000000.00 CUR" ) ); BOOST_CHECK_EXCEPTION( test.chain->push_action( N(charlie), N(create), N(charlie), mvo() ( "issuer", "charlie" ) ( "maximum_supply", "1000000.00 CUR" ) ), contract_blacklist_exception, fc_exception_message_starts_with("account 'charlie' is on the contract blacklist") ); test.chain->produce_blocks(); } FC_LOG_AND_RETHROW() } BOOST_AUTO_TEST_CASE( action_blacklist ) { try { whitelist_blacklist_tester<> test; test.contract_whitelist = {config::system_account_name, N(eosio.token), N(bob), N(charlie)}; test.action_blacklist = {{N(charlie), N(create)}}; test.init(); test.transfer( N(eosio.token), N(alice), "1000.00 TOK" ); test.chain->produce_blocks(); test.chain->set_code(N(bob), contracts::eosio_token_wasm() ); test.chain->set_abi(N(bob), contracts::eosio_token_abi().data() ); test.chain->produce_blocks(); test.chain->set_code(N(charlie), contracts::eosio_token_wasm() ); test.chain->set_abi(N(charlie), contracts::eosio_token_abi().data() ); test.chain->produce_blocks(); test.transfer( N(alice), N(bob) ); test.transfer( N(alice), N(charlie) ), test.chain->push_action( N(bob), N(create), N(bob), mvo() ( "issuer", "bob" ) ( "maximum_supply", "1000000.00 CUR" ) ); BOOST_CHECK_EXCEPTION( test.chain->push_action( N(charlie), N(create), N(charlie), mvo() ( "issuer", "charlie" ) ( "maximum_supply", "1000000.00 CUR" ) ), action_blacklist_exception, fc_exception_message_starts_with("action 'charlie::create' is on the action blacklist") ); test.chain->produce_blocks(); } FC_LOG_AND_RETHROW() } BOOST_AUTO_TEST_CASE( blacklist_eosio ) { try { whitelist_blacklist_tester<tester> tester1; tester1.init(); tester1.chain->produce_blocks(); tester1.chain->set_code(config::system_account_name, contracts::eosio_token_wasm() ); tester1.chain->produce_blocks(); tester1.shutdown(); tester1.contract_blacklist = {config::system_account_name}; tester1.init(false); whitelist_blacklist_tester<tester> tester2; tester2.init(false); while( tester2.chain->control->head_block_num() < tester1.chain->control->head_block_num() ) { auto b = tester1.chain->control->fetch_block_by_number( tester2.chain->control->head_block_num()+1 ); tester2.chain->push_block( b ); } tester1.chain->produce_blocks(2); while( tester2.chain->control->head_block_num() < tester1.chain->control->head_block_num() ) { auto b = tester1.chain->control->fetch_block_by_number( tester2.chain->control->head_block_num()+1 ); tester2.chain->push_block( b ); } } FC_LOG_AND_RETHROW() } BOOST_AUTO_TEST_CASE( deferred_blacklist_failure ) { try { whitelist_blacklist_tester<tester> tester1; tester1.init(); tester1.chain->produce_blocks(); tester1.chain->set_code( N(bob), contracts::deferred_test_wasm() ); tester1.chain->set_abi( N(bob), contracts::deferred_test_abi().data() ); tester1.chain->set_code( N(charlie), contracts::deferred_test_wasm() ); tester1.chain->set_abi( N(charlie), contracts::deferred_test_abi().data() ); tester1.chain->produce_blocks(); tester1.chain->push_action( N(bob), N(defercall), N(alice), mvo() ( "payer", "alice" ) ( "sender_id", 0 ) ( "contract", "charlie" ) ( "payload", 10 ) ); tester1.chain->produce_blocks(2); tester1.shutdown(); tester1.contract_blacklist = {N(charlie)}; tester1.init(false); whitelist_blacklist_tester<tester> tester2; tester2.init(false); while( tester2.chain->control->head_block_num() < tester1.chain->control->head_block_num() ) { auto b = tester1.chain->control->fetch_block_by_number( tester2.chain->control->head_block_num()+1 ); tester2.chain->push_block( b ); } tester1.chain->push_action( N(bob), N(defercall), N(alice), mvo() ( "payer", "alice" ) ( "sender_id", 1 ) ( "contract", "charlie" ) ( "payload", 10 ) ); BOOST_CHECK_EXCEPTION( tester1.chain->produce_blocks(), fc::exception, fc_exception_message_is("account 'charlie' is on the contract blacklist") ); tester1.chain->produce_blocks(2, true); // Produce 2 empty blocks (other than onblock of course). while( tester2.chain->control->head_block_num() < tester1.chain->control->head_block_num() ) { auto b = tester1.chain->control->fetch_block_by_number( tester2.chain->control->head_block_num()+1 ); tester2.chain->push_block( b ); } } FC_LOG_AND_RETHROW() } BOOST_AUTO_TEST_CASE( blacklist_onerror ) { try { whitelist_blacklist_tester<TESTER> tester1; tester1.init(); tester1.chain->produce_blocks(); tester1.chain->set_code( N(bob), contracts::deferred_test_wasm() ); tester1.chain->set_abi( N(bob), contracts::deferred_test_abi().data() ); tester1.chain->set_code( N(charlie), contracts::deferred_test_wasm() ); tester1.chain->set_abi( N(charlie), contracts::deferred_test_abi().data() ); tester1.chain->produce_blocks(); tester1.chain->push_action( N(bob), N(defercall), N(alice), mvo() ( "payer", "alice" ) ( "sender_id", 0 ) ( "contract", "charlie" ) ( "payload", 13 ) ); tester1.chain->produce_blocks(); tester1.shutdown(); tester1.action_blacklist = {{config::system_account_name, N(onerror)}}; tester1.init(false); tester1.chain->push_action( N(bob), N(defercall), N(alice), mvo() ( "payer", "alice" ) ( "sender_id", 0 ) ( "contract", "charlie" ) ( "payload", 13 ) ); BOOST_CHECK_EXCEPTION( tester1.chain->produce_blocks(), fc::exception, fc_exception_message_is("action 'eosio::onerror' is on the action blacklist") ); } FC_LOG_AND_RETHROW() } BOOST_AUTO_TEST_CASE( actor_blacklist_inline_deferred ) { try { whitelist_blacklist_tester<tester> tester1; tester1.init(); tester1.chain->produce_blocks(); tester1.chain->set_code( N(alice), contracts::deferred_test_wasm() ); tester1.chain->set_abi( N(alice), contracts::deferred_test_abi().data() ); tester1.chain->set_code( N(bob), contracts::deferred_test_wasm() ); tester1.chain->set_abi( N(bob), contracts::deferred_test_abi().data() ); tester1.chain->set_code( N(charlie), contracts::deferred_test_wasm() ); tester1.chain->set_abi( N(charlie), contracts::deferred_test_abi().data() ); tester1.chain->produce_blocks(); auto auth = authority(eosio::testing::base_tester::get_public_key(name("alice"), "active")); auth.accounts.push_back( permission_level_weight{{N(alice), config::eosio_code_name}, 1} ); tester1.chain->push_action( N(eosio), N(updateauth), N(alice), mvo() ( "account", "alice" ) ( "permission", "active" ) ( "parent", "owner" ) ( "auth", auth ) ); auth = authority(eosio::testing::base_tester::get_public_key(name("bob"), "active")); auth.accounts.push_back( permission_level_weight{{N(alice), config::eosio_code_name}, 1} ); auth.accounts.push_back( permission_level_weight{{N(bob), config::eosio_code_name}, 1} ); tester1.chain->push_action( N(eosio), N(updateauth), N(bob), mvo() ( "account", "bob" ) ( "permission", "active" ) ( "parent", "owner" ) ( "auth", auth ) ); auth = authority(eosio::testing::base_tester::get_public_key(name("charlie"), "active")); auth.accounts.push_back( permission_level_weight{{N(charlie), config::eosio_code_name}, 1} ); tester1.chain->push_action( N(eosio), N(updateauth), N(charlie), mvo() ( "account", "charlie" ) ( "permission", "active" ) ( "parent", "owner" ) ( "auth", auth ) ); tester1.chain->produce_blocks(2); tester1.shutdown(); tester1.actor_blacklist = {N(bob)}; tester1.init(false); whitelist_blacklist_tester<tester> tester2; tester2.init(false); while( tester2.chain->control->head_block_num() < tester1.chain->control->head_block_num() ) { auto b = tester1.chain->control->fetch_block_by_number( tester2.chain->control->head_block_num()+1 ); tester2.chain->push_block( b ); } auto log_trxs = [&](std::tuple<const transaction_trace_ptr&, const signed_transaction&> x) { auto& t = std::get<0>(x); if( !t || t->action_traces.size() == 0 ) return; const auto& act = t->action_traces[0].act; if( act.account == config::system_account_name && act.name == config::action::onblock_name ) return; if( t->receipt && t->receipt->status == transaction_receipt::executed ) { wlog( "${trx_type} ${id} executed (first action is ${code}::${action})", ("trx_type", t->scheduled ? "scheduled trx" : "trx")("id", t->id)("code", act.account)("action", act.name) ); } else { wlog( "${trx_type} ${id} failed (first action is ${code}::${action})", ("trx_type", t->scheduled ? "scheduled trx" : "trx")("id", t->id)("code", act.account)("action", act.name) ); } }; auto c1 = tester1.chain->control->applied_transaction.connect( log_trxs ); // Disallow inline actions authorized by actor in blacklist BOOST_CHECK_EXCEPTION( tester1.chain->push_action( N(alice), N(inlinecall), N(alice), mvo() ( "contract", "alice" ) ( "authorizer", "bob" ) ( "payload", 10 ) ), fc::exception, fc_exception_message_is("authorizing actor(s) in transaction are on the actor blacklist: [\"bob\"]") ); auto num_deferred = tester1.chain->control->db().get_index<generated_transaction_multi_index,by_trx_id>().size(); BOOST_REQUIRE_EQUAL(0u, num_deferred); // Schedule a deferred transaction authorized by charlie@active tester1.chain->push_action( N(charlie), N(defercall), N(alice), mvo() ( "payer", "alice" ) ( "sender_id", 0 ) ( "contract", "charlie" ) ( "payload", 10 ) ); num_deferred = tester1.chain->control->db().get_index<generated_transaction_multi_index,by_trx_id>().size(); BOOST_REQUIRE_EQUAL(1u, num_deferred); // Do not allow that deferred transaction to retire yet tester1.chain->finish_block(); tester1.chain->produce_blocks(2, true); // Produce 2 empty blocks (other than onblock of course). num_deferred = tester1.chain->control->db().get_index<generated_transaction_multi_index,by_trx_id>().size(); BOOST_REQUIRE_EQUAL(1u, num_deferred); c1.disconnect(); while( tester2.chain->control->head_block_num() < tester1.chain->control->head_block_num() ) { auto b = tester1.chain->control->fetch_block_by_number( tester2.chain->control->head_block_num()+1 ); tester2.chain->push_block( b ); } tester1.shutdown(); tester1.actor_blacklist = {N(bob), N(charlie)}; tester1.init(false); auto c2 = tester1.chain->control->applied_transaction.connect( log_trxs ); num_deferred = tester1.chain->control->db().get_index<generated_transaction_multi_index,by_trx_id>().size(); BOOST_REQUIRE_EQUAL(1, num_deferred); // With charlie now in the actor blacklist, retiring the previously scheduled deferred transaction should now not be possible. BOOST_CHECK_EXCEPTION( tester1.chain->produce_blocks(), fc::exception, fc_exception_message_is("authorizing actor(s) in transaction are on the actor blacklist: [\"charlie\"]") ); // With charlie now in the actor blacklist, it is now not possible to schedule a deferred transaction authorized by charlie@active BOOST_CHECK_EXCEPTION( tester1.chain->push_action( N(charlie), N(defercall), N(alice), mvo() ( "payer", "alice" ) ( "sender_id", 1 ) ( "contract", "charlie" ) ( "payload", 10 ) ), fc::exception, fc_exception_message_is("authorizing actor(s) in transaction are on the actor blacklist: [\"charlie\"]") ); c2.disconnect(); } FC_LOG_AND_RETHROW() } BOOST_AUTO_TEST_CASE( blacklist_sender_bypass ) { try { whitelist_blacklist_tester<tester> tester1; tester1.init(); tester1.chain->produce_blocks(); tester1.chain->set_code( N(alice), contracts::deferred_test_wasm() ); tester1.chain->set_abi( N(alice), contracts::deferred_test_abi().data() ); tester1.chain->set_code( N(bob), contracts::deferred_test_wasm() ); tester1.chain->set_abi( N(bob), contracts::deferred_test_abi().data() ); tester1.chain->set_code( N(charlie), contracts::deferred_test_wasm() ); tester1.chain->set_abi( N(charlie), contracts::deferred_test_abi().data() ); tester1.chain->produce_blocks(); auto auth = authority(eosio::testing::base_tester::get_public_key(name("alice"), "active")); auth.accounts.push_back( permission_level_weight{{N(alice), config::eosio_code_name}, 1} ); tester1.chain->push_action( N(eosio), N(updateauth), N(alice), mvo() ( "account", "alice" ) ( "permission", "active" ) ( "parent", "owner" ) ( "auth", auth ) ); auth = authority(eosio::testing::base_tester::get_public_key(name("bob"), "active")); auth.accounts.push_back( permission_level_weight{{N(bob), config::eosio_code_name}, 1} ); tester1.chain->push_action( N(eosio), N(updateauth), N(bob), mvo() ( "account", "bob" ) ( "permission", "active" ) ( "parent", "owner" ) ( "auth", auth ) ); auth = authority(eosio::testing::base_tester::get_public_key(name("charlie"), "active")); auth.accounts.push_back( permission_level_weight{{N(charlie), config::eosio_code_name}, 1} ); tester1.chain->push_action( N(eosio), N(updateauth), N(charlie), mvo() ( "account", "charlie" ) ( "permission", "active" ) ( "parent", "owner" ) ( "auth", auth ) ); tester1.chain->produce_blocks(2); tester1.shutdown(); tester1.sender_bypass_whiteblacklist = {N(charlie)}; tester1.actor_blacklist = {N(bob), N(charlie)}; tester1.init(false); BOOST_CHECK_EXCEPTION( tester1.chain->push_action( N(bob), N(deferfunc), N(bob), mvo() ( "payload", 10 ) ), fc::exception, fc_exception_message_is("authorizing actor(s) in transaction are on the actor blacklist: [\"bob\"]") ); BOOST_CHECK_EXCEPTION( tester1.chain->push_action( N(charlie), N(deferfunc), N(charlie), mvo() ( "payload", 10 ) ), fc::exception, fc_exception_message_is("authorizing actor(s) in transaction are on the actor blacklist: [\"charlie\"]") ); auto num_deferred = tester1.chain->control->db().get_index<generated_transaction_multi_index,by_trx_id>().size(); BOOST_REQUIRE_EQUAL(0, num_deferred); BOOST_CHECK_EXCEPTION( tester1.chain->push_action( N(bob), N(defercall), N(alice), mvo() ( "payer", "alice" ) ( "sender_id", 0 ) ( "contract", "bob" ) ( "payload", 10 ) ), fc::exception, fc_exception_message_is("authorizing actor(s) in transaction are on the actor blacklist: [\"bob\"]") ); num_deferred = tester1.chain->control->db().get_index<generated_transaction_multi_index,by_trx_id>().size(); BOOST_REQUIRE_EQUAL(0, num_deferred); // Schedule a deferred transaction authorized by charlie@active tester1.chain->push_action( N(charlie), N(defercall), N(alice), mvo() ( "payer", "alice" ) ( "sender_id", 0 ) ( "contract", "charlie" ) ( "payload", 10 ) ); num_deferred = tester1.chain->control->db().get_index<generated_transaction_multi_index,by_trx_id>().size(); BOOST_REQUIRE_EQUAL(1, num_deferred); // Retire the deferred transaction successfully despite charlie being on the actor blacklist. // This is allowed due to the fact that the sender of the deferred transaction (also charlie) is in the sender bypass list. tester1.chain->produce_blocks(); num_deferred = tester1.chain->control->db().get_index<generated_transaction_multi_index,by_trx_id>().size(); BOOST_REQUIRE_EQUAL(0, num_deferred); // Schedule another deferred transaction authorized by charlie@active tester1.chain->push_action( N(charlie), N(defercall), N(alice), mvo() ( "payer", "alice" ) ( "sender_id", 1 ) ( "contract", "bob" ) ( "payload", 10 ) ); // Do not yet retire the deferred transaction tester1.chain->finish_block(); num_deferred = tester1.chain->control->db().get_index<generated_transaction_multi_index,by_trx_id>().size(); BOOST_REQUIRE_EQUAL(1, num_deferred); tester1.shutdown(); tester1.sender_bypass_whiteblacklist = {N(charlie)}; tester1.actor_blacklist = {N(bob), N(charlie)}; tester1.contract_blacklist = {N(bob)}; // Add bob to the contract blacklist as well tester1.init(false); num_deferred = tester1.chain->control->db().get_index<generated_transaction_multi_index,by_trx_id>().size(); BOOST_REQUIRE_EQUAL(1, num_deferred); // Now retire the deferred transaction successfully despite charlie being on both the actor blacklist and bob being on the contract blacklist // This is allowed due to the fact that the sender of the deferred transaction (also charlie) is in the sender bypass list. tester1.chain->produce_blocks(); num_deferred = tester1.chain->control->db().get_index<generated_transaction_multi_index,by_trx_id>().size(); BOOST_REQUIRE_EQUAL(0, num_deferred); tester1.chain->push_action( N(alice), N(defercall), N(alice), mvo() ( "payer", "alice" ) ( "sender_id", 0 ) ( "contract", "bob" ) ( "payload", 10 ) ); num_deferred = tester1.chain->control->db().get_index<generated_transaction_multi_index,by_trx_id>().size(); BOOST_REQUIRE_EQUAL(1, num_deferred); // Ensure that if there if the sender is not on the sender bypass list, then the contract blacklist is enforced. BOOST_CHECK_EXCEPTION( tester1.chain->produce_blocks(), fc::exception, fc_exception_message_is("account 'bob' is on the contract blacklist") ); whitelist_blacklist_tester<tester> tester2; tester2.init(false); while( tester2.chain->control->head_block_num() < tester1.chain->control->head_block_num() ) { auto b = tester1.chain->control->fetch_block_by_number( tester2.chain->control->head_block_num()+1 ); tester2.chain->push_block( b ); } } FC_LOG_AND_RETHROW() } BOOST_AUTO_TEST_CASE( greylist_limit_tests ) { try { fc::temp_directory tempdir; auto conf_genesis = tester::default_config( tempdir ); auto& cfg = conf_genesis.second.initial_configuration; cfg.max_block_net_usage = 128 * 1024; // 64 KiB max block size cfg.target_block_net_usage_pct = config::percent_1/10; // A total net usage of more than 131 bytes will keep the block above the target. cfg.max_transaction_net_usage = 64 * 1024; cfg.max_block_cpu_usage = 150'000; // maximum of 150 ms of CPU per block cfg.target_block_cpu_usage_pct = config::percent_1/10; // More than 150 us of CPU to keep the block above the target. cfg.max_transaction_cpu_usage = 50'000; cfg.min_transaction_cpu_usage = 100; // Empty blocks (consisting of only onblock) would be below the target. // But all it takes is one transaction in the block to be above the target. tester c( conf_genesis.first, conf_genesis.second ); c.execute_setup_policy( setup_policy::full ); const resource_limits_manager& rm = c.control->get_resource_limits_manager(); const auto& user_account = N(user); const auto& other_account = N(other); c.create_accounts( {user_account, other_account} ); c.push_action( config::system_account_name, N(setalimits), config::system_account_name, fc::mutable_variant_object() ("account", user_account) ("ram_bytes", -1) ("net_weight", 1) ("cpu_weight", 1) ); c.push_action( config::system_account_name, N(setalimits), config::system_account_name, fc::mutable_variant_object() ("account", other_account) ("ram_bytes", -1) ("net_weight", 249'999'999) ("cpu_weight", 249'999'999) ); const uint64_t reqauth_net_charge = 104; auto push_reqauth = [&]( name acnt, name perm, uint32_t billed_cpu_time_us ) { signed_transaction trx; trx.actions.emplace_back( c.get_action( config::system_account_name, N(reqauth), std::vector<permission_level>{{acnt, perm}}, fc::mutable_variant_object()("from", acnt) ) ); c.set_transaction_headers( trx, 6, 0 ); trx.sign( c.get_private_key( acnt, perm.to_string() ), c.control->get_chain_id() ); // This transaction is charged 104 bytes of NET. return c.push_transaction( trx, fc::time_point::maximum(), billed_cpu_time_us ); }; // Force contraction of elastic resources until fully congested. c.produce_block(); for( size_t i = 0; i < 300; ++i ) { push_reqauth( other_account, config::active_name, cfg.min_transaction_cpu_usage ); push_reqauth( other_account, config::owner_name, cfg.min_transaction_cpu_usage ); c.produce_block(); } BOOST_REQUIRE_EQUAL( rm.get_virtual_block_cpu_limit(), cfg.max_block_cpu_usage ); BOOST_REQUIRE_EQUAL( rm.get_virtual_block_net_limit(), cfg.max_block_net_usage ); uint64_t blocks_per_day = 2*60*60*24; uint64_t user_cpu_per_day = (cfg.max_block_cpu_usage * blocks_per_day / 250'000'000); // 103 us uint64_t user_net_per_day = (cfg.max_block_net_usage * blocks_per_day / 250'000'000); // 90 bytes wdump((user_cpu_per_day)(user_net_per_day)); BOOST_REQUIRE_EQUAL( rm.get_account_cpu_limit_ex(user_account).first.max, user_cpu_per_day ); BOOST_REQUIRE_EQUAL( rm.get_account_net_limit_ex(user_account).first.max, user_net_per_day ); BOOST_REQUIRE_EQUAL( rm.get_account_cpu_limit_ex(user_account, 1).first.max, user_cpu_per_day ); BOOST_REQUIRE_EQUAL( rm.get_account_net_limit_ex(user_account, 1).first.max, user_net_per_day ); // The reqauth transaction will use more NET than the user can currently support under full congestion. BOOST_REQUIRE_EXCEPTION( push_reqauth( user_account, config::active_name, cfg.min_transaction_cpu_usage ), tx_net_usage_exceeded, fc_exception_message_starts_with("transaction net usage is too high") ); wdump((rm.get_account_net_limit(user_account).first)); // Allow congestion to reduce a little bit. c.produce_blocks(1400); BOOST_REQUIRE( rm.get_virtual_block_net_limit() > (3*cfg.max_block_net_usage) ); BOOST_REQUIRE( rm.get_virtual_block_net_limit() < (4*cfg.max_block_net_usage) ); wdump((rm.get_account_net_limit_ex(user_account))); BOOST_REQUIRE( rm.get_account_net_limit_ex(user_account).first.max > 3*reqauth_net_charge ); BOOST_REQUIRE( rm.get_account_net_limit_ex(user_account).first.max < 4*reqauth_net_charge ); // User can only push three reqauths per day even at this relaxed congestion level. push_reqauth( user_account, config::active_name, cfg.min_transaction_cpu_usage ); c.produce_block(); push_reqauth( user_account, config::active_name, cfg.min_transaction_cpu_usage ); c.produce_block(); push_reqauth( user_account, config::active_name, cfg.min_transaction_cpu_usage ); c.produce_block(); BOOST_REQUIRE_EXCEPTION( push_reqauth( user_account, config::active_name, cfg.min_transaction_cpu_usage ), tx_net_usage_exceeded, fc_exception_message_starts_with("transaction net usage is too high") ); c.produce_block( fc::days(1) ); push_reqauth( user_account, config::active_name, cfg.min_transaction_cpu_usage ); c.produce_block(); push_reqauth( user_account, config::active_name, cfg.min_transaction_cpu_usage ); c.produce_block(); push_reqauth( user_account, config::active_name, cfg.min_transaction_cpu_usage ); c.produce_block(); c.produce_block( fc::days(1) ); // Reducing the greylist limit from 1000 to 4 should not make a difference since it would not be the // bottleneck at this level of congestion. But dropping it to 3 would make a difference. { auto user_elastic_cpu_limit = rm.get_account_cpu_limit_ex(user_account).first.max; auto user_elastic_net_limit = rm.get_account_net_limit_ex(user_account).first.max; auto user_cpu_res1 = rm.get_account_cpu_limit_ex(user_account, 4); BOOST_REQUIRE_EQUAL( user_cpu_res1.first.max, user_elastic_cpu_limit ); BOOST_REQUIRE_EQUAL( user_cpu_res1.second, false ); auto user_net_res1 = rm.get_account_net_limit_ex(user_account, 4); BOOST_REQUIRE_EQUAL( user_net_res1.first.max, user_elastic_net_limit ); BOOST_REQUIRE_EQUAL( user_net_res1.second, false ); auto user_cpu_res2 = rm.get_account_cpu_limit_ex(user_account, 3); BOOST_REQUIRE( user_cpu_res2.first.max < user_elastic_cpu_limit ); BOOST_REQUIRE_EQUAL( user_cpu_res2.second, true ); auto user_net_res2 = rm.get_account_net_limit_ex(user_account, 3); BOOST_REQUIRE( user_net_res2.first.max < user_elastic_net_limit ); BOOST_REQUIRE_EQUAL( user_net_res2.second, true ); BOOST_REQUIRE( 2*reqauth_net_charge < user_net_res2.first.max ); BOOST_REQUIRE( user_net_res2.first.max < 3*reqauth_net_charge ); } ilog("setting greylist limit to 4"); c.control->set_greylist_limit( 4 ); c.produce_block(); push_reqauth( user_account, config::active_name, cfg.min_transaction_cpu_usage ); c.produce_block(); push_reqauth( user_account, config::active_name, cfg.min_transaction_cpu_usage ); c.produce_block(); push_reqauth( user_account, config::active_name, cfg.min_transaction_cpu_usage ); c.produce_block(); ilog("setting greylist limit to 3"); c.control->set_greylist_limit( 3 ); c.produce_block( fc::days(1) ); push_reqauth( user_account, config::active_name, cfg.min_transaction_cpu_usage ); c.produce_block(); push_reqauth( user_account, config::active_name, cfg.min_transaction_cpu_usage ); c.produce_block(); BOOST_REQUIRE_EXCEPTION( push_reqauth( user_account, config::active_name, cfg.min_transaction_cpu_usage ), greylist_net_usage_exceeded, fc_exception_message_starts_with("greylisted transaction net usage is too high") ); c.produce_block( fc::days(1) ); push_reqauth( user_account, config::active_name, cfg.min_transaction_cpu_usage ); c.produce_block(); push_reqauth( user_account, config::active_name, cfg.min_transaction_cpu_usage ); c.produce_block(); // Finally, dropping the greylist limit to 1 will restrict the user's NET bandwidth so much that this user // cannot push even a single reqauth just like when they were under full congestion. // However, this time the exception will be due to greylist_net_usage_exceeded rather than tx_net_usage_exceeded. ilog("setting greylist limit to 1"); c.control->set_greylist_limit( 1 ); c.produce_block( fc::days(1) ); BOOST_REQUIRE_EQUAL( rm.get_account_cpu_limit_ex(user_account, 1).first.max, user_cpu_per_day ); BOOST_REQUIRE_EQUAL( rm.get_account_net_limit_ex(user_account, 1).first.max, user_net_per_day ); BOOST_REQUIRE_EXCEPTION( push_reqauth( user_account, config::active_name, cfg.min_transaction_cpu_usage ), greylist_net_usage_exceeded, fc_exception_message_starts_with("greylisted transaction net usage is too high") ); } FC_LOG_AND_RETHROW() } BOOST_AUTO_TEST_SUITE_END()
.intel_syntax noprefix AND rax, 0b111111000000 # keep the mem. access within the sandbox MFENCE ADD rsp, 8 # ensure that the CALL and RET use the first cache set CALL f1 unreachable: // LFENCE # if you uncomment this line, the speculation will stop MOV rax, [r14 + rax] # speculative access JMP f2 LFENCE f1: LEA rdx, [rip + f2] MOV [rsp], rdx # overwrite the return address with f2 RET f2: MFENCE
// Copyright (C) 2020 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // #pragma once #include <ngraph/ngraph.hpp> //! [op:header] namespace TemplateExtension { class Operation : public ngraph::op::Op { public: static constexpr ngraph::NodeTypeInfo type_info{"Template", 0}; const ngraph::NodeTypeInfo& get_type_info() const override { return type_info; } Operation() = default; Operation(const ngraph::Output<ngraph::Node>& arg, int64_t add); void validate_and_infer_types() override; std::shared_ptr<ngraph::Node> clone_with_new_inputs(const ngraph::OutputVector& new_args) const override; bool visit_attributes(ngraph::AttributeVisitor& visitor) override; int64_t getAddAttr() const { return add; } bool evaluate(const ngraph::HostTensorVector& outputs, const ngraph::HostTensorVector& inputs) const override; private: int64_t add; }; //! [op:header] } // namespace TemplateExtension
; ---------------------------------------------------------------- ; Z88DK INTERFACE LIBRARY FOR THE BIFROST* ENGINE - RELEASE 1.2/L ; ; See "bifrost_h.h" for further details ; ---------------------------------------------------------------- ; unsigned char BIFROSTH_getTile(unsigned int px,unsigned int py) SECTION code_clib SECTION code_bifrost_h PUBLIC BIFROSTH_getTile EXTERN asm_BIFROSTH_getTile BIFROSTH_getTile: ld hl,2 ld b,h ; B=0 add hl,sp ld c,(hl) ; BC=py inc hl inc hl ld l,(hl) ; L=px jp asm_BIFROSTH_getTile
# JMH version: 1.19 # VM version: JDK 1.8.0_131, VM 25.131-b11 # VM invoker: /usr/lib/jvm/java-8-oracle/jre/bin/java # VM options: <none> # Warmup: 20 iterations, 1 s each # Measurement: 20 iterations, 1 s each # Timeout: 10 min per iteration # Threads: 1 thread, will synchronize iterations # Benchmark mode: Average time, time/op # Benchmark: com.github.arnaudroger.Seq2ArrayAccess.testGet # Parameters: (size = 10) # Run progress: 0.00% complete, ETA 00:00:40 # Fork: 1 of 1 # Preparing profilers: LinuxPerfAsmProfiler # Profilers consume stdout and stderr from target VM, use -v EXTRA to copy to console # Warmup Iteration 1: 8.084 ns/op # Warmup Iteration 2: 7.676 ns/op # Warmup Iteration 3: 7.620 ns/op # Warmup Iteration 4: 7.785 ns/op # Warmup Iteration 5: 7.789 ns/op # Warmup Iteration 6: 7.846 ns/op # Warmup Iteration 7: 7.807 ns/op # Warmup Iteration 8: 7.759 ns/op # Warmup Iteration 9: 7.816 ns/op # Warmup Iteration 10: 7.778 ns/op # Warmup Iteration 11: 7.910 ns/op # Warmup Iteration 12: 7.819 ns/op # Warmup Iteration 13: 7.811 ns/op # Warmup Iteration 14: 7.818 ns/op # Warmup Iteration 15: 7.754 ns/op # Warmup Iteration 16: 7.815 ns/op # Warmup Iteration 17: 7.856 ns/op # Warmup Iteration 18: 7.765 ns/op # Warmup Iteration 19: 7.754 ns/op # Warmup Iteration 20: 7.790 ns/op Iteration 1: 7.788 ns/op Iteration 2: 7.848 ns/op Iteration 3: 7.752 ns/op Iteration 4: 7.849 ns/op Iteration 5: 7.780 ns/op Iteration 6: 7.765 ns/op Iteration 7: 7.833 ns/op Iteration 8: 7.792 ns/op Iteration 9: 7.782 ns/op Iteration 10: 7.805 ns/op Iteration 11: 7.767 ns/op Iteration 12: 7.818 ns/op Iteration 13: 7.751 ns/op Iteration 14: 7.760 ns/op Iteration 15: 7.827 ns/op Iteration 16: 7.818 ns/op Iteration 17: 7.845 ns/op Iteration 18: 7.757 ns/op Iteration 19: 7.765 ns/op Iteration 20: 7.752 ns/op # Processing profiler results: LinuxPerfAsmProfiler Result "com.github.arnaudroger.Seq2ArrayAccess.testGet": 7.793 ±(99.9%) 0.030 ns/op [Average] (min, avg, max) = (7.751, 7.793, 7.849), stdev = 0.035 CI (99.9%): [7.762, 7.823] (assumes normal distribution) Secondary result "com.github.arnaudroger.Seq2ArrayAccess.testGet:·asm": PrintAssembly processed: 176020 total address lines. Perf output processed (skipped 23.488 seconds): Column 1: cycles (20492 events) Column 2: instructions (20471 events) Hottest code regions (>10.00% "cycles" events): ....[Hottest Region 1].............................................................................. C2, level 4, com.github.arnaudroger.generated.Seq2ArrayAccess_testGet_jmhTest::testGet_avgt_jmhStub, version 540 (221 bytes) ; - com.github.arnaudroger.generated.Seq2ArrayAccess_testGet_jmhTest::testGet_avgt_jmhStub@30 (line 234) ; implicit exception: dispatches to 0x00007f368439ff79 0x00007f368439fd75: test %r11d,%r11d 0x00007f368439fd78: jne 0x00007f368439fe75 ;*ifeq ; - com.github.arnaudroger.generated.Seq2ArrayAccess_testGet_jmhTest::testGet_avgt_jmhStub@33 (line 234) 0x00007f368439fd7e: mov $0x1,%ebp ╭ 0x00007f368439fd83: jmp 0x00007f368439fdb8 │↗ 0x00007f368439fd85: xor %edx,%edx ;*if_icmpge ││ ; - com.github.arnaudroger.Seq2ArrayAccess::testGet@18 (line 57) ││ ; - com.github.arnaudroger.generated.Seq2ArrayAccess_testGet_jmhTest::testGet_avgt_jmhStub@17 (line 232) 3.35% 2.90% ││ ↗ ↗ 0x00007f368439fd87: mov %rbx,0x40(%rsp) 0.07% 0.09% ││ │ │ 0x00007f368439fd8c: mov (%rsp),%rsi ││ │ │ 0x00007f368439fd90: data16 xchg %ax,%ax ││ │ │ 0x00007f368439fd93: callq 0x00007f36841b0020 ; OopMap{[64]=Oop [72]=Oop [80]=Oop [0]=Oop off=312} ││ │ │ ;*invokevirtual consume ││ │ │ ; - com.github.arnaudroger.generated.Seq2ArrayAccess_testGet_jmhTest::testGet_avgt_jmhStub@20 (line 232) ││ │ │ ; {optimized virtual_call} 8.49% 7.53% ││ │ │ 0x00007f368439fd98: mov 0x40(%rsp),%rbx 0.06% 0.09% ││ │ │ 0x00007f368439fd9d: movzbl 0x94(%rbx),%r11d ;*getfield isDone ││ │ │ ; - com.github.arnaudroger.generated.Seq2ArrayAccess_testGet_jmhTest::testGet_avgt_jmhStub@30 (line 234) ││ │ │ 0x00007f368439fda5: add $0x1,%rbp ; OopMap{rbx=Oop [72]=Oop [80]=Oop [0]=Oop off=329} ││ │ │ ;*ifeq ││ │ │ ; - com.github.arnaudroger.generated.Seq2ArrayAccess_testGet_jmhTest::testGet_avgt_jmhStub@33 (line 234) 3.09% 2.83% ││ │ │ 0x00007f368439fda9: test %eax,0x15e94251(%rip) # 0x00007f369a234000 ││ │ │ ; {poll} 0.03% 0.07% ││ │ │ 0x00007f368439fdaf: test %r11d,%r11d ││ │ │ 0x00007f368439fdb2: jne 0x00007f368439fe7a ;*aload ││ │ │ ; - com.github.arnaudroger.generated.Seq2ArrayAccess_testGet_jmhTest::testGet_avgt_jmhStub@13 (line 232) ↘│ │ │ 0x00007f368439fdb8: mov 0x50(%rsp),%r10 │ │ │ 0x00007f368439fdbd: mov 0x10(%r10),%r8d ;*getfield data │ │ │ ; - com.github.arnaudroger.Seq2ArrayAccess::testGet@3 (line 57) │ │ │ ; - com.github.arnaudroger.generated.Seq2ArrayAccess_testGet_jmhTest::testGet_avgt_jmhStub@17 (line 232) 3.58% 2.98% │ │ │ 0x00007f368439fdc1: mov 0xc(%r12,%r8,8),%r9d ;*arraylength │ │ │ ; - com.github.arnaudroger.Seq2ArrayAccess::testGet@8 (line 57) │ │ │ ; - com.github.arnaudroger.generated.Seq2ArrayAccess_testGet_jmhTest::testGet_avgt_jmhStub@17 (line 232) │ │ │ ; implicit exception: dispatches to 0x00007f368439ff25 3.20% 2.59% │ │ │ 0x00007f368439fdc6: test %r9d,%r9d ╰ │ │ 0x00007f368439fdc9: jle 0x00007f368439fd85 ;*if_icmpge │ │ ; - com.github.arnaudroger.Seq2ArrayAccess::testGet@18 (line 57) │ │ ; - com.github.arnaudroger.generated.Seq2ArrayAccess_testGet_jmhTest::testGet_avgt_jmhStub@17 (line 232) 3.93% 3.72% │ │ 0x00007f368439fdcb: test %r9d,%r9d │ │ 0x00007f368439fdce: jbe 0x00007f368439fea4 2.43% 3.08% │ │ 0x00007f368439fdd4: mov %r9d,%ecx 0.11% 0.08% │ │ 0x00007f368439fdd7: dec %ecx 0.03% 0.02% │ │ 0x00007f368439fdd9: cmp %r9d,%ecx │ │ 0x00007f368439fddc: jae 0x00007f368439fea4 ;*aload_3 │ │ ; - com.github.arnaudroger.Seq2ArrayAccess::testGet@21 (line 57) │ │ ; - com.github.arnaudroger.generated.Seq2ArrayAccess_testGet_jmhTest::testGet_avgt_jmhStub@17 (line 232) 3.09% 4.08% │ │ 0x00007f368439fde2: mov 0x10(%r12,%r8,8),%r10d ;*aaload │ │ ; - com.github.arnaudroger.Seq2ArrayAccess::testGet@24 (line 57) │ │ ; - com.github.arnaudroger.generated.Seq2ArrayAccess_testGet_jmhTest::testGet_avgt_jmhStub@17 (line 232) 0.01% 0.00% │ │ 0x00007f368439fde7: mov 0x10(%r12,%r10,8),%rdx ;*getfield value │ │ ; - java.lang.Long::longValue@1 (line 1000) │ │ ; - com.github.arnaudroger.Seq2ArrayAccess::testGet@30 (line 58) │ │ ; - com.github.arnaudroger.generated.Seq2ArrayAccess_testGet_jmhTest::testGet_avgt_jmhStub@17 (line 232) │ │ ; implicit exception: dispatches to 0x00007f368439ff13 6.68% 6.76% │ │ 0x00007f368439fdec: mov %r9d,%r10d 0.00% │ │ 0x00007f368439fdef: add $0xfffffffd,%r10d │ │ 0x00007f368439fdf3: cmp %r10d,%ecx │ │ 0x00007f368439fdf6: mov $0x80000000,%r11d 3.31% 4.74% │ │ 0x00007f368439fdfc: cmovl %r11d,%r10d 0.01% │ │ 0x00007f368439fe00: lea (%r12,%r8,8),%rsi │ │ 0x00007f368439fe04: cmp $0x1,%r10d │ │ 0x00007f368439fe08: jle 0x00007f368439fec5 3.08% 5.27% │ │ 0x00007f368439fe0e: mov $0x1,%edi ;*aload_3 │ │ ; - com.github.arnaudroger.Seq2ArrayAccess::testGet@21 (line 57) │ │ ; - com.github.arnaudroger.generated.Seq2ArrayAccess_testGet_jmhTest::testGet_avgt_jmhStub@17 (line 232) 0.00% 0.00% ↗│ │ 0x00007f368439fe13: mov 0x10(%rsi,%rdi,4),%r11d 0.03% 0.06% ││ │ 0x00007f368439fe18: add 0x10(%r12,%r11,8),%rdx ; implicit exception: dispatches to 0x00007f368439ff13 9.74% 10.98% ││ │ 0x00007f368439fe1d: movslq %edi,%rcx 0.11% 0.07% ││ │ 0x00007f368439fe20: mov 0x14(%rsi,%rcx,4),%r11d ;*aaload ││ │ ; - com.github.arnaudroger.Seq2ArrayAccess::testGet@24 (line 57) ││ │ ; - com.github.arnaudroger.generated.Seq2ArrayAccess_testGet_jmhTest::testGet_avgt_jmhStub@17 (line 232) 0.00% 0.01% ││ │ 0x00007f368439fe25: mov 0x10(%r12,%r11,8),%rax ;*getfield value ││ │ ; - java.lang.Long::longValue@1 (line 1000) ││ │ ; - com.github.arnaudroger.Seq2ArrayAccess::testGet@30 (line 58) ││ │ ; - com.github.arnaudroger.generated.Seq2ArrayAccess_testGet_jmhTest::testGet_avgt_jmhStub@17 (line 232) ││ │ ; implicit exception: dispatches to 0x00007f368439ff13 2.11% 2.34% ││ │ 0x00007f368439fe2a: mov 0x18(%rsi,%rcx,4),%r8d ;*aaload ││ │ ; - com.github.arnaudroger.Seq2ArrayAccess::testGet@24 (line 57) ││ │ ; - com.github.arnaudroger.generated.Seq2ArrayAccess_testGet_jmhTest::testGet_avgt_jmhStub@17 (line 232) 5.45% 4.88% ││ │ 0x00007f368439fe2f: mov 0x10(%r12,%r8,8),%r8 ;*getfield value ││ │ ; - java.lang.Long::longValue@1 (line 1000) ││ │ ; - com.github.arnaudroger.Seq2ArrayAccess::testGet@30 (line 58) ││ │ ; - com.github.arnaudroger.generated.Seq2ArrayAccess_testGet_jmhTest::testGet_avgt_jmhStub@17 (line 232) ││ │ ; implicit exception: dispatches to 0x00007f368439ff13 1.33% 1.37% ││ │ 0x00007f368439fe34: mov 0x1c(%rsi,%rcx,4),%r11d ;*aaload ││ │ ; - com.github.arnaudroger.Seq2ArrayAccess::testGet@24 (line 57) ││ │ ; - com.github.arnaudroger.generated.Seq2ArrayAccess_testGet_jmhTest::testGet_avgt_jmhStub@17 (line 232) ││ │ 0x00007f368439fe39: mov 0x10(%r12,%r11,8),%r11 ;*getfield value ││ │ ; - java.lang.Long::longValue@1 (line 1000) ││ │ ; - com.github.arnaudroger.Seq2ArrayAccess::testGet@30 (line 58) ││ │ ; - com.github.arnaudroger.generated.Seq2ArrayAccess_testGet_jmhTest::testGet_avgt_jmhStub@17 (line 232) ││ │ ; implicit exception: dispatches to 0x00007f368439ff13 2.03% 2.06% ││ │ 0x00007f368439fe3e: add %rax,%rdx 5.28% 4.58% ││ │ 0x00007f368439fe41: add %r8,%rdx 3.06% 2.91% ││ │ 0x00007f368439fe44: add %r11,%rdx ;*ladd ││ │ ; - com.github.arnaudroger.Seq2ArrayAccess::testGet@33 (line 58) ││ │ ; - com.github.arnaudroger.generated.Seq2ArrayAccess_testGet_jmhTest::testGet_avgt_jmhStub@17 (line 232) 6.59% 5.22% ││ │ 0x00007f368439fe47: add $0x4,%edi ;*iinc ││ │ ; - com.github.arnaudroger.Seq2ArrayAccess::testGet@35 (line 57) ││ │ ; - com.github.arnaudroger.generated.Seq2ArrayAccess_testGet_jmhTest::testGet_avgt_jmhStub@17 (line 232) 0.00% 0.00% ││ │ 0x00007f368439fe4a: cmp %r10d,%edi ╰│ │ 0x00007f368439fe4d: jl 0x00007f368439fe13 ;*if_icmpge │ │ ; - com.github.arnaudroger.Seq2ArrayAccess::testGet@18 (line 57) │ │ ; - com.github.arnaudroger.generated.Seq2ArrayAccess_testGet_jmhTest::testGet_avgt_jmhStub@17 (line 232) │ │ 0x00007f368439fe4f: cmp %r9d,%edi ╰ │ 0x00007f368439fe52: jge 0x00007f368439fd87 ;*aload_3 │ ; - com.github.arnaudroger.Seq2ArrayAccess::testGet@21 (line 57) │ ; - com.github.arnaudroger.generated.Seq2ArrayAccess_testGet_jmhTest::testGet_avgt_jmhStub@17 (line 232) ↗│ 0x00007f368439fe58: mov 0x10(%rsi,%rdi,4),%r10d ;*aaload ││ ; - com.github.arnaudroger.Seq2ArrayAccess::testGet@24 (line 57) ││ ; - com.github.arnaudroger.generated.Seq2ArrayAccess_testGet_jmhTest::testGet_avgt_jmhStub@17 (line 232) 3.33% 2.72% ││ 0x00007f368439fe5d: add 0x10(%r12,%r10,8),%rdx ;*ladd ││ ; - com.github.arnaudroger.Seq2ArrayAccess::testGet@33 (line 58) ││ ; - com.github.arnaudroger.generated.Seq2ArrayAccess_testGet_jmhTest::testGet_avgt_jmhStub@17 (line 232) ││ ; implicit exception: dispatches to 0x00007f368439ff13 0.17% 0.15% ││ 0x00007f368439fe62: inc %edi ;*iinc ││ ; - com.github.arnaudroger.Seq2ArrayAccess::testGet@35 (line 57) ││ ; - com.github.arnaudroger.generated.Seq2ArrayAccess_testGet_jmhTest::testGet_avgt_jmhStub@17 (line 232) 0.00% ││ 0x00007f368439fe64: cmp %r9d,%edi ╰│ 0x00007f368439fe67: jl 0x00007f368439fe58 ;*if_icmpge │ ; - com.github.arnaudroger.Seq2ArrayAccess::testGet@18 (line 57) │ ; - com.github.arnaudroger.generated.Seq2ArrayAccess_testGet_jmhTest::testGet_avgt_jmhStub@17 (line 232) ╰ 0x00007f368439fe69: jmpq 0x00007f368439fd87 0x00007f368439fe6e: xor %edx,%edx 0x00007f368439fe70: jmpq 0x00007f368439fd50 0x00007f368439fe75: mov $0x1,%ebp ;*aload_1 ; - com.github.arnaudroger.generated.Seq2ArrayAccess_testGet_jmhTest::testGet_avgt_jmhStub@36 (line 235) .................................................................................................... 83.80% 84.20% <total for region 1> ....[Hottest Region 2].............................................................................. C2, level 4, org.openjdk.jmh.infra.Blackhole::consume, version 512 (44 bytes) # parm0: rdx:rdx = long # [sp+0x30] (sp of caller) 0x00007f368438dd20: mov 0x8(%rsi),%r10d 0x00007f368438dd24: shl $0x3,%r10 0x00007f368438dd28: cmp %r10,%rax 0x00007f368438dd2b: jne 0x00007f36841afe20 ; {runtime_call} 0x00007f368438dd31: data16 xchg %ax,%ax 0x00007f368438dd34: nopl 0x0(%rax,%rax,1) 0x00007f368438dd3c: data16 data16 xchg %ax,%ax [Verified Entry Point] 3.08% 3.28% 0x00007f368438dd40: mov %eax,-0x14000(%rsp) 0.00% 0x00007f368438dd47: push %rbp 3.35% 3.35% 0x00007f368438dd48: sub $0x20,%rsp ;*synchronization entry ; - org.openjdk.jmh.infra.Blackhole::consume@-1 (line 392) 0.09% 0.08% 0x00007f368438dd4c: mov 0x90(%rsi),%r10 ;*getfield l1 ; - org.openjdk.jmh.infra.Blackhole::consume@1 (line 392) 0x00007f368438dd53: mov %rdx,%r11 3.37% 2.25% 0x00007f368438dd56: xor 0xa0(%rsi),%r11 ;*lxor ; - org.openjdk.jmh.infra.Blackhole::consume@17 (line 394) 0.13% 0.07% 0x00007f368438dd5d: mov %rdx,%r8 0x00007f368438dd60: xor %r10,%r8 ;*lxor ; - org.openjdk.jmh.infra.Blackhole::consume@13 (line 394) 0x00007f368438dd63: cmp %r11,%r8 ╭ 0x00007f368438dd66: je 0x00007f368438dd74 ;*ifne │ ; - org.openjdk.jmh.infra.Blackhole::consume@19 (line 394) 3.25% 4.03% │ 0x00007f368438dd68: add $0x20,%rsp 0.11% 0.09% │ 0x00007f368438dd6c: pop %rbp │ 0x00007f368438dd6d: test %eax,0x15ea628d(%rip) # 0x00007f369a234000 │ ; {poll_return} │ 0x00007f368438dd73: retq ↘ 0x00007f368438dd74: cmp %r11,%r8 0x00007f368438dd77: mov $0xffffffff,%ebp 0x00007f368438dd7c: jl 0x00007f368438dd86 0x00007f368438dd7e: setne %bpl 0x00007f368438dd82: movzbl %bpl,%ebp ;*lcmp ; - org.openjdk.jmh.infra.Blackhole::consume@18 (line 394) 0x00007f368438dd86: mov %rsi,(%rsp) .................................................................................................... 13.38% 13.16% <total for region 2> ....[Hottest Regions]............................................................................... 83.80% 84.20% C2, level 4 com.github.arnaudroger.generated.Seq2ArrayAccess_testGet_jmhTest::testGet_avgt_jmhStub, version 540 (221 bytes) 13.38% 13.16% C2, level 4 org.openjdk.jmh.infra.Blackhole::consume, version 512 (44 bytes) 0.93% 0.93% [kernel.kallsyms] [unknown] (0 bytes) 0.10% 0.01% [kernel.kallsyms] [unknown] (1 bytes) 0.09% [kernel.kallsyms] [unknown] (37 bytes) 0.05% 0.02% [kernel.kallsyms] [unknown] (0 bytes) 0.04% [kernel.kallsyms] [unknown] (24 bytes) 0.04% 0.02% [kernel.kallsyms] [unknown] (0 bytes) 0.03% 0.00% [kernel.kallsyms] [unknown] (9 bytes) 0.03% 0.01% [kernel.kallsyms] [unknown] (70 bytes) 0.03% 0.01% libjvm.so _ZN12outputStream15update_positionEPKcm (12 bytes) 0.02% 0.02% [kernel.kallsyms] [unknown] (48 bytes) 0.02% 0.01% [kernel.kallsyms] [unknown] (27 bytes) 0.02% 0.00% [kernel.kallsyms] [unknown] (7 bytes) 0.02% [kernel.kallsyms] [unknown] (12 bytes) 0.02% [kernel.kallsyms] [unknown] (13 bytes) 0.02% 0.01% [kernel.kallsyms] [unknown] (62 bytes) 0.02% 0.02% [kernel.kallsyms] [unknown] (43 bytes) 0.02% 0.01% [kernel.kallsyms] [unknown] (18 bytes) 0.02% 0.02% libjvm.so _ZN10fileStream5writeEPKcm (29 bytes) 1.28% 1.53% <...other 340 warm regions...> .................................................................................................... 100.00% 100.00% <totals> ....[Hottest Methods (after inlining)].............................................................. 83.80% 84.20% C2, level 4 com.github.arnaudroger.generated.Seq2ArrayAccess_testGet_jmhTest::testGet_avgt_jmhStub, version 540 13.38% 13.16% C2, level 4 org.openjdk.jmh.infra.Blackhole::consume, version 512 2.15% 1.83% [kernel.kallsyms] [unknown] 0.07% 0.03% hsdis-amd64.so [unknown] 0.03% 0.10% libc-2.26.so vfprintf 0.03% 0.02% libc-2.26.so _IO_default_xsputn 0.03% 0.01% libjvm.so _ZN12outputStream15update_positionEPKcm 0.03% 0.07% libjvm.so _ZN13RelocIterator10initializeEP7nmethodPhS2_ 0.02% 0.02% libjvm.so _ZN10fileStream5writeEPKcm 0.02% 0.04% libjvm.so _ZN13xmlTextStream5writeEPKcm 0.02% 0.01% libjvm.so _ZN10decode_env12handle_eventEPKcPh 0.02% 0.03% libc-2.26.so _IO_fwrite 0.02% 0.00% libpthread-2.26.so __pthread_disable_asynccancel 0.02% libjvm.so _ZL13printf_to_envPvPKcz 0.01% 0.01% libjvm.so _ZN13defaultStream4holdEl 0.01% 0.01% libpthread-2.26.so __libc_write 0.01% 0.02% libc-2.26.so __strlen_avx2 0.01% 0.04% libpthread-2.26.so __pthread_enable_asynccancel 0.01% 0.02% libc-2.26.so _IO_str_init_static_internal 0.01% libjvm.so _ZN2os13PlatformEvent4parkEl 0.28% 0.16% <...other 52 warm methods...> .................................................................................................... 100.00% 99.79% <totals> ....[Distribution by Source]........................................................................ 97.17% 97.35% C2, level 4 2.15% 1.83% [kernel.kallsyms] 0.38% 0.37% libjvm.so 0.13% 0.33% libc-2.26.so 0.08% 0.04% hsdis-amd64.so 0.05% 0.07% libpthread-2.26.so 0.02% 0.00% interpreter 0.01% 0.00% C1, level 3 .................................................................................................... 100.00% 100.00% <totals> # Run complete. Total time: 00:00:45 Benchmark (size) Mode Cnt Score Error Units Seq2ArrayAccess.testGet 10 avgt 20 7.793 ± 0.030 ns/op Seq2ArrayAccess.testGet:·asm 10 avgt NaN --- Benchmark result is saved to jmh-result2.csv
; vasmm68k_mot[_<HOST>] -Fbin -o icon_36_279/def_kick.info def_kick-icon_36_279.asm ; ; Default "ENV:def_kick.info" data included in "icon 36.279 (20.4.90)". ; include deficon.inc ifne DEFICON_MEM align 1 endif defIconKick: dc.w $E310 ; do_Magic = WB_DISKMAGIC dc.w $0001 ; do_Version = WB_DISKVERSION dc.l 0 ; do_Gadget+gg_NextGadget dc.w 0,0 ; do_Gadget+gg_LeftEdge/gg_TopEdge dc.w 35,16 ; do_Gadget+gg_Width/gg_Height dc.w $0004 ; do_Gadget+gg_Flags = ; GFLG_GADGIMAGE dc.w $0003 ; do_Gadget+gg_Activation = ; GACT_RELVERIFY ; GACT_IMMEDIATE dc.w $0001 ; do_Gadget+gg_GadgetType = ; GTYP_BOOLGADGET DEFICON_PTR .GadgetRender ; do_Gadget+gg_GadgetRender dc.l 0 ; do_Gadget+gg_SelectRender dc.l 0 ; do_Gadget+gg_GadgetText dc.l 0 ; do_Gadget+gg_MutualExclude dc.l 0 ; do_Gadget+gg_SpecialInfo dc.w 0 ; do_Gadget+gg_GadgetID dc.l 0 ; do_Gadget+gg_UserData dc.b 7 ; do_Type = WBKICK dc.b 0 ; do_PAD_BYTE dc.l 0 ; do_DefaultTool dc.l 0 ; do_ToolTypes dc.l $80000000 ; do_CurrentX = NO_ICON_POSITION dc.l $80000000 ; do_CurrentY = NO_ICON_POSITION DEFICON_PTR .DrawerData ; do_DrawerData dc.l 0 ; do_ToolWindow dc.l 0 ; do_StackSize .DrawerData: dc.w 0,11 ; dd_NewWindow+nw_LeftEdge/nw_TopEdge dc.w 320,100 ; dd_NewWindow+nw_Width/nw_Height dc.b -1,-1 ; dd_NewWindow+nw_DetailPen/nw_BlockPen dc.l 0 ; dd_NewWindow+nw_IDCMPFlags dc.l $0240027F ; dd_NewWindow+nw_Flags = ; WFLG_SIZEGADGET ; WFLG_DRAGBAR ; WFLG_DEPTHGADGET ; WFLG_CLOSEGADGET ; WFLG_SIZEBRIGHT ; WFLG_SIZEBBOTTOM ; WFLG_SIMPLE_REFRESH ; WFLG_REPORTMOUSE ; $00400000 ; WFLG_WBENCHWINDOW dc.l 0 ; dd_NewWindow+nw_FirstGadget dc.l 0 ; dd_NewWindow+nw_CheckMark dc.l 0 ; dd_NewWindow+nw_Title dc.l 0 ; dd_NewWindow+nw_Screen dc.l 0 ; dd_NewWindow+nw_BitMap dc.w 90,40 ; dd_NewWindow+nw_MinWidth/nw_MinHeight dc.w 65535,65535 ; dd_NewWindow+nw_MaxWidth/nw_MaxHeight dc.w $0001 ; dd_NewWindow+nw_Type = WBENCHSCREEN dc.l 18,0 ; dd_CurrentX/CurrentY ifne DEFICON_MEM dc.l 0 ; dd_Flags dc.w 0 ; dd_ViewModes endif .GadgetRender: dc.w 0,0 ; ig_LeftEdge/ig_TopEdge dc.w 35,16 ; ig_Width/ig_Height dc.w 2 ; ig_Depth DEFICON_PTR .GadgetImage ; ig_ImageData dc.b (1<<2)-1,0 ; ig_PlanePick/ig_PlaneOnOff dc.l 0 ; ig_NextImage .GadgetImage: dc.w %0000001111111111,%1111111111111000,%0000000000000000 dc.w %0000001111111111,%1111101010101000,%0000000000000000 dc.w %0000001111111111,%1111010101011000,%0000000000000000 dc.w %0000001111111111,%1110101010111000,%0000000000000000 dc.w %0000001100010001,%1101010101111000,%0000000000000000 dc.w %0000001110001000,%1010101011111000,%0000000000000000 dc.w %0000001111000100,%0101010111111000,%0000000000000000 dc.w %0000000111100010,%1010101111111000,%0000000000000000 dc.w %0000000000000000,%0000000000000000,%0000000000000000 dc.w %0000000000000000,%0000000000000000,%0000000000000000 dc.w %0000000001111111,%1111111111000000,%0000000000000000 dc.w %0000000001110000,%1111111111000000,%0000000000000000 dc.w %0000000001110000,%1111111111000000,%0000000000000000 dc.w %0000000001110000,%1111111111000000,%0000000000000000 dc.w %0000000001111111,%1111111111000000,%0000000000000000 dc.w %0000000000000000,%0000000000000000,%0000000000000000 dc.w %1111110000000000,%0000000000000111,%1110000000000000 dc.w %1111110000000000,%0000011101110110,%0110000000000000 dc.w %1111110000000000,%0000111011100111,%1110000000000000 dc.w %1111110000000000,%0001110111000111,%1110000000000000 dc.w %1111110010101010,%0011101110000111,%1110000000000000 dc.w %1111110001010101,%0111011100000111,%1110000000000000 dc.w %1111110000101010,%1110111000000111,%1110000000000000 dc.w %1111111000010101,%1111110000000111,%1110000000000000 dc.w %1111111111111111,%1111111111111111,%1110000000000000 dc.w %1111111111111111,%1111111111111111,%1110000000000000 dc.w %1111111111111111,%1111111111111111,%1110000000000000 dc.w %1111111111111111,%1111111111111111,%1110000000000000 dc.w %1111111111111111,%1111111111111111,%1110000000000000 dc.w %0111111111111111,%1111111111111111,%1110000000000000 dc.w %0011111111111111,%1111111111111111,%1110000000000000 dc.w %0000000000000000,%0000000000000000,%0000000000000000
#include <iostream> #include <vector> using namespace std; //precondition: v.size() > 0 && 1 <= k && k <=v.size() int kth_selection(const vector<int>& v, size_t k) { vector<int> left, mid, right; if(k == 1) return v[0]; for(size_t i = 1; i <= k; i++){ if(v[i] < v[0]) left.push_back(v[i]); else if(v[i] > v[0]) right.push_back(v[i]); else mid.push_back(v[i]); } if(left.size() > 0) kth_selection(left, left.size()); else return mid[0]; } int main(){ vector<int> v = {3, 2, 5, 7, 6, 8, 1, 9, 4}; size_t k = 4; cout << kth_selection(v, k) << endl; }
#include "RecoTauTag/RecoTau/interface/AntiElectronDeadECAL.h" #include "FWCore/Framework/interface/ESHandle.h" #include "CondFormats/DataRecord/interface/EcalChannelStatusRcd.h" #include "CondFormats/EcalObjects/interface/EcalChannelStatus.h" #include "Geometry/Records/interface/CaloGeometryRecord.h" #include "Geometry/CaloGeometry/interface/CaloGeometry.h" #include "Geometry/CaloTopology/interface/EcalTrigTowerConstituentsMap.h" #include "Geometry/Records/interface/IdealGeometryRecord.h" #include "DataFormats/TauReco/interface/PFTau.h" #include "DataFormats/PatCandidates/interface/Tau.h" #include "DataFormats/DetId/interface/DetId.h" #include "DataFormats/EcalDetId/interface/EBDetId.h" #include "DataFormats/EcalDetId/interface/EEDetId.h" #include "DataFormats/Math/interface/deltaR.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" AntiElectronDeadECAL::AntiElectronDeadECAL(const edm::ParameterSet& cfg) : minStatus_(cfg.getParameter<uint32_t>("minStatus")), dR2_(std::pow(cfg.getParameter<double>("dR"), 2)), extrapolateToECalEntrance_(cfg.getParameter<bool>("extrapolateToECalEntrance")), verbosity_(cfg.getParameter<int>("verbosity")), isFirstEvent_(true) {} AntiElectronDeadECAL::~AntiElectronDeadECAL() {} void AntiElectronDeadECAL::beginEvent(const edm::EventSetup& es) { updateBadTowers(es); positionAtECalEntrance_.beginEvent(es); } namespace { template <class Id> void loopXtals(std::map<uint32_t, unsigned>& nBadCrystals, std::map<uint32_t, unsigned>& maxStatus, std::map<uint32_t, double>& sumEta, std::map<uint32_t, double>& sumPhi, const EcalChannelStatus* channelStatus, const CaloGeometry* caloGeometry, const EcalTrigTowerConstituentsMap* ttMap, unsigned minStatus, const uint16_t statusMask) { // NOTE: modified version of SUSY CAF code // UserCode/SusyCAF/plugins/SusyCAF_EcalDeadChannels.cc for (int i = 0; i < Id::kSizeForDenseIndexing; ++i) { Id id = Id::unhashIndex(i); if (id == Id(0)) continue; EcalChannelStatusMap::const_iterator it = channelStatus->getMap().find(id.rawId()); unsigned status = (it == channelStatus->end()) ? 0 : (it->getStatusCode() & statusMask); if (status >= minStatus) { const GlobalPoint& point = caloGeometry->getPosition(id); uint32_t key = ttMap->towerOf(id); maxStatus[key] = std::max(status, maxStatus[key]); ++nBadCrystals[key]; sumEta[key] += point.eta(); sumPhi[key] += point.phi(); } } } } // namespace void AntiElectronDeadECAL::updateBadTowers(const edm::EventSetup& es) { // NOTE: modified version of SUSY CAF code // UserCode/SusyCAF/plugins/SusyCAF_EcalDeadChannels.cc if (!isFirstEvent_ && !channelStatusWatcher_.check(es) && !caloGeometryWatcher_.check(es) && !idealGeometryWatcher_.check(es)) return; edm::ESHandle<EcalChannelStatus> channelStatus; es.get<EcalChannelStatusRcd>().get(channelStatus); edm::ESHandle<CaloGeometry> caloGeometry; es.get<CaloGeometryRecord>().get(caloGeometry); edm::ESHandle<EcalTrigTowerConstituentsMap> ttMap; es.get<IdealGeometryRecord>().get(ttMap); std::map<uint32_t, unsigned> nBadCrystals, maxStatus; std::map<uint32_t, double> sumEta, sumPhi; loopXtals<EBDetId>(nBadCrystals, maxStatus, sumEta, sumPhi, channelStatus.product(), caloGeometry.product(), ttMap.product(), minStatus_, statusMask_); loopXtals<EEDetId>(nBadCrystals, maxStatus, sumEta, sumPhi, channelStatus.product(), caloGeometry.product(), ttMap.product(), minStatus_, statusMask_); badTowers_.clear(); for (auto it : nBadCrystals) { uint32_t key = it.first; badTowers_.push_back(TowerInfo(key, it.second, maxStatus[key], sumEta[key] / it.second, sumPhi[key] / it.second)); } isFirstEvent_ = false; } bool AntiElectronDeadECAL::operator()(const reco::Candidate* tau) const { bool isNearBadTower = false; double tau_eta = tau->eta(); double tau_phi = tau->phi(); const reco::Candidate* leadChargedHadron = nullptr; if (extrapolateToECalEntrance_) { const reco::PFTau* pfTau = dynamic_cast<const reco::PFTau*>(tau); if (pfTau != nullptr) { leadChargedHadron = pfTau->leadChargedHadrCand().isNonnull() ? pfTau->leadChargedHadrCand().get() : nullptr; } else { const pat::Tau* patTau = dynamic_cast<const pat::Tau*>(tau); if (patTau != nullptr) { leadChargedHadron = patTau->leadChargedHadrCand().isNonnull() ? patTau->leadChargedHadrCand().get() : nullptr; } } } if (leadChargedHadron != nullptr) { bool success = false; reco::Candidate::Point positionAtECalEntrance = positionAtECalEntrance_(leadChargedHadron, success); if (success) { tau_eta = positionAtECalEntrance.eta(); tau_phi = positionAtECalEntrance.phi(); } } if (verbosity_) { edm::LogPrint("TauAgainstEleDeadECAL") << "<AntiElectronDeadECal::operator()>:"; edm::LogPrint("TauAgainstEleDeadECAL") << " #badTowers = " << badTowers_.size(); if (leadChargedHadron != nullptr) { edm::LogPrint("TauAgainstEleDeadECAL") << " leadChargedHadron (" << leadChargedHadron->pdgId() << "): Pt = " << leadChargedHadron->pt() << ", eta at ECAL (vtx) = " << tau_eta << " (" << leadChargedHadron->eta() << ")" << ", phi at ECAL (vtx) = " << tau_phi << " (" << leadChargedHadron->phi() << ")"; } else { edm::LogPrint("TauAgainstEleDeadECAL") << " tau: Pt = " << tau->pt() << ", eta at vtx = " << tau_eta << ", phi at vtx = " << tau_phi; } } for (auto const& badTower : badTowers_) { if (deltaR2(badTower.eta_, badTower.phi_, tau_eta, tau_phi) < dR2_) { if (verbosity_) { edm::LogPrint("TauAgainstEleDeadECAL") << " matches badTower: eta = " << badTower.eta_ << ", phi = " << badTower.phi_; } isNearBadTower = true; break; } } return isNearBadTower; }
// Copyright 2019 Daniel Parker // Distributed under the Boost license, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // See https://github.com/danielaparker/jsoncons for latest version #ifndef JSONCONS_JSON_TRAITS_MACROS_HPP #define JSONCONS_JSON_TRAITS_MACROS_HPP #include <algorithm> // std::swap #include <iterator> // std::iterator_traits, std::input_iterator_tag #include <jsoncons/config/jsoncons_config.hpp> // JSONCONS_EXPAND, JSONCONS_QUOTE #include <jsoncons/more_type_traits.hpp> #include <jsoncons/json_visitor.hpp> #include <limits> // std::numeric_limits #include <string> #include <type_traits> // std::enable_if #include <utility> #include <jsoncons/json_type_traits.hpp> namespace jsoncons { #define JSONCONS_RDONLY(X) #define JSONCONS_RDWR(X) X struct always_true { template< class T> constexpr bool operator()(const T&) const noexcept { return true; } }; struct identity { template< class T> constexpr T&& operator()(T&& val) const noexcept { return std::forward<T>(val); } }; template <class ChT,class T> struct json_traits_macro_names {}; template <class Json> struct json_traits_helper { using string_view_type = typename Json::string_view_type; template <class OutputType> static void set_udt_member(const Json&, const string_view_type&, const OutputType&) { } template <class OutputType> static void set_udt_member(const Json& j, const string_view_type& key, OutputType& val) { val = j.at(key).template as<OutputType>(); } template <class T, class From, class OutputType> static void set_udt_member(const Json&, const string_view_type&, From, const OutputType&) { } template <class T, class From, class OutputType> static void set_udt_member(const Json& j, const string_view_type& key, From from, OutputType& val) { val = from(j.at(key).template as<T>()); } template <class U> static void set_optional_json_member(const string_view_type& key, const std::shared_ptr<U>& val, Json& j) { if (val) j.try_emplace(key, val); } template <class U> static void set_optional_json_member(const string_view_type& key, const std::unique_ptr<U>& val, Json& j) { if (val) j.try_emplace(key, val); } template <class U> static void set_optional_json_member(const string_view_type& key, const jsoncons::optional<U>& val, Json& j) { if (val) j.try_emplace(key, val); } template <class U> static void set_optional_json_member(const string_view_type& key, const U& val, Json& j) { j.try_emplace(key, val); } }; } #if defined(_MSC_VER) #pragma warning( disable : 4127) #endif #define JSONCONS_CONCAT_RAW(a, b) a ## b #define JSONCONS_CONCAT(a, b) JSONCONS_CONCAT_RAW(a, b) // Inspired by https://github.com/Loki-Astari/ThorsSerializer/blob/master/src/Serialize/Traits.h #define JSONCONS_NARGS(...) JSONCONS_NARG_(__VA_ARGS__, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0) #define JSONCONS_NARG_(...) JSONCONS_EXPAND( JSONCONS_ARG_N(__VA_ARGS__) ) #define JSONCONS_ARG_N(e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, N, ...) N #define JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, Count) Call(P1, P2, P3, P4, Count) #define JSONCONS_VARIADIC_REP_N(Call, P1, P2, P3, ...) JSONCONS_VARIADIC_REP_OF_N(Call, P1,P2, P3, JSONCONS_NARGS(__VA_ARGS__), __VA_ARGS__) #define JSONCONS_VARIADIC_REP_OF_N(Call, P1, P2, P3, Count, ...) JSONCONS_VARIADIC_REP_OF_N_(Call, P1, P2, P3, Count, __VA_ARGS__) #define JSONCONS_VARIADIC_REP_OF_N_(Call, P1, P2, P3, Count, ...) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_ ## Count(Call, P1, P2, P3, __VA_ARGS__)) #define JSONCONS_VARIADIC_REP_OF_50(Call, P1, P2, P3, P4, ...) JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, 50) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_49(Call, P1, P2, P3, __VA_ARGS__)) #define JSONCONS_VARIADIC_REP_OF_49(Call, P1, P2, P3, P4, ...) JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, 49) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_48(Call, P1, P2, P3, __VA_ARGS__)) #define JSONCONS_VARIADIC_REP_OF_48(Call, P1, P2, P3, P4, ...) JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, 48) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_47(Call, P1, P2, P3, __VA_ARGS__)) #define JSONCONS_VARIADIC_REP_OF_47(Call, P1, P2, P3, P4, ...) JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, 47, ) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_46(Call, P1, P2, P3, __VA_ARGS__)) #define JSONCONS_VARIADIC_REP_OF_46(Call, P1, P2, P3, P4, ...) JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, 46) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_45(Call, P1, P2, P3, __VA_ARGS__)) #define JSONCONS_VARIADIC_REP_OF_45(Call, P1, P2, P3, P4, ...) JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, 45) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_44(Call, P1, P2, P3, __VA_ARGS__)) #define JSONCONS_VARIADIC_REP_OF_44(Call, P1, P2, P3, P4, ...) JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, 44) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_43(Call, P1, P2, P3, __VA_ARGS__)) #define JSONCONS_VARIADIC_REP_OF_43(Call, P1, P2, P3, P4, ...) JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, 43) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_42(Call, P1, P2, P3, __VA_ARGS__)) #define JSONCONS_VARIADIC_REP_OF_42(Call, P1, P2, P3, P4, ...) JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, 42) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_41(Call, P1, P2, P3, __VA_ARGS__)) #define JSONCONS_VARIADIC_REP_OF_41(Call, P1, P2, P3, P4, ...) JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, 41) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_40(Call, P1, P2, P3, __VA_ARGS__)) #define JSONCONS_VARIADIC_REP_OF_40(Call, P1, P2, P3, P4, ...) JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, 40) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_39(Call, P1, P2, P3, __VA_ARGS__)) #define JSONCONS_VARIADIC_REP_OF_39(Call, P1, P2, P3, P4, ...) JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, 39) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_38(Call, P1, P2, P3, __VA_ARGS__)) #define JSONCONS_VARIADIC_REP_OF_38(Call, P1, P2, P3, P4, ...) JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, 38) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_37(Call, P1, P2, P3, __VA_ARGS__)) #define JSONCONS_VARIADIC_REP_OF_37(Call, P1, P2, P3, P4, ...) JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, 37) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_36(Call, P1, P2, P3, __VA_ARGS__)) #define JSONCONS_VARIADIC_REP_OF_36(Call, P1, P2, P3, P4, ...) JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, 36) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_35(Call, P1, P2, P3, __VA_ARGS__)) #define JSONCONS_VARIADIC_REP_OF_35(Call, P1, P2, P3, P4, ...) JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, 35) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_34(Call, P1, P2, P3, __VA_ARGS__)) #define JSONCONS_VARIADIC_REP_OF_34(Call, P1, P2, P3, P4, ...) JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, 34) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_33(Call, P1, P2, P3, __VA_ARGS__)) #define JSONCONS_VARIADIC_REP_OF_33(Call, P1, P2, P3, P4, ...) JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, 33) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_32(Call, P1, P2, P3, __VA_ARGS__)) #define JSONCONS_VARIADIC_REP_OF_32(Call, P1, P2, P3, P4, ...) JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, 32) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_31(Call, P1, P2, P3, __VA_ARGS__)) #define JSONCONS_VARIADIC_REP_OF_31(Call, P1, P2, P3, P4, ...) JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, 31) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_30(Call, P1, P2, P3, __VA_ARGS__)) #define JSONCONS_VARIADIC_REP_OF_30(Call, P1, P2, P3, P4, ...) JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, 30) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_29(Call, P1, P2, P3, __VA_ARGS__)) #define JSONCONS_VARIADIC_REP_OF_29(Call, P1, P2, P3, P4, ...) JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, 29) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_28(Call, P1, P2, P3, __VA_ARGS__)) #define JSONCONS_VARIADIC_REP_OF_28(Call, P1, P2, P3, P4, ...) JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, 28) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_27(Call, P1, P2, P3, __VA_ARGS__)) #define JSONCONS_VARIADIC_REP_OF_27(Call, P1, P2, P3, P4, ...) JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, 27) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_26(Call, P1, P2, P3, __VA_ARGS__)) #define JSONCONS_VARIADIC_REP_OF_26(Call, P1, P2, P3, P4, ...) JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, 26) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_25(Call, P1, P2, P3, __VA_ARGS__)) #define JSONCONS_VARIADIC_REP_OF_25(Call, P1, P2, P3, P4, ...) JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, 25) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_24(Call, P1, P2, P3, __VA_ARGS__)) #define JSONCONS_VARIADIC_REP_OF_24(Call, P1, P2, P3, P4, ...) JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, 24) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_23(Call, P1, P2, P3, __VA_ARGS__)) #define JSONCONS_VARIADIC_REP_OF_23(Call, P1, P2, P3, P4, ...) JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, 23) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_22(Call, P1, P2, P3, __VA_ARGS__)) #define JSONCONS_VARIADIC_REP_OF_22(Call, P1, P2, P3, P4, ...) JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, 22) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_21(Call, P1, P2, P3, __VA_ARGS__)) #define JSONCONS_VARIADIC_REP_OF_21(Call, P1, P2, P3, P4, ...) JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, 21) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_20(Call, P1, P2, P3, __VA_ARGS__)) #define JSONCONS_VARIADIC_REP_OF_20(Call, P1, P2, P3, P4, ...) JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, 20) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_19(Call, P1, P2, P3, __VA_ARGS__)) #define JSONCONS_VARIADIC_REP_OF_19(Call, P1, P2, P3, P4, ...) JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, 19) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_18(Call, P1, P2, P3, __VA_ARGS__)) #define JSONCONS_VARIADIC_REP_OF_18(Call, P1, P2, P3, P4, ...) JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, 18) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_17(Call, P1, P2, P3, __VA_ARGS__)) #define JSONCONS_VARIADIC_REP_OF_17(Call, P1, P2, P3, P4, ...) JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, 17) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_16(Call, P1, P2, P3, __VA_ARGS__)) #define JSONCONS_VARIADIC_REP_OF_16(Call, P1, P2, P3, P4, ...) JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, 16) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_15(Call, P1, P2, P3, __VA_ARGS__)) #define JSONCONS_VARIADIC_REP_OF_15(Call, P1, P2, P3, P4, ...) JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, 15) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_14(Call, P1, P2, P3, __VA_ARGS__)) #define JSONCONS_VARIADIC_REP_OF_14(Call, P1, P2, P3, P4, ...) JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, 14) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_13(Call, P1, P2, P3, __VA_ARGS__)) #define JSONCONS_VARIADIC_REP_OF_13(Call, P1, P2, P3, P4, ...) JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, 13) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_12(Call, P1, P2, P3, __VA_ARGS__)) #define JSONCONS_VARIADIC_REP_OF_12(Call, P1, P2, P3, P4, ...) JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, 12) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_11(Call, P1, P2, P3, __VA_ARGS__)) #define JSONCONS_VARIADIC_REP_OF_11(Call, P1, P2, P3, P4, ...) JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, 11) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_10(Call, P1, P2, P3, __VA_ARGS__)) #define JSONCONS_VARIADIC_REP_OF_10(Call, P1, P2, P3, P4, ...) JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, 10) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_9(Call, P1, P2, P3, __VA_ARGS__)) #define JSONCONS_VARIADIC_REP_OF_9(Call, P1, P2, P3, P4, ...) JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, 9) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_8(Call, P1, P2, P3, __VA_ARGS__)) #define JSONCONS_VARIADIC_REP_OF_8(Call, P1, P2, P3, P4, ...) JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, 8) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_7(Call, P1, P2, P3, __VA_ARGS__)) #define JSONCONS_VARIADIC_REP_OF_7(Call, P1, P2, P3, P4, ...) JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, 7) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_6(Call, P1, P2, P3, __VA_ARGS__)) #define JSONCONS_VARIADIC_REP_OF_6(Call, P1, P2, P3, P4, ...) JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, 6) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_5(Call, P1, P2, P3, __VA_ARGS__)) #define JSONCONS_VARIADIC_REP_OF_5(Call, P1, P2, P3, P4, ...) JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, 5) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_4(Call, P1, P2, P3, __VA_ARGS__)) #define JSONCONS_VARIADIC_REP_OF_4(Call, P1, P2, P3, P4, ...) JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, 4) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_3(Call, P1, P2, P3, __VA_ARGS__)) #define JSONCONS_VARIADIC_REP_OF_3(Call, P1, P2, P3, P4, ...) JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, 3) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_2(Call, P1, P2, P3, __VA_ARGS__)) #define JSONCONS_VARIADIC_REP_OF_2(Call, P1, P2, P3, P4, ...) JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, 2) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_1(Call, P1, P2, P3, __VA_ARGS__)) #define JSONCONS_VARIADIC_REP_OF_1(Call, P1, P2, P3, P4) JSONCONS_EXPAND(Call ## _LAST(P1, P2, P3, P4, 1)) #define JSONCONS_TYPE_TRAITS_FRIEND \ template <class JSON,class T,class Enable> \ friend struct jsoncons::json_type_traits; #define JSONCONS_EXPAND_CALL2(Call, Expr, Id) JSONCONS_EXPAND(Call(Expr, Id)) #define JSONCONS_REP_OF_N(Call, Expr, Pre, App, Count) JSONCONS_REP_OF_ ## Count(Call, Expr, Pre, App) #define JSONCONS_REP_OF_50(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call, Expr, 50) JSONCONS_REP_OF_49(Call, Expr, , App) #define JSONCONS_REP_OF_49(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call, Expr, 49) JSONCONS_REP_OF_48(Call, Expr, , App) #define JSONCONS_REP_OF_48(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call, Expr, 48) JSONCONS_REP_OF_47(Call, Expr, , App) #define JSONCONS_REP_OF_47(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call, Expr, 47) JSONCONS_REP_OF_46(Call, Expr, , App) #define JSONCONS_REP_OF_46(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call, Expr, 46) JSONCONS_REP_OF_45(Call, Expr, , App) #define JSONCONS_REP_OF_45(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call, Expr, 45) JSONCONS_REP_OF_44(Call, Expr, , App) #define JSONCONS_REP_OF_44(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call, Expr, 44) JSONCONS_REP_OF_43(Call, Expr, , App) #define JSONCONS_REP_OF_43(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call, Expr, 43) JSONCONS_REP_OF_42(Call, Expr, , App) #define JSONCONS_REP_OF_42(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call, Expr, 42) JSONCONS_REP_OF_41(Call, Expr, , App) #define JSONCONS_REP_OF_41(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call, Expr, 41) JSONCONS_REP_OF_40(Call, Expr, , App) #define JSONCONS_REP_OF_40(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call, Expr, 40) JSONCONS_REP_OF_39(Call, Expr, , App) #define JSONCONS_REP_OF_39(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call, Expr, 39) JSONCONS_REP_OF_38(Call, Expr, , App) #define JSONCONS_REP_OF_38(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call, Expr, 38) JSONCONS_REP_OF_37(Call, Expr, , App) #define JSONCONS_REP_OF_37(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call, Expr, 37) JSONCONS_REP_OF_36(Call, Expr, , App) #define JSONCONS_REP_OF_36(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call, Expr, 36) JSONCONS_REP_OF_35(Call, Expr, , App) #define JSONCONS_REP_OF_35(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call, Expr, 35) JSONCONS_REP_OF_34(Call, Expr, , App) #define JSONCONS_REP_OF_34(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call, Expr, 34) JSONCONS_REP_OF_33(Call, Expr, , App) #define JSONCONS_REP_OF_33(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call, Expr, 33) JSONCONS_REP_OF_32(Call, Expr, , App) #define JSONCONS_REP_OF_32(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call, Expr, 32) JSONCONS_REP_OF_31(Call, Expr, , App) #define JSONCONS_REP_OF_31(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call, Expr, 31) JSONCONS_REP_OF_30(Call, Expr, , App) #define JSONCONS_REP_OF_30(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call, Expr, 30) JSONCONS_REP_OF_29(Call, Expr, , App) #define JSONCONS_REP_OF_29(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call, Expr, 29) JSONCONS_REP_OF_28(Call, Expr, , App) #define JSONCONS_REP_OF_28(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call, Expr, 28) JSONCONS_REP_OF_27(Call, Expr, , App) #define JSONCONS_REP_OF_27(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call, Expr, 27) JSONCONS_REP_OF_26(Call, Expr, , App) #define JSONCONS_REP_OF_26(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call, Expr, 26) JSONCONS_REP_OF_25(Call, Expr, , App) #define JSONCONS_REP_OF_25(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call, Expr, 25) JSONCONS_REP_OF_24(Call, Expr, , App) #define JSONCONS_REP_OF_24(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call, Expr, 24) JSONCONS_REP_OF_23(Call, Expr, , App) #define JSONCONS_REP_OF_23(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call, Expr, 23) JSONCONS_REP_OF_22(Call, Expr, , App) #define JSONCONS_REP_OF_22(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call, Expr, 22) JSONCONS_REP_OF_21(Call, Expr, , App) #define JSONCONS_REP_OF_21(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call, Expr, 21) JSONCONS_REP_OF_20(Call, Expr, , App) #define JSONCONS_REP_OF_20(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call, Expr, 20) JSONCONS_REP_OF_19(Call, Expr, , App) #define JSONCONS_REP_OF_19(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call, Expr, 19) JSONCONS_REP_OF_18(Call, Expr, , App) #define JSONCONS_REP_OF_18(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call, Expr, 18) JSONCONS_REP_OF_17(Call, Expr, , App) #define JSONCONS_REP_OF_17(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call, Expr, 17) JSONCONS_REP_OF_16(Call, Expr, , App) #define JSONCONS_REP_OF_16(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call, Expr, 16) JSONCONS_REP_OF_15(Call, Expr, , App) #define JSONCONS_REP_OF_15(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call, Expr, 15) JSONCONS_REP_OF_14(Call, Expr, , App) #define JSONCONS_REP_OF_14(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call, Expr, 14) JSONCONS_REP_OF_13(Call, Expr, , App) #define JSONCONS_REP_OF_13(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call, Expr, 13) JSONCONS_REP_OF_12(Call, Expr, , App) #define JSONCONS_REP_OF_12(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call, Expr, 12) JSONCONS_REP_OF_11(Call, Expr, , App) #define JSONCONS_REP_OF_11(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call, Expr, 11) JSONCONS_REP_OF_10(Call, Expr, , App) #define JSONCONS_REP_OF_10(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call, Expr, 10) JSONCONS_REP_OF_9(Call, Expr, , App) #define JSONCONS_REP_OF_9(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call, Expr, 9) JSONCONS_REP_OF_8(Call, Expr, , App) #define JSONCONS_REP_OF_8(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call, Expr, 8) JSONCONS_REP_OF_7(Call, Expr, , App) #define JSONCONS_REP_OF_7(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call, Expr, 7) JSONCONS_REP_OF_6(Call, Expr, , App) #define JSONCONS_REP_OF_6(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call, Expr, 6) JSONCONS_REP_OF_5(Call, Expr, , App) #define JSONCONS_REP_OF_5(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call, Expr, 5) JSONCONS_REP_OF_4(Call, Expr, , App) #define JSONCONS_REP_OF_4(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call, Expr, 4) JSONCONS_REP_OF_3(Call, Expr, , App) #define JSONCONS_REP_OF_3(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call, Expr, 3) JSONCONS_REP_OF_2(Call, Expr, , App) #define JSONCONS_REP_OF_2(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call, Expr, 2) JSONCONS_REP_OF_1(Call, Expr, , App) #define JSONCONS_REP_OF_1(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call ## _LAST, Expr, 1) App #define JSONCONS_REP_OF_0(Call, Expr, Pre, App) #define JSONCONS_GENERATE_TPL_PARAMS(Call, Count) JSONCONS_REP_OF_N(Call, , , ,Count) #define JSONCONS_GENERATE_TPL_ARGS(Call, Count) JSONCONS_REP_OF_N(Call, ,<,>,Count) #define JSONCONS_GENERATE_TPL_PARAM(Expr, Id) typename T ## Id, #define JSONCONS_GENERATE_TPL_PARAM_LAST(Expr, Id) typename T ## Id #define JSONCONS_GENERATE_MORE_TPL_PARAM(Expr, Id) , typename T ## Id #define JSONCONS_GENERATE_MORE_TPL_PARAM_LAST(Expr, Id) , typename T ## Id #define JSONCONS_GENERATE_TPL_ARG(Expr, Id) T ## Id, #define JSONCONS_GENERATE_TPL_ARG_LAST(Ex, Id) T ## Id #define JSONCONS_GENERATE_NAME_STR(Prefix, P2, P3, Member, Count) JSONCONS_GENERATE_NAME_STR_LAST(Prefix, P2, P3, Member, Count) #define JSONCONS_GENERATE_NAME_STR_LAST(Prefix, P2, P3, Member, Count) \ static inline const char* Member ## _str(char) {return JSONCONS_QUOTE(,Member);} \ static inline const wchar_t* Member ## _str(wchar_t) {return JSONCONS_QUOTE(L,Member);} \ /**/ #define JSONCONS_N_MEMBER_IS(Prefix, P2, P3, Member, Count) JSONCONS_N_MEMBER_IS_LAST(Prefix, P2, P3, Member, Count) #define JSONCONS_N_MEMBER_IS_LAST(Prefix, P2, P3, Member, Count) if ((num_params-Count) < num_mandatory_params1 && !ajson.contains(json_traits_macro_names<char_type,value_type>::Member##_str(char_type{}))) return false; #define JSONCONS_N_MEMBER_AS(Prefix,P2,P3, Member, Count) JSONCONS_N_MEMBER_AS_LAST(Prefix,P2,P3, Member, Count) #define JSONCONS_N_MEMBER_AS_LAST(Prefix,P2,P3, Member, Count) \ if ((num_params-Count) < num_mandatory_params2 || ajson.contains(json_traits_macro_names<char_type,value_type>::Member##_str(char_type{}))) \ {json_traits_helper<Json>::set_udt_member(ajson,json_traits_macro_names<char_type,value_type>::Member##_str(char_type{}),aval.Member);} #define JSONCONS_ALL_MEMBER_AS(Prefix, P2,P3,Member, Count) JSONCONS_ALL_MEMBER_AS_LAST(Prefix,P2,P3, Member, Count) #define JSONCONS_ALL_MEMBER_AS_LAST(Prefix,P2,P3, Member, Count) \ json_traits_helper<Json>::set_udt_member(ajson,json_traits_macro_names<char_type,value_type>::Member##_str(char_type{}),aval.Member); #define JSONCONS_TO_JSON(Prefix, P2, P3, Member, Count) JSONCONS_TO_JSON_LAST(Prefix, P2, P3, Member, Count) #define JSONCONS_TO_JSON_LAST(Prefix, P2, P3, Member, Count) if ((num_params-Count) < num_mandatory_params2) \ {ajson.try_emplace(json_traits_macro_names<char_type,value_type>::Member##_str(char_type{}), aval.Member);} \ else {json_traits_helper<Json>::set_optional_json_member(json_traits_macro_names<char_type,value_type>::Member##_str(char_type{}), aval.Member, ajson);} #define JSONCONS_ALL_TO_JSON(Prefix, P2, P3, Member, Count) JSONCONS_ALL_TO_JSON_LAST(Prefix, P2, P3, Member, Count) #define JSONCONS_ALL_TO_JSON_LAST(Prefix, P2, P3, Member, Count) \ ajson.try_emplace(json_traits_macro_names<char_type,value_type>::Member##_str(char_type{}), aval.Member); #define JSONCONS_MEMBER_TRAITS_BASE(AsT,ToJ,NumTemplateParams,ValueType,NumMandatoryParams1,NumMandatoryParams2, ...) \ namespace jsoncons \ { \ template <class ChT JSONCONS_GENERATE_TPL_PARAMS(JSONCONS_GENERATE_MORE_TPL_PARAM, NumTemplateParams)> \ struct json_traits_macro_names<ChT,ValueType JSONCONS_GENERATE_TPL_ARGS(JSONCONS_GENERATE_TPL_ARG, NumTemplateParams)> \ { \ JSONCONS_VARIADIC_REP_N(JSONCONS_GENERATE_NAME_STR, ,,, __VA_ARGS__)\ }; \ template<typename Json JSONCONS_GENERATE_TPL_PARAMS(JSONCONS_GENERATE_MORE_TPL_PARAM, NumTemplateParams)> \ struct json_type_traits<Json, ValueType JSONCONS_GENERATE_TPL_ARGS(JSONCONS_GENERATE_TPL_ARG, NumTemplateParams)> \ { \ using value_type = ValueType JSONCONS_GENERATE_TPL_ARGS(JSONCONS_GENERATE_TPL_ARG, NumTemplateParams); \ using allocator_type = typename Json::allocator_type; \ using char_type = typename Json::char_type; \ using string_view_type = typename Json::string_view_type; \ constexpr static size_t num_params = JSONCONS_NARGS(__VA_ARGS__); \ constexpr static size_t num_mandatory_params1 = NumMandatoryParams1; \ constexpr static size_t num_mandatory_params2 = NumMandatoryParams2; \ static bool is(const Json& ajson) noexcept \ { \ if (!ajson.is_object()) return false; \ JSONCONS_VARIADIC_REP_N(JSONCONS_N_MEMBER_IS, ,,, __VA_ARGS__)\ return true; \ } \ static value_type as(const Json& ajson) \ { \ if (!is(ajson)) JSONCONS_THROW(conv_error(conv_errc::conversion_failed, "Not a " # ValueType)); \ value_type aval{}; \ JSONCONS_VARIADIC_REP_N(AsT, ,,, __VA_ARGS__) \ return aval; \ } \ static Json to_json(const value_type& aval, allocator_type alloc=allocator_type()) \ { \ Json ajson(json_object_arg, semantic_tag::none, alloc); \ JSONCONS_VARIADIC_REP_N(ToJ, ,,, __VA_ARGS__) \ return ajson; \ } \ }; \ } \ /**/ #define JSONCONS_N_MEMBER_TRAITS(ValueType,NumMandatoryParams,...) \ JSONCONS_MEMBER_TRAITS_BASE(JSONCONS_N_MEMBER_AS, JSONCONS_TO_JSON,0, ValueType,NumMandatoryParams,NumMandatoryParams, __VA_ARGS__) \ namespace jsoncons { template <> struct is_json_type_traits_declared<ValueType> : public std::true_type {}; } \ /**/ #define JSONCONS_TPL_N_MEMBER_TRAITS(NumTemplateParams, ValueType,NumMandatoryParams, ...) \ JSONCONS_MEMBER_TRAITS_BASE(JSONCONS_N_MEMBER_AS, JSONCONS_TO_JSON,NumTemplateParams, ValueType,NumMandatoryParams,NumMandatoryParams, __VA_ARGS__) \ namespace jsoncons { template <JSONCONS_GENERATE_TPL_PARAMS(JSONCONS_GENERATE_TPL_PARAM, NumTemplateParams)> struct is_json_type_traits_declared<ValueType JSONCONS_GENERATE_TPL_ARGS(JSONCONS_GENERATE_TPL_ARG, NumTemplateParams)> : public std::true_type {}; } \ /**/ #define JSONCONS_ALL_MEMBER_TRAITS(ValueType, ...) \ JSONCONS_MEMBER_TRAITS_BASE(JSONCONS_ALL_MEMBER_AS,JSONCONS_ALL_TO_JSON,0,ValueType, JSONCONS_NARGS(__VA_ARGS__), JSONCONS_NARGS(__VA_ARGS__),__VA_ARGS__) \ namespace jsoncons { template <> struct is_json_type_traits_declared<ValueType> : public std::true_type {}; } \ /**/ #define JSONCONS_TPL_ALL_MEMBER_TRAITS(NumTemplateParams, ValueType, ...) \ JSONCONS_MEMBER_TRAITS_BASE(JSONCONS_ALL_MEMBER_AS,JSONCONS_ALL_TO_JSON,NumTemplateParams,ValueType, JSONCONS_NARGS(__VA_ARGS__), JSONCONS_NARGS(__VA_ARGS__),__VA_ARGS__) \ namespace jsoncons { template <JSONCONS_GENERATE_TPL_PARAMS(JSONCONS_GENERATE_TPL_PARAM, NumTemplateParams)> struct is_json_type_traits_declared<ValueType JSONCONS_GENERATE_TPL_ARGS(JSONCONS_GENERATE_TPL_ARG, NumTemplateParams)> : public std::true_type {}; } \ /**/ #define JSONCONS_MEMBER_NAME_IS(P1, P2, P3, Seq, Count) JSONCONS_MEMBER_NAME_IS_LAST(P1, P2, P3, Seq, Count) #define JSONCONS_MEMBER_NAME_IS_LAST(P1, P2, P3, Seq, Count) if ((num_params-Count) < num_mandatory_params1 && JSONCONS_EXPAND(JSONCONS_CONCAT(JSONCONS_MEMBER_NAME_IS_,JSONCONS_NARGS Seq) Seq) #define JSONCONS_MEMBER_NAME_IS_2(Member, Name) !ajson.contains(Name)) return false; #define JSONCONS_MEMBER_NAME_IS_3(Member, Name, Mode) JSONCONS_MEMBER_NAME_IS_2(Member, Name) #define JSONCONS_MEMBER_NAME_IS_4(Member, Name, Mode, Match) JSONCONS_MEMBER_NAME_IS_6(Member, Name, Mode, Match, , ) #define JSONCONS_MEMBER_NAME_IS_5(Member, Name, Mode, Match, Into) JSONCONS_MEMBER_NAME_IS_6(Member, Name, Mode, Match, Into, ) #define JSONCONS_MEMBER_NAME_IS_6(Member, Name, Mode, Match, Into, From) !ajson.contains(Name)) return false; \ JSONCONS_TRY{if (!Match(ajson.at(Name).template as<typename std::decay<decltype(Into(((value_type*)nullptr)->Member))>::type>())) return false;} \ JSONCONS_CATCH(...) {return false;} #define JSONCONS_N_MEMBER_NAME_AS(P1, P2, P3, Seq, Count) JSONCONS_N_MEMBER_NAME_AS_LAST(P1, P2, P3, Seq, Count) #define JSONCONS_N_MEMBER_NAME_AS_LAST(P1, P2, P3, Seq, Count) JSONCONS_EXPAND(JSONCONS_CONCAT(JSONCONS_N_MEMBER_NAME_AS_,JSONCONS_NARGS Seq) Seq) #define JSONCONS_N_MEMBER_NAME_AS_2(Member, Name) \ if (ajson.contains(Name)) {json_traits_helper<Json>::set_udt_member(ajson,Name,aval.Member);} #define JSONCONS_N_MEMBER_NAME_AS_3(Member, Name, Mode) Mode(JSONCONS_N_MEMBER_NAME_AS_2(Member, Name)) #define JSONCONS_N_MEMBER_NAME_AS_4(Member, Name, Mode, Match) \ Mode(if (ajson.contains(Name)) {json_traits_helper<Json>::set_udt_member(ajson,Name,aval.Member);}) #define JSONCONS_N_MEMBER_NAME_AS_5(Member, Name, Mode, Match, Into) \ Mode(if (ajson.contains(Name)) {json_traits_helper<Json>::template set_udt_member<typename std::decay<decltype(Into(((value_type*)nullptr)->Member))>::type>(ajson,Name,aval.Member);}) #define JSONCONS_N_MEMBER_NAME_AS_6(Member, Name, Mode, Match, Into, From) \ Mode(if (ajson.contains(Name)) {json_traits_helper<Json>::template set_udt_member<typename std::decay<decltype(Into(((value_type*)nullptr)->Member))>::type>(ajson,Name,From,aval.Member);}) #define JSONCONS_ALL_MEMBER_NAME_AS(P1, P2, P3, Seq, Count) JSONCONS_ALL_MEMBER_NAME_AS_LAST(P1, P2, P3, Seq, Count) #define JSONCONS_ALL_MEMBER_NAME_AS_LAST(P1, P2, P3, Seq, Count) JSONCONS_EXPAND(JSONCONS_CONCAT(JSONCONS_ALL_MEMBER_NAME_AS_,JSONCONS_NARGS Seq) Seq) #define JSONCONS_ALL_MEMBER_NAME_AS_2(Member, Name) \ json_traits_helper<Json>::set_udt_member(ajson,Name,aval.Member); #define JSONCONS_ALL_MEMBER_NAME_AS_3(Member, Name, Mode) Mode(JSONCONS_ALL_MEMBER_NAME_AS_2(Member, Name)) #define JSONCONS_ALL_MEMBER_NAME_AS_4(Member, Name, Mode, Match) \ Mode(json_traits_helper<Json>::set_udt_member(ajson,Name,aval.Member);) #define JSONCONS_ALL_MEMBER_NAME_AS_5(Member, Name, Mode, Match, Into) \ Mode(json_traits_helper<Json>::template set_udt_member<typename std::decay<decltype(Into(((value_type*)nullptr)->Member))>::type>(ajson,Name,aval.Member);) #define JSONCONS_ALL_MEMBER_NAME_AS_6(Member, Name, Mode, Match, Into, From) \ Mode(json_traits_helper<Json>::template set_udt_member<typename std::decay<decltype(Into(((value_type*)nullptr)->Member))>::type>(ajson,Name,From,aval.Member);) #define JSONCONS_N_MEMBER_NAME_TO_JSON(P1, P2, P3, Seq, Count) JSONCONS_N_MEMBER_NAME_TO_JSON_LAST(P1, P2, P3, Seq, Count) #define JSONCONS_N_MEMBER_NAME_TO_JSON_LAST(P1, P2, P3, Seq, Count) if ((num_params-Count) < num_mandatory_params2) JSONCONS_EXPAND(JSONCONS_CONCAT(JSONCONS_N_MEMBER_NAME_TO_JSON_,JSONCONS_NARGS Seq) Seq) #define JSONCONS_N_MEMBER_NAME_TO_JSON_2(Member, Name) \ {ajson.try_emplace(Name, aval.Member);} \ else \ {json_traits_helper<Json>::set_optional_json_member(Name, aval.Member, ajson);} #define JSONCONS_N_MEMBER_NAME_TO_JSON_3(Member, Name, Mode) JSONCONS_N_MEMBER_NAME_TO_JSON_2(Member, Name) #define JSONCONS_N_MEMBER_NAME_TO_JSON_4(Member, Name, Mode, Match) JSONCONS_N_MEMBER_NAME_TO_JSON_6(Member, Name, Mode, Match,,) #define JSONCONS_N_MEMBER_NAME_TO_JSON_5(Member, Name, Mode, Match, Into) JSONCONS_N_MEMBER_NAME_TO_JSON_6(Member, Name, Mode, Match, Into, ) #define JSONCONS_N_MEMBER_NAME_TO_JSON_6(Member, Name, Mode, Match, Into, From) \ {ajson.try_emplace(Name, Into(aval.Member));} \ else \ {json_traits_helper<Json>::set_optional_json_member(Name, Into(aval.Member), ajson);} #define JSONCONS_ALL_MEMBER_NAME_TO_JSON(P1, P2, P3, Seq, Count) JSONCONS_ALL_MEMBER_NAME_TO_JSON_LAST(P1, P2, P3, Seq, Count) #define JSONCONS_ALL_MEMBER_NAME_TO_JSON_LAST(P1, P2, P3, Seq, Count) JSONCONS_EXPAND(JSONCONS_CONCAT(JSONCONS_ALL_MEMBER_NAME_TO_JSON_,JSONCONS_NARGS Seq) Seq) #define JSONCONS_ALL_MEMBER_NAME_TO_JSON_2(Member, Name) ajson.try_emplace(Name, aval.Member); #define JSONCONS_ALL_MEMBER_NAME_TO_JSON_3(Member, Name, Mode) JSONCONS_ALL_MEMBER_NAME_TO_JSON_2(Member, Name) #define JSONCONS_ALL_MEMBER_NAME_TO_JSON_4(Member, Name, Mode, Match) JSONCONS_ALL_MEMBER_NAME_TO_JSON_6(Member, Name, Mode, Match,,) #define JSONCONS_ALL_MEMBER_NAME_TO_JSON_5(Member, Name, Mode, Match, Into) JSONCONS_ALL_MEMBER_NAME_TO_JSON_6(Member, Name, Mode, Match, Into, ) #define JSONCONS_ALL_MEMBER_NAME_TO_JSON_6(Member, Name, Mode, Match, Into, From) ajson.try_emplace(Name, Into(aval.Member)); #define JSONCONS_MEMBER_NAME_TRAITS_BASE(AsT,ToJ, NumTemplateParams, ValueType,NumMandatoryParams1,NumMandatoryParams2, ...) \ namespace jsoncons \ { \ template<typename Json JSONCONS_GENERATE_TPL_PARAMS(JSONCONS_GENERATE_MORE_TPL_PARAM, NumTemplateParams)> \ struct json_type_traits<Json, ValueType JSONCONS_GENERATE_TPL_ARGS(JSONCONS_GENERATE_TPL_ARG, NumTemplateParams)> \ { \ using value_type = ValueType JSONCONS_GENERATE_TPL_ARGS(JSONCONS_GENERATE_TPL_ARG, NumTemplateParams); \ using allocator_type = typename Json::allocator_type; \ using char_type = typename Json::char_type; \ using string_view_type = typename Json::string_view_type; \ constexpr static size_t num_params = JSONCONS_NARGS(__VA_ARGS__); \ constexpr static size_t num_mandatory_params1 = NumMandatoryParams1; \ constexpr static size_t num_mandatory_params2 = NumMandatoryParams2; \ static bool is(const Json& ajson) noexcept \ { \ if (!ajson.is_object()) return false; \ JSONCONS_VARIADIC_REP_N(JSONCONS_MEMBER_NAME_IS,,,, __VA_ARGS__)\ return true; \ } \ static value_type as(const Json& ajson) \ { \ if (!is(ajson)) JSONCONS_THROW(conv_error(conv_errc::conversion_failed, "Not a " # ValueType)); \ value_type aval{}; \ JSONCONS_VARIADIC_REP_N(AsT,,,, __VA_ARGS__) \ return aval; \ } \ static Json to_json(const value_type& aval, allocator_type alloc=allocator_type()) \ { \ Json ajson(json_object_arg, semantic_tag::none, alloc); \ JSONCONS_VARIADIC_REP_N(ToJ,,,, __VA_ARGS__) \ return ajson; \ } \ }; \ } \ /**/ #define JSONCONS_N_MEMBER_NAME_TRAITS(ValueType,NumMandatoryParams, ...) \ JSONCONS_MEMBER_NAME_TRAITS_BASE(JSONCONS_N_MEMBER_NAME_AS, JSONCONS_N_MEMBER_NAME_TO_JSON, 0, ValueType,NumMandatoryParams,NumMandatoryParams, __VA_ARGS__) \ namespace jsoncons { template <> struct is_json_type_traits_declared<ValueType> : public std::true_type {}; } \ /**/ #define JSONCONS_TPL_N_MEMBER_NAME_TRAITS(NumTemplateParams, ValueType,NumMandatoryParams, ...) \ JSONCONS_MEMBER_NAME_TRAITS_BASE(JSONCONS_N_MEMBER_NAME_AS, JSONCONS_N_MEMBER_NAME_TO_JSON, NumTemplateParams, ValueType,NumMandatoryParams,NumMandatoryParams, __VA_ARGS__) \ namespace jsoncons { template <JSONCONS_GENERATE_TPL_PARAMS(JSONCONS_GENERATE_TPL_PARAM, NumTemplateParams)> struct is_json_type_traits_declared<ValueType JSONCONS_GENERATE_TPL_ARGS(JSONCONS_GENERATE_TPL_ARG, NumTemplateParams)> : public std::true_type {}; } \ /**/ #define JSONCONS_ALL_MEMBER_NAME_TRAITS(ValueType, ...) \ JSONCONS_MEMBER_NAME_TRAITS_BASE(JSONCONS_ALL_MEMBER_NAME_AS, JSONCONS_ALL_MEMBER_NAME_TO_JSON, 0, ValueType, JSONCONS_NARGS(__VA_ARGS__), JSONCONS_NARGS(__VA_ARGS__), __VA_ARGS__) \ namespace jsoncons { template <> struct is_json_type_traits_declared<ValueType> : public std::true_type {}; } \ /**/ #define JSONCONS_TPL_ALL_MEMBER_NAME_TRAITS(NumTemplateParams, ValueType, ...) \ JSONCONS_MEMBER_NAME_TRAITS_BASE(JSONCONS_ALL_MEMBER_NAME_AS, JSONCONS_ALL_MEMBER_NAME_TO_JSON, NumTemplateParams, ValueType, JSONCONS_NARGS(__VA_ARGS__), JSONCONS_NARGS(__VA_ARGS__), __VA_ARGS__) \ namespace jsoncons { template <JSONCONS_GENERATE_TPL_PARAMS(JSONCONS_GENERATE_TPL_PARAM, NumTemplateParams)> struct is_json_type_traits_declared<ValueType JSONCONS_GENERATE_TPL_ARGS(JSONCONS_GENERATE_TPL_ARG, NumTemplateParams)> : public std::true_type {}; } \ /**/ #define JSONCONS_CTOR_GETTER_IS(Prefix, P2, P3, Getter, Count) JSONCONS_CTOR_GETTER_IS_LAST(Prefix, P2, P3, Getter, Count) #define JSONCONS_CTOR_GETTER_IS_LAST(Prefix, P2, P3, Getter, Count) if ((num_params-Count) < num_mandatory_params1 && !ajson.contains(json_traits_macro_names<char_type,value_type>::Getter##_str(char_type{}))) return false; #define JSONCONS_CTOR_GETTER_AS(Prefix, P2, P3, Getter, Count) JSONCONS_CTOR_GETTER_AS_LAST(Prefix, P2, P3, Getter, Count), #define JSONCONS_CTOR_GETTER_AS_LAST(Prefix, P2, P3, Getter, Count) ((num_params-Count) < num_mandatory_params2) ? (ajson.at(json_traits_macro_names<char_type,value_type>::Getter##_str(char_type{}))).template as<typename std::decay<decltype(((value_type*)nullptr)->Getter())>::type>() : (ajson.contains(json_traits_macro_names<char_type,value_type>::Getter##_str(char_type{})) ? (ajson.at(json_traits_macro_names<char_type,value_type>::Getter##_str(char_type{}))).template as<typename std::decay<decltype(((value_type*)nullptr)->Getter())>::type>() : typename std::decay<decltype(((value_type*)nullptr)->Getter())>::type()) #define JSONCONS_CTOR_GETTER_TO_JSON(Prefix, P2, P3, Getter, Count) JSONCONS_CTOR_GETTER_TO_JSON_LAST(Prefix, P2, P3, Getter, Count) #define JSONCONS_CTOR_GETTER_TO_JSON_LAST(Prefix, P2, P3, Getter, Count) \ if ((num_params-Count) < num_mandatory_params2) { \ ajson.try_emplace(json_traits_macro_names<char_type,value_type>::Getter##_str(char_type{}), aval.Getter() ); \ } \ else { \ json_traits_helper<Json>::set_optional_json_member(json_traits_macro_names<char_type,value_type>::Getter##_str(char_type{}), aval.Getter(), ajson); \ } #define JSONCONS_CTOR_GETTER_TRAITS_BASE(NumTemplateParams, ValueType,NumMandatoryParams1,NumMandatoryParams2, ...) \ namespace jsoncons \ { \ template <class ChT JSONCONS_GENERATE_TPL_PARAMS(JSONCONS_GENERATE_MORE_TPL_PARAM, NumTemplateParams)> \ struct json_traits_macro_names<ChT,ValueType JSONCONS_GENERATE_TPL_ARGS(JSONCONS_GENERATE_TPL_ARG, NumTemplateParams)> \ { \ JSONCONS_VARIADIC_REP_N(JSONCONS_GENERATE_NAME_STR, ,,, __VA_ARGS__)\ }; \ template<typename Json JSONCONS_GENERATE_TPL_PARAMS(JSONCONS_GENERATE_MORE_TPL_PARAM, NumTemplateParams)> \ struct json_type_traits<Json, ValueType JSONCONS_GENERATE_TPL_ARGS(JSONCONS_GENERATE_TPL_ARG, NumTemplateParams)> \ { \ using value_type = ValueType JSONCONS_GENERATE_TPL_ARGS(JSONCONS_GENERATE_TPL_ARG, NumTemplateParams); \ using allocator_type = typename Json::allocator_type; \ using char_type = typename Json::char_type; \ using string_view_type = typename Json::string_view_type; \ constexpr static size_t num_params = JSONCONS_NARGS(__VA_ARGS__); \ constexpr static size_t num_mandatory_params1 = NumMandatoryParams1; \ constexpr static size_t num_mandatory_params2 = NumMandatoryParams2; \ static bool is(const Json& ajson) noexcept \ { \ if (!ajson.is_object()) return false; \ JSONCONS_VARIADIC_REP_N(JSONCONS_CTOR_GETTER_IS, ,,, __VA_ARGS__)\ return true; \ } \ static value_type as(const Json& ajson) \ { \ if (!is(ajson)) JSONCONS_THROW(conv_error(conv_errc::conversion_failed, "Not a " # ValueType)); \ return value_type ( JSONCONS_VARIADIC_REP_N(JSONCONS_CTOR_GETTER_AS, ,,, __VA_ARGS__) ); \ } \ static Json to_json(const value_type& aval, allocator_type alloc=allocator_type()) \ { \ Json ajson(json_object_arg, semantic_tag::none, alloc); \ JSONCONS_VARIADIC_REP_N(JSONCONS_CTOR_GETTER_TO_JSON, ,,, __VA_ARGS__) \ return ajson; \ } \ }; \ } \ /**/ #define JSONCONS_ALL_CTOR_GETTER_TRAITS(ValueType, ...) \ JSONCONS_CTOR_GETTER_TRAITS_BASE(0, ValueType, JSONCONS_NARGS(__VA_ARGS__), JSONCONS_NARGS(__VA_ARGS__), __VA_ARGS__) \ namespace jsoncons { template <> struct is_json_type_traits_declared<ValueType> : public std::true_type {}; } \ /**/ #define JSONCONS_TPL_ALL_CTOR_GETTER_TRAITS(NumTemplateParams, ValueType, ...) \ JSONCONS_CTOR_GETTER_TRAITS_BASE(NumTemplateParams, ValueType, JSONCONS_NARGS(__VA_ARGS__), JSONCONS_NARGS(__VA_ARGS__), __VA_ARGS__) \ namespace jsoncons { template <JSONCONS_GENERATE_TPL_PARAMS(JSONCONS_GENERATE_TPL_PARAM, NumTemplateParams)> struct is_json_type_traits_declared<ValueType JSONCONS_GENERATE_TPL_ARGS(JSONCONS_GENERATE_TPL_ARG, NumTemplateParams)> : public std::true_type {}; } \ /**/ #define JSONCONS_N_CTOR_GETTER_TRAITS(ValueType,NumMandatoryParams, ...) \ JSONCONS_CTOR_GETTER_TRAITS_BASE(0, ValueType,NumMandatoryParams,NumMandatoryParams, __VA_ARGS__) \ namespace jsoncons { template <> struct is_json_type_traits_declared<ValueType> : public std::true_type {}; } \ /**/ #define JSONCONS_N_ALL_CTOR_GETTER_TRAITS(NumTemplateParams, ValueType,NumMandatoryParams, ...) \ JSONCONS_CTOR_GETTER_TRAITS_BASE(NumTemplateParams, ValueType,NumMandatoryParams,NumMandatoryParams, __VA_ARGS__) \ namespace jsoncons { template <> struct is_json_type_traits_declared<ValueType> : public std::true_type {}; } \ /**/ #define JSONCONS_CTOR_GETTER_NAME_IS(P1, P2, P3, Seq, Count) JSONCONS_CTOR_GETTER_NAME_IS_LAST(P1, P2, P3, Seq, Count) #define JSONCONS_CTOR_GETTER_NAME_IS_LAST(P1, P2, P3, Seq, Count) if ((num_params-Count) < num_mandatory_params1 && JSONCONS_EXPAND(JSONCONS_CONCAT(JSONCONS_CTOR_GETTER_NAME_IS_,JSONCONS_NARGS Seq) Seq) #define JSONCONS_CTOR_GETTER_NAME_IS_2(Getter, Name) !ajson.contains(Name)) return false; #define JSONCONS_CTOR_GETTER_NAME_IS_3(Getter, Name, Mode) JSONCONS_CTOR_GETTER_NAME_IS_2(Getter, Name) #define JSONCONS_CTOR_GETTER_NAME_IS_4(Getter, Name, Mode, Match) JSONCONS_CTOR_GETTER_NAME_IS_6(Getter, Name, Mode, Match, , ) #define JSONCONS_CTOR_GETTER_NAME_IS_5(Getter, Name, Mode, Match, Into) JSONCONS_CTOR_GETTER_NAME_IS_6(Getter, Name, Mode, Match, Into, ) #define JSONCONS_CTOR_GETTER_NAME_IS_6(Getter, Name, Mode, Match, Into, From) !ajson.contains(Name)) return false; \ JSONCONS_TRY{if (!Match(ajson.at(Name).template as<typename std::decay<decltype(Into(((value_type*)nullptr)->Getter()))>::type>())) return false;} \ JSONCONS_CATCH(...) {return false;} #define JSONCONS_CTOR_GETTER_NAME_AS(P1, P2, P3, Seq, Count) JSONCONS_EXPAND(JSONCONS_CONCAT(JSONCONS_CTOR_GETTER_NAME_AS_,JSONCONS_NARGS Seq) Seq) #define JSONCONS_CTOR_GETTER_NAME_AS_2(Getter, Name) JSONCONS_CTOR_GETTER_NAME_AS_LAST_2(Getter, Name) JSONCONS_COMMA #define JSONCONS_CTOR_GETTER_NAME_AS_3(Getter, Name, Mode) Mode(JSONCONS_CTOR_GETTER_NAME_AS_LAST_2(Getter, Name)) Mode(JSONCONS_COMMA) #define JSONCONS_CTOR_GETTER_NAME_AS_4(Getter, Name, Mode, Match) JSONCONS_CTOR_GETTER_NAME_AS_6(Getter, Name, Mode, Match,,) #define JSONCONS_CTOR_GETTER_NAME_AS_5(Getter, Name, Mode, Match, Into) JSONCONS_CTOR_GETTER_NAME_AS_6(Getter, Name, Mode, Match, Into, ) #define JSONCONS_CTOR_GETTER_NAME_AS_6(Getter, Name, Mode, Match, Into, From) JSONCONS_CTOR_GETTER_NAME_AS_LAST_6(Getter,Name,Mode,Match,Into,From) Mode(JSONCONS_COMMA) #define JSONCONS_COMMA , #define JSONCONS_CTOR_GETTER_NAME_AS_LAST(P1, P2, P3, Seq, Count) JSONCONS_EXPAND(JSONCONS_CONCAT(JSONCONS_CTOR_GETTER_NAME_AS_LAST_,JSONCONS_NARGS Seq) Seq) #define JSONCONS_CTOR_GETTER_NAME_AS_LAST_2(Getter, Name) (ajson.contains(Name)) ? (ajson.at(Name)).template as<typename std::decay<decltype(((value_type*)nullptr)->Getter())>::type>() : typename std::decay<decltype(((value_type*)nullptr)->Getter())>::type() #define JSONCONS_CTOR_GETTER_NAME_AS_LAST_3(Getter, Name, Mode) Mode(JSONCONS_CTOR_GETTER_NAME_AS_LAST_2(Getter, Name)) #define JSONCONS_CTOR_GETTER_NAME_AS_LAST_4(Getter, Name, Mode, Match) JSONCONS_CTOR_GETTER_NAME_AS_LAST_6(Getter, Name, Mode, Match,,) #define JSONCONS_CTOR_GETTER_NAME_AS_LAST_5(Getter, Name, Mode, Match, Into) JSONCONS_CTOR_GETTER_NAME_AS_LAST_6(Getter, Name, Mode, Match, Into, ) #define JSONCONS_CTOR_GETTER_NAME_AS_LAST_6(Getter, Name, Mode, Match, Into, From) Mode(ajson.contains(Name) ? From(ajson.at(Name).template as<typename std::decay<decltype(Into(((value_type*)nullptr)->Getter()))>::type>()) : From(typename std::decay<decltype(Into(((value_type*)nullptr)->Getter()))>::type())) #define JSONCONS_CTOR_GETTER_NAME_TO_JSON(P1, P2, P3, Seq, Count) JSONCONS_CTOR_GETTER_NAME_TO_JSON_LAST(P1, P2, P3, Seq, Count) #define JSONCONS_CTOR_GETTER_NAME_TO_JSON_LAST(P1, P2, P3, Seq, Count) if ((num_params-Count) < num_mandatory_params2) JSONCONS_EXPAND(JSONCONS_CONCAT(JSONCONS_CTOR_GETTER_NAME_TO_JSON_,JSONCONS_NARGS Seq) Seq) #define JSONCONS_CTOR_GETTER_NAME_TO_JSON_2(Getter, Name) \ { \ ajson.try_emplace(Name, aval.Getter() ); \ } \ else { \ json_traits_helper<Json>::set_optional_json_member(Name, aval.Getter(), ajson); \ } #define JSONCONS_CTOR_GETTER_NAME_TO_JSON_3(Getter, Name, Mode) JSONCONS_CTOR_GETTER_NAME_TO_JSON_2(Getter, Name) #define JSONCONS_CTOR_GETTER_NAME_TO_JSON_4(Getter, Name, Mode, Match) JSONCONS_CTOR_GETTER_NAME_TO_JSON_2(Getter, Name) #define JSONCONS_CTOR_GETTER_NAME_TO_JSON_5(Getter, Name, Mode, Match, Into) JSONCONS_CTOR_GETTER_NAME_TO_JSON_6(Getter, Name, Mode, Match, Into, ) #define JSONCONS_CTOR_GETTER_NAME_TO_JSON_6(Getter, Name, Mode, Match, Into, From) \ { \ ajson.try_emplace(Name, Into(aval.Getter()) ); \ } \ else { \ json_traits_helper<Json>::set_optional_json_member(Name, Into(aval.Getter()), ajson); \ } #define JSONCONS_CTOR_GETTER_NAME_TRAITS_BASE(NumTemplateParams, ValueType,NumMandatoryParams1,NumMandatoryParams2, ...) \ namespace jsoncons \ { \ template<typename Json JSONCONS_GENERATE_TPL_PARAMS(JSONCONS_GENERATE_MORE_TPL_PARAM, NumTemplateParams)> \ struct json_type_traits<Json, ValueType JSONCONS_GENERATE_TPL_ARGS(JSONCONS_GENERATE_TPL_ARG, NumTemplateParams)> \ { \ using value_type = ValueType JSONCONS_GENERATE_TPL_ARGS(JSONCONS_GENERATE_TPL_ARG, NumTemplateParams); \ using allocator_type = typename Json::allocator_type; \ using char_type = typename Json::char_type; \ using string_view_type = typename Json::string_view_type; \ constexpr static size_t num_params = JSONCONS_NARGS(__VA_ARGS__); \ constexpr static size_t num_mandatory_params1 = NumMandatoryParams1; \ constexpr static size_t num_mandatory_params2 = NumMandatoryParams2; \ static bool is(const Json& ajson) noexcept \ { \ if (!ajson.is_object()) return false; \ JSONCONS_VARIADIC_REP_N(JSONCONS_CTOR_GETTER_NAME_IS,,,, __VA_ARGS__)\ return true; \ } \ static value_type as(const Json& ajson) \ { \ if (!is(ajson)) JSONCONS_THROW(conv_error(conv_errc::conversion_failed, "Not a " # ValueType)); \ return value_type ( JSONCONS_VARIADIC_REP_N(JSONCONS_CTOR_GETTER_NAME_AS,,,, __VA_ARGS__) ); \ } \ static Json to_json(const value_type& aval, allocator_type alloc=allocator_type()) \ { \ Json ajson(json_object_arg, semantic_tag::none, alloc); \ JSONCONS_VARIADIC_REP_N(JSONCONS_CTOR_GETTER_NAME_TO_JSON,,,, __VA_ARGS__) \ return ajson; \ } \ }; \ } \ /**/ #define JSONCONS_ALL_CTOR_GETTER_NAME_TRAITS(ValueType, ...) \ JSONCONS_CTOR_GETTER_NAME_TRAITS_BASE(0, ValueType, JSONCONS_NARGS(__VA_ARGS__), JSONCONS_NARGS(__VA_ARGS__), __VA_ARGS__) \ namespace jsoncons { template <> struct is_json_type_traits_declared<ValueType> : public std::true_type {}; } \ /**/ #define JSONCONS_TPL_ALL_CTOR_GETTER_NAME_TRAITS(NumTemplateParams, ValueType, ...) \ JSONCONS_CTOR_GETTER_NAME_TRAITS_BASE(NumTemplateParams, ValueType, JSONCONS_NARGS(__VA_ARGS__), JSONCONS_NARGS(__VA_ARGS__), __VA_ARGS__) \ namespace jsoncons { template <JSONCONS_GENERATE_TPL_PARAMS(JSONCONS_GENERATE_TPL_PARAM, NumTemplateParams)> struct is_json_type_traits_declared<ValueType JSONCONS_GENERATE_TPL_ARGS(JSONCONS_GENERATE_TPL_ARG, NumTemplateParams)> : public std::true_type {}; } \ /**/ #define JSONCONS_N_CTOR_GETTER_NAME_TRAITS(ValueType,NumMandatoryParams, ...) \ JSONCONS_CTOR_GETTER_NAME_TRAITS_BASE(0, ValueType,NumMandatoryParams,NumMandatoryParams, __VA_ARGS__) \ namespace jsoncons { template <> struct is_json_type_traits_declared<ValueType> : public std::true_type {}; } \ /**/ #define JSONCONS_TPL_N_CTOR_GETTER_NAME_TRAITS(NumTemplateParams, ValueType,NumMandatoryParams, ...) \ JSONCONS_CTOR_GETTER_NAME_TRAITS_BASE(NumTemplateParams, ValueType,NumMandatoryParams,NumMandatoryParams, __VA_ARGS__) \ namespace jsoncons { template <JSONCONS_GENERATE_TPL_PARAMS(JSONCONS_GENERATE_TPL_PARAM, NumTemplateParams)> struct is_json_type_traits_declared<ValueType JSONCONS_GENERATE_TPL_ARGS(JSONCONS_GENERATE_TPL_ARG, NumTemplateParams)> : public std::true_type {}; } \ /**/ #define JSONCONS_ENUM_PAIR(Prefix, P2, P3, Member, Count) JSONCONS_ENUM_PAIR_LAST(Prefix, P2, P3, Member, Count), #define JSONCONS_ENUM_PAIR_LAST(Prefix, P2, P3, Member, Count) {value_type::Member, json_traits_macro_names<char_type,value_type>::Member##_str(char_type{})} #define JSONCONS_ENUM_TRAITS_BASE(EnumType, ...) \ namespace jsoncons \ { \ template <class ChT> \ struct json_traits_macro_names<ChT,EnumType> \ { \ JSONCONS_VARIADIC_REP_N(JSONCONS_GENERATE_NAME_STR, ,,, __VA_ARGS__)\ }; \ template<typename Json> \ struct json_type_traits<Json, EnumType> \ { \ static_assert(std::is_enum<EnumType>::value, # EnumType " must be an enum"); \ using value_type = EnumType; \ using char_type = typename Json::char_type; \ using string_type = std::basic_string<char_type>; \ using string_view_type = jsoncons::basic_string_view<char_type>; \ using allocator_type = typename Json::allocator_type; \ using mapped_type = std::pair<EnumType,string_type>; \ \ static std::pair<const mapped_type*,const mapped_type*> get_values() \ { \ static const mapped_type v[] = { \ JSONCONS_VARIADIC_REP_N(JSONCONS_ENUM_PAIR, ,,, __VA_ARGS__)\ };\ return std::make_pair(v,v+JSONCONS_NARGS(__VA_ARGS__)); \ } \ \ static bool is(const Json& ajson) noexcept \ { \ if (!ajson.is_string()) return false; \ auto first = get_values().first; \ auto last = get_values().second; \ const string_view_type s = ajson.template as<string_view_type>(); \ if (s.empty() && std::find_if(first, last, \ [](const mapped_type& item) -> bool \ { return item.first == value_type(); }) == last) \ { \ return true; \ } \ auto it = std::find_if(first, last, \ [&](const mapped_type& item) -> bool \ { return item.second == s; }); \ return it != last; \ } \ static value_type as(const Json& ajson) \ { \ if (!is(ajson)) JSONCONS_THROW(conv_error(conv_errc::conversion_failed, "Not a " # EnumType)); \ const string_view_type s = ajson.template as<string_view_type>(); \ auto first = get_values().first; \ auto last = get_values().second; \ if (s.empty() && std::find_if(first, last, \ [](const mapped_type& item) -> bool \ { return item.first == value_type(); }) == last) \ { \ return value_type(); \ } \ auto it = std::find_if(first, last, \ [&](const mapped_type& item) -> bool \ { return item.second == s; }); \ if (it == last) \ { \ if (s.empty()) \ { \ return value_type(); \ } \ else \ { \ JSONCONS_THROW(conv_error(conv_errc::conversion_failed, "Not an enum")); \ } \ } \ return it->first; \ } \ static Json to_json(value_type aval, allocator_type alloc=allocator_type()) \ { \ static constexpr char_type empty_string[] = {0}; \ auto first = get_values().first; \ auto last = get_values().second; \ auto it = std::find_if(first, last, \ [aval](const mapped_type& item) -> bool \ { return item.first == aval; }); \ if (it == last) \ { \ if (aval == value_type()) \ { \ return Json(empty_string); \ } \ else \ { \ JSONCONS_THROW(conv_error(conv_errc::conversion_failed, "Not an enum")); \ } \ } \ return Json(it->second,alloc); \ } \ }; \ } \ /**/ #define JSONCONS_ENUM_TRAITS(EnumType, ...) \ JSONCONS_ENUM_TRAITS_BASE(EnumType,__VA_ARGS__) \ namespace jsoncons { template <> struct is_json_type_traits_declared<EnumType> : public std::true_type {}; } \ /**/ #define JSONCONS_NAME_ENUM_PAIR(P1, P2, P3, Seq, Count) JSONCONS_EXPAND(JSONCONS_NAME_ENUM_PAIR_ Seq), #define JSONCONS_NAME_ENUM_PAIR_LAST(P1, P2, P3, Seq, Count) JSONCONS_EXPAND(JSONCONS_NAME_ENUM_PAIR_ Seq) #define JSONCONS_NAME_ENUM_PAIR_(Member, Name) {value_type::Member, Name} #define JSONCONS_ENUM_NAME_TRAITS(EnumType, ...) \ namespace jsoncons \ { \ template<typename Json> \ struct json_type_traits<Json, EnumType> \ { \ static_assert(std::is_enum<EnumType>::value, # EnumType " must be an enum"); \ using value_type = EnumType; \ using char_type = typename Json::char_type; \ using string_type = std::basic_string<char_type>; \ using string_view_type = jsoncons::basic_string_view<char_type>; \ using allocator_type = typename Json::allocator_type; \ using mapped_type = std::pair<EnumType,string_type>; \ \ static std::pair<const mapped_type*,const mapped_type*> get_values() \ { \ static const mapped_type v[] = { \ JSONCONS_VARIADIC_REP_N(JSONCONS_NAME_ENUM_PAIR,,,, __VA_ARGS__)\ };\ return std::make_pair(v,v+JSONCONS_NARGS(__VA_ARGS__)); \ } \ \ static bool is(const Json& ajson) noexcept \ { \ if (!ajson.is_string()) return false; \ auto first = get_values().first; \ auto last = get_values().second; \ const string_view_type s = ajson.template as<string_view_type>(); \ if (s.empty() && std::find_if(first, last, \ [](const mapped_type& item) -> bool \ { return item.first == value_type(); }) == last) \ { \ return true; \ } \ auto it = std::find_if(first, last, \ [&](const mapped_type& item) -> bool \ { return item.second == s; }); \ return it != last; \ } \ static value_type as(const Json& ajson) \ { \ if (!is(ajson)) JSONCONS_THROW(conv_error(conv_errc::conversion_failed, "Not a " # EnumType)); \ const string_view_type s = ajson.template as<string_view_type>(); \ auto first = get_values().first; \ auto last = get_values().second; \ if (s.empty() && std::find_if(first, last, \ [](const mapped_type& item) -> bool \ { return item.first == value_type(); }) == last) \ { \ return value_type(); \ } \ auto it = std::find_if(first, last, \ [&](const mapped_type& item) -> bool \ { return item.second == s; }); \ if (it == last) \ { \ if (s.empty()) \ { \ return value_type(); \ } \ else \ { \ JSONCONS_THROW(conv_error(conv_errc::conversion_failed, "Not an enum")); \ } \ } \ return it->first; \ } \ static Json to_json(value_type aval, allocator_type alloc=allocator_type()) \ { \ static constexpr char_type empty_string[] = {0}; \ auto first = get_values().first; \ auto last = get_values().second; \ auto it = std::find_if(first, last, \ [aval](const mapped_type& item) -> bool \ { return item.first == aval; }); \ if (it == last) \ { \ if (aval == value_type()) \ { \ return Json(empty_string); \ } \ else \ { \ JSONCONS_THROW(conv_error(conv_errc::conversion_failed, "Not an enum")); \ } \ } \ return Json(it->second,alloc); \ } \ }; \ template <> struct is_json_type_traits_declared<EnumType> : public std::true_type {}; \ } \ /**/ #define JSONCONS_GETTER_SETTER_AS(Prefix, GetPrefix, SetPrefix, Property, Count) JSONCONS_GETTER_SETTER_AS_(Prefix, GetPrefix ## Property, SetPrefix ## Property, Property, Count) #define JSONCONS_GETTER_SETTER_AS_LAST(Prefix, GetPrefix, SetPrefix, Property, Count) JSONCONS_GETTER_SETTER_AS_(Prefix, GetPrefix ## Property, SetPrefix ## Property, Property, Count) #define JSONCONS_GETTER_SETTER_AS_(Prefix, Getter, Setter, Property, Count) if ((num_params-Count) < num_mandatory_params2 || ajson.contains(json_traits_macro_names<char_type,value_type>::Property##_str(char_type{}))) {aval.Setter(ajson.at(json_traits_macro_names<char_type,value_type>::Property##_str(char_type{})).template as<typename std::decay<decltype(aval.Getter())>::type>());} #define JSONCONS_ALL_GETTER_SETTER_AS(Prefix, GetPrefix, SetPrefix, Property, Count) JSONCONS_ALL_GETTER_SETTER_AS_(Prefix, GetPrefix ## Property, SetPrefix ## Property, Property, Count) #define JSONCONS_ALL_GETTER_SETTER_AS_LAST(Prefix, GetPrefix, SetPrefix, Property, Count) JSONCONS_ALL_GETTER_SETTER_AS_(Prefix, GetPrefix ## Property, SetPrefix ## Property, Property, Count) #define JSONCONS_ALL_GETTER_SETTER_AS_(Prefix, Getter, Setter, Property, Count) aval.Setter(ajson.at(json_traits_macro_names<char_type,value_type>::Property##_str(char_type{})).template as<typename std::decay<decltype(aval.Getter())>::type>()); #define JSONCONS_GETTER_SETTER_TO_JSON(Prefix, GetPrefix, SetPrefix, Property, Count) JSONCONS_GETTER_SETTER_TO_JSON_(Prefix, GetPrefix ## Property, SetPrefix ## Property, Property, Count) #define JSONCONS_GETTER_SETTER_TO_JSON_LAST(Prefix, GetPrefix, SetPrefix, Property, Count) JSONCONS_GETTER_SETTER_TO_JSON_(Prefix, GetPrefix ## Property, SetPrefix ## Property, Property, Count) #define JSONCONS_GETTER_SETTER_TO_JSON_(Prefix, Getter, Setter, Property, Count) \ if ((num_params-Count) < num_mandatory_params2) \ {ajson.try_emplace(json_traits_macro_names<char_type,value_type>::Property##_str(char_type{}), aval.Getter());} \ else \ {json_traits_helper<Json>::set_optional_json_member(json_traits_macro_names<char_type,value_type>::Property##_str(char_type{}), aval.Getter(), ajson);} #define JSONCONS_ALL_GETTER_SETTER_TO_JSON(Prefix, GetPrefix, SetPrefix, Property, Count) JSONCONS_ALL_GETTER_SETTER_TO_JSON_(Prefix, GetPrefix ## Property, SetPrefix ## Property, Property, Count) #define JSONCONS_ALL_GETTER_SETTER_TO_JSON_LAST(Prefix, GetPrefix, SetPrefix, Property, Count) JSONCONS_ALL_GETTER_SETTER_TO_JSON_(Prefix, GetPrefix ## Property, SetPrefix ## Property, Property, Count) #define JSONCONS_ALL_GETTER_SETTER_TO_JSON_(Prefix, Getter, Setter, Property, Count) ajson.try_emplace(json_traits_macro_names<char_type,value_type>::Property##_str(char_type{}), aval.Getter() ); #define JSONCONS_GETTER_SETTER_TRAITS_BASE(AsT,ToJ,NumTemplateParams, ValueType,GetPrefix,SetPrefix,NumMandatoryParams1,NumMandatoryParams2, ...) \ namespace jsoncons \ { \ template <class ChT JSONCONS_GENERATE_TPL_PARAMS(JSONCONS_GENERATE_MORE_TPL_PARAM, NumTemplateParams)> \ struct json_traits_macro_names<ChT,ValueType JSONCONS_GENERATE_TPL_ARGS(JSONCONS_GENERATE_TPL_ARG, NumTemplateParams)> \ { \ JSONCONS_VARIADIC_REP_N(JSONCONS_GENERATE_NAME_STR, ,,, __VA_ARGS__)\ }; \ template<typename Json JSONCONS_GENERATE_TPL_PARAMS(JSONCONS_GENERATE_MORE_TPL_PARAM, NumTemplateParams)> \ struct json_type_traits<Json, ValueType JSONCONS_GENERATE_TPL_ARGS(JSONCONS_GENERATE_TPL_ARG, NumTemplateParams)> \ { \ using value_type = ValueType JSONCONS_GENERATE_TPL_ARGS(JSONCONS_GENERATE_TPL_ARG, NumTemplateParams); \ using allocator_type = typename Json::allocator_type; \ using char_type = typename Json::char_type; \ using string_view_type = typename Json::string_view_type; \ constexpr static size_t num_params = JSONCONS_NARGS(__VA_ARGS__); \ constexpr static size_t num_mandatory_params1 = NumMandatoryParams1; \ constexpr static size_t num_mandatory_params2 = NumMandatoryParams2; \ static bool is(const Json& ajson) noexcept \ { \ if (!ajson.is_object()) return false; \ JSONCONS_VARIADIC_REP_N(JSONCONS_N_MEMBER_IS, ,GetPrefix,SetPrefix, __VA_ARGS__)\ return true; \ } \ static value_type as(const Json& ajson) \ { \ if (!is(ajson)) JSONCONS_THROW(conv_error(conv_errc::conversion_failed, "Not a " # ValueType)); \ value_type aval{}; \ JSONCONS_VARIADIC_REP_N(AsT, ,GetPrefix,SetPrefix, __VA_ARGS__) \ return aval; \ } \ static Json to_json(const value_type& aval, allocator_type alloc=allocator_type()) \ { \ Json ajson(json_object_arg, semantic_tag::none, alloc); \ JSONCONS_VARIADIC_REP_N(ToJ, ,GetPrefix,SetPrefix, __VA_ARGS__) \ return ajson; \ } \ }; \ } \ /**/ #define JSONCONS_N_GETTER_SETTER_TRAITS(ValueType,GetPrefix,SetPrefix,NumMandatoryParams, ...) \ JSONCONS_GETTER_SETTER_TRAITS_BASE(JSONCONS_GETTER_SETTER_AS, JSONCONS_GETTER_SETTER_TO_JSON,0, ValueType,GetPrefix,SetPrefix,NumMandatoryParams,NumMandatoryParams, __VA_ARGS__) \ namespace jsoncons { template <> struct is_json_type_traits_declared<ValueType> : public std::true_type {}; } \ /**/ #define JSONCONS_TPL_N_GETTER_SETTER_TRAITS(NumTemplateParams, ValueType,GetPrefix,SetPrefix,NumMandatoryParams, ...) \ JSONCONS_GETTER_SETTER_TRAITS_BASE(JSONCONS_GETTER_SETTER_AS, JSONCONS_GETTER_SETTER_TO_JSON,NumTemplateParams, ValueType,GetPrefix,SetPrefix,NumMandatoryParams,NumMandatoryParams, __VA_ARGS__) \ namespace jsoncons { template <JSONCONS_GENERATE_TPL_PARAMS(JSONCONS_GENERATE_TPL_PARAM, NumTemplateParams)> struct is_json_type_traits_declared<ValueType JSONCONS_GENERATE_TPL_ARGS(JSONCONS_GENERATE_TPL_ARG, NumTemplateParams)> : public std::true_type {}; } \ /**/ #define JSONCONS_ALL_GETTER_SETTER_TRAITS(ValueType,GetPrefix,SetPrefix, ...) \ JSONCONS_GETTER_SETTER_TRAITS_BASE(JSONCONS_ALL_GETTER_SETTER_AS, JSONCONS_ALL_GETTER_SETTER_TO_JSON,0,ValueType,GetPrefix,SetPrefix, JSONCONS_NARGS(__VA_ARGS__), JSONCONS_NARGS(__VA_ARGS__),__VA_ARGS__) \ namespace jsoncons { template <> struct is_json_type_traits_declared<ValueType> : public std::true_type {}; } \ /**/ #define JSONCONS_TPL_ALL_GETTER_SETTER_TRAITS(NumTemplateParams, ValueType,GetPrefix,SetPrefix, ...) \ JSONCONS_GETTER_SETTER_TRAITS_BASE(JSONCONS_ALL_GETTER_SETTER_AS, JSONCONS_ALL_GETTER_SETTER_TO_JSON,NumTemplateParams,ValueType,GetPrefix,SetPrefix, JSONCONS_NARGS(__VA_ARGS__), JSONCONS_NARGS(__VA_ARGS__),__VA_ARGS__) \ namespace jsoncons { template <JSONCONS_GENERATE_TPL_PARAMS(JSONCONS_GENERATE_TPL_PARAM, NumTemplateParams)> struct is_json_type_traits_declared<ValueType JSONCONS_GENERATE_TPL_ARGS(JSONCONS_GENERATE_TPL_ARG, NumTemplateParams)> : public std::true_type {}; } \ /**/ #define JSONCONS_GETTER_SETTER_NAME_IS(P1, P2, P3, Seq, Count) JSONCONS_GETTER_SETTER_NAME_IS_LAST(P1, P2, P3, Seq, Count) #define JSONCONS_GETTER_SETTER_NAME_IS_LAST(P1, P2, P3, Seq, Count) if ((num_params-Count) < num_mandatory_params1 && JSONCONS_EXPAND(JSONCONS_CONCAT(JSONCONS_GETTER_SETTER_NAME_IS_,JSONCONS_NARGS Seq) Seq) #define JSONCONS_GETTER_SETTER_NAME_IS_3(Getter, Setter, Name) !ajson.contains(Name)) return false; #define JSONCONS_GETTER_SETTER_NAME_IS_5(Getter, Setter, Name, Mode, Match) JSONCONS_GETTER_SETTER_NAME_IS_7(Getter, Setter, Name, Mode, Match,, ) #define JSONCONS_GETTER_SETTER_NAME_IS_6(Getter, Setter, Name, Mode, Match, Into) JSONCONS_GETTER_SETTER_NAME_IS_7(Getter, Setter, Name, Mode, Match, Into, ) #define JSONCONS_GETTER_SETTER_NAME_IS_7(Getter, Setter, Name, Mode, Match, Into, From) !ajson.contains(Name)) return false; \ JSONCONS_TRY{if (!Match(ajson.at(Name).template as<typename std::decay<decltype(Into(((value_type*)nullptr)->Getter()))>::type>())) return false;} \ JSONCONS_CATCH(...) {return false;} #define JSONCONS_N_GETTER_SETTER_NAME_AS(P1, P2, P3, Seq, Count) JSONCONS_N_GETTER_SETTER_NAME_AS_LAST(P1, P2, P3, Seq, Count) #define JSONCONS_N_GETTER_SETTER_NAME_AS_LAST(P1, P2, P3, Seq, Count) JSONCONS_EXPAND(JSONCONS_CONCAT(JSONCONS_N_GETTER_SETTER_NAME_AS_,JSONCONS_NARGS Seq) Seq) #define JSONCONS_N_GETTER_SETTER_NAME_AS_3(Getter, Setter, Name) if (ajson.contains(Name)) aval.Setter(ajson.at(Name).template as<typename std::decay<decltype(aval.Getter())>::type>()); #define JSONCONS_N_GETTER_SETTER_NAME_AS_4(Getter, Setter, Name, Mode) Mode(JSONCONS_N_GETTER_SETTER_NAME_AS_3(Getter, Setter, Name)) #define JSONCONS_N_GETTER_SETTER_NAME_AS_5(Getter, Setter, Name, Mode, Match) JSONCONS_N_GETTER_SETTER_NAME_AS_7(Getter, Setter, Name, Mode, Match, , ) #define JSONCONS_N_GETTER_SETTER_NAME_AS_6(Getter, Setter, Name, Mode, Match, Into) JSONCONS_N_GETTER_SETTER_NAME_AS_7(Getter, Setter, Name, Mode, Match, Into, ) #define JSONCONS_N_GETTER_SETTER_NAME_AS_7(Getter, Setter, Name, Mode, Match, Into, From) Mode(if (ajson.contains(Name)) aval.Setter(From(ajson.at(Name).template as<typename std::decay<decltype(Into(aval.Getter()))>::type>()));) #define JSONCONS_N_GETTER_SETTER_NAME_TO_JSON(P1, P2, P3, Seq, Count) JSONCONS_N_GETTER_SETTER_NAME_TO_JSON_LAST(P1, P2, P3, Seq, Count) #define JSONCONS_N_GETTER_SETTER_NAME_TO_JSON_LAST(P1, P2, P3, Seq, Count) JSONCONS_EXPAND(JSONCONS_CONCAT(JSONCONS_N_GETTER_SETTER_NAME_TO_JSON_,JSONCONS_NARGS Seq) Seq) #define JSONCONS_N_GETTER_SETTER_NAME_TO_JSON_3(Getter, Setter, Name) ajson.try_emplace(Name, aval.Getter() ); #define JSONCONS_N_GETTER_SETTER_NAME_TO_JSON_5(Getter, Setter, Name, Mode, Match) JSONCONS_N_GETTER_SETTER_NAME_TO_JSON_7(Getter, Setter, Name, Mode, Match, , ) #define JSONCONS_N_GETTER_SETTER_NAME_TO_JSON_6(Getter, Setter, Name, Mode, Match, Into) JSONCONS_N_GETTER_SETTER_NAME_TO_JSON_7(Getter, Setter, Name, Mode, Match, Into, ) #define JSONCONS_N_GETTER_SETTER_NAME_TO_JSON_7(Getter, Setter, Name, Mode, Match, Into, From) ajson.try_emplace(Name, Into(aval.Getter()) ); #define JSONCONS_ALL_GETTER_SETTER_NAME_AS(P1, P2, P3, Seq, Count) JSONCONS_ALL_GETTER_SETTER_NAME_AS_LAST(P1, P2, P3, Seq, Count) #define JSONCONS_ALL_GETTER_SETTER_NAME_AS_LAST(P1, P2, P3, Seq, Count) JSONCONS_EXPAND(JSONCONS_CONCAT(JSONCONS_ALL_GETTER_SETTER_NAME_AS_,JSONCONS_NARGS Seq) Seq) #define JSONCONS_ALL_GETTER_SETTER_NAME_AS_3(Getter, Setter, Name) aval.Setter(ajson.at(Name).template as<typename std::decay<decltype(aval.Getter())>::type>()); #define JSONCONS_ALL_GETTER_SETTER_NAME_AS_4(Getter, Setter, Name, Mode) Mode(JSONCONS_ALL_GETTER_SETTER_NAME_AS_3(Getter, Setter, Name)) #define JSONCONS_ALL_GETTER_SETTER_NAME_AS_5(Getter, Setter, Name, Mode, Match) JSONCONS_ALL_GETTER_SETTER_NAME_AS_7(Getter, Setter, Name, Mode, Match, , ) #define JSONCONS_ALL_GETTER_SETTER_NAME_AS_6(Getter, Setter, Name, Mode, Match, Into) JSONCONS_ALL_GETTER_SETTER_NAME_AS_7(Getter, Setter, Name, Mode, Match, Into, ) #define JSONCONS_ALL_GETTER_SETTER_NAME_AS_7(Getter, Setter, Name, Mode, Match, Into, From) Mode(aval.Setter(From(ajson.at(Name).template as<typename std::decay<decltype(Into(aval.Getter()))>::type>()));) #define JSONCONS_ALL_GETTER_SETTER_NAME_TO_JSON(P1, P2, P3, Seq, Count) JSONCONS_ALL_GETTER_SETTER_NAME_TO_JSON_LAST(P1, P2, P3, Seq, Count) #define JSONCONS_ALL_GETTER_SETTER_NAME_TO_JSON_LAST(P1, P2, P3, Seq, Count) if ((num_params-Count) < num_mandatory_params2) JSONCONS_EXPAND(JSONCONS_CONCAT(JSONCONS_ALL_GETTER_SETTER_NAME_TO_JSON_,JSONCONS_NARGS Seq) Seq) #define JSONCONS_ALL_GETTER_SETTER_NAME_TO_JSON_3(Getter, Setter, Name) \ ajson.try_emplace(Name, aval.Getter()); \ else \ {json_traits_helper<Json>::set_optional_json_member(Name, aval.Getter(), ajson);} #define JSONCONS_ALL_GETTER_SETTER_NAME_TO_JSON_5(Getter, Setter, Name, Mode, Match) JSONCONS_ALL_GETTER_SETTER_NAME_TO_JSON_7(Getter, Setter, Name, Mode, Match, , ) #define JSONCONS_ALL_GETTER_SETTER_NAME_TO_JSON_6(Getter, Setter, Name, Mode, Match, Into) JSONCONS_ALL_GETTER_SETTER_NAME_TO_JSON_7(Getter, Setter, Name, Mode, Match, Into, ) #define JSONCONS_ALL_GETTER_SETTER_NAME_TO_JSON_7(Getter, Setter, Name, Mode, Match, Into, From) \ ajson.try_emplace(Name, Into(aval.Getter())); \ else \ {json_traits_helper<Json>::set_optional_json_member(Name, Into(aval.Getter()), ajson);} #define JSONCONS_GETTER_SETTER_NAME_TRAITS_BASE(AsT,ToJ, NumTemplateParams, ValueType,NumMandatoryParams1,NumMandatoryParams2, ...) \ namespace jsoncons \ { \ template<typename Json JSONCONS_GENERATE_TPL_PARAMS(JSONCONS_GENERATE_MORE_TPL_PARAM, NumTemplateParams)> \ struct json_type_traits<Json, ValueType JSONCONS_GENERATE_TPL_ARGS(JSONCONS_GENERATE_TPL_ARG, NumTemplateParams)> \ { \ using value_type = ValueType JSONCONS_GENERATE_TPL_ARGS(JSONCONS_GENERATE_TPL_ARG, NumTemplateParams); \ using allocator_type = typename Json::allocator_type; \ using char_type = typename Json::char_type; \ using string_view_type = typename Json::string_view_type; \ constexpr static size_t num_params = JSONCONS_NARGS(__VA_ARGS__); \ constexpr static size_t num_mandatory_params1 = NumMandatoryParams1; \ constexpr static size_t num_mandatory_params2 = NumMandatoryParams2; \ static bool is(const Json& ajson) noexcept \ { \ if (!ajson.is_object()) return false; \ JSONCONS_VARIADIC_REP_N(JSONCONS_GETTER_SETTER_NAME_IS,,,, __VA_ARGS__)\ return true; \ } \ static value_type as(const Json& ajson) \ { \ if (!is(ajson)) JSONCONS_THROW(conv_error(conv_errc::conversion_failed, "Not a " # ValueType)); \ value_type aval{}; \ JSONCONS_VARIADIC_REP_N(AsT,,,, __VA_ARGS__) \ return aval; \ } \ static Json to_json(const value_type& aval, allocator_type alloc=allocator_type()) \ { \ Json ajson(json_object_arg, semantic_tag::none, alloc); \ JSONCONS_VARIADIC_REP_N(ToJ,,,, __VA_ARGS__) \ return ajson; \ } \ }; \ } \ /**/ #define JSONCONS_N_GETTER_SETTER_NAME_TRAITS(ValueType,NumMandatoryParams, ...) \ JSONCONS_GETTER_SETTER_NAME_TRAITS_BASE(JSONCONS_N_GETTER_SETTER_NAME_AS,JSONCONS_N_GETTER_SETTER_NAME_TO_JSON, 0, ValueType,NumMandatoryParams,NumMandatoryParams, __VA_ARGS__) \ namespace jsoncons { template <> struct is_json_type_traits_declared<ValueType> : public std::true_type {}; } \ /**/ #define JSONCONS_TPL_N_GETTER_SETTER_NAME_TRAITS(NumTemplateParams, ValueType,NumMandatoryParams, ...) \ JSONCONS_GETTER_SETTER_NAME_TRAITS_BASE(JSONCONS_N_GETTER_SETTER_NAME_AS,JSONCONS_N_GETTER_SETTER_NAME_TO_JSON, NumTemplateParams, ValueType,NumMandatoryParams,NumMandatoryParams, __VA_ARGS__) \ namespace jsoncons { template <JSONCONS_GENERATE_TPL_PARAMS(JSONCONS_GENERATE_TPL_PARAM, NumTemplateParams)> struct is_json_type_traits_declared<ValueType JSONCONS_GENERATE_TPL_ARGS(JSONCONS_GENERATE_TPL_ARG, NumTemplateParams)> : public std::true_type {}; } \ /**/ #define JSONCONS_ALL_GETTER_SETTER_NAME_TRAITS(ValueType, ...) \ JSONCONS_GETTER_SETTER_NAME_TRAITS_BASE(JSONCONS_ALL_GETTER_SETTER_NAME_AS,JSONCONS_ALL_GETTER_SETTER_NAME_TO_JSON, 0, ValueType, JSONCONS_NARGS(__VA_ARGS__), JSONCONS_NARGS(__VA_ARGS__), __VA_ARGS__) \ namespace jsoncons { template <> struct is_json_type_traits_declared<ValueType> : public std::true_type {}; } \ /**/ #define JSONCONS_TPL_ALL_GETTER_SETTER_NAME_TRAITS(NumTemplateParams, ValueType, ...) \ JSONCONS_GETTER_SETTER_NAME_TRAITS_BASE(JSONCONS_ALL_GETTER_SETTER_NAME_AS,JSONCONS_ALL_GETTER_SETTER_NAME_TO_JSON, NumTemplateParams, ValueType, JSONCONS_NARGS(__VA_ARGS__), JSONCONS_NARGS(__VA_ARGS__), __VA_ARGS__) \ namespace jsoncons { template <JSONCONS_GENERATE_TPL_PARAMS(JSONCONS_GENERATE_TPL_PARAM, NumTemplateParams)> struct is_json_type_traits_declared<ValueType JSONCONS_GENERATE_TPL_ARGS(JSONCONS_GENERATE_TPL_ARG, NumTemplateParams)> : public std::true_type {}; } \ /**/ #define JSONCONS_POLYMORPHIC_IS(BaseClass, P2, P3, DerivedClass, Count) if (ajson.template is<DerivedClass>()) return true; #define JSONCONS_POLYMORPHIC_IS_LAST(BaseClass, P2, P3, DerivedClass, Count) if (ajson.template is<DerivedClass>()) return true; #define JSONCONS_POLYMORPHIC_AS(BaseClass, P2, P3, DerivedClass, Count) if (ajson.template is<DerivedClass>()) return std::make_shared<DerivedClass>(ajson.template as<DerivedClass>()); #define JSONCONS_POLYMORPHIC_AS_LAST(BaseClass, P2, P3, DerivedClass, Count) if (ajson.template is<DerivedClass>()) return std::make_shared<DerivedClass>(ajson.template as<DerivedClass>()); #define JSONCONS_POLYMORPHIC_AS_UNIQUE_PTR(BaseClass, P2, P3, DerivedClass, Count) if (ajson.template is<DerivedClass>()) return jsoncons::make_unique<DerivedClass>(ajson.template as<DerivedClass>()); #define JSONCONS_POLYMORPHIC_AS_UNIQUE_PTR_LAST(BaseClass, P2, P3, DerivedClass, Count) if (ajson.template is<DerivedClass>()) return jsoncons::make_unique<DerivedClass>(ajson.template as<DerivedClass>()); #define JSONCONS_POLYMORPHIC_AS_SHARED_PTR(BaseClass, P2, P3, DerivedClass, Count) if (ajson.template is<DerivedClass>()) return std::make_shared<DerivedClass>(ajson.template as<DerivedClass>()); #define JSONCONS_POLYMORPHIC_AS_SHARED_PTR_LAST(BaseClass, P2, P3, DerivedClass, Count) if (ajson.template is<DerivedClass>()) return std::make_shared<DerivedClass>(ajson.template as<DerivedClass>()); #define JSONCONS_POLYMORPHIC_TO_JSON(BaseClass, P2, P3, DerivedClass, Count) if (DerivedClass* p = dynamic_cast<DerivedClass*>(ptr.get())) {return Json(*p);} #define JSONCONS_POLYMORPHIC_TO_JSON_LAST(BaseClass, P2, P3, DerivedClass, Count) if (DerivedClass* p = dynamic_cast<DerivedClass*>(ptr.get())) {return Json(*p);} #define JSONCONS_POLYMORPHIC_TRAITS(BaseClass, ...) \ namespace jsoncons { \ template<class Json> \ struct json_type_traits<Json, std::shared_ptr<BaseClass>> { \ static bool is(const Json& ajson) noexcept { \ if (!ajson.is_object()) return false; \ JSONCONS_VARIADIC_REP_N(JSONCONS_POLYMORPHIC_IS, BaseClass,,, __VA_ARGS__)\ return false; \ } \ \ static std::shared_ptr<BaseClass> as(const Json& ajson) { \ if (!ajson.is_object()) return std::shared_ptr<BaseClass>(); \ JSONCONS_VARIADIC_REP_N(JSONCONS_POLYMORPHIC_AS_SHARED_PTR, BaseClass,,, __VA_ARGS__)\ return std::shared_ptr<BaseClass>(); \ } \ \ static Json to_json(const std::shared_ptr<BaseClass>& ptr) { \ if (ptr.get() == nullptr) {return Json::null();} \ JSONCONS_VARIADIC_REP_N(JSONCONS_POLYMORPHIC_TO_JSON, BaseClass,,, __VA_ARGS__)\ return Json::null(); \ } \ }; \ template<class Json> \ struct json_type_traits<Json, std::unique_ptr<BaseClass>> { \ static bool is(const Json& ajson) noexcept { \ if (!ajson.is_object()) return false; \ JSONCONS_VARIADIC_REP_N(JSONCONS_POLYMORPHIC_IS, BaseClass,,, __VA_ARGS__)\ return false; \ } \ static std::unique_ptr<BaseClass> as(const Json& ajson) { \ if (!ajson.is_object()) return std::unique_ptr<BaseClass>(); \ JSONCONS_VARIADIC_REP_N(JSONCONS_POLYMORPHIC_AS_UNIQUE_PTR, BaseClass,,, __VA_ARGS__)\ return std::unique_ptr<BaseClass>(); \ } \ static Json to_json(const std::unique_ptr<BaseClass>& ptr) { \ if (ptr.get() == nullptr) {return Json::null();} \ JSONCONS_VARIADIC_REP_N(JSONCONS_POLYMORPHIC_TO_JSON, BaseClass,,, __VA_ARGS__)\ return Json::null(); \ } \ }; \ } \ /**/ #endif
; A215144: a(n) = 19*n + 1. ; 1,20,39,58,77,96,115,134,153,172,191,210,229,248,267,286,305,324,343,362,381,400,419,438,457,476,495,514,533,552,571,590,609,628,647,666,685,704,723,742,761,780,799,818,837,856,875,894,913,932,951,970,989,1008,1027,1046,1065,1084,1103,1122,1141,1160,1179,1198,1217,1236,1255,1274,1293,1312,1331,1350,1369,1388,1407,1426,1445,1464,1483,1502,1521,1540,1559,1578,1597,1616,1635,1654,1673,1692,1711,1730,1749,1768,1787,1806,1825,1844,1863,1882 mul $0,19 add $0,1
; A078007: Expansion of (1-x)/(1-x-2*x^2-x^3). ; 1,0,2,3,7,15,32,69,148,318,683,1467,3151,6768,14537,31224,67066,144051,309407,664575,1427440,3065997,6585452,14144886,30381787,65257011,140165471,301061280,646649233,1388937264,2983297010,6407820771,13763352055,29562290607,63496815488,136384748757,292940670340,629206983342,1351473072779,2902827709803,6234980838703,13392109331088,28764898718297,61784098219176,132706004986858,285039100143507,612235208336399,1315019413610271,2824528930426576,6066802965983517,13030880240446940,27989015102840550,60117578549717947,129126488995845987,277350661198122431,595721217739532352,1279549029131623201,2748342125808810336,5903161401811589090,12679394682560832963,27234059611992821479,58496010378926076495,125643524285472552416,269869604655317526885,579652663605188708212,1245035397201296314398,2674210329066991257707,5743933787074772594715,12337389842410051424527,26499467745626587871664,56918181217521463315433,122254506551184690483288,262590336731854204985818,564017531051745049267827,1211452711066638149722751,2602078109901982453244223,5589001063087003801957552,12004609993957606858168749,25784690230033596915328076,55382911281035814433623126,118956901735060615122448027,255507414527165840905022355,548804129278322885583541535,1178775860067715182516034272,2531891533151526794588139697,5438247382565280045203749776,11680806308936048816896063442,25089192607218135701891702691,53889052607655513380887579351,115748244131027833601567048175,248615541953556996065233909568,534001082823268176649255585269,1146980410861410002381290452580,2463598118461503351745035532686,5291560023007591533156872023115,11365736670792008239028233541067,24412454835268694657087013119983,52435488199860302668300352225232,112626134541189700221502612006265,241909565776179000215190329576712 mov $2,$0 mov $4,2 lpb $4 mov $0,$2 sub $4,1 add $0,$4 trn $0,1 seq $0,2478 ; Bisection of A000930. mov $3,$0 mov $5,$4 mul $5,$0 add $1,$5 lpe min $2,1 mul $2,$3 sub $1,$2 mov $0,$1
#ifndef _LEMONATOR_DUMMY_H #define _LEMONATOR_DUMMY_H #include "lemonator_interface.hpp" // generalisation of a sensor class sensor_dummy : // this is not good programming practice... public hwlib::sensor_temperature, public hwlib::sensor_distance, public hwlib::sensor_rgb, public hwlib::istream, public hwlib::pin_in { public: int read_mc() override { return 370; } int read_mm() override { return 42; } rgb read_rgb() override { return rgb( 12, 13, 14 ); } char getc() override { return 'D'; } bool get( hwlib::buffering buf = hwlib::buffering::unbuffered ) override { return 1;; } }; class lcd_dummy : public hwlib::ostream { public: void putc( char c ){ } }; class output_dummy : public hwlib::pin_out { public: void set( bool b, hwlib::buffering buf = hwlib::buffering::unbuffered ){ // implement } }; class lemonator_dummy : public lemonator_interface { private: lcd_dummy d_lcd; sensor_dummy d_keypad; sensor_dummy d_distance; sensor_dummy d_color; sensor_dummy d_temperature; sensor_dummy d_reflex; output_dummy d_heater; output_dummy d_sirup_pump; output_dummy d_sirup_valve; output_dummy d_water_pump; output_dummy d_water_valve; output_dummy d_led_green; output_dummy d_led_yellow; public: lemonator_dummy(): lemonator_interface( d_lcd, d_keypad, d_distance, d_color, d_temperature, d_reflex, d_heater, d_sirup_pump, d_sirup_valve, d_water_pump, d_water_valve, d_led_green, d_led_yellow ), d_lcd(), d_keypad(), d_distance(), d_color(), d_temperature(), d_reflex(), d_heater(), d_sirup_pump(), d_sirup_valve(), d_water_pump(), d_water_valve(), d_led_green(), d_led_yellow() {} }; #endif
; A190333: n + [n*r/s] + [n*t/s]; r=1, s=sqrt(3), t=1/s. ; Submitted by Simon Strandgaard ; 1,3,5,7,8,11,13,14,17,18,20,22,24,26,28,30,31,34,35,37,40,41,43,45,47,49,51,53,54,57,58,60,63,64,66,68,70,71,74,76,77,80,81,83,85,87,89,91,93,94,97,99,100,103,104,106,108,110,112,114,116,117,120,121,123,126,127,129,131,133,134,137,139,140,143,144,146,149,150,152,154,156,157,160,162,163,166,167,169,171,173,175,177,179,180,183,185,186,189,190 mov $1,$0 seq $0,190057 ; a(n) = n + [n*r/s] + [n*t/s]; r=1/2, s=sin(Pi/3), t=csc(Pi/3). sub $0,$1 sub $0,1
.global s_prepare_buffers s_prepare_buffers: push %r11 push %r15 push %r8 push %rbx push %rcx push %rdi push %rdx push %rsi lea addresses_UC_ht+0xd7a9, %rdi nop nop nop nop nop sub %r8, %r8 mov $0x6162636465666768, %rdx movq %rdx, %xmm4 and $0xffffffffffffffc0, %rdi vmovaps %ymm4, (%rdi) sub $63537, %r11 lea addresses_D_ht+0x130e9, %r15 nop cmp $21787, %rbx mov $0x6162636465666768, %r11 movq %r11, %xmm3 movups %xmm3, (%r15) nop nop nop nop nop sub %rdi, %rdi lea addresses_A_ht+0x98a9, %rsi lea addresses_WC_ht+0x97a9, %rdi clflush (%rdi) add $1938, %rdx mov $20, %rcx rep movsw nop nop and $50610, %rbx lea addresses_D_ht+0x165a9, %rsi lea addresses_A_ht+0x6da9, %rdi clflush (%rdi) xor $4221, %r15 mov $7, %rcx rep movsq nop nop nop nop nop cmp %rdi, %rdi lea addresses_A_ht+0x1e3d1, %rdi nop xor $55870, %r8 mov (%rdi), %r15d nop nop cmp $21095, %r11 lea addresses_WT_ht+0x8929, %rdx cmp $9073, %rsi movb (%rdx), %bl nop nop nop cmp %rsi, %rsi lea addresses_D_ht+0x1b189, %rdi nop nop nop add %rsi, %rsi mov (%rdi), %edx nop nop nop nop nop and %rdx, %rdx lea addresses_UC_ht+0x16e29, %rcx nop and $36126, %rdi mov $0x6162636465666768, %r15 movq %r15, %xmm7 vmovups %ymm7, (%rcx) nop nop nop nop inc %rsi lea addresses_UC_ht+0xb541, %rdi cmp %rsi, %rsi mov (%rdi), %r11w nop nop nop sub $21238, %rbx lea addresses_normal_ht+0x101a9, %r15 nop nop nop nop nop sub $54452, %rsi mov $0x6162636465666768, %rdi movq %rdi, (%r15) cmp $22775, %r11 lea addresses_D_ht+0x10d15, %rdx and $31230, %rbx mov (%rdx), %rsi nop cmp $21539, %rsi lea addresses_WC_ht+0x71a9, %r15 and %rdx, %rdx and $0xffffffffffffffc0, %r15 movntdqa (%r15), %xmm7 vpextrq $1, %xmm7, %rbx nop nop nop dec %rbx pop %rsi pop %rdx pop %rdi pop %rcx pop %rbx pop %r8 pop %r15 pop %r11 ret .global s_faulty_load s_faulty_load: push %r11 push %r13 push %rbp push %rdi push %rdx push %rsi // Load lea addresses_US+0x3e29, %rdi nop and %r11, %r11 movups (%rdi), %xmm3 vpextrq $1, %xmm3, %rbp and $20328, %rdx // Store lea addresses_WC+0x19811, %rsi nop nop nop nop sub %r13, %r13 mov $0x5152535455565758, %rdi movq %rdi, (%rsi) nop nop nop and $45729, %rdi // Faulty Load lea addresses_D+0x101a9, %r11 nop sub $50394, %rbp mov (%r11), %r13d lea oracles, %r11 and $0xff, %r13 shlq $12, %r13 mov (%r11,%r13,1), %r13 pop %rsi pop %rdx pop %rdi pop %rbp pop %r13 pop %r11 ret /* <gen_faulty_load> [REF] {'src': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 0, 'same': False, 'type': 'addresses_D'}, 'OP': 'LOAD'} {'src': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 7, 'same': False, 'type': 'addresses_US'}, 'OP': 'LOAD'} {'dst': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 3, 'same': False, 'type': 'addresses_WC'}, 'OP': 'STOR'} [Faulty Load] {'src': {'NT': True, 'AVXalign': False, 'size': 4, 'congruent': 0, 'same': True, 'type': 'addresses_D'}, 'OP': 'LOAD'} <gen_prepare_buffer> {'dst': {'NT': False, 'AVXalign': True, 'size': 32, 'congruent': 8, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'STOR'} {'dst': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 6, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'STOR'} {'src': {'congruent': 8, 'same': False, 'type': 'addresses_A_ht'}, 'dst': {'congruent': 9, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'REPM'} {'src': {'congruent': 10, 'same': False, 'type': 'addresses_D_ht'}, 'dst': {'congruent': 10, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'REPM'} {'src': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 3, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'LOAD'} {'src': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 4, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'LOAD'} {'src': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 4, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'LOAD'} {'dst': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 7, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'STOR'} {'src': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 1, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'LOAD'} {'dst': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 10, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'STOR'} {'src': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 2, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'LOAD'} {'src': {'NT': True, 'AVXalign': False, 'size': 16, 'congruent': 4, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'LOAD'} {'36': 21829} 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 */
/* * Copyright 2010-2017 Amazon.com, Inc. or its affiliates. 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. * A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file 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 <aws/medialive/model/InputSourceRequest.h> #include <aws/core/utils/json/JsonSerializer.h> #include <utility> using namespace Aws::Utils::Json; using namespace Aws::Utils; namespace Aws { namespace MediaLive { namespace Model { InputSourceRequest::InputSourceRequest() : m_passwordParamHasBeenSet(false), m_urlHasBeenSet(false), m_usernameHasBeenSet(false) { } InputSourceRequest::InputSourceRequest(JsonView jsonValue) : m_passwordParamHasBeenSet(false), m_urlHasBeenSet(false), m_usernameHasBeenSet(false) { *this = jsonValue; } InputSourceRequest& InputSourceRequest::operator =(JsonView jsonValue) { if(jsonValue.ValueExists("passwordParam")) { m_passwordParam = jsonValue.GetString("passwordParam"); m_passwordParamHasBeenSet = true; } if(jsonValue.ValueExists("url")) { m_url = jsonValue.GetString("url"); m_urlHasBeenSet = true; } if(jsonValue.ValueExists("username")) { m_username = jsonValue.GetString("username"); m_usernameHasBeenSet = true; } return *this; } JsonValue InputSourceRequest::Jsonize() const { JsonValue payload; if(m_passwordParamHasBeenSet) { payload.WithString("passwordParam", m_passwordParam); } if(m_urlHasBeenSet) { payload.WithString("url", m_url); } if(m_usernameHasBeenSet) { payload.WithString("username", m_username); } return payload; } } // namespace Model } // namespace MediaLive } // namespace Aws
/* Copyright 2021 Google LLC 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 "arch/arm64/arm64_helpers.h" #include <algorithm> #include <vector> #include "common.h" Register reg(arm64::Register r) { switch(r.name) { case arm64::Register::kX0: return X0; case arm64::Register::kX1: return X1; case arm64::Register::kX2: return X2; case arm64::Register::kX3: return X3; case arm64::Register::kX4: return X4; case arm64::Register::kX5: return X5; case arm64::Register::kX6: return X6; case arm64::Register::kX7: return X7; case arm64::Register::kX8: return X8; case arm64::Register::kX9: return X9; case arm64::Register::kX10: return X10; case arm64::Register::kX11: return X11; case arm64::Register::kX12: return X12; case arm64::Register::kX13: return X13; case arm64::Register::kX14: return X14; case arm64::Register::kX15: return X15; case arm64::Register::kX16: return X16; case arm64::Register::kX17: return X17; case arm64::Register::kX18: return X18; case arm64::Register::kX19: return X19; case arm64::Register::kX20: return X20; case arm64::Register::kX21: return X21; case arm64::Register::kX22: return X22; case arm64::Register::kX23: return X23; case arm64::Register::kX24: return X24; case arm64::Register::kX25: return X25; case arm64::Register::kX26: return X26; case arm64::Register::kX27: return X27; case arm64::Register::kX28: return X28; case arm64::Register::kX29: return X29; case arm64::Register::kX30: return X30; case arm64::Register::kXzr: return XZR; default: FATAL("unsupported register"); } } uint32_t bits(uint32_t msb, uint32_t lsb, uint32_t val) { uint32_t mask = 0xffffffffu >> (32 - (msb - lsb + 1)); return (val & mask) << lsb; } uint32_t bit(uint32_t lsb) { return 1 << lsb; } uint32_t EncodeSignedImmediate(const uint8_t msb, const uint8_t lsb, int32_t value) { int32_t min = ((2 << (msb - lsb)) / 2) * -1; int32_t max = ((2 << (msb - lsb)) / 2) - 1; if (value < min || value > max) { FATAL("number must be in range [%d, %d], was %d", min, max, value); return 0; // not reached } return bits(msb, lsb, value); } uint32_t EncodeUnsignedImmediate(const uint8_t msb, const uint8_t lsb, uint32_t value) { int32_t max = ((2 << (msb - lsb))) - 1; if (value > max) { FATAL("number must be in range [0, %d], was %d", max, value); return 0; // not reached } return bits(msb, lsb, value); } uint32_t ldr_lit(Register dst_reg, int64_t rip_offset, size_t size, bool is_signed) { uint32_t instr = 0; uint32_t opc = 0; /**/ if(!is_signed && size == 32) opc = 0b00; // LDR (literal) 32-bit else if(!is_signed && size == 64) opc = 0b01; // LDR (literal) 64-bit else if( is_signed && size == 32) opc = 0b10; // LDRSW (literal) 32-bit else FATAL("size must be either unsigned 32/64, or signed 32\n"); if (rip_offset & 3) { FATAL("rip_offset must be aligned"); } // load/store instr |= bits(28, 25, 0b0100); // load literal instr |= bits(29, 28, 0b01); // instr instr |= bits(31, 30, opc); instr |= EncodeSignedImmediate(23, 5, rip_offset >> 2); instr |= bits(4, 0, static_cast<uint32_t>(dst_reg)); return instr; } uint32_t br(Register dst_reg) { uint32_t instr = 0; // branch exception instr |= bits(28, 25, 0b1010); // branch register instr |= bits(31, 29, 0b110); instr |= bits(25, 22, 0b1000); instr |= bits(20, 16, 0b11111); instr |= bits(9, 5, dst_reg); return instr; } uint32_t b_cond(const std::string &cond, int32_t off) { static const std::vector<const std::string> condition_codes = { "eq", "ne", "cs", "cc", "mi", "pl", "vs", "vc", "hi", "ls", "ge", "lt", "gt", "le", "al", "al" }; if(off & 3) { FATAL("offset must be aligned to 4, was: %d", off); } auto it = std::find(condition_codes.begin(), condition_codes.end(), cond); if(it == condition_codes.end()) { FATAL("unknown condition: %s", cond.c_str()); } auto cond_bits = std::distance(condition_codes.begin(), it); uint32_t instr = 0; // branch exception instr |= bits(28, 25, 0b1010); // branch cond instr |= bits(31, 29, 0b010); // for cond branch all further instruction bits are 0 // operands instr |= EncodeSignedImmediate(24, 5, off >> 2); instr |= bits(3, 0, static_cast<uint32_t>(cond_bits)); return instr; } uint32_t load_store(uint8_t op, uint8_t size, Register data_reg, Register base_reg, int32_t offset) { uint32_t instr = 0; uint32_t size_bin = 0; /**/ if(size == 64) size_bin = 0b11; else if(size == 32) size_bin = 0b10; else if(size == 16) size_bin = 0b01; else if(size == 8) size_bin = 0b00; else FATAL("size must be either 64, 32, 16, or 8\n"); // load/store instr |= bits(28, 25, 0b0100); // sz instr |= bits(31, 30, size_bin); // unscaled imm, reg offset, unsigned imm instr |= bits(29, 28, 0b11); // LD*R/B/H or / ST*R/B/H instr |= bits(23, 22, op); instr |= bits(4, 0, static_cast<uint32_t>(data_reg)); // base instr |= bits(9, 5, static_cast<uint32_t>(base_reg)); // offset instr |= EncodeSignedImmediate(20, 12, offset); return instr; } uint32_t movzn(Register dst_reg, int32_t imm) { uint32_t instr = 0; // 64 bit instr |= bit(31); // data processing imm instr |= bits(28, 25, 0b1000); // move wide imm instr |= bits(25, 23, 0b101); if(imm < 0) { // movn instr |= bits(30, 29, 0b00); } else { // movz instr |= bits(30, 29, 0b10); } instr |= EncodeUnsignedImmediate(20, 5, std::abs(imm)); instr |= bits(4, 0, static_cast<uint32_t>(dst_reg)); return instr; } uint32_t ldr(uint8_t size, Register data_reg, Register base_reg, int32_t offset) { // LD*R/B/H == 0b01 return load_store(0b01, size, data_reg, base_reg, offset); } uint32_t str(uint8_t size, Register data_reg, Register base_reg, int32_t offset) { // LD*R/B/H == 0b00 return load_store(0b00, size, data_reg, base_reg, offset); } // TODO: change op to reil instruction constant uint32_t add_sub_reg_imm(uint8_t op, Register dst_reg, Register src_reg, uint32_t offset) { uint32_t instr = 0; // data process immm instr |= bits(28, 25, 0b01000); // add/sub imm instr |= bits(25, 23, 0b010); // 64 bit instr |= bit(31); // add or sub if(op == 1) { // sub instr |= bit(30); } else { // add // dont set bit } instr |= bits(4, 0, dst_reg); instr |= bits(9, 5, src_reg); instr |= EncodeUnsignedImmediate(21, 10, offset); return instr; } uint32_t cmp(Register src1, Register src2) { uint32_t instr = 0; // data processing register instr |= bits(28, 25, 0b0101); // data process reg instr |= bits(24, 21, 0b1000); // size == 64 bit instr |= bit(31); // sub instr |= bit(30); // set flag instr |= bit(29); instr |= bits(20, 16, src2); instr |= bits(9, 5, src1); instr |= bits(4, 0, Register::XZR); return instr; } uint32_t sub_reg_imm(Register dst_reg, Register src_reg, uint32_t offset) { return add_sub_reg_imm(1, dst_reg, src_reg, offset); } uint32_t add_reg_imm(Register dst_reg, Register src_reg, uint32_t offset) { return add_sub_reg_imm(0, dst_reg, src_reg, offset); } uint32_t branch_imm(size_t instr_address, size_t address, bool do_link) { uint32_t instr = 0; // check 4 byte alignment if (address & 3 || instr_address & 3) { FATAL("Source and Target address (%lx/%lx) must be alignt to 4 bytes", instr_address, address); } int32_t offset = (int32_t)(address - instr_address); // bl xzr instr |= bits(28, 25, 0b1010); instr |= EncodeSignedImmediate(25, 0, offset>>2); if(do_link) { instr |= bit(31); } return instr; } uint32_t orr_shifted_reg(Register dst, Register rn, Register src) { uint32_t instr = 0; // data processing register instr |= bits(28, 25, 0b0101); // logical shifted Register // size = 64bit instr |= bit(31); // kOrrShiftedRegister instr |= bits(30, 29, 0b01); instr |= bits( 4, 0, dst); instr |= bits( 9, 5, rn); instr |= bits(20, 16, src); return instr; } // Encode arm64 Bitwise Exclusive OR (shifted register) instruction. // (https://developer.arm.com/documentation/dui0801/g/A64-General-Instructions/EOR--shifted-register-) uint32_t eor_shifted_reg(uint8_t sz, Register rd, Register rn, Register rm, arm64::Shift::Type shift_type, uint8_t shift_count) { uint32_t instr = 0; if(sz == 64) { instr |= bit(31); } else if (sz == 32) { } else { FATAL("eor: unexpected size. Valid is 32 or 64, was %d", sz); } // data processing register instr |= bits(29, 25, 0b0101); // logical shift instr // bit 28 not set // bit 24 not set // kEorShiftedRegister instr |= bits(30, 29, 0b10); // dst instr |= bits(4, 0, rd); // src1 instr |= bits(9, 5, rn); // src2 instr |= bits(20, 16, rm); // count instr |= EncodeUnsignedImmediate(15, 10, shift_count); switch (shift_type) { case arm64::Shift::kNone: case arm64::Shift::kLsl: break; case arm64::Shift::kLsr: instr |= bits(23, 22, 0b01); break; case arm64::Shift::kAsr: instr |= bits(23, 22, 0b10); break; case arm64::Shift::kRor: instr |= bits(23, 22, 0b11); break; default: FATAL("eor: unknown shift type: %d", shift_type); } return instr; } uint32_t movz_imm(Register dst, int32_t imm) { uint32_t instr = 0; // data processing immediate instr |= bits(28, 25, 0b1000); // mov wide immediate instr |= bits(25, 23, 0b101); // size == 64 bit instr |= bit(31); // kMovz instr |= bits(30, 29, 0b10); instr |= EncodeUnsignedImmediate(20, 5, imm); instr |= bits(4, 0, dst); return instr; } uint32_t mov(Register dst, Register src) { return orr_shifted_reg(dst, Register::XZR, src); } uint32_t b(size_t instr_address, size_t address) { return branch_imm(instr_address, address, false); } uint32_t bl(size_t instr_address, size_t address) { return branch_imm(instr_address, address, true); }
; A112440: Next term is the sum of the last 10 digits in the sequence, beginning with a(10) = 9. ; 0,0,0,0,0,0,0,0,0,9,9,18,27,36,45,54,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45 sub $0,1 pow $0,2 div $0,28 mov $2,2 lpb $0,1 mov $3,$2 mov $2,1 mov $4,$3 add $4,5 mov $0,$4 lpe trn $0,1 mov $1,$0 mul $1,9
; A101990: a(1) = a(2) = 1, a(3) = 9; for n > 3, a(n) = 3*a(n-1) - 3*a(n-2) + 9*a(n-3). ; Submitted by Jon Maiga ; 1,1,9,33,81,225,729,2241,6561,19521,59049,177633,531441,1592865,4782969,14353281,43046721,129127041,387420489,1162300833,3486784401,10460235105,31381059609,94143533121,282429536481,847287546561,2541865828329,7625600673633,22876792454961,68630367798945,205891132094649,617673424981761,1853020188851841,5559060480462081,16677181699666569,50031545357280033,150094635296999121,450283905116156385,1350851717672992089,4052555155343499201,12157665459056928801,36472996370197217601,109418989131512359209 lpb $0 sub $0,1 mov $2,$0 max $2,0 seq $2,318610 ; a(1) = 0, a(2) = 4, a(3) = 12; for n > 3, a(n) = 3*a(n-1) - 3*a(n-2) + 9*a(n-3). add $1,$2 lpe mov $0,$1 mul $0,2 add $0,1
lui $1,35117 ori $1,$1,33896 lui $2,64975 ori $2,$2,47349 lui $3,39921 ori $3,$3,13256 lui $4,30093 ori $4,$4,7286 lui $5,60867 ori $5,$5,53937 lui $6,63760 ori $6,$6,27844 mthi $1 mtlo $2 sec0: nop nop nop slt $5,$6,$2 sec1: nop nop sltu $6,$1,$1 slt $5,$6,$2 sec2: nop nop lui $6,20852 slt $0,$6,$2 sec3: nop nop mflo $6 slt $3,$6,$2 sec4: nop nop lbu $6,8($0) slt $5,$6,$2 sec5: nop and $2,$4,$3 nop slt $4,$6,$2 sec6: nop slt $2,$6,$4 or $6,$1,$3 slt $4,$6,$2 sec7: nop and $2,$3,$2 lui $6,7773 slt $5,$6,$2 sec8: nop slt $2,$2,$4 mflo $6 slt $3,$6,$2 sec9: nop slt $2,$3,$5 lb $6,8($0) slt $4,$6,$2 sec10: nop andi $2,$6,27068 nop slt $2,$6,$2 sec11: nop lui $2,57446 subu $6,$3,$1 slt $3,$6,$2 sec12: nop ori $2,$2,37366 slti $6,$0,26101 slt $2,$6,$2 sec13: nop xori $2,$0,12465 mflo $6 slt $3,$6,$2 sec14: nop ori $2,$5,50717 lb $6,12($0) slt $1,$6,$2 sec15: nop mfhi $2 nop slt $3,$6,$2 sec16: nop mflo $2 or $6,$4,$4 slt $2,$6,$2 sec17: nop mflo $2 xori $6,$1,14602 slt $6,$6,$2 sec18: nop mfhi $2 mfhi $6 slt $3,$6,$2 sec19: nop mflo $2 lb $6,2($0) slt $2,$6,$2 sec20: nop lh $2,4($0) nop slt $3,$6,$2 sec21: nop lb $2,13($0) subu $6,$5,$3 slt $3,$6,$2 sec22: nop lw $2,4($0) ori $6,$3,22411 slt $3,$6,$2 sec23: nop lbu $2,13($0) mfhi $6 slt $3,$6,$2 sec24: nop lw $2,16($0) lw $6,8($0) slt $0,$6,$2 sec25: slt $6,$4,$2 nop nop slt $2,$6,$2 sec26: addu $6,$3,$4 nop addu $6,$1,$3 slt $1,$6,$2 sec27: xor $6,$3,$0 nop lui $6,30998 slt $3,$6,$2 sec28: sltu $6,$3,$4 nop mflo $6 slt $1,$6,$2 sec29: or $6,$4,$6 nop lbu $6,2($0) slt $5,$6,$2 sec30: sltu $6,$5,$0 and $2,$4,$0 nop slt $5,$6,$2 sec31: subu $6,$5,$0 or $2,$4,$3 xor $6,$5,$0 slt $4,$6,$2 sec32: slt $6,$4,$3 xor $2,$4,$0 sltiu $6,$4,-9603 slt $0,$6,$2 sec33: nor $6,$3,$2 and $2,$6,$2 mfhi $6 slt $2,$6,$2 sec34: sltu $6,$4,$5 nor $2,$4,$3 lbu $6,2($0) slt $4,$6,$2 sec35: nor $6,$4,$4 ori $2,$4,8727 nop slt $1,$6,$2 sec36: subu $6,$6,$1 xori $2,$4,40702 and $6,$1,$3 slt $1,$6,$2 sec37: sltu $6,$3,$3 ori $2,$2,26209 andi $6,$2,17186 slt $3,$6,$2 sec38: slt $6,$2,$3 xori $2,$4,58925 mflo $6 slt $0,$6,$2 sec39: addu $6,$2,$0 addiu $2,$4,23838 lbu $6,8($0) slt $3,$6,$2 sec40: addu $6,$3,$4 mfhi $2 nop slt $3,$6,$2 sec41: addu $6,$2,$4 mfhi $2 subu $6,$3,$3 slt $3,$6,$2 sec42: addu $6,$5,$3 mfhi $2 slti $6,$2,-3701 slt $4,$6,$2 sec43: xor $6,$3,$4 mfhi $2 mfhi $6 slt $0,$6,$2 sec44: subu $6,$2,$3 mfhi $2 lhu $6,6($0) slt $1,$6,$2 sec45: or $6,$3,$2 lhu $2,16($0) nop slt $1,$6,$2 sec46: nor $6,$2,$1 lbu $2,6($0) subu $6,$4,$3 slt $1,$6,$2 sec47: subu $6,$4,$3 lh $2,6($0) lui $6,47773 slt $3,$6,$2 sec48: addu $6,$2,$2 lh $2,14($0) mflo $6 slt $3,$6,$2 sec49: xor $6,$3,$2 lw $2,0($0) lw $6,8($0) slt $3,$6,$2 sec50: addiu $6,$5,12570 nop nop slt $1,$6,$2 sec51: slti $6,$4,-4081 nop sltu $6,$2,$3 slt $2,$6,$2 sec52: slti $6,$2,22819 nop lui $6,44322 slt $2,$6,$2 sec53: andi $6,$2,14996 nop mflo $6 slt $6,$6,$2 sec54: lui $6,2154 nop lh $6,12($0) slt $5,$6,$2 sec55: slti $6,$3,21860 and $2,$3,$3 nop slt $4,$6,$2 sec56: andi $6,$3,30482 sltu $2,$2,$2 slt $6,$6,$3 slt $6,$6,$2 sec57: xori $6,$5,64755 subu $2,$2,$1 andi $6,$2,29521 slt $3,$6,$2 sec58: addiu $6,$4,-24275 subu $2,$2,$3 mfhi $6 slt $3,$6,$2 sec59: sltiu $6,$1,-7539 or $2,$0,$4 lh $6,16($0) slt $1,$6,$2 sec60: xori $6,$5,712 xori $2,$6,7052 nop slt $4,$6,$2 sec61: sltiu $6,$3,-15629 addiu $2,$0,22729 slt $6,$3,$3 slt $3,$6,$2 sec62: andi $6,$1,14118 sltiu $2,$4,-12812 xori $6,$4,57194 slt $1,$6,$2 sec63: lui $6,19897 sltiu $2,$5,29537 mflo $6 slt $5,$6,$2 sec64: xori $6,$6,14707 lui $2,61203 lhu $6,2($0) slt $6,$6,$2 sec65: lui $6,8585 mflo $2 nop slt $4,$6,$2 sec66: sltiu $6,$3,-4475 mfhi $2 sltu $6,$2,$4 slt $1,$6,$2 sec67: xori $6,$3,57711 mfhi $2 sltiu $6,$5,-26234 slt $4,$6,$2 sec68: xori $6,$3,23172 mfhi $2 mfhi $6 slt $3,$6,$2 sec69: lui $6,10258 mfhi $2 lhu $6,10($0) slt $5,$6,$2 sec70: xori $6,$4,65030 lb $2,6($0) nop slt $5,$6,$2 sec71: ori $6,$3,39629 lbu $2,10($0) or $6,$5,$1 slt $1,$6,$2 sec72: slti $6,$2,-21039 lhu $2,0($0) lui $6,32686 slt $5,$6,$2 sec73: andi $6,$4,6866 lbu $2,7($0) mfhi $6 slt $3,$6,$2 sec74: lui $6,42994 lh $2,10($0) lh $6,2($0) slt $2,$6,$2 sec75: mfhi $6 nop nop slt $1,$6,$2 sec76: mflo $6 nop addu $6,$2,$1 slt $3,$6,$2 sec77: mflo $6 nop slti $6,$4,5657 slt $2,$6,$2 sec78: mflo $6 nop mfhi $6 slt $4,$6,$2 sec79: mflo $6 nop lw $6,12($0) slt $1,$6,$2 sec80: mfhi $6 slt $2,$5,$2 nop slt $1,$6,$2 sec81: mflo $6 sltu $2,$3,$4 sltu $6,$2,$6 slt $3,$6,$2 sec82: mflo $6 nor $2,$2,$2 addiu $6,$1,-14120 slt $4,$6,$2 sec83: mflo $6 subu $2,$1,$3 mfhi $6 slt $3,$6,$2 sec84: mfhi $6 or $2,$3,$4 lh $6,12($0) slt $4,$6,$2 sec85: mfhi $6 lui $2,65128 nop slt $2,$6,$2 sec86: mfhi $6 ori $2,$3,53468 subu $6,$3,$1 slt $4,$6,$2 sec87: mflo $6 ori $2,$0,53490 sltiu $6,$4,-28346 slt $4,$6,$2 sec88: mfhi $6 addiu $2,$2,-26745 mfhi $6 slt $5,$6,$2 sec89: mflo $6 xori $2,$5,18552 lbu $6,9($0) slt $2,$6,$2 sec90: mflo $6 mfhi $2 nop slt $2,$6,$2 sec91: mfhi $6 mfhi $2 and $6,$0,$3 slt $0,$6,$2 sec92: mfhi $6 mflo $2 addiu $6,$3,-17157 slt $6,$6,$2 sec93: mfhi $6 mflo $2 mflo $6 slt $2,$6,$2 sec94: mfhi $6 mfhi $2 lb $6,15($0) slt $3,$6,$2 sec95: mfhi $6 lbu $2,11($0) nop slt $3,$6,$2 sec96: mfhi $6 lbu $2,1($0) sltu $6,$4,$5 slt $1,$6,$2 sec97: mfhi $6 lhu $2,6($0) xori $6,$0,29815 slt $3,$6,$2 sec98: mflo $6 lw $2,12($0) mfhi $6 slt $2,$6,$2 sec99: mfhi $6 lb $2,11($0) lbu $6,13($0) slt $2,$6,$2 sec100: lh $6,14($0) nop nop slt $4,$6,$2 sec101: lbu $6,6($0) nop addu $6,$1,$1 slt $1,$6,$2 sec102: lw $6,4($0) nop addiu $6,$6,-18550 slt $1,$6,$2 sec103: lhu $6,2($0) nop mflo $6 slt $5,$6,$2 sec104: lbu $6,2($0) nop lhu $6,2($0) slt $2,$6,$2 sec105: lhu $6,2($0) and $2,$3,$1 nop slt $4,$6,$2 sec106: lhu $6,16($0) nor $2,$4,$6 or $6,$6,$4 slt $5,$6,$2 sec107: lh $6,8($0) subu $2,$5,$3 slti $6,$2,-17788 slt $3,$6,$2 sec108: lb $6,5($0) or $2,$3,$4 mfhi $6 slt $5,$6,$2 sec109: lw $6,16($0) slt $2,$5,$4 lbu $6,1($0) slt $6,$6,$2 sec110: lh $6,8($0) slti $2,$1,18480 nop slt $5,$6,$2 sec111: lbu $6,0($0) lui $2,63285 or $6,$2,$2 slt $0,$6,$2 sec112: lbu $6,0($0) slti $2,$1,-1694 ori $6,$2,56191 slt $6,$6,$2 sec113: lh $6,12($0) lui $2,14490 mflo $6 slt $3,$6,$2 sec114: lh $6,6($0) ori $2,$3,54982 lw $6,16($0) slt $3,$6,$2 sec115: lb $6,16($0) mflo $2 nop slt $6,$6,$2 sec116: lh $6,4($0) mfhi $2 and $6,$3,$3 slt $1,$6,$2 sec117: lb $6,3($0) mflo $2 andi $6,$3,65159 slt $1,$6,$2 sec118: lb $6,1($0) mflo $2 mflo $6 slt $2,$6,$2 sec119: lw $6,12($0) mfhi $2 lw $6,0($0) slt $1,$6,$2 sec120: lbu $6,6($0) lb $2,15($0) nop slt $5,$6,$2 sec121: lhu $6,8($0) lbu $2,5($0) or $6,$4,$2 slt $0,$6,$2 sec122: lh $6,0($0) lhu $2,14($0) addiu $6,$4,27629 slt $6,$6,$2 sec123: lh $6,6($0) lb $2,16($0) mflo $6 slt $5,$6,$2 sec124: lw $6,8($0) lbu $2,4($0) lw $6,12($0) slt $4,$6,$2
; A091704: Number of Barker codes (or Barker sequences) of length n up to reversals and negations. ; Submitted by Christian Krause ; 2,1,2,1,0,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 mov $2,2 mov $5,1 lpb $0 mov $3,$0 lpb $3 add $0,1 mul $2,$5 mov $4,$3 mov $6,$2 cmp $6,0 add $2,$6 mod $4,$2 add $2,1 div $3,2 cmp $4,0 cmp $4,0 mov $5,$4 lpe div $0,$2 mov $2,$5 lpe mov $0,$2
; A001610: a(n) = a(n-1) + a(n-2) + 1, with a(0) = 0 and a(1) = 2. ; 0,2,3,6,10,17,28,46,75,122,198,321,520,842,1363,2206,3570,5777,9348,15126,24475,39602,64078,103681,167760,271442,439203,710646,1149850,1860497,3010348,4870846,7881195,12752042,20633238,33385281,54018520,87403802,141422323,228826126,370248450,599074577,969323028,1568397606,2537720635,4106118242,6643838878,10749957121,17393796000,28143753122,45537549123,73681302246,119218851370,192900153617,312119004988,505019158606,817138163595,1322157322202,2139295485798,3461452808001,5600748293800,9062201101802,14662949395603,23725150497406,38388099893010,62113250390417,100501350283428,162614600673846,263115950957275,425730551631122,688846502588398,1114577054219521,1803423556807920,2918000611027442,4721424167835363,7639424778862806 lpb $0,1 sub $0,1 add $3,1 add $3,$2 mov $2,$1 mov $1,1 add $1,$3 lpe
; A265609: Array read by ascending antidiagonals: A(n,k) the rising factorial, also known as Pochhammer symbol, for n >= 0 and k >= 0. ; Submitted by Christian Krause ; 1,1,0,1,1,0,1,2,2,0,1,3,6,6,0,1,4,12,24,24,0,1,5,20,60,120,120,0,1,6,30,120,360,720,720,0,1,7,42,210,840,2520,5040,5040,0,1,8,56,336,1680,6720,20160,40320,40320,0 lpb $0 add $2,1 sub $0,$2 lpe add $1,1 sub $2,1 lpb $0 sub $0,1 mul $1,$2 sub $2,1 lpe mov $0,$1
;GEN-ASM ; =========================================================================== ; --------------------------------------------------------------------------- ; AMPS - SMPS2ASM macro & equate file ; --------------------------------------------------------------------------- %ifasm% AS ; Note Equates ; --------------------------------------------------------------------------- enum nC0=$81,nCs0,nD0,nEb0,nE0,nF0,nFs0,nG0,nAb0,nA0,nBb0,nB0 enum nC1=$8D,nCs1,nD1,nEb1,nE1,nF1,nFs1,nG1,nAb1,nA1,nBb1,nB1 enum nC2=$99,nCs2,nD2,nEb2,nE2,nF2,nFs2,nG2,nAb2,nA2,nBb2,nB2 enum nC3=$A5,nCs3,nD3,nEb3,nE3,nF3,nFs3,nG3,nAb3,nA3,nBb3,nB3 enum nC4=$B1,nCs4,nD4,nEb4,nE4,nF4,nFs4,nG4,nAb4,nA4,nBb4,nB4 enum nC5=$BD,nCs5,nD5,nEb5,nE5,nF5,nFs5,nG5,nAb5,nA5,nBb5,nB5 enum nC6=$C9,nCs6,nD6,nEb6,nE6,nF6,nFs6,nG6,nAb6,nA6,nBb6,nB6 enum nC7=$D5,nCs7,nD7,nEb7,nE7,nF7,nFs7,nG7,nAb7,nA7,nBb7 enum nRst=$80, nHiHat=nBb6 %endif% %ifasm% ASM68K ; this macro is created to emulate enum in AS enum macro lable rept narg \lable = _num _num = _num+1 shift endr endm ; =========================================================================== ; --------------------------------------------------------------------------- ; Note equates ; --------------------------------------------------------------------------- _num = $80 enum nRst enum nC0,nCs0,nD0,nEb0,nE0,nF0,nFs0,nG0,nAb0,nA0,nBb0,nB0 enum nC1,nCs1,nD1,nEb1,nE1,nF1,nFs1,nG1,nAb1,nA1,nBb1,nB1 enum nC2,nCs2,nD2,nEb2,nE2,nF2,nFs2,nG2,nAb2,nA2,nBb2,nB2 enum nC3,nCs3,nD3,nEb3,nE3,nF3,nFs3,nG3,nAb3,nA3,nBb3,nB3 enum nC4,nCs4,nD4,nEb4,nE4,nF4,nFs4,nG4,nAb4,nA4,nBb4,nB4 enum nC5,nCs5,nD5,nEb5,nE5,nF5,nFs5,nG5,nAb5,nA5,nBb5,nB5 enum nC6,nCs6,nD6,nEb6,nE6,nF6,nFs6,nG6,nAb6,nA6,nBb6,nB6 enum nC7,nCs7,nD7,nEb7,nE7,nF7,nFs7,nG7,nAb7,nA7,nBb7 nHiHat = nBb6 %endif% ; =========================================================================== ; --------------------------------------------------------------------------- ; Header macros ; --------------------------------------------------------------------------- ; Header - Initialize a music file sHeaderInit macro sPatNum %set% 0 endm ; Header - Initialize a sound effect file sHeaderInitSFX macro endm ; Header - Set up channel usage sHeaderCh macro fm,psg %narg% >1 psg <> dc.b %macpfx%psg-1, %macpfx%fm-1 if %macpfx%fm>(5+((FEATURE_FM6<>0)&1)) %warning%"You sure there are %macpfx%fm FM channels?" endif if %macpfx%psg>3 %warning%"You sure there are %macpfx%psg PSG channels?" endif else dc.b %macpfx%fm-1 endif endm ; Header - Set up tempo and tick multiplier sHeaderTempo macro tmul,tempo dc.b %macpfx%tempo,%macpfx%tmul-1 endm ; Header - Set priority level sHeaderPrio macro prio dc.b %macpfx%prio endm ; Header - Set up a DAC channel sHeaderDAC macro loc,vol,samp dc.w %macpfx%loc-* %narg% >1 vol <> dc.b (%macpfx%vol)&$FF %narg% >2 samp <> dc.b %macpfx%samp else dc.b $00 endif else dc.w $00 endif endm ; Header - Set up an FM channel sHeaderFM macro loc,pitch,vol dc.w %macpfx%loc-* dc.b (%macpfx%pitch)&$FF,(%macpfx%vol)&$FF endm ; Header - Set up a PSG channel sHeaderPSG macro loc,pitch,vol,detune,volenv dc.w %macpfx%loc-* dc.b (%macpfx%pitch)&$FF,(%macpfx%vol)&$FF,(%macpfx%detune)&$FF,%macpfx%volenv endm ; Header - Set up an SFX channel sHeaderSFX macro flags,type,loc,pitch,vol dc.b %macpfx%flags,%macpfx%type dc.w %macpfx%loc-* dc.b (%macpfx%pitch)&$FF,(%macpfx%vol)&$FF endm ; =========================================================================== ; --------------------------------------------------------------------------- ; Macros for FM instruments ; --------------------------------------------------------------------------- ; Patches - Algorithm and patch name spAlgorithm macro val, name if (sPatNum<>0)&(safe=0) ; align the patch dc.b ((*)%xor%(sPatNum*spTL4))&$FF dc.b (((*)>>8)+(spDe3*spDR3))&$FF dc.b (((*)>>16)-(spTL1*spRR3))&$FF endif %narg% >1 name <> p%dlbs%name%dlbe% %set% sPatNum endif sPatNum %set% sPatNum+1 spAl %set% %macpfx%val endm ; Patches - Feedback spFeedback macro val spFe %set% %macpfx%val endm ; Patches - Detune spDetune macro op1,op2,op3,op4 spDe1 %set% %macpfx%op1 spDe2 %set% %macpfx%op2 spDe3 %set% %macpfx%op3 spDe4 %set% %macpfx%op4 endm ; Patches - Multiple spMultiple macro op1,op2,op3,op4 spMu1 %set% %macpfx%op1 spMu2 %set% %macpfx%op2 spMu3 %set% %macpfx%op3 spMu4 %set% %macpfx%op4 endm ; Patches - Rate Scale spRateScale macro op1,op2,op3,op4 spRS1 %set% %macpfx%op1 spRS2 %set% %macpfx%op2 spRS3 %set% %macpfx%op3 spRS4 %set% %macpfx%op4 endm ; Patches - Attack Rate spAttackRt macro op1,op2,op3,op4 spAR1 %set% %macpfx%op1 spAR2 %set% %macpfx%op2 spAR3 %set% %macpfx%op3 spAR4 %set% %macpfx%op4 endm ; Patches - Amplitude Modulation spAmpMod macro op1,op2,op3,op4 spAM1 %set% %macpfx%op1 spAM2 %set% %macpfx%op2 spAM3 %set% %macpfx%op3 spAM4 %set% %macpfx%op4 endm ; Patches - Sustain Rate spSustainRt macro op1,op2,op3,op4 spSR1 %set% %macpfx%op1 ; Also known as decay 1 rate spSR2 %set% %macpfx%op2 spSR3 %set% %macpfx%op3 spSR4 %set% %macpfx%op4 endm ; Patches - Sustain Level spSustainLv macro op1,op2,op3,op4 spSL1 %set% %macpfx%op1 ; also known as decay 1 level spSL2 %set% %macpfx%op2 spSL3 %set% %macpfx%op3 spSL4 %set% %macpfx%op4 endm ; Patches - Decay Rate spDecayRt macro op1,op2,op3,op4 spDR1 %set% %macpfx%op1 ; Also known as decay 2 rate spDR2 %set% %macpfx%op2 spDR3 %set% %macpfx%op3 spDR4 %set% %macpfx%op4 endm ; Patches - Release Rate spReleaseRt macro op1,op2,op3,op4 spRR1 %set% %macpfx%op1 spRR2 %set% %macpfx%op2 spRR3 %set% %macpfx%op3 spRR4 %set% %macpfx%op4 endm ; Patches - SSG-EG spSSGEG macro op1,op2,op3,op4 spSS1 %set% %macpfx%op1 spSS2 %set% %macpfx%op2 spSS3 %set% %macpfx%op3 spSS4 %set% %macpfx%op4 endm ; Patches - Total Level spTotalLv macro op1,op2,op3,op4 spTL1 %set% %macpfx%op1 spTL2 %set% %macpfx%op2 spTL3 %set% %macpfx%op3 spTL4 %set% %macpfx%op4 ; Construct the patch finally. dc.b (spFe<<3)+spAl ; 0 1 2 3 4 5 6 7 ;%1000,%1000,%1000,%1000,%1010,%1110,%1110,%1111 spTLMask4 %set% $80 spTLMask2 %set% ((spAl>=5)<<7) spTLMask3 %set% ((spAl>=4)<<7) spTLMask1 %set% ((spAl=7)<<7) dc.b (spDe1<<4)+spMu1, (spDe3<<4)+spMu3, (spDe2<<4)+spMu2, (spDe4<<4)+spMu4 dc.b (spRS1<<6)+spAR1, (spRS3<<6)+spAR3, (spRS2<<6)+spAR2, (spRS4<<6)+spAR4 dc.b (spAM1<<7)+spSR1, (spAM3<<7)+spsR3, (spAM2<<7)+spSR2, (spAM4<<7)+spSR4 dc.b spDR1, spDR3, spDR2, spDR4 dc.b (spSL1<<4)+spRR1, (spSL3<<4)+spRR3, (spSL2<<4)+spRR2, (spSL4<<4)+spRR4 dc.b spSS1, spSS3, spSS2, spSS4 dc.b spTL1|spTLMask1, spTL3|spTLMask3, spTL2|spTLMask2, spTL4|spTLMask4 if safe=1 dc.b "NAT" ; align the patch endif endm ; Patches - Total Level (for broken total level masks) spTotalLv2 macro op1,op2,op3,op4 spTL1 %set% %macpfx%op1 spTL2 %set% %macpfx%op2 spTL3 %set% %macpfx%op3 spTL4 %set% %macpfx%op4 dc.b (spFe<<3)+spAl dc.b (spDe1<<4)+spMu1, (spDe3<<4)+spMu3, (spDe2<<4)+spMu2, (spDe4<<4)+spMu4 dc.b (spRS1<<6)+spAR1, (spRS3<<6)+spAR3, (spRS2<<6)+spAR2, (spRS4<<6)+spAR4 dc.b (spAM1<<7)+spSR1, (spAM3<<7)+spsR3, (spAM2<<7)+spSR2, (spAM4<<7)+spSR4 dc.b spDR1, spDR3, spDR2, spDR4 dc.b (spSL1<<4)+spRR1, (spSL3<<4)+spRR3, (spSL2<<4)+spRR2, (spSL4<<4)+spRR4 dc.b spSS1, spSS3, spSS2, spSS4 dc.b spTL1, spTL3, spTL2, spTL4 if safe=1 dc.b "NAT" ; align the patch endif endm ; =========================================================================== ; --------------------------------------------------------------------------- ; Equates for sPan ; --------------------------------------------------------------------------- spNone %equ% $00 spRight %equ% $40 spLeft %equ% $80 spCentre %equ% $C0 spCenter %equ% $C0 ; =========================================================================== ; --------------------------------------------------------------------------- ; Tracker commands ; --------------------------------------------------------------------------- ; E0xx - Panning, AMS, FMS (PANAFMS - PAFMS_PAN) sPan macro pan, ams, fms %narg% =1 ams == dc.b $E0, %macpfx%pan %narg% =2 fms == else dc.b $E0, %macpfx%pan|%macpfx%ams else dc.b $E0, %macpfx%pan|(%macpfx%ams<<4)|%macpfx%fms endif endm ; E1xx - Set channel frequency displacement to xx (DETUNE_SET) ssDetune macro detune dc.b $E1, %macpfx%detune endm ; E2xx - Add xx to channel frequency displacement (DETUNE) saDetune macro detune dc.b $E2, %macpfx%detune endm ; E3xx - Set channel pitch to xx (TRANSPOSE - TRNSP_SET) ssTranspose macro transp dc.b $E3, %macpfx%transp endm ; E4xx - Add xx to channel pitch (TRANSPOSE - TRNSP_ADD) saTranspose macro transp dc.b $E4, %macpfx%transp endm ; E5xx - Set channel tick multiplier to xx (TICK_MULT - TMULT_CUR) ssTickMulCh macro tick dc.b $E5, %macpfx%tick-1 endm ; E6xx - Set global tick multiplier to xx (TICK_MULT - TMULT_ALL) ssTickMul macro tick dc.b $E6, %macpfx%tick-1 endm ; E7 - Do not attack of next note (HOLD) sHold %equ% $E7 ; E8xx - Set patch/voice/sample to xx (INSTRUMENT - INS_C_FM / INS_C_PSG / INS_C_DAC) sVoice macro voice dc.b $E8, %macpfx%voice endm ; F2xx - Set volume envelope to xx (INSTRUMENT - INS_C_PSG) (FM_VOLENV / DAC_VOLENV) sVolEnv macro env dc.b $F2, %macpfx%env endm ; F3xx - Set modulation envelope to xx (MOD_ENV - MENV_GEN) sModEnv macro env dc.b $F3, %macpfx%env endm ; E9xx - Set music speed shoes tempo to xx (TEMPO - TEMPO_SET_SPEED) ssTempoShoes macro tempo dc.b $E9, %macpfx%tempo endm ; EAxx - Set music tempo to xx (TEMPO - TEMPO_SET) ssTempo macro tempo dc.b $EA, %macpfx%tempo endm ; FF18xx - Add xx to music speed tempo (TEMPO - TEMPO_ADD_SPEED) saTempoSpeed macro tempo dc.b $FF,$18, %macpfx%tempo endm ; FF1Cxx - Add xx to music tempo (TEMPO - TEMPO_ADD) saTempo macro tempo dc.b $FF,$1C, %macpfx%tempo endm ; EB - Use sample DAC mode, where each note is a different sample (DAC_MODE - DACM_SAMP) sModeSampDAC macro dc.b $EB endm ; EC - Use pitch DAC mode, where each note is a different pitch (DAC_MODE - DACM_NOTE) sModePitchDAC macro dc.b $EC endm ; EDxx - Add xx to channel volume (VOLUME - VOL_CN_FM / VOL_CN_PSG / VOL_CN_DAC) saVol macro volume dc.b $ED, %macpfx%volume endm ; EExx - Set channel volume to xx (VOLUME - VOL_CN_ABS) ssVol macro volume dc.b $EE, %macpfx%volume endm ; EFxxyy - Enable/Disable LFO (SET_LFO - LFO_AMSEN) ssLFO macro reg, ams, fms, pan %narg% =2 fms == dc.b $EF, %macpfx%reg,%macpfx%ams %narg% =3 pan == else dc.b $EF, %macpfx%reg,(%macpfx%ams<<4)|%macpfx%fms else dc.b $EF, %macpfx%reg,(%macpfx%ams<<4)|%macpfx%fms|%macpfx%pan endif endm ; F0xxzzwwyy - Modulation (AMPS algorithm) ; ww: wait time ; xx: modulation speed ; yy: change per step ; zz: number of steps ; (MOD_SETUP) sModAMPS macro wait, speed, step, count dc.b $F0 sModData %macpfx%wait, %macpfx%speed, %macpfx%step, %macpfx%count endm sModData macro wait, speed, step, count dc.b %macpfx%speed, %macpfx%count, %macpfx%step, %macpfx%wait endm ; FF00 - Turn on Modulation (MOD_SET - MODS_ON) sModOn macro dc.b $FF,$00 endm ; FF04 - Turn off Modulation (MOD_SET - MODS_OFF) sModOff macro dc.b $FF,$04 endm ; FF28xxxx - Set modulation frequency to xxxx (MOD_SET - MODS_FREQ) ssModFreq macro freq dc.b $FF,$28 dc.w %macpfx%freq endm ; FF2C - Reset modulation data (MOD_SET - MODS_RESET) sModReset macro dc.b $FF,$2C endm ; F1xx - Set portamento speed to xx frames. 0 means portamento is disabled (PORTAMENTO) ssPortamento macro frames dc.b $F1, %macpfx%frames endm ; F4xxxx - Keep looping back to xxxx each time the SFX is being played (CONT_SFX) sCont macro loc dc.b $F4 dc.w %macpfx%loc-*-2 endm ; F5 - End of channel (TRK_END - TEND_STD) sStop macro dc.b $F5 endm ; F6xxxx - Jump to xxxx (GOTO) sJump macro loc dc.b $F6 dc.w %macpfx%loc-*-2 endm ; F7xxyyzzzz - Loop back to zzzz yy times, xx being the loop index for loop recursion fixing (LOOP) sLoop macro index,loops,loc dc.b $F7, %macpfx%index dc.w %macpfx%loc-*-2 dc.b %macpfx%loops-1 if %macpfx%loops<2 %fatal%"Invalid number of loops! Must be 2 or more!" endif endm ; F8xxxx - Call pattern at xxxx, saving return point (GOSUB) sCall macro loc dc.b $F8 dc.w %macpfx%loc-*-2 endm ; F9 - Return (RETURN) sRet macro dc.b $F9 endm ; FAyyxx - Set communications byte yy to xx (SET_COMM - SPECIAL) sComm macro index, val dc.b $FA, %macpfx%index,%macpfx%val endm ; FBxyzz - Get communications byte y, and compare zz with it using condition x (COMM_CONDITION) sCond macro index, cond, val dc.b $FB, %macpfx%index|(%macpfx%cond<<4),%macpfx%val endm ; FC - Reset condition (COMM_RESET) sCondOff macro dc.b $FC endm ; FDxx - Stop note after xx frames (NOTE_STOP - NSTOP_NORMAL) sGate macro frames dc.b $FD, %macpfx%frames endm ; FExxyy - YM command yy on register xx (YMCMD) sCmdYM macro reg, val dc.b $FE, %macpfx%reg,%macpfx%val endm ; FF08xxxx - Set channel frequency to xxxx (CHFREQ_SET) ssFreq macro freq dc.b $FF,$08 dc.w %macpfx%freq endm ; FF0Cxx - Set channel frequency to note xx (CHFREQ_SET - CHFREQ_NOTE) ssFreqNote macro note dc.b $FF,$0C, %macpfx%note%xor%$80 endm ; FF10 - Increment spindash rev counter (SPINDASH_REV - SDREV_INC) sSpinRev macro dc.b $FF,$10 endm ; FF14 - Reset spindash rev counter (SPINDASH_REV - SDREV_RESET) sSpinReset macro dc.b $FF,$14 endm ; FF20xyzz - Get RAM address pointer offset by y, compare zz with it using condition x (COMM_CONDITION - COMM_SPEC) sCondReg macro index, cond, val dc.b $FF,$20, %macpfx%index|(%macpfx%cond<<4),%macpfx%val endm ; FF24xx - Play another music/sfx (SND_CMD) sPlayMus macro id dc.b $FF,$24, %macpfx%id endm ; FF30 - Enable FM3 special mode (SPC_FM3) sSpecFM3 macro dc.b $FF,$30 %fatal%"Flag is currently not implemented! Please remove." endm ; FF34xx - Set DAC filter bank address (DAC_FILTER) ssFilter macro bank dc.b $FF,$34, %macpfx%bank endm ; FF38 - Load the last song from back-up (FADE_IN_SONG) sBackup macro dc.b $FF,$38 endm ; FF3Cxx - PSG4 noise mode xx (PSG_NOISE - PNOIS_AMPS) sNoisePSG macro mode dc.b $FF,$3C, %macpfx%mode endm ; FF40 - Freeze 68k. Debug flag (DEBUG_STOP_CPU) sFreeze macro if safe=1 dc.b $FF,$40 endif endm ; FF44 - Bring up tracker debugger at end of frame. Debug flag (DEBUG_PRINT_TRACKER) sCheck macro if safe=1 dc.b $FF,$44 endif endm ; =========================================================================== ; --------------------------------------------------------------------------- ; Equates for sNoisePSG ; --------------------------------------------------------------------------- %ifasm% AS enum snOff=$00 ; disables PSG3 noise mode. enum snPeri10=$E0,snPeri20,snPeri40,snPeriPSG3 enum snWhite10=$E4,snWhite20,snWhite40,snWhitePSG3 %endif% %ifasm% ASM68K snOff = $00 ; disables PSG3 noise mode. _num = $E0 enum snPeri10, snPeri20, snPeri40, snPeriPSG3 enum snWhite10,snWhite20,snWhite40,snWhitePSG3 %endif% ; ---------------------------------------------------------------------------
ADI,D1,8 ADI,D2,4 ADD,D1,D2 // this is a comment ADD,D5,D1 SUB,D1,D2 MUL,D5,D1
#include <algorithm> #include <sstream> #include <ctime> #include <cstring> #include <minizip/zlib.h> #include <zipper.hpp> namespace ziputils { const unsigned int BUFSIZE = 2048; // Default constructor zipper::zipper() : zipFile_(nullptr), entryOpen_(false) { } // Default destructor zipper::~zipper(void) { close(); } // Create a new zip file. // param: // filename path and the filename of the zip file to open // append set true to append the zip file // return: // true if open, false otherwise bool zipper::open(const char* filename, bool append) { close(); zipFile_ = zipOpen64(filename, append ? APPEND_STATUS_ADDINZIP : 0); return isOpen(); } // Close the zip file void zipper::close() { if (zipFile_) { closeEntry(); zipClose(zipFile_, nullptr); zipFile_ = nullptr; } } // Check if a zipfile is open. // return: // true if open, false otherwise bool zipper::isOpen() { return zipFile_ != nullptr; } // Create a zip entry; either file or folder. Folder has to // end with a slash or backslash. // return: // true if open, false otherwise bool zipper::addEntry(const char* filename) { if (isOpen()) { closeEntry(); while (filename[0] == '\\' || filename[0] == '/') { filename++; } //?? we dont need the stinking time zip_fileinfo zi; memset(&zi, 0, sizeof(zi)); getTime(zi.tmz_date); int err = zipOpenNewFileInZip(zipFile_, filename, &zi, nullptr, 0, nullptr, 0, nullptr, Z_DEFLATED, Z_DEFAULT_COMPRESSION); entryOpen_ = (err == ZIP_OK); } return entryOpen_; } // Close the currently open zip entry. void zipper::closeEntry() { if (entryOpen_) { zipCloseFileInZip(zipFile_); entryOpen_ = false; } } // Check if there is a currently open file zip entry. // return: // true if open, false otherwise bool zipper::isOpenEntry() { return entryOpen_; } // Stream operator for dumping data from an input stream to the // currently open zip entry. zipper& zipper::operator<<(std::istream& is) { int err = ZIP_OK; char buf[BUFSIZE]; if (isOpenEntry()) { while (err == ZIP_OK && is.good()) { is.read(buf, BUFSIZE); unsigned int nRead = (unsigned int)is.gcount(); if (nRead) { err = zipWriteInFileInZip(zipFile_, buf, nRead); } else { break; } } } return *this; } // Fill the zip time structure // param: // tmZip time structure to be filled void zipper::getTime(tm_zip& tmZip) { time_t rawtime; time(&rawtime); auto timeinfo = localtime(&rawtime); tmZip.tm_sec = timeinfo->tm_sec; tmZip.tm_min = timeinfo->tm_min; tmZip.tm_hour = timeinfo->tm_hour; tmZip.tm_mday = timeinfo->tm_mday; tmZip.tm_mon = timeinfo->tm_mon; tmZip.tm_year = timeinfo->tm_year; } };
#include "game/data/stages/stages-index.asm" #include "game/data/characters/characters-index.asm" #include "game/data/characters/characters-common-logic.asm" #include "game/data/characters/characters-common-animations/characters-common-animations.asm"
SECTION code_clib SECTION code_l_sdcc PUBLIC ____sdcc_load_debc_deix ____sdcc_load_debc_deix: IFDEF __SDCC_IX push ix ELSE push iy ENDIF ex (sp),hl add hl,de ld c,(hl) inc hl ld b,(hl) inc hl ld e,(hl) inc hl ld d,(hl) pop hl ret
.global s_prepare_buffers s_prepare_buffers: push %r12 push %r13 push %r14 push %r8 push %rbx push %rcx push %rdi push %rsi lea addresses_A_ht+0x185d1, %rbx nop nop nop nop nop xor $26262, %r13 mov $0x6162636465666768, %r14 movq %r14, (%rbx) nop nop nop add %r8, %r8 lea addresses_A_ht+0x33d1, %rsi nop nop nop inc %rbx mov $0x6162636465666768, %r12 movq %r12, (%rsi) nop nop nop cmp %r12, %r12 lea addresses_A_ht+0x83d1, %rsi lea addresses_WC_ht+0x71d1, %rdi clflush (%rdi) nop nop nop nop xor %rbx, %rbx mov $20, %rcx rep movsb nop nop nop nop sub %rsi, %rsi lea addresses_UC_ht+0xf6d1, %rsi lea addresses_WC_ht+0x2c71, %rdi clflush (%rsi) nop nop cmp $56500, %r13 mov $28, %rcx rep movsb nop nop sub $23606, %r12 lea addresses_normal_ht+0x1a8d1, %r13 nop nop nop nop xor $12230, %rsi movb (%r13), %r8b nop nop nop nop nop sub $25412, %rdi lea addresses_WT_ht+0xb731, %rcx xor %rbx, %rbx movups (%rcx), %xmm4 vpextrq $0, %xmm4, %r13 nop nop nop nop nop inc %rsi lea addresses_WC_ht+0x12ed1, %r12 nop xor $10, %r14 mov (%r12), %ebx nop lfence lea addresses_WT_ht+0x197d1, %r13 nop nop nop nop nop cmp $29980, %r12 movw $0x6162, (%r13) nop nop nop nop cmp %rsi, %rsi lea addresses_D_ht+0x1ec72, %r12 nop nop nop nop lfence movl $0x61626364, (%r12) cmp $22725, %rcx lea addresses_WC_ht+0xa0cc, %rcx cmp $47205, %r13 movups (%rcx), %xmm3 vpextrq $0, %xmm3, %rdi nop nop nop sub %r8, %r8 lea addresses_normal_ht+0x193a1, %rsi lea addresses_normal_ht+0x1bbd1, %rdi clflush (%rdi) sub %r12, %r12 mov $93, %rcx rep movsb nop nop nop nop sub %r8, %r8 lea addresses_WT_ht+0x43d1, %r14 sub %r13, %r13 movw $0x6162, (%r14) nop nop nop nop and $57787, %rsi lea addresses_A_ht+0xbbd1, %r14 cmp %rdi, %rdi movw $0x6162, (%r14) nop xor %r14, %r14 lea addresses_normal_ht+0xe431, %rsi nop nop nop nop add %r12, %r12 movb (%rsi), %r8b nop nop nop nop nop inc %r8 lea addresses_WT_ht+0x3183, %rcx nop nop nop nop nop add $19577, %r8 movb $0x61, (%rcx) nop xor $16611, %rdi pop %rsi pop %rdi pop %rcx pop %rbx pop %r8 pop %r14 pop %r13 pop %r12 ret .global s_faulty_load s_faulty_load: push %r15 push %r8 push %rbx push %rcx push %rdi push %rdx push %rsi // Store lea addresses_WT+0x1a789, %r15 nop nop nop nop xor %rbx, %rbx mov $0x5152535455565758, %rsi movq %rsi, %xmm3 movups %xmm3, (%r15) nop nop nop nop nop add %r15, %r15 // Faulty Load lea addresses_D+0xdbd1, %rdx nop nop nop dec %r8 vmovups (%rdx), %ymm0 vextracti128 $0, %ymm0, %xmm0 vpextrq $1, %xmm0, %r15 lea oracles, %rdx and $0xff, %r15 shlq $12, %r15 mov (%rdx,%r15,1), %r15 pop %rsi pop %rdx pop %rdi pop %rcx pop %rbx pop %r8 pop %r15 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_D', 'same': False, 'size': 16, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_WT', 'same': False, 'size': 16, 'congruent': 1, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} [Faulty Load] {'src': {'type': 'addresses_D', 'same': True, 'size': 32, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} <gen_prepare_buffer> {'dst': {'type': 'addresses_A_ht', 'same': False, 'size': 8, 'congruent': 8, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'dst': {'type': 'addresses_A_ht', 'same': False, 'size': 8, 'congruent': 9, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'src': {'type': 'addresses_A_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 9, 'same': True}, 'OP': 'REPM'} {'src': {'type': 'addresses_UC_ht', 'congruent': 3, 'same': True}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 5, 'same': False}, 'OP': 'REPM'} {'src': {'type': 'addresses_normal_ht', 'same': False, 'size': 1, 'congruent': 8, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_WT_ht', 'same': False, 'size': 16, 'congruent': 4, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_WC_ht', 'same': False, 'size': 4, 'congruent': 7, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_WT_ht', 'same': False, 'size': 2, 'congruent': 10, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'dst': {'type': 'addresses_D_ht', 'same': False, 'size': 4, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'src': {'type': 'addresses_WC_ht', 'same': False, 'size': 16, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_normal_ht', 'congruent': 2, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 11, 'same': False}, 'OP': 'REPM'} {'dst': {'type': 'addresses_WT_ht', 'same': False, 'size': 2, 'congruent': 11, 'NT': True, 'AVXalign': False}, 'OP': 'STOR'} {'dst': {'type': 'addresses_A_ht', 'same': False, 'size': 2, 'congruent': 11, 'NT': False, 'AVXalign': True}, 'OP': 'STOR'} {'src': {'type': 'addresses_normal_ht', 'same': False, 'size': 1, 'congruent': 5, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_WT_ht', 'same': False, 'size': 1, 'congruent': 1, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'36': 21829} 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 */
; ; FILENAME : f64_ldexp.asm ; ; DESCRIPTION : ; double ldexpd(double v, int n) ; double scalbnd(double v, int n) ; ; assembly module written for MASM/NASM ; ; AUTHOR : Rainer Erdmann ; ; Copyright 2016-2019 Rainer Erdmann ; ; License: see accompanying file license.txt ; ; CHANGES : ; ; REF NO VERSION DATE WHO DETAIL ; IFDEF @Version INCLUDE common.masm ELSE INCLUDE 'common.nasm' ENDIF IFDEF @Version COPYSIGN MACRO DST, SRC pxor DST, SRC pand DST, [M7FF] pxor DST, SRC ENDM ELSE %macro COPYSIGN 2 pxor %1, %2 pand %1, [M7FF] pxor %1, %2 %endmacro ENDIF IMPORT C10, ?C10@@3NB IMPORT D_INF, ?D_INF@@3NA IMPORT M7FF, ?M7FF@@3XA IFDEF _M_X64 ; 64bit ; x64 - x64 - x64 - x64 - x64 - x64 - x64 - x64 - x64 - x64 - x64 .data align 16 MASK dq 0800fffffffffffffh, 0 ESUB dq 03fe0000000000000h, 0 MMSK dq 0000fffffffffffffh, 0 .code ; "double __cdecl __ldexp(double,int)" (?__ldexp@@YANNH@Z) ENTRY ldexpd, YANNH@Z ENTRY scalbnd, YANNH@Z ; this is the shortest and the (normally) fastest way; ; it gets very slow on DENS, not on ZERO, INF or NAN ; and we have a different rounding behavior on DENs ; the original truncates, we round ; (by definition, rounding is the correct behavior) cmp edx, 03ffh jge .of cmp edx, -1023 jle .uf add edx, 03ffh ; if we would check x for DEN here ; we would get slower on the main path ; how much? ; 7.5 with check, 6.5 without ; movq rax, xmm0 ; btr rax, 63 ; shr rax, 52 ; jz .spec0 .cont: shl rdx, 52 movq xmm1, rdx mulsd xmm0, xmm1 ret ;.spec0: ; jmp .cont .of: ; in case edx is >= 7fe we need a special handling cmp edx, 07feh jge .gt7fe mov eax, edx shr eax, 1 sub edx, eax add edx, 03ffh add eax, 03ffh movd xmm1, eax psllq xmm1, 52 mulsd xmm0, xmm1 movd xmm1, edx psllq xmm1, 52 mulsd xmm0, xmm1 ret .gt7fe: ; edx is >= 0x7fe mov eax, 07feh sub edx, 03ffh movd xmm1, eax psllq xmm1, 52 mulsd xmm0, xmm1 cmp edx, 03ffh jle .lt3ff sub edx, 03ffh mulsd xmm0, xmm1 cmp edx, 03ffh jle .lt3ff psllq xmm1, 52 mulsd xmm0, xmm1 ret .lt3ff: add edx, 03ffh movd xmm1, edx psllq xmm1, 52 mulsd xmm0, xmm1 ret ; ---------------- .uf: cmp edx, -1022 jg .gem3fe mov eax, 1 add edx, 03ffh movd xmm1, eax psllq xmm1, 52 mulsd xmm0, xmm1 cmp edx, -1022 jg .gem3fe mov eax, 1 add edx, 03feh ; why 3fe here and 3ff above? movd xmm1, eax psllq xmm1, 52 mulsd xmm0, xmm1 cmp edx, -1022 jg .gem3fe mov eax, 1 add edx, 03ffh movd xmm1, edx psllq xmm1, 52 mulsd xmm0, xmm1 ret ; already correct .gem3fe: add edx, 03feh movd xmm1, edx psllq xmm1, 52 mulsd xmm0, xmm1 ret ENTRY ldexpd2, YANNH@Z ENTRY ldexpd ; this surely works absolutely correct ; but it gets deadly slow on DENs IF 0 movsd [SPACE], xmm0 mov [SPACE+8], edx fild _D [SPACE+8] fld _Q [SPACE] fscale fstp ST(1) fstp _Q [SPACE] movsd xmm0, [SPACE] ret ENDIF ; but already xdenz and this is fast ; 8cy main range ; and all special cases <16cy ; the slowest is DEN x and DEN y 14cy pextrw eax, xmm0, 3 btr eax, 15 shr eax, 4 jz .xdenz4 ; x is DEN or ZERO cmp eax, 07ffh jz .xinf4 ; we do not check edx here in the moment add eax, edx jle .zden4 cmp eax, 07ffh jge .zinf4 shl rax, 52 movq xmm1, rax pand xmm0, [MASK] por xmm0, xmm1 ; andpd xmm0, [MASK] ; orpd xmm0, xmm1 ret add edx, 3ffh shl rdx, 52 movq xmm1, rdx mulsd xmm0, xmm1 ret ; we must handle all special cases here ; x is DEN or ZERO .xdenz4: movdqa xmm2, xmm0 ;+++ andpd xmm0, [M7FF] ; fabs movsd xmm1, [C10] orpd xmm0, xmm1 subsd xmm0, xmm1 movq rax, xmm0 shr rax, 52 jz .xz5 orpd xmm0, xmm1 ; xmm0 is normalized now to [1, 2[ lea eax, [eax - 1023 - 1022 + edx] cmp eax, 1023 jg .zinf5 cmp eax, -1023 jle .zden5 ; result is a NORM add eax, 3ffh shl rax, 52 movq xmm1, rax mulsd xmm0, xmm1 pxor xmm0, xmm2 pand xmm0, [M7FF] pxor xmm0, xmm2 ; COPYSIGN xmm0, xmm2 ret ; x is INF or NAN .xinf4: ret ; finished ; x is ZERO .xz5: ; finished ret ; z will be DEN or ZERO .zden5: ; x is normalized and positive add eax, 1023 neg eax add eax, 400h shl rax, 52 movq xmm1, rax addsd xmm0, xmm1 pand xmm0, [MASK] pxor xmm0, xmm2 pand xmm0, [M7FF] pxor xmm0, xmm2 ret .zden4: ; x is unknown ; thats it! (except we need the sign of x in xmm1) movdqa xmm2, xmm0 pand xmm0, [MMSK] por xmm0, [C10] neg eax add eax, 400h shl rax, 52 movq xmm1, rax addsd xmm0, xmm1 pand xmm0, [MMSK] pxor xmm0, xmm2 pand xmm0, [M7FF] pxor xmm0, xmm2 ret ; z will be INF - leave it to a mul to keep the sign .zinf4: mulsd xmm0, [D_INF] ret .zinf5: movsd xmm0, [D_INF] pxor xmm0, xmm2 pand xmm0, [M7FF] pxor xmm0, xmm2 ret IF 0 ; yes it works... ; was only a test; ; solution above IS faster movsd _Q [SPACE], xmm0 fld1 fstp _T [SPACE+8] add _W [SPACE+8+8], dx fld _T [SPACE+8] fmul _Q [SPACE] fstp _Q [SPACE] movsd xmm0, _Q [SPACE] ret ENDIF IF 1 ; n is >= 1023 or <= -1023 ; x is not yet checked pxor xmm2, xmm2 comisd xmm0, xmm2 jz .ret3 ; x is ZERO or NAN ; remaining: x is not ZERO, anything [DEN, INF] movq rax, xmm0 btr rax, 63 shr rax, 52 jz .denx cmp eax, 07ffh jz .ret3 ; x is INF ; remaining: x is finite add eax, edx ; combine jbe .den ; result will be DEN cmp eax, 07ffh jge .inf ; result will be INF andpd xmm0, [MASK] shl rax, 52 movq xmm1, rax orpd xmm0, xmm1 ret ; x is DEN .denx: .inf: mov eax, 07ffh psrlq xmm0, 52 ; keep sign only movq xmm1, rax por xmm0, xmm1 psllq xmm0, 52 ret .den: ; eax is the final (biased) exp ; and the result will be a DEN ; in case eax < -52 the result is ZERO ; we would like to use the same trick as in frexp andpd xmm0, [MASK] orpd xmm0, [ESUB] ; x now is [0.5, 1[ ; add eax, 3ffh mov edx, 3ffh sub edx, eax ; ### something missing movq xmm1, rdx psllq xmm1, 52 addsd xmm0, xmm1 andpd xmm0, [MASK] ret .ret3: ret ENDIF FUNC ENDP ELSE ; x86 .code ; "double __cdecl __ldexp(double,int)" (?__ldexp@@YANNH@Z) ENTRY ldexpd2, YANNH@Z ; this is the shortest way... ; 18..20 SAN fild _D [esp+4+8] fld _Q [esp+4] fscale fstp ST(1) ret ; this is the shortest and the (normally) fastest way; ; it gets very slow on DENS, not on ZERO, INF or NAN ; 10.3 SAN movsd xmm0, _X [esp+4] mov edx, _D [esp+4+8] cmp edx, 03ffh jge .of cmp edx, -1023 jle .uf add edx, 03ffh movd xmm1, edx psllq xmm1, 52 mulsd xmm0, xmm1 movsd _X [esp+4], xmm0 fld _Q [esp+4] ret .of: ; in case edx is >= 7fe we need a special handling cmp edx, 0x7fe jge .gt7fe mov eax, edx shr eax, 1 sub edx, eax add edx, 03ffh add eax, 03ffh movd xmm1, eax psllq xmm1, 52 mulsd xmm0, xmm1 movd xmm1, edx psllq xmm1, 52 mulsd xmm0, xmm1 movsd _X [esp+4], xmm0 fld _Q [esp+4] ret .gt7fe: ; edx is >= 0x7fe mov eax, 07feh sub edx, 03ffh movd xmm1, eax psllq xmm1, 52 mulsd xmm0, xmm1 cmp edx, 03ffh jle .lt3ff sub edx, 03ffh mulsd xmm0, xmm1 cmp edx, 03ffh jle .lt3ff psllq xmm1, 52 mulsd xmm0, xmm1 movsd _X [esp+4], xmm0 fld _Q [esp+4] ret .lt3ff: add edx, 03ffh movd xmm1, edx psllq xmm1, 52 mulsd xmm0, xmm1 movsd _X [esp+4], xmm0 fld _Q [esp+4] ret ; ---------------- .uf: cmp edx, -1022 jg .gem3fe mov eax, 1 add edx, 03ffh movd xmm1, eax psllq xmm1, 52 mulsd xmm0, xmm1 cmp edx, -1022 jg .gem3fe mov eax, 1 add edx, 03feh ; why 3fe here and 3ff above? movd xmm1, eax psllq xmm1, 52 mulsd xmm0, xmm1 cmp edx, -1022 jg .gem3fe mov eax, 1 add edx, 03ffh movd xmm1, edx psllq xmm1, 52 mulsd xmm0, xmm1 movsd _X [esp+4], xmm0 fld _Q [esp+4] ret ; already correct .gem3fe: add edx, 03feh movd xmm1, edx psllq xmm1, 52 mulsd xmm0, xmm1 movsd _X [esp+4], xmm0 fld _Q [esp+4] ret ; "double __cdecl ldexp(double,int)" (?ldexp@@YANNH@Z) ENTRY ldexpd, YANNH@Z ; this is the shortest and the (normally) fastest way; ; it gets very slow on DENS, INF or NAN, not on ZERO ; 9.9 SAN fld _Q [esp+4] mov edx, _D [esp+4+8] cmp edx, 03ffh jge .of cmp edx, -1023 jle .uf add edx, 03ffh movd xmm1, edx psllq xmm1, 52 movsd _X [esp+4], xmm1 fmul _Q [esp+4] ret .of: cmp edx, 03fffh jge .gt7fe fld1 fstp _T [esp+4] add _W [esp+4+8], dx fld _T [esp+4] fmulp ret .gt7fe: fld1 fstp _T [esp+4] add _W [esp+4+8], 8192 fld _T [esp+4] fmulp ret ; ---------------- .uf: cmp edx, -16382 jl .l3fe fld1 fstp _T [esp+4] add _W [esp+4+8], dx fld _T [esp+4] fmulp ret .l3fe: fld1 fstp _T [esp+4] add _W [esp+4+8], -8192 fld _T [esp+4] fmulp ret ; "double __vectorcall ldexpd(double,int)" (?ldexpd@@YQNNH@Z) ENTRY ldexpd, YQNNH@Z cmp ecx, 03ffh jge .of cmp ecx, -1023 jle .uf add ecx, 03ffh movd xmm1, ecx psllq xmm1, 52 mulsd xmm0, xmm1 ret .of: ; in case exp is >= 7fe we need a special handling cmp ecx, 0x7fe jge .gt7fe mov eax, ecx shr eax, 1 sub ecx, eax add ecx, 03ffh add eax, 03ffh movd xmm1, eax psllq xmm1, 52 mulsd xmm0, xmm1 movd xmm1, ecx psllq xmm1, 52 mulsd xmm0, xmm1 ret .gt7fe: ; exp is >= 0x7fe mov eax, 07feh sub ecx, 03ffh movd xmm1, eax psllq xmm1, 52 mulsd xmm0, xmm1 cmp ecx, 03ffh jle .lt3ff sub ecx, 03ffh mulsd xmm0, xmm1 cmp ecx, 03ffh jle .lt3ff psllq xmm1, 52 mulsd xmm0, xmm1 ret .lt3ff: add ecx, 03ffh movd xmm1, ecx psllq xmm1, 52 mulsd xmm0, xmm1 ret ; ---------------- .uf: cmp ecx, -1022 jg .gem3fe mov eax, 1 add ecx, 03ffh movd xmm1, eax psllq xmm1, 52 mulsd xmm0, xmm1 cmp ecx, -1022 jg .gem3fe mov eax, 1 add ecx, 03feh ; why 3fe here and 3ff above? movd xmm1, eax psllq xmm1, 52 mulsd xmm0, xmm1 cmp ecx, -1022 jg .gem3fe mov eax, 1 add ecx, 03ffh movd xmm1, ecx psllq xmm1, 52 mulsd xmm0, xmm1 ret ; already correct .gem3fe: add ecx, 03feh movd xmm1, ecx psllq xmm1, 52 mulsd xmm0, xmm1 ret ; we need an internal version ; with x in xmm0, exp in edx ; returning y in st(0) ENTRY ldexpd ; this is the shortest way... ; 18..20 SAN ; fild _D [esp+4+8] ; fld _Q [esp+4] mov [esp-8], edx movsd [esp-16], xmm0 fild _D [esp-8] fld _Q [esp-16] fscale fstp ST(1) ret FUNC ENDP ENDIF END
; SMSQmulator WIN Driver initialisation V1.03 (c) W.Lenerz 2012-2020 ; This handles linking in the driver into the OS. ; ; copyright (C) w. Lenerz 2012-2020 published under the SMSQE licence ; v. 1.03 added WIN_REMV ; v. 1.02 data/prog defaults are set ; v. 1.01 implement win_drive & win_drive$ ; v. 1.00 device is called WIN ; v. 0.01 functional ; v. 0.00 stub ; based on: ; RAM Disk disk initialisation V2.02  1985 Tony Tebby QJUMP section nfa xdef win_init xref.l nfa_vers ; get version xref ut_procdef xref iou_ddst xref iou_ddlk xref nfa_opn ; open file xref nfa_clo ; close file xref nfa_io ; do file io xref nfa_fmt ; format drive xref nfa_niy include 'dev8_keys_iod' include 'dev8_mac_proc' include 'dev8_dd_rd_data' include 'dev8_mac_config02' include 'dev8_keys_java' include 'dev8_keys_qdos_sms' include 'dev8_keys_sys' maxchars equ 96 mkcfhead {WIN Drives},'1_00' noyes mkcfitem 'JVW0',code,'D',disable,,,\ {Disable WIN drives?} \ 0,N,{No},1,Y,{Yes} mkcfitem 'JVW1',string,1,w1name,,,\ {Name for WIN Drive 1?},0 mkcfitem 'JVW2',string,'2',w2name,,,\ {Name for WIN Drive 2?},$0000 mkcfitem 'JVW3',string,'3',w3name,,,\ {Name for WIN Drive 3?},$0000 mkcfitem 'JVW4',string,'4',w4name,,,\ {Name for WIN Drive 4?},$0000 mkcfitem 'JVW5',string,'5',w5name,,,\ {Name for WIN Drive 5?},$0000 mkcfitem 'JVW6',string,'6',w6name,,,\ {Name for WIN Drive 6?},$0000 mkcfitem 'JVW7',string,'7',w7name,,,\ {Name for WIN Drive 7?},$0000 mkcfitem 'JVW8',string,'8',w8name,,,\ {Name for WIN Drive 8?},$0000 mkcfend dc.l jva_cfgf1 dc.l jva_cfgf2 dc.l jva_cfgf3 dc.l jva_cfgf4 dc.l 'WIN0' disable dc.b 0 w1name dc.w maxchars+4 ds.b maxchars+4 w2name dc.w maxchars ds.b maxchars+4 w3name dc.w maxchars ds.b maxchars+4 w4name dc.w maxchars ds.b maxchars+4 w5name dc.w maxchars ds.b maxchars+4 w6name dc.w maxchars ds.b maxchars+4 w7name dc.w maxchars ds.b maxchars+4 w8name dc.w maxchars ds.b maxchars+4 ;+++ ; Initialise WIN_USE and DD linkage and get device going. ; ; status return standard ;--- exit clr.l d0 rts win_init lea proctab,a1 jsr ut_procdef ; initialise basic keywords (always) lea disable(PC),a1 tst.b (a1) ; do we link in WIN drive at all? bne.s exit ; no move.l 4,d0 ; get config info beq.s no_cfg move.l a1,-(a7) move.l d0,a1 move.l jva_winu(a1),d0 beq.s none lea use_nam+2,a1 move.l d0,(a1) none move.l (a7)+,a1 no_cfg lea nfa_vect,a3 ; set up dd linkage jsr iou_ddst jmp iou_ddlk jsr iou_ddlk hdi_found moveq #sms.xtop,d0 trap #do.smsq lea sys_datd(a6),a0 ; data default bsr.s hdi_dset lea sys_prgd(a6),a0 hdi_dset move.l (a0),d0 ; set? beq.s hdi_rts move.l d0,a0 move.l hdi_boot+2,2(a0) ; set boot device as default moveq #0,d0 hdi_rts rts hdi_boot dc.w 9,'win1_boot' nfa_vect dc.l rdd_end ; length of linkage dc.l rdd.plen ; length of physical definition use_nam dc.w 3,'WIN0' ; device name (usage) dc.w 3,'WIN0' ; device name (real) null dc.w 0 ; external interrupt server (none) dc.w 0 ; polling server (none) dc.w 0 ; scheduler server (none) dc.w nfa_io-* ; io operations dc.w nfa_opn-* ; open operation dc.w nfa_clo-* ; close dc.w 0 ; forced slaving dc.w 0 ; dummy dc.w 0 ; dummy dc.w nfa_fmt-* ; format dc.w 0 ; check all slave blocks read dc.w 0 ; flush all buffers dc.w 0 ; get occupancy information dc.w 0 ; load dc.w 0 ; save dc.w 0 ; truncate dc.w 0 ; locate buffer dc.w 0 ; locate / allocate buffer dc.w 0 ; mark buffer updated dc.w 0 ; allocate first sector dc.w 0 ; check medium for open operation dc.w 0 ; format drive dc.w 0 ; read sector dc.w 0 ; write sector dc.w -1 ; the basic procedures (in driver_nfa_use and driver_nfa_useq) section procs proctab proc_stt proc_def WIN_USE proc_def WIN_DRIVE proc_def WIN_REMV proc_end proc_stt proc_def WIN_USE$ , win_useq proc_def WIN_DRIVE$ , win_useq proc_end end
; BeepFX sound effect by shiru ; http://shiru.untergrund.net SECTION rodata_clib SECTION rodata_sound_bit PUBLIC _bfx_40 _bfx_40: ; Select_1 defb 1 ;tone defw 1,2000,400,0,128 defb 1 ;tone defw 1,2000,400,0,16 defb 1 ;tone defw 1,2000,600,0,128 defb 1 ;tone defw 1,2000,600,0,16 defb 1 ;tone defw 1,2000,800,0,128 defb 1 ;tone defw 1,2000,800,0,16 defb 0
.include "defaults_mod.asm" table_file_jp equ "exe5-utf8.tbl" table_file_en equ "bn5-utf8.tbl" game_code_len equ 3 game_code equ 0x4252424A // BRBJ game_code_2 equ 0x42524245 // BRBE game_code_3 equ 0x42524250 // BRBP card_type equ 1 card_id equ 89 card_no equ "089" card_sub equ "Mod Card 089" card_sub_x equ 64 card_desc_len equ 2 card_desc_1 equ "DrillMan" card_desc_2 equ "47MB" card_desc_3 equ "" card_name_jp_full equ "ドリルマン" card_name_jp_game equ "ドリルマン" card_name_en_full equ "DrillMan" card_name_en_game equ "DrillMan" card_address equ "" card_address_id equ 0 card_bug equ 0 card_wrote_en equ "" card_wrote_jp equ ""
ViridianForestEntranceScript: call EnableAutoTextBoxDrawing ret ViridianForestEntranceTextPointers: dw ViridianForestEntranceText1 dw ViridianForestEntranceText2 ViridianForestEntranceText1: TX_FAR _ViridianForestEntranceText1 db "@" ViridianForestEntranceText2: TX_FAR _ViridianForestEntranceText2 db "@"