text
stringlengths
1
1.05M
; A169371: Number of reduced words of length n in Coxeter group on 22 generators S_i with relations (S_i)^2 = (S_i S_j)^31 = I. ; 1,22,462,9702,203742,4278582,89850222,1886854662,39623947902,832102905942,17474161024782,366957381520422,7706105011928862,161828205250506102,3398392310260628142,71366238515473190982 add $0,1 mov $3,1 lpb $0 sub $0,1 add $2,$3 div $3,$2 mul $2,21 lpe mov $0,$2 div $0,21
/* * Copyright (c) 2014 The WebRTC 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 in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree. */ #include "modules/remote_bitrate_estimator/aimd_rate_control.h" #include <inttypes.h> #include <algorithm> #include <cassert> #include <cmath> #include <cstdio> #include <string> #include "api/transport/network_types.h" #include "api/units/data_rate.h" #include "modules/remote_bitrate_estimator/include/bwe_defines.h" #include "modules/remote_bitrate_estimator/overuse_detector.h" #include "rtc_base/checks.h" #include "rtc_base/experiments/field_trial_parser.h" #include "rtc_base/logging.h" #include "rtc_base/numerics/safe_minmax.h" namespace webrtc { namespace { constexpr TimeDelta kDefaultRtt = TimeDelta::Millis<200>(); constexpr double kDefaultBackoffFactor = 0.85; constexpr char kBweBackOffFactorExperiment[] = "WebRTC-BweBackOffFactor"; bool IsEnabled(const WebRtcKeyValueConfig& field_trials, absl::string_view key) { return field_trials.Lookup(key).find("Enabled") == 0; } double ReadBackoffFactor(const WebRtcKeyValueConfig& key_value_config) { std::string experiment_string = key_value_config.Lookup(kBweBackOffFactorExperiment); double backoff_factor; int parsed_values = sscanf(experiment_string.c_str(), "Enabled-%lf", &backoff_factor); if (parsed_values == 1) { if (backoff_factor >= 1.0) { RTC_LOG(WARNING) << "Back-off factor must be less than 1."; } else if (backoff_factor <= 0.0) { RTC_LOG(WARNING) << "Back-off factor must be greater than 0."; } else { return backoff_factor; } } RTC_LOG(LS_WARNING) << "Failed to parse parameters for AimdRateControl " "experiment from field trial string. Using default."; return kDefaultBackoffFactor; } } // namespace AimdRateControl::AimdRateControl(const WebRtcKeyValueConfig* key_value_config) : AimdRateControl(key_value_config, /* send_side =*/false) {} AimdRateControl::AimdRateControl(const WebRtcKeyValueConfig* key_value_config, bool send_side) : min_configured_bitrate_(congestion_controller::GetMinBitrate()), max_configured_bitrate_(DataRate::kbps(30000)), current_bitrate_(max_configured_bitrate_), latest_estimated_throughput_(current_bitrate_), link_capacity_(), rate_control_state_(kRcHold), time_last_bitrate_change_(Timestamp::MinusInfinity()), time_last_bitrate_decrease_(Timestamp::MinusInfinity()), time_first_throughput_estimate_(Timestamp::MinusInfinity()), bitrate_is_initialized_(false), beta_(IsEnabled(*key_value_config, kBweBackOffFactorExperiment) ? ReadBackoffFactor(*key_value_config) : kDefaultBackoffFactor), in_alr_(false), rtt_(kDefaultRtt), send_side_(send_side), in_experiment_(!AdaptiveThresholdExperimentIsDisabled(*key_value_config)), no_bitrate_increase_in_alr_( IsEnabled(*key_value_config, "WebRTC-DontIncreaseDelayBasedBweInAlr")), smoothing_experiment_( IsEnabled(*key_value_config, "WebRTC-Audio-BandwidthSmoothing")), initial_backoff_interval_("initial_backoff_interval"), low_throughput_threshold_("low_throughput", DataRate::Zero()), capacity_deviation_ratio_threshold_("cap_thr", 0.2), cross_traffic_factor_("cross", 1.0), capacity_limit_deviation_factor_("cap_lim", 1) { // E.g // WebRTC-BweAimdRateControlConfig/initial_backoff_interval:100ms, // low_throughput:50kbps/ ParseFieldTrial({&initial_backoff_interval_, &low_throughput_threshold_}, key_value_config->Lookup("WebRTC-BweAimdRateControlConfig")); if (initial_backoff_interval_) { RTC_LOG(LS_INFO) << "Using aimd rate control with initial back-off interval" << " " << ToString(*initial_backoff_interval_) << "."; } RTC_LOG(LS_INFO) << "Using aimd rate control with back off factor " << beta_; ParseFieldTrial( {&capacity_deviation_ratio_threshold_, &cross_traffic_factor_, &capacity_limit_deviation_factor_}, key_value_config->Lookup("WebRTC-Bwe-AimdRateControl-NetworkState")); } AimdRateControl::~AimdRateControl() {} void AimdRateControl::SetStartBitrate(DataRate start_bitrate) { current_bitrate_ = start_bitrate; latest_estimated_throughput_ = current_bitrate_; bitrate_is_initialized_ = true; } void AimdRateControl::SetMinBitrate(DataRate min_bitrate) { min_configured_bitrate_ = min_bitrate; current_bitrate_ = std::max(min_bitrate, current_bitrate_); } bool AimdRateControl::ValidEstimate() const { return bitrate_is_initialized_; } TimeDelta AimdRateControl::GetFeedbackInterval() const { // Estimate how often we can send RTCP if we allocate up to 5% of bandwidth // to feedback. const DataSize kRtcpSize = DataSize::bytes(80); const DataRate rtcp_bitrate = current_bitrate_ * 0.05; const TimeDelta interval = kRtcpSize / rtcp_bitrate; const TimeDelta kMinFeedbackInterval = TimeDelta::ms(200); const TimeDelta kMaxFeedbackInterval = TimeDelta::ms(1000); return interval.Clamped(kMinFeedbackInterval, kMaxFeedbackInterval); } bool AimdRateControl::TimeToReduceFurther(Timestamp at_time, DataRate estimated_throughput) const { const TimeDelta bitrate_reduction_interval = rtt_.Clamped(TimeDelta::ms(10), TimeDelta::ms(200)); if (at_time - time_last_bitrate_change_ >= bitrate_reduction_interval) { return true; } if (ValidEstimate()) { // TODO(terelius/holmer): Investigate consequences of increasing // the threshold to 0.95 * LatestEstimate(). const DataRate threshold = 0.5 * LatestEstimate(); return estimated_throughput < threshold; } return false; } bool AimdRateControl::InitialTimeToReduceFurther(Timestamp at_time) const { if (!initial_backoff_interval_) { return ValidEstimate() && TimeToReduceFurther(at_time, LatestEstimate() / 2 - DataRate::bps(1)); } // TODO(terelius): We could use the RTT (clamped to suitable limits) instead // of a fixed bitrate_reduction_interval. if (time_last_bitrate_decrease_.IsInfinite() || at_time - time_last_bitrate_decrease_ >= *initial_backoff_interval_) { return true; } return false; } DataRate AimdRateControl::LatestEstimate() const { return current_bitrate_; } void AimdRateControl::SetRtt(TimeDelta rtt) { rtt_ = rtt; } DataRate AimdRateControl::Update(const RateControlInput* input, Timestamp at_time) { RTC_CHECK(input); // Set the initial bit rate value to what we're receiving the first half // second. // TODO(bugs.webrtc.org/9379): The comment above doesn't match to the code. if (!bitrate_is_initialized_) { const TimeDelta kInitializationTime = TimeDelta::seconds(5); RTC_DCHECK_LE(kBitrateWindowMs, kInitializationTime.ms()); if (time_first_throughput_estimate_.IsInfinite()) { if (input->estimated_throughput) time_first_throughput_estimate_ = at_time; } else if (at_time - time_first_throughput_estimate_ > kInitializationTime && input->estimated_throughput) { current_bitrate_ = *input->estimated_throughput; bitrate_is_initialized_ = true; } } current_bitrate_ = ChangeBitrate(current_bitrate_, *input, at_time); return current_bitrate_; } void AimdRateControl::SetInApplicationLimitedRegion(bool in_alr) { in_alr_ = in_alr; } void AimdRateControl::SetEstimate(DataRate bitrate, Timestamp at_time) { bitrate_is_initialized_ = true; DataRate prev_bitrate = current_bitrate_; current_bitrate_ = ClampBitrate(bitrate, bitrate); time_last_bitrate_change_ = at_time; if (current_bitrate_ < prev_bitrate) { time_last_bitrate_decrease_ = at_time; } } void AimdRateControl::SetNetworkStateEstimate( const absl::optional<NetworkStateEstimate>& estimate) { network_estimate_ = estimate; } double AimdRateControl::GetNearMaxIncreaseRateBpsPerSecond() const { RTC_DCHECK(!current_bitrate_.IsZero()); const TimeDelta kFrameInterval = TimeDelta::seconds(1) / 30; DataSize frame_size = current_bitrate_ * kFrameInterval; const DataSize kPacketSize = DataSize::bytes(1200); double packets_per_frame = std::ceil(frame_size / kPacketSize); DataSize avg_packet_size = frame_size / packets_per_frame; // Approximate the over-use estimator delay to 100 ms. TimeDelta response_time = rtt_ + TimeDelta::ms(100); if (in_experiment_) response_time = response_time * 2; double increase_rate_bps_per_second = (avg_packet_size / response_time).bps<double>(); double kMinIncreaseRateBpsPerSecond = 4000; return std::max(kMinIncreaseRateBpsPerSecond, increase_rate_bps_per_second); } TimeDelta AimdRateControl::GetExpectedBandwidthPeriod() const { const TimeDelta kMinPeriod = smoothing_experiment_ ? TimeDelta::ms(500) : TimeDelta::seconds(2); const TimeDelta kDefaultPeriod = TimeDelta::seconds(3); const TimeDelta kMaxPeriod = TimeDelta::seconds(50); double increase_rate_bps_per_second = GetNearMaxIncreaseRateBpsPerSecond(); if (!last_decrease_) return smoothing_experiment_ ? kMinPeriod : kDefaultPeriod; double time_to_recover_decrease_seconds = last_decrease_->bps() / increase_rate_bps_per_second; TimeDelta period = TimeDelta::seconds(time_to_recover_decrease_seconds); return period.Clamped(kMinPeriod, kMaxPeriod); } DataRate AimdRateControl::ChangeBitrate(DataRate new_bitrate, const RateControlInput& input, Timestamp at_time) { DataRate estimated_throughput = input.estimated_throughput.value_or(latest_estimated_throughput_); if (input.estimated_throughput) latest_estimated_throughput_ = *input.estimated_throughput; // An over-use should always trigger us to reduce the bitrate, even though // we have not yet established our first estimate. By acting on the over-use, // we will end up with a valid estimate. if (!bitrate_is_initialized_ && input.bw_state != BandwidthUsage::kBwOverusing) return current_bitrate_; ChangeState(input, at_time); switch (rate_control_state_) { case kRcHold: break; case kRcIncrease: if (estimated_throughput > link_capacity_.UpperBound()) link_capacity_.Reset(); // Do not increase the delay based estimate in alr since the estimator // will not be able to get transport feedback necessary to detect if // the new estimate is correct. if (!(send_side_ && in_alr_ && no_bitrate_increase_in_alr_)) { if (link_capacity_.has_estimate()) { // The link_capacity estimate is reset if the measured throughput // is too far from the estimate. We can therefore assume that our // target rate is reasonably close to link capacity and use additive // increase. DataRate additive_increase = AdditiveRateIncrease(at_time, time_last_bitrate_change_); new_bitrate += additive_increase; } else { // If we don't have an estimate of the link capacity, use faster ramp // up to discover the capacity. DataRate multiplicative_increase = MultiplicativeRateIncrease( at_time, time_last_bitrate_change_, new_bitrate); new_bitrate += multiplicative_increase; } } time_last_bitrate_change_ = at_time; break; case kRcDecrease: if (network_estimate_ && capacity_deviation_ratio_threshold_) { // If we have a low variance network estimate, we use it over the // acknowledged rate to avoid dropping the bitrate too far. This avoids // overcompensating when the send rate is lower than the capacity. double deviation_ratio = network_estimate_->link_capacity_std_dev / network_estimate_->link_capacity; if (deviation_ratio < *capacity_deviation_ratio_threshold_) { double available_ratio = std::max(0.0, 1.0 - network_estimate_->cross_traffic_ratio * cross_traffic_factor_); DataRate available_rate = network_estimate_->link_capacity * available_ratio; estimated_throughput = std::max(available_rate, estimated_throughput); } } if (estimated_throughput > low_throughput_threshold_) { // Set bit rate to something slightly lower than the measured throughput // to get rid of any self-induced delay. new_bitrate = estimated_throughput * beta_; if (new_bitrate > current_bitrate_) { // Avoid increasing the rate when over-using. if (link_capacity_.has_estimate()) { new_bitrate = beta_ * link_capacity_.estimate(); } } } else { new_bitrate = estimated_throughput; if (link_capacity_.has_estimate()) { new_bitrate = std::max(new_bitrate, link_capacity_.estimate()); } new_bitrate = std::min(new_bitrate, low_throughput_threshold_.Get()); } new_bitrate = std::min(new_bitrate, current_bitrate_); if (bitrate_is_initialized_ && estimated_throughput < current_bitrate_) { constexpr double kDegradationFactor = 0.9; if (smoothing_experiment_ && new_bitrate < kDegradationFactor * beta_ * current_bitrate_) { // If bitrate decreases more than a normal back off after overuse, it // indicates a real network degradation. We do not let such a decrease // to determine the bandwidth estimation period. last_decrease_ = absl::nullopt; } else { last_decrease_ = current_bitrate_ - new_bitrate; } } if (estimated_throughput < link_capacity_.LowerBound()) { // The current throughput is far from the estimated link capacity. Clear // the estimate to allow an immediate update in OnOveruseDetected. link_capacity_.Reset(); } bitrate_is_initialized_ = true; link_capacity_.OnOveruseDetected(estimated_throughput); // Stay on hold until the pipes are cleared. rate_control_state_ = kRcHold; time_last_bitrate_change_ = at_time; time_last_bitrate_decrease_ = at_time; break; default: assert(false); } return ClampBitrate(new_bitrate, estimated_throughput); } DataRate AimdRateControl::ClampBitrate(DataRate new_bitrate, DataRate estimated_throughput) const { // Allow the estimate to increase as long as alr is not detected to ensure // that there is no BWE values that can make the estimate stuck at a too // low bitrate. If an encoder can not produce the bitrate necessary to // fully use the capacity, alr will sooner or later trigger. if (!(send_side_ && no_bitrate_increase_in_alr_)) { // Don't change the bit rate if the send side is too far off. // We allow a bit more lag at very low rates to not too easily get stuck if // the encoder produces uneven outputs. const DataRate max_bitrate = 1.5 * estimated_throughput + DataRate::kbps(10); if (new_bitrate > current_bitrate_ && new_bitrate > max_bitrate) { new_bitrate = std::max(current_bitrate_, max_bitrate); } } if (network_estimate_ && capacity_limit_deviation_factor_) { DataRate upper_bound = network_estimate_->link_capacity + network_estimate_->link_capacity_std_dev * capacity_limit_deviation_factor_.Value(); new_bitrate = std::min(new_bitrate, upper_bound); } new_bitrate = std::max(new_bitrate, min_configured_bitrate_); return new_bitrate; } DataRate AimdRateControl::MultiplicativeRateIncrease( Timestamp at_time, Timestamp last_time, DataRate current_bitrate) const { double alpha = 1.08; if (last_time.IsFinite()) { auto time_since_last_update = at_time - last_time; alpha = pow(alpha, std::min(time_since_last_update.seconds<double>(), 1.0)); } DataRate multiplicative_increase = std::max(current_bitrate * (alpha - 1.0), DataRate::bps(1000)); return multiplicative_increase; } DataRate AimdRateControl::AdditiveRateIncrease(Timestamp at_time, Timestamp last_time) const { double time_period_seconds = (at_time - last_time).seconds<double>(); double data_rate_increase_bps = GetNearMaxIncreaseRateBpsPerSecond() * time_period_seconds; return DataRate::bps(data_rate_increase_bps); } void AimdRateControl::ChangeState(const RateControlInput& input, Timestamp at_time) { switch (input.bw_state) { case BandwidthUsage::kBwNormal: if (rate_control_state_ == kRcHold) { time_last_bitrate_change_ = at_time; rate_control_state_ = kRcIncrease; } break; case BandwidthUsage::kBwOverusing: if (rate_control_state_ != kRcDecrease) { rate_control_state_ = kRcDecrease; } break; case BandwidthUsage::kBwUnderusing: rate_control_state_ = kRcHold; break; default: assert(false); } } } // namespace webrtc
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r13 push %r15 push %r8 push %rbx push %rcx push %rdi push %rdx push %rsi lea addresses_normal_ht+0x17da9, %r15 cmp %rdx, %rdx mov $0x6162636465666768, %r13 movq %r13, (%r15) nop nop nop nop nop xor $27293, %r10 lea addresses_WC_ht+0x21a9, %r8 nop nop nop nop add %rbx, %rbx mov $0x6162636465666768, %rcx movq %rcx, %xmm5 and $0xffffffffffffffc0, %r8 movaps %xmm5, (%r8) nop nop nop nop xor $33343, %rcx lea addresses_normal_ht+0x18e5, %rdx add %r8, %r8 movb (%rdx), %bl add %rcx, %rcx lea addresses_WT_ht+0x41a9, %r10 nop nop nop xor %rdx, %rdx movups (%r10), %xmm0 vpextrq $0, %xmm0, %r15 nop nop nop and $9110, %rdx lea addresses_D_ht+0x6f91, %r13 nop nop nop nop nop mfence vmovups (%r13), %ymm5 vextracti128 $0, %ymm5, %xmm5 vpextrq $1, %xmm5, %rdx nop nop nop nop nop add $12886, %rbx lea addresses_A_ht+0x8749, %rdx nop nop nop nop sub %r8, %r8 mov $0x6162636465666768, %r15 movq %r15, %xmm0 movups %xmm0, (%rdx) nop nop nop nop and %r10, %r10 lea addresses_normal_ht+0xb189, %r15 nop xor $44927, %rbx vmovups (%r15), %ymm5 vextracti128 $0, %ymm5, %xmm5 vpextrq $1, %xmm5, %r8 nop nop nop cmp $16899, %rbx lea addresses_WC_ht+0xfaa9, %rsi lea addresses_D_ht+0x4fa9, %rdi nop nop and %r15, %r15 mov $123, %rcx rep movsb nop nop nop nop nop add %rcx, %rcx lea addresses_A_ht+0x7aa9, %rsi nop nop nop dec %r15 mov (%rsi), %r13 nop nop nop nop nop and $9865, %rcx lea addresses_normal_ht+0x1efa9, %rdi nop nop nop nop xor $14440, %rdx mov (%rdi), %r8w nop inc %r10 lea addresses_A_ht+0x1ce1, %r13 nop nop nop nop nop and %r8, %r8 mov $0x6162636465666768, %rbx movq %rbx, %xmm5 movups %xmm5, (%r13) nop nop nop nop sub %r15, %r15 pop %rsi pop %rdx pop %rdi pop %rcx pop %rbx pop %r8 pop %r15 pop %r13 pop %r10 ret .global s_faulty_load s_faulty_load: push %rax push %rbp push %rbx push %rdi push %rdx push %rsi // Faulty Load lea addresses_WT+0x1f5a9, %rbx clflush (%rbx) nop nop nop nop nop sub $18096, %rdi mov (%rbx), %dx lea oracles, %rdi and $0xff, %rdx shlq $12, %rdx mov (%rdi,%rdx,1), %rdx pop %rsi pop %rdx pop %rdi pop %rbx pop %rbp pop %rax ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_WT', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_WT', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 11, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'size': 16, 'AVXalign': True, 'NT': False, 'congruent': 10, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 2, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 7, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 2, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 5, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 5, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 6, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 6, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 4, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': False}} {'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 */
Route22GateObject: db $a ; border block db $5 ; warps db $7, $4, $0, $ff db $7, $5, $0, $ff db $0, $4, $0, $ff db $0, $5, $0, $ff db $3, $0, $1, MT_SILVER db $0 ; signs db $1 ; objects object SPRITE_GUARD, $6, $2, STAY, LEFT, $1 ; person ; warp-to EVENT_DISP ROUTE_22_GATE_WIDTH, $7, $4 EVENT_DISP ROUTE_22_GATE_WIDTH, $7, $5 EVENT_DISP ROUTE_22_GATE_WIDTH, $0, $4 EVENT_DISP ROUTE_22_GATE_WIDTH, $0, $5 EVENT_DISP ROUTE_22_GATE_WIDTH, $3, $0 ; MT_SILVER
; long __ladd (long left, long right) SECTION code_clib SECTION code_fp_am9511 PUBLIC cam32_sdcc_ladd EXTERN cam32_sdcc_readr, asm_am9511_ladd .cam32_sdcc_ladd ; add two sdcc longs ; ; enter : stack = sdcc_long right, sdcc_long left, ret ; ; exit : DEHL = sdcc_long(left+right) ; ; uses : af, bc, de, hl, af', bc', de', hl' call cam32_sdcc_readr jp asm_am9511_ladd ; enter stack = sdcc_long right, sdcc_long left, ret ; DEHL = sdcc_long right ; return DEHL = sdcc_long
; A198971: a(n) = 5*10^n-1. ; 4,49,499,4999,49999,499999,4999999,49999999,499999999,4999999999,49999999999,499999999999,4999999999999,49999999999999,499999999999999,4999999999999999,49999999999999999,499999999999999999,4999999999999999999,49999999999999999999,499999999999999999999,4999999999999999999999,49999999999999999999999,499999999999999999999999,4999999999999999999999999,49999999999999999999999999,499999999999999999999999999,4999999999999999999999999999,49999999999999999999999999999,499999999999999999999999999999,4999999999999999999999999999999,49999999999999999999999999999999,499999999999999999999999999999999,4999999999999999999999999999999999,49999999999999999999999999999999999,499999999999999999999999999999999999 mov $1,10 pow $1,$0 mul $1,5 sub $1,1 mov $0,$1
bits 64 default rel %include "cabna/sys/conv.nasm" global notify_receiver global supply_retval extern sched_task section .text proc notify_receiver: ; Notify the currently executing task's waiting receiver task that one of its ; tasks finished. If the receiver task gets its final notice, schedule the ; task for execution. Return to ret_rsi. ; Used registers: rsi, rdi, and those of sched_task. ; No other threads will access our currently executing task struc, so we can ; access it without concurrency concern. mov arg1_rdi, [cet_r14 + task.rcvr] ; Other threads will access the .need field, so we must atomically decrement ; it. lock sub dword [arg1_rdi + task.need], 1 ; 32-bit alright. ; Supplied the final needed argument to rcvr, so schedule rcvr for execution. jz sched_task ; arg1_rdi and ret_rsi are already set. ; Receiver needs more. jmp_ind ret_rsi proc supply_retval: ; Return a value to the currently executing task's waiting receiver task, ; argument in arg1_rdi. If the receiver task gets its final value, schedule ; the task for execution. Return to ret_rsi. ; Used registers: rax, rdx, rsi, rdi, and those of sched_task. ; No other threads will access our currently executing task struc, so we can ; access it without concurrency concern. mov rax, [cet_r14 + task.rcvr] mov edx, [cet_r14 + task.ridx] ; 32-bit alright. ; No other threads will access this field in rcvr, so we can access it without ; concurrency concern. mov [rax + task.args + 8 * rdx], arg1_rdi ; Other threads will access the .need field, so we must atomically decrement ; it. lock sub dword [rax + task.need], 1 ; 32-bit alright. cmovz arg1_rdi, rax ; For sched_task. ; Supplied the final needed argument to rcvr, so schedule rcvr for execution. jz sched_task ; ret_rsi already set. ; Receiver needs more. jmp_ind ret_rsi
; A173148: a(n) = cos(2*n*arccos(sqrt(n))). ; Submitted by Jon Maiga ; 1,1,17,485,18817,930249,55989361,3974443213,325142092801,30122754096401,3117419602578001,356452534779818421,44627167107085622401,6071840759403431812825,892064955046043465408177,140751338790698080509966749,23737154316161495960243527681,4261096989893599697435331978273,811220409432847949542070174498449,163254590106980535972927706792168837,34628529131515108675246203336961584001,7721545569399409696686985589628780849641,1805692630429843748504981102012125248308977 mov $3,$0 sub $3,1 mul $3,4 mov $4,1 lpb $0 sub $0,1 add $1,1 add $2,$3 mul $2,$1 add $4,$2 add $1,$4 mov $2,0 lpe mov $0,$4 add $0,1 div $0,2
#include <deque> template <class T, class Sequence = std::deque<T> > class stack { friend bool operator== (const stack&, const stack&); friend bool operator< (const stack&, const stack&); public: typedef typename Sequence::value_type value_type; typedef typename Sequence::size_type size_type; typedef Sequence container_type; typedef typename Sequence::reference reference; typedef typename Sequence::const_reference const_reference; protected: Sequence seq; public: stack() : seq() {} explicit stack(const Sequence& s0) : seq(s0) {} bool empty() const { return seq.empty(); } size_type size() const { return seq.size(); } reference top() { return seq.back(); } const_reference top() const { return seq.back(); } void push(const value_type& x) { seq.push_back(x); } void pop() { seq.pop_back(); } }; template <class T, class Sequence> bool operator==(const stack<T,Sequence>& x, const stack<T,Sequence>& y) { return x.seq == y.seq; } template <class T, class Sequence> bool operator<(const stack<T,Sequence>& x, const stack<T,Sequence>& y) { return x.seq < y.seq; } template <class T, class Sequence> bool operator!=(const stack<T,Sequence>& x, const stack<T,Sequence>& y) { return !(x == y); } template <class T, class Sequence> bool operator>(const stack<T,Sequence>& x, const stack<T,Sequence>& y) { return y < x; } template <class T, class Sequence> bool operator<=(const stack<T,Sequence>& x, const stack<T,Sequence>& y) { return !(y < x); } template <class T, class Sequence> bool operator>=(const stack<T,Sequence>& x, const stack<T,Sequence>& y) { return !(x < y); }
#pragma once #include <iostream> #include <string> #include "IncludeDeps.hpp" #include "Core/Mesh.hpp" #include "Core/Textures/Texture.hpp" #include "Core/Vulkan/Material.hpp" #include "Core/GameObject.hpp" namespace LWGC { class ModelLoader { private: public: ModelLoader(void) = delete; ModelLoader(const ModelLoader&) = delete; ~ModelLoader(void) = delete; ModelLoader & operator=(ModelLoader const & src) = delete; static GameObject * Load(const std::string & path, bool optimize = false) noexcept; }; }
[bits 64] [org 0x140059080] cmp eax, 0xdeadc0de jne not_eq mov r13, 0x140059100 mov r12, 0x1F jmp 0x14000B4EF not_eq: mov rax, r12 shl rax, 5 jmp 0x14000B4DB
#include <stdio.h> #include <stdlib.h> #include "bignum.h" /** * Test populating, searching, and removing integers from a Vector. * * @param Argument count * @param Argument list * @return Error level */ int main(int argc, char* argv[]) { char buffer[1000]; Bignum n(0); n.str(buffer, 1000); printf("%u: %s\n", n.length(), buffer); n.add(10); n.str(buffer, 1000); printf("n.add(10): %u, %s\n", n.length(), buffer); n.add(1000); n.str(buffer, 1000); printf("n.add(1000): %u, %s\n", n.length(), buffer); n = Bignum(9999); n.str(buffer, 1000); printf("n = Bignum(9999): %u, %s\n", n.length(), buffer); n.add(1); n.str(buffer, 1000); printf("n.add(1): %u, %s\n", n.length(), buffer); n = 3; n.str(buffer, 1000); printf("n = 3: %u, %s\n", n.length(), buffer); n = n + 1; n.str(buffer, 1000); printf("n = n + 1: %u, %s\n", n.length(), buffer); n += 1; n.str(buffer, 1000); printf("n += 1: %u, %s\n", n.length(), buffer); Bignum m(100); n.add(m); n.str(buffer, 1000); printf("n.add(m=100): %u, %s\n", n.length(), buffer); n = n + m; n.str(buffer, 1000); printf("n = n + m: %u, %s\n", n.length(), buffer); n += m; n.str(buffer, 1000); printf("n += m: %u, %s\n", n.length(), buffer); n.mul(2); n.str(buffer, 1000); printf("n.mul(2): %u, %s\n", n.length(), buffer); n = n * 3; n.str(buffer, 1000); printf("n = n * 3: %u, %s\n", n.length(), buffer); n *= 3; n.str(buffer, 1000); printf("n *= 3: %u, %s\n", n.length(), buffer); }
; A047612: Numbers that are congruent to {0, 2, 4, 5} mod 8. ; 0,2,4,5,8,10,12,13,16,18,20,21,24,26,28,29,32,34,36,37,40,42,44,45,48,50,52,53,56,58,60,61,64,66,68,69,72,74,76,77,80,82,84,85,88,90,92,93,96,98,100,101,104,106,108,109,112,114,116,117,120,122,124,125,128,130,132,133,136,138,140,141,144,146,148,149,152,154,156,157,160,162,164,165,168,170,172,173,176,178,180,181,184,186,188,189,192,194,196,197,200,202,204,205,208,210,212,213,216,218,220,221,224,226,228,229,232,234,236,237,240,242,244,245,248,250,252,253,256,258,260,261,264,266,268,269,272,274,276,277,280,282,284,285,288,290,292,293,296,298,300,301,304,306,308,309,312,314,316,317,320,322,324,325,328,330,332,333,336,338,340,341,344,346,348,349,352,354,356,357,360,362,364,365,368,370,372,373,376,378,380,381,384,386,388,389,392,394,396,397,400,402,404,405,408,410,412,413,416,418,420,421,424,426,428,429,432,434,436,437,440,442,444,445,448,450,452,453,456,458,460,461,464,466,468,469,472,474,476,477,480,482,484,485,488,490,492,493,496,498 mov $1,$0 add $1,$0 bin $0,3 gcd $0,2 add $1,$0 sub $1,2
#include "Platform.inc" #include "FarCalls.inc" #include "Arithmetic32.inc" #include "SunriseSunset.inc" #include "States.inc" radix decimal defineSunriseSunsetState SUN_STATE_INTERPOLATE_LONGITUDE loadLongitudeOffsetMultipliedByFourIntoDividend: bcf STATUS, C .setBankFor longitudeOffset rlf longitudeOffset, W .setBankFor RAD movwf RAD btfss STATUS, C goto positiveLongitudeOffset negativeLongitudeOffsetIntoPositive: comf RAD incf RAD bcf STATUS, C positiveLongitudeOffset: rlf RAD clrf RAA clrf RAB clrf RAC loadTenIntoDivisor: clrf RBC movlw 10 movwf RBD divideAndStoreQuotientAndRemainder: fcall div32x16 call storeLookupIndexFromA setSunriseSunsetState SUN_STATE_INTERPOLATE_LONGITUDE2 returnFromSunriseSunsetState defineSunriseSunsetStateInSameSection SUN_STATE_INTERPOLATE_LONGITUDE2 roundUpIfRemainderIsAtLeastFive: .setBankFor lookupIndexRemainderLow movf lookupIndexRemainderLow, W sublw 4 movf lookupIndexLow, W btfss STATUS, C incf lookupIndexLow, W loadOffsetNumberOfMinutesIntoB: .setBankFor RBA clrf RBA clrf RBB clrf RBC movwf RBD loadNonOffsetNumberOfMinutesIntoA: call loadAccumulatorIntoA .setBankFor longitudeOffset offsetMinutesAreNegativeIfLongitudeOffsetIsPositive: btfsc longitudeOffset, 7 goto adjustNumberOfMinutesInAccumulatorForLongitudeOffset fcall negateB32 adjustNumberOfMinutesInAccumulatorForLongitudeOffset: fcall add32 call storeAccumulatorFromA setSunriseSunsetState SUN_STATE_ACCUMULATORTOHOURS returnFromSunriseSunsetState end
;; ;; Copyright (c) 2012-2021, Intel Corporation ;; ;; Redistribution and use in source and binary forms, with or without ;; modification, are permitted provided that the following conditions are met: ;; ;; * Redistributions of source code must retain the above copyright notice, ;; this list of conditions and the following disclaimer. ;; * 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. ;; * Neither the name of Intel Corporation nor the names of its contributors ;; may be used to endorse or promote products derived from this software ;; without specific prior written permission. ;; ;; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" ;; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ;; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ;; DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE ;; FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL ;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR ;; SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER ;; CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, ;; OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ;; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ;; %define FUNC flush_job_hmac_sha_224_sse %define SHA224 %include "sse/mb_mgr_hmac_sha256_flush_sse.asm"
#pragma once #include "RegexElements.hpp" #include <string> #include <string_view> namespace RegPanzer { struct ParseError { size_t pos= 0; std::string message; }; using ParseErrors= std::vector<ParseError>; using ParseResult= std::variant<RegexElementsChain, ParseErrors>; // Parse regex in UTF-8 format. ParseResult ParseRegexString(std::string_view str); } // namespace RegPanzer
; A118830: 2-adic continued fraction of zero, where a(n) = -1 if n is odd, 2*A006519(n/2) otherwise. ; -1,2,-1,4,-1,2,-1,8,-1,2,-1,4,-1,2,-1,16,-1,2,-1,4,-1,2,-1,8,-1,2,-1,4,-1,2,-1,32,-1,2,-1,4,-1,2,-1,8,-1,2,-1,4,-1,2,-1,16,-1,2,-1,4,-1,2,-1,8,-1,2,-1,4,-1,2,-1,64,-1,2,-1,4,-1,2,-1,8,-1,2,-1,4,-1,2,-1,16,-1,2,-1,4,-1,2,-1,8,-1,2,-1,4,-1,2,-1,32,-1,2,-1,4 seq $0,118827 ; 2-adic continued fraction of zero, where a(n) = 1 if n is odd, otherwise -2*A006519(n/2). sub $1,$0 mov $0,$1
/*========================================================================= * * Copyright Insight Software Consortium * * 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.txt * * 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 "itkEuclideanDistancePointSetToPointSetMetricv4.h" #include "itkTranslationTransform.h" #include "itkGaussianSmoothingOnUpdateDisplacementFieldTransform.h" #include "itkTestingMacros.h" #include <fstream> #include "itkMath.h" /* * Test with a displacement field transform */ template<unsigned int Dimension> int itkEuclideanDistancePointSetMetricTest2Run() { typedef itk::PointSet<unsigned char, Dimension> PointSetType; typedef typename PointSetType::PointType PointType; typename PointSetType::Pointer fixedPoints = PointSetType::New(); fixedPoints->Initialize(); typename PointSetType::Pointer movingPoints = PointSetType::New(); movingPoints->Initialize(); // Create a few points and apply a small offset to make the moving points float pointMax = static_cast<float>(100.0); PointType fixedPoint; fixedPoint.Fill( 0.0 ); fixedPoint[0] = 0.0; fixedPoint[1] = 0.0; fixedPoints->SetPoint( 0, fixedPoint ); fixedPoint[0] = pointMax; fixedPoint[1] = 0.0; fixedPoints->SetPoint( 1, fixedPoint ); fixedPoint[0] = pointMax; fixedPoint[1] = pointMax; fixedPoints->SetPoint( 2, fixedPoint ); fixedPoint[0] = 0.0; fixedPoint[1] = pointMax; fixedPoints->SetPoint( 3, fixedPoint ); fixedPoint[0] = pointMax / 2.0; fixedPoint[1] = pointMax / 2.0; fixedPoints->SetPoint( 4, fixedPoint ); if( Dimension == 3 ) { fixedPoint[0] = pointMax / 2.0; fixedPoint[1] = pointMax / 2.0; fixedPoint[2] = pointMax / 2.0; fixedPoints->SetPoint( 5, fixedPoint ); fixedPoint[0] = 0.0; fixedPoint[1] = 0.0; fixedPoint[2] = pointMax / 2.0; fixedPoints->SetPoint( 6, fixedPoint ); } unsigned int numberOfPoints = fixedPoints->GetNumberOfPoints(); PointType movingPoint; for( unsigned int n=0; n < numberOfPoints; n ++ ) { fixedPoint = fixedPoints->GetPoint( n ); movingPoint[0] = fixedPoint[0] + (n + 1) * 0.5; movingPoint[1] = fixedPoint[1] - (n + 2) * 0.5; if( Dimension == 3 ) { movingPoint[2] = fixedPoint[2] + (n + 3 ) * 0.5; } movingPoints->SetPoint( n, movingPoint ); //std::cout << fixedPoint << " -> " << movingPoint << std::endl; } // Test with displacement field transform std::cout << "Testing with displacement field transform." << std::endl; //typedef itk::GaussianSmoothingOnUpdateDisplacementFieldTransform<double, Dimension> DisplacementFieldTransformType; typedef itk::DisplacementFieldTransform<double, Dimension> DisplacementFieldTransformType; typename DisplacementFieldTransformType::Pointer displacementTransform = DisplacementFieldTransformType::New(); // Setup the physical space to match the point set virtual domain, // which is defined by the fixed point set since the fixed transform // is identity. typedef typename DisplacementFieldTransformType::DisplacementFieldType FieldType; typedef typename FieldType::RegionType RegionType; typename FieldType::SpacingType spacing; spacing.Fill( 1.0 ); typename FieldType::DirectionType direction; direction.Fill( 0.0 ); for( unsigned int d = 0; d < Dimension; d++ ) { direction[d][d] = 1.0; } typename FieldType::PointType origin; origin.Fill( 0.0 ); typename RegionType::SizeType regionSize; regionSize.Fill( static_cast<itk::SizeValueType>(pointMax + 1.0) ); typename RegionType::IndexType regionIndex; regionIndex.Fill( 0 ); RegionType region; region.SetSize( regionSize ); region.SetIndex( regionIndex ); typename FieldType::Pointer displacementField = FieldType::New(); displacementField->SetOrigin( origin ); displacementField->SetDirection( direction ); displacementField->SetSpacing( spacing ); displacementField->SetRegions( region ); displacementField->Allocate(); typename DisplacementFieldTransformType::OutputVectorType zeroVector; zeroVector.Fill( 0 ); displacementField->FillBuffer( zeroVector ); displacementTransform->SetDisplacementField( displacementField ); // Instantiate the metric typedef itk::EuclideanDistancePointSetToPointSetMetricv4<PointSetType> PointSetMetricType; typename PointSetMetricType::Pointer metric = PointSetMetricType::New(); metric->SetFixedPointSet( fixedPoints ); metric->SetMovingPointSet( movingPoints ); metric->SetMovingTransform( displacementTransform ); // If we don't set this explicitly, it will still work because it will be taken from the // displacement field during initialization. metric->SetVirtualDomain( spacing, origin, direction, region ); metric->Initialize(); // test typename PointSetMetricType::MeasureType value = metric->GetValue(), value2; typename PointSetMetricType::DerivativeType derivative, derivative2; metric->GetDerivative( derivative ); metric->GetValueAndDerivative( value2, derivative2 ); std::cout << "value: " << value << std::endl; // Check for the same results from different methods if( itk::Math::NotExactlyEquals(value, value2) ) { std::cerr << "value does not match between calls to different methods: " << "value: " << value << " value2: " << value2 << std::endl; } if( derivative != derivative2 ) { std::cerr << "derivative does not match between calls to different methods: " << "derivative: " << derivative << " derivative2: " << derivative2 << std::endl; } displacementTransform->UpdateTransformParameters( derivative2 ); // check the results bool passed = true; for( itk::SizeValueType n=0; n < fixedPoints->GetNumberOfPoints(); n++ ) { PointType transformedPoint; fixedPoint = fixedPoints->GetPoint( n ); movingPoint = movingPoints->GetPoint(n); transformedPoint = displacementTransform->TransformPoint( fixedPoint ); for( unsigned int d = 0; d < Dimension; d++ ) { if( itk::Math::NotExactlyEquals(transformedPoint[d], movingPoint[d]) ) { passed = false; } } std::cout << " fixed, moving, txf'ed, moving-txf: " << fixedPoint << " " << movingPoint << " " << transformedPoint << " " << movingPoint - transformedPoint << std::endl; } if( ! passed ) { std::cerr << "Not all points match after transformation with result." << std::endl; return EXIT_FAILURE; } // Test the valid points are counted correctly. // We should get a warning printed. fixedPoint[0] = 0.0; fixedPoint[1] = 2 * pointMax; unsigned int numberExpected = fixedPoints->GetNumberOfPoints() - 1; fixedPoints->SetPoint( fixedPoints->GetNumberOfPoints() - 1, fixedPoint ); metric->GetValueAndDerivative( value2, derivative2 ); if( metric->GetNumberOfValidPoints() != numberExpected ) { std::cerr << "Expected " << numberExpected << " valid points, but got " << metric->GetNumberOfValidPoints() << std::endl; return EXIT_FAILURE; } // Test with no valid points. typename PointSetType::Pointer fixedPoints2 = PointSetType::New(); fixedPoints2->Initialize(); fixedPoint[0] = -pointMax; fixedPoint[1] = 0.0; fixedPoints2->SetPoint( 0, fixedPoint ); metric->SetFixedPointSet( fixedPoints2 ); metric->Initialize(); metric->GetValueAndDerivative( value2, derivative2 ); bool derivative2IsZero = true; for( itk::SizeValueType n=0; n < metric->GetNumberOfParameters(); n++ ) { if( itk::Math::NotExactlyEquals(derivative2[n], itk::NumericTraits<typename PointSetMetricType::DerivativeValueType>::ZeroValue()) ) { derivative2IsZero = false; } } if( itk::Math::NotExactlyEquals(value2, itk::NumericTraits<typename PointSetMetricType::MeasureType>::max()) || ! derivative2IsZero ) { std::cerr << "Failed testing with no valid points. Number of valid points: " << metric->GetNumberOfValidPoints() << " value2: " << value2 << " derivative2IsZero: " << derivative2IsZero << std::endl; return EXIT_FAILURE; } // Test with invalid virtual domain, i.e. // one that doesn't match the displacement field. typename RegionType::SizeType badSize; badSize.Fill( static_cast<itk::SizeValueType>(pointMax / 2.0) ); RegionType badRegion; badRegion.SetSize( badSize ); badRegion.SetIndex( regionIndex ); metric->SetVirtualDomain( spacing, origin, direction, badRegion ); TRY_EXPECT_EXCEPTION( metric->Initialize() ); typename FieldType::SpacingType badSpacing; badSpacing.Fill( 0.5 ); metric->SetVirtualDomain( badSpacing, origin, direction, region ); TRY_EXPECT_EXCEPTION( metric->Initialize() ); return EXIT_SUCCESS; } int itkEuclideanDistancePointSetMetricTest2( int, char* [] ) { int result = EXIT_SUCCESS; if( itkEuclideanDistancePointSetMetricTest2Run<2>() == EXIT_FAILURE ) { std::cerr << "Failed for Dimension 2." << std::endl; result = EXIT_FAILURE; } if( itkEuclideanDistancePointSetMetricTest2Run<3>() == EXIT_FAILURE ) { std::cerr << "Failed for Dimension 3." << std::endl; result = EXIT_FAILURE; } return result; }
SECTION code_clib SECTION code_fp_math48 PUBLIC _fdim_callee EXTERN cm48_sdccix_fdim_callee defc _fdim_callee = cm48_sdccix_fdim_callee
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Copyright(c) 2011-2015 Intel Corporation All rights reserved. ; ; Redistribution and use in source and binary forms, with or without ; modification, are permitted provided that the following conditions ; are met: ; * Redistributions of source code must retain the above copyright ; notice, this list of conditions and the following disclaimer. ; * 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. ; * Neither the name of Intel Corporation nor the names of its ; contributors may be used to endorse or promote products derived ; from this software without specific prior written permission. ; ; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ; "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ; LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR ; A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT ; OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ; SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ; LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ; DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ; THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; ;;; gf_5vect_dot_prod_sse(len, vec, *g_tbls, **buffs, **dests); ;;; %include "reg_sizes.asm" %ifidn __OUTPUT_FORMAT__, elf64 %define arg0 rdi %define arg1 rsi %define arg2 rdx %define arg3 rcx %define arg4 r8 %define arg5 r9 %define tmp r11 %define tmp2 r10 %define tmp3 r13 ; must be saved and restored %define tmp4 r12 ; must be saved and restored %define tmp5 r14 ; must be saved and restored %define tmp6 r15 ; must be saved and restored %define return rax %define PS 8 %define LOG_PS 3 %define func(x) x: %macro FUNC_SAVE 0 push r12 push r13 push r14 push r15 %endmacro %macro FUNC_RESTORE 0 pop r15 pop r14 pop r13 pop r12 %endmacro %endif %ifidn __OUTPUT_FORMAT__, win64 %define arg0 rcx %define arg1 rdx %define arg2 r8 %define arg3 r9 %define arg4 r12 ; must be saved, loaded and restored %define arg5 r15 ; must be saved and restored %define tmp r11 %define tmp2 r10 %define tmp3 r13 ; must be saved and restored %define tmp4 r14 ; must be saved and restored %define tmp5 rdi ; must be saved and restored %define tmp6 rsi ; must be saved and restored %define return rax %define PS 8 %define LOG_PS 3 %define stack_size 10*16 + 7*8 ; must be an odd multiple of 8 %define arg(x) [rsp + stack_size + PS + PS*x] %define func(x) proc_frame x %macro FUNC_SAVE 0 alloc_stack stack_size save_xmm128 xmm6, 0*16 save_xmm128 xmm7, 1*16 save_xmm128 xmm8, 2*16 save_xmm128 xmm9, 3*16 save_xmm128 xmm10, 4*16 save_xmm128 xmm11, 5*16 save_xmm128 xmm12, 6*16 save_xmm128 xmm13, 7*16 save_xmm128 xmm14, 8*16 save_xmm128 xmm15, 9*16 save_reg r12, 10*16 + 0*8 save_reg r13, 10*16 + 1*8 save_reg r14, 10*16 + 2*8 save_reg r15, 10*16 + 3*8 save_reg rdi, 10*16 + 4*8 save_reg rsi, 10*16 + 5*8 end_prolog mov arg4, arg(4) %endmacro %macro FUNC_RESTORE 0 movdqa xmm6, [rsp + 0*16] movdqa xmm7, [rsp + 1*16] movdqa xmm8, [rsp + 2*16] movdqa xmm9, [rsp + 3*16] movdqa xmm10, [rsp + 4*16] movdqa xmm11, [rsp + 5*16] movdqa xmm12, [rsp + 6*16] movdqa xmm13, [rsp + 7*16] movdqa xmm14, [rsp + 8*16] movdqa xmm15, [rsp + 9*16] mov r12, [rsp + 10*16 + 0*8] mov r13, [rsp + 10*16 + 1*8] mov r14, [rsp + 10*16 + 2*8] mov r15, [rsp + 10*16 + 3*8] mov rdi, [rsp + 10*16 + 4*8] mov rsi, [rsp + 10*16 + 5*8] add rsp, stack_size %endmacro %endif %define len arg0 %define vec arg1 %define mul_array arg2 %define src arg3 %define dest arg4 %define ptr arg5 %define vec_i tmp2 %define dest1 tmp3 %define dest2 tmp4 %define vskip1 tmp5 %define vskip3 tmp6 %define pos return %ifndef EC_ALIGNED_ADDR ;;; Use Un-aligned load/store %define XLDR movdqu %define XSTR movdqu %else ;;; Use Non-temporal load/stor %ifdef NO_NT_LDST %define XLDR movdqa %define XSTR movdqa %else %define XLDR movntdqa %define XSTR movntdq %endif %endif default rel [bits 64] section .text %define xmask0f xmm15 %define xgft1_lo xmm2 %define xgft1_hi xmm3 %define xgft2_lo xmm4 %define xgft2_hi xmm5 %define xgft3_lo xmm10 %define xgft3_hi xmm6 %define xgft4_lo xmm8 %define xgft4_hi xmm7 %define x0 xmm0 %define xtmpa xmm1 %define xp1 xmm9 %define xp2 xmm11 %define xp3 xmm12 %define xp4 xmm13 %define xp5 xmm14 align 16 global gf_5vect_dot_prod_sse:ISAL_SYM_TYPE_FUNCTION func(gf_5vect_dot_prod_sse) FUNC_SAVE sub len, 16 jl .return_fail xor pos, pos movdqa xmask0f, [mask0f] ;Load mask of lower nibble in each byte mov vskip1, vec imul vskip1, 32 mov vskip3, vec imul vskip3, 96 sal vec, LOG_PS ;vec *= PS. Make vec_i count by PS mov dest1, [dest] mov dest2, [dest+PS] .loop16: mov tmp, mul_array xor vec_i, vec_i pxor xp1, xp1 pxor xp2, xp2 pxor xp3, xp3 pxor xp4, xp4 pxor xp5, xp5 .next_vect: mov ptr, [src+vec_i] add vec_i, PS XLDR x0, [ptr+pos] ;Get next source vector movdqu xgft1_lo, [tmp] ;Load array Ax{00}, Ax{01}, ..., Ax{0f} movdqu xgft1_hi, [tmp+16] ; " Ax{00}, Ax{10}, ..., Ax{f0} movdqu xgft2_lo, [tmp+vskip1*1] ;Load array Bx{00}, Bx{01}, ..., Bx{0f} movdqu xgft2_hi, [tmp+vskip1*1+16] ; " Bx{00}, Bx{10}, ..., Bx{f0} movdqu xgft3_lo, [tmp+vskip1*2] ;Load array Cx{00}, Cx{01}, ..., Cx{0f} movdqu xgft3_hi, [tmp+vskip1*2+16] ; " Cx{00}, Cx{10}, ..., Cx{f0} movdqu xgft4_lo, [tmp+vskip3] ;Load array Dx{00}, Dx{01}, ..., Dx{0f} movdqu xgft4_hi, [tmp+vskip3+16] ; " Dx{00}, Dx{10}, ..., Dx{f0} movdqa xtmpa, x0 ;Keep unshifted copy of src psraw x0, 4 ;Shift to put high nibble into bits 4-0 pand x0, xmask0f ;Mask high src nibble in bits 4-0 pand xtmpa, xmask0f ;Mask low src nibble in bits 4-0 pshufb xgft1_hi, x0 ;Lookup mul table of high nibble pshufb xgft1_lo, xtmpa ;Lookup mul table of low nibble pxor xgft1_hi, xgft1_lo ;GF add high and low partials pxor xp1, xgft1_hi ;xp1 += partial pshufb xgft2_hi, x0 ;Lookup mul table of high nibble pshufb xgft2_lo, xtmpa ;Lookup mul table of low nibble pxor xgft2_hi, xgft2_lo ;GF add high and low partials pxor xp2, xgft2_hi ;xp2 += partial movdqu xgft1_lo, [tmp+vskip1*4] ;Load array Ex{00}, Ex{01}, ..., Ex{0f} movdqu xgft1_hi, [tmp+vskip1*4+16] ; " Ex{00}, Ex{10}, ..., Ex{f0} add tmp, 32 pshufb xgft3_hi, x0 ;Lookup mul table of high nibble pshufb xgft3_lo, xtmpa ;Lookup mul table of low nibble pxor xgft3_hi, xgft3_lo ;GF add high and low partials pxor xp3, xgft3_hi ;xp3 += partial pshufb xgft4_hi, x0 ;Lookup mul table of high nibble pshufb xgft4_lo, xtmpa ;Lookup mul table of low nibble pxor xgft4_hi, xgft4_lo ;GF add high and low partials pxor xp4, xgft4_hi ;xp4 += partial pshufb xgft1_hi, x0 ;Lookup mul table of high nibble pshufb xgft1_lo, xtmpa ;Lookup mul table of low nibble pxor xgft1_hi, xgft1_lo ;GF add high and low partials pxor xp5, xgft1_hi ;xp5 += partial cmp vec_i, vec jl .next_vect mov tmp, [dest+2*PS] mov ptr, [dest+3*PS] mov vec_i, [dest+4*PS] XSTR [dest1+pos], xp1 XSTR [dest2+pos], xp2 XSTR [tmp+pos], xp3 XSTR [ptr+pos], xp4 XSTR [vec_i+pos], xp5 add pos, 16 ;Loop on 16 bytes at a time cmp pos, len jle .loop16 lea tmp, [len + 16] cmp pos, tmp je .return_pass ;; Tail len mov pos, len ;Overlapped offset length-16 jmp .loop16 ;Do one more overlap pass .return_pass: FUNC_RESTORE mov return, 0 ret .return_fail: FUNC_RESTORE mov return, 1 ret endproc_frame section .data align 16 mask0f: dq 0x0f0f0f0f0f0f0f0f, 0x0f0f0f0f0f0f0f0f ;;; func core, ver, snum slversion gf_5vect_dot_prod_sse, 00, 05, 0065
// Test the pseudorandom number generator in stdlib.h // Source http://www.retroprogramming.com/2017/07/xorshift-pseudorandom-numbers-in-z80.html // Information https://en.wikipedia.org/wiki/Xorshift // Commodore 64 PRG executable file .file [name="rand-1.prg", type="prg", segments="Program"] .segmentdef Program [segments="Basic, Code, Data"] .segmentdef Basic [start=$0801] .segmentdef Code [start=$80d] .segmentdef Data [startAfter="Code"] .segment Basic :BasicUpstart(__start) .const WHITE = 1 .const LIGHT_BLUE = $e .const OFFSET_STRUCT_PRINTF_BUFFER_NUMBER_DIGITS = 1 .const STACK_BASE = $103 .const SIZEOF_STRUCT_PRINTF_BUFFER_NUMBER = $c /// Color Ram .label COLORRAM = $d800 /// Default address of screen character matrix .label DEFAULT_SCREEN = $400 // The number of bytes on the screen // The current cursor x-position .label conio_cursor_x = $2b // The current cursor y-position .label conio_cursor_y = $2e // The current text cursor line start .label conio_line_text = $2c // The current color cursor line start .label conio_line_color = $2f // The current text color .label conio_textcolor = $28 // The random state variable .label rand_state = $1e .segment Code __start: { // __ma char conio_cursor_x = 0 lda #0 sta.z conio_cursor_x // __ma char conio_cursor_y = 0 sta.z conio_cursor_y // __ma char *conio_line_text = CONIO_SCREEN_TEXT lda #<DEFAULT_SCREEN sta.z conio_line_text lda #>DEFAULT_SCREEN sta.z conio_line_text+1 // __ma char *conio_line_color = CONIO_SCREEN_COLORS lda #<COLORRAM sta.z conio_line_color lda #>COLORRAM sta.z conio_line_color+1 // __ma char conio_textcolor = CONIO_TEXTCOLOR_DEFAULT lda #LIGHT_BLUE sta.z conio_textcolor // #pragma constructor_for(conio_c64_init, cputc, clrscr, cscroll) jsr conio_c64_init jsr main rts } // Set initial cursor position conio_c64_init: { // Position cursor at current line .label BASIC_CURSOR_LINE = $d6 // char line = *BASIC_CURSOR_LINE lda.z BASIC_CURSOR_LINE // if(line>=CONIO_HEIGHT) cmp #$19 bcc __b1 lda #$19-1 __b1: // gotoxy(0, line) ldx #0 jsr gotoxy // } rts } // Output one character at the current cursor position // Moves the cursor forward. Scrolls the entire screen if needed // void cputc(__register(A) char c) cputc: { .const OFFSET_STACK_C = 0 tsx lda STACK_BASE+OFFSET_STACK_C,x // if(c=='\n') cmp #'\n' beq __b1 // conio_line_text[conio_cursor_x] = c ldy.z conio_cursor_x sta (conio_line_text),y // conio_line_color[conio_cursor_x] = conio_textcolor lda.z conio_textcolor sta (conio_line_color),y // if(++conio_cursor_x==CONIO_WIDTH) inc.z conio_cursor_x lda #$28 cmp.z conio_cursor_x bne __breturn // cputln() jsr cputln __breturn: // } rts __b1: // cputln() jsr cputln rts } main: { .label first = $31 .label cnt = 7 .label rnd = 2 .label row = $29 .label col = $2a // clrscr() jsr clrscr // textcolor(WHITE) lda #WHITE jsr textcolor // printf("generating unique randoms...") lda #<cputc sta.z printf_str.putc lda #>cputc sta.z printf_str.putc+1 lda #<s sta.z printf_str.s lda #>s sta.z printf_str.s+1 jsr printf_str // unsigned int first = rand() lda #<1 sta.z rand_state lda #>1 sta.z rand_state+1 jsr rand // unsigned int first = rand() lda.z rand.return sta.z rand.return_1 lda.z rand.return+1 sta.z rand.return_1+1 // textcolor(LIGHT_BLUE) lda #LIGHT_BLUE jsr textcolor lda.z first sta.z rnd lda.z first+1 sta.z rnd+1 lda #1 sta.z row lda #3 sta.z col lda #<0 sta.z cnt sta.z cnt+1 lda #<0>>$10 sta.z cnt+2 lda #>0>>$10 sta.z cnt+3 __b1: // cnt++; inc.z cnt bne !+ inc.z cnt+1 bne !+ inc.z cnt+2 bne !+ inc.z cnt+3 !: // (char)cnt==0 lda.z cnt // if((char)cnt==0) cmp #0 bne __b2 // gotoxy(col,row) ldx.z col lda.z row jsr gotoxy // printf("%5u",rnd) jsr printf_uint // if(++row==25) inc.z row lda #$19 cmp.z row bne __b2 // col+=6 lax.z col axs #-[6] stx.z col // if(col>40-5) txa cmp #$28-5+1 bcc __b17 lda #1 sta.z row lda #3 sta.z col jmp __b2 __b17: lda #1 sta.z row __b2: // rand() jsr rand // rand() // rnd = rand() // while(rnd!=first) lda.z rnd+1 cmp.z first+1 bne __b1 lda.z rnd cmp.z first bne __b1 // gotoxy(28,0) ldx #$1c lda #0 jsr gotoxy // textcolor(WHITE) lda #WHITE jsr textcolor // printf("found %lu",cnt) lda #<cputc sta.z printf_str.putc lda #>cputc sta.z printf_str.putc+1 lda #<s1 sta.z printf_str.s lda #>s1 sta.z printf_str.s+1 jsr printf_str // printf("found %lu",cnt) jsr printf_ulong // } rts .segment Data s: .text "generating unique randoms..." .byte 0 s1: .text "found " .byte 0 } .segment Code // Set the cursor to the specified position // void gotoxy(__register(X) char x, __register(A) char y) gotoxy: { .label __5 = $23 .label __6 = $1c .label __7 = $1c .label line_offset = $1c .label __8 = $21 .label __9 = $1c // if(y>CONIO_HEIGHT) cmp #$19+1 bcc __b1 lda #0 __b1: // if(x>=CONIO_WIDTH) cpx #$28 bcc __b2 ldx #0 __b2: // conio_cursor_x = x stx.z conio_cursor_x // conio_cursor_y = y sta.z conio_cursor_y // unsigned int line_offset = (unsigned int)y*CONIO_WIDTH sta.z __7 lda #0 sta.z __7+1 lda.z __7 asl sta.z __8 lda.z __7+1 rol sta.z __8+1 asl.z __8 rol.z __8+1 clc lda.z __9 adc.z __8 sta.z __9 lda.z __9+1 adc.z __8+1 sta.z __9+1 asl.z line_offset rol.z line_offset+1 asl.z line_offset rol.z line_offset+1 asl.z line_offset rol.z line_offset+1 // CONIO_SCREEN_TEXT + line_offset lda.z line_offset clc adc #<DEFAULT_SCREEN sta.z __5 lda.z line_offset+1 adc #>DEFAULT_SCREEN sta.z __5+1 // conio_line_text = CONIO_SCREEN_TEXT + line_offset lda.z __5 sta.z conio_line_text lda.z __5+1 sta.z conio_line_text+1 // CONIO_SCREEN_COLORS + line_offset lda.z __6 clc adc #<COLORRAM sta.z __6 lda.z __6+1 adc #>COLORRAM sta.z __6+1 // conio_line_color = CONIO_SCREEN_COLORS + line_offset lda.z __6 sta.z conio_line_color lda.z __6+1 sta.z conio_line_color+1 // } rts } // Print a newline cputln: { // conio_line_text += CONIO_WIDTH lda #$28 clc adc.z conio_line_text sta.z conio_line_text bcc !+ inc.z conio_line_text+1 !: // conio_line_color += CONIO_WIDTH lda #$28 clc adc.z conio_line_color sta.z conio_line_color bcc !+ inc.z conio_line_color+1 !: // conio_cursor_x = 0 lda #0 sta.z conio_cursor_x // conio_cursor_y++; inc.z conio_cursor_y // cscroll() jsr cscroll // } rts } // clears the screen and moves the cursor to the upper left-hand corner of the screen. clrscr: { .label line_text = $d .label line_cols = 4 lda #<COLORRAM sta.z line_cols lda #>COLORRAM sta.z line_cols+1 lda #<DEFAULT_SCREEN sta.z line_text lda #>DEFAULT_SCREEN sta.z line_text+1 ldx #0 __b1: // for( char l=0;l<CONIO_HEIGHT; l++ ) cpx #$19 bcc __b2 // conio_cursor_x = 0 lda #0 sta.z conio_cursor_x // conio_cursor_y = 0 sta.z conio_cursor_y // conio_line_text = CONIO_SCREEN_TEXT lda #<DEFAULT_SCREEN sta.z conio_line_text lda #>DEFAULT_SCREEN sta.z conio_line_text+1 // conio_line_color = CONIO_SCREEN_COLORS lda #<COLORRAM sta.z conio_line_color lda #>COLORRAM sta.z conio_line_color+1 // } rts __b2: ldy #0 __b3: // for( char c=0;c<CONIO_WIDTH; c++ ) cpy #$28 bcc __b4 // line_text += CONIO_WIDTH lda #$28 clc adc.z line_text sta.z line_text bcc !+ inc.z line_text+1 !: // line_cols += CONIO_WIDTH lda #$28 clc adc.z line_cols sta.z line_cols bcc !+ inc.z line_cols+1 !: // for( char l=0;l<CONIO_HEIGHT; l++ ) inx jmp __b1 __b4: // line_text[c] = ' ' lda #' ' sta (line_text),y // line_cols[c] = conio_textcolor lda.z conio_textcolor sta (line_cols),y // for( char c=0;c<CONIO_WIDTH; c++ ) iny jmp __b3 } // Set the color for text output. The old color setting is returned. // char textcolor(__register(A) char color) textcolor: { // conio_textcolor = color sta.z conio_textcolor // } rts } /// Print a NUL-terminated string // void printf_str(__zp($d) void (*putc)(char), __zp(4) const char *s) printf_str: { .label s = 4 .label putc = $d __b1: // while(c=*s++) ldy #0 lda (s),y inc.z s bne !+ inc.z s+1 !: cmp #0 bne __b2 // } rts __b2: // putc(c) pha jsr icall1 pla jmp __b1 icall1: jmp (putc) } // Returns a pseudo-random number in the range of 0 to RAND_MAX (65535) // Uses an xorshift pseudorandom number generator that hits all different values // Information https://en.wikipedia.org/wiki/Xorshift // Source http://www.retroprogramming.com/2017/07/xorshift-pseudorandom-numbers-in-z80.html rand: { .label __0 = $b .label __1 = 4 .label __2 = $d .label return = 2 .label return_1 = $31 // rand_state << 7 lda.z rand_state+1 lsr lda.z rand_state ror sta.z __0+1 lda #0 ror sta.z __0 // rand_state ^= rand_state << 7 lda.z rand_state eor.z __0 sta.z rand_state lda.z rand_state+1 eor.z __0+1 sta.z rand_state+1 // rand_state >> 9 lsr sta.z __1 lda #0 sta.z __1+1 // rand_state ^= rand_state >> 9 lda.z rand_state eor.z __1 sta.z rand_state lda.z rand_state+1 eor.z __1+1 sta.z rand_state+1 // rand_state << 8 lda.z rand_state sta.z __2+1 lda #0 sta.z __2 // rand_state ^= rand_state << 8 lda.z rand_state eor.z __2 sta.z rand_state lda.z rand_state+1 eor.z __2+1 sta.z rand_state+1 // return rand_state; lda.z rand_state sta.z return lda.z rand_state+1 sta.z return+1 // } rts } // Print an unsigned int using a specific format // void printf_uint(void (*putc)(char), __zp(2) unsigned int uvalue, char format_min_length, char format_justify_left, char format_sign_always, char format_zero_padding, char format_upper_case, char format_radix) printf_uint: { .const format_min_length = 5 .const format_justify_left = 0 .const format_zero_padding = 0 .const format_upper_case = 0 .label putc = cputc .label uvalue = 2 // printf_buffer.sign = format.sign_always?'+':0 // Handle any sign lda #0 sta printf_buffer // utoa(uvalue, printf_buffer.digits, format.radix) // Format number into buffer jsr utoa // printf_number_buffer(putc, printf_buffer, format) lda printf_buffer sta.z printf_number_buffer.buffer_sign // Print using format lda #format_upper_case sta.z printf_number_buffer.format_upper_case lda #<putc sta.z printf_number_buffer.putc lda #>putc sta.z printf_number_buffer.putc+1 lda #format_zero_padding sta.z printf_number_buffer.format_zero_padding lda #format_justify_left sta.z printf_number_buffer.format_justify_left ldx #format_min_length jsr printf_number_buffer // } rts } // Print an unsigned int using a specific format // void printf_ulong(void (*putc)(char), __zp(7) unsigned long uvalue, char format_min_length, char format_justify_left, char format_sign_always, char format_zero_padding, char format_upper_case, char format_radix) printf_ulong: { .const format_min_length = 0 .const format_justify_left = 0 .const format_zero_padding = 0 .const format_upper_case = 0 .label putc = cputc .label uvalue = 7 // printf_buffer.sign = format.sign_always?'+':0 // Handle any sign lda #0 sta printf_buffer // ultoa(uvalue, printf_buffer.digits, format.radix) // Format number into buffer jsr ultoa // printf_number_buffer(putc, printf_buffer, format) lda printf_buffer sta.z printf_number_buffer.buffer_sign // Print using format lda #format_upper_case sta.z printf_number_buffer.format_upper_case lda #<putc sta.z printf_number_buffer.putc lda #>putc sta.z printf_number_buffer.putc+1 lda #format_zero_padding sta.z printf_number_buffer.format_zero_padding lda #format_justify_left sta.z printf_number_buffer.format_justify_left ldx #format_min_length jsr printf_number_buffer // } rts } // Scroll the entire screen if the cursor is beyond the last line cscroll: { // if(conio_cursor_y==CONIO_HEIGHT) lda #$19 cmp.z conio_cursor_y bne __breturn // memcpy(CONIO_SCREEN_TEXT, CONIO_SCREEN_TEXT+CONIO_WIDTH, CONIO_BYTES-CONIO_WIDTH) lda #<DEFAULT_SCREEN sta.z memcpy.destination lda #>DEFAULT_SCREEN sta.z memcpy.destination+1 lda #<DEFAULT_SCREEN+$28 sta.z memcpy.source lda #>DEFAULT_SCREEN+$28 sta.z memcpy.source+1 jsr memcpy // memcpy(CONIO_SCREEN_COLORS, CONIO_SCREEN_COLORS+CONIO_WIDTH, CONIO_BYTES-CONIO_WIDTH) lda #<COLORRAM sta.z memcpy.destination lda #>COLORRAM sta.z memcpy.destination+1 lda #<COLORRAM+$28 sta.z memcpy.source lda #>COLORRAM+$28 sta.z memcpy.source+1 jsr memcpy // memset(CONIO_SCREEN_TEXT+CONIO_BYTES-CONIO_WIDTH, ' ', CONIO_WIDTH) ldx #' ' lda #<DEFAULT_SCREEN+$19*$28-$28 sta.z memset.str lda #>DEFAULT_SCREEN+$19*$28-$28 sta.z memset.str+1 jsr memset // memset(CONIO_SCREEN_COLORS+CONIO_BYTES-CONIO_WIDTH, conio_textcolor, CONIO_WIDTH) ldx.z conio_textcolor lda #<COLORRAM+$19*$28-$28 sta.z memset.str lda #>COLORRAM+$19*$28-$28 sta.z memset.str+1 jsr memset // conio_line_text -= CONIO_WIDTH sec lda.z conio_line_text sbc #$28 sta.z conio_line_text lda.z conio_line_text+1 sbc #0 sta.z conio_line_text+1 // conio_line_color -= CONIO_WIDTH sec lda.z conio_line_color sbc #$28 sta.z conio_line_color lda.z conio_line_color+1 sbc #0 sta.z conio_line_color+1 // conio_cursor_y--; dec.z conio_cursor_y __breturn: // } rts } // Converts unsigned number value to a string representing it in RADIX format. // If the leading digits are zero they are not included in the string. // - value : The number to be converted to RADIX // - buffer : receives the string representing the number and zero-termination. // - radix : The radix to convert the number to (from the enum RADIX) // void utoa(__zp(2) unsigned int value, __zp($d) char *buffer, char radix) utoa: { .const max_digits = 5 .label digit_value = 4 .label buffer = $d .label digit = $13 .label value = 2 lda #<printf_buffer+OFFSET_STRUCT_PRINTF_BUFFER_NUMBER_DIGITS sta.z buffer lda #>printf_buffer+OFFSET_STRUCT_PRINTF_BUFFER_NUMBER_DIGITS sta.z buffer+1 ldx #0 txa sta.z digit __b1: // for( char digit=0; digit<max_digits-1; digit++ ) lda.z digit cmp #max_digits-1 bcc __b2 // *buffer++ = DIGITS[(char)value] ldx.z value lda DIGITS,x ldy #0 sta (buffer),y // *buffer++ = DIGITS[(char)value]; inc.z buffer bne !+ inc.z buffer+1 !: // *buffer = 0 lda #0 tay sta (buffer),y // } rts __b2: // unsigned int digit_value = digit_values[digit] lda.z digit asl tay lda RADIX_DECIMAL_VALUES,y sta.z digit_value lda RADIX_DECIMAL_VALUES+1,y sta.z digit_value+1 // if (started || value >= digit_value) cpx #0 bne __b5 cmp.z value+1 bne !+ lda.z digit_value cmp.z value beq __b5 !: bcc __b5 __b4: // for( char digit=0; digit<max_digits-1; digit++ ) inc.z digit jmp __b1 __b5: // utoa_append(buffer++, value, digit_value) jsr utoa_append // utoa_append(buffer++, value, digit_value) // value = utoa_append(buffer++, value, digit_value) // value = utoa_append(buffer++, value, digit_value); inc.z buffer bne !+ inc.z buffer+1 !: ldx #1 jmp __b4 } // Print the contents of the number buffer using a specific format. // This handles minimum length, zero-filling, and left/right justification from the format // void printf_number_buffer(__zp($d) void (*putc)(char), __zp($20) char buffer_sign, char *buffer_digits, __register(X) char format_min_length, __zp($13) char format_justify_left, char format_sign_always, __zp($1a) char format_zero_padding, __zp($27) char format_upper_case, char format_radix) printf_number_buffer: { .label __19 = $b .label buffer_sign = $20 .label padding = $1b .label putc = $d .label format_zero_padding = $1a .label format_justify_left = $13 .label format_upper_case = $27 // if(format.min_length) cpx #0 beq __b6 // strlen(buffer.digits) jsr strlen // strlen(buffer.digits) // signed char len = (signed char)strlen(buffer.digits) // There is a minimum length - work out the padding ldy.z __19 // if(buffer.sign) lda.z buffer_sign beq __b13 // len++; iny __b13: // padding = (signed char)format.min_length - len txa sty.z $ff sec sbc.z $ff sta.z padding // if(padding<0) cmp #0 bpl __b1 __b6: lda #0 sta.z padding __b1: // if(!format.justify_left && !format.zero_padding && padding) lda.z format_justify_left bne __b2 lda.z format_zero_padding bne __b2 lda.z padding cmp #0 bne __b8 jmp __b2 __b8: // printf_padding(putc, ' ',(char)padding) lda.z padding sta.z printf_padding.length lda #' ' sta.z printf_padding.pad jsr printf_padding __b2: // if(buffer.sign) lda.z buffer_sign beq __b3 // putc(buffer.sign) pha jsr icall2 pla __b3: // if(format.zero_padding && padding) lda.z format_zero_padding beq __b4 lda.z padding cmp #0 bne __b10 jmp __b4 __b10: // printf_padding(putc, '0',(char)padding) lda.z padding sta.z printf_padding.length lda #'0' sta.z printf_padding.pad jsr printf_padding __b4: // if(format.upper_case) lda.z format_upper_case beq __b5 // strupr(buffer.digits) jsr strupr __b5: // printf_str(putc, buffer.digits) lda #<printf_buffer+OFFSET_STRUCT_PRINTF_BUFFER_NUMBER_DIGITS sta.z printf_str.s lda #>printf_buffer+OFFSET_STRUCT_PRINTF_BUFFER_NUMBER_DIGITS sta.z printf_str.s+1 jsr printf_str // if(format.justify_left && !format.zero_padding && padding) lda.z format_justify_left beq __breturn lda.z format_zero_padding bne __breturn lda.z padding cmp #0 bne __b12 rts __b12: // printf_padding(putc, ' ',(char)padding) lda.z padding sta.z printf_padding.length lda #' ' sta.z printf_padding.pad jsr printf_padding __breturn: // } rts icall2: jmp (putc) } // Converts unsigned number value to a string representing it in RADIX format. // If the leading digits are zero they are not included in the string. // - value : The number to be converted to RADIX // - buffer : receives the string representing the number and zero-termination. // - radix : The radix to convert the number to (from the enum RADIX) // void ultoa(__zp(7) unsigned long value, __zp($d) char *buffer, char radix) ultoa: { .const max_digits = $a .label digit_value = $f .label buffer = $d .label digit = $1a .label value = 7 lda #<printf_buffer+OFFSET_STRUCT_PRINTF_BUFFER_NUMBER_DIGITS sta.z buffer lda #>printf_buffer+OFFSET_STRUCT_PRINTF_BUFFER_NUMBER_DIGITS sta.z buffer+1 ldx #0 txa sta.z digit __b1: // for( char digit=0; digit<max_digits-1; digit++ ) lda.z digit cmp #max_digits-1 bcc __b2 // *buffer++ = DIGITS[(char)value] lda.z value tay lda DIGITS,y ldy #0 sta (buffer),y // *buffer++ = DIGITS[(char)value]; inc.z buffer bne !+ inc.z buffer+1 !: // *buffer = 0 lda #0 tay sta (buffer),y // } rts __b2: // unsigned long digit_value = digit_values[digit] lda.z digit asl asl tay lda RADIX_DECIMAL_VALUES_LONG,y sta.z digit_value lda RADIX_DECIMAL_VALUES_LONG+1,y sta.z digit_value+1 lda RADIX_DECIMAL_VALUES_LONG+2,y sta.z digit_value+2 lda RADIX_DECIMAL_VALUES_LONG+3,y sta.z digit_value+3 // if (started || value >= digit_value) cpx #0 bne __b5 lda.z value+3 cmp.z digit_value+3 bcc !+ bne __b5 lda.z value+2 cmp.z digit_value+2 bcc !+ bne __b5 lda.z value+1 cmp.z digit_value+1 bcc !+ bne __b5 lda.z value cmp.z digit_value bcs __b5 !: __b4: // for( char digit=0; digit<max_digits-1; digit++ ) inc.z digit jmp __b1 __b5: // ultoa_append(buffer++, value, digit_value) jsr ultoa_append // ultoa_append(buffer++, value, digit_value) // value = ultoa_append(buffer++, value, digit_value) // value = ultoa_append(buffer++, value, digit_value); inc.z buffer bne !+ inc.z buffer+1 !: ldx #1 jmp __b4 } // Copy block of memory (forwards) // Copies the values of num bytes from the location pointed to by source directly to the memory block pointed to by destination. // void * memcpy(__zp($18) void *destination, __zp($16) void *source, unsigned int num) memcpy: { .label src_end = $25 .label dst = $18 .label src = $16 .label source = $16 .label destination = $18 // char* src_end = (char*)source+num lda.z source clc adc #<$19*$28-$28 sta.z src_end lda.z source+1 adc #>$19*$28-$28 sta.z src_end+1 __b1: // while(src!=src_end) lda.z src+1 cmp.z src_end+1 bne __b2 lda.z src cmp.z src_end bne __b2 // } rts __b2: // *dst++ = *src++ ldy #0 lda (src),y sta (dst),y // *dst++ = *src++; inc.z dst bne !+ inc.z dst+1 !: inc.z src bne !+ inc.z src+1 !: jmp __b1 } // Copies the character c (an unsigned char) to the first num characters of the object pointed to by the argument str. // void * memset(__zp($16) void *str, __register(X) char c, unsigned int num) memset: { .label end = $18 .label dst = $16 .label str = $16 // char* end = (char*)str + num lda #$28 clc adc.z str sta.z end lda #0 adc.z str+1 sta.z end+1 __b2: // for(char* dst = str; dst!=end; dst++) lda.z dst+1 cmp.z end+1 bne __b3 lda.z dst cmp.z end bne __b3 // } rts __b3: // *dst = c txa ldy #0 sta (dst),y // for(char* dst = str; dst!=end; dst++) inc.z dst bne !+ inc.z dst+1 !: jmp __b2 } // Used to convert a single digit of an unsigned number value to a string representation // Counts a single digit up from '0' as long as the value is larger than sub. // Each time the digit is increased sub is subtracted from value. // - buffer : pointer to the char that receives the digit // - value : The value where the digit will be derived from // - sub : the value of a '1' in the digit. Subtracted continually while the digit is increased. // (For decimal the subs used are 10000, 1000, 100, 10, 1) // returns : the value reduced by sub * digit so that it is less than sub. // __zp(2) unsigned int utoa_append(__zp($d) char *buffer, __zp(2) unsigned int value, __zp(4) unsigned int sub) utoa_append: { .label buffer = $d .label value = 2 .label sub = 4 .label return = 2 ldx #0 __b1: // while (value >= sub) lda.z sub+1 cmp.z value+1 bne !+ lda.z sub cmp.z value beq __b2 !: bcc __b2 // *buffer = DIGITS[digit] lda DIGITS,x ldy #0 sta (buffer),y // } rts __b2: // digit++; inx // value -= sub lda.z value sec sbc.z sub sta.z value lda.z value+1 sbc.z sub+1 sta.z value+1 jmp __b1 } // Computes the length of the string str up to but not including the terminating null character. // __zp($b) unsigned int strlen(__zp(4) char *str) strlen: { .label len = $b .label str = 4 .label return = $b lda #<0 sta.z len sta.z len+1 lda #<printf_buffer+OFFSET_STRUCT_PRINTF_BUFFER_NUMBER_DIGITS sta.z str lda #>printf_buffer+OFFSET_STRUCT_PRINTF_BUFFER_NUMBER_DIGITS sta.z str+1 __b1: // while(*str) ldy #0 lda (str),y cmp #0 bne __b2 // } rts __b2: // len++; inc.z len bne !+ inc.z len+1 !: // str++; inc.z str bne !+ inc.z str+1 !: jmp __b1 } // Print a padding char a number of times // void printf_padding(__zp($d) void (*putc)(char), __zp($15) char pad, __zp($14) char length) printf_padding: { .label i = 6 .label putc = $d .label length = $14 .label pad = $15 lda #0 sta.z i __b1: // for(char i=0;i<length; i++) lda.z i cmp.z length bcc __b2 // } rts __b2: // putc(pad) lda.z pad pha jsr icall3 pla // for(char i=0;i<length; i++) inc.z i jmp __b1 icall3: jmp (putc) } // Converts a string to uppercase. // char * strupr(char *str) strupr: { .label str = printf_buffer+OFFSET_STRUCT_PRINTF_BUFFER_NUMBER_DIGITS .label src = 4 lda #<str sta.z src lda #>str sta.z src+1 __b1: // while(*src) ldy #0 lda (src),y cmp #0 bne __b2 // } rts __b2: // toupper(*src) ldy #0 lda (src),y jsr toupper // *src = toupper(*src) ldy #0 sta (src),y // src++; inc.z src bne !+ inc.z src+1 !: jmp __b1 } // Used to convert a single digit of an unsigned number value to a string representation // Counts a single digit up from '0' as long as the value is larger than sub. // Each time the digit is increased sub is subtracted from value. // - buffer : pointer to the char that receives the digit // - value : The value where the digit will be derived from // - sub : the value of a '1' in the digit. Subtracted continually while the digit is increased. // (For decimal the subs used are 10000, 1000, 100, 10, 1) // returns : the value reduced by sub * digit so that it is less than sub. // __zp(7) unsigned long ultoa_append(__zp($d) char *buffer, __zp(7) unsigned long value, __zp($f) unsigned long sub) ultoa_append: { .label buffer = $d .label value = 7 .label sub = $f .label return = 7 ldx #0 __b1: // while (value >= sub) lda.z value+3 cmp.z sub+3 bcc !+ bne __b2 lda.z value+2 cmp.z sub+2 bcc !+ bne __b2 lda.z value+1 cmp.z sub+1 bcc !+ bne __b2 lda.z value cmp.z sub bcs __b2 !: // *buffer = DIGITS[digit] lda DIGITS,x ldy #0 sta (buffer),y // } rts __b2: // digit++; inx // value -= sub lda.z value sec sbc.z sub sta.z value lda.z value+1 sbc.z sub+1 sta.z value+1 lda.z value+2 sbc.z sub+2 sta.z value+2 lda.z value+3 sbc.z sub+3 sta.z value+3 jmp __b1 } // Convert lowercase alphabet to uppercase // Returns uppercase equivalent to c, if such value exists, else c remains unchanged // __register(A) char toupper(__register(A) char ch) toupper: { // if(ch>='a' && ch<='z') cmp #'a' bcc __breturn cmp #'z' bcc __b1 beq __b1 rts __b1: // return ch + ('A'-'a'); clc adc #'A'-'a' __breturn: // } rts } .segment Data // The digits used for numbers DIGITS: .text "0123456789abcdef" // Values of decimal digits RADIX_DECIMAL_VALUES: .word $2710, $3e8, $64, $a // Values of decimal digits RADIX_DECIMAL_VALUES_LONG: .dword $3b9aca00, $5f5e100, $989680, $f4240, $186a0, $2710, $3e8, $64, $a // Buffer used for stringified number being printed printf_buffer: .fill SIZEOF_STRUCT_PRINTF_BUFFER_NUMBER, 0
; ; Enterprise 64/128 specific routines ; by Stefano Bodrato, 2011 ; ; exos_reset_font(); ; ; ; $Id: exos_reset_font.asm,v 1.4 2016/06/19 20:17:32 dom Exp $ ; SECTION code_clib PUBLIC exos_reset_font PUBLIC _exos_reset_font INCLUDE "enterprise.def" exos_reset_font: _exos_reset_font: ; __FASTCALL_ ld a,l ; channel ld b,FN_FONT ; special fn code rst 30h defb 11 ; call special device dependent exos functions ld h,0 ld l,a ret
.global s_prepare_buffers s_prepare_buffers: ret .global s_faulty_load s_faulty_load: push %r14 push %rax push %rbp push %rbx push %rdi push %rdx push %rsi // Store mov $0xabe, %rbp nop nop nop nop nop inc %rax movl $0x51525354, (%rbp) add %rbp, %rbp // Store lea addresses_normal+0xc63e, %r14 nop nop nop nop nop sub %rbx, %rbx mov $0x5152535455565758, %rax movq %rax, %xmm0 vmovups %ymm0, (%r14) nop nop nop cmp $3856, %rbx // Store lea addresses_normal+0x13716, %rbp add %rbx, %rbx movw $0x5152, (%rbp) // Exception!!! nop nop mov (0), %rdx nop inc %r14 // Store lea addresses_A+0x387e, %rsi nop nop and %r14, %r14 movl $0x51525354, (%rsi) nop nop nop nop dec %rbp // Store lea addresses_UC+0xc48e, %r14 nop nop nop cmp $27934, %rdi movl $0x51525354, (%r14) nop sub $46407, %rdx // Store mov $0xa1e, %rdi inc %r14 movw $0x5152, (%rdi) nop add %rbp, %rbp // Store lea addresses_US+0xc55e, %rdi nop sub %rbp, %rbp movl $0x51525354, (%rdi) nop nop nop nop and %rdx, %rdx // Faulty Load lea addresses_WC+0xf6fe, %rbx nop nop nop nop sub $41878, %rdx movups (%rbx), %xmm5 vpextrq $0, %xmm5, %r14 lea oracles, %rdx and $0xff, %r14 shlq $12, %r14 mov (%rdx,%r14,1), %r14 pop %rsi pop %rdx pop %rdi pop %rbx pop %rbp pop %rax pop %r14 ret /* <gen_faulty_load> [REF] {'src': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_WC'}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'congruent': 6, 'AVXalign': False, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_P'}} {'OP': 'STOR', 'dst': {'congruent': 6, 'AVXalign': False, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_normal'}} {'OP': 'STOR', 'dst': {'congruent': 3, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_normal'}} {'OP': 'STOR', 'dst': {'congruent': 2, 'AVXalign': False, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_A'}} {'OP': 'STOR', 'dst': {'congruent': 4, 'AVXalign': False, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_UC'}} {'OP': 'STOR', 'dst': {'congruent': 5, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_P'}} {'OP': 'STOR', 'dst': {'congruent': 5, 'AVXalign': False, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_US'}} [Faulty Load] {'src': {'congruent': 0, 'AVXalign': False, 'same': True, 'size': 16, 'NT': False, 'type': 'addresses_WC'}, 'OP': 'LOAD'} <gen_prepare_buffer> {'d0': 13, '00': 46} 00 00 00 00 00 00 00 00 00 d0 00 00 d0 00 00 00 d0 00 d0 00 00 00 00 00 00 00 00 d0 00 00 d0 00 00 00 d0 00 00 00 00 00 d0 d0 00 d0 00 00 00 d0 00 d0 d0 00 00 00 00 00 00 00 00 */
/********************************************************************** * File: paragraphs.cpp * Description: Paragraph detection for tesseract. * Author: David Eger * Created: 25 February 2011 * * (C) Copyright 2011, Google Inc. ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. ** You may obtain a copy of the License at ** http://www.apache.org/licenses/LICENSE-2.0 ** Unless required by applicable law or agreed to in writing, software ** distributed under the License is distributed on an "AS IS" BASIS, ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ** See the License for the specific language governing permissions and ** limitations under the License. * **********************************************************************/ #ifdef _MSC_VER #define __func__ __FUNCTION__ #endif #include <ctype.h> #include BLIK_TESSERACT_U_genericvector_h //original-code:"genericvector.h" #include BLIK_TESSERACT_U_helpers_h //original-code:"helpers.h" #include BLIK_TESSERACT_U_mutableiterator_h //original-code:"mutableiterator.h" #include BLIK_TESSERACT_U_ocrpara_h //original-code:"ocrpara.h" #include BLIK_TESSERACT_U_pageres_h //original-code:"pageres.h" #include BLIK_TESSERACT_U_paragraphs_h //original-code:"paragraphs.h" #include "paragraphs_internal.h" #include BLIK_TESSERACT_U_publictypes_h //original-code:"publictypes.h" #include BLIK_TESSERACT_U_ratngs_h //original-code:"ratngs.h" #include BLIK_TESSERACT_U_rect_h //original-code:"rect.h" #include BLIK_TESSERACT_U_statistc_h //original-code:"statistc.h" #include BLIK_TESSERACT_U_strngs_h //original-code:"strngs.h" #include BLIK_TESSERACT_U_tprintf_h //original-code:"tprintf.h" #include BLIK_TESSERACT_U_unicharset_h //original-code:"unicharset.h" #include BLIK_TESSERACT_U_unicodes_h //original-code:"unicodes.h" namespace tesseract { // Special "weak" ParagraphModels. const ParagraphModel *kCrownLeft = reinterpret_cast<ParagraphModel *>(0xDEAD111F); const ParagraphModel *kCrownRight = reinterpret_cast<ParagraphModel *>(0xDEAD888F); // Given the width of a typical space between words, what is the threshold // by which by which we think left and right alignments for paragraphs // can vary and still be aligned. static int Epsilon(int space_pix) { return space_pix * 4 / 5; } static bool AcceptableRowArgs( int debug_level, int min_num_rows, const char *function_name, const GenericVector<RowScratchRegisters> *rows, int row_start, int row_end) { if (row_start < 0 || row_end > rows->size() || row_start > row_end) { tprintf("Invalid arguments rows[%d, %d) while rows is of size %d.\n", row_start, row_end, rows->size()); return false; } if (row_end - row_start < min_num_rows) { if (debug_level > 1) { tprintf("# Too few rows[%d, %d) for %s.\n", row_start, row_end, function_name); } return false; } return true; } // =============================== Debug Code ================================ // Convert an integer to a decimal string. static STRING StrOf(int num) { char buffer[30]; snprintf(buffer, sizeof(buffer), "%d", num); return STRING(buffer); } // Given a row-major matrix of unicode text and a column separator, print // a formatted table. For ASCII, we get good column alignment. static void PrintTable(const GenericVector<GenericVector<STRING> > &rows, const STRING &colsep) { GenericVector<int> max_col_widths; for (int r = 0; r < rows.size(); r++) { int num_columns = rows[r].size(); for (int c = 0; c < num_columns; c++) { int num_unicodes = 0; for (int i = 0; i < rows[r][c].size(); i++) { if ((rows[r][c][i] & 0xC0) != 0x80) num_unicodes++; } if (c >= max_col_widths.size()) { max_col_widths.push_back(num_unicodes); } else { if (num_unicodes > max_col_widths[c]) max_col_widths[c] = num_unicodes; } } } GenericVector<STRING> col_width_patterns; for (int c = 0; c < max_col_widths.size(); c++) { col_width_patterns.push_back( STRING("%-") + StrOf(max_col_widths[c]) + "s"); } for (int r = 0; r < rows.size(); r++) { for (int c = 0; c < rows[r].size(); c++) { if (c > 0) tprintf("%s", colsep.string()); tprintf(col_width_patterns[c].string(), rows[r][c].string()); } tprintf("\n"); } } STRING RtlEmbed(const STRING &word, bool rtlify) { if (rtlify) return STRING(kRLE) + word + STRING(kPDF); return word; } // Print the current thoughts of the paragraph detector. static void PrintDetectorState(const ParagraphTheory &theory, const GenericVector<RowScratchRegisters> &rows) { GenericVector<GenericVector<STRING> > output; output.push_back(GenericVector<STRING>()); output.back().push_back("#row"); output.back().push_back("space"); output.back().push_back(".."); output.back().push_back("lword[widthSEL]"); output.back().push_back("rword[widthSEL]"); RowScratchRegisters::AppendDebugHeaderFields(&output.back()); output.back().push_back("text"); for (int i = 0; i < rows.size(); i++) { output.push_back(GenericVector<STRING>()); GenericVector<STRING> &row = output.back(); const RowInfo& ri = *rows[i].ri_; row.push_back(StrOf(i)); row.push_back(StrOf(ri.average_interword_space)); row.push_back(ri.has_leaders ? ".." : " "); row.push_back(RtlEmbed(ri.lword_text, !ri.ltr) + "[" + StrOf(ri.lword_box.width()) + (ri.lword_likely_starts_idea ? "S" : "s") + (ri.lword_likely_ends_idea ? "E" : "e") + (ri.lword_indicates_list_item ? "L" : "l") + "]"); row.push_back(RtlEmbed(ri.rword_text, !ri.ltr) + "[" + StrOf(ri.rword_box.width()) + (ri.rword_likely_starts_idea ? "S" : "s") + (ri.rword_likely_ends_idea ? "E" : "e") + (ri.rword_indicates_list_item ? "L" : "l") + "]"); rows[i].AppendDebugInfo(theory, &row); row.push_back(RtlEmbed(ri.text, !ri.ltr)); } PrintTable(output, " "); tprintf("Active Paragraph Models:\n"); for (int m = 0; m < theory.models().size(); m++) { tprintf(" %d: %s\n", m + 1, theory.models()[m]->ToString().string()); } } static void DebugDump( bool should_print, const STRING &phase, const ParagraphTheory &theory, const GenericVector<RowScratchRegisters> &rows) { if (!should_print) return; tprintf("# %s\n", phase.string()); PrintDetectorState(theory, rows); } // Print out the text for rows[row_start, row_end) static void PrintRowRange(const GenericVector<RowScratchRegisters> &rows, int row_start, int row_end) { tprintf("======================================\n"); for (int row = row_start; row < row_end; row++) { tprintf("%s\n", rows[row].ri_->text.string()); } tprintf("======================================\n"); } // ============= Brain Dead Language Model (ASCII Version) =================== bool IsLatinLetter(int ch) { return (ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z'); } bool IsDigitLike(int ch) { return ch == 'o' || ch == 'O' || ch == 'l' || ch == 'I'; } bool IsOpeningPunct(int ch) { return strchr("'\"({[", ch) != NULL; } bool IsTerminalPunct(int ch) { return strchr(":'\".?!]})", ch) != NULL; } // Return a pointer after consuming as much text as qualifies as roman numeral. const char *SkipChars(const char *str, const char *toskip) { while (*str != '\0' && strchr(toskip, *str)) { str++; } return str; } const char *SkipChars(const char *str, bool (*skip)(int)) { while (*str != '\0' && skip(*str)) { str++; } return str; } const char *SkipOne(const char *str, const char *toskip) { if (*str != '\0' && strchr(toskip, *str)) return str + 1; return str; } // Return whether it is very likely that this is a numeral marker that could // start a list item. Some examples include: // A I iii. VI (2) 3.5. [C-4] bool LikelyListNumeral(const STRING &word) { const char *kRomans = "ivxlmdIVXLMD"; const char *kDigits = "012345789"; const char *kOpen = "[{("; const char *kSep = ":;-.,"; const char *kClose = "]})"; int num_segments = 0; const char *pos = word.string(); while (*pos != '\0' && num_segments < 3) { // skip up to two open parens. const char *numeral_start = SkipOne(SkipOne(pos, kOpen), kOpen); const char *numeral_end = SkipChars(numeral_start, kRomans); if (numeral_end != numeral_start) { // Got Roman Numeral. Great. } else { numeral_end = SkipChars(numeral_start, kDigits); if (numeral_end == numeral_start) { // If there's a single latin letter, we can use that. numeral_end = SkipChars(numeral_start, IsLatinLetter); if (numeral_end - numeral_start != 1) break; } } // We got some sort of numeral. num_segments++; // Skip any trailing parens or punctuation. pos = SkipChars(SkipChars(numeral_end, kClose), kSep); if (pos == numeral_end) break; } return *pos == '\0'; } bool LikelyListMark(const STRING &word) { const char *kListMarks = "0Oo*.,+."; return word.size() == 1 && strchr(kListMarks, word[0]) != NULL; } bool AsciiLikelyListItem(const STRING &word) { return LikelyListMark(word) || LikelyListNumeral(word); } // ========== Brain Dead Language Model (Tesseract Version) ================ // Return the first Unicode Codepoint from werd[pos]. int UnicodeFor(const UNICHARSET *u, const WERD_CHOICE *werd, int pos) { if (!u || !werd || pos > werd->length()) return 0; return UNICHAR(u->id_to_unichar(werd->unichar_id(pos)), -1).first_uni(); } // A useful helper class for finding the first j >= i so that word[j] // does not have given character type. class UnicodeSpanSkipper { public: UnicodeSpanSkipper(const UNICHARSET *unicharset, const WERD_CHOICE *word) : u_(unicharset), word_(word) { wordlen_ = word->length(); } // Given an input position, return the first position >= pos not punc. int SkipPunc(int pos); // Given an input position, return the first position >= pos not digit. int SkipDigits(int pos); // Given an input position, return the first position >= pos not roman. int SkipRomans(int pos); // Given an input position, return the first position >= pos not alpha. int SkipAlpha(int pos); private: const UNICHARSET *u_; const WERD_CHOICE *word_; int wordlen_; }; int UnicodeSpanSkipper::SkipPunc(int pos) { while (pos < wordlen_ && u_->get_ispunctuation(word_->unichar_id(pos))) pos++; return pos; } int UnicodeSpanSkipper::SkipDigits(int pos) { while (pos < wordlen_ && (u_->get_isdigit(word_->unichar_id(pos)) || IsDigitLike(UnicodeFor(u_, word_, pos)))) pos++; return pos; } int UnicodeSpanSkipper::SkipRomans(int pos) { const char *kRomans = "ivxlmdIVXLMD"; while (pos < wordlen_) { int ch = UnicodeFor(u_, word_, pos); if (ch >= 0xF0 || strchr(kRomans, ch) == 0) break; pos++; } return pos; } int UnicodeSpanSkipper::SkipAlpha(int pos) { while (pos < wordlen_ && u_->get_isalpha(word_->unichar_id(pos))) pos++; return pos; } bool LikelyListMarkUnicode(int ch) { if (ch < 0x80) { STRING single_ch; single_ch += ch; return LikelyListMark(single_ch); } switch (ch) { // TODO(eger) expand this list of unicodes as needed. case 0x00B0: // degree sign case 0x2022: // bullet case 0x25E6: // white bullet case 0x00B7: // middle dot case 0x25A1: // white square case 0x25A0: // black square case 0x25AA: // black small square case 0x2B1D: // black very small square case 0x25BA: // black right-pointing pointer case 0x25CF: // black circle case 0x25CB: // white circle return true; default: break; // fall through } return false; } // Return whether it is very likely that this is a numeral marker that could // start a list item. Some examples include: // A I iii. VI (2) 3.5. [C-4] bool UniLikelyListItem(const UNICHARSET *u, const WERD_CHOICE *werd) { if (werd->length() == 1 && LikelyListMarkUnicode(UnicodeFor(u, werd, 0))) return true; UnicodeSpanSkipper m(u, werd); int num_segments = 0; int pos = 0; while (pos < werd->length() && num_segments < 3) { int numeral_start = m.SkipPunc(pos); if (numeral_start > pos + 1) break; int numeral_end = m.SkipRomans(numeral_start); if (numeral_end == numeral_start) { numeral_end = m.SkipDigits(numeral_start); if (numeral_end == numeral_start) { // If there's a single latin letter, we can use that. numeral_end = m.SkipAlpha(numeral_start); if (numeral_end - numeral_start != 1) break; } } // We got some sort of numeral. num_segments++; // Skip any trailing punctuation. pos = m.SkipPunc(numeral_end); if (pos == numeral_end) break; } return pos == werd->length(); } // ========= Brain Dead Language Model (combined entry points) ================ // Given the leftmost word of a line either as a Tesseract unicharset + werd // or a utf8 string, set the following attributes for it: // is_list - this word might be a list number or bullet. // starts_idea - this word is likely to start a sentence. // ends_idea - this word is likely to end a sentence. void LeftWordAttributes(const UNICHARSET *unicharset, const WERD_CHOICE *werd, const STRING &utf8, bool *is_list, bool *starts_idea, bool *ends_idea) { *is_list = false; *starts_idea = false; *ends_idea = false; if (utf8.size() == 0 || (werd != NULL && werd->length() == 0)) { // Empty *ends_idea = true; return; } if (unicharset && werd) { // We have a proper werd and unicharset so use it. if (UniLikelyListItem(unicharset, werd)) { *is_list = true; *starts_idea = true; *ends_idea = true; } if (unicharset->get_isupper(werd->unichar_id(0))) { *starts_idea = true; } if (unicharset->get_ispunctuation(werd->unichar_id(0))) { *starts_idea = true; *ends_idea = true; } } else { // Assume utf8 is mostly ASCII if (AsciiLikelyListItem(utf8)) { *is_list = true; *starts_idea = true; } int start_letter = utf8[0]; if (IsOpeningPunct(start_letter)) { *starts_idea = true; } if (IsTerminalPunct(start_letter)) { *ends_idea = true; } if (start_letter >= 'A' && start_letter <= 'Z') { *starts_idea = true; } } } // Given the rightmost word of a line either as a Tesseract unicharset + werd // or a utf8 string, set the following attributes for it: // is_list - this word might be a list number or bullet. // starts_idea - this word is likely to start a sentence. // ends_idea - this word is likely to end a sentence. void RightWordAttributes(const UNICHARSET *unicharset, const WERD_CHOICE *werd, const STRING &utf8, bool *is_list, bool *starts_idea, bool *ends_idea) { *is_list = false; *starts_idea = false; *ends_idea = false; if (utf8.size() == 0 || (werd != NULL && werd->length() == 0)) { // Empty *ends_idea = true; return; } if (unicharset && werd) { // We have a proper werd and unicharset so use it. if (UniLikelyListItem(unicharset, werd)) { *is_list = true; *starts_idea = true; } UNICHAR_ID last_letter = werd->unichar_id(werd->length() - 1); if (unicharset->get_ispunctuation(last_letter)) { *ends_idea = true; } } else { // Assume utf8 is mostly ASCII if (AsciiLikelyListItem(utf8)) { *is_list = true; *starts_idea = true; } int last_letter = utf8[utf8.size() - 1]; if (IsOpeningPunct(last_letter) || IsTerminalPunct(last_letter)) { *ends_idea = true; } } } // =============== Implementation of RowScratchRegisters ===================== /* static */ void RowScratchRegisters::AppendDebugHeaderFields( GenericVector<STRING> *header) { header->push_back("[lmarg,lind;rind,rmarg]"); header->push_back("model"); } void RowScratchRegisters::AppendDebugInfo(const ParagraphTheory &theory, GenericVector<STRING> *dbg) const { char s[30]; snprintf(s, sizeof(s), "[%3d,%3d;%3d,%3d]", lmargin_, lindent_, rindent_, rmargin_); dbg->push_back(s); STRING model_string; model_string += static_cast<char>(GetLineType()); model_string += ":"; int model_numbers = 0; for (int h = 0; h < hypotheses_.size(); h++) { if (hypotheses_[h].model == NULL) continue; if (model_numbers > 0) model_string += ","; if (StrongModel(hypotheses_[h].model)) { model_string += StrOf(1 + theory.IndexOf(hypotheses_[h].model)); } else if (hypotheses_[h].model == kCrownLeft) { model_string += "CrL"; } else if (hypotheses_[h].model == kCrownRight) { model_string += "CrR"; } model_numbers++; } if (model_numbers == 0) model_string += "0"; dbg->push_back(model_string); } void RowScratchRegisters::Init(const RowInfo &row) { ri_ = &row; lmargin_ = 0; lindent_ = row.pix_ldistance; rmargin_ = 0; rindent_ = row.pix_rdistance; } LineType RowScratchRegisters::GetLineType() const { if (hypotheses_.empty()) return LT_UNKNOWN; bool has_start = false; bool has_body = false; for (int i = 0; i < hypotheses_.size(); i++) { switch (hypotheses_[i].ty) { case LT_START: has_start = true; break; case LT_BODY: has_body = true; break; default: tprintf("Encountered bad value in hypothesis list: %c\n", hypotheses_[i].ty); break; } } if (has_start && has_body) return LT_MULTIPLE; return has_start ? LT_START : LT_BODY; } LineType RowScratchRegisters::GetLineType(const ParagraphModel *model) const { if (hypotheses_.empty()) return LT_UNKNOWN; bool has_start = false; bool has_body = false; for (int i = 0; i < hypotheses_.size(); i++) { if (hypotheses_[i].model != model) continue; switch (hypotheses_[i].ty) { case LT_START: has_start = true; break; case LT_BODY: has_body = true; break; default: tprintf("Encountered bad value in hypothesis list: %c\n", hypotheses_[i].ty); break; } } if (has_start && has_body) return LT_MULTIPLE; return has_start ? LT_START : LT_BODY; } void RowScratchRegisters::SetStartLine() { LineType current_lt = GetLineType(); if (current_lt != LT_UNKNOWN && current_lt != LT_START) { tprintf("Trying to set a line to be START when it's already BODY.\n"); } if (current_lt == LT_UNKNOWN || current_lt == LT_BODY) { hypotheses_.push_back_new(LineHypothesis(LT_START, NULL)); } } void RowScratchRegisters::SetBodyLine() { LineType current_lt = GetLineType(); if (current_lt != LT_UNKNOWN && current_lt != LT_BODY) { tprintf("Trying to set a line to be BODY when it's already START.\n"); } if (current_lt == LT_UNKNOWN || current_lt == LT_START) { hypotheses_.push_back_new(LineHypothesis(LT_BODY, NULL)); } } void RowScratchRegisters::AddStartLine(const ParagraphModel *model) { hypotheses_.push_back_new(LineHypothesis(LT_START, model)); int old_idx = hypotheses_.get_index(LineHypothesis(LT_START, NULL)); if (old_idx >= 0) hypotheses_.remove(old_idx); } void RowScratchRegisters::AddBodyLine(const ParagraphModel *model) { hypotheses_.push_back_new(LineHypothesis(LT_BODY, model)); int old_idx = hypotheses_.get_index(LineHypothesis(LT_BODY, NULL)); if (old_idx >= 0) hypotheses_.remove(old_idx); } void RowScratchRegisters::StartHypotheses(SetOfModels *models) const { for (int h = 0; h < hypotheses_.size(); h++) { if (hypotheses_[h].ty == LT_START && StrongModel(hypotheses_[h].model)) models->push_back_new(hypotheses_[h].model); } } void RowScratchRegisters::StrongHypotheses(SetOfModels *models) const { for (int h = 0; h < hypotheses_.size(); h++) { if (StrongModel(hypotheses_[h].model)) models->push_back_new(hypotheses_[h].model); } } void RowScratchRegisters::NonNullHypotheses(SetOfModels *models) const { for (int h = 0; h < hypotheses_.size(); h++) { if (hypotheses_[h].model != NULL) models->push_back_new(hypotheses_[h].model); } } const ParagraphModel *RowScratchRegisters::UniqueStartHypothesis() const { if (hypotheses_.size() != 1 || hypotheses_[0].ty != LT_START) return NULL; return hypotheses_[0].model; } const ParagraphModel *RowScratchRegisters::UniqueBodyHypothesis() const { if (hypotheses_.size() != 1 || hypotheses_[0].ty != LT_BODY) return NULL; return hypotheses_[0].model; } // Discard any hypotheses whose model is not in the given list. void RowScratchRegisters::DiscardNonMatchingHypotheses( const SetOfModels &models) { if (models.empty()) return; for (int h = hypotheses_.size() - 1; h >= 0; h--) { if (!models.contains(hypotheses_[h].model)) { hypotheses_.remove(h); } } } // ============ Geometry based Paragraph Detection Algorithm ================= struct Cluster { Cluster() : center(0), count(0) {} Cluster(int cen, int num) : center(cen), count(num) {} int center; // The center of the cluster. int count; // The number of entries within the cluster. }; class SimpleClusterer { public: explicit SimpleClusterer(int max_cluster_width) : max_cluster_width_(max_cluster_width) {} void Add(int value) { values_.push_back(value); } int size() const { return values_.size(); } void GetClusters(GenericVector<Cluster> *clusters); private: int max_cluster_width_; GenericVectorEqEq<int> values_; }; // Return the index of the cluster closest to value. int ClosestCluster(const GenericVector<Cluster> &clusters, int value) { int best_index = 0; for (int i = 0; i < clusters.size(); i++) { if (abs(value - clusters[i].center) < abs(value - clusters[best_index].center)) best_index = i; } return best_index; } void SimpleClusterer::GetClusters(GenericVector<Cluster> *clusters) { clusters->clear(); values_.sort(); for (int i = 0; i < values_.size();) { int orig_i = i; int lo = values_[i]; int hi = lo; while (++i < values_.size() && values_[i] <= lo + max_cluster_width_) { hi = values_[i]; } clusters->push_back(Cluster((hi + lo) / 2, i - orig_i)); } } // Calculate left- and right-indent tab stop values seen in // rows[row_start, row_end) given a tolerance of tolerance. void CalculateTabStops(GenericVector<RowScratchRegisters> *rows, int row_start, int row_end, int tolerance, GenericVector<Cluster> *left_tabs, GenericVector<Cluster> *right_tabs) { if (!AcceptableRowArgs(0, 1, __func__, rows, row_start, row_end)) return; // First pass: toss all left and right indents into clusterers. SimpleClusterer initial_lefts(tolerance); SimpleClusterer initial_rights(tolerance); GenericVector<Cluster> initial_left_tabs; GenericVector<Cluster> initial_right_tabs; for (int i = row_start; i < row_end; i++) { initial_lefts.Add((*rows)[i].lindent_); initial_rights.Add((*rows)[i].rindent_); } initial_lefts.GetClusters(&initial_left_tabs); initial_rights.GetClusters(&initial_right_tabs); // Second pass: cluster only lines that are not "stray" // An example of a stray line is a page number -- a line whose start // and end tab-stops are far outside the typical start and end tab-stops // for the block. // Put another way, we only cluster data from lines whose start or end // tab stop is frequent. SimpleClusterer lefts(tolerance); SimpleClusterer rights(tolerance); // Outlier elimination. We might want to switch this to test outlier-ness // based on how strange a position an outlier is in instead of or in addition // to how rare it is. These outliers get re-added if we end up having too // few tab stops, to work with, however. int infrequent_enough_to_ignore = 0; if (row_end - row_start >= 8) infrequent_enough_to_ignore = 1; if (row_end - row_start >= 20) infrequent_enough_to_ignore = 2; for (int i = row_start; i < row_end; i++) { int lidx = ClosestCluster(initial_left_tabs, (*rows)[i].lindent_); int ridx = ClosestCluster(initial_right_tabs, (*rows)[i].rindent_); if (initial_left_tabs[lidx].count > infrequent_enough_to_ignore || initial_right_tabs[ridx].count > infrequent_enough_to_ignore) { lefts.Add((*rows)[i].lindent_); rights.Add((*rows)[i].rindent_); } } lefts.GetClusters(left_tabs); rights.GetClusters(right_tabs); if ((left_tabs->size() == 1 && right_tabs->size() >= 4) || (right_tabs->size() == 1 && left_tabs->size() >= 4)) { // One side is really ragged, and the other only has one tab stop, // so those "insignificant outliers" are probably important, actually. // This often happens on a page of an index. Add back in the ones // we omitted in the first pass. for (int i = row_start; i < row_end; i++) { int lidx = ClosestCluster(initial_left_tabs, (*rows)[i].lindent_); int ridx = ClosestCluster(initial_right_tabs, (*rows)[i].rindent_); if (!(initial_left_tabs[lidx].count > infrequent_enough_to_ignore || initial_right_tabs[ridx].count > infrequent_enough_to_ignore)) { lefts.Add((*rows)[i].lindent_); rights.Add((*rows)[i].rindent_); } } } lefts.GetClusters(left_tabs); rights.GetClusters(right_tabs); // If one side is almost a two-indent aligned side, and the other clearly // isn't, try to prune out the least frequent tab stop from that side. if (left_tabs->size() == 3 && right_tabs->size() >= 4) { int to_prune = -1; for (int i = left_tabs->size() - 1; i >= 0; i--) { if (to_prune < 0 || (*left_tabs)[i].count < (*left_tabs)[to_prune].count) { to_prune = i; } } if (to_prune >= 0 && (*left_tabs)[to_prune].count <= infrequent_enough_to_ignore) { left_tabs->remove(to_prune); } } if (right_tabs->size() == 3 && left_tabs->size() >= 4) { int to_prune = -1; for (int i = right_tabs->size() - 1; i >= 0; i--) { if (to_prune < 0 || (*right_tabs)[i].count < (*right_tabs)[to_prune].count) { to_prune = i; } } if (to_prune >= 0 && (*right_tabs)[to_prune].count <= infrequent_enough_to_ignore) { right_tabs->remove(to_prune); } } } // Given a paragraph model mark rows[row_start, row_end) as said model // start or body lines. // // Case 1: model->first_indent_ != model->body_indent_ // Differentiating the paragraph start lines from the paragraph body lines in // this case is easy, we just see how far each line is indented. // // Case 2: model->first_indent_ == model->body_indent_ // Here, we find end-of-paragraph lines by looking for "short lines." // What constitutes a "short line" changes depending on whether the text // ragged-right[left] or fully justified (aligned left and right). // // Case 2a: Ragged Right (or Left) text. (eop_threshold == 0) // We have a new paragraph it the first word would have at the end // of the previous line. // // Case 2b: Fully Justified. (eop_threshold > 0) // We mark a line as short (end of paragraph) if the offside indent // is greater than eop_threshold. void MarkRowsWithModel(GenericVector<RowScratchRegisters> *rows, int row_start, int row_end, const ParagraphModel *model, bool ltr, int eop_threshold) { if (!AcceptableRowArgs(0, 0, __func__, rows, row_start, row_end)) return; for (int row = row_start; row < row_end; row++) { bool valid_first = ValidFirstLine(rows, row, model); bool valid_body = ValidBodyLine(rows, row, model); if (valid_first && !valid_body) { (*rows)[row].AddStartLine(model); } else if (valid_body && !valid_first) { (*rows)[row].AddBodyLine(model); } else if (valid_body && valid_first) { bool after_eop = (row == row_start); if (row > row_start) { if (eop_threshold > 0) { if (model->justification() == JUSTIFICATION_LEFT) { after_eop = (*rows)[row - 1].rindent_ > eop_threshold; } else { after_eop = (*rows)[row - 1].lindent_ > eop_threshold; } } else { after_eop = FirstWordWouldHaveFit((*rows)[row - 1], (*rows)[row], model->justification()); } } if (after_eop) { (*rows)[row].AddStartLine(model); } else { (*rows)[row].AddBodyLine(model); } } else { // Do nothing. Stray row. } } } // GeometricClassifierState holds all of the information we'll use while // trying to determine a paragraph model for the text lines in a block of // text: // + the rows under consideration [row_start, row_end) // + the common left- and right-indent tab stops // + does the block start out left-to-right or right-to-left // Further, this struct holds the data we amass for the (single) ParagraphModel // we'll assign to the text lines (assuming we get that far). struct GeometricClassifierState { GeometricClassifierState(int dbg_level, GenericVector<RowScratchRegisters> *r, int r_start, int r_end) : debug_level(dbg_level), rows(r), row_start(r_start), row_end(r_end), margin(0) { tolerance = InterwordSpace(*r, r_start, r_end); CalculateTabStops(r, r_start, r_end, tolerance, &left_tabs, &right_tabs); if (debug_level >= 3) { tprintf("Geometry: TabStop cluster tolerance = %d; " "%d left tabs; %d right tabs\n", tolerance, left_tabs.size(), right_tabs.size()); } ltr = (*r)[r_start].ri_->ltr; } void AssumeLeftJustification() { just = tesseract::JUSTIFICATION_LEFT; margin = (*rows)[row_start].lmargin_; } void AssumeRightJustification() { just = tesseract::JUSTIFICATION_RIGHT; margin = (*rows)[row_start].rmargin_; } // Align tabs are the tab stops the text is aligned to. const GenericVector<Cluster> &AlignTabs() const { if (just == tesseract::JUSTIFICATION_RIGHT) return right_tabs; return left_tabs; } // Offside tabs are the tab stops opposite the tabs used to align the text. // // Note that for a left-to-right text which is aligned to the right such as // this function comment, the offside tabs are the horizontal tab stops // marking the beginning of ("Note", "this" and "marking"). const GenericVector<Cluster> &OffsideTabs() const { if (just == tesseract::JUSTIFICATION_RIGHT) return left_tabs; return right_tabs; } // Return whether the i'th row extends from the leftmost left tab stop // to the right most right tab stop. bool IsFullRow(int i) const { return ClosestCluster(left_tabs, (*rows)[i].lindent_) == 0 && ClosestCluster(right_tabs, (*rows)[i].rindent_) == 0; } int AlignsideTabIndex(int row_idx) const { return ClosestCluster(AlignTabs(), (*rows)[row_idx].AlignsideIndent(just)); } // Given what we know about the paragraph justification (just), would the // first word of row_b have fit at the end of row_a? bool FirstWordWouldHaveFit(int row_a, int row_b) { return ::tesseract::FirstWordWouldHaveFit( (*rows)[row_a], (*rows)[row_b], just); } void PrintRows() const { PrintRowRange(*rows, row_start, row_end); } void Fail(int min_debug_level, const char *why) const { if (debug_level < min_debug_level) return; tprintf("# %s\n", why); PrintRows(); } ParagraphModel Model() const { return ParagraphModel(just, margin, first_indent, body_indent, tolerance); } // We print out messages with a debug level at least as great as debug_level. int debug_level; // The Geometric Classifier was asked to find a single paragraph model // to fit the text rows (*rows)[row_start, row_end) GenericVector<RowScratchRegisters> *rows; int row_start; int row_end; // The amount by which we expect the text edge can vary and still be aligned. int tolerance; // Is the script in this text block left-to-right? // HORRIBLE ROUGH APPROXIMATION. TODO(eger): Improve bool ltr; // These left and right tab stops were determined to be the common tab // stops for the given text. GenericVector<Cluster> left_tabs; GenericVector<Cluster> right_tabs; // These are parameters we must determine to create a ParagraphModel. tesseract::ParagraphJustification just; int margin; int first_indent; int body_indent; // eop_threshold > 0 if the text is fully justified. See MarkRowsWithModel() int eop_threshold; }; // Given a section of text where strong textual clues did not help identifying // paragraph breaks, and for which the left and right indents have exactly // three tab stops between them, attempt to find the paragraph breaks based // solely on the outline of the text and whether the script is left-to-right. // // Algorithm Detail: // The selected rows are in the form of a rectangle except // for some number of "short lines" of the same length: // // (A1) xxxxxxxxxxxxx (B1) xxxxxxxxxxxx // xxxxxxxxxxx xxxxxxxxxx # A "short" line. // xxxxxxxxxxxxx xxxxxxxxxxxx // xxxxxxxxxxxxx xxxxxxxxxxxx // // We have a slightly different situation if the only short // line is at the end of the excerpt. // // (A2) xxxxxxxxxxxxx (B2) xxxxxxxxxxxx // xxxxxxxxxxxxx xxxxxxxxxxxx // xxxxxxxxxxxxx xxxxxxxxxxxx // xxxxxxxxxxx xxxxxxxxxx # A "short" line. // // We'll interpret these as follows based on the reasoning in the comment for // GeometricClassify(): // [script direction: first indent, body indent] // (A1) LtR: 2,0 RtL: 0,0 (B1) LtR: 0,0 RtL: 2,0 // (A2) LtR: 2,0 RtL: CrR (B2) LtR: CrL RtL: 2,0 void GeometricClassifyThreeTabStopTextBlock( int debug_level, GeometricClassifierState &s, ParagraphTheory *theory) { int num_rows = s.row_end - s.row_start; int num_full_rows = 0; int last_row_full = 0; for (int i = s.row_start; i < s.row_end; i++) { if (s.IsFullRow(i)) { num_full_rows++; if (i == s.row_end - 1) last_row_full++; } } if (num_full_rows < 0.7 * num_rows) { s.Fail(1, "Not enough full lines to know which lines start paras."); return; } // eop_threshold gets set if we're fully justified; see MarkRowsWithModel() s.eop_threshold = 0; if (s.ltr) { s.AssumeLeftJustification(); } else { s.AssumeRightJustification(); } if (debug_level > 0) { tprintf("# Not enough variety for clear outline classification. " "Guessing these are %s aligned based on script.\n", s.ltr ? "left" : "right"); s.PrintRows(); } if (s.AlignTabs().size() == 2) { // case A1 or A2 s.first_indent = s.AlignTabs()[1].center; s.body_indent = s.AlignTabs()[0].center; } else { // case B1 or B2 if (num_rows - 1 == num_full_rows - last_row_full) { // case B2 const ParagraphModel *model = s.ltr ? kCrownLeft : kCrownRight; (*s.rows)[s.row_start].AddStartLine(model); for (int i = s.row_start + 1; i < s.row_end; i++) { (*s.rows)[i].AddBodyLine(model); } return; } else { // case B1 s.first_indent = s.body_indent = s.AlignTabs()[0].center; s.eop_threshold = (s.OffsideTabs()[0].center + s.OffsideTabs()[1].center) / 2; } } const ParagraphModel *model = theory->AddModel(s.Model()); MarkRowsWithModel(s.rows, s.row_start, s.row_end, model, s.ltr, s.eop_threshold); return; } // This function is called if strong textual clues were not available, but // the caller hopes that the paragraph breaks will be super obvious just // by the outline of the text. // // The particularly difficult case is figuring out what's going on if you // don't have enough short paragraph end lines to tell us what's going on. // // For instance, let's say you have the following outline: // // (A1) xxxxxxxxxxxxxxxxxxxxxx // xxxxxxxxxxxxxxxxxxxx // xxxxxxxxxxxxxxxxxxxxxx // xxxxxxxxxxxxxxxxxxxxxx // // Even if we know that the text is left-to-right and so will probably be // left-aligned, both of the following are possible texts: // // (A1a) 1. Here our list item // with two full lines. // 2. Here a second item. // 3. Here our third one. // // (A1b) so ends paragraph one. // Here starts another // paragraph we want to // read. This continues // // These examples are obvious from the text and should have been caught // by the StrongEvidenceClassify pass. However, for languages where we don't // have capital letters to go on (e.g. Hebrew, Arabic, Hindi, Chinese), // it's worth guessing that (A1b) is the correct interpretation if there are // far more "full" lines than "short" lines. void GeometricClassify(int debug_level, GenericVector<RowScratchRegisters> *rows, int row_start, int row_end, ParagraphTheory *theory) { if (!AcceptableRowArgs(debug_level, 4, __func__, rows, row_start, row_end)) return; if (debug_level > 1) { tprintf("###############################################\n"); tprintf("##### GeometricClassify( rows[%d:%d) ) ####\n", row_start, row_end); tprintf("###############################################\n"); } RecomputeMarginsAndClearHypotheses(rows, row_start, row_end, 10); GeometricClassifierState s(debug_level, rows, row_start, row_end); if (s.left_tabs.size() > 2 && s.right_tabs.size() > 2) { s.Fail(2, "Too much variety for simple outline classification."); return; } if (s.left_tabs.size() <= 1 && s.right_tabs.size() <= 1) { s.Fail(1, "Not enough variety for simple outline classification."); return; } if (s.left_tabs.size() + s.right_tabs.size() == 3) { GeometricClassifyThreeTabStopTextBlock(debug_level, s, theory); return; } // At this point, we know that one side has at least two tab stops, and the // other side has one or two tab stops. // Left to determine: // (1) Which is the body indent and which is the first line indent? // (2) Is the text fully justified? // If one side happens to have three or more tab stops, assume that side // is opposite of the aligned side. if (s.right_tabs.size() > 2) { s.AssumeLeftJustification(); } else if (s.left_tabs.size() > 2) { s.AssumeRightJustification(); } else if (s.ltr) { // guess based on script direction s.AssumeLeftJustification(); } else { s.AssumeRightJustification(); } if (s.AlignTabs().size() == 2) { // For each tab stop on the aligned side, how many of them appear // to be paragraph start lines? [first lines] int firsts[2] = {0, 0}; // Count the first line as a likely paragraph start line. firsts[s.AlignsideTabIndex(s.row_start)]++; // For each line, if the first word would have fit on the previous // line count it as a likely paragraph start line. bool jam_packed = true; for (int i = s.row_start + 1; i < s.row_end; i++) { if (s.FirstWordWouldHaveFit(i - 1, i)) { firsts[s.AlignsideTabIndex(i)]++; jam_packed = false; } } // Make an extra accounting for the last line of the paragraph just // in case it's the only short line in the block. That is, take its // first word as typical and see if this looks like the *last* line // of a paragraph. If so, mark the *other* indent as probably a first. if (jam_packed && s.FirstWordWouldHaveFit(s.row_end - 1, s.row_end - 1)) { firsts[1 - s.AlignsideTabIndex(s.row_end - 1)]++; } int percent0firsts, percent1firsts; percent0firsts = (100 * firsts[0]) / s.AlignTabs()[0].count; percent1firsts = (100 * firsts[1]) / s.AlignTabs()[1].count; // TODO(eger): Tune these constants if necessary. if ((percent0firsts < 20 && 30 < percent1firsts) || percent0firsts + 30 < percent1firsts) { s.first_indent = s.AlignTabs()[1].center; s.body_indent = s.AlignTabs()[0].center; } else if ((percent1firsts < 20 && 30 < percent0firsts) || percent1firsts + 30 < percent0firsts) { s.first_indent = s.AlignTabs()[0].center; s.body_indent = s.AlignTabs()[1].center; } else { // Ambiguous! Probably lineated (poetry) if (debug_level > 1) { tprintf("# Cannot determine %s indent likely to start paragraphs.\n", s.just == tesseract::JUSTIFICATION_LEFT ? "left" : "right"); tprintf("# Indent of %d looks like a first line %d%% of the time.\n", s.AlignTabs()[0].center, percent0firsts); tprintf("# Indent of %d looks like a first line %d%% of the time.\n", s.AlignTabs()[1].center, percent1firsts); s.PrintRows(); } return; } } else { // There's only one tab stop for the "aligned to" side. s.first_indent = s.body_indent = s.AlignTabs()[0].center; } // At this point, we have our model. const ParagraphModel *model = theory->AddModel(s.Model()); // Now all we have to do is figure out if the text is fully justified or not. // eop_threshold: default to fully justified unless we see evidence below. // See description on MarkRowsWithModel() s.eop_threshold = (s.OffsideTabs()[0].center + s.OffsideTabs()[1].center) / 2; // If the text is not fully justified, re-set the eop_threshold to 0. if (s.AlignTabs().size() == 2) { // Paragraphs with a paragraph-start indent. for (int i = s.row_start; i < s.row_end - 1; i++) { if (ValidFirstLine(s.rows, i + 1, model) && !NearlyEqual(s.OffsideTabs()[0].center, (*s.rows)[i].OffsideIndent(s.just), s.tolerance)) { // We found a non-end-of-paragraph short line: not fully justified. s.eop_threshold = 0; break; } } } else { // Paragraphs with no paragraph-start indent. for (int i = s.row_start; i < s.row_end - 1; i++) { if (!s.FirstWordWouldHaveFit(i, i + 1) && !NearlyEqual(s.OffsideTabs()[0].center, (*s.rows)[i].OffsideIndent(s.just), s.tolerance)) { // We found a non-end-of-paragraph short line: not fully justified. s.eop_threshold = 0; break; } } } MarkRowsWithModel(rows, row_start, row_end, model, s.ltr, s.eop_threshold); } // =============== Implementation of ParagraphTheory ===================== const ParagraphModel *ParagraphTheory::AddModel(const ParagraphModel &model) { for (int i = 0; i < models_->size(); i++) { if ((*models_)[i]->Comparable(model)) return (*models_)[i]; } ParagraphModel *m = new ParagraphModel(model); models_->push_back(m); models_we_added_.push_back_new(m); return m; } void ParagraphTheory::DiscardUnusedModels(const SetOfModels &used_models) { for (int i = models_->size() - 1; i >= 0; i--) { ParagraphModel *m = (*models_)[i]; if (!used_models.contains(m) && models_we_added_.contains(m)) { models_->remove(i); models_we_added_.remove(models_we_added_.get_index(m)); delete m; } } } // Examine rows[start, end) and try to determine if an existing non-centered // paragraph model would fit them perfectly. If so, return a pointer to it. // If not, return NULL. const ParagraphModel *ParagraphTheory::Fits( const GenericVector<RowScratchRegisters> *rows, int start, int end) const { for (int m = 0; m < models_->size(); m++) { const ParagraphModel *model = (*models_)[m]; if (model->justification() != JUSTIFICATION_CENTER && RowsFitModel(rows, start, end, model)) return model; } return NULL; } void ParagraphTheory::NonCenteredModels(SetOfModels *models) { for (int m = 0; m < models_->size(); m++) { const ParagraphModel *model = (*models_)[m]; if (model->justification() != JUSTIFICATION_CENTER) models->push_back_new(model); } } int ParagraphTheory::IndexOf(const ParagraphModel *model) const { for (int i = 0; i < models_->size(); i++) { if ((*models_)[i] == model) return i; } return -1; } bool ValidFirstLine(const GenericVector<RowScratchRegisters> *rows, int row, const ParagraphModel *model) { if (!StrongModel(model)) { tprintf("ValidFirstLine() should only be called with strong models!\n"); } return StrongModel(model) && model->ValidFirstLine( (*rows)[row].lmargin_, (*rows)[row].lindent_, (*rows)[row].rindent_, (*rows)[row].rmargin_); } bool ValidBodyLine(const GenericVector<RowScratchRegisters> *rows, int row, const ParagraphModel *model) { if (!StrongModel(model)) { tprintf("ValidBodyLine() should only be called with strong models!\n"); } return StrongModel(model) && model->ValidBodyLine( (*rows)[row].lmargin_, (*rows)[row].lindent_, (*rows)[row].rindent_, (*rows)[row].rmargin_); } bool CrownCompatible(const GenericVector<RowScratchRegisters> *rows, int a, int b, const ParagraphModel *model) { if (model != kCrownRight && model != kCrownLeft) { tprintf("CrownCompatible() should only be called with crown models!\n"); return false; } RowScratchRegisters &row_a = (*rows)[a]; RowScratchRegisters &row_b = (*rows)[b]; if (model == kCrownRight) { return NearlyEqual(row_a.rindent_ + row_a.rmargin_, row_b.rindent_ + row_b.rmargin_, Epsilon(row_a.ri_->average_interword_space)); } return NearlyEqual(row_a.lindent_ + row_a.lmargin_, row_b.lindent_ + row_b.lmargin_, Epsilon(row_a.ri_->average_interword_space)); } // =============== Implementation of ParagraphModelSmearer ==================== ParagraphModelSmearer::ParagraphModelSmearer( GenericVector<RowScratchRegisters> *rows, int row_start, int row_end, ParagraphTheory *theory) : theory_(theory), rows_(rows), row_start_(row_start), row_end_(row_end) { if (!AcceptableRowArgs(0, 0, __func__, rows, row_start, row_end)) { row_start_ = 0; row_end_ = 0; return; } SetOfModels no_models; for (int row = row_start - 1; row <= row_end; row++) { open_models_.push_back(no_models); } } // see paragraphs_internal.h void ParagraphModelSmearer::CalculateOpenModels(int row_start, int row_end) { SetOfModels no_models; if (row_start < row_start_) row_start = row_start_; if (row_end > row_end_) row_end = row_end_; for (int row = (row_start > 0) ? row_start - 1 : row_start; row < row_end; row++) { if ((*rows_)[row].ri_->num_words == 0) { OpenModels(row + 1) = no_models; } else { SetOfModels &opened = OpenModels(row); (*rows_)[row].StartHypotheses(&opened); // Which models survive the transition from row to row + 1? SetOfModels still_open; for (int m = 0; m < opened.size(); m++) { if (ValidFirstLine(rows_, row, opened[m]) || ValidBodyLine(rows_, row, opened[m])) { // This is basic filtering; we check likely paragraph starty-ness down // below in Smear() -- you know, whether the first word would have fit // and such. still_open.push_back_new(opened[m]); } } OpenModels(row + 1) = still_open; } } } // see paragraphs_internal.h void ParagraphModelSmearer::Smear() { CalculateOpenModels(row_start_, row_end_); // For each row which we're unsure about (that is, it is LT_UNKNOWN or // we have multiple LT_START hypotheses), see if there's a model that // was recently used (an "open" model) which might model it well. for (int i = row_start_; i < row_end_; i++) { RowScratchRegisters &row = (*rows_)[i]; if (row.ri_->num_words == 0) continue; // Step One: // Figure out if there are "open" models which are left-alined or // right-aligned. This is important for determining whether the // "first" word in a row would fit at the "end" of the previous row. bool left_align_open = false; bool right_align_open = false; for (int m = 0; m < OpenModels(i).size(); m++) { switch (OpenModels(i)[m]->justification()) { case JUSTIFICATION_LEFT: left_align_open = true; break; case JUSTIFICATION_RIGHT: right_align_open = true; break; default: left_align_open = right_align_open = true; } } // Step Two: // Use that knowledge to figure out if this row is likely to // start a paragraph. bool likely_start; if (i == 0) { likely_start = true; } else { if ((left_align_open && right_align_open) || (!left_align_open && !right_align_open)) { likely_start = LikelyParagraphStart((*rows_)[i - 1], row, JUSTIFICATION_LEFT) || LikelyParagraphStart((*rows_)[i - 1], row, JUSTIFICATION_RIGHT); } else if (left_align_open) { likely_start = LikelyParagraphStart((*rows_)[i - 1], row, JUSTIFICATION_LEFT); } else { likely_start = LikelyParagraphStart((*rows_)[i - 1], row, JUSTIFICATION_RIGHT); } } // Step Three: // If this text line seems like an obvious first line of an // open model, or an obvious continuation of an existing // modelled paragraph, mark it up. if (likely_start) { // Add Start Hypotheses for all Open models that fit. for (int m = 0; m < OpenModels(i).size(); m++) { if (ValidFirstLine(rows_, i, OpenModels(i)[m])) { row.AddStartLine(OpenModels(i)[m]); } } } else { // Add relevant body line hypotheses. SetOfModels last_line_models; if (i > 0) { (*rows_)[i - 1].StrongHypotheses(&last_line_models); } else { theory_->NonCenteredModels(&last_line_models); } for (int m = 0; m < last_line_models.size(); m++) { const ParagraphModel *model = last_line_models[m]; if (ValidBodyLine(rows_, i, model)) row.AddBodyLine(model); } } // Step Four: // If we're still quite unsure about this line, go through all // models in our theory and see if this row could be the start // of any of our models. if (row.GetLineType() == LT_UNKNOWN || (row.GetLineType() == LT_START && !row.UniqueStartHypothesis())) { SetOfModels all_models; theory_->NonCenteredModels(&all_models); for (int m = 0; m < all_models.size(); m++) { if (ValidFirstLine(rows_, i, all_models[m])) { row.AddStartLine(all_models[m]); } } } // Step Five: // Since we may have updated the hypotheses about this row, we need // to recalculate the Open models for the rest of rows[i + 1, row_end) if (row.GetLineType() != LT_UNKNOWN) { CalculateOpenModels(i + 1, row_end_); } } } // ================ Main Paragraph Detection Algorithm ======================= // Find out what ParagraphModels are actually used, and discard any // that are not. void DiscardUnusedModels(const GenericVector<RowScratchRegisters> &rows, ParagraphTheory *theory) { SetOfModels used_models; for (int i = 0; i < rows.size(); i++) { rows[i].StrongHypotheses(&used_models); } theory->DiscardUnusedModels(used_models); } // DowngradeWeakestToCrowns: // Forget any flush-{left, right} models unless we see two or more // of them in sequence. // // In pass 3, we start to classify even flush-left paragraphs (paragraphs // where the first line and body indent are the same) as having proper Models. // This is generally dangerous, since if you start imagining that flush-left // is a typical paragraph model when it is not, it will lead you to chop normal // indented paragraphs in the middle whenever a sentence happens to start on a // new line (see "This" above). What to do? // What we do is to take any paragraph which is flush left and is not // preceded by another paragraph of the same model and convert it to a "Crown" // paragraph. This is a weak pseudo-ParagraphModel which is a placeholder // for later. It means that the paragraph is flush, but it would be desirable // to mark it as the same model as following text if it fits. This downgrade // FlushLeft -> CrownLeft -> Model of following paragraph. Means that we // avoid making flush left Paragraph Models whenever we see a top-of-the-page // half-of-a-paragraph. and instead we mark it the same as normal body text. // // Implementation: // // Comb backwards through the row scratch registers, and turn any // sequences of body lines of equivalent type abutted against the beginning // or a body or start line of a different type into a crown paragraph. void DowngradeWeakestToCrowns(int debug_level, ParagraphTheory *theory, GenericVector<RowScratchRegisters> *rows) { int start; for (int end = rows->size(); end > 0; end = start) { // Search back for a body line of a unique type. const ParagraphModel *model = NULL; while (end > 0 && (model = (*rows)[end - 1].UniqueBodyHypothesis()) == NULL) { end--; } if (end == 0) break; start = end - 1; while (start >= 0 && (*rows)[start].UniqueBodyHypothesis() == model) { start--; // walk back to the first line that is not the same body type. } if (start >= 0 && (*rows)[start].UniqueStartHypothesis() == model && StrongModel(model) && NearlyEqual(model->first_indent(), model->body_indent(), model->tolerance())) { start--; } start++; // Now rows[start, end) is a sequence of unique body hypotheses of model. if (StrongModel(model) && model->justification() == JUSTIFICATION_CENTER) continue; if (!StrongModel(model)) { while (start > 0 && CrownCompatible(rows, start - 1, start, model)) start--; } if (start == 0 || (!StrongModel(model)) || (StrongModel(model) && !ValidFirstLine(rows, start - 1, model))) { // crownify rows[start, end) const ParagraphModel *crown_model = model; if (StrongModel(model)) { if (model->justification() == JUSTIFICATION_LEFT) crown_model = kCrownLeft; else crown_model = kCrownRight; } (*rows)[start].SetUnknown(); (*rows)[start].AddStartLine(crown_model); for (int row = start + 1; row < end; row++) { (*rows)[row].SetUnknown(); (*rows)[row].AddBodyLine(crown_model); } } } DiscardUnusedModels(*rows, theory); } // Clear all hypotheses about lines [start, end) and reset margins. // // The empty space between the left of a row and the block boundary (and // similarly for the right) is split into two pieces: margin and indent. // In initial processing, we assume the block is tight and the margin for // all lines is set to zero. However, if our first pass does not yield // models for everything, it may be due to an inset paragraph like a // block-quote. In that case, we make a second pass over that unmarked // section of the page and reset the "margin" portion of the empty space // to the common amount of space at the ends of the lines under consid- // eration. This would be equivalent to percentile set to 0. However, // sometimes we have a single character sticking out in the right margin // of a text block (like the 'r' in 'for' on line 3 above), and we can // really just ignore it as an outlier. To express this, we allow the // user to specify the percentile (0..100) of indent values to use as // the common margin for each row in the run of rows[start, end). void RecomputeMarginsAndClearHypotheses( GenericVector<RowScratchRegisters> *rows, int start, int end, int percentile) { if (!AcceptableRowArgs(0, 0, __func__, rows, start, end)) return; int lmin, lmax, rmin, rmax; lmin = lmax = (*rows)[start].lmargin_ + (*rows)[start].lindent_; rmin = rmax = (*rows)[start].rmargin_ + (*rows)[start].rindent_; for (int i = start; i < end; i++) { RowScratchRegisters &sr = (*rows)[i]; sr.SetUnknown(); if (sr.ri_->num_words == 0) continue; UpdateRange(sr.lmargin_ + sr.lindent_, &lmin, &lmax); UpdateRange(sr.rmargin_ + sr.rindent_, &rmin, &rmax); } STATS lefts(lmin, lmax + 1); STATS rights(rmin, rmax + 1); for (int i = start; i < end; i++) { RowScratchRegisters &sr = (*rows)[i]; if (sr.ri_->num_words == 0) continue; lefts.add(sr.lmargin_ + sr.lindent_, 1); rights.add(sr.rmargin_ + sr.rindent_, 1); } int ignorable_left = lefts.ile(ClipToRange(percentile, 0, 100) / 100.0); int ignorable_right = rights.ile(ClipToRange(percentile, 0, 100) / 100.0); for (int i = start; i < end; i++) { RowScratchRegisters &sr = (*rows)[i]; int ldelta = ignorable_left - sr.lmargin_; sr.lmargin_ += ldelta; sr.lindent_ -= ldelta; int rdelta = ignorable_right - sr.rmargin_; sr.rmargin_ += rdelta; sr.rindent_ -= rdelta; } } // Return the median inter-word space in rows[row_start, row_end). int InterwordSpace(const GenericVector<RowScratchRegisters> &rows, int row_start, int row_end) { if (row_end < row_start + 1) return 1; int word_height = (rows[row_start].ri_->lword_box.height() + rows[row_end - 1].ri_->lword_box.height()) / 2; int word_width = (rows[row_start].ri_->lword_box.width() + rows[row_end - 1].ri_->lword_box.width()) / 2; STATS spacing_widths(0, 5 + word_width); for (int i = row_start; i < row_end; i++) { if (rows[i].ri_->num_words > 1) { spacing_widths.add(rows[i].ri_->average_interword_space, 1); } } int minimum_reasonable_space = word_height / 3; if (minimum_reasonable_space < 2) minimum_reasonable_space = 2; int median = spacing_widths.median(); return (median > minimum_reasonable_space) ? median : minimum_reasonable_space; } // Return whether the first word on the after line can fit in the space at // the end of the before line (knowing which way the text is aligned and read). bool FirstWordWouldHaveFit(const RowScratchRegisters &before, const RowScratchRegisters &after, tesseract::ParagraphJustification justification) { if (before.ri_->num_words == 0 || after.ri_->num_words == 0) return true; if (justification == JUSTIFICATION_UNKNOWN) { tprintf("Don't call FirstWordWouldHaveFit(r, s, JUSTIFICATION_UNKNOWN).\n"); } int available_space; if (justification == JUSTIFICATION_CENTER) { available_space = before.lindent_ + before.rindent_; } else { available_space = before.OffsideIndent(justification); } available_space -= before.ri_->average_interword_space; if (before.ri_->ltr) return after.ri_->lword_box.width() < available_space; return after.ri_->rword_box.width() < available_space; } // Return whether the first word on the after line can fit in the space at // the end of the before line (not knowing which way the text goes) in a left // or right alignemnt. bool FirstWordWouldHaveFit(const RowScratchRegisters &before, const RowScratchRegisters &after) { if (before.ri_->num_words == 0 || after.ri_->num_words == 0) return true; int available_space = before.lindent_; if (before.rindent_ > available_space) available_space = before.rindent_; available_space -= before.ri_->average_interword_space; if (before.ri_->ltr) return after.ri_->lword_box.width() < available_space; return after.ri_->rword_box.width() < available_space; } bool TextSupportsBreak(const RowScratchRegisters &before, const RowScratchRegisters &after) { if (before.ri_->ltr) { return before.ri_->rword_likely_ends_idea && after.ri_->lword_likely_starts_idea; } else { return before.ri_->lword_likely_ends_idea && after.ri_->rword_likely_starts_idea; } } bool LikelyParagraphStart(const RowScratchRegisters &before, const RowScratchRegisters &after) { return before.ri_->num_words == 0 || (FirstWordWouldHaveFit(before, after) && TextSupportsBreak(before, after)); } bool LikelyParagraphStart(const RowScratchRegisters &before, const RowScratchRegisters &after, tesseract::ParagraphJustification j) { return before.ri_->num_words == 0 || (FirstWordWouldHaveFit(before, after, j) && TextSupportsBreak(before, after)); } // Examine rows[start, end) and try to determine what sort of ParagraphModel // would fit them as a single paragraph. // If we can't produce a unique model justification_ = JUSTIFICATION_UNKNOWN. // If the rows given could be a consistent start to a paragraph, set *consistent // true. ParagraphModel InternalParagraphModelByOutline( const GenericVector<RowScratchRegisters> *rows, int start, int end, int tolerance, bool *consistent) { int ltr_line_count = 0; for (int i = start; i < end; i++) { ltr_line_count += static_cast<int>((*rows)[i].ri_->ltr); } bool ltr = (ltr_line_count >= (end - start) / 2); *consistent = true; if (!AcceptableRowArgs(0, 2, __func__, rows, start, end)) return ParagraphModel(); // Ensure the caller only passed us a region with a common rmargin and // lmargin. int lmargin = (*rows)[start].lmargin_; int rmargin = (*rows)[start].rmargin_; int lmin, lmax, rmin, rmax, cmin, cmax; lmin = lmax = (*rows)[start + 1].lindent_; rmin = rmax = (*rows)[start + 1].rindent_; cmin = cmax = 0; for (int i = start + 1; i < end; i++) { if ((*rows)[i].lmargin_ != lmargin || (*rows)[i].rmargin_ != rmargin) { tprintf("Margins don't match! Software error.\n"); *consistent = false; return ParagraphModel(); } UpdateRange((*rows)[i].lindent_, &lmin, &lmax); UpdateRange((*rows)[i].rindent_, &rmin, &rmax); UpdateRange((*rows)[i].rindent_ - (*rows)[i].lindent_, &cmin, &cmax); } int ldiff = lmax - lmin; int rdiff = rmax - rmin; int cdiff = cmax - cmin; if (rdiff > tolerance && ldiff > tolerance) { if (cdiff < tolerance * 2) { if (end - start < 3) return ParagraphModel(); return ParagraphModel(JUSTIFICATION_CENTER, 0, 0, 0, tolerance); } *consistent = false; return ParagraphModel(); } if (end - start < 3) // Don't return a model for two line paras. return ParagraphModel(); // These booleans keep us from saying something is aligned left when the body // left variance is too large. bool body_admits_left_alignment = ldiff < tolerance; bool body_admits_right_alignment = rdiff < tolerance; ParagraphModel left_model = ParagraphModel(JUSTIFICATION_LEFT, lmargin, (*rows)[start].lindent_, (lmin + lmax) / 2, tolerance); ParagraphModel right_model = ParagraphModel(JUSTIFICATION_RIGHT, rmargin, (*rows)[start].rindent_, (rmin + rmax) / 2, tolerance); // These booleans keep us from having an indent on the "wrong side" for the // first line. bool text_admits_left_alignment = ltr || left_model.is_flush(); bool text_admits_right_alignment = !ltr || right_model.is_flush(); // At least one of the edges is less than tolerance in variance. // If the other is obviously ragged, it can't be the one aligned to. // [Note the last line is included in this raggedness.] if (tolerance < rdiff) { if (body_admits_left_alignment && text_admits_left_alignment) return left_model; *consistent = false; return ParagraphModel(); } if (tolerance < ldiff) { if (body_admits_right_alignment && text_admits_right_alignment) return right_model; *consistent = false; return ParagraphModel(); } // At this point, we know the body text doesn't vary much on either side. // If the first line juts out oddly in one direction or the other, // that likely indicates the side aligned to. int first_left = (*rows)[start].lindent_; int first_right = (*rows)[start].rindent_; if (ltr && body_admits_left_alignment && (first_left < lmin || first_left > lmax)) return left_model; if (!ltr && body_admits_right_alignment && (first_right < rmin || first_right > rmax)) return right_model; *consistent = false; return ParagraphModel(); } // Examine rows[start, end) and try to determine what sort of ParagraphModel // would fit them as a single paragraph. If nothing fits, // justification_ = JUSTIFICATION_UNKNOWN and print the paragraph to debug // output if we're debugging. ParagraphModel ParagraphModelByOutline( int debug_level, const GenericVector<RowScratchRegisters> *rows, int start, int end, int tolerance) { bool unused_consistent; ParagraphModel retval = InternalParagraphModelByOutline( rows, start, end, tolerance, &unused_consistent); if (debug_level >= 2 && retval.justification() == JUSTIFICATION_UNKNOWN) { tprintf("Could not determine a model for this paragraph:\n"); PrintRowRange(*rows, start, end); } return retval; } // Do rows[start, end) form a single instance of the given paragraph model? bool RowsFitModel(const GenericVector<RowScratchRegisters> *rows, int start, int end, const ParagraphModel *model) { if (!AcceptableRowArgs(0, 1, __func__, rows, start, end)) return false; if (!ValidFirstLine(rows, start, model)) return false; for (int i = start + 1 ; i < end; i++) { if (!ValidBodyLine(rows, i, model)) return false; } return true; } // Examine rows[row_start, row_end) as an independent section of text, // and mark rows that are exceptionally clear as start-of-paragraph // and paragraph-body lines. // // We presume that any lines surrounding rows[row_start, row_end) may // have wildly different paragraph models, so we don't key any data off // of those lines. // // We only take the very strongest signals, as we don't want to get // confused and marking up centered text, poetry, or source code as // clearly part of a typical paragraph. void MarkStrongEvidence(GenericVector<RowScratchRegisters> *rows, int row_start, int row_end) { // Record patently obvious body text. for (int i = row_start + 1; i < row_end; i++) { const RowScratchRegisters &prev = (*rows)[i - 1]; RowScratchRegisters &curr = (*rows)[i]; tesseract::ParagraphJustification typical_justification = prev.ri_->ltr ? JUSTIFICATION_LEFT : JUSTIFICATION_RIGHT; if (!curr.ri_->rword_likely_starts_idea && !curr.ri_->lword_likely_starts_idea && !FirstWordWouldHaveFit(prev, curr, typical_justification)) { curr.SetBodyLine(); } } // Record patently obvious start paragraph lines. // // It's an extremely good signal of the start of a paragraph that // the first word would have fit on the end of the previous line. // However, applying just that signal would have us mark random // start lines of lineated text (poetry and source code) and some // centered headings as paragraph start lines. Therefore, we use // a second qualification for a paragraph start: Not only should // the first word of this line have fit on the previous line, // but also, this line should go full to the right of the block, // disallowing a subsequent word from having fit on this line. // First row: { RowScratchRegisters &curr = (*rows)[row_start]; RowScratchRegisters &next = (*rows)[row_start + 1]; tesseract::ParagraphJustification j = curr.ri_->ltr ? JUSTIFICATION_LEFT : JUSTIFICATION_RIGHT; if (curr.GetLineType() == LT_UNKNOWN && !FirstWordWouldHaveFit(curr, next, j) && (curr.ri_->lword_likely_starts_idea || curr.ri_->rword_likely_starts_idea)) { curr.SetStartLine(); } } // Middle rows for (int i = row_start + 1; i < row_end - 1; i++) { RowScratchRegisters &prev = (*rows)[i - 1]; RowScratchRegisters &curr = (*rows)[i]; RowScratchRegisters &next = (*rows)[i + 1]; tesseract::ParagraphJustification j = curr.ri_->ltr ? JUSTIFICATION_LEFT : JUSTIFICATION_RIGHT; if (curr.GetLineType() == LT_UNKNOWN && !FirstWordWouldHaveFit(curr, next, j) && LikelyParagraphStart(prev, curr, j)) { curr.SetStartLine(); } } // Last row { // the short circuit at the top means we have at least two lines. RowScratchRegisters &prev = (*rows)[row_end - 2]; RowScratchRegisters &curr = (*rows)[row_end - 1]; tesseract::ParagraphJustification j = curr.ri_->ltr ? JUSTIFICATION_LEFT : JUSTIFICATION_RIGHT; if (curr.GetLineType() == LT_UNKNOWN && !FirstWordWouldHaveFit(curr, curr, j) && LikelyParagraphStart(prev, curr, j)) { curr.SetStartLine(); } } } // Look for sequences of a start line followed by some body lines in // rows[row_start, row_end) and create ParagraphModels for them if // they seem coherent. void ModelStrongEvidence(int debug_level, GenericVector<RowScratchRegisters> *rows, int row_start, int row_end, bool allow_flush_models, ParagraphTheory *theory) { if (!AcceptableRowArgs(debug_level, 2, __func__, rows, row_start, row_end)) return; int start = row_start; while (start < row_end) { while (start < row_end && (*rows)[start].GetLineType() != LT_START) start++; if (start >= row_end - 1) break; int tolerance = Epsilon((*rows)[start + 1].ri_->average_interword_space); int end = start; ParagraphModel last_model; bool next_consistent; do { ++end; // rows[row, end) was consistent. // If rows[row, end + 1) is not consistent, // just model rows[row, end) if (end < row_end - 1) { RowScratchRegisters &next = (*rows)[end]; LineType lt = next.GetLineType(); next_consistent = lt == LT_BODY || (lt == LT_UNKNOWN && !FirstWordWouldHaveFit((*rows)[end - 1], (*rows)[end])); } else { next_consistent = false; } if (next_consistent) { ParagraphModel next_model = InternalParagraphModelByOutline( rows, start, end + 1, tolerance, &next_consistent); if (((*rows)[start].ri_->ltr && last_model.justification() == JUSTIFICATION_LEFT && next_model.justification() != JUSTIFICATION_LEFT) || (!(*rows)[start].ri_->ltr && last_model.justification() == JUSTIFICATION_RIGHT && next_model.justification() != JUSTIFICATION_RIGHT)) { next_consistent = false; } last_model = next_model; } else { next_consistent = false; } } while (next_consistent && end < row_end); // At this point, rows[start, end) looked like it could have been a // single paragraph. If we can make a good ParagraphModel for it, // do so and mark this sequence with that model. if (end > start + 1) { // emit a new paragraph if we have more than one line. const ParagraphModel *model = NULL; ParagraphModel new_model = ParagraphModelByOutline( debug_level, rows, start, end, Epsilon(InterwordSpace(*rows, start, end))); if (new_model.justification() == JUSTIFICATION_UNKNOWN) { // couldn't create a good model, oh well. } else if (new_model.is_flush()) { if (end == start + 2) { // It's very likely we just got two paragraph starts in a row. end = start + 1; } else if (start == row_start) { // Mark this as a Crown. if (new_model.justification() == JUSTIFICATION_LEFT) { model = kCrownLeft; } else { model = kCrownRight; } } else if (allow_flush_models) { model = theory->AddModel(new_model); } } else { model = theory->AddModel(new_model); } if (model) { (*rows)[start].AddStartLine(model); for (int i = start + 1; i < end; i++) { (*rows)[i].AddBodyLine(model); } } } start = end; } } // We examine rows[row_start, row_end) and do the following: // (1) Clear all existing hypotheses for the rows being considered. // (2) Mark up any rows as exceptionally likely to be paragraph starts // or paragraph body lines as such using both geometric and textual // clues. // (3) Form models for any sequence of start + continuation lines. // (4) Smear the paragraph models to cover surrounding text. void StrongEvidenceClassify(int debug_level, GenericVector<RowScratchRegisters> *rows, int row_start, int row_end, ParagraphTheory *theory) { if (!AcceptableRowArgs(debug_level, 2, __func__, rows, row_start, row_end)) return; if (debug_level > 1) { tprintf("#############################################\n"); tprintf("# StrongEvidenceClassify( rows[%d:%d) )\n", row_start, row_end); tprintf("#############################################\n"); } RecomputeMarginsAndClearHypotheses(rows, row_start, row_end, 10); MarkStrongEvidence(rows, row_start, row_end); DebugDump(debug_level > 2, "Initial strong signals.", *theory, *rows); // Create paragraph models. ModelStrongEvidence(debug_level, rows, row_start, row_end, false, theory); DebugDump(debug_level > 2, "Unsmeared hypotheses.s.", *theory, *rows); // At this point, some rows are marked up as paragraphs with model numbers, // and some rows are marked up as either LT_START or LT_BODY. Now let's // smear any good paragraph hypotheses forward and backward. ParagraphModelSmearer smearer(rows, row_start, row_end, theory); smearer.Smear(); } void SeparateSimpleLeaderLines(GenericVector<RowScratchRegisters> *rows, int row_start, int row_end, ParagraphTheory *theory) { for (int i = row_start + 1; i < row_end - 1; i++) { if ((*rows)[i - 1].ri_->has_leaders && (*rows)[i].ri_->has_leaders && (*rows)[i + 1].ri_->has_leaders) { const ParagraphModel *model = theory->AddModel( ParagraphModel(JUSTIFICATION_UNKNOWN, 0, 0, 0, 0)); (*rows)[i].AddStartLine(model); } } } // Collect sequences of unique hypotheses in row registers and create proper // paragraphs for them, referencing the paragraphs in row_owners. void ConvertHypothesizedModelRunsToParagraphs( int debug_level, const GenericVector<RowScratchRegisters> &rows, GenericVector<PARA *> *row_owners, ParagraphTheory *theory) { int end = rows.size(); int start; for (; end > 0; end = start) { start = end - 1; const ParagraphModel *model = NULL; // TODO(eger): Be smarter about dealing with multiple hypotheses. bool single_line_paragraph = false; SetOfModels models; rows[start].NonNullHypotheses(&models); if (models.size() > 0) { model = models[0]; if (rows[start].GetLineType(model) != LT_BODY) single_line_paragraph = true; } if (model && !single_line_paragraph) { // walk back looking for more body lines and then a start line. while (--start > 0 && rows[start].GetLineType(model) == LT_BODY) { // do nothing } if (start < 0 || rows[start].GetLineType(model) != LT_START) { model = NULL; } } if (model == NULL) { continue; } // rows[start, end) should be a paragraph. PARA *p = new PARA(); if (model == kCrownLeft || model == kCrownRight) { p->is_very_first_or_continuation = true; // Crown paragraph. // If we can find an existing ParagraphModel that fits, use it, // else create a new one. for (int row = end; row < rows.size(); row++) { if ((*row_owners)[row] && (ValidBodyLine(&rows, start, (*row_owners)[row]->model) && (start == 0 || ValidFirstLine(&rows, start, (*row_owners)[row]->model)))) { model = (*row_owners)[row]->model; break; } } if (model == kCrownLeft) { // No subsequent model fits, so cons one up. model = theory->AddModel(ParagraphModel( JUSTIFICATION_LEFT, rows[start].lmargin_ + rows[start].lindent_, 0, 0, Epsilon(rows[start].ri_->average_interword_space))); } else if (model == kCrownRight) { // No subsequent model fits, so cons one up. model = theory->AddModel(ParagraphModel( JUSTIFICATION_RIGHT, rows[start].rmargin_ + rows[start].rmargin_, 0, 0, Epsilon(rows[start].ri_->average_interword_space))); } } rows[start].SetUnknown(); rows[start].AddStartLine(model); for (int i = start + 1; i < end; i++) { rows[i].SetUnknown(); rows[i].AddBodyLine(model); } p->model = model; p->has_drop_cap = rows[start].ri_->has_drop_cap; p->is_list_item = model->justification() == JUSTIFICATION_RIGHT ? rows[start].ri_->rword_indicates_list_item : rows[start].ri_->lword_indicates_list_item; for (int row = start; row < end; row++) { if ((*row_owners)[row] != NULL) { tprintf("Memory leak! ConvertHypothesizeModelRunsToParagraphs() called " "more than once!\n"); } (*row_owners)[row] = p; } } } struct Interval { Interval() : begin(0), end(0) {} Interval(int b, int e) : begin(b), end(e) {} int begin; int end; }; // Return whether rows[row] appears to be stranded, meaning that the evidence // for this row is very weak due to context. For instance, two lines of source // code may happen to be indented at the same tab vector as body text starts, // leading us to think they are two start-of-paragraph lines. This is not // optimal. However, we also don't want to mark a sequence of short dialog // as "weak," so our heuristic is: // (1) If a line is surrounded by lines of unknown type, it's weak. // (2) If two lines in a row are start lines for a given paragraph type, but // after that the same paragraph type does not continue, they're weak. bool RowIsStranded(const GenericVector<RowScratchRegisters> &rows, int row) { SetOfModels row_models; rows[row].StrongHypotheses(&row_models); for (int m = 0; m < row_models.size(); m++) { bool all_starts = rows[row].GetLineType(); int run_length = 1; bool continues = true; for (int i = row - 1; i >= 0 && continues; i--) { SetOfModels models; rows[i].NonNullHypotheses(&models); switch (rows[i].GetLineType(row_models[m])) { case LT_START: run_length++; break; case LT_MULTIPLE: // explicit fall-through case LT_BODY: run_length++; all_starts = false; break; case LT_UNKNOWN: // explicit fall-through default: continues = false; } } continues = true; for (int i = row + 1; i < rows.size() && continues; i++) { SetOfModels models; rows[i].NonNullHypotheses(&models); switch (rows[i].GetLineType(row_models[m])) { case LT_START: run_length++; break; case LT_MULTIPLE: // explicit fall-through case LT_BODY: run_length++; all_starts = false; break; case LT_UNKNOWN: // explicit fall-through default: continues = false; } } if (run_length > 2 || (!all_starts && run_length > 1)) return false; } return true; } // Go through rows[row_start, row_end) and gather up sequences that need better // classification. // + Sequences of non-empty rows without hypotheses. // + Crown paragraphs not immediately followed by a strongly modeled line. // + Single line paragraphs surrounded by text that doesn't match the // model. void LeftoverSegments(const GenericVector<RowScratchRegisters> &rows, GenericVector<Interval> *to_fix, int row_start, int row_end) { to_fix->clear(); for (int i = row_start; i < row_end; i++) { bool needs_fixing = false; SetOfModels models; SetOfModels models_w_crowns; rows[i].StrongHypotheses(&models); rows[i].NonNullHypotheses(&models_w_crowns); if (models.empty() && models_w_crowns.size() > 0) { // Crown paragraph. Is it followed by a modeled line? for (int end = i + 1; end < rows.size(); end++) { SetOfModels end_models; SetOfModels strong_end_models; rows[end].NonNullHypotheses(&end_models); rows[end].StrongHypotheses(&strong_end_models); if (end_models.size() == 0) { needs_fixing = true; break; } else if (strong_end_models.size() > 0) { needs_fixing = false; break; } } } else if (models.empty() && rows[i].ri_->num_words > 0) { // No models at all. needs_fixing = true; } if (!needs_fixing && !models.empty()) { needs_fixing = RowIsStranded(rows, i); } if (needs_fixing) { if (!to_fix->empty() && to_fix->back().end == i - 1) to_fix->back().end = i; else to_fix->push_back(Interval(i, i)); } } // Convert inclusive intervals to half-open intervals. for (int i = 0; i < to_fix->size(); i++) { (*to_fix)[i].end = (*to_fix)[i].end + 1; } } // Given a set of row_owners pointing to PARAs or NULL (no paragraph known), // normalize each row_owner to point to an actual PARA, and output the // paragraphs in order onto paragraphs. void CanonicalizeDetectionResults( GenericVector<PARA *> *row_owners, PARA_LIST *paragraphs) { GenericVector<PARA *> &rows = *row_owners; paragraphs->clear(); PARA_IT out(paragraphs); PARA *formerly_null = NULL; for (int i = 0; i < rows.size(); i++) { if (rows[i] == NULL) { if (i == 0 || rows[i - 1] != formerly_null) { rows[i] = formerly_null = new PARA(); } else { rows[i] = formerly_null; continue; } } else if (i > 0 && rows[i - 1] == rows[i]) { continue; } out.add_after_then_move(rows[i]); } } // Main entry point for Paragraph Detection Algorithm. // // Given a set of equally spaced textlines (described by row_infos), // Split them into paragraphs. // // Output: // row_owners - one pointer for each row, to the paragraph it belongs to. // paragraphs - this is the actual list of PARA objects. // models - the list of paragraph models referenced by the PARA objects. // caller is responsible for deleting the models. void DetectParagraphs(int debug_level, GenericVector<RowInfo> *row_infos, GenericVector<PARA *> *row_owners, PARA_LIST *paragraphs, GenericVector<ParagraphModel *> *models) { GenericVector<RowScratchRegisters> rows; ParagraphTheory theory(models); // Initialize row_owners to be a bunch of NULL pointers. row_owners->init_to_size(row_infos->size(), NULL); // Set up row scratch registers for the main algorithm. rows.init_to_size(row_infos->size(), RowScratchRegisters()); for (int i = 0; i < row_infos->size(); i++) { rows[i].Init((*row_infos)[i]); } // Pass 1: // Detect sequences of lines that all contain leader dots (.....) // These are likely Tables of Contents. If there are three text lines in // a row with leader dots, it's pretty safe to say the middle one should // be a paragraph of its own. SeparateSimpleLeaderLines(&rows, 0, rows.size(), &theory); DebugDump(debug_level > 1, "End of Pass 1", theory, rows); GenericVector<Interval> leftovers; LeftoverSegments(rows, &leftovers, 0, rows.size()); for (int i = 0; i < leftovers.size(); i++) { // Pass 2a: // Find any strongly evidenced start-of-paragraph lines. If they're // followed by two lines that look like body lines, make a paragraph // model for that and see if that model applies throughout the text // (that is, "smear" it). StrongEvidenceClassify(debug_level, &rows, leftovers[i].begin, leftovers[i].end, &theory); // Pass 2b: // If we had any luck in pass 2a, we got part of the page and didn't // know how to classify a few runs of rows. Take the segments that // didn't find a model and reprocess them individually. GenericVector<Interval> leftovers2; LeftoverSegments(rows, &leftovers2, leftovers[i].begin, leftovers[i].end); bool pass2a_was_useful = leftovers2.size() > 1 || (leftovers2.size() == 1 && (leftovers2[0].begin != 0 || leftovers2[0].end != rows.size())); if (pass2a_was_useful) { for (int j = 0; j < leftovers2.size(); j++) { StrongEvidenceClassify(debug_level, &rows, leftovers2[j].begin, leftovers2[j].end, &theory); } } } DebugDump(debug_level > 1, "End of Pass 2", theory, rows); // Pass 3: // These are the dregs for which we didn't have enough strong textual // and geometric clues to form matching models for. Let's see if // the geometric clues are simple enough that we could just use those. LeftoverSegments(rows, &leftovers, 0, rows.size()); for (int i = 0; i < leftovers.size(); i++) { GeometricClassify(debug_level, &rows, leftovers[i].begin, leftovers[i].end, &theory); } // Undo any flush models for which there's little evidence. DowngradeWeakestToCrowns(debug_level, &theory, &rows); DebugDump(debug_level > 1, "End of Pass 3", theory, rows); // Pass 4: // Take everything that's still not marked up well and clear all markings. LeftoverSegments(rows, &leftovers, 0, rows.size()); for (int i = 0; i < leftovers.size(); i++) { for (int j = leftovers[i].begin; j < leftovers[i].end; j++) { rows[j].SetUnknown(); } } DebugDump(debug_level > 1, "End of Pass 4", theory, rows); // Convert all of the unique hypothesis runs to PARAs. ConvertHypothesizedModelRunsToParagraphs(debug_level, rows, row_owners, &theory); DebugDump(debug_level > 0, "Final Paragraph Segmentation", theory, rows); // Finally, clean up any dangling NULL row paragraph parents. CanonicalizeDetectionResults(row_owners, paragraphs); } // ============ Code interfacing with the rest of Tesseract ================== void InitializeTextAndBoxesPreRecognition(const MutableIterator &it, RowInfo *info) { // Set up text, lword_text, and rword_text (mostly for debug printing). STRING fake_text; PageIterator pit(static_cast<const PageIterator&>(it)); bool first_word = true; if (!pit.Empty(RIL_WORD)) { do { fake_text += "x"; if (first_word) info->lword_text += "x"; info->rword_text += "x"; if (pit.IsAtFinalElement(RIL_WORD, RIL_SYMBOL) && !pit.IsAtFinalElement(RIL_TEXTLINE, RIL_SYMBOL)) { fake_text += " "; info->rword_text = ""; first_word = false; } } while (!pit.IsAtFinalElement(RIL_TEXTLINE, RIL_SYMBOL) && pit.Next(RIL_SYMBOL)); } if (fake_text.size() == 0) return; int lspaces = info->pix_ldistance / info->average_interword_space; for (int i = 0; i < lspaces; i++) { info->text += ' '; } info->text += fake_text; // Set up lword_box, rword_box, and num_words. PAGE_RES_IT page_res_it = *it.PageResIt(); WERD_RES *word_res = page_res_it.restart_row(); ROW_RES *this_row = page_res_it.row(); WERD_RES *lword = NULL; WERD_RES *rword = NULL; info->num_words = 0; do { if (word_res) { if (!lword) lword = word_res; if (rword != word_res) info->num_words++; rword = word_res; } word_res = page_res_it.forward(); } while (page_res_it.row() == this_row); if (lword) info->lword_box = lword->word->bounding_box(); if (rword) info->rword_box = rword->word->bounding_box(); } // Given a Tesseract Iterator pointing to a text line, fill in the paragraph // detector RowInfo with all relevant information from the row. void InitializeRowInfo(bool after_recognition, const MutableIterator &it, RowInfo *info) { if (it.PageResIt()->row() != NULL) { ROW *row = it.PageResIt()->row()->row; info->pix_ldistance = row->lmargin(); info->pix_rdistance = row->rmargin(); info->average_interword_space = row->space() > 0 ? row->space() : MAX(row->x_height(), 1); info->pix_xheight = row->x_height(); info->has_leaders = false; info->has_drop_cap = row->has_drop_cap(); info->ltr = true; // set below depending on word scripts } else { info->pix_ldistance = info->pix_rdistance = 0; info->average_interword_space = 1; info->pix_xheight = 1.0; info->has_leaders = false; info->has_drop_cap = false; info->ltr = true; } info->num_words = 0; info->lword_indicates_list_item = false; info->lword_likely_starts_idea = false; info->lword_likely_ends_idea = false; info->rword_indicates_list_item = false; info->rword_likely_starts_idea = false; info->rword_likely_ends_idea = false; info->has_leaders = false; info->ltr = 1; if (!after_recognition) { InitializeTextAndBoxesPreRecognition(it, info); return; } info->text = ""; char *text = it.GetUTF8Text(RIL_TEXTLINE); int trailing_ws_idx = strlen(text); // strip trailing space while (trailing_ws_idx > 0 && // isspace() only takes ASCII ((text[trailing_ws_idx - 1] & 0x80) == 0) && isspace(text[trailing_ws_idx - 1])) trailing_ws_idx--; if (trailing_ws_idx > 0) { int lspaces = info->pix_ldistance / info->average_interword_space; for (int i = 0; i < lspaces; i++) info->text += ' '; for (int i = 0; i < trailing_ws_idx; i++) info->text += text[i]; } delete []text; if (info->text.size() == 0) { return; } PAGE_RES_IT page_res_it = *it.PageResIt(); GenericVector<WERD_RES *> werds; WERD_RES *word_res = page_res_it.restart_row(); ROW_RES *this_row = page_res_it.row(); int num_leaders = 0; int ltr = 0; int rtl = 0; do { if (word_res && word_res->best_choice->unichar_string().length() > 0) { werds.push_back(word_res); ltr += word_res->AnyLtrCharsInWord() ? 1 : 0; rtl += word_res->AnyRtlCharsInWord() ? 1 : 0; if (word_res->word->flag(W_REP_CHAR)) num_leaders++; } word_res = page_res_it.forward(); } while (page_res_it.row() == this_row); info->ltr = ltr >= rtl; info->has_leaders = num_leaders > 3; info->num_words = werds.size(); if (werds.size() > 0) { WERD_RES *lword = werds[0], *rword = werds[werds.size() - 1]; info->lword_text = lword->best_choice->unichar_string().string(); info->rword_text = rword->best_choice->unichar_string().string(); info->lword_box = lword->word->bounding_box(); info->rword_box = rword->word->bounding_box(); LeftWordAttributes(lword->uch_set, lword->best_choice, info->lword_text, &info->lword_indicates_list_item, &info->lword_likely_starts_idea, &info->lword_likely_ends_idea); RightWordAttributes(rword->uch_set, rword->best_choice, info->rword_text, &info->rword_indicates_list_item, &info->rword_likely_starts_idea, &info->rword_likely_ends_idea); } } // This is called after rows have been identified and words are recognized. // Much of this could be implemented before word recognition, but text helps // to identify bulleted lists and gives good signals for sentence boundaries. void DetectParagraphs(int debug_level, bool after_text_recognition, const MutableIterator *block_start, GenericVector<ParagraphModel *> *models) { // Clear out any preconceived notions. if (block_start->Empty(RIL_TEXTLINE)) { return; } BLOCK *block = block_start->PageResIt()->block()->block; block->para_list()->clear(); bool is_image_block = block->poly_block() && !block->poly_block()->IsText(); // Convert the Tesseract structures to RowInfos // for the paragraph detection algorithm. MutableIterator row(*block_start); if (row.Empty(RIL_TEXTLINE)) return; // end of input already. GenericVector<RowInfo> row_infos; do { if (!row.PageResIt()->row()) continue; // empty row. row.PageResIt()->row()->row->set_para(NULL); row_infos.push_back(RowInfo()); RowInfo &ri = row_infos.back(); InitializeRowInfo(after_text_recognition, row, &ri); } while (!row.IsAtFinalElement(RIL_BLOCK, RIL_TEXTLINE) && row.Next(RIL_TEXTLINE)); // If we're called before text recognition, we might not have // tight block bounding boxes, so trim by the minimum on each side. if (row_infos.size() > 0) { int min_lmargin = row_infos[0].pix_ldistance; int min_rmargin = row_infos[0].pix_rdistance; for (int i = 1; i < row_infos.size(); i++) { if (row_infos[i].pix_ldistance < min_lmargin) min_lmargin = row_infos[i].pix_ldistance; if (row_infos[i].pix_rdistance < min_rmargin) min_rmargin = row_infos[i].pix_rdistance; } if (min_lmargin > 0 || min_rmargin > 0) { for (int i = 0; i < row_infos.size(); i++) { row_infos[i].pix_ldistance -= min_lmargin; row_infos[i].pix_rdistance -= min_rmargin; } } } // Run the paragraph detection algorithm. GenericVector<PARA *> row_owners; GenericVector<PARA *> the_paragraphs; if (!is_image_block) { DetectParagraphs(debug_level, &row_infos, &row_owners, block->para_list(), models); } else { row_owners.init_to_size(row_infos.size(), NULL); CanonicalizeDetectionResults(&row_owners, block->para_list()); } // Now stitch in the row_owners into the rows. row = *block_start; for (int i = 0; i < row_owners.size(); i++) { while (!row.PageResIt()->row()) row.Next(RIL_TEXTLINE); row.PageResIt()->row()->row->set_para(row_owners[i]); row.Next(RIL_TEXTLINE); } } } // namespace
/* * Copyright 2019 Xilinx, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // clang-format off #include "table_dt.hpp" #include "join_kernel.hpp" #include "utils.hpp" // clang-format on #include <unordered_map> #include <iomanip> #include <iostream> #include <fstream> #include <sstream> #include <cstring> #include <sys/time.h> #ifndef HLS_TEST #include <xcl2.hpp> #define XCL_BANK(n) (XCL_MEM_TOPOLOGY | unsigned(n)) typedef struct print_buf_result_data_ { int i; long long* v; long long* g; int* r; } print_buf_result_data_t; void CL_CALLBACK print_buf_result(cl_event event, cl_int cmd_exec_status, void* user_data) { print_buf_result_data_t* d = (print_buf_result_data_t*)user_data; printf("FPGA result %d: %lld.%lld\n", d->i, *(d->v) / 10000, *(d->v) % 10000); if ((*(d->g)) != (*(d->v))) { (*(d->r))++; printf("Golden result %d: %lld.%lld\n", d->i, *(d->g) / 10000, *(d->g) % 10000); } } #endif template <typename T> int generate_data(T* data, int range, size_t n) { if (!data) { return -1; } for (size_t i = 0; i < n; i++) { data[i] = (T)(rand() % range + 1); } return 0; } int64_t get_golden_sum(int l_row, KEY_T* col_l_orderkey, MONEY_T* col_l_extendedprice, MONEY_T* col_l_discount, int o_row, KEY_T* col_o_orderkey) { int64_t sum = 0; int cnt = 0; std::unordered_multimap<uint32_t, uint32_t> ht1; { for (int i = 0; i < o_row; ++i) { uint32_t k = col_o_orderkey[i]; uint32_t p = 0; // insert into hash table ht1.insert(std::make_pair(k, p)); } } // read t once for (int i = 0; i < l_row; ++i) { uint32_t k = col_l_orderkey[i]; uint32_t p = col_l_extendedprice[i]; uint32_t d = col_l_discount[i]; // check hash table auto its = ht1.equal_range(k); for (auto it = its.first; it != its.second; ++it) { sum += (p * (100 - d)); ++cnt; } } std::cout << "INFO: CPU ref matched " << cnt << " rows, sum = " << sum << std::endl; return sum; } int main(int argc, const char* argv[]) { std::cout << "\n------------- Hash-Join Test ----------------\n"; // cmd arg parser. ArgParser parser(argc, argv); std::string mode; std::string xclbin_path; // eg. kernel.xclbin if (parser.getCmdOption("-mode", mode) && mode != "fpga") { std::cout << "ERROR: CPU mode is not available yet.\n"; return 1; } if (!parser.getCmdOption("-xclbin", xclbin_path)) { std::cout << "ERROR: xclbin path is not set!\n"; return 1; } std::string num_str; int num_rep = 1; #ifndef HLS_TEST if (parser.getCmdOption("-rep", num_str)) { try { num_rep = std::stoi(num_str); } catch (...) { num_rep = 1; } } if (num_rep > 20) { num_rep = 20; std::cout << "WARNING: limited repeat to " << num_rep << " times\n."; } #endif int sim_scale = 1; if (parser.getCmdOption("-scale", num_str)) { try { sim_scale = std::stoi(num_str); } catch (...) { sim_scale = 1; } } const int k_bucket = 4; const int ht_hbm_size = 64 / 8 * PU_HT_DEPTH; const int s_hbm_size = 64 / 8 * PU_S_DEPTH; const size_t l_depth = L_MAX_ROW + VEC_LEN - 1; KEY_T* col_l_orderkey = aligned_alloc<KEY_T>(l_depth); MONEY_T* col_l_extendedprice = aligned_alloc<MONEY_T>(l_depth); MONEY_T* col_l_discount = aligned_alloc<MONEY_T>(l_depth); const size_t o_depth = O_MAX_ROW + VEC_LEN - 1; KEY_T* col_o_orderkey = aligned_alloc<KEY_T>(o_depth); MONEY_T* row_result_a = aligned_alloc<MONEY_T>(2); MONEY_T* row_result_b = aligned_alloc<MONEY_T>(2); std::cout << "Data integer width is " << 8 * sizeof(KEY_T) << ".\n"; std::cout << "Host map buffer has been allocated.\n"; int l_nrow = L_MAX_ROW / sim_scale; int o_nrow = O_MAX_ROW / sim_scale; std::cout << "Lineitem " << l_nrow << " rows\nOrders " << o_nrow << "rows" << std::endl; int err; err = generate_data<TPCH_INT>(col_l_orderkey, 100000, l_nrow); if (err) return err; err = generate_data<TPCH_INT>(col_l_extendedprice, 10000000, l_nrow); if (err) return err; err = generate_data<TPCH_INT>(col_l_discount, 10, l_nrow); if (err) return err; std::cout << "Lineitem table has been read from disk\n"; err = generate_data<TPCH_INT>(col_o_orderkey, 100000, o_nrow); if (err) return err; std::cout << "Orders table has been read from disk\n"; long long golden = get_golden_sum(l_nrow, col_l_orderkey, col_l_extendedprice, col_l_discount, o_nrow, col_o_orderkey); const int PU_NM = 8; #ifdef HLS_TEST ap_uint<64>* tb_ht[PU_NM]; ap_uint<64>* tb_s[PU_NM]; for (int i = 0; i < PU_NM; i++) { tb_ht[i] = aligned_alloc<ap_uint<64> >(PU_HT_DEPTH); tb_s[i] = aligned_alloc<ap_uint<64> >(PU_S_DEPTH); } join_kernel((ap_uint<W_TPCH_INT * VEC_LEN>*)col_o_orderkey, o_nrow, (ap_uint<W_TPCH_INT * VEC_LEN>*)col_l_orderkey, (ap_uint<W_TPCH_INT * VEC_LEN>*)col_l_extendedprice, (ap_uint<W_TPCH_INT * VEC_LEN>*)col_l_discount, l_nrow, k_bucket, (ap_uint<64>*)tb_ht[0], (ap_uint<64>*)tb_ht[1], (ap_uint<64>*)tb_ht[2], (ap_uint<64>*)tb_ht[3], (ap_uint<64>*)tb_ht[4], (ap_uint<64>*)tb_ht[5], (ap_uint<64>*)tb_ht[6], (ap_uint<64>*)tb_ht[7], (ap_uint<64>*)tb_s[0], (ap_uint<64>*)tb_s[1], (ap_uint<64>*)tb_s[2], (ap_uint<64>*)tb_s[3], (ap_uint<64>*)tb_s[4], (ap_uint<64>*)tb_s[5], (ap_uint<64>*)tb_s[6], (ap_uint<64>*)tb_s[7], (ap_uint<W_TPCH_INT * 2>*)row_result_a); long long* rv = (long long*)row_result_a; printf("FPGA result: %lld.%lld\n", *rv / 10000, *rv % 10000); #else // Get CL devices. std::vector<cl::Device> devices = xcl::get_xil_devices(); cl::Device device = devices[0]; // Create context and command queue for selected device cl::Context context(device); cl::CommandQueue q(context, device, // CL_QUEUE_PROFILING_ENABLE); CL_QUEUE_PROFILING_ENABLE | CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE); std::string devName = device.getInfo<CL_DEVICE_NAME>(); std::cout << "Selected Device " << devName << "\n"; cl::Program::Binaries xclBins = xcl::import_binary_file(xclbin_path); devices.resize(1); cl::Program program(context, devices, xclBins); cl::Kernel kernel0(program, "join_kernel"); // XXX must match std::cout << "Kernel has been created\n"; cl_mem_ext_ptr_t mext_o_orderkey = {0, col_o_orderkey, kernel0()}; cl_mem_ext_ptr_t mext_l_orderkey = {2, col_l_orderkey, kernel0()}; cl_mem_ext_ptr_t mext_l_extendedprice = {3, col_l_extendedprice, kernel0()}; cl_mem_ext_ptr_t mext_l_discount = {4, col_l_discount, kernel0()}; cl_mem_ext_ptr_t mext_result_a = {23, row_result_a, kernel0()}; cl_mem_ext_ptr_t mext_result_b = {23, row_result_b, kernel0()}; // Map buffers // a cl::Buffer buf_l_orderkey_a(context, CL_MEM_EXT_PTR_XILINX | CL_MEM_USE_HOST_PTR | CL_MEM_READ_ONLY, (size_t)(KEY_SZ * l_depth), &mext_l_orderkey); cl::Buffer buf_l_extendedprice_a(context, CL_MEM_EXT_PTR_XILINX | CL_MEM_USE_HOST_PTR | CL_MEM_READ_ONLY, (size_t)(MONEY_SZ * l_depth), &mext_l_extendedprice); cl::Buffer buf_l_discout_a(context, CL_MEM_EXT_PTR_XILINX | CL_MEM_USE_HOST_PTR | CL_MEM_READ_ONLY, (size_t)(MONEY_SZ * l_depth), &mext_l_discount); cl::Buffer buf_o_orderkey_a(context, CL_MEM_EXT_PTR_XILINX | CL_MEM_USE_HOST_PTR | CL_MEM_READ_ONLY, (size_t)(KEY_SZ * o_depth), &mext_o_orderkey); cl::Buffer buf_result_a(context, CL_MEM_EXT_PTR_XILINX | CL_MEM_USE_HOST_PTR | CL_MEM_WRITE_ONLY, (size_t)(MONEY_SZ * 2), &mext_result_a); // b (need to copy input) cl::Buffer buf_l_orderkey_b(context, CL_MEM_EXT_PTR_XILINX | CL_MEM_COPY_HOST_PTR | CL_MEM_READ_ONLY, (size_t)(KEY_SZ * l_depth), &mext_l_orderkey); cl::Buffer buf_l_extendedprice_b(context, CL_MEM_EXT_PTR_XILINX | CL_MEM_COPY_HOST_PTR | CL_MEM_READ_ONLY, (size_t)(MONEY_SZ * l_depth), &mext_l_extendedprice); cl::Buffer buf_l_discout_b(context, CL_MEM_EXT_PTR_XILINX | CL_MEM_COPY_HOST_PTR | CL_MEM_READ_ONLY, (size_t)(MONEY_SZ * l_depth), &mext_l_discount); cl::Buffer buf_o_orderkey_b(context, CL_MEM_EXT_PTR_XILINX | CL_MEM_COPY_HOST_PTR | CL_MEM_READ_ONLY, (size_t)(KEY_SZ * o_depth), &mext_o_orderkey); cl::Buffer buf_result_b(context, CL_MEM_EXT_PTR_XILINX | CL_MEM_USE_HOST_PTR | CL_MEM_WRITE_ONLY, (size_t)(MONEY_SZ * 2), &mext_result_b); cl::Buffer buf_ht[PU_NM]; cl::Buffer buf_s[PU_NM]; std::vector<cl::Memory> tb; for (int i = 0; i < PU_NM; i++) { // even cl_mem_ext_ptr_t me_ht = {0}; me_ht.banks = XCL_BANK(i * 4); buf_ht[i] = cl::Buffer(context, CL_MEM_READ_WRITE | CL_MEM_EXT_PTR_XILINX, (size_t)ht_hbm_size, &me_ht); tb.push_back(buf_ht[i]); // odd cl_mem_ext_ptr_t me_s = {0}; me_s.banks = XCL_BANK(i * 4 + 2); buf_s[i] = cl::Buffer(context, CL_MEM_READ_WRITE | CL_MEM_EXT_PTR_XILINX, (size_t)s_hbm_size, &me_s); tb.push_back(buf_s[i]); } q.enqueueMigrateMemObjects(tb, CL_MIGRATE_MEM_OBJECT_CONTENT_UNDEFINED, nullptr, nullptr); q.finish(); std::cout << "DDR buffers have been mapped/copy-and-mapped\n"; struct timeval tv0; int exec_us; gettimeofday(&tv0, 0); std::vector<std::vector<cl::Event> > write_events(num_rep); std::vector<std::vector<cl::Event> > kernel_events(num_rep); std::vector<std::vector<cl::Event> > read_events(num_rep); for (int i = 0; i < num_rep; ++i) { write_events[i].resize(1); kernel_events[i].resize(1); read_events[i].resize(1); } /* * W0-. W1----. W2-. W3-. * '-K0--. '-K1-/-. '-K2-/-. '-K3---. * '---R0- '---R1- '---R2 '--R3 */ std::vector<print_buf_result_data_t> cbd(num_rep); std::vector<print_buf_result_data_t>::iterator it = cbd.begin(); print_buf_result_data_t* cbd_ptr = &(*it); int ret = 0; for (int i = 0; i < num_rep; ++i) { int use_a = i & 1; // write data to DDR std::vector<cl::Memory> ib; if (use_a) { ib.push_back(buf_o_orderkey_a); ib.push_back(buf_l_orderkey_a); ib.push_back(buf_l_extendedprice_a); ib.push_back(buf_l_discout_a); } else { ib.push_back(buf_o_orderkey_b); ib.push_back(buf_l_orderkey_b); ib.push_back(buf_l_extendedprice_b); ib.push_back(buf_l_discout_b); } if (i > 1) { q.enqueueMigrateMemObjects(ib, 0, &read_events[i - 2], &write_events[i][0]); } else { q.enqueueMigrateMemObjects(ib, 0, nullptr, &write_events[i][0]); } // set args and enqueue kernel if (use_a) { int j = 0; kernel0.setArg(j++, buf_o_orderkey_a); kernel0.setArg(j++, o_nrow); kernel0.setArg(j++, buf_l_orderkey_a); kernel0.setArg(j++, buf_l_extendedprice_a); kernel0.setArg(j++, buf_l_discout_a); kernel0.setArg(j++, l_nrow); kernel0.setArg(j++, k_bucket); kernel0.setArg(j++, buf_ht[0]); kernel0.setArg(j++, buf_ht[1]); kernel0.setArg(j++, buf_ht[2]); kernel0.setArg(j++, buf_ht[3]); kernel0.setArg(j++, buf_ht[4]); kernel0.setArg(j++, buf_ht[5]); kernel0.setArg(j++, buf_ht[6]); kernel0.setArg(j++, buf_ht[7]); kernel0.setArg(j++, buf_s[0]); kernel0.setArg(j++, buf_s[1]); kernel0.setArg(j++, buf_s[2]); kernel0.setArg(j++, buf_s[3]); kernel0.setArg(j++, buf_s[4]); kernel0.setArg(j++, buf_s[5]); kernel0.setArg(j++, buf_s[6]); kernel0.setArg(j++, buf_s[7]); kernel0.setArg(j++, buf_result_a); } else { int j = 0; kernel0.setArg(j++, buf_o_orderkey_b); kernel0.setArg(j++, o_nrow); kernel0.setArg(j++, buf_l_orderkey_b); kernel0.setArg(j++, buf_l_extendedprice_b); kernel0.setArg(j++, buf_l_discout_b); kernel0.setArg(j++, l_nrow); kernel0.setArg(j++, k_bucket); kernel0.setArg(j++, buf_ht[0]); kernel0.setArg(j++, buf_ht[1]); kernel0.setArg(j++, buf_ht[2]); kernel0.setArg(j++, buf_ht[3]); kernel0.setArg(j++, buf_ht[4]); kernel0.setArg(j++, buf_ht[5]); kernel0.setArg(j++, buf_ht[6]); kernel0.setArg(j++, buf_ht[7]); kernel0.setArg(j++, buf_s[0]); kernel0.setArg(j++, buf_s[1]); kernel0.setArg(j++, buf_s[2]); kernel0.setArg(j++, buf_s[3]); kernel0.setArg(j++, buf_s[4]); kernel0.setArg(j++, buf_s[5]); kernel0.setArg(j++, buf_s[6]); kernel0.setArg(j++, buf_s[7]); kernel0.setArg(j++, buf_result_b); } q.enqueueTask(kernel0, &write_events[i], &kernel_events[i][0]); // read data from DDR std::vector<cl::Memory> ob; if (use_a) { ob.push_back(buf_result_a); } else { ob.push_back(buf_result_b); } q.enqueueMigrateMemObjects(ob, CL_MIGRATE_MEM_OBJECT_HOST, &kernel_events[i], &read_events[i][0]); if (use_a) { cbd_ptr[i].i = i; cbd_ptr[i].v = (long long*)row_result_a; cbd_ptr[i].g = &golden; cbd_ptr[i].r = &ret; read_events[i][0].setCallback(CL_COMPLETE, print_buf_result, cbd_ptr + i); } else { cbd_ptr[i].i = i; cbd_ptr[i].v = (long long*)row_result_b; cbd_ptr[i].g = &golden; cbd_ptr[i].r = &ret; read_events[i][0].setCallback(CL_COMPLETE, print_buf_result, cbd_ptr + i); } } // wait all to finish. q.flush(); q.finish(); struct timeval tv3; gettimeofday(&tv3, 0); exec_us = tvdiff(&tv0, &tv3); std::cout << "FPGA execution time of " << num_rep << " runs: " << exec_us << " usec\n" << "Average execution per run: " << exec_us / num_rep << " usec\n"; for (int i = 0; i < num_rep; ++i) { cl_ulong ts, te; kernel_events[i][0].getProfilingInfo(CL_PROFILING_COMMAND_START, &ts); kernel_events[i][0].getProfilingInfo(CL_PROFILING_COMMAND_END, &te); unsigned long t = (te - ts) / 1000; printf("INFO: kernel %d: execution time %lu usec\n", i, t); } #endif std::cout << "---------------------------------------------\n\n"; return ret; }
.global s_prepare_buffers s_prepare_buffers: push %r13 push %r14 push %r8 push %r9 push %rbp push %rcx push %rdi push %rsi lea addresses_A_ht+0x83e7, %r14 nop nop nop nop nop inc %rdi movl $0x61626364, (%r14) nop nop nop nop nop and %rdi, %rdi lea addresses_WT_ht+0xbea7, %r9 cmp %rsi, %rsi mov (%r9), %rbp nop nop nop nop nop xor $55610, %rsi lea addresses_D_ht+0x13ee7, %rcx nop add $62103, %r8 mov $0x6162636465666768, %r14 movq %r14, %xmm2 vmovups %ymm2, (%rcx) nop nop mfence lea addresses_D_ht+0x168c7, %rbp nop nop nop nop sub %rsi, %rsi movups (%rbp), %xmm1 vpextrq $1, %xmm1, %r8 nop nop nop nop nop cmp $5279, %rbp lea addresses_D_ht+0x9447, %rsi lea addresses_UC_ht+0x434, %rdi xor %r13, %r13 mov $4, %rcx rep movsl nop nop sub %rsi, %rsi lea addresses_WT_ht+0x175e7, %r9 nop nop nop nop sub %r13, %r13 mov $0x6162636465666768, %r14 movq %r14, (%r9) nop cmp $1307, %rdi pop %rsi pop %rdi pop %rcx pop %rbp pop %r9 pop %r8 pop %r14 pop %r13 ret .global s_faulty_load s_faulty_load: push %r12 push %r8 push %r9 push %rbp push %rcx push %rdi push %rsi // Store lea addresses_normal+0x144c7, %rsi nop nop nop nop sub %r12, %r12 movb $0x51, (%rsi) nop nop nop and $32400, %rcx // Store lea addresses_PSE+0x17697, %r12 nop nop nop nop nop and $22861, %rdi movl $0x51525354, (%r12) nop nop nop nop nop and $5935, %rcx // Faulty Load lea addresses_UC+0x178c7, %rdi nop dec %rbp mov (%rdi), %rsi lea oracles, %r8 and $0xff, %rsi shlq $12, %rsi mov (%r8,%rsi,1), %rsi pop %rsi pop %rdi pop %rcx pop %rbp pop %r9 pop %r8 pop %r12 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'size': 8, 'NT': False, 'type': 'addresses_UC', 'same': False, 'AVXalign': False, 'congruent': 0}} {'OP': 'STOR', 'dst': {'size': 1, 'NT': False, 'type': 'addresses_normal', 'same': False, 'AVXalign': False, 'congruent': 10}} {'OP': 'STOR', 'dst': {'size': 4, 'NT': False, 'type': 'addresses_PSE', 'same': False, 'AVXalign': False, 'congruent': 4}} [Faulty Load] {'OP': 'LOAD', 'src': {'size': 8, 'NT': False, 'type': 'addresses_UC', 'same': True, 'AVXalign': False, 'congruent': 0}} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'size': 4, 'NT': False, 'type': 'addresses_A_ht', 'same': False, 'AVXalign': False, 'congruent': 5}} {'OP': 'LOAD', 'src': {'size': 8, 'NT': False, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': False, 'congruent': 5}} {'OP': 'STOR', 'dst': {'size': 32, 'NT': False, 'type': 'addresses_D_ht', 'same': False, 'AVXalign': False, 'congruent': 1}} {'OP': 'LOAD', 'src': {'size': 16, 'NT': False, 'type': 'addresses_D_ht', 'same': False, 'AVXalign': False, 'congruent': 8}} {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_D_ht', 'congruent': 4}, 'dst': {'same': False, 'type': 'addresses_UC_ht', 'congruent': 0}} {'OP': 'STOR', 'dst': {'size': 8, 'NT': False, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': True, '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 */
// Assembler: KickAssembler 4.4 // source: http://codebase64.org/doku.php?id=base:16bit_addition_and_subtraction .var num1lo = $62 .var num1hi = $63 .var num2lo = $64 .var num2hi = $65 .var reslo = $66 .var reshi = $67 .var delta = $68 // 16-bit addition zero page add16: clc lda num1lo adc num2lo sta reslo lda num1hi adc num2hi sta reshi rts // 16-bit subtraction zero page sub16: sec lda num1lo sbc num2lo sta reslo lda num1hi sbc num2hi sta reshi rts // add 8-bit constant to 16-bit number add8_16: clc lda num1lo adc #40 // the constant sta num1lo bcc !ok+ inc num1hi !ok: rts // add signed 8-bit to 16-bit number // source: http://codebase64.org/doku.php?id=base:signed_8bit_16bit_addition ldx #$00 // implied high byte of delta lda delta // the signed 8-bit number bpl !l+ dex // high byte becomes $ff to reflect negative delta !l: clc adc num1lo // normal 16-bit addition sta num1lo txa adc num1hi sta num1hi
;; ;; Copyright (c) 2018, Intel Corporation ;; ;; Redistribution and use in source and binary forms, with or without ;; modification, are permitted provided that the following conditions are met: ;; ;; * Redistributions of source code must retain the above copyright notice, ;; this list of conditions and the following disclaimer. ;; * 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. ;; * Neither the name of Intel Corporation nor the names of its contributors ;; may be used to endorse or promote products derived from this software ;; without specific prior written permission. ;; ;; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" ;; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ;; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ;; DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE ;; FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL ;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR ;; SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER ;; CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, ;; OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ;; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ;; %define AES_CBC_ENC_X4 aes_cbc_enc_192_x4 %define SUBMIT_JOB_AES_ENC submit_job_aes192_enc_sse_no_aesni %include "mb_mgr_aes_submit_sse.asm"
#include <Energia.h> #include "device.h" #include "pinchange.h" static Port *d[2]; #pragma vector=PORT1_VECTOR __interrupt void port1(void) { if (d[0]) d[0]->ready(); __bic_SR_register_on_exit(LPM4_bits | GIE); } #pragma vector=PORT2_VECTOR __interrupt void port2(void) { if (d[1]) d[1]->ready(); __bic_SR_register_on_exit(LPM4_bits | GIE); } void Port::ready() { volatile byte *ifg, *ies; byte v = 0; if (_port == P1) { ifg = &P1IFG; ies = &P1IES; v = P1IN; } else if (_port == P2) { ifg = &P2IFG; ies = &P2IES; v = P2IN; } else return; for (int i = 0; i < 8; i++) { byte b = bit(i); // deal with the interrupt here whether the device // is enabled or not: ensure the next edge trigger // remains consistent with its current state // (i.e., don't just toggle it as in the examples). if (*ifg & b) { if (_enabled & b) _pins[i]->set_state((v & b) != 0); if (_pins[i]->is_high()) *ies |= b; // next trigger on hi->lo else *ies &= ~b; // next trigger on lo->hi *ifg &= ~b; } } } void Port::add_pin(int pin, Pin *p) { byte b = digitalPinToBitMask(pin); _pins[bit_index(b)] = p; if (!_port) _port = digitalPinToPort(pin); if (_port == P1) d[0] = this; else if (_port == P2) d[1] = this; } void Port::enable_pin(int pin, bool enable) { byte b = digitalPinToBitMask(pin); byte v = 0; volatile byte *ie, *ifg, *ies; if (_port == P1) { ie = &P1IE; ifg = &P1IFG; ies = &P1IES; v = P1IN; } else if (_port == P2) { ie = &P2IE; ifg = &P2IFG; ies = &P2IES; v = P2IN; } else return; if (enable) { _enabled |= b; *ie |= b; bool on = (v & b) != 0; if (on) *ies |= b; else *ies &= ~b; _pins[bit_index(b)]->set_state(on); } else { _enabled &= ~b; *ie &= ~b; } *ifg &= ~b; }
WardensHouse_Object: db $17 ; border block def_warps warp 4, 7, 3, LAST_MAP warp 5, 7, 3, LAST_MAP def_signs sign 4, 3, 4 ; FuchsiaHouse2Text4 sign 5, 3, 5 ; FuchsiaHouse2Text5 def_objects object SPRITE_WARDEN, 2, 3, STAY, NONE, 1 ; person object SPRITE_POKE_BALL, 8, 3, STAY, NONE, 2, RARE_CANDY object SPRITE_BOULDER, 8, 4, STAY, BOULDER_MOVEMENT_BYTE_2, 3 ; person def_warps_to WARDENS_HOUSE
; A188480: a(n) = (n^4 + 16*n^3 + 65*n^2 + 26*n + 12)/12. ; 1,10,39,99,203,366,605,939,1389,1978,2731,3675,4839,6254,7953,9971,12345,15114,18319,22003,26211,30990,36389,42459,49253,56826,65235,74539,84799,96078,108441,121955,136689,152714,170103,188931,209275,231214,254829,280203,307421,336570,367739,401019,436503,474286,514465,557139,602409,650378,701151,754835,811539,871374,934453,1000891,1070805,1144314,1221539,1302603,1387631,1476750,1570089,1667779,1769953,1876746,1988295,2104739,2226219,2352878,2484861,2622315,2765389,2914234,3069003,3229851,3396935,3570414,3750449,3937203,4130841,4331530,4539439,4754739,4977603,5208206,5446725,5693339,5948229,6211578,6483571,6764395,7054239,7353294,7661753,7979811,8307665,8645514,8993559,9352003 mov $5,$0 add $5,1 mov $10,$0 lpb $5 mov $0,$10 sub $5,1 sub $0,$5 mov $7,$0 mov $8,0 mov $9,$0 add $9,1 lpb $9 mov $0,$7 sub $9,1 sub $0,$9 mov $3,$0 add $3,1 mov $0,$3 mov $2,$3 add $2,4 mov $4,0 lpb $0 mov $0,0 mul $3,$2 add $4,$3 mov $2,$4 add $4,1 trn $4,19 mov $6,3 trn $6,$4 sub $2,$6 lpe sub $2,1 add $0,$2 add $8,$0 lpe add $1,$8 lpe mov $0,$1
// Copyright (c) 2015 Vivaldi Technologies AS. All rights reserved #include "importer/chromium_profile_lock.h" #include <windows.h> void ChromiumProfileLock::Init() { lock_handle_ = INVALID_HANDLE_VALUE; } void ChromiumProfileLock::Lock() { if (HasAcquired()) return; lock_handle_ = CreateFile(lock_file_.value().c_str(), GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_ALWAYS, FILE_FLAG_DELETE_ON_CLOSE, NULL); } void ChromiumProfileLock::Unlock() { if (!HasAcquired()) return; CloseHandle(lock_handle_); lock_handle_ = INVALID_HANDLE_VALUE; } bool ChromiumProfileLock::HasAcquired() { return (lock_handle_ != INVALID_HANDLE_VALUE); }
#include <algorithm> #include <iostream> #include <map> #include <vector> using namespace std; int main() { int n; cin >> n; vector<long long> a(n); map<long long,int> v; for (int i = 0; i < n; i++) { cin >> a[i]; v[a[i]]++; } vector<long long> d; d.push_back(1); for (int i = 1; i < 32; i++) { d.push_back(d[i-1] << 1); } int ans = 0; for_each(a.begin(), a.end(), [&ans,d,&v](auto elem) { bool no = true; for (int k = 0; k < d.size(); k++) { long long r = d[k] - elem; if (r == elem && v[elem] == 1) { continue; } if (r > 0 && v.find(r) != v.end()) { no = false; break; } } if (no) { ans++; } //v.insert(elem); }); cout << ans << endl; return 0; }
[bits 32] [section .text] INT_VECTOR_SYS_CALL equ 0x80 _NR_PUTCHAR EQU 5 global putchar putchar: mov eax, _NR_PUTCHAR mov ebx, [esp + 4] int INT_VECTOR_SYS_CALL ret
; A241520: Numbers n such that n^2 == -1 (mod 89). ; 34,55,123,144,212,233,301,322,390,411,479,500,568,589,657,678,746,767,835,856,924,945,1013,1034,1102,1123,1191,1212,1280,1301,1369,1390,1458,1479,1547,1568,1636,1657,1725,1746,1814,1835,1903,1924,1992,2013,2081,2102,2170,2191,2259,2280,2348,2369,2437,2458,2526,2547,2615,2636,2704,2725,2793,2814,2882,2903,2971,2992,3060,3081,3149,3170,3238,3259,3327,3348,3416,3437,3505,3526,3594,3615,3683,3704,3772,3793,3861,3882,3950,3971,4039,4060,4128,4149,4217,4238,4306,4327,4395,4416 mov $2,$0 add $0,9 mov $1,6 mov $3,6 mov $4,23 lpb $0 trn $0,2 add $1,3 add $4,$3 add $1,$4 trn $3,1 lpe lpb $2 add $1,21 sub $2,1 lpe sub $1,172 mov $0,$1
; ; Startup for test emulator ; ; $Id: test_crt0.asm,v 1.12 2016-06-21 20:49:07 dom Exp $ module test_crt0 INCLUDE "test_cmds.def" defc crt0 = 1 INCLUDE "zcc_opt.def" EXTERN _main ;main() is always external to crt0 code PUBLIC cleanup ;jp'd to by exit() PUBLIC l_dcal ;jp(hl) defc TAR__clib_exit_stack_size = 32 defc TAR__register_sp = 65280 defc CRT_KEY_DEL = 127 defc __CPU_CLOCK = 4000000 IF !__CPU_RABBIT__ && !__CPU_GBZ80__ IF CRT_ORG_CODE = 0x0000 ; We want to intercept rst38 to our interrupt routine defc TAR__crt_enable_rst = $0000 EXTERN asm_im1_handler defc _z80_rst_38h = asm_im1_handler ENDIF ENDIF INCLUDE "crt/classic/crt_rules.inc" IF !DEFINED_CRT_ORG_CODE defc CRT_ORG_CODE = 0x0000 ENDIF org CRT_ORG_CODE IF CRT_ORG_CODE = 0x0000 if (ASMPC<>$0000) defs CODE_ALIGNMENT_ERROR endif jp program INCLUDE "crt/classic/crt_z80_rsts.asm" ENDIF program: INCLUDE "crt/classic/crt_init_sp.asm" INCLUDE "crt/classic/crt_init_atexit.asm" call crt0_init_bss IF __CPU_GBZ80__ ld hl,sp+0 ld d,h ld e,l ld hl,exitsp ld a,l ld (hl+),a ld a,h ld (hl+),a ELSE ld hl,0 add hl,sp ld (exitsp),hl ENDIF IF !__CPU_R2KA__ ei ENDIF ; Optional definition for auto MALLOC init ; it assumes we have free space between the end of ; the compiled program and the stack pointer IF DEFINED_USING_amalloc INCLUDE "crt/classic/crt_init_amalloc.asm" ENDIF ld a,(argv_length) and a jp z,argv_done ld c,a ld b,0 ld hl,argv_start add hl,bc ; now points to end of the command line INCLUDE "crt/classic/crt_command_line.asm" push hl ;argv push bc ;argc call _main pop bc pop bc cleanup: push hl call crt0_exit pop hl ld a,CMD_EXIT ;exit ; Fall into SYSCALL SYSCALL: ; a = command to execute defb $ED, $FE ;trap ret l_dcal: jp (hl) ;Used for function pointer calls INCLUDE "crt/classic/crt_runtime_selection.asm" INCLUDE "crt/classic/crt_section.asm"
copyright zengfr site:http://github.com/zengfr/romhack 00042A move.l D1, (A0)+ 00042C dbra D0, $42a 001248 move.l D2, ($2c,A6) 00124C tst.w D0 [enemy+2C, enemy+2E, etc+2C, etc+2E, item+2C, item+2E] 001298 move.l D2, ($2c,A6) 00129C tst.w D0 [enemy+2C, enemy+2E, item+2C, item+2E] 0016D2 move.l D1, ($2c,A6) 0016D6 or.w D0, D0 [enemy+2C, enemy+2E, etc+2C, etc+2E] 004D3E move.l D0, (A4)+ 004D40 dbra D1, $4d38 02A79A tst.b ($2c,A6) 02A79E bne $2a7a6 [enemy+2C] 02A806 tst.b ($2c,A6) 02A80A bne $2a812 [enemy+2C] 02A924 tst.b ($2c,A6) 02A928 bne $2a930 [enemy+2C] 02AB16 tst.b ($2c,A6) 02AB1A bne $2ab22 [enemy+2C] 02ABB4 tst.b ($2c,A6) 02ABB8 bne $2abc0 [enemy+2C] 02AD30 tst.b ($2c,A6) 02AD34 bne $2ad3c [enemy+2C] 033D82 tst.b ($2c,A6) 033D86 bne $33da2 [enemy+2C] 033DE8 tst.b ($2c,A6) 033DEC bne $33df4 [enemy+2C] 042814 tst.b ($2c,A6) [enemy+80] 042818 beq $42822 [enemy+2C] 04281A clr.b ($2c,A6) 04281E bsr $42824 [enemy+2C] 0488D2 tst.b ($2c,A6) 0488D6 bne $4890a [enemy+2C] 0493C6 move.b ($2c,A6), D0 0493CA move.w ($16,PC,D0.w), D0 [enemy+2C] 04F3BE move.b ($2c,A6), D0 04F3C2 move.w ($16,PC,D0.w), D0 [enemy+2C] 0502FA tst.b ($2c,A6) 0502FE beq $50330 [enemy+2C] 05032C clr.b ($2c,A6) 050330 jsr $121e.l [enemy+2C] 057DF0 tst.b ($2c,A6) [enemy+ 4] 057DF4 beq $57dfc [enemy+2C] 057EB8 move.b ($2c,A3), D0 057EBC asl.w #3, D0 [enemy+2C] 057EC8 move.b ($2c,A3), D0 057ECC asl.w #3, D0 [enemy+2C] 05EEBC move.b ($2c,A0), D0 05EEC0 bmi $5efe8 [enemy+2C] 05EEE6 move.b ($2c,A0), D0 05EEEA add.w D0, D0 [enemy+2C] 0AAACA move.l (A0), D2 0AAACC move.w D0, (A0) [123p+11A, 123p+11C, 123p+11E, 123p+120, 123p+122, 123p+124, 123p+126, 123p+128, 123p+12A, enemy+BC, enemy+C0, enemy+C2, enemy+C4, enemy+CC, enemy+CE, enemy+D0, enemy+D2, enemy+D4, enemy+D6, enemy+D8, enemy+DA, enemy+DE, item+86, item+88, item+8A, item+98, item+9A, item+9C, item+9E, item+A0, item+A2, item+A4, item+A6, scr1] 0AAACE move.w D0, ($2,A0) 0AAAD2 cmp.l (A0), D0 0AAAD4 bne $aaafc 0AAAD8 move.l D2, (A0)+ 0AAADA cmpa.l A0, A1 [123p+11A, 123p+11C, 123p+11E, 123p+120, 123p+122, 123p+124, 123p+126, 123p+128, 123p+12A, enemy+BC, enemy+C0, enemy+C2, enemy+C4, enemy+CC, enemy+CE, enemy+D0, enemy+D2, enemy+D4, enemy+D6, enemy+D8, enemy+DA, enemy+DE, item+86, item+88, item+8A, item+98, item+9A, item+9C, item+9E, item+A0, item+A2, item+A4, item+A6, scr1] 0AAAE6 move.l (A0), D2 0AAAE8 move.w D0, (A0) [123p+11A, 123p+11C, 123p+11E, 123p+120, 123p+122, 123p+124, 123p+126, 123p+128, 123p+12A, enemy+BC, enemy+C0, enemy+C2, enemy+C4, enemy+CC, enemy+CE, enemy+D0, enemy+D2, enemy+D4, enemy+D6, enemy+D8, enemy+DA, enemy+DE, item+86, item+88, item+8A, item+98, item+9A, item+9C, item+9E, item+A0, item+A2, item+A4, item+A6, scr1] 0AAAF4 move.l D2, (A0)+ 0AAAF6 cmpa.l A0, A1 [123p+11A, 123p+11C, 123p+11E, 123p+120, 123p+122, 123p+124, 123p+126, 123p+128, 123p+12A, enemy+BC, enemy+C0, enemy+C2, enemy+C4, enemy+CC, enemy+CE, enemy+D0, enemy+D2, enemy+D4, enemy+D6, enemy+D8, enemy+DA, enemy+DE, item+86, item+88, item+8A, item+98, item+9A, item+9C, item+9E, item+A0, item+A2, item+A4, item+A6, scr1] copyright zengfr site:http://github.com/zengfr/romhack
; A276800: Decimal expansion of t^2, where t is the tribonacci constant A058265. ; Submitted by Jon Maiga ; 3,3,8,2,9,7,5,7,6,7,9,0,6,2,3,7,4,9,4,1,2,2,7,0,8,5,3,6,4,5,5,0,3,4,5,8,6,9,4,9,3,8,2,0,4,3,7,4,8,5,7,6,1,8,2,0,1,9,5,6,2,6,7,7,2,3,5,3,7,1,8,9,6,0,0,9,9,4,0,2,9,2,2,2,3,5,9,3,3,3,4,0,0,4,3,6,6,1,3,9 mov $5,$0 cmp $5,0 add $0,$5 mov $2,1 mov $3,$0 mul $3,4 lpb $3 add $1,$2 add $2,$1 pow $2,2 div $2,$1 mul $1,4 sub $3,1 lpe mov $4,10 pow $4,$0 div $2,$4 div $1,$2 mov $0,$1 mod $0,10
#include "crystalpicnic.h" #include "error.h" std::string Error::get_message(void) { return message; } Error::Error(std::string msg) : message(msg) { } Error::Error() : message("") { }
// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "chrome/browser/policy/browser_policy_connector.h" #include "base/bind.h" #include "base/bind_helpers.h" #include "base/command_line.h" #include "base/file_path.h" #include "base/path_service.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/policy/cloud_policy_provider.h" #include "chrome/browser/policy/cloud_policy_subsystem.h" #include "chrome/browser/policy/configuration_policy_provider.h" #include "chrome/browser/policy/policy_service_impl.h" #include "chrome/browser/policy/user_policy_cache.h" #include "chrome/browser/policy/user_policy_token_cache.h" #include "chrome/browser/signin/token_service.h" #include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/net/gaia/gaia_constants.h" #include "chrome/common/pref_names.h" #include "content/public/browser/notification_details.h" #include "content/public/browser/notification_source.h" #include "grit/generated_resources.h" #include "policy/policy_constants.h" #if defined(OS_WIN) #include "chrome/browser/policy/configuration_policy_provider_win.h" #elif defined(OS_MACOSX) #include "chrome/browser/policy/configuration_policy_provider_mac.h" #elif defined(OS_POSIX) #include "chrome/browser/policy/config_dir_policy_provider.h" #endif #if defined(OS_CHROMEOS) #include "chrome/browser/chromeos/cros/cros_library.h" #include "chrome/browser/chromeos/system/statistics_provider.h" #include "chrome/browser/policy/app_pack_updater.h" #include "chrome/browser/policy/cros_user_policy_cache.h" #include "chrome/browser/policy/device_policy_cache.h" #include "chrome/browser/policy/network_configuration_updater.h" #include "chromeos/dbus/dbus_thread_manager.h" #endif using content::BrowserThread; namespace policy { namespace { // Subdirectory in the user's profile for storing user policies. const FilePath::CharType kPolicyDir[] = FILE_PATH_LITERAL("Device Management"); // File in the above directory for stroing user policy dmtokens. const FilePath::CharType kTokenCacheFile[] = FILE_PATH_LITERAL("Token"); // File in the above directory for storing user policy data. const FilePath::CharType kPolicyCacheFile[] = FILE_PATH_LITERAL("Policy"); // The following constants define delays applied before the initial policy fetch // on startup. (So that displaying Chrome's GUI does not get delayed.) // Delay in milliseconds from startup. const int64 kServiceInitializationStartupDelay = 5000; #if defined(OS_CHROMEOS) // MachineInfo key names. const char kMachineInfoSystemHwqual[] = "hardware_class"; // These are the machine serial number keys that we check in order until we // find a non-empty serial number. The VPD spec says the serial number should be // in the "serial_number" key for v2+ VPDs. However, we cannot check this first, // since we'd get the "serial_number" value from the SMBIOS (yes, there's a name // clash here!), which is different from the serial number we want and not // actually per-device. So, we check the legacy keys first. If we find a // serial number for these, we use it, otherwise we must be on a newer device // that provides the correct data in "serial_number". const char* kMachineInfoSerialNumberKeys[] = { "sn", // ZGB "Product_S/N", // Alex "Product_SN", // Mario "serial_number" // VPD v2+ devices }; #endif } // namespace BrowserPolicyConnector::BrowserPolicyConnector() : ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)) {} BrowserPolicyConnector::~BrowserPolicyConnector() { // Shutdown device cloud policy. #if defined(OS_CHROMEOS) if (device_cloud_policy_subsystem_.get()) device_cloud_policy_subsystem_->Shutdown(); // The AppPackUpdater may be observing the |device_cloud_policy_subsystem_|. // Delete it first. app_pack_updater_.reset(); device_cloud_policy_subsystem_.reset(); device_data_store_.reset(); #endif // Shutdown user cloud policy. if (user_cloud_policy_subsystem_.get()) user_cloud_policy_subsystem_->Shutdown(); user_cloud_policy_subsystem_.reset(); user_policy_token_cache_.reset(); user_data_store_.reset(); } void BrowserPolicyConnector::Init() { managed_platform_provider_.reset(CreateManagedPlatformProvider()); recommended_platform_provider_.reset(CreateRecommendedPlatformProvider()); #if defined(OS_CHROMEOS) // The CloudPolicyProvider blocks asynchronous Profile creation until a login // is performed. This is used to ensure that the Profile's PrefService sees // managed preferences on managed Chrome OS devices. However, this also // prevents creation of new Profiles in Desktop Chrome. The implementation of // cloud policy on the Desktop requires a refactoring of the cloud provider, // but for now it just isn't created. CommandLine* command_line = CommandLine::ForCurrentProcess(); if (command_line->HasSwitch(switches::kDeviceManagementUrl)) { managed_cloud_provider_.reset(new CloudPolicyProvider( this, GetChromePolicyDefinitionList(), POLICY_LEVEL_MANDATORY)); recommended_cloud_provider_.reset(new CloudPolicyProvider( this, GetChromePolicyDefinitionList(), POLICY_LEVEL_RECOMMENDED)); } InitializeDevicePolicy(); if (command_line->HasSwitch(switches::kEnableONCPolicy)) { network_configuration_updater_.reset( new NetworkConfigurationUpdater( managed_cloud_provider_.get(), chromeos::CrosLibrary::Get()->GetNetworkLibrary())); } // Create the AppPackUpdater to start updating the cache. It requires the // system request context, which isn't available yet; therefore it is // created only once the loops are running. MessageLoop::current()->PostTask( FROM_HERE, base::Bind(base::IgnoreResult(&BrowserPolicyConnector::GetAppPackUpdater), weak_ptr_factory_.GetWeakPtr())); #endif } PolicyService* BrowserPolicyConnector::CreatePolicyService() const { // |providers| in decreasing order of priority. PolicyServiceImpl::Providers providers; if (managed_platform_provider_.get()) providers.push_back(managed_platform_provider_.get()); if (managed_cloud_provider_.get()) providers.push_back(managed_cloud_provider_.get()); if (recommended_platform_provider_.get()) providers.push_back(recommended_platform_provider_.get()); if (recommended_cloud_provider_.get()) providers.push_back(recommended_cloud_provider_.get()); return new PolicyServiceImpl(providers); } void BrowserPolicyConnector::RegisterForDevicePolicy( const std::string& owner_email, const std::string& token, bool known_machine_id) { #if defined(OS_CHROMEOS) if (device_data_store_.get()) { if (!device_data_store_->device_token().empty()) { LOG(ERROR) << "Device policy data store already has a DMToken; " << "RegisterForDevicePolicy won't trigger a new registration."; } device_data_store_->set_user_name(owner_email); device_data_store_->set_known_machine_id(known_machine_id); device_data_store_->set_policy_fetching_enabled(false); device_data_store_->SetOAuthToken(token); } #endif } bool BrowserPolicyConnector::IsEnterpriseManaged() { #if defined(OS_CHROMEOS) return install_attributes_.get() && install_attributes_->IsEnterpriseDevice(); #else return false; #endif } EnterpriseInstallAttributes::LockResult BrowserPolicyConnector::LockDevice(const std::string& user) { #if defined(OS_CHROMEOS) if (install_attributes_.get()) { return install_attributes_->LockDevice(user, device_data_store_->device_mode(), device_data_store_->device_id()); } #endif return EnterpriseInstallAttributes::LOCK_BACKEND_ERROR; } // static std::string BrowserPolicyConnector::GetSerialNumber() { std::string serial_number; #if defined(OS_CHROMEOS) chromeos::system::StatisticsProvider* provider = chromeos::system::StatisticsProvider::GetInstance(); for (size_t i = 0; i < arraysize(kMachineInfoSerialNumberKeys); i++) { if (provider->GetMachineStatistic(kMachineInfoSerialNumberKeys[i], &serial_number) && !serial_number.empty()) { break; } } #endif return serial_number; } std::string BrowserPolicyConnector::GetEnterpriseDomain() { #if defined(OS_CHROMEOS) if (install_attributes_.get()) return install_attributes_->GetDomain(); #endif return std::string(); } DeviceMode BrowserPolicyConnector::GetDeviceMode() { #if defined(OS_CHROMEOS) if (install_attributes_.get()) return install_attributes_->GetMode(); else return DEVICE_MODE_NOT_SET; #endif // We only have the notion of "enterprise" device on ChromeOS for now. return DEVICE_MODE_CONSUMER; } void BrowserPolicyConnector::ResetDevicePolicy() { #if defined(OS_CHROMEOS) if (device_cloud_policy_subsystem_.get()) device_cloud_policy_subsystem_->Reset(); #endif } void BrowserPolicyConnector::FetchCloudPolicy() { #if defined(OS_CHROMEOS) if (device_cloud_policy_subsystem_.get()) device_cloud_policy_subsystem_->RefreshPolicies(false); if (user_cloud_policy_subsystem_.get()) user_cloud_policy_subsystem_->RefreshPolicies(true); // wait_for_auth_token #endif } void BrowserPolicyConnector::ScheduleServiceInitialization( int64 delay_milliseconds) { if (user_cloud_policy_subsystem_.get()) { user_cloud_policy_subsystem_-> ScheduleServiceInitialization(delay_milliseconds); } #if defined(OS_CHROMEOS) if (device_cloud_policy_subsystem_.get()) { device_cloud_policy_subsystem_-> ScheduleServiceInitialization(delay_milliseconds); } #endif } void BrowserPolicyConnector::InitializeUserPolicy( const std::string& user_name, bool wait_for_policy_fetch) { // Throw away the old backend. user_cloud_policy_subsystem_.reset(); user_policy_token_cache_.reset(); user_data_store_.reset(); token_service_ = NULL; registrar_.RemoveAll(); CommandLine* command_line = CommandLine::ForCurrentProcess(); if (command_line->HasSwitch(switches::kDeviceManagementUrl)) { user_data_store_.reset(CloudPolicyDataStore::CreateForUserPolicies()); FilePath profile_dir; PathService::Get(chrome::DIR_USER_DATA, &profile_dir); #if defined(OS_CHROMEOS) profile_dir = profile_dir.Append( command_line->GetSwitchValuePath(switches::kLoginProfile)); #endif const FilePath policy_dir = profile_dir.Append(kPolicyDir); const FilePath policy_cache_file = policy_dir.Append(kPolicyCacheFile); const FilePath token_cache_file = policy_dir.Append(kTokenCacheFile); CloudPolicyCacheBase* user_policy_cache = NULL; #if defined(OS_CHROMEOS) user_policy_cache = new CrosUserPolicyCache( chromeos::DBusThreadManager::Get()->GetSessionManagerClient(), user_data_store_.get(), wait_for_policy_fetch, token_cache_file, policy_cache_file); #else user_policy_cache = new UserPolicyCache(policy_cache_file, wait_for_policy_fetch); user_policy_token_cache_.reset( new UserPolicyTokenCache(user_data_store_.get(), token_cache_file)); // Initiate the DM-Token load. user_policy_token_cache_->Load(); #endif managed_cloud_provider_->SetUserPolicyCache(user_policy_cache); recommended_cloud_provider_->SetUserPolicyCache(user_policy_cache); user_cloud_policy_subsystem_.reset(new CloudPolicySubsystem( user_data_store_.get(), user_policy_cache)); user_data_store_->set_user_name(user_name); user_data_store_->set_user_affiliation(GetUserAffiliation(user_name)); int64 delay = wait_for_policy_fetch ? 0 : kServiceInitializationStartupDelay; user_cloud_policy_subsystem_->CompleteInitialization( prefs::kUserPolicyRefreshRate, delay); } } void BrowserPolicyConnector::SetUserPolicyTokenService( TokenService* token_service) { token_service_ = token_service; registrar_.Add(this, chrome::NOTIFICATION_TOKEN_AVAILABLE, content::Source<TokenService>(token_service_)); if (token_service_->HasTokenForService( GaiaConstants::kDeviceManagementService)) { user_data_store_->SetGaiaToken(token_service_->GetTokenForService( GaiaConstants::kDeviceManagementService)); } } void BrowserPolicyConnector::RegisterForUserPolicy( const std::string& oauth_token) { if (oauth_token.empty()) { // An attempt to fetch the dm service oauth token has failed. Notify // the user policy cache of this, so that a potential blocked login // proceeds without waiting for user policy. if (user_cloud_policy_subsystem_.get()) { user_cloud_policy_subsystem_->GetCloudPolicyCacheBase()-> SetFetchingDone(); } } else { if (user_data_store_.get()) user_data_store_->SetOAuthToken(oauth_token); } } CloudPolicyDataStore* BrowserPolicyConnector::GetDeviceCloudPolicyDataStore() { #if defined(OS_CHROMEOS) return device_data_store_.get(); #else return NULL; #endif } CloudPolicyDataStore* BrowserPolicyConnector::GetUserCloudPolicyDataStore() { return user_data_store_.get(); } const ConfigurationPolicyHandlerList* BrowserPolicyConnector::GetHandlerList() const { return &handler_list_; } UserAffiliation BrowserPolicyConnector::GetUserAffiliation( const std::string& user_name) { #if defined(OS_CHROMEOS) if (install_attributes_.get()) { size_t pos = user_name.find('@'); if (pos != std::string::npos && user_name.substr(pos + 1) == install_attributes_->GetDomain()) { return USER_AFFILIATION_MANAGED; } } #endif return USER_AFFILIATION_NONE; } AppPackUpdater* BrowserPolicyConnector::GetAppPackUpdater() { #if defined(OS_CHROMEOS) if (!app_pack_updater_.get()) { // system_request_context() is NULL in unit tests. net::URLRequestContextGetter* request_context = g_browser_process->system_request_context(); if (request_context) app_pack_updater_.reset(new AppPackUpdater(request_context, this)); } return app_pack_updater_.get(); #else return NULL; #endif } void BrowserPolicyConnector::Observe( int type, const content::NotificationSource& source, const content::NotificationDetails& details) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); if (type == chrome::NOTIFICATION_TOKEN_AVAILABLE) { const TokenService* token_source = content::Source<const TokenService>(source).ptr(); DCHECK_EQ(token_service_, token_source); const TokenService::TokenAvailableDetails* token_details = content::Details<const TokenService::TokenAvailableDetails>(details). ptr(); if (token_details->service() == GaiaConstants::kDeviceManagementService) { if (user_data_store_.get()) { user_data_store_->SetGaiaToken(token_details->token()); } } } else { NOTREACHED(); } } void BrowserPolicyConnector::InitializeDevicePolicy() { #if defined(OS_CHROMEOS) // Throw away the old backend. device_cloud_policy_subsystem_.reset(); device_data_store_.reset(); CommandLine* command_line = CommandLine::ForCurrentProcess(); if (command_line->HasSwitch(switches::kEnableDevicePolicy)) { device_data_store_.reset(CloudPolicyDataStore::CreateForDevicePolicies()); chromeos::CryptohomeLibrary* cryptohome = chromeos::CrosLibrary::Get()->GetCryptohomeLibrary(); install_attributes_.reset(new EnterpriseInstallAttributes(cryptohome)); DevicePolicyCache* device_policy_cache = new DevicePolicyCache(device_data_store_.get(), install_attributes_.get()); managed_cloud_provider_->SetDevicePolicyCache(device_policy_cache); recommended_cloud_provider_->SetDevicePolicyCache(device_policy_cache); device_cloud_policy_subsystem_.reset(new CloudPolicySubsystem( device_data_store_.get(), device_policy_cache)); // Initialize the subsystem once the message loops are spinning. MessageLoop::current()->PostTask( FROM_HERE, base::Bind(&BrowserPolicyConnector::CompleteInitialization, weak_ptr_factory_.GetWeakPtr())); } #endif } void BrowserPolicyConnector::CompleteInitialization() { #if defined(OS_CHROMEOS) if (device_cloud_policy_subsystem_.get()) { // Read serial number and machine model. This must be done before we call // CompleteInitialization() below such that the serial number is available // for re-submission in case we're doing serial number recovery. if (device_data_store_->machine_id().empty() || device_data_store_->machine_model().empty()) { chromeos::system::StatisticsProvider* provider = chromeos::system::StatisticsProvider::GetInstance(); std::string machine_model; if (!provider->GetMachineStatistic(kMachineInfoSystemHwqual, &machine_model)) { LOG(ERROR) << "Failed to get machine model."; } std::string machine_id = GetSerialNumber(); if (machine_id.empty()) LOG(ERROR) << "Failed to get machine serial number."; device_data_store_->set_machine_id(machine_id); device_data_store_->set_machine_model(machine_model); } device_cloud_policy_subsystem_->CompleteInitialization( prefs::kDevicePolicyRefreshRate, kServiceInitializationStartupDelay); } device_data_store_->set_device_status_collector( new DeviceStatusCollector( g_browser_process->local_state(), chromeos::system::StatisticsProvider::GetInstance(), NULL)); #endif } // static ConfigurationPolicyProvider* BrowserPolicyConnector::CreateManagedPlatformProvider() { const PolicyDefinitionList* policy_list = GetChromePolicyDefinitionList(); #if defined(OS_WIN) return new ConfigurationPolicyProviderWin(policy_list, policy::kRegistryMandatorySubKey, POLICY_LEVEL_MANDATORY); #elif defined(OS_MACOSX) return new ConfigurationPolicyProviderMac(policy_list, POLICY_LEVEL_MANDATORY); #elif defined(OS_POSIX) FilePath config_dir_path; if (PathService::Get(chrome::DIR_POLICY_FILES, &config_dir_path)) { return new ConfigDirPolicyProvider( policy_list, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, config_dir_path.Append(FILE_PATH_LITERAL("managed"))); } else { return NULL; } #else return NULL; #endif } // static ConfigurationPolicyProvider* BrowserPolicyConnector::CreateRecommendedPlatformProvider() { const PolicyDefinitionList* policy_list = GetChromePolicyDefinitionList(); #if defined(OS_WIN) return new ConfigurationPolicyProviderWin(policy_list, policy::kRegistryRecommendedSubKey, POLICY_LEVEL_RECOMMENDED); #elif defined(OS_MACOSX) return new ConfigurationPolicyProviderMac(policy_list, POLICY_LEVEL_RECOMMENDED); #elif defined(OS_POSIX) FilePath config_dir_path; if (PathService::Get(chrome::DIR_POLICY_FILES, &config_dir_path)) { return new ConfigDirPolicyProvider( policy_list, POLICY_LEVEL_RECOMMENDED, POLICY_SCOPE_MACHINE, config_dir_path.Append(FILE_PATH_LITERAL("recommended"))); } else { return NULL; } #else return NULL; #endif } } // namespace policy
// // Created by Rose on 2018/8/21. // #include "List.h" int List::traverseList() { ListNode * p=pHead->pNext; if(p == NULL){ return 0; } while(p!=NULL) { cout<<"N(" << p->NDeg << "): "; SubList *s = p->subList; s->traverseList(); p=p->pNext; //cout << endl; } return 1; } void List::traverseListReturn()//逆向遍历 { ListNode * p=pTail; while(p->pLast!=NULL) { cout<<"N(" << p->NDeg << "): " <<endl; SubList *s = p->subList; s->traverseList(); p=p->pLast; } } void List::insertList(int ndeg, SubList* s, int position)//插入数据 { ListNode * p=pHead->pNext; if(position>length||position<=0) { cout<<"over stack !"<<endl; return; } for(int i=0;i<position-1;i++) { p=p->pNext; } ListNode * temp=new ListNode(); temp->NDeg = ndeg; temp->subList = s; temp->pNext=p; temp->pLast=p->pLast; // p->pLast->pNext=temp; p->pLast=temp; length++; } void List::clearList()//清空 { ListNode * q; ListNode * p=pHead->pNext; while(p!=NULL) { q=p; p=p->pNext; delete q; } p=NULL; q=NULL; } void List::deleteList(int position)//删除指定位置的节点 { ListNode * p=pHead->pNext; if(position>length||position<=0) { cout<<"over stack !"<<endl; return; } for(int i=0;i<position-1;i++) { p=p->pNext; } if(p == pTail){ p->pLast->pNext=NULL; pTail = p->pLast; delete p; length--; } else{ p->pLast->pNext=p->pNext; p->pNext->pLast=p->pLast; delete p; length--; } } HNode List::getItemInList(int pos, int position)//查找指定位置的节点 { ListNode *p = pHead->pNext; if (pos > length || pos <= 0) { cout << "-----over stack !" << endl; //return ; } for (int i = 0; i < pos - 1; i++) { p = p->pNext; } HNode node = p->subList->getNodeInList(position); return node; } void List::insert(ListNode *ls){ ListNode * temp = ls; temp->pNext=NULL; temp->pLast=pTail; pTail->pNext=temp; pTail=temp; length++; } int List::findNsub(int deg){ ListNode * p=pHead->pNext; int i = 1; while(p!=NULL) { if(p->NDeg == deg){ return i; } i++; p=p->pNext; if(p == NULL){ return 0; } } return 0; } int List::deleteSubList(int pos, int position){ //pos = pos+1; //position = position+1; ListNode * p=pHead->pNext; for(int i=0;i<pos-1;i++) { p=p->pNext; } p->subList->deleteList(position); return 1; } int List::insertSubList(HNode hNode, int pos){ ListNode * p=pHead->pNext; for(int i=0;i<pos-1;i++) { p=p->pNext; } p->subList->insertNode(hNode); return 1; } HNode List::getHNode(int pos, int position){ ListNode * p=pHead->pNext; for(int i=0;i<pos-1;i++) { p=p->pNext; } return p->subList->getNodeInList(position); } int List::getSubListLength(int pos){ ListNode * p=pHead->pNext; for(int i=0;i<pos-1;i++) { p=p->pNext; } return p->subList->length; } void List::changeList(int pos, int position, int flag){ if(flag == 0){ ListNode * p=pHead->pNext; if(pos>length||pos<=0) { cout<<"over stack !"<<endl; return; } for(int i=0;i<pos-1;i++) { p=p->pNext; } while(p != NULL){ p->subList->changeList(position, flag); p = p->pNext; } } else if(flag == 1){ ListNode * p=pHead->pNext; if(pos>length||pos<=0) { cout<<"over stack out !"<<endl; return; } for(int i=0;i<pos-1;i++) { p=p->pNext; } p->subList->changeList(position, flag); } } void List::changeOneList(int pos, int position, HNode hNode){ ListNode * p=pHead->pNext; if(pos>length||pos<=0) { cout<<"over stack out !"<<endl; return; } for(int i=0;i<pos-1;i++) { p=p->pNext; } p->subList->changeOneList(hNode, position); }
// Copyright 2006-2009 Daniel James. // 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) // This test creates the containers with members that meet their minimum // requirements. Makes sure everything compiles and is defined correctly. // clang-format off #include "../helpers/prefix.hpp" #include <boost/unordered_set.hpp> #include "../helpers/postfix.hpp" // clang-format on #include <iostream> #include "../helpers/test.hpp" #include "../objects/minimal.hpp" #include "./compile_tests.hpp" // Explicit instantiation to catch compile-time errors #define INSTANTIATE(type) \ template class boost::unordered::detail::instantiate_##type INSTANTIATE(set)<int, boost::hash<int>, std::equal_to<int>, test::minimal::allocator<int> >; INSTANTIATE(multiset)<int const, boost::hash<int>, std::equal_to<int>, test::minimal::allocator<int> >; INSTANTIATE(set)<test::minimal::assignable const, test::minimal::hash<test::minimal::assignable>, test::minimal::equal_to<test::minimal::assignable>, test::minimal::allocator<int> >; INSTANTIATE(multiset)<test::minimal::assignable, test::minimal::hash<test::minimal::assignable>, test::minimal::equal_to<test::minimal::assignable>, test::minimal::allocator<int> >; UNORDERED_AUTO_TEST(test0) { test::minimal::constructor_param x; test::minimal::assignable assignable(x); std::cout << "Test unordered_set.\n"; boost::unordered_set<int> int_set; boost::unordered_set<int, boost::hash<int>, std::equal_to<int>, test::minimal::cxx11_allocator<int> > int_set2; boost::unordered_set<test::minimal::assignable, test::minimal::hash<test::minimal::assignable>, test::minimal::equal_to<test::minimal::assignable>, test::minimal::allocator<test::minimal::assignable> > set; container_test(int_set, 0); container_test(int_set2, 0); container_test(set, assignable); std::cout << "Test unordered_multiset.\n"; boost::unordered_multiset<int> int_multiset; boost::unordered_multiset<int, boost::hash<int>, std::equal_to<int>, test::minimal::cxx11_allocator<int> > int_multiset2; boost::unordered_multiset<test::minimal::assignable, test::minimal::hash<test::minimal::assignable>, test::minimal::equal_to<test::minimal::assignable>, test::minimal::allocator<test::minimal::assignable> > multiset; container_test(int_multiset, 0); container_test(int_multiset2, 0); container_test(multiset, assignable); } UNORDERED_AUTO_TEST(equality_tests) { typedef test::minimal::copy_constructible_equality_comparable value_type; boost::unordered_set<int> int_set; boost::unordered_set<int, boost::hash<int>, std::equal_to<int>, test::minimal::cxx11_allocator<int> > int_set2; boost::unordered_set< test::minimal::copy_constructible_equality_comparable, test::minimal::hash< test::minimal::copy_constructible_equality_comparable>, test::minimal::equal_to< test::minimal::copy_constructible_equality_comparable>, test::minimal::allocator<value_type> > set; equality_test(int_set); equality_test(int_set2); equality_test(set); boost::unordered_multiset<int> int_multiset; boost::unordered_multiset<int, boost::hash<int>, std::equal_to<int>, test::minimal::cxx11_allocator<int> > int_multiset2; boost::unordered_multiset< test::minimal::copy_constructible_equality_comparable, test::minimal::hash< test::minimal::copy_constructible_equality_comparable>, test::minimal::equal_to< test::minimal::copy_constructible_equality_comparable>, test::minimal::allocator<value_type> > multiset; equality_test(int_multiset); equality_test(int_multiset2); equality_test(multiset); } UNORDERED_AUTO_TEST(test1) { boost::hash<int> hash; std::equal_to<int> equal_to; int value = 0; std::cout << "Test unordered_set." << std::endl; boost::unordered_set<int> set; boost::unordered_set<int, boost::hash<int>, std::equal_to<int>, test::minimal::cxx11_allocator<int> > set2; unordered_unique_test(set, value); unordered_set_test(set, value); unordered_copyable_test(set, value, value, hash, equal_to); unordered_unique_test(set2, value); unordered_set_test(set2, value); unordered_copyable_test(set2, value, value, hash, equal_to); std::cout << "Test unordered_multiset." << std::endl; boost::unordered_multiset<int> multiset; boost::unordered_multiset<int, boost::hash<int>, std::equal_to<int>, test::minimal::cxx11_allocator<int> > multiset2; unordered_equivalent_test(multiset, value); unordered_set_test(multiset, value); unordered_copyable_test(multiset, value, value, hash, equal_to); unordered_equivalent_test(multiset2, value); unordered_set_test(multiset2, value); unordered_copyable_test(multiset2, value, value, hash, equal_to); } UNORDERED_AUTO_TEST(test2) { test::minimal::constructor_param x; test::minimal::assignable assignable(x); test::minimal::copy_constructible copy_constructible(x); test::minimal::hash<test::minimal::assignable> hash(x); test::minimal::equal_to<test::minimal::assignable> equal_to(x); std::cout << "Test unordered_set.\n"; boost::unordered_set<test::minimal::assignable, test::minimal::hash<test::minimal::assignable>, test::minimal::equal_to<test::minimal::assignable>, test::minimal::allocator<test::minimal::assignable> > set; unordered_unique_test(set, assignable); unordered_set_test(set, assignable); unordered_copyable_test(set, assignable, assignable, hash, equal_to); unordered_set_member_test(set, assignable); std::cout << "Test unordered_multiset.\n"; boost::unordered_multiset<test::minimal::assignable, test::minimal::hash<test::minimal::assignable>, test::minimal::equal_to<test::minimal::assignable>, test::minimal::allocator<test::minimal::assignable> > multiset; unordered_equivalent_test(multiset, assignable); unordered_set_test(multiset, assignable); unordered_copyable_test(multiset, assignable, assignable, hash, equal_to); unordered_set_member_test(multiset, assignable); } UNORDERED_AUTO_TEST(movable1_tests) { test::minimal::constructor_param x; test::minimal::movable1 movable1(x); test::minimal::hash<test::minimal::movable1> hash(x); test::minimal::equal_to<test::minimal::movable1> equal_to(x); std::cout << "Test unordered_set.\n"; boost::unordered_set<test::minimal::movable1, test::minimal::hash<test::minimal::movable1>, test::minimal::equal_to<test::minimal::movable1>, test::minimal::allocator<test::minimal::movable1> > set; // unordered_unique_test(set, movable1); unordered_set_test(set, movable1); unordered_movable_test(set, movable1, movable1, hash, equal_to); std::cout << "Test unordered_multiset.\n"; boost::unordered_multiset<test::minimal::movable1, test::minimal::hash<test::minimal::movable1>, test::minimal::equal_to<test::minimal::movable1>, test::minimal::allocator<test::minimal::movable1> > multiset; // unordered_equivalent_test(multiset, movable1); unordered_set_test(multiset, movable1); unordered_movable_test(multiset, movable1, movable1, hash, equal_to); } UNORDERED_AUTO_TEST(movable2_tests) { test::minimal::constructor_param x; test::minimal::movable2 movable2(x); test::minimal::hash<test::minimal::movable2> hash(x); test::minimal::equal_to<test::minimal::movable2> equal_to(x); std::cout << "Test unordered_set.\n"; boost::unordered_set<test::minimal::movable2, test::minimal::hash<test::minimal::movable2>, test::minimal::equal_to<test::minimal::movable2>, test::minimal::allocator<test::minimal::movable2> > set; // unordered_unique_test(set, movable2); unordered_set_test(set, movable2); unordered_movable_test(set, movable2, movable2, hash, equal_to); std::cout << "Test unordered_multiset.\n"; boost::unordered_multiset<test::minimal::movable2, test::minimal::hash<test::minimal::movable2>, test::minimal::equal_to<test::minimal::movable2>, test::minimal::allocator<test::minimal::movable2> > multiset; // unordered_equivalent_test(multiset, movable2); unordered_set_test(multiset, movable2); unordered_movable_test(multiset, movable2, movable2, hash, equal_to); } UNORDERED_AUTO_TEST(destructible_tests) { test::minimal::constructor_param x; test::minimal::destructible destructible(x); test::minimal::hash<test::minimal::destructible> hash(x); test::minimal::equal_to<test::minimal::destructible> equal_to(x); std::cout << "Test unordered_set.\n"; boost::unordered_set<test::minimal::destructible, test::minimal::hash<test::minimal::destructible>, test::minimal::equal_to<test::minimal::destructible> > set; unordered_destructible_test(set); std::cout << "Test unordered_multiset.\n"; boost::unordered_multiset<test::minimal::destructible, test::minimal::hash<test::minimal::destructible>, test::minimal::equal_to<test::minimal::destructible> > multiset; unordered_destructible_test(multiset); } RUN_TESTS()
; A094569: Associated with alternating row sums of array in A094568. ; Submitted by Jon Maiga ; 2,11,78,532,3649,25008,171410,1174859,8052606,55193380,378301057,2592914016,17772097058,121811765387,834910260654,5722560059188,39223010153665,268838511016464,1842646566961586,12629687457714635,86565165637040862,593326472001571396,4066720138373958913,27873714496616140992,191049281337939028034,1309471254868957055243,8975249502744760358670,61517275264344365455444,421645677347665797829441,2890002466169316219350640,19808371585837547737625042,135768598634693517944024651,930571818857017077870547518 add $0,1 seq $0,33889 ; a(n) = Fibonacci(4*n + 1). add $0,1 div $0,3
ORG 100 LDA 106 BUN 104 X, DEC 100 Y, HEX 102 ADD X CIR STA Y I HLT END
.data #global data X: .word 5 Y: .word 10 SUM: .word 0 .text #.globl main main: la R1, X la R2, Y lwz R3, 0(R1) lwz R4, 0(R2) add R5, R3, R4 la R6, SUM stw R5, 0(R6) lwz R8, 0(R6) # .end
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Copyright (c) GeoWorks 1993 -- All Rights Reserved PROJECT: PC GEOS MODULE: Hearts (trivia project) FILE: heartsDeck.asm AUTHOR: Peter Weck, Jan 20, 1993 ROUTINES: Name Description ---- ----------- REVISION HISTORY: Name Date Description ---- ---- ----------- PW 1/20/93 Initial revision DESCRIPTION: $Id: heartsDeck.asm,v 1.1 97/04/04 15:19:23 newdeal Exp $ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ;------------------------------------------------------------------------------ ; Common GEODE stuff ;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------ ; Libraries used ;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------ ; Macros ;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------ ; Resources ;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------ ; Initialized variables and class structures ;------------------------------------------------------------------------------ idata segment ;Class definition is stored in the application's idata resource here. HeartsDeckClass ;initialized variables idata ends ;------------------------------------------------------------------------------ ; Uninitialized variables ;------------------------------------------------------------------------------ udata segment udata ends ;------------------------------------------------------------------------------ ; Code for HeartsDeckClass ;------------------------------------------------------------------------------ CommonCode segment resource ;start of code resource COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckSaveState %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: will save the state of the deck. Then if not MyDeck, pass the message on to the neighbor. CALLED BY: HeartsDeckRestoreState PASS: *ds:si = HeartsDeckClass object ds:di = HeartsDeckClass instance data ^hcx = block of saved data dx = # bytes written RETURN: ^hcx - block of saved data dx - # bytes written DESTROYED: ax SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- PW 3/16/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckSaveState method dynamic HeartsDeckClass, MSG_DECK_SAVE_STATE uses bp playedCardPtr local optr playersDataPtr local optr chunkPointer local optr .enter call ObjMarkDirty Deref_DI Deck_offset tst ds:[di].HI_deckIdNumber jz exitRoutine movdw playedCardPtr, ds:[di].HI_playedCardPtr, ax movdw playersDataPtr, ds:[di].HI_playersDataPtr, ax movdw chunkPointer, ds:[di].HI_chunkPointer, ax movdw bxsi, playedCardPtr, ax call MemLock mov ds, ax call ObjMarkDirty call MemUnlock movdw bxsi, playersDataPtr, ax call MemLock mov ds, ax call ObjMarkDirty call MemUnlock movdw bxsi, chunkPointer, ax call MemLock mov ds, ax call ObjMarkDirty call MemUnlock exitRoutine: .leave ret HeartsDeckSaveState endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckDrawScore %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Will draw the score of the deck on to the view. You can pass it a GState or it will create a one, and you can specify if you want the score drawn highlighted or not. CALLED BY: MSG_HEARTS_DECK_DRAW_SCORE PASS: *ds:si = HeartsDeckClass object bp = passed GState (0 if no GState) cx = color (0 = white, 1 = Grey, DRAW_SCORE_AS_BEFORE = same as before) RETURN: nothing DESTROYED: nothing SIDE EFFECTS: will change the sceen PSEUDO CODE/STRATEGY: Create a GState Draw the text on the screen, near the current position of the deck, and then invalidate the region to get it to redraw the score. Destroy the GState REVISION HISTORY: Name Date Description ---- ---- ----------- PW 2/ 2/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckDrawScore method dynamic HeartsDeckClass, MSG_HEARTS_DECK_DRAW_SCORE uses ax, cx, dx, bp passedGState local word push bp currentGState local word position local dword .enter mov cx, passedGState tst cx jnz GStateAlreadyExists push bp ;save locals mov ax, MSG_VIS_VUP_CREATE_GSTATE call ObjCallInstanceNoLock mov cx, bp ;cx <= GState pop bp ;restore locals GStateAlreadyExists: mov currentGState, cx mov di, cx ;di <= GState mov cx, FID_BERKELEY mov dx, TEXT_POINT_SIZE clr ah ;point size (fraction) = 0 call GrSetFont ;change the GState mov ah, CF_INDEX ;indicate we are using a pre-defined ;color, not an RGB value. mov al, C_BLACK ;set text color value call GrSetTextColor ;set text color in GState mov al, C_GREEN ;set text color value call GrSetAreaColor ;set area color in GState push bp ;save locals mov ax, MSG_HEARTS_DECK_GET_SCORE_POSITION call ObjCallInstanceNoLock pop bp ;restore locals movdw position, cxdx ; Draw players name ; movdw axbx,cxdx add cx, NAME_LENGTH add dx, NAME_HEIGHT call GrFillRect ;draw over old score clr cx ;null terminated string push si Deref_DI Deck_offset mov si, ds:[di].HI_nameString mov si,ds:[si] mov di,currentGState call GrDrawText pop si ; Draw this rounds score ; mov cx,1 ;get this rounds score mov ax,MSG_HEARTS_DECK_GET_SCORE call ObjCallInstanceNoLock mov dx,cx ;this rounds score mov di,currentGState movdw axbx,position mov ax,CHART_HAND_TEXT_X call HeartsDrawNumber ; Draw total score ; Deref_DI Deck_offset mov dx, ds:[di].HI_score mov di,currentGState movdw axbx,position mov ax,CHART_GAME_TEXT_X call HeartsDrawNumber tst passedGState jnz dontDestroyGState call GrDestroyState ;destroy the graphics state dontDestroyGState: .leave ret HeartsDeckDrawScore endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDrawNumber %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Draw a number as an ascii string CALLED BY: INTERNAL HeartsDeckDrawScore PASS: dx - number ax - x location bx - y location di - gstate RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: none KNOWN BUGS/SIDE EFFECTS/IDEAS: This routine should be optimized for SMALL SIZE over SPEED Common cases: unknown REVISION HISTORY: Name Date Description ---- ---- ----------- srs 7/21/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDrawNumber proc far positionX local word push ax positionY local word push bx score local word push dx gstate local word push di memHandle local word uses ax,bx,cx,dx,es,di,ds,si .enter ; Clear area to draw to. ; mov ah,CF_INDEX mov al,C_GREEN call GrSetAreaColor mov ax,positionX mov bx,positionY movdw cxdx, axbx add cx, SCORE_LENGTH add dx, SCORE_HEIGHT call GrFillRect ;draw over old score ; Create string with score in it ; mov ax, SIZE_OF_SCORE mov cx, (mask HAF_LOCK or mask HAF_NO_ERR) shl 8 + mask HF_SWAPABLE call MemAlloc mov memHandle, bx ;save the handle to Memory mov es, ax ;mov seg ptr to es clr di ;set offset to zero mov dx,score call BinToAscii segmov ds, es clr si, cx ; Draw the score ; mov ax,positionX mov bx,positionY mov di,gstate clr cx ;null terminated string call GrDrawText mov bx, memHandle ;get back handle to Mem block call MemFree ;free the block of memory .leave ret HeartsDrawNumber endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckDrawName %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Will draw the name of the deck on to the view. You can pass it a GState or it will create a one CALLED BY: MSG_HEARTS_DECK_DRAW_NAME PASS: *ds:si = HeartsDeckClass object bp = passed GState (0 if no GState) RETURN: nothing DESTROYED: nothing SIDE EFFECTS: will change the sceen PSEUDO CODE/STRATEGY: Create a GState Draw the text on the screen, near the current position of the deck, and then invalidate the region to get it to redraw the score. Destroy the GState REVISION HISTORY: Name Date Description ---- ---- ----------- PW 2/ 2/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckDrawName method dynamic HeartsDeckClass, MSG_HEARTS_DECK_DRAW_NAME uses ax, cx, dx, bp passedGState local word push bp currentGState local word position local Point yCharAdjust local word .enter mov di, passedGState tst di jnz GStateAlreadyExists push bp ;save locals mov ax, MSG_VIS_VUP_CREATE_GSTATE call ObjCallInstanceNoLock mov di, bp ;cx <= GState pop bp ;restore locals GStateAlreadyExists: mov currentGState, di call GrSaveState mov cx, FID_BERKELEY mov dx, TEXT_POINT_SIZE clr ah ;point size (fraction) = 0 call GrSetFont ;change the GState mov ah, CF_INDEX ;indicate we are using a pre-defined ;color, not an RGB value. mov al, C_BLACK ;set text color value call GrSetTextColor ;set text color in GState mov al, C_GREEN call GrSetAreaColor push bp ;save locals mov ax, MSG_HEARTS_DECK_GET_NAME_POSITION call ObjCallInstanceNoLock pop bp ;restore locals mov position.P_x,cx mov position.P_y,dx mov yCharAdjust,ax Deref_DI Deck_offset mov si, ds:[di].HI_nameString mov si,ds:[si] mov di, currentGState ;retrieve GState tst yCharAdjust jnz verticalText mov ax, position.P_x ;retrieve position mov bx, position.P_y ;retrieve position movdw cxdx,axbx add cx, NAME_LENGTH add dx, NAME_HEIGHT call GrFillRect ;draw over old score clr cx ;null terminated string call GrDrawText restoreState: call GrRestoreState mov di, passedGState ;retrieve passed GState tst di jnz dontDestroyGState call GrDestroyState ;destroy the graphics state dontDestroyGState: .leave ret verticalText: mov ax, position.P_x ;retrieve position mov bx, position.P_y ;retrieve position movdw cxdx,axbx add cx, NAME_VERT_WIDTH add dx, NAME_VERT_HEIGHT call GrFillRect ;draw over old score drawCharLoop: mov dl,ds:[si] tst dl jz restoreState inc si call GrDrawChar add bx,yCharAdjust ;advance y position jmp drawCharLoop HeartsDeckDrawName endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckGetScorePosition %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Will return the position where the score should be printed. CALLED BY: HeartsDeckDrawScore PASS: *ds:si = HeartsDeckClass object ds:di = HeartsDeckClass instance data RETURN: cx,dx = position for score DESTROYED: ax, bp SIDE EFFECTS: none PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- PW 3/11/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckGetScorePosition method dynamic HeartsDeckClass, MSG_HEARTS_DECK_GET_SCORE_POSITION .enter ifdef STEVE mov ax, MSG_VIS_GET_POSITION call ObjCallInstanceNoLock endif Deref_DI Deck_offset mov cx, ds:[di].HI_scoreXPosition mov dx, ds:[di].HI_scoreYPosition .leave ret HeartsDeckGetScorePosition endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckGetNamePosition %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Will return the position where the name should be printed. CALLED BY: HeartsDeckDrawName PASS: *ds:si = HeartsDeckClass object ds:di = HeartsDeckClass instance data RETURN: cx,dx = position for name ax = rotation for name DESTROYED: bp SIDE EFFECTS: none PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- PW 3/11/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckGetNamePosition method dynamic HeartsDeckClass, MSG_HEARTS_DECK_GET_NAME_POSITION .enter mov ax, MSG_VIS_GET_POSITION call ObjCallInstanceNoLock Deref_DI Deck_offset add cx, ds:[di].HI_namePosition.P_x add dx, ds:[di].HI_namePosition.P_y mov ax, ds:[di].HI_nameYCharAdjust .leave ret HeartsDeckGetNamePosition endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckTurnRedIfWinner %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Will highlight the score of the winner(s). CALLED BY: MSG_HEARTS_DECK_TURN_RED_IF_WINNER PASS: *ds:si = HeartsDeckClass object cx = winners score RETURN: nothing DESTROYED: nothing SIDE EFFECTS: will turn text red if winning score PSEUDO CODE/STRATEGY: check if the winners score, and if it is then call HeartsDeckDrawScore with cx = 1 (draw red) REVISION HISTORY: Name Date Description ---- ---- ----------- PW 2/ 4/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckTurnRedIfWinner method dynamic HeartsDeckClass, MSG_HEARTS_DECK_TURN_RED_IF_WINNER uses ax, cx, bp .enter cmp ds:[di].HI_score, cx jne exitRoutine clr bp ;no GState exists mov cx, DRAW_SCORE_HIGHLIGHTED mov ax, MSG_HEARTS_DECK_DRAW_SCORE call ObjCallInstanceNoLock exitRoutine: .leave ret HeartsDeckTurnRedIfWinner endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% BinToAscii %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Converts dx to null terminated ascii string CALLED BY: PASS: dx - value to convert es:di - buffer for ascii string RETURN: es:di - null terminated ascii string DESTROYED: ax PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 08/24/89 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ BinToAscii proc near mov ax, dx push bx, cx, dx, bp mov bx, 10 ;print in base ten clr cx, bp cmp ax, 0 ;check if negative jge nextDigit ;negative: neg ax ;make positive inc bp nextDigit: clr dx div bx add dl, '0' ;convert to ASCII push dx ;save resulting character inc cx ;bump character count tst ax ;check if done jnz nextDigit ;if not, do next digit tst bp ;check if negative jz nextChar ;negative: mov al, '-' stosb nextChar: pop ax ;retrieve character (in AL) stosb ;stuff in buffer loop nextChar ;loop to stuff all clr al stosb ;null-terminate it pop bx, cx, dx, bp ret BinToAscii endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckInvert %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Inverts the top card of the deck CALLED BY: HeartsDeckPlayCard PASS: *ds:si = HeartsDeckClass object RETURN: nothing DESTROYED: nothing SIDE EFFECTS: inverts top card of deck PSEUDO CODE/STRATEGY: call superclass with MSG_DECK_INVERT REVISION HISTORY: Name Date Description ---- ---- ----------- PW 2/ 4/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckInvert method dynamic HeartsDeckClass, MSG_HEARTS_DECK_INVERT uses ax, cx, dx, bp .enter ;saving ax,bx,cx,bp because the superclass destroyes these registers mov ax, MSG_DECK_INVERT mov di, offset HeartsDeckClass call ObjCallSuperNoLock .leave ret HeartsDeckInvert endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartDeckInvert %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: We are subclassing this method because we don't want it to do anything. Normally it inverts the top card of the deck. If you want to call this routine, you can call MSG_HEARTS_DECK_INVERT it calls the superclasses routine MSG_DECK_INVERT CALLED BY: MSG_DECK_INVERT PASS: *ds:si = HeartsDeckClass object ds:di = HeartsDeckClass instance data ds:bx = HeartsDeckClass object (same as *ds:si) es = segment of HeartsDeckClass ax = message # RETURN: DESTROYED: SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- PW 2/ 3/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartDeckInvert method dynamic HeartsDeckClass, MSG_DECK_INVERT .enter .leave ret HeartDeckInvert endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckStartSelect %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: PASS: *(ds:si) - instance data of object ds:[bx] - instance data of object ds:[di] - master part of object (if any) es - segment of HeartDeckClass RETURN: DESTROYED: ax PSEUDO CODE/STRATEGY: none KNOWN BUGS/SIDE EFFECTS/IDEAS: This method should be optimized for SMALL SIZE over SPEED Common cases: unknown REVISION HISTORY: Name Date Description ---- ---- ----------- srs 5/28/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckStartSelect method dynamic HeartsDeckClass, MSG_META_START_SELECT .enter mov di,offset HeartsDeckClass call ObjCallSuperNoLock .leave ret HeartsDeckStartSelect endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckCardSelected %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Called when one of the deck's face up cards receives a click event. If the deck is MyDeck, then will send the card to the discard deck if it is ok to. If the deck is DiscardDeck and four cards have been played, then it will transfer the cards to MyDiscardDeck. CALLED BY: Game object PASS: *ds:si = HeartsDeckClass object bp = # of child in composite that was double-clicked (bp = 0 for first child) RETURN: nothing DESTROYED: nothing SIDE EFFECTS: may move the card to the discard deck PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- PW 2/ 8/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckCardSelected method dynamic HeartsDeckClass, MSG_DECK_UP_CARD_SELECTED uses ax, cx, dx, bp .enter ; Only accept clicks on face up cards in the players deck ; mov bx, handle MyDeck cmp bx, ds:[LMBH_handle] jne done cmp si, offset MyDeck jne done ; Check for being in passing cards mode ; push cx ;mouse x position mov ax, MSG_HEARTS_GAME_GET_GAME_ATTRS call VisCallParent mov ax,cx ;attrs pop cx ;mouse x position test al, mask HGA_PASSING_CARDS jnz passingCards ; See if card can be placed in trick ; push bp ;save card number mov ax, MSG_DECK_GET_NTH_CARD_ATTRIBUTES call ObjCallInstanceNoLock mov cx, ds:[LMBH_handle] mov dx, si push cx, dx ;save ^lcx:dx mov bx, handle DiscardDeck mov si, offset DiscardDeck mov di, mask MF_FIXUP_DS or mask MF_CALL mov ax, MSG_HEARTS_DECK_TEST_SUIT_CONDITION call ObjMessage mov al, cl ;al <= explaination pop cx, dx ;restore ^lcx:dx pop bp ;restore card number jc moveCards ;will accept ; Can't play card, let the player know ; mov cl, al ;cl <= explaination mov dx, HS_WRONG_PLAY ;dx <= sound to play mov ax, MSG_HEARTS_DECK_EXPLAIN mov di, mask MF_FIXUP_DS or mask MF_CALL call ObjMessage done: .leave ret passingCards: call HeartsDeckAddToChunkArray jmp done moveCards: xchg bx, cx ;switch donnor and xchg si, dx ;reciever xchg cx, bp ;setup card number mov di, mask MF_FIXUP_DS or mask MF_CALL mov ax, MSG_HEARTS_DECK_SHIFT_CARDS ; clr ch ;redraw deck call ObjMessage mov cx, bp ;setup reciever mov di, mask MF_FIXUP_DS or mask MF_CALL mov ax, MSG_HEARTS_DECK_PLAY_TOP_CARD call ObjMessage push si ;save offset mov bx, handle HeartsPlayingTable mov si, offset HeartsPlayingTable mov ax, MSG_HEARTS_GAME_GET_CARDS_PLAYED mov di, mask MF_FIXUP_DS or mask MF_CALL call ObjMessage inc cl ;increment cards played mov ax, MSG_HEARTS_GAME_SET_CARDS_PLAYED mov di, mask MF_FIXUP_DS or mask MF_CALL call ObjMessage pop si ;restore offset ; Play sounds associated with card played if any ; mov ax, MSG_HEARTS_GAME_CHECK_PLAY_SOUND call VisCallParent mov ax, DRAW_SCORE_HIGHLIGHTED ;redraw score highlight call HeartsDeckSetComputerPlayer Deref_DI Deck_offset movdw bxsi, ds:[di].HI_neighborPointer mov di, mask MF_FIXUP_DS or mask MF_FORCE_QUEUE ;changed to force_queue to make sure ;deck updated itself before the next ;card is played mov ax, MSG_HEARTS_DECK_PLAY_CARD call ObjMessage jmp done HeartsDeckCardSelected endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckDownCardSelected %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Handler for MSG_DECK_DOWN_CARD_SELECTED. The procedure intercepts the message so that clicking on a down card will not flip it over. CALLED BY: MSG_DECK_DOWN_CARD_SELECTED PASS: *ds:si = HeartsDeckClass object bp = # of selected child in composite RETURN: nothing DESTROYED: nothing SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- PW 1/21/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckDownCardSelected method dynamic HeartsDeckClass, MSG_DECK_DOWN_CARD_SELECTED uses ax, cx, dx, bp .enter mov ax, ds:[LMBH_handle] cmp ax, handle MyDiscardDeck jnz notMyDiscardDeck cmp si, offset MyDiscardDeck jnz notMyDiscardDeck ;isMyDiscardDeck: test ds:[di].HI_deckAttributes, mask HDA_FLIPPING_TAKE_TRICK jnz notMyDiscardDeck push si ;save offset mov bx, handle MyDeck mov si, offset MyDeck mov ax, MSG_VIS_GET_ATTRS mov di, mask MF_CALL or mask MF_FIXUP_DS call ObjMessage pop si ;restore offset test cl, mask VA_DETECTABLE jz notMyDiscardDeck call HeartsDeckFlipLastTrick notMyDiscardDeck: ;nothing here because we don't want to do anything. .leave ret HeartsDeckDownCardSelected endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckFlipLastTrick %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Will Flip the last trick that was played CALLED BY: HeartsDeckDownCardSelected PASS: *ds:si = MyDiscardDeck RETURN: nothing DESTROYED: nothing SIDE EFFECTS: will flip the top NUMBER_OF_PLAYERS card of the deck PSEUDO CODE/STRATEGY: Will move ShowLastTrickDeck to a visible point on the screen, then will Pop the top NUMBER_OF_PLAYERS cards from MyDiscardDeck and push them face up onto ShowLastTrickDeck REVISION HISTORY: Name Date Description ---- ---- ----------- PW 2/25/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckFlipLastTrick proc near uses ax,bx,cx,dx,si,di,bp .enter class HeartsDeckClass clr ax ;don't redraw the score call HeartsDeckSetComputerPlayer ;disable player movements Deref_DI Deck_offset BitSet ds:[di].HI_deckAttributes, HDA_FLIPPING_TAKE_TRICK call ObjMarkDirty ; call HeartsDeckSetComputerPlayer ;disable futher play push si ;save offset mov cx, SHOWLASTTRICKDECK_DISPLAY_X_POSITION mov dx, SHOWLASTTRICKDECK_DISPLAY_Y_POSITION mov bx, handle ShowLastTrickDeck mov si, offset ShowLastTrickDeck mov ax, MSG_VIS_SET_POSITION mov di, mask MF_FIXUP_DS or mask MF_CALL call ObjMessage movdw cxdx, bxsi ;^lcx:dx <= ShowLastTrickDeck pop si ;restore handle mov ax, MSG_HEARTS_DECK_TRANSFER_N_CARDS mov bp, NUMBER_OF_CARDS_IN_TRICK call ObjCallInstanceNoLock mov ax, MSG_CARD_MAXIMIZE ;make sure deck doesn't call VisCallFirstChild ;disappear mov bx, segment CardClass mov si, offset CardClass mov ax, MSG_CARD_TURN_FACE_UP mov di, mask MF_RECORD call ObjMessage mov cx, di ;cx <= event mov bx, handle ShowLastTrickDeck mov si, offset ShowLastTrickDeck mov di, mask MF_CALL or mask MF_FIXUP_DS mov ax, MSG_VIS_SEND_TO_CHILDREN call ObjMessage mov ax, MSG_DECK_REDRAW mov di, mask MF_CALL or mask MF_FIXUP_DS call ObjMessage mov ax,SHOW_LAST_TRICK_TIMER_INTERVAL call TimerSleep mov bx, handle MyDiscardDeck mov si, offset MyDiscardDeck mov ax, MSG_HEARTS_DECK_DONE_FLIPPING mov di, mask MF_FIXUP_DS call ObjMessage .leave ret HeartsDeckFlipLastTrick endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HearstDeckTransferNCards %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Transfers a specified number of cards to another deck. CALLED BY: HeartsDeckFlipLastTrick PASS: ds:di = deck instance *ds:si = instance data of deck bp = number of cards to transfer ^lcx:dx = instance of VisCompClass to receive the cards (usually another Deck) CHANGES: The top bp cards of deck at *ds:si are transferred to the top of deck at ^lcx:dx. The order of the cards is preserved. RETURN: nothing DESTROYED: ax, bx, cx, dx, bp PSEUDO CODE/STRATEGY: loops bp times, popping cards (starting with the bp'th, ending with the top)from the donor and pushing them to the recipient and each time a card is removed, maximize it. KNOWN BUGS/IDEAS: *WARNING* A deck must never transfer to itself. REVISION HISTORY: Name Date Description ---- ---- ----------- PW 2/25/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckTransferNCards method HeartsDeckClass, MSG_HEARTS_DECK_TRANSFER_N_CARDS push cx,dx,bp mov ds:[di].DI_lastRecipient.handle, cx mov ds:[di].DI_lastRecipient.chunk, dx mov ds:[di].DI_lastGift, bp call ObjMarkDirty mov ax, MSG_GAME_SET_DONOR mov cx, ds:[LMBH_handle] mov dx, si call VisCallParent pop cx,dx,bp startDeckTransferNCards: dec bp ;see if we're done tst bp jl endDeckTransferNCards push bp ;save count push cx, dx ;save OD of recipient clr cx ;cx:dx <- # of child mov dx, bp ;to remove mov ax, MSG_DECK_REMOVE_NTH_CARD mov di, mask MF_CALL or mask MF_FIXUP_DS call ObjCallInstanceNoLock ;^lcx:dx <- OD of card mov bp, si ;save offset pop bx,si ;restore recipient OD push bp ;push donor offset push bx,si push cx,dx ;save card OD mov ax, MSG_DECK_PUSH_CARD ;give card to recipient mov di, mask MF_FIXUP_DS call ObjMessage pop bx,si ;restore card OD mov ax, MSG_CARD_MAXIMIZE mov di, mask MF_FIXUP_DS call ObjMessage pop cx, dx pop si ;restore donor offset pop bp ;restore count jmp startDeckTransferNCards endDeckTransferNCards: ret HeartsDeckTransferNCards endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckDoneFlipping %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Will return the flipped cards to MyDiscardDeck from ShowLastTrickDeck CALLED BY: The timer and sent to MyDiscardDeck PASS: *ds:si = HeartsDeckClass object ds:di = instance data RETURN: nothing DESTROYED: nothing SIDE EFFECTS: will remove cards from ShowLastTrickDeck and add them to MyDiscardDeck PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- PW 2/25/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckDoneFlipping method dynamic HeartsDeckClass, MSG_HEARTS_DECK_DONE_FLIPPING uses ax, cx, dx, bp .enter BitClr ds:[di].HI_deckAttributes, HDA_FLIPPING_TAKE_TRICK call ObjMarkDirty movdw axbx, ds:[di].HI_timerData ;restore ID and Handle call TimerStop ; call HeartsDeckSetComputerPlayer ;disable futher play mov bx, handle ShowLastTrickDeck mov si, offset ShowLastTrickDeck mov ax, MSG_VIS_GET_BOUNDS mov di, mask MF_FIXUP_DS or mask MF_CALL call ObjMessage push ax,bp,cx,dx ;save boundry mov cx, handle MyDiscardDeck mov dx, offset MyDiscardDeck mov ax, MSG_HEARTS_DECK_TRANSFER_ALL_CARDS_FACE_DOWN mov di, mask MF_FIXUP_DS or mask MF_CALL call ObjMessage mov si, offset MyDiscardDeck mov ax, MSG_CARD_MAXIMIZE call VisCallFirstChild mov cx, SHOWLASTTRICKDECK_X_POSITION mov dx, SHOWLASTTRICKDECK_Y_POSITION ; mov bx, handle ShowLastTrickDeck mov si, offset ShowLastTrickDeck mov ax, MSG_VIS_SET_POSITION mov di, mask MF_FIXUP_DS or mask MF_CALL call ObjMessage mov si, offset MyDiscardDeck mov ax, MSG_VIS_VUP_CREATE_GSTATE call ObjCallInstanceNoLock mov di, bp ;di <= GState pop ax,bx,cx,dx ;restore boundry call GrInvalRect call GrDestroyState clr ax ;don't draw score in red. call HeartsDeckSetHumanPlayer ;enable player movements ; mov bx, handle MyDiscardDeck ; mov si, offset MyDiscardDeck ; mov ax, MSG_DECK_REDRAW ; mov di, mask MF_FIXUP_DS or mask MF_CALL ; call ObjMessage .leave ret HeartsDeckDoneFlipping endm ifdef STEVE COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckUpCardSelected %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: MSG_DECK_UP_CARD_SELECTED handler for DeckClass This method determines which card will be dragged as a result of this card selection CALLED BY: CardStartSelect PASS: *ds:si = deck object cx,dx = mouse bp = # of card selected RETURN: nothing DESTROYED: SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- PW 1/21/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckUpCardSelected method dynamic HeartsDeckClass, MSG_DECK_UP_CARD_SELECTED .enter push cx ;save mouse x-position mov ax, MSG_HEARTS_GAME_GET_GAME_ATTRS call VisCallParent test cl, mask HGA_PASSING_CARDS jz notPassingCards ;passingCards: pop cx ;restore mouse x-position call HeartsDeckAddToChunkArray jmp exitRoutine notPassingCards: pop cx ;restore mouse x-position mov ax, bp mov ds:[di].HI_chosenCard, al call ObjMarkDirty mov bp, 1 ;we only want to move one card mov ax, MSG_DECK_DRAGGABLE_CARD_SELECTED call ObjCallInstanceNoLock exitRoutine: .leave ret HeartsDeckUpCardSelected endm endif COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckAddToChunkArray %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Will add or delete the card in bp to/from the chunk array CALLED BY: HeartsDeckUpCardSelected PASS: *ds:si = deck object cx,dx = mouse bp = # of card selected RETURN: nothing DESTROYED: ax, bx, cx, dx, bp, di SIDE EFFECTS: may add or delete card to/from chunk array PSEUDO CODE/STRATEGY: If card is already in the chunk array, then uninvert it and delete it from the chunk array. If the card is not already in the chunk array and not too many cards have been selected, then invert the card and add it to the chunk array. If the card is not in the chunk array, but the maximum number of cards have been selected, then remove the most recently selected card and add the currently selected card to the chunk array. REVISION HISTORY: Name Date Description ---- ---- ----------- PW 2/22/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckAddToChunkArray proc near cardSelected local word push bp mouse local dword push cx,dx cardAttrs local byte numPassCards local byte deckOptr local optr .enter class HeartsDeckClass mov ax, ds:[LMBH_handle] movdw deckOptr, axsi push bp ;save local vars ptr mov bp, cardSelected mov ax, MSG_DECK_GET_NTH_CARD_ATTRIBUTES call ObjCallInstanceNoLock mov ax, bp ;al <= card attrs. pop bp ;restore local vars ptr mov cardAttrs, al mov ax, MSG_HEARTS_GAME_GET_NUMBER_OF_PASS_CARDS call VisCallParent mov numPassCards, cl movdw bxsi, ds:[di].HI_chunkPointer call MemLock mov ds, ax call ChunkArrayGetCount mov dx, cardSelected ;dl <= card to search for mov dh, cl ;dh <= # array elements ;search to see if the card is already selected clr ax ;ax <= counter continueSearch: cmp dh, al jz elementNotFound ;counter = # array elements call ChunkArrayElementToPtr cmp dl, ds:[di].PCD_cardNumber ;test the card number jz foundElement inc al jmp continueSearch elementNotFound: mov al, numPassCards cmp dh, al je alreadyEnoughSelected dec al cmp dh, al jl addElement ;enable the take trigger push bx,si,bp ;save handle, offset, local mov bx, handle HeartsPassTrigger mov si, offset HeartsPassTrigger mov ax, MSG_GEN_SET_ENABLED mov dl, VUM_NOW mov di, mask MF_CALL or mask MF_FIXUP_DS call ObjMessage pop bx,si,bp ;restore handle, offset, local jmp addElement alreadyEnoughSelected: mov cl, ds:[di].PCD_cardNumber call ChunkArrayDelete ;delete last element mov bx, ds:[LMBH_handle] xchgdw bxsi, deckOptr, ax call MemDerefDS mov ax, MSG_HEARTS_DECK_CLEAR_INVERTED_NTH_CARD call ObjCallInstanceNoLock xchgdw bxsi, deckOptr, ax call MemDerefDS addElement: call ChunkArrayAppend mov ax, cardSelected mov ds:[di].PCD_cardNumber, al mov al, cardAttrs mov ds:[di].PCD_cardAttribute, al jmp invertCard foundElement: call ChunkArrayDelete ;delete the element ;disable the take trigger push bx,si,bp ;save handle, offset, local mov bx, handle HeartsPassTrigger mov si, offset HeartsPassTrigger mov ax, MSG_GEN_SET_NOT_ENABLED mov dl, VUM_NOW mov di, mask MF_CALL or mask MF_FIXUP_DS call ObjMessage pop bx,si,bp ;restore handle, offset, local invertCard: call ObjMarkDirty call MemUnlock ;release chunk array movdw bxsi, deckOptr call MemDerefDS movdw cxdx, mouse mov ax, MSG_CARD_INVERT push bp ;save local vars ptr call VisCallChildUnderPoint pop bp ;restore local vars ptr ;exitRoutine: .leave ret HeartsDeckAddToChunkArray endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckClearInvertedNthCard %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Will uninvert the nth card of the deck CALLED BY: MSG_HEARTS_DECK_CLEAR_INVERTED_NTH_CARD PASS: *ds:si = HeartsDeckClass object cl = card to invert (0 is first card) RETURN: nothing DESTROYED: nothing SIDE EFFECTS: will uninvert the nth card in the deck PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- PW 2/22/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckClearInvertedNthCard method dynamic HeartsDeckClass, MSG_HEARTS_DECK_CLEAR_INVERTED_NTH_CARD uses ax, cx, dx, bp .enter mov dl, cl clr dh ;dx <= child to invert clr cx mov ax, MSG_VIS_FIND_CHILD call ObjCallInstanceNoLock ;now ^lcx:dx = child movdw bxsi, cxdx mov ax, MSG_CARD_CLEAR_INVERTED mov di, mask MF_CALL call ObjMessage .leave ret HeartsDeckClearInvertedNthCard endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckUninvertChunkArray %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Will uninvert the cards associated with the chunk array CALLED BY: MSG_HEARTS_DECK_UNINVERT_CHUNK_ARRAY PASS: *ds:si = HeartsDeckClass object RETURN: nothing DESTROYED: nothing SIDE EFFECTS: will uninvert cards in the deck PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- PW 2/23/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckUninvertChunkArray method dynamic HeartsDeckClass, MSG_HEARTS_DECK_UNINVERT_CHUNK_ARRAY uses ax, cx, dx, bp .enter tstdw ds:[di].HI_chunkPointer jz exitRoutine ;no chunk array mov ax, MSG_CARD_CLEAR_INVERTED call VisSendToChildren exitRoutine: .leave ret HeartsDeckUninvertChunkArray endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckClearChunkArray %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Will clear the Chunk array if it points anywhere CALLED BY: MSG_HEARTS_DECK_CLEAR_CHUNK_ARRAY PASS: *ds:si = HeartsDeckClass object RETURN: nothing DESTROYED: nothing SIDE EFFECTS: will clear the chunk array PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- PW 2/22/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckClearChunkArray method dynamic HeartsDeckClass, MSG_HEARTS_DECK_CLEAR_CHUNK_ARRAY uses ax, cx, dx .enter tstdw ds:[di].HI_chunkPointer jz exitRoutine ;no chunk array ;clearTheArray: movdw bxsi, ds:[di].HI_chunkPointer call MemLock ;lock down LMemBlock mov ds, ax call ChunkArrayZero ;clear all elements call ObjMarkDirty call MemUnlock ;unlock the LMemBlock exitRoutine: .leave ret HeartsDeckClearChunkArray endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckGetNeighborPointer %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: returns the neighborPointer instance data CALLED BY: MSG_HEARTS_DECK_UPDATE_PASS_POINTER PASS: *ds:si = HeartsDeckClass object RETURN: ^lcx:dx = neighborPointer DESTROYED: nothing SIDE EFFECTS: none PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- PW 2/23/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckGetNeighborPointer method dynamic HeartsDeckClass, MSG_HEARTS_DECK_GET_NEIGHBOR_POINTER .enter movdw cxdx, ds:[di].HI_neighborPointer .leave ret HeartsDeckGetNeighborPointer endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckClearPassPointer %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Will clear the passPointer instance data CALLED BY: MSG_HEARTS_DECK_CLEAR_PASS_POINTER PASS: *ds:si = HeartsDeckClass object RETURN: nothing DESTROYED: nothing SIDE EFFECTS: will clear the passPointer instance data PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- PW 2/23/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckClearPassPointer method dynamic HeartsDeckClass, MSG_HEARTS_DECK_CLEAR_PASS_POINTER .enter clrdw ds:[di].HI_passPointer call ObjMarkDirty .leave ret HeartsDeckClearPassPointer endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckDropDrags %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: MSG_DECK_DROP_DRAGS handler for HeartsDeckClass CALLED BY: DeckEndSelect PASS: *ds:si = instance data of deck CHANGES: RETURN: nothing DESTROYED: ax, cx, dx PSEUDO CODE/STRATEGY: sends a method to the playing table asking it to give the drag cards to any deck that'll take them. if the cards are taken: issues a MSG_DECK_REPAIR_SUCCESSFUL_TRANSFER to self and then issues a MSG_HEARTS_DECK_PLAY_CARD to its neighbor else: issues a MSG_DECK_REPAIR_FAILED_TRANSFER to self KNOWN BUGS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- PW 1/26/93 Initial Version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckDropDrags method HeartsDeckClass, MSG_DECK_DROP_DRAGS .enter mov ax, MSG_DECK_GET_DROP_CARD_ATTRIBUTES call ObjCallInstanceNoLock mov ax, MSG_GAME_DROPPING_DRAG_CARDS mov cx, ds:[LMBH_handle] ;tell parent to mov dx, si ;advertise the dropped call VisCallParent ;cards jnc repair mov ax, MSG_DECK_REPAIR_SUCCESSFUL_TRANSFER call ObjCallInstanceNoLock ;;call the next player to play a card mov ax, MSG_HEARTS_GAME_GET_CARDS_PLAYED call VisCallParent inc cl ;increment cards played mov ax, MSG_HEARTS_GAME_SET_CARDS_PLAYED call VisCallParent mov ax, DRAW_SCORE_HIGHLIGHTED ;redraw score in Green call HeartsDeckSetComputerPlayer Deref_DI Deck_offset movdw bxsi, ds:[di].HI_neighborPointer mov di, mask MF_FIXUP_DS or mask MF_FORCE_QUEUE mov ax, MSG_HEARTS_DECK_PLAY_CARD call ObjMessage jmp repairDone repair: mov ax, MSG_DECK_REPAIR_FAILED_TRANSFER ;do visual repairs call ObjCallInstanceNoLock repairDone: .leave ret HeartsDeckDropDrags endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckSetChunkArray %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Creates the chunk-arrays in the same segment as the HeartsDeckClass objects, and stores the handles to the chunk arrays in the object's instance data. The chunk arrays are of variable length, but each entry is a fixed size CALLED BY: HeartsGameSetupGeometry PASS: *ds:si = HeartsDeckClass object RETURN: nothing DESTROYED: nothing SIDE EFFECTS: may move around the local memory heap it is given PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- PW 1/27/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckSetChunkArray method dynamic HeartsDeckClass, MSG_HEARTS_DECK_SET_CHUNK_ARRAY uses ax, cx localMemHandle local word deckOD local optr chunkPointerOffset local lptr playersDataOffset local lptr playedCardOffset local lptr .enter mov bx, ds:[LMBH_handle] mov localMemHandle, bx movdw deckOD, bxsi mov bx, size PassCardData clr cx, si mov ax, mask OCF_DIRTY call ChunkArrayCreate mov chunkPointerOffset, si mov bx, size PlayerData clr si call ChunkArrayCreate mov playersDataOffset, si mov bx, size TrickData clr si call ChunkArrayCreate mov playedCardOffset, si movdw bxsi, deckOD call MemDerefDS Deref_DI Deck_offset mov ax, localMemHandle ;get local mem block handle mov cx, chunkPointerOffset movdw ds:[di].HI_chunkPointer, axcx mov cx, playersDataOffset movdw ds:[di].HI_playersDataPtr, axcx mov cx, playedCardOffset movdw ds:[di].HI_playedCardPtr, axcx call ObjMarkDirty .leave ret HeartsDeckSetChunkArray endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckGetChunkArray %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: will return a handle to the chunk array of the deck CALLED BY: HeartsDeckSwitchPassCards PASS: *ds:si = HeartsDeckClass object RETURN: ^lcx:dx = handle to the chunk array DESTROYED: nothing SIDE EFFECTS: none PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- PW 2/23/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckGetChunkArray method dynamic HeartsDeckClass, MSG_HEARTS_DECK_GET_CHUNK_ARRAY .enter movdw cxdx, ds:[di].HI_chunkPointer .leave ret HeartsDeckGetChunkArray endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckSetNeighbor %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Set the neighbor instance data for the deck. CALLED BY: MSG_HEARTS_DECK_SET_NEIGHBOR PASS: *ds:si = HeartsDeckClass object ^lcx:dx = the optr of the neighbor RETURN: nothing DESTROYED: nothing SIDE EFFECTS: set the instance data for the deck PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- PW 1/28/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckSetNeighbor method dynamic HeartsDeckClass, MSG_HEARTS_DECK_SET_NEIGHBOR .enter movdw ds:[di].HI_neighborPointer, cxdx call ObjMarkDirty .leave ret HeartsDeckSetNeighbor endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckDrawPlayerInstructions %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Draws text above the players cards CALLED BY: INTERNAL PASS: *ds:si - an object in the visual tree di - offset of string in StringResource RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: none KNOWN BUGS/SIDE EFFECTS/IDEAS: This routine should be optimized for SMALL SIZE over SPEED Common cases: unknown REVISION HISTORY: Name Date Description ---- ---- ----------- srs 7/22/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckDrawPlayerInstructions proc far uses ax,bx,cx,dx,di,bp,ds,si .enter push di ;string offset mov ax, MSG_VIS_VUP_CREATE_GSTATE call ObjCallInstanceNoLock mov di, bp ;cx <= GState mov cx, FID_BERKELEY mov dx, TEXT_POINT_SIZE clr ah ;point size (fraction) = 0 call GrSetFont ;change the GState mov ah, CF_INDEX ;indicate we are using a pre-defined ;color, not an RGB value. mov al, C_BLACK ;set text color value call GrSetTextColor ;set text color in GState mov al, C_GREEN call GrSetAreaColor ; mov ax, 0 jfh changed mov ax, INSTRUCTION_TEXT_X mov bx, INSTRUCTION_TEXT_Y movdw cxdx,axbx add cx, INSTRUCTION_TEXT_WIDTH add dx, INSTRUCTION_TEXT_HEIGHT call GrFillRect ;draw over old score mov bx,handle StringResource call MemLock mov ds,ax pop si ;string offst mov si,ds:[si] lodsw ;x pos clr cx ;null terminated string mov ax, INSTRUCTION_TEXT_X ; jfh added mov bx, INSTRUCTION_TEXT_Y call GrDrawText mov bx,handle StringResource call MemUnlock call GrDestroyState ;destroy the graphics state .leave ret HeartsDeckDrawPlayerInstructions endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckSetHumanPlayer %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: will enable the human player to choose a card and place it on the discard pile. CALLED BY: HeartsDeckPlayCard PASS: ax = DRAW_SCORE_HIGHLIGHTED if the score should be draw in red != DRAW_SCORE_HIGHLIGHTED, don't redraw the score. RETURN: nothing DESTROYED: nothing SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- PW 2/ 1/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckSetHumanPlayer proc near uses ax,bx,cx,dx,si,di,bp .enter class HeartsDeckClass mov bx, handle MyDeck mov si, offset MyDeck cmp ax, DRAW_SCORE_HIGHLIGHTED jne dontRedrawScoreInRed clr bp ;no GState to pass mov cx, DRAW_SCORE_HIGHLIGHTED mov ax, MSG_HEARTS_DECK_DRAW_SCORE mov di, mask MF_CALL call ObjMessage dontRedrawScoreInRed: ; mov bx, handle MyDeck ; mov si, offset MyDeck mov ax, MSG_VIS_SET_ATTRS mov dl, VUM_NOW mov cx, mask VA_DETECTABLE mov di, mask MF_FIXUP_DS call ObjMessage .leave ret HeartsDeckSetHumanPlayer endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckSetComputerPlayer %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Will disable the human player from being able to move any cards. CALLED BY: HeartsDeckDropDrags PASS: ax = DRAW_SCORE_HIGHLIGHTED if the score of MyDeck should be un-highlighted != DRAW_SCORE_HIGHLIGHTED, don't redraw the score. RETURN: nothing DESTROYED: nothing SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- PW 2/ 1/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckSetComputerPlayer proc near uses ax,bx,cx,dx,si,di,bp .enter class HeartsDeckClass mov bx, handle MyDeck mov si, offset MyDeck cmp ax, DRAW_SCORE_HIGHLIGHTED jne dontRedrawScoreInRed clr bp ;no GState to pass clr cx ;don't draw score in Red mov ax, MSG_HEARTS_DECK_DRAW_SCORE mov di, mask MF_CALL call ObjMessage dontRedrawScoreInRed: ; mov bx, handle MyDeck ; mov si, offset MyDeck mov ax, MSG_VIS_SET_ATTRS mov dl, VUM_NOW mov cx, (mask VA_DETECTABLE) shl 8 mov di, mask MF_FIXUP_DS call ObjMessage .leave ret HeartsDeckSetComputerPlayer endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckSetDiscardDeck %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Will set or unset the DiscardDeck as dectectable CALLED BY: PASS: cx = 0 for setting undectable = 1 for setting dectable RETURN: nothing DESTROYED: ax,bx,cx,dx,si,di SIDE EFFECTS: will set or unset discarddeck PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- PW 2/19/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckSetDiscardDeck proc near .enter mov ax, (mask VA_DETECTABLE) shl 8 jcxz setUndetectable ;setDetectable: mov ax, mask VA_DETECTABLE setUndetectable: mov cx, ax mov bx, handle DiscardDeck mov si, offset DiscardDeck mov ax, MSG_VIS_SET_ATTRS mov dl, VUM_NOW mov di, mask MF_FIXUP_DS call ObjMessage .leave ret HeartsDeckSetDiscardDeck endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckSetTakeTrigger %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: set up the timer to take the trick. CALLED BY: HeartsDeckPlayCard PASS: nothing RETURN: nothing DESTROYED: nothing SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- PW 1/27/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckSetTakeTrigger proc near uses ax,bx,cx,dx,si,di .enter class HeartsDeckClass mov ax,SHOW_TRICK_BEFORE_TAKING_IT_TIMER_INTERVAL call TimerSleep mov bx, handle DiscardDeck mov si, offset DiscardDeck mov ax, MSG_HEARTS_DECK_TAKE_TRICK mov di, mask MF_FIXUP_DS call ObjMessage .leave ret HeartsDeckSetTakeTrigger endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckSetupDrag %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: MSG_DECK_SETUP_DRAG handler for DeckClass Prepares the deck's drag instance data for dragging. CALLED BY: PASS: *ds:si = deck object cx,dx = mouse position bp = # of children to drag RETURN: nothing DESTROYED: ax, bp SIDE EFFECTS: fills in some drag data PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- PW 1/21/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckSetupDrag method dynamic HeartsDeckClass, MSG_DECK_SETUP_DRAG .enter push cx,dx ;save mouse position push bp mov ax, MSG_VIS_GET_BOUNDS call ObjCallInstanceNoLock Deref_DI Deck_offset mov ax, ds:[di].DI_offsetFromUpCardX mov ah, ds:[di].HI_chosenCard mul ah add cx, ax ;add offset to the ;right position mov ds:[di].DI_initRight, cx mov ds:[di].DI_initBottom, dx pop bp mov cx, VUQ_CARD_DIMENSIONS mov ax, MSG_VIS_VUP_QUERY call VisCallParent push dx Deref_DI Deck_offset mov ds:[di].DI_nDragCards, bp mov al, ds:[di].HI_chosenCard clr ah mov bp, ax ;bp <- drag card # push bp ;save drag card # mov ax, ds:[di].DI_offsetFromUpCardX ;ax <- horiz. offset mul bp ;ax <- offset * #cards ; = total offset ; add cx, ax mov ds:[di].DI_dragWidth, cx ;dragWidth = ;cardWidth + tot.offset mov cx, ds:[di].DI_topCardLeft sub cx,ax ;cx <- left drag bound mov ds:[di].DI_prevLeft, cx mov ds:[di].DI_initLeft, cx pop ax mul ds:[di].DI_offsetFromUpCardY pop dx add dx, ax mov ds:[di].DI_dragHeight, dx ;dragHeight = ;cardHeight + offset mov dx, ds:[di].DI_topCardTop sub dx,ax ;dx <- top drag bound mov ds:[di].DI_prevTop, dx mov ds:[di].DI_initTop, dx pop ax,bx ;restore mouse position sub ax, cx ;get offset from mouse mov ds:[di].DI_dragOffsetX, ax ;left to drag left sub bx, dx ;get offset from mouse mov ds:[di].DI_dragOffsetY, bx ;top to drag top call ObjMarkDirty .leave ret HeartsDeckSetupDrag endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckGetDropCardAttributes %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: returns the drop cards attributes CALLED BY: MSG_DECK_GET_DROP_CARD_ATTRIBUTES PASS: ds:di = deck instance *ds:si = instance data of deck RETURN: bp = CardAttrs of the drop card The "drop card" is the card in a drag group whose attributes must be checked when determining the legality of a transfer DESTROYED: nothing SIDE EFFECTS: none PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- PW 1/22/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckGetDropCardAttributes method dynamic HeartsDeckClass, MSG_DECK_GET_DROP_CARD_ATTRIBUTES .enter mov al, ds:[di].HI_chosenCard clr ah mov bp, ax mov ax, MSG_DECK_GET_NTH_CARD_ATTRIBUTES call ObjCallInstanceNoLock .leave ret HeartsDeckGetDropCardAttributes endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckTransferDraggedCards %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: MSG_DECK_TRANSFER_DRAGGED_CARDS handler for DeckClass Transfers the deck's drag cards (if any) to another deck. CALLED BY: MSG_DECK_TRANSFER_DRAGGED_CARDS PASS: ds:di = deck instance *ds:si = instance data of deck ^lcx:dx = deck to which to transfer the cards RETURN: nothing DESTROYED: ax, bp, cx, dx SIDE EFFECTS: deck *ds:si transfers its cards to deck ^lcx:dx PSEUDO CODE/STRATEGY: forwards the call to MSG_HEARTS_DECK_TRANSFER_NTH_CARD, setting N to the number of dragged card REVISION HISTORY: Name Date Description ---- ---- ----------- PW 1/22/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckTransferDraggedCards method dynamic HeartsDeckClass, MSG_DECK_TRANSFER_DRAGGED_CARDS .enter mov al, ds:[di].HI_chosenCard ;set bp = # drag card clr ah mov bp, ax mov ax, MSG_HEARTS_DECK_TRANSFER_NTH_CARD ;and transfer them call ObjCallInstanceNoLock .leave ret HeartsDeckTransferDraggedCards endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckTestSuitCondition %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: test to see if the deck will accept the card that is being discarded. CALLED BY: MSG_HEARTS_DECK_TEST_SUIT_CONDITION PASS: *ds:si = instance data of deck bp = CardAttr of the drop card (bottom card in the drag) ^lcx:dx = potential donor deck RETURN: carry set if transfer occurs, carry clear if not cl = reason card not accepted DESTROYED: ax, ch, dx, bp SIDE EFFECTS: PSEUDO CODE/STRATEGY: check if this is the first play of the game and if it is, then only accept the two of clubs. check if the deck is empty, and if so, then accept the card if not then : check to see if the card being discarded is of the same suit as the first card in the deck, and if it is then accept it and if not then: check if the donor deck is out of the suit that was lead (the suit of the first card in the deck), and if so, accept the card and if not, then reject the card. REVISION HISTORY: Name Date Description ---- ---- ----------- PW 1/29/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckTestSuitCondition method dynamic HeartsDeckClass, MSG_HEARTS_DECK_TEST_SUIT_CONDITION .enter push cx ;save handle of donnor deck mov ax, MSG_HEARTS_GAME_GET_CARDS_PLAYED call VisCallParent cmp cl, 0 pop cx ;restore handle of donnor deck jge notFirstCardOfGame mov cl, MUST_PLAY_TWO_OF_CLUBS and bp, SUIT_MASK or RANK_MASK cmp bp, TWO or CLUBS jne dontAcceptCard clr cl ;set number of cards played ;to zero mov ax, MSG_HEARTS_GAME_SET_CARDS_PLAYED call VisCallParent stc jmp acceptCard notFirstCardOfGame: push cx mov ax, MSG_DECK_GET_N_CARDS call ObjCallInstanceNoLock mov ax, cx pop cx tst ax ;check if deck is empty jnz deckNotEmpty ;deckEmpty: and bp, SUIT_MASK mov ax, HEARTS cmp ax, bp ;check if it is a heart stc jne acceptCard ;heartPlayed: push cx ;save handle mov ax, MSG_HEARTS_GAME_CHECK_HEARTS_BROKEN call VisCallParent tst cl stc pop cx ;restore handle jnz acceptCard call HeartsDeckMakeSureNotJustHeartsLeft jc acceptCard mov cl, HEARTS_NOT_BROKEN_YET jmp dontAcceptCard deckNotEmpty: push bp ;save card attributes mov bp, ax dec bp ;set bp to bottom card number mov ax, MSG_DECK_GET_NTH_CARD_ATTRIBUTES call ObjCallInstanceNoLock pop ax ;restore card attributes push bp ;save card attributes and bp, SUIT_MASK and ax, SUIT_MASK cmp ax, bp ;check if suits are the same pop bp ;restore card attributes stc jz acceptCard ;;not the same suits mov bx, cx mov si, dx ; clr cx ;doesn't matter here if ;we search for highest or ;lowest card, but chosing ;highest mov ax, MSG_HEARTS_DECK_FIND_HIGH_OR_LOW mov di, mask MF_CALL or mask MF_FIXUP_DS call ObjMessage stc jcxz acceptCard mov cl, MUST_FOLLOW_SUIT dontAcceptCard: clc acceptCard: .leave ret HeartsDeckTestSuitCondition endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckMakeSureNotJustHeartsLeft %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: will check and see if the only cards in the players deck are hearts. CALLED BY: HeartsDeckTestSuitCondition PASS: ^lcx:dx = deck to check RETURN: carry set if only hearts are left carry clear if more than just hearts left DESTROYED: ax, bx, cx, bp, si, di SIDE EFFECTS: none PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- PW 3/23/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckMakeSureNotJustHeartsLeft proc near .enter movdw bxsi, cxdx mov ax, MSG_DECK_GET_N_CARDS mov di, mask MF_CALL call ObjMessage keepChecking: mov bp, cx dec bp mov ax, MSG_DECK_GET_NTH_CARD_ATTRIBUTES mov di, mask MF_CALL call ObjMessage and bp, SUIT_MASK cmp bp, HEARTS jne notAllHearts loop keepChecking stc jmp exitRoutine notAllHearts: clc exitRoutine: .leave ret HeartsDeckMakeSureNotJustHeartsLeft endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckExplain %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Will Bring up a dialog box to explain why the card is not accepted. CALLED BY: MSG_HEARTS_DECK_EXPLAIN PASS: *ds:si = HeartsDeckClass object ds:di = HeartsDeckClass instance data cl = NonAcceptanceReason dx = sound to play (0 for no sound) RETURN: nothing DESTROYED: ax, cx, dx, bp SIDE EFFECTS: will bring up a dialog box PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- PW 3/ 9/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckExplain method dynamic HeartsDeckClass, MSG_HEARTS_DECK_EXPLAIN .enter xchg cx, dx jcxz dontPlaySound call HeartsGamePlaySound dontPlaySound: xchg cx, dx mov al, size optr mul cl ;ax <= offset in table mov bx, offset heartsDeckExplainationTable add bx, ax mov dx, cs:[bx].handle mov bp, cs:[bx].offset ;^ldx:bp <= string to display mov bx, handle HeartsExplainText mov si, offset HeartsExplainText clr cx ;null terminated string. mov ax, MSG_VIS_TEXT_REPLACE_ALL_OPTR mov di, mask MF_CALL or mask MF_FIXUP_DS call ObjMessage mov bx, handle HeartsExplaining mov si, offset HeartsExplaining call UserDoDialog .leave ret HeartsDeckExplain endm heartsDeckExplainationTable optr \ PlayTwoOfClubs, HeartsNotBroken, MustFollowSuit COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckFindHighOrLow %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Returns the number of the card in the deck with the highest/lowest card of the suit passed in bp. Also, can set a zero point so that it will find the highest card less than a certain number, or the lowest card greater than a certain number. CALLED BY: MSG_HEARTS_DECK_FIND_HIGH_OR_LOW PASS: *ds:si = HeartsDeckClass object bp = CardAttr of suit ch = 0 (find absolute highest/lowest) = NON_ZERO (use this as zero point) cl = 0 to find highest card = non-zero to find lowest card RETURN: ch = number of highest card of that suit in deck cl = value of highest card of that suit in the deck (0 if no cards of that suit) DESTROYED: nothing SIDE EFFECTS: none PSEUDO CODE/STRATEGY: Find the first card of the suit you are looking for. Check all the other cards of the deck with the same suit to see if they match the request better. You can either be searching for the absolute highest or lowest card, or you can be searching for the highest card below a certain value, or the lowest card above a certain value. REVISION HISTORY: Name Date Description ---- ---- ----------- PW 1/29/93 Initial version PW 2/05/93 modified to add the non-absolute search %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckFindHighOrLow method dynamic HeartsDeckClass, MSG_HEARTS_DECK_FIND_HIGH_OR_LOW uses ax, dx, bp .enter clr bh mov bl, cl ;save check for high or low mov cl, ch clr ch mov di, cx ;save zero point mov ax, MSG_DECK_GET_N_CARDS call ObjCallInstanceNoLock tst cx jnz deckNotEmpty ;deckEmpty: jmp exitRoutine deckNotEmpty: mov dx, bp ;save card attributes and dx, SUIT_MASK mov bp, cx clr cx countingLoop: dec bp ;set bp to current card number push bp ;save card number mov ax, MSG_DECK_GET_NTH_CARD_ATTRIBUTES call ObjCallInstanceNoLock mov ax, bp and bp, SUIT_MASK cmp dx, bp ;check if suits are the same jnz notTheSameSuit ;areTheSameSuit: call HeartsDeckGetCardRank ;al <= card rank tst di jz firstCard ;jump if looking for absolute jcxz firstCard ;jump if this the first card ;of the correct suit ;this code deals with finding a card that is the largest up to ;a certain card, or smallest above a certain card. push dx ;save suit variable mov dx, di ;move ZERO_POINT into dx mov dh, dl sub dl, cl ;normalize card value sub dh, al ;normalize card value tst bx ;check if searching for ;high or low jz searchingForLargest ;searchingForSmallest: cmp dl, 0 ;check if previous card was ;big enough after normalization jg smallFindHighest jz smallNotTheSameSuit cmp dh, 0 ;check if this card is big ;enough after normalization pop dx ;restore suit variable jle firstCard jmp notTheSameSuit smallFindHighest: pop dx ;restore suit variable cmp al, cl jl notTheSameSuit jmp markAsBest smallNotTheSameSuit: pop dx ;restore suit variable jmp notTheSameSuit searchingForLargest: cmp dl, 0 ;check if previous card was ;small enough after ;normalization jl largeFindLowest jz largeNotTheSameSuit cmp dh, 0 ;check if this card is small ;enough after normalization pop dx ;restore suit variable jge firstCard jmp notTheSameSuit largeFindLowest: pop dx ;restore suit variable cmp al, cl jg notTheSameSuit jmp markAsBest largeNotTheSameSuit: pop dx ;restore suit variable jmp notTheSameSuit ;end of code dealing with finding a card that is the largest up to ;a certain card, or smallest above a certain card. firstCard: cmp al, cl ;check if the card rank is ;greater than largest one so ;far xchg bx, cx jcxz findHighest ;check for high/low xchg bx, cx jcxz markAsBest ;first card of suit jg notTheSameSuit jmp markAsBest ;lower card found findHighest: xchg bx, cx ; cmp al, cl jl notTheSameSuit ;taken if current card being ;looked at not as big as ;the best card seen so far. markAsBest: pop bp ;get card number push bp ;save card number mov cx, bp mov ch, cl mov cl, al notTheSameSuit: pop bp ;restore card number tst bp jz exitRoutine jmp countingLoop exitRoutine: .leave ret HeartsDeckFindHighOrLow endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckCountNumberOfSuit %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Will return the number of cards of a given suit and the highest card of that suit. CALLED BY: MSG_HEARTS_DECK_COUNT_NUMBER_OF_SUIT PASS: *ds:si = HeartsDeckClass object ds:di = HeartsDeckClass instance data bp = card attrs. of suit to find RETURN: cl = number of cards of given suit ch = rank of hightest card of given suit dx = number of highest card in deck DESTROYED: ax SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- PW 3/25/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckCountNumberOfSuit method dynamic HeartsDeckClass, MSG_HEARTS_DECK_COUNT_NUMBER_OF_SUIT cardAttrs local word push bp numCards local word numSuit local byte highestCard local byte ;rank of highest card highestCardNum local word ;number of card in deck .enter clr numSuit, highestCard push bp ;save locals mov ax, MSG_DECK_GET_N_CARDS call ObjCallInstanceNoLock pop bp ;restore locals jcxz exitRoutine mov numCards, cx and cardAttrs, SUIT_MASK searchingLoop: dec numCards push bp ;save locals mov bp, numCards mov ax, MSG_DECK_GET_NTH_CARD_ATTRIBUTES call ObjCallInstanceNoLock mov ax, bp ;ax <= card attrs. pop bp ;restore locals mov dx, ax and dx, SUIT_MASK cmp dx, cardAttrs jne continueLoop ; ;a card of the correct suit has been found ; inc numSuit call HeartsDeckGetCardRank cmp al, highestCard jl continueLoop ; ;a higher card has been found ; mov highestCard, al mov ax, numCards mov highestCardNum, ax continueLoop: tst numCards jnz searchingLoop mov cl, numSuit mov ch, highestCard mov dx, highestCardNum exitRoutine: .leave ret HeartsDeckCountNumberOfSuit endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckGetChanceOfTaking %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: will return the chance of taking the trick based on what has already been played CALLED BY: PASS: *ds:si = instance data of object ax = card attributes of card to play RETURN: cx = number of cards still out that could take the trick if this card was played. (-1 if card will not take trick) DESTROYED: nothing SIDE EFFECTS: none PSEUDO CODE/STRATEGY: Go through MyDiscardDeck and see how many cards could take this card and then return : Rank of Ace - Rank of card - # of cards already played. REVISION HISTORY: Name Date Description ---- ---- ----------- PW 2/10/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckGetChanceOfTaking proc near uses ax,bx,dx,bp,ds,si,di .enter class HeartsDeckClass mov bp, ax call HeartsDeckCheckIfLastCard mov dx, bp ;save card attributes jc lastCard mov ax, MSG_HEARTS_GAME_GET_CARDS_PLAYED call VisCallParent cmp cl, 0 jle setTake ;card is highest of cards ;lead, since its first card. jmp notFirstCardPlayed lastCard: mov cl, NUM_PLAYERS -1 notFirstCardPlayed: push cx ;save # of cards played mov ax, MSG_HEARTS_GAME_GET_TAKE_CARD_ATTR call VisCallParent mov bl, cl ;bl <= takeCardAttr. pop cx ;restore # of cards played mov al, dl ;restore card attributes and al, SUIT_MASK and bl, SUIT_MASK cmp al, bl jne wontTakeTrick ;not the same suit, can't win ;sameSuit: mov al, dl ;restore card attributes and al, RANK_MASK cmp al, RANK_ACE je takeTheTrick ;if an ace, it takes the trick push ax, cx ;save card attr. and # cards ;played mov ax, MSG_HEARTS_GAME_GET_TAKE_CARD_ATTR call VisCallParent mov bl, cl ;bl <= takeCardAttr. pop ax, cx ;restore card attr. and # ;cards played and bl, RANK_MASK cmp bl, RANK_ACE je wontTakeTrick ;if take card is ace, can't win cmp al, bl jl wontTakeTrick ;card is smaller cmp cl, NUM_PLAYERS -1 je takeTheTrick ;if last card out, will win setTake: mov al, dl ;restore card attributes and dl, SUIT_MASK call HeartsDeckGetCardRank mov dh, al ;dh <= card rank mov ax, MSG_DECK_GET_N_CARDS call ObjCallInstanceNoLock clr bp ;clear # of cards greater mov bx, ds:[LMBH_handle] call HeartsDeckDiscardLoop ;calculate # of cards greater mov bx, handle MyDiscardDeck mov si, offset MyDiscardDeck mov di, mask MF_CALL or mask MF_FIXUP_DS mov ax, MSG_DECK_GET_N_CARDS call ObjMessage jcxz discardDeckEmpty ;discardDeckNotEmpty: call HeartsDeckDiscardLoop ;calculate # of card greater discardDeckEmpty: mov cx, ACE_VALUE ;cx <= rank ace sub cl, dh ;return rank ace - rank card sub cx, bp ;cx <= cx - # greater cards jmp exitRoutine wontTakeTrick: mov cx, -1 jmp exitRoutine takeTheTrick: clr cx exitRoutine: .leave ret HeartsDeckGetChanceOfTaking endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckDiscardLoop %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: will determine the number of cards greater than the give card. CALLED BY: HeartsDeckGetChanceOfTaking PASS: bp = number of card already greater than card to compair with. cx = number of cards in deck ^lbx:si = deck to count cards of dl = suit of card to compair with dh = rank of card to compair with RETURN: bp = # of cards greater than card to compair with DESTROYED: cx = 0 at the end di, ax SIDE EFFECTS: none PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- PW 2/12/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckDiscardLoop proc near .enter class HeartsDeckClass push bp ;save number of cards ;greater than compair card discardLoop: mov bp, cx ;bp <= card number to find dec bp mov di, mask MF_CALL or mask MF_FIXUP_DS mov ax, MSG_DECK_GET_NTH_CARD_ATTRIBUTES call ObjMessage mov ax, bp ;ax <= nth card attr. and al, SUIT_MASK cmp al, dl ;check if same suit jne continueLoop mov ax, bp ;ax <= nth card attr. call HeartsDeckGetCardRank cmp al, dh ;compair the card ranks jle continueLoop pop bp inc bp ;increment # cards greater ;than passed card push bp continueLoop: loop discardLoop pop bp ;restore # of card greater ;than passed card .leave ret HeartsDeckDiscardLoop endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckGetStrategicCardValue %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Will return the strategic card value that is used to determine the value of taking a particular card CALLED BY: PASS: ax = CardAttrs RETURN: cx = strategic card value DESTROYED: nothing SIDE EFFECTS: none PSEUDO CODE/STRATEGY: Jack of Diamonds = +100 Queen of Spades = -180 Heart = (5 - # of Heart) * 3 Club = 10 - # of Club Diamond = # of Diamond (Queen) = 20 (King) = 21 (Ace) = 22 Spade = # of Spade (Ace) = -21 (King) = -20 REVISION HISTORY: Name Date Description ---- ---- ----------- PW 2/10/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckGetStrategicCardValue proc near uses ax .enter clr ch ;make sure that ;cx = cl mov ah, al ;save CardAttrs and al, RANK_MASK or SUIT_MASK cmp al, JACK or DIAMONDS je jackOfDiamonds mov al, ah ;restore CardAttrs and al, RANK_MASK or SUIT_MASK cmp al, QUEEN or SPADES je queenOfSpades mov al, ah ;restore CardAttrs ;;calculate rank for card and store in ah call HeartsDeckGetCardRank xchg al, ah ;;done calculating rank ;findSuit: and al, SUIT_MASK cmp al, HEARTS je isHearts cmp al, CLUBS je isClubs cmp al, DIAMONDS je isDiamonds ;isSpades: mov al, ah cmp al, 13 jl notAceOrKing mov al, -7 sub al, ah notAceOrKing: cbw ;make sure ax is signed mov cx, ax jmp exitRoutine jackOfDiamonds: mov cx, 100 jmp exitRoutine queenOfSpades: mov cx, -180 jmp exitRoutine isHearts: mov al, 3 mul ah ;al <= 3 * card rank mov ah, 3*5 ;ah <= 15 xchg al, ah sub al, ah ;al <= 15 - card rank * 3 cbw mov cx, ax jmp exitRoutine isClubs: mov al, 10 sub al, ah cbw mov cx, ax jmp exitRoutine isDiamonds: cmp ah, 12 jl notGreaterThanJack add ah, 8 notGreaterThanJack: mov cl, ah ; jmp exitRoutine exitRoutine: .leave ret HeartsDeckGetStrategicCardValue endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckSetTakeData %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Will set the two global variables that indicate who is going to take the trick. (The two variables are : TakeCardAttr, TakePointer). CALLED BY: PASS: bp = card attributes of discard card ^lcx:dx = donor deck RETURN: nothing DESTROYED: nothing SIDE EFFECTS: sets Take global variables PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- PW 2/ 1/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckSetTakeData proc near uses ax,bx,bp,si,di discardAttr local word push bp donorDeck local optr push cx, dx takeCardAttr local byte .enter mov bx, handle HeartsPlayingTable mov si, offset HeartsPlayingTable mov ax, MSG_HEARTS_GAME_GET_CARDS_PLAYED mov di, mask MF_FIXUP_DS or mask MF_CALL call ObjMessage cmp cl, 0 jle setTake ;firstCardPlayed ;notFirstCardPlayed: mov ax, MSG_HEARTS_GAME_GET_TAKE_CARD_ATTR mov di, mask MF_FIXUP_DS or mask MF_CALL call ObjMessage mov takeCardAttr, cl mov bl, takeCardAttr mov ax, discardAttr and al, SUIT_MASK and bl, SUIT_MASK cmp al, bl jne exitRoutine ;not the same suit, can't win ;sameSuit: mov ax, discardAttr and al, RANK_MASK cmp al, RANK_ACE je setTake ;if an ace, it takes the trick mov bl, takeCardAttr and bl, RANK_MASK cmp bl, RANK_ACE je exitRoutine ;if an ace, it takes the trick cmp al, bl jl exitRoutine ;card is smaller setTake: mov cx, discardAttr mov bx, handle HeartsPlayingTable mov ax, MSG_HEARTS_GAME_SET_TAKE_CARD_ATTR mov di, mask MF_FIXUP_DS or mask MF_CALL call ObjMessage mov cx, donorDeck.handle ; mov dx, donorDeck.offset ;dx is never changed. mov ax, MSG_HEARTS_GAME_SET_TAKE_POINTER mov di, mask MF_FIXUP_DS or mask MF_CALL call ObjMessage exitRoutine: movdw cxdx, donorDeck ;restore donorDeck .leave ret HeartsDeckSetTakeData endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckTakeCardsIfOK %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: MSG_DECK_TAKE_CARDS_IF_OK handler for HeartsDeckClass Determines whether a deck will accept a drop from another deck. If so, issues a MSG_DECK_TRANSFER_DRAGGED_CARDS to the donor. CALLED BY: PASS: *ds:si = instance data of deck bp = CardAttr of the drop card (bottom card in the drag) ^lcx:dx = potential donor deck CHANGES: If the transfer is accepted, the deck with OD ^lcx:dx transfers #DI_nDragCards cards to the deck RETURN: carry set if transfer occurs, carry clear if not DESTROYED: ax, cx, dx, bp PSEUDO CODE/STRATEGY: calls TestAcceptCards if deck accepts, issues a MSG_DECK_TRANSFER_DRAGGED_CARDS to donor KNOWN BUGS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- PW 1/29/93 initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckTakeCardsIfOK method HeartsDeckClass, MSG_DECK_TAKE_CARDS_IF_OK dropCardAttr local word push bp donorDeck local optr push cx, dx .enter mov ax, MSG_DECK_TEST_ACCEPT_CARDS call ObjCallInstanceNoLock LONG jnc endDeckTakeCardsIfOK ;deck wont accept cards movdw cxdx, donorDeck push bp ;save bp for local vars mov bp, dropCardAttr mov ax, MSG_HEARTS_DECK_TEST_SUIT_CONDITION call ObjCallInstanceNoLock pop bp ;restore bp for local vars jc willAccept push bp ;save locals mov dx, HS_WRONG_PLAY ;dx <= sound to play mov ax, MSG_HEARTS_DECK_EXPLAIN call ObjCallInstanceNoLock pop bp ;restore locals clc ;indiate not taking cards jmp endDeckTakeCardsIfOK ;deck wont accept cards willAccept: movdw cxdx, donorDeck push bp ;save bp for local vars mov bp, dropCardAttr call HeartsDeckSetTakeData pop bp ;restore bp for local vars push bp ;save locals push si ;save offset movdw bxsi, donorDeck clr bp mov ax, MSG_DECK_GET_NTH_CARD_ATTRIBUTES mov di, mask MF_CALL or mask MF_FIXUP_DS call ObjMessage mov cx, bp ;cl <= card attrs. mov ax, MSG_HEARTS_DECK_GET_DECK_ID_NUMBER mov di, mask MF_CALL or mask MF_FIXUP_DS call ObjMessage mov ax, MSG_HEARTS_GAME_SET_PLAYERS_DATA mov bx, handle HeartsPlayingTable mov si, offset HeartsPlayingTable mov di, mask MF_CALL or mask MF_FIXUP_DS call ObjMessage pop si ;restore offset pop bp ;restore locals ; mov ax, MSG_GAME_GET_DRAG_TYPE ; call VisCallParent ;transferCards: movdw cxdx, donorDeck mov bx, ds:[LMBH_handle] xchgdw bxsi, cxdx ;^lbx:si = donor ;^lcx:dx = recipient mov ax, MSG_DECK_TRANSFER_DRAGGED_CARDS ;do the transfer mov di, mask MF_FIXUP_DS call ObjMessage push bp ;save locals mov bx, handle HeartsPlayingTable mov si, offset HeartsPlayingTable mov ax, MSG_HEARTS_GAME_SET_SHOOT_DATA mov di, mask MF_FIXUP_DS or mask MF_CALL call ObjMessage pop bp ;restore locals stc ;indicate that we took ;the cards endDeckTakeCardsIfOK: .leave ret HeartsDeckTakeCardsIfOK endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckTestAcceptCards %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: MSG_DECK_TEST_ACCEPT_CARDS handler for DeckClass Tests deck to see whether a set of dragged cards would be accepted to the drag if it were dropped right now (i.e., rank&suit are ok, and position is ok). CALLED BY: PASS: ds:di = deck instance *ds:si = instance data of deck ^lcx:dx = potential donor deck CHANGES: RETURN: carry set if deck would accept cards, carry clear otherwise DESTROYED: ax, cx, dx PSEUDO CODE/STRATEGY: calls TestRightCard to see if the card type is correct calls CheckDragCaught to see if the bounds are correct KNOWN BUGS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- jon 7/90 initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckTestAcceptCards method HeartsDeckClass, MSG_DECK_TEST_ACCEPT_CARDS push bp test ds:[di].DI_deckAttrs, mask DA_WANTS_DRAG jz endTest mov ax, ds:[LMBH_handle] cmp ax, cx jnz notTheSameObject cmp si, dx clc jz endTest notTheSameObject: mov ax, MSG_DECK_CHECK_DRAG_CAUGHT ;see if the drag area is in the call ObjCallInstanceNoLock ;right place endTest: pop bp ;;the carry bit will now be set if the deck will accept the cards ret HeartsDeckTestAcceptCards endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckTransferNthCard %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Shifts the nth card to make it the first card on the deck, and then transfers the top card to the other deck CALLED BY: HeartsDeckTransferDraggedCards PASS: ds:di = deck instance *ds:si = instance data of deck bp = number of card to transfer ^lcx:dx = instance of VisCompClass to receive the cards (usually another Deck) RETURN: nothing DESTROYED: ax, cx, dx, bp SIDE EFFECTS: The bp card of the deck at *ds:si is transferred to the top of deck at ^lcx:dx. The order of the cards is preserved. PSEUDO CODE/STRATEGY: pop the n'th card and push it on the recipient deck KNOWN BUGS/IDEAS: *WARNING* A deck must never transfer to itself. REVISION HISTORY: Name Date Description ---- ---- ----------- PW 1/22/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckTransferNthCard method dynamic HeartsDeckClass, MSG_HEARTS_DECK_TRANSFER_NTH_CARD .enter push cx mov cx, bp mov ax, MSG_HEARTS_DECK_SHIFT_CARDS mov di, mask MF_FIXUP_DS ; clr ch ;redraw deck call ObjCallInstanceNoLock pop cx mov bp, 1 ;transfers 1 card mov ax, MSG_DECK_TRANSFER_N_CARDS call ObjCallInstanceNoLock .leave ret HeartsDeckTransferNthCard endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckCalculateScore %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Will calculate the amount of points in the deck CALLED BY: HeartsDeckTakeTrick PASS: *ds:si = HeartsDeckClass object RETURN: cx = points al = positive points ah = negative points DESTROYED: nothing SIDE EFFECTS: none PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- PW 2/ 3/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckCalculateScore method dynamic HeartsDeckClass, MSG_HEARTS_DECK_CALCULATE_SCORE uses dx, bp .enter mov ax, MSG_DECK_GET_N_CARDS call ObjCallInstanceNoLock jcxz exitRoutine mov dx, cx ;store number of cards clr cx ;store total score Scoreloop: dec dx mov bp, dx mov ax, MSG_DECK_GET_NTH_CARD_ATTRIBUTES call ObjCallInstanceNoLock call HeartsDeckGetCardScore mov ax, bp cmp ax, 0 jz continueLoop jl negativeValue ;positiveValue: add cl, al jmp continueLoop negativeValue: add ch, al continueLoop: tst dx jnz Scoreloop mov ax, cx add al, ah cbw xchg ax, cx exitRoutine: .leave ret HeartsDeckCalculateScore endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckGetCardScore %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: calculate the value of a card given it's attributes CALLED BY: HeartsDeckCalculateScore PASS: bp = card attributes RETURN: bp = card value DESTROYED: nothing SIDE EFFECTS: none PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- PW 2/ 3/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckGetCardScore proc near uses ax .enter mov ax, bp ;save card attr. and al, SUIT_MASK cmp al, HEARTS je isHearts ;notHearts: cmp al, DIAMONDS je isDiamonds ;notDiamonds: cmp al, CLUBS je isClubs ;notClubs: ;isSpades: mov ax, bp and al, RANK_MASK cmp al, QUEEN jne isClubs mov bp, QUEEN_OF_SPADES_POINTS jmp exitRoutine isHearts: mov bp, HEARTS_POINTS jmp exitRoutine isDiamonds: mov ax, bp and al, RANK_MASK cmp al, JACK jne isClubs mov bp, JACK_OF_DIAMONDS_POINTS jmp exitRoutine isClubs: clr bp exitRoutine: .leave ret HeartsDeckGetCardScore endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckGetRawScore %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: returns both the positive and negative points recieved for this round CALLED BY: HeartsGameCheckShootMoon, HeartsGameGetAbsolutePoints PASS: *ds:si = HeartsDeckClass object RETURN: cl = positive points ch = negative points DESTROYED: nothing SIDE EFFECTS: none PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- PW 2/16/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckGetRawScore method dynamic HeartsDeckClass, MSG_HEARTS_DECK_GET_RAW_SCORE .enter mov cx, ds:[di].HI_thisRoundScore .leave ret HeartsDeckGetRawScore endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckGetScore %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: returns the score of this round, or the total score CALLED BY: MSG_HEARTS_DECK_GET_SCORE PASS: *ds:si = HeartsDeckClass object cx = 0 (total score) = 1 (get this round's score) RETURN: cx = score DESTROYED: nothing SIDE EFFECTS: none PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- PW 2/ 4/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckGetScore method dynamic HeartsDeckClass, MSG_HEARTS_DECK_GET_SCORE .enter jcxz getTotalScore ;getThisRoundsScore: xchg ax, cx ;save ax mov ax, ds:[di].HI_thisRoundScore add al, ah ;al<=thisRoundScore cbw xchg ax, cx ;restore ax, cx<=score jmp exitRoutine getTotalScore: mov cx, ds:[di].HI_score exitRoutine: .leave ret HeartsDeckGetScore endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckResetScore %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: will set the score instance data to zero for either just this rounds score, or both this round and the total score. CALLED BY: HeartsGameResetGame PASS: *ds:si = HeartsDeckClass object cx = 0 (reset just this rounds score) = 1 (reset total score) RETURN: nothing DESTROYED: nothing SIDE EFFECTS: will set the score instance data PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- PW 2/ 4/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckResetScore method dynamic HeartsDeckClass, MSG_HEARTS_DECK_RESET_SCORE .enter clr ds:[di].HI_thisRoundScore jcxz exitRoutine ;resetTotalScore: clr ds:[di].HI_score exitRoutine: call ObjMarkDirty .leave ret HeartsDeckResetScore endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckIncrementScore %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Increment both this rounds score and the total score CALLED BY: MSG_HEARTS_DECK_INCREMENT_SCORE PASS: *ds:si = HeartsDeckClass object cl = positive score ch = negative score RETURN: nothing DESTROYED: nothing SIDE EFFECTS: changes score PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- PW 2/ 3/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckIncrementScore method dynamic HeartsDeckClass, MSG_HEARTS_DECK_INCREMENT_SCORE uses ax .enter mov ax, ds:[di].HI_thisRoundScore add al, cl add ah, ch xchg ax, cx add al, ah cbw add ds:[di].HI_score, ax mov ds:[di].HI_thisRoundScore, cx call ObjMarkDirty ; add ds:[di].HI_score, cx ; mov ax, ds:[di].HI_thisRoundScore ; cmp cl, 0 ; jl incrementNegative ;incrementPositive: ; add al, cl ; jmp saveThisRoundScore ;incrementNegative: ; add ah, cl ;saveThisRoundScore: ; mov ds:[di].HI_thisRoundScore, ax .leave ret HeartsDeckIncrementScore endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckTakeTrick %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Move the cards to MyDiscardDeck. Also, it sets up the HeartsBroken instance data for the parent class. This method should only be sent to DiscardDeck, since it is the only proper discard deck. CALLED BY: HeartsDeckSetTakeTrigger PASS: *ds:si = HeartsDeckClass object to pass cards RETURN: nothing DESTROYED: nothing SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- PW 1/26/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckTakeTrick method dynamic HeartsDeckClass, MSG_HEARTS_DECK_TAKE_TRICK uses ax, cx, dx, bp .enter push si ;save offset call HeartsDeckCompleteTrickData mov ax, MSG_HEARTS_GAME_CHECK_HEARTS_BROKEN call VisCallParent tst cl jnz noHearts ;hearts already broken mov bp, HEARTS ;check if heart played clr cx ;search for highest mov ax, MSG_HEARTS_DECK_FIND_HIGH_OR_LOW call ObjCallInstanceNoLock tst cx jnz heartsAreBroken mov dl, QUEEN or SPADES call HeartsDeckFindCardGivenAttr cmp cx, 0 jl noHearts ;queen not played heartsAreBroken: mov ax, MSG_HEARTS_GAME_SET_HEARTS_BROKEN call VisCallParent noHearts: mov ax, MSG_HEARTS_DECK_CALCULATE_SCORE call ObjCallInstanceNoLock push ax ;save score mov di, mask MF_CALL or mask MF_FIXUP_DS mov ax, MSG_VIS_GET_BOUNDS call ObjCallInstanceNoLock Deref_DI Deck_offset ;save the original position mov ds:[di].DI_initLeft, ax mov ds:[di].DI_initTop, bp mov ds:[di].DI_initRight, cx mov ds:[di].DI_initBottom, dx call ObjMarkDirty clr cx mov ax, MSG_VIS_FIND_CHILD_AT_POSITION call ObjCallInstanceNoLock push si ;save offset movdw bxsi, cxdx ;^bx:si <= card to move mov cx, handle MyDiscardDeck mov dx, offset MyDiscardDeck call HeartsDeckMoveCardToDiscard pop si ;restore offset mov di, mask MF_CALL or mask MF_FIXUP_DS mov ax, MSG_HEARTS_DECK_TRANSFER_ALL_CARDS_FACE_DOWN call ObjCallInstanceNoLock mov ax, MSG_CARD_MAXIMIZE ;make sure top card is now call VisCallFirstChild ;set to full size mov ax, MSG_DECK_INVALIDATE_INIT ;invalidate old region call ObjCallInstanceNoLock mov ax, MSG_HEARTS_GAME_GET_TAKE_POINTER call VisCallParent movdw bxsi, cxdx mov di, mask MF_CALL or mask MF_FIXUP_DS mov ax, MSG_HEARTS_DECK_INVERT call ObjMessage pop cx ;retrieve score mov di, mask MF_CALL or mask MF_FIXUP_DS mov ax, MSG_HEARTS_DECK_INCREMENT_SCORE call ObjMessage add cl, ch ;cl <= increment in score mov ax, MSG_HEARTS_DECK_GET_DECK_ID_NUMBER mov di, mask MF_CALL or mask MF_FIXUP_DS call ObjMessage push si ;save offset mov ah, ch ;ah <= deck ID number clr al ;clear indicator mov dl, cl ;dl <= incremental score clr cx ;don't set anything but score call HeartsGameModifyPlayersData pop si ;restore offset clr bp, cx mov di, mask MF_CALL or mask MF_FIXUP_DS mov ax, MSG_HEARTS_DECK_DRAW_SCORE call ObjMessage mov di, mask MF_CALL or mask MF_FIXUP_DS mov ax, MSG_DECK_GET_N_CARDS call ObjMessage pop ax ;ax <= offset tst cx ;check if there are cards jnz cardsLeft ;noCardsLeft: mov si, ax ;si <= offset mov ax, MSG_HEARTS_GAME_CHECK_SHOOT_MOON call VisCallParent ;adjust scores if moon was shot mov ax, MSG_HEARTS_GAME_GET_MAX_SCORE call VisCallParent mov dx, cx ;dx <= max score mov cx, 1 ;we want to find highest score mov ax, MSG_HEARTS_GAME_GET_PLAYERS_SCORE call VisCallParent cmp cx, dx ;check if anyone went over ;maximum score jl gameNotOver ;gameOver: mov ax, MSG_HEARTS_GAME_GAME_OVER call VisCallParent jmp exitRoutine gameNotOver: mov ax, MSG_HEARTS_GAME_DEAL_ANOTHER_HAND call VisCallParent jmp exitRoutine cardsLeft: push si ;save next players offset mov si, ax ;si <= DiscardDeck offset mov cx, MAXIMUM_ABSOLUTE_POINTS mov ax, MSG_HEARTS_GAME_GET_ABSOLUTE_POINTS call VisCallParent pop si ;restore next players offset cmp cx, MAXIMUM_ABSOLUTE_POINTS je exitRoutine mov di, mask MF_FORCE_QUEUE or mask MF_FIXUP_DS mov ax, MSG_HEARTS_DECK_PLAY_CARD call ObjMessage exitRoutine: .leave ret HeartsDeckTakeTrick endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckCompleteTrickData %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Will add this trick to all the decks instance data pertaining to what cards have been played. CALLED BY: HeartsDeckTakeTrick PASS: *ds:si = Discard Deck RETURN: ds = segment of Discard Deck, may have changed DESTROYED: ax,cx,dx,bp SIDE EFFECTS: PSEUDO CODE/STRATEGY: Get the attributes of all four cards in the deck, and then send that to the HeartsPlayingTable to set all the decks with the proper information. REVISION HISTORY: Name Date Description ---- ---- ----------- PW 3/ 9/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckCompleteTrickData proc near .enter ;perform four consecutive function calls because it is eaier than looping ;for such a short number of calls. clr bp ;get first card attr. mov ax, MSG_DECK_GET_NTH_CARD_ATTRIBUTES call ObjCallInstanceNoLock push bp ;save first card attr. mov bp, 1 ;get second card attr. mov ax, MSG_DECK_GET_NTH_CARD_ATTRIBUTES call ObjCallInstanceNoLock push bp ;save second card attr. mov bp, 2 mov ax, MSG_DECK_GET_NTH_CARD_ATTRIBUTES call ObjCallInstanceNoLock push bp ;save third card attr. mov bp, 3 mov ax, MSG_DECK_GET_NTH_CARD_ATTRIBUTES call ObjCallInstanceNoLock mov ax, bp mov cl, al ;cl <= 4th card attr. pop bp mov ax, bp mov ch, al ;ch <= 3rd card attr. pop bp mov ax, bp mov dl, al ;dl <= 2nd card attr. pop bp mov ax, bp mov dh, al ;dh <= 1st card attr. mov ax, MSG_HEARTS_GAME_SET_TRICK_DATA call VisCallParent .leave ret HeartsDeckCompleteTrickData endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckComputerShotMoonGloat %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Default handler see message definition PASS: *(ds:si) - instance data of object ds:[bx] - instance data of object ds:[di] - master part of object (if any) es - segment of HeartsDeckClass RETURN: nothing DESTROYED: ax PSEUDO CODE/STRATEGY: none KNOWN BUGS/SIDE EFFECTS/IDEAS: This method should be optimized for SMALL SIZE over SPEED Common cases: unknown REVISION HISTORY: Name Date Description ---- ---- ----------- srs 7/27/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckComputerShotMoonGloat method dynamic HeartsDeckClass, MSG_HEARTS_DECK_COMPUTER_SHOT_MOON_GLOAT uses cx,dx,bp .enter sub sp, size StandardDialogParams mov bp, sp mov ss:[bp].SDP_customFlags, CustomDialogBoxFlags \ <FALSE, CDT_NOTIFICATION, GIT_NOTIFICATION, 0> mov ss:[bp].SDP_stringArg1.segment, ds mov di,ds:[di].HI_nameString mov di,ds:[di] mov ss:[bp].SDP_stringArg1.offset, di mov bx, handle StringResource call MemLock mov es, ax mov ss:[bp].SDP_customString.segment, ax mov di,offset ComputerPlayerShotMoonText mov ax, es:[di] mov ss:[bp].SDP_customString.offset, ax clr ss:[bp].SDP_helpContext.segment call UserStandardDialog call MemUnlock .leave ret HeartsDeckComputerShotMoonGloat endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckGetPlayedCardPointer %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Will return the instance data HI_playedCardPtr CALLED BY: MSG_HEARTS_DECK_GET_PLAYED_CARD_POINTER PASS: *ds:si = HeartsDeckClass object ds:di = HeartsDeckClass instance data RETURN: ^lcx:dx = playedCardPtr. DESTROYED: nothing SIDE EFFECTS: none PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- PW 3/10/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckGetPlayedCardPointer method dynamic HeartsDeckClass, MSG_HEARTS_DECK_GET_PLAYED_CARD_POINTER .enter movdw cxdx, ds:[di].HI_playedCardPtr .leave ret HeartsDeckGetPlayedCardPointer endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckGetPlayersDataPointer %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Will return the instance data HI_playersDataPtr CALLED BY: MSG_HEARTS_DECK_GET_PLAYERS_DATA_POINTER PASS: *ds:si = HeartsDeckClass object ds:di = HeartsDeckClass instance data RETURN: ^lcx:dx = playerDataPtr DESTROYED: nothing SIDE EFFECTS: none PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- PW 3/10/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckGetPlayersDataPointer method dynamic HeartsDeckClass, MSG_HEARTS_DECK_GET_PLAYERS_DATA_POINTER .enter movdw cxdx, ds:[di].HI_playersDataPtr .leave ret HeartsDeckGetPlayersDataPointer endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckGetDeckIdNumber %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Will return the decks ID number CALLED BY: HeartsDeckTakeCardsIfOK PASS: *ds:si = HeartsDeckClass object ds:di = HeartsDeckClass instance data RETURN: ch = deckIdNumber DESTROYED: nothing SIDE EFFECTS: none PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- PW 3/12/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckGetDeckIdNumber method dynamic HeartsDeckClass, MSG_HEARTS_DECK_GET_DECK_ID_NUMBER .enter mov ch, ds:[di].HI_deckIdNumber .leave ret HeartsDeckGetDeckIdNumber endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckClearStrategyData %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Will clear the two chunk arrays pointed to by : HI_playedCardPtr & HI_playersDataPtr Then it will initialize the HI_playersDataPtr by adding all the players with no information about them. CALLED BY: MSG_HEARTS_DECK_CLEAR_STRATEGY_DATA PASS: *ds:si = HeartsDeckClass object ds:di = HeartsDeckClass instance data RETURN: nothing DESTROYED: ax, cx SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- PW 3/10/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckClearStrategyData method dynamic HeartsDeckClass, MSG_HEARTS_DECK_CLEAR_STRATEGY_DATA playersDataOD local optr .enter movdw playersDataOD, ds:[di].HI_playersDataPtr, bx movdw bxsi, ds:[di].HI_playedCardPtr call MemLock mov ds, ax call ChunkArrayZero call ObjMarkDirty call MemUnlock movdw bxsi, playersDataOD call MemLock mov ds, ax call ChunkArrayZero clr bl mov cx, NUM_PLAYERS morePlayersLoop: call ChunkArrayAppend inc bl mov ds:[di].PD_playerId, bl clr ds:[di].PD_voidSuits clr ds:[di].PD_points clr ds:[di].PD_cardAssumptions loop morePlayersLoop mov bx, playersDataOD.handle call ObjMarkDirty call MemUnlock .leave ret HeartsDeckClearStrategyData endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckTransferAllCardsFaceDown %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Transfers all of a decks cards to another deck and flips the cards face down, as it does so. CALLED BY: HeartsDeckTakeTrick PASS: ds:di = deck instance *ds:si = instance data of deck ^lcx:dx = instance of VisCompClass to receive the cards (usually another Deck) CHANGES: The cards of deck at *ds:si are transferred to the top of deck at ^lcx:dx. The order of the cards is preserved. RETURN: nothing DESTROYED: ax, cx, dx, bp PSEUDO CODE/STRATEGY: loops bp times, popping cards (starting with the bp'th, ending with the top)from the donor and pushing them to the recipient KNOWN BUGS/IDEAS: *WARNING* A deck must never transfer to itself because the cards then get lost in space. REVISION HISTORY: Name Date Description ---- ---- ----------- PW 1/26/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckTransferAllCardsFaceDown method dynamic HeartsDeckClass, MSG_HEARTS_DECK_TRANSFER_ALL_CARDS_FACE_DOWN mov bp, ds:[di].DI_nCards ;set bp = all cards push cx,dx,bp mov ds:[di].DI_lastRecipient.handle, cx mov ds:[di].DI_lastRecipient.chunk, dx mov ds:[di].DI_lastGift, bp call ObjMarkDirty mov ax, MSG_GAME_SET_DONOR mov cx, ds:[LMBH_handle] mov dx, si call VisCallParent pop cx,dx,bp startDeckTransferNCards: dec bp ;see if we're done cmp bp, 0 jl endDeckTransferNCards push bp ;save count push cx, dx ;save OD of recipient clr cx ;cx:dx <- # of child mov dx, bp ;to remove mov ax, MSG_DECK_REMOVE_NTH_CARD mov di, mask MF_CALL or mask MF_FIXUP_DS call ObjCallInstanceNoLock ;^lcx:dx <- OD of card push si mov bx, cx mov si, dx mov ax, MSG_CARD_TURN_FACE_DOWN mov di, mask MF_FIXUP_DS or mask MF_CALL call ObjMessage ; mov ax, MSG_CARD_MAXIMIZE ; call ObjMessage pop bp ;save donor offset pop bx,si ;restore recipient OD push bp ;push donor offset push bx,si mov ax, MSG_DECK_PUSH_CARD ;give card to recipient mov di, mask MF_FIXUP_DS call ObjMessage pop cx, dx pop si ;restore donor offset pop bp ;restore count jmp startDeckTransferNCards endDeckTransferNCards: ret HeartsDeckTransferAllCardsFaceDown endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckPassCards %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Will pass a number of cards to another player, and then tell its neighbor to pass cards. CALLED BY: MSG_HEARTS_DECK_PASS_CARDS PASS: *ds:si = HeartsDeckClass object RETURN: nothing DESTROYED: nothing SIDE EFFECTS: will pass the number of cards indicated in the instance data. PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- PW 2/17/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckPassCards method dynamic HeartsDeckClass, MSG_HEARTS_DECK_PASS_CARDS uses ax, cx, dx, bp .enter test ds:[di].HI_deckAttributes, mask HDA_COMPUTER_PLAYER jz humanPlayer ;computerPlayer: call HeartsDeckComputerPassCards Deref_DI Deck_offset movdw bxsi, ds:[di].HI_neighborPointer mov ax, MSG_HEARTS_DECK_PASS_CARDS mov di, mask MF_CALL call ObjMessage jmp exitRoutine humanPlayer: mov ax, MSG_HEARTS_GAME_GET_GAME_ATTRS call VisCallParent BitSet cl, HGA_PASSING_CARDS mov ax, MSG_HEARTS_GAME_SET_GAME_ATTRS call VisCallParent Deref_DI Deck_offset push si ;save offset movdw bxsi, ds:[di].HI_passPointer mov ax, MSG_HEARTS_DECK_GET_PASS_STRING mov di, mask MF_CALL or mask MF_FIXUP_DS call ObjMessage pop si ;restore offset Deref_DI Deck_offset push si ;save offset mov bx, handle HeartsPassText mov si, offset HeartsPassText clr cx ;null terminated string. mov ax, MSG_VIS_TEXT_REPLACE_ALL_OPTR mov di, mask MF_CALL or mask MF_FIXUP_DS call ObjMessage pop si ;restore offset clr cx ;set undetectable call HeartsDeckSetDiscardDeck mov bx, handle HeartsPassing mov si, offset HeartsPassing mov ax, MSG_GEN_INTERACTION_INITIATE mov di, mask MF_CALL call ObjMessage exitRoutine: .leave ret HeartsDeckPassCards endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckGetPassString %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Will return an Optr to the pass string (the instance data) CALLED BY: MSG_HEARTS_DECK_GET_PASS_STRING PASS: *ds:si = HeartsDeckClass object ds:di = HeartsDeckClass instance data RETURN: ^ldx:bp = the pass string instance data DESTROYED: nothing SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- PW 3/ 8/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckGetPassString method dynamic HeartsDeckClass, MSG_HEARTS_DECK_GET_PASS_STRING .enter mov dx, ds:[LMBH_handle] ;there in the same resource mov bp, ds:[di].HI_passString .leave ret HeartsDeckGetPassString endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckComputerPassCards %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Will set up the chunk array with the cards the deck wishes to pass. Do not call procedure with zero passCards. CALLED BY: HeartsDeckPassCards PASS: *ds:si = deck object RETURN: *ds:si = deck object (ds may have changed) DESTROYED: ax,bx,cx,dx,bp,di SIDE EFFECTS: will add some entries to the chunk array PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- PW 2/23/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckComputerPassCards proc near passProcedure local word backupProcedure local word chunkArray local optr numPassCards local byte numNuetralCards local byte numDeckCards local byte deckOptr local optr cardAttrs local PassCardData counter local word numberClubs local byte numberDiamonds local byte highestDiamond local byte switchCards local word ForceRef cardAttrs ForceRef counter ForceRef numberClubs ForceRef numberDiamonds ForceRef highestDiamond ForceRef switchCards .enter class HeartsDeckClass mov bx, ds:[LMBH_handle] movdw deckOptr, bxsi mov ax, MSG_HEARTS_GAME_GET_NUMBER_OF_PASS_CARDS call VisCallParent mov numPassCards, cl mov ax, MSG_HEARTS_DECK_GET_PASS_STYLE call ObjCallInstanceNoLock mov numNuetralCards, al mov passProcedure, cx mov backupProcedure, dx Deref_DI Deck_offset mov ax, ds:[di].DI_nCards mov numDeckCards, al movdw chunkArray, ds:[di].HI_chunkPointer, ax mov bx, chunkArray.handle call MemLock call passProcedure ;endOfLoop: movdw bxsi, chunkArray call MemDerefDS call ObjMarkDirty call MemUnlock movdw bxsi, deckOptr call MemDerefDS .leave ret HeartsDeckComputerPassCards endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckGetPassStyle %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: will return the pass style that should be used CALLED BY: MSG_HEARTS_DECK_GET_PASS_STYLE PASS: *ds:si = HeartsDeckClass object ds:di = HeartsDeckClass instance data RETURN: al = numNuetralCards cx = passProcedure dx = backupProcedure DESTROYED: nothing SIDE EFFECTS: none PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- PW 3/24/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckGetPassStyle method dynamic HeartsDeckClass, MSG_HEARTS_DECK_GET_PASS_STYLE uses bp .enter call TimerGetCount mov dx, ax mov ax, MSG_GAME_SEED_RANDOM call VisCallParent mov dx, MAX_ODDS mov ax, MSG_GAME_RANDOM call VisCallParent ; Deref_DI Deck_offset cmp dl, ds:[di].HI_passStyle.HPS_oddsOnAlternate lea di, ds:[di].HI_passStyle.HPS_mainMethod jge methodOK ;useAlternateMethod: add di, HPS_alternateMethod - HPS_mainMethod methodOK: mov al, ds:[di].HPM_numNuetralCards mov bp, ds:[di].HPM_passProcedure mov cx, cs:[heartsDeckPassProcedureTable][bp] mov bp, ds:[di].HPM_backupProcedure mov dx, cs:[heartsDeckPassProcedureTable][bp] .leave ret HeartsDeckGetPassStyle endm heartsDeckPassProcedureTable nptr.near \ HeartsDeckComputerPassVoidSuit, HeartsDeckSwitchRunOfCards, HeartsDeckComputerPassDontBeDumb COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckComputerPassVoidSuit %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Will reorder the deck so that the last cards are the cards that the deck should pass following the "Void Suit" tacktic. (Pass cards that will make the deck void in either clubs or diamonds). The deck must be arraged in order (ie. the deck must be sorted by MSG_HEARTS_DECK_SORT_DECK) in order that this procedure works properly. CALLED BY: HeartsDeckComputerPassCards PASS: *ds:si = HeartsDeckClass object bp = pointer to stack frame of HeartsDeckComputerPassCards backupProcedure = procedure to call if cannot void chunkArray = optr to chunkarray to store pass cards numPassCards = number of cards to pass numNuetralCards = number of nuetral cards to pass numDeckCards = number of cards in the deck deckOptr = optr to the deck passing cards cardAttrs = PassCardData temp variable RETURN: nothing DESTROYED: SIDE EFFECTS: will mess up the local variables and will add some elements to the chunk array PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- PW 3/18/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckComputerPassVoidSuit proc near .enter inherit HeartsDeckComputerPassCards clr counter clr al, numberClubs, numberDiamonds, highestDiamond push bp ;save locals mov bp, DIAMONDS mov ax, MSG_HEARTS_DECK_COUNT_NUMBER_OF_SUIT call ObjCallInstanceNoLock pop bp ;restore locals mov numberDiamonds, cl mov highestDiamond, ch push bp ;save locals mov bp, CLUBS mov ax, MSG_HEARTS_DECK_COUNT_NUMBER_OF_SUIT call ObjCallInstanceNoLock pop bp ;restore locals mov numberClubs, cl clr ah mov al, cl ;al <= numberClubs cmp highestDiamond, RANK_VALUE_OF_JACK jge lessClubs ;has card that can ;take Jack, so don't ;void Diamonds clr cl mov ch, al ;ch <= #Clubs add ch, numberDiamonds ;ch <= #Clubs + #Diam cmp ch, numPassCards jle switchTheCards ;pass all diamond and ;clubs cmp numberDiamonds, al jg lessClubs ;lessDiamonds: clr cl mov ch, numberDiamonds cmp ch, numPassCards jg TooManyCardsToVoid jmp switchTheCards lessClubs: mov cl, numberDiamonds mov ch, cl add ch, al ;ch <= #Diam + #Clubs cmp al, numPassCards jg TooManyCardsToVoid switchTheCards: mov switchCards, cx call HeartsDeckSwitchRunOfCards jmp exitRoutine TooManyCardsToVoid: mov switchCards, cx call backupProcedure ; jmp exitRoutine exitRoutine: .leave ret HeartsDeckComputerPassVoidSuit endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckSwitchRunOfCards %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Will switch a run of consecutive cards with the cards in the back of the deck and add them to the chunk array as cards to pass. It will only switch a maximum of (numPassCards), and if less that that are requested to be switched, then it will call HeartsDeckComputerPassDontBeDumb to take care of the rest of the cards. CALLED BY: HeartsDeckComputerPassVoidSuit PASS: switchCards.low = First Card to switch to back of deck .high = last card (don't actually switch it) (high-low cards are switched.) chunkArray = optr to chunkarray to store pass cards numPassCards = number of cards to pass numNuetralCards = number of nuetral cards to pass numDeckCards = number of cards in the deck deckOptr = optr to the deck passing cards cardAttrs = PassCardData temp variable RETURN: DESTROYED: nothing SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- PW 3/19/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckSwitchRunOfCards proc near .enter inherit HeartsDeckComputerPassCards mov cx, switchCards cmp cl, ch jl switchSomeCards jmp notEnoughCardsSwitched switchSomeCards: sub ch, numPassCards cmp cl, ch jge passLoop ;too many cards trying to be switched ;so only switch the last of the cards mov switchCards.low, ch passLoop: dec switchCards.high dec numPassCards dec numDeckCards clr ch mov cl, switchCards.high clr dh mov dl, numDeckCards ;switch with the last ;card. mov ax, MSG_HEARTS_DECK_SWITCH_CARDS call ObjCallInstanceNoLock push bp ;save locals mov cardAttrs.PCD_cardNumber, dl mov bp, dx ;bp <= card # mov ax, MSG_DECK_GET_NTH_CARD_ATTRIBUTES call ObjCallInstanceNoLock mov cx, bp ;cx <= card attrs. pop bp ;restore locals mov cardAttrs.PCD_cardAttribute, cl movdw bxsi, chunkArray call MemDerefDS call ChunkArrayAppend CheckHack <size PassCardData eq size word> mov ax, {word} cardAttrs mov ds:[di], ax ;chunkArray <= card movdw bxsi, deckOptr call MemDerefDS mov cx, switchCards cmp cl, ch jl passLoop tst numPassCards jz exitRoutine ;not enough cards switched so call HeartsDeckComputerPassDontBeDumb clr numNuetralCards notEnoughCardsSwitched: call HeartsDeckComputerPassDontBeDumb exitRoutine: .leave ret HeartsDeckSwitchRunOfCards endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckComputerPassDontBeDumb %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Will reorder the deck so that the last cards are the cards that the deck should pass following the "Dont be Dumb" tacktic. (Pass one nuetral card and the rest your worst cards) CALLED BY: HeartsDeckComputerPassCards PASS: *ds:si = HeartsDeckClass object bp = pointer to stack frame of HeartsDeckComputerPassCards chunkArray = optr to chunkarray to store pass cards numPassCards = number of cards to pass numNuetralCards = number of nuetral cards to pass numDeckCards = number of cards in the deck deckOptr = optr to the deck passing cards cardAttrs = PassCardData temp variable RETURN: nothing DESTROYED: SIDE EFFECTS: will mess up the local variables and will add some elements to the chunk array PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- PW 3/18/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckComputerPassDontBeDumb proc near .enter inherit HeartsDeckComputerPassCards passLoop: push bp ;save locals clr ch mov cl, numDeckCards ;find lowest card ;from all card unchosen mov al, numNuetralCards cmp numPassCards, al jg getLowest ;getNuetral: call HeartsDeckGetNuetralCard jmp doneGetting getLowest: call HeartsDeckGetLowestCard doneGetting: pop bp ;restore locals dec numPassCards dec numDeckCards clr dh mov dl, numDeckCards ;switch the worst card ;with the last card. mov ax, MSG_HEARTS_DECK_SWITCH_CARDS call ObjCallInstanceNoLock push bp ;save locals mov cardAttrs.PCD_cardNumber, dl mov bp, dx ;bp <= card # mov ax, MSG_DECK_GET_NTH_CARD_ATTRIBUTES call ObjCallInstanceNoLock mov cx, bp ;cx <= card attrs. pop bp ;restore locals mov cardAttrs.PCD_cardAttribute, cl movdw bxsi, chunkArray call MemDerefDS call ChunkArrayAppend CheckHack <size PassCardData eq size word> mov ax, {word} cardAttrs mov ds:[di], ax ;chunkArray <= card movdw bxsi, deckOptr call MemDerefDS tst numPassCards jg passLoop .leave ret HeartsDeckComputerPassDontBeDumb endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckCompletePassCards %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: message sent to MyHand to indicate that the pass cards have been selected and ready to do the pass, and then start the game CALLED BY: HeartsPassTrigger PASS: *ds:si = HeartsDeckClass object RETURN: nothing DESTROYED: nothing SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- PW 2/19/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckCompletePassCards method dynamic HeartsDeckClass, MSG_HEARTS_DECK_COMPLETE_PASS_CARDS uses ax, cx, dx, bp .enter ; ; Check to see if the number of passing cards is equal ; to the number of cards selected to pass. ; I'm assuming this method only gets called for MyDeck. ; (*ds:si = MyDeck). ; Added to correct for a timing hole where ; MSG_DECK_UP_CARD_SELECTED can be handled after the ; "Pass Cards" trigger has been pressed, but before we ; we get here. Later in this method handler, we set ; MyDeck not enabled to prevent any further ; MSG_DECK_UP_CARD_SELECTED from being handled. ; mov ax, MSG_HEARTS_GAME_GET_NUMBER_OF_PASS_CARDS call VisCallParent mov dl, cl ; dl <= num pass cards push si ; save offset Deref_DI Deck_offset movdw bxsi, ds:[di].HI_chunkPointer call MemLock jc exitRoutine ; error locking mov ds, ax call ChunkArrayGetCount ; cl <= # cards selected call MemUnlock pop si ; restore offset cmp cl, dl jne exitRoutine ; # cards selected != # pass cards ; If we are not passing cards then bail. ; mov ax, MSG_HEARTS_GAME_GET_GAME_ATTRS call VisCallParent test cl,mask HGA_PASSING_CARDS jz exitRoutine ; Clear our passing mode bit ; BitClr cl, HGA_PASSING_CARDS mov ax, MSG_HEARTS_GAME_SET_GAME_ATTRS call VisCallParent mov cx, 1 ;set detectable call HeartsDeckSetDiscardDeck call HeartsDeckRemovePassTrigger ; Don't let player click on any more cards until the game ; starts ; mov bx, handle MyDeck mov si, offset MyDeck mov ax, MSG_VIS_SET_ATTRS mov dl, VUM_NOW mov cx, (mask VA_DETECTABLE) shl 8 mov di, mask MF_FIXUP_DS call ObjMessage ;pass the cards around. mov bx, handle ComputerDeck3 mov si, offset ComputerDeck3 mov ax, MSG_HEARTS_DECK_SWITCH_PASS_CARDS mov di, mask MF_CALL or mask MF_FIXUP_DS call ObjMessage ; Start the game, but do it via the queue so that ; the screen can redraw before the delay at ; the begining of the handler for the message ; we are about to send. ; mov di, mask MF_FIXUP_DS or mask MF_FORCE_QUEUE mov ax, MSG_HEARTS_DECK_START_GAME_AFTER_PASSING call ObjMessage exitRoutine: .leave ret HeartsDeckCompletePassCards endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckStartGameAfterPassing %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Will clear the inverted cards in MyDeck and then call HeartsDeckStartGame CALLED BY: HeartsDeckCompletePassCards PASS: *ds:si = HeartsDeckClass object ds:di = HeartsDeckClass instance data RETURN: nothing DESTROYED: nothing SIDE EFFECTS: will start the game PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- PW 3/ 8/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckStartGameAfterPassing method dynamic HeartsDeckClass, MSG_HEARTS_DECK_START_GAME_AFTER_PASSING uses ax, cx, dx, bp .enter mov di,offset YourCardsText call HeartsDeckDrawPlayerInstructions ; Let the player look at his/her new cards ; mov ax, SHOW_PASSED_CARDS_TIMER_INTERVAL call TimerSleep ;clear the inverted cards in MyDeck mov bx, handle MyDeck mov si, offset MyDeck mov ax, MSG_HEARTS_DECK_UNINVERT_CHUNK_ARRAY mov di, mask MF_CALL or mask MF_FIXUP_DS call ObjMessage ;start the game mov bx, handle ComputerDeck3 mov si, offset ComputerDeck3 mov ax, MSG_HEARTS_DECK_START_GAME mov di, mask MF_CALL or mask MF_FIXUP_DS call ObjMessage .leave ret HeartsDeckStartGameAfterPassing endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckRemovePassTrigger %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Will remove the PassTrigger associated dialog box from the screen, and disable the PassTrigger CALLED BY: HeartsDeckCompletePassCards PASS: nothing RETURN: nothing DESTROYED: ax,bx,cx,dx,di,si SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- PW 2/23/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckRemovePassTrigger proc near .enter ;disable the pass trigger mov bx, handle HeartsPassTrigger mov si, offset HeartsPassTrigger mov ax, MSG_GEN_SET_NOT_ENABLED mov dl, VUM_NOW mov di, mask MF_CALL or mask MF_FIXUP_DS call ObjMessage ;remove the pass dialog box mov bx, handle HeartsPassing mov si, offset HeartsPassing mov ax, MSG_GEN_GUP_INTERACTION_COMMAND mov cx, IC_DISMISS mov di, mask MF_CALL or mask MF_FIXUP_DS call ObjMessage .leave ret HeartsDeckRemovePassTrigger endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckUpdataPassPointer %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Will move the pass pointer to the next person to pass to. CALLED BY: MSG_HEARTS_DECK_UPDATE_PASS_POINTER PASS: *ds:si = HeartsDeckClass object ds:di = HeartsDeckClass instance data RETURN: cx = 0 if passing to another deck DESTROYED: ax, dx, bp SIDE EFFECTS: will set the passPointer instance data PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- PW 2/24/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckUpdataPassPointer method dynamic HeartsDeckClass, MSG_HEARTS_DECK_UPDATE_PASS_POINTER .enter tstdw ds:[di].HI_passPointer jz initializePointer ;move passPointer to next person to pass to. push si ;save offset movdw bxsi, ds:[di].HI_passPointer mov ax, MSG_HEARTS_DECK_GET_NEIGHBOR_POINTER mov di, mask MF_FIXUP_DS or mask MF_CALL call ObjMessage pop si ;restore offset Deref_DI Deck_offset mov ax, ds:[LMBH_handle] cmpdw axsi, cxdx ;check if passing to ;oneself jne validPass ;invalidPass: clrdw ds:[di].HI_passPointer ;set passPointer to ;initial state mov cx, HOLD_HAND jmp exitRoutine validPass: movdw ds:[di].HI_passPointer, cxdx jmp doneSettingPointer initializePointer: movdw ds:[di].HI_passPointer, ds:[di].HI_neighborPointer, ax doneSettingPointer: clr cx ;passing valid exitRoutine: call ObjMarkDirty .leave ret HeartsDeckUpdataPassPointer endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckSwitchPassCards %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Will switch the cards for all the people passing cards and resort the deck. Note that number of cards to pass must not be zero because we are looping and not checking for the initial zero case. CALLED BY: MSG_HEARTS_DECK_SWITCH_PASS_CARDS PASS: *ds:si = HeartsDeckClass object RETURN: nothing DESTROYED: nothing SIDE EFFECTS: will switch the cards PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- PW 2/23/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckSwitchPassCards method dynamic HeartsDeckClass, MSG_HEARTS_DECK_SWITCH_PASS_CARDS uses ax, cx, dx, bp deckAttrs local byte deckOptr local optr numPassCards local byte cardAttrs local byte passArray local optr deckArray local optr .enter mov bx, ds:[LMBH_handle] movdw deckOptr, bxsi mov al, ds:[di].HI_deckAttributes mov deckAttrs, al mov ax, MSG_HEARTS_GAME_GET_NUMBER_OF_PASS_CARDS call VisCallParent mov numPassCards, cl Deref_DI Deck_offset movdw bxdx, ds:[di].HI_chunkPointer call MemLock movdw deckArray, bxdx Deref_DI Deck_offset movdw bxsi, ds:[di].HI_passPointer mov ax, MSG_HEARTS_DECK_GET_CHUNK_ARRAY mov di, mask MF_FIXUP_DS or mask MF_CALL call ObjMessage mov bx, cx ;bx <= chunk handle call MemLock movdw passArray, bxdx switchingLoop: dec numPassCards clr ah mov al, numPassCards movdw bxsi, passArray call MemDerefDS call ChunkArrayElementToPtr mov bl, ds:[di].PCD_cardAttribute mov cardAttrs, bl movdw bxsi, deckArray call MemDerefDS call ChunkArrayElementToPtr clr dx mov cl, ds:[di].PCD_cardNumber clr ch ;cx <= card # push bp ;save locals movdw bxsi, deckOptr mov ax, MSG_VIS_FIND_CHILD_AT_POSITION mov di, mask MF_CALL call ObjMessage pop bp ;restore locals mov al, cardAttrs movdw bxsi, cxdx ;^lbx:si <= card optr call HeartsDeckSetTheNewAttributes tst numPassCards jnz switchingLoop movdw bxsi, deckOptr call MemDerefDS movdw axbx, deckArray movdw cxdx, passArray call HeartsDeckSetPassReceiveData ;unlockLMem: mov bx, deckArray.handle call MemUnlock mov bx, passArray.handle call MemUnlock test deckAttrs, mask HDA_COMPUTER_PLAYER jz notComputerPlayer ;computerPlayer: movdw bxsi, deckOptr call MemDerefDS mov ax, MSG_HEARTS_DECK_SORT_DECK call ObjCallInstanceNoLock push bp ;save locals mov ax, MSG_HEARTS_DECK_REDRAW_IF_FACE_UP call ObjCallInstanceNoLock pop bp ;restore locals Deref_DI Deck_offset movdw bxsi, ds:[di].HI_neighborPointer mov ax, MSG_HEARTS_DECK_SWITCH_PASS_CARDS mov di, mask MF_CALL or mask MF_FIXUP_DS call ObjMessage jmp exitRoutine notComputerPlayer: if WAV_SOUND mov cx,HS_CARDS_PASSED call HeartsGamePlaySound endif movdw bxsi, deckOptr call MemDerefDS mov ax, MSG_HEARTS_DECK_SORT_DECK call ObjCallInstanceNoLock push bp ;save locals mov ax, MSG_DECK_REDRAW call ObjCallInstanceNoLock pop bp ;restore locals exitRoutine: .leave ret HeartsDeckSwitchPassCards endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckSetPassReceiveData %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Will Set the HI_passedCards and HI_receivedCards instance data. CALLED BY: HeartsDeckSwitchPassCards PASS: ds:si = HeartsDeck object ^lax:bx = deckArray (locked down) ^lcx:dx = passArray (locked down) RETURN: nothing DESTROYED: ax,bx,cx,dx,si,di SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- PW 3/ 5/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckSetPassReceiveData proc near deckArray local optr push ax,bx passArray local optr push cx,dx deckOptr local optr .enter class HeartsDeckClass mov cx, ds:[LMBH_handle] mov dx, si movdw deckOptr, cxdx Deref_DI Deck_offset movdw bxsi, ds:[di].HI_passPointer movdw ds:[di].HI_receivedCards.PD_passerOD, bxsi mov ax, MSG_HEARTS_DECK_SET_PASS_TO_POINTER mov di, mask MF_FIXUP_DS or mask MF_CALL call ObjMessage movdw bxsi, passArray call MemDerefDS call HeartsDeckGetCardAttributesFromArray push dx,cx ;save received cards movdw bxsi, deckArray call MemDerefDS call HeartsDeckGetCardAttributesFromArray movdw bxsi, deckOptr call MemDerefDS Deref_DI Deck_offset mov ds:[di].HI_passedCards.PD_cardsPassed.HPC_card1, dl mov ds:[di].HI_passedCards.PD_cardsPassed.HPC_card2, dh mov ds:[di].HI_passedCards.PD_cardsPassed.HPC_card3, cl pop dx,cx ;restore received cards mov ds:[di].HI_receivedCards.PD_cardsPassed.HPC_card1, dl mov ds:[di].HI_receivedCards.PD_cardsPassed.HPC_card2, dh mov ds:[di].HI_receivedCards.PD_cardsPassed.HPC_card3, cl call ObjMarkDirty .leave ret HeartsDeckSetPassReceiveData endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckGetCardAttributesFromArray %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Will return the top threee card attributes from the chunk array CALLED BY: HeartsDeckSetPassReceiveData PASS: *ds:si = chunk array RETURN: dl = first card Attribute dh = second card Attribute cl = third card Attribute DESTROYED: ax, ch, di SIDE EFFECTS: none PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- PW 3/ 8/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckGetCardAttributesFromArray proc near .enter clr ax call ChunkArrayElementToPtr mov dl, ds:[di].PCD_cardAttribute inc al call ChunkArrayElementToPtr mov dh, ds:[di].PCD_cardAttribute inc al call ChunkArrayElementToPtr mov cl, ds:[di].PCD_cardAttribute .leave ret HeartsDeckGetCardAttributesFromArray endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckSetPassToPointer %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Will set the HI_passedCards.PD_passerOD instance data CALLED BY: MSG_HEARTS_DECK_SET_PASS_TO_POINTER PASS: *ds:si = HeartsDeckClass object ds:di = HeartsDeckClass instance data ^lcx:dx = player your passing to. RETURN: nothing DESTROYED: nothing SIDE EFFECTS: will set the instance data PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- PW 3/ 5/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckSetPassToPointer method dynamic HeartsDeckClass, MSG_HEARTS_DECK_SET_PASS_TO_POINTER .enter movdw ds:[di].HI_passedCards.PD_passerOD, cxdx call ObjMarkDirty .leave ret HeartsDeckSetPassToPointer endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckFlipCards %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Will flip all the cards in the deck and redraw the deck CALLED BY: HeartsGameFlipComputerDecks PASS: *ds:si = HeartsDeckClass object RETURN: nothing DESTROYED: ax, cx, dx, bp SIDE EFFECTS: will flip the deck and redraw itself PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- PW 3/ 4/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckFlipCards method dynamic HeartsDeckClass, MSG_HEARTS_DECK_FLIP_CARDS .enter ;mark all the cards as dirty. mov ax, MSG_CARD_MARK_DIRTY_IF_FACE_DOWN call VisSendToChildren mov ax, MSG_CARD_FLIP call VisSendToChildren mov ax, MSG_DECK_REDRAW call ObjCallInstanceNoLock .leave ret HeartsDeckFlipCards endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckRedrawIfFaceUp %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Will do a deck redraw if the top card is face up. CALLED BY: MSG_HEARTS_DECK_REDRAW_IF_FACE_UP PASS: *ds:si = HeartsDeckClass object ds:di = HeartsDeckClass instance data RETURN: nothing DESTROYED: ax, cx, dx, bp SIDE EFFECTS: may redraw the deck PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- PW 3/ 4/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckRedrawIfFaceUp method dynamic HeartsDeckClass, MSG_HEARTS_DECK_REDRAW_IF_FACE_UP .enter clr bp ;clear attributes mov ax, MSG_CARD_GET_ATTRIBUTES call VisCallFirstChild test bp, mask CA_FACE_UP jz exitRoutine ;top card not face up mov ax, MSG_DECK_REDRAW call ObjCallInstanceNoLock exitRoutine: .leave ret HeartsDeckRedrawIfFaceUp endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckSetTheNewAttributes %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: will set the attributes for a card CALLED BY: HeartsDeckSwitchPassCards PASS: al = new card attributes ^lbx:si = card to set the attributes for RETURN: nothing DESTROYED: ax,dx,di SIDE EFFECTS: will set the attributes of the card PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- PW 2/23/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckSetTheNewAttributes proc near uses bp .enter mov dl, al ;dl <= card attrs. mov ax, MSG_CARD_GET_ATTRIBUTES mov di, mask MF_CALL call ObjMessage mov ax, bp ;ax <= cards old attrs. and al, not (RANK_MASK or SUIT_MASK) and dl, RANK_MASK or SUIT_MASK or al, dl mov bp, ax ;bp <= new card attrs. mov ax, MSG_CARD_SET_ATTRIBUTES mov di, mask MF_CALL call ObjMessage .leave ret HeartsDeckSetTheNewAttributes endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckPlayTopCard %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: will move the top card from the deck to the discard deck CALLED BY: MSG_HEARTS_DECK_PLAY_TOP_CARD PASS: *ds:si = HeartsDeckClass object to pass card ^lcx:dx = handle to deck to recieve card RETURN: nothing DESTROYED: nothing SIDE EFFECTS: PSEUDO CODE/STRATEGY: pop card from the giving deck and push card on recieving deck REVISION HISTORY: Name Date Description ---- ---- ----------- PW 1/26/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckPlayTopCard method dynamic HeartsDeckClass, MSG_HEARTS_DECK_PLAY_TOP_CARD uses ax, cx, dx, bp receivingDeck local optr push cx,dx donorDeck local optr topCard local optr .enter mov ax, ds:[LMBH_handle] movdw donorDeck, axsi push bp ;save locals mov ax, MSG_VIS_GET_BOUNDS call ObjCallInstanceNoLock Deref_DI Deck_offset ;save the original position mov ds:[di].DI_initLeft, ax mov ds:[di].DI_initTop, bp mov ds:[di].DI_initRight, cx mov ds:[di].DI_initBottom, dx call ObjMarkDirty clr cx ;find first child mov ax, MSG_VIS_FIND_CHILD_AT_POSITION call ObjCallInstanceNoLock pushdw cxdx ;save card optr clr bp mov ax, MSG_DECK_GET_NTH_CARD_ATTRIBUTES call ObjCallInstanceNoLock mov cx, bp ;cl <= card attrs. Deref_DI Deck_offset mov ch, ds:[di].HI_deckIdNumber mov ax, MSG_HEARTS_GAME_SET_PLAYERS_DATA call VisCallParent mov bp, 1 mov ax, MSG_CARD_MAXIMIZE call HeartsDeckCallNthChild popdw bxsi ;restore card optr mov ax, MSG_CARD_TURN_FACE_UP mov di, mask MF_CALL or mask MF_FIXUP_DS call ObjMessage mov ax, MSG_CARD_NORMAL_REDRAW mov di, mask MF_CALL or mask MF_FIXUP_DS call ObjMessage pop bp ;restore locals push bp ;save locals movdw cxdx, receivingDeck call HeartsDeckMoveCardToDiscard pop bp ;restore locals push bp ;save locals movdw topCard, bxsi movdw cxdx, donorDeck push dx ;save offset mov ax, MSG_CARD_GET_ATTRIBUTES mov di, mask MF_CALL or mask MF_FIXUP_DS call ObjMessage call HeartsDeckSetTakeData pop si ;restore offset mov ax, MSG_DECK_POP_CARD call ObjCallInstanceNoLock mov ax, MSG_DECK_INVALIDATE_INIT call ObjCallInstanceNoLock ; clr bp ; mov ax, MSG_CARD_MAXIMIZE ;make sure top card is now ; call HeartsDeckCallNthChild ;set to full size pop bp ;restore locals push bp ;save locals movdw cxdx, topCard movdw bxsi, receivingDeck mov di, mask MF_CALL or mask MF_FIXUP_DS mov ax, MSG_DECK_PUSH_CARD call ObjMessage mov bx, handle HeartsPlayingTable mov si, offset HeartsPlayingTable mov ax, MSG_HEARTS_GAME_SET_SHOOT_DATA mov di, mask MF_FIXUP_DS or mask MF_CALL call ObjMessage pop bp ;restore locals .leave ret HeartsDeckPlayTopCard endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckCallNthChild %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Common routine to find the deck's Nth child and send a method to it. CALLED BY: PASS: bp = Nth child ax = method number to send to Nth child *ds:si = deck object cx,dx = arguments to pass to card CHANGES: RETURN: carry set if Nth child was not found carry returned from method if child was found cx,dx,bp = return values DESTROYED: ax, di PSEUDO CODE/STRATEGY: search for nth card if found, send the method KNOWN BUGS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- jon 10/90 initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckCallNthChild proc near ; ; get the OD of the nth card ; push si push ax, cx, dx mov dx, bp clr cx mov ax, MSG_VIS_FIND_CHILD call ObjCallInstanceNoLock pop ax, bx, si jc afterCall xchg bx, cx xchg si, dx mov di, mask MF_FIXUP_DS or mask MF_CALL call ObjMessage afterCall: pop si ret HeartsDeckCallNthChild endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckMoveCardToDiscard %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Will visually move the card in ^lbx:si to the discard deck. CALLED BY: HeartsDeckPlayTopCard PASS: ^lbx:si = card to move ^lcx:dx = deck moving to RETURN: nothing DESTROYED: nothing SIDE EFFECTS: will move the card in ^lbx:si to the discard deck PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- PW 3/ 1/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckMoveCardToDiscard proc near uses ax,bx,cx,dx,si,di,bp receivingDeck local optr push cx,dx gState local word originalTopPosition local dword originalBottomPosition local dword discardPosition local dword .enter class HeartsDeckClass pushdw bxsi ;save card to move mov bx, handle HeartsPlayingTable mov si, offset HeartsPlayingTable mov ax, MSG_HEARTS_GAME_GET_GAME_ATTRS mov di, mask MF_FIXUP_DS or mask MF_CALL call ObjMessage popdw bxsi ;restore card to move test cl, mask HGA_DONT_SHOW_MOVEMENT LONG jnz exitRoutine ;dont show the movement push bp ;save locals mov ax, MSG_VIS_VUP_CREATE_GSTATE mov di, mask MF_FIXUP_DS or mask MF_CALL call ObjMessage mov di, bp ;cx <= GState pop bp ;restore locals mov gState, di ;change the graphics state to our liking and draw the outline mov al, MM_INVERT call GrSetMixMode ;set invert mode clr ax, dx call GrSetLineWidth ;set line width = 1 push bp ;save locals mov ax, MSG_VIS_GET_BOUNDS mov di, mask MF_FIXUP_DS or mask MF_CALL call ObjMessage mov bx, bp ;bx <= top pop bp ;restore locals movdw originalTopPosition, axbx movdw originalBottomPosition, cxdx push bp ;save locals movdw bxsi, receivingDeck mov ax, MSG_HEARTS_DECK_GET_PUSH_CARD_POSITION mov di, mask MF_FIXUP_DS or mask MF_CALL call ObjMessage pop bp ;restore locals movdw discardPosition, cxdx mov di, gState movdw axbx, originalTopPosition movdw cxdx, originalBottomPosition call GrDrawRect cmp bx, discardPosition.offset jz yPositionOK jg moveCardUp moveCardDown: call GrDrawRect add bx, CARD_Y_MOVEMENT_AMOUNT ;bx <= new top pos. add dx, CARD_Y_MOVEMENT_AMOUNT ;dx <= new bottom pos. cmp bx, discardPosition.offset jge lastYMove call GrDrawRect jmp moveCardDown moveCardUp: call GrDrawRect sub bx, CARD_Y_MOVEMENT_AMOUNT ;bx <= new top pos. sub dx, CARD_Y_MOVEMENT_AMOUNT ;dx <= new bottom pos. cmp bx, discardPosition.offset jle lastYMove call GrDrawRect jmp moveCardUp lastYMove: sub dx, bx mov bx, discardPosition.offset add dx, bx call GrDrawRect yPositionOK: cmp ax, discardPosition.handle jz xPositionOK jg moveCardLeft moveCardRight: call GrDrawRect add ax, CARD_X_MOVEMENT_AMOUNT ;bx <= new left pos. add cx, CARD_X_MOVEMENT_AMOUNT ;dx <= new right pos. cmp ax, discardPosition.handle jge lastXMove call GrDrawRect jmp moveCardRight moveCardLeft: call GrDrawRect sub ax, CARD_X_MOVEMENT_AMOUNT ;bx <= new left pos. sub cx, CARD_X_MOVEMENT_AMOUNT ;dx <= new right pos. cmp ax, discardPosition.handle jle lastXMove call GrDrawRect jmp moveCardLeft lastXMove: sub cx, ax mov ax, discardPosition.handle add cx, ax call GrDrawRect xPositionOK: call GrDrawRect call GrDestroyState exitRoutine: .leave ret HeartsDeckMoveCardToDiscard endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckGetPushCardPosition %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: will return the position where the next card to push should go. CALLED BY: MSG_HEARTS_DECK_GET_PUSH_CARD_POSITION PASS: *ds:si = HeartsDeckClass object ds:di = HeartsDeckClass instance data RETURN: cx = left edge of object dx = top edge of object DESTROYED: ax, bp SIDE EFFECTS: none PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- PW 3/ 2/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckGetPushCardPosition method dynamic HeartsDeckClass, MSG_HEARTS_DECK_GET_PUSH_CARD_POSITION .enter clr bp mov ax, MSG_CARD_GET_ATTRIBUTES call VisCallFirstChild tst bp ;see if we got anything back (i.e., ;see if we have any children) jnz gotTopCardAttrs ;if so, we've got its attributes in bp ;noKids: ;just returns the deck position mov ax, MSG_VIS_GET_POSITION call ObjCallInstanceNoLock jmp endDeckOffsetTopLeft gotTopCardAttrs: Deref_DI Deck_offset test bp, mask CA_FACE_UP jz faceDown ;faceUp: mov cx, ds:[di].DI_offsetFromUpCardX ;if the card is face up mov dx, ds:[di].DI_offsetFromUpCardY ;we want up offsets jmp addOffsets faceDown: mov cx, ds:[di].DI_offsetFromDownCardX ;if card is face down, mov dx, ds:[di].DI_offsetFromDownCardY ;we want down offsets addOffsets: add cx, ds:[di].DI_topCardLeft ;add the offsets to the topCard add dx, ds:[di].DI_topCardTop ;position endDeckOffsetTopLeft: .leave ret HeartsDeckGetPushCardPosition endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckShiftCards %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Will exchange the cx card with the first card and shift all the other cards down accordingly to preserve the deck order. CALLED BY: MSG_HEARTS_DECK_SHIFT_CARDS PASS: *ds:si = HeartsDeckClass object cl = the card to swap with the first card. (first card is card 0) ch = 0 to redraw the deck if face up when done, 1 not to redraw deck when done RETURN: nothing DESTROYED: nothing SIDE EFFECTS: will alter the deck by shifting the cards PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- PW 1/29/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckShiftCards method dynamic HeartsDeckClass, MSG_HEARTS_DECK_SHIFT_CARDS uses ax, cx, dx, bp .enter ;setup for loop mov bp, cx ;save cx clr ch ;eliminate interference by ch jcxz exitRoutine ;card already in place mov di, mask MF_CALL or mask MF_FIXUP_DS mov ax, MSG_HEARTS_DECK_SWITCH_CARDS ;perform loop switchLoop: mov dx, cx dec cx call ObjCallInstanceNoLock tst cx jnz switchLoop mov cx, bp ;restore cx tst ch jnz exitRoutine ;dont redraw deck mov ax, MSG_HEARTS_DECK_REDRAW_IF_FACE_UP call ObjCallInstanceNoLock exitRoutine: .leave ret HeartsDeckShiftCards endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckSortDeck %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Rearranges the cards in the deck in order by suit and card number CALLED BY: MSG_HEARTS_DECK_SORT_DECK PASS: *ds:si = HeartsDeckClass object ds:di = HeartsDeckClass instance data ds:bx = HeartsDeckClass object (same as *ds:si) es = segment of HeartsDeckClass ax = message # RETURN: nothing DESTROYED: nothing SIDE EFFECTS: Rearranges the cards in the deck PSEUDO CODE/STRATEGY: To perform a selection sort on the cards in the deck, and two cards are switched simply by exchanging there suit and card number REVISION HISTORY: Name Date Description ---- ---- ----------- PW 1/25/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckSortDeck method dynamic HeartsDeckClass, MSG_HEARTS_DECK_SORT_DECK uses ax, cx, dx, bp loopCounter local word numberOfCards local word .enter ;setup for loop clr loopCounter mov di, mask MF_CALL or mask MF_FIXUP_DS mov ax, MSG_DECK_GET_N_CARDS call ObjCallInstanceNoLock jcxz exitRoutine ;no card in deck mov numberOfCards, cx ;perform loop sortLoop: mov dx, loopCounter mov ax, MSG_HEARTS_DECK_FIND_SMALLEST_CARD call ObjCallInstanceNoLock cmp cx, loopCounter je noSwitchCards mov dx, loopCounter mov ax, MSG_HEARTS_DECK_SWITCH_CARDS call ObjCallInstanceNoLock noSwitchCards: inc loopCounter mov cx, numberOfCards cmp loopCounter, cx jl sortLoop exitRoutine: .leave ret HeartsDeckSortDeck endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckSwitchCards %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: switch two card in a deck CALLED BY: MSG_HEARTS_DECK_SORT_DECK PASS: cx, dx = the cards to switch *ds:si = instance data of deck RETURN: nothing DESTROYED: nothing SIDE EFFECTS: none PSEUDO CODE/STRATEGY: Find the first childs attributes (dx child), and push them on the stack. Find the second childs attributs (cx child), set to first childs attributes, and set first child to have second childs original attributes. REVISION HISTORY: Name Date Description ---- ---- ----------- PW 1/25/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckSwitchCards method dynamic HeartsDeckClass, MSG_HEARTS_DECK_SWITCH_CARDS uses ax, cx, dx, bp .enter cmp cx, dx je exitRoutine ;the cards are the same, ;nothing to do. push cx, si clr cx mov di, mask MF_CALL or mask MF_FIXUP_DS mov ax, MSG_VIS_FIND_CHILD call ObjCallInstanceNoLock mov bx, cx mov si, dx mov di, mask MF_CALL or mask MF_FIXUP_DS mov ax, MSG_CARD_GET_ATTRIBUTES call ObjMessage mov di, si pop dx, si ;find attributes of next child push bx, di push bp ;save attributes of prev child clr cx mov di, mask MF_CALL or mask MF_FIXUP_DS mov ax, MSG_VIS_FIND_CHILD call ObjCallInstanceNoLock mov bx, cx mov si, dx mov di, mask MF_CALL or mask MF_FIXUP_DS mov ax, MSG_CARD_GET_ATTRIBUTES call ObjMessage mov ax, bp pop bp push ax mov di, mask MF_CALL or mask MF_FIXUP_DS mov ax, MSG_CARD_SET_ATTRIBUTES call ObjMessage pop bp pop bx, si mov di, mask MF_CALL or mask MF_FIXUP_DS mov ax, MSG_CARD_SET_ATTRIBUTES call ObjMessage exitRoutine: .leave ret HeartsDeckSwitchCards endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckFindSmallestCard %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Returns the smallest cards value and where in the deck it is located. CALLED BY: MSG_HEARTS_DECK_SORT_DECK PASS: cx = number of cards in deck dx = starting loop number *ds:si = instance data of deck RETURN: cx = the number of smallest card in deck dx = the smallest card value (13*suit + rank) DESTROYED: nothing SIDE EFFECTS: none PSEUDO CODE/STRATEGY: loop through the deck to find the smallest card and return the value REVISION HISTORY: Name Date Description ---- ---- ----------- PW 1/25/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckFindSmallestCard method dynamic HeartsDeckClass, MSG_HEARTS_DECK_FIND_SMALLEST_CARD uses ax, bp smallestCardValue local byte actualCardValue local byte smallestCard local word loopCounter local word numberOfCards local word .enter mov smallestCardValue, MAX_CARD_VALUE clr smallestCard mov loopCounter, dx mov numberOfCards, cx firstLoop: push bp ;save local variable reg clr cx mov dx, loopCounter ;set which child to find mov di, mask MF_CALL or mask MF_FIXUP_DS mov ax, MSG_VIS_FIND_CHILD call ObjCallInstanceNoLock push si ;save si mov bx, cx mov si, dx call HeartsDeckGetCardValue ;get value of card mov ah, al ;save card value call HeartsDeckFixupCardValue ;make it so suits are ordered ;in correct order. pop si ;restore si pop bp ;restore local variable reg cmp smallestCardValue, al jl noAdjustments mov smallestCardValue, al mov actualCardValue, ah push loopCounter pop smallestCard noAdjustments: inc loopCounter mov ax, numberOfCards cmp loopCounter, ax jl firstLoop mov cx, smallestCard clr dh mov dl, actualCardValue .leave ret HeartsDeckFindSmallestCard endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckPushCard %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: MSG_DECK_PUSH_CARD, MSG_DECK_PUSH_CARD_NO_EFFECTS handler for HeartsDeckClass Adds a card to the deck's composite, and does some visual operations that reflect the adoption. The two methods are identical at this level, but exist independently so they can be subclassed differently. Also adds the card to the decks chunk array CALLED BY: PASS: *ds:si = instance data of deck ^lcx:dx = card to be added CHANGES: RETURN: nothing DESTROYED: ax, bx, cx, dx, bp, di PSEUDO CODE/STRATEGY: call the superclass, and then add the element to the chunk array. KNOWN BUGS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- PW 1/27/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ if 0 HeartsDeckPushCard method HeartsDeckClass, MSG_DECK_PUSH_CARD, MSG_DECK_PUSH_CARD_NO_EFFECTS mov di, offset HeartsDeckClass call ObjCallSuperNoLock ret HeartsDeckPushCard endm endif COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckFixupCardValue %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Will make it so the order of cards is diamond, clubs, hearts and spades, instead of diamonds, hearts, clubs, spades CALLED BY: HeartsDeckFindSmallestCard PASS: al = card value RETURN: al = modified card value DESTROYED: nothing SIDE EFFECTS: none PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- PW 2/ 6/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckFixupCardValue proc near .enter cmp al, 40 jg exitRoutine cmp al, 15 jl exitRoutine cmp al, 27 jg fixupClubs ;fixupHearts: add al, 13 ;make hearts greater than clubs jmp exitRoutine fixupClubs: sub al, 13 ;make clubs smaller than hearts exitRoutine: .leave ret HeartsDeckFixupCardValue endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckGetCardValue %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: returns the a number (between 2 and 53) to represent the card. CALLED BY: PASS: ^lbx:si = handle to card RETURN: ax = number representing card DESTROYED: nothing SIDE EFFECTS: none PSEUDO CODE/STRATEGY: find the rank and suit of the card and return 13*suit + rank REVISION HISTORY: Name Date Description ---- ---- ----------- PW 1/28/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckGetCardValue proc near uses di,bp .enter class HeartsDeckClass mov di, mask MF_CALL or mask MF_FIXUP_DS mov ax, MSG_CARD_GET_ATTRIBUTES call ObjMessage mov ax, bp ;move CI_cardAttrs into ax call HeartsDeckConvertCardAttributes .leave ret HeartsDeckGetCardValue endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckConvertCardAttributes %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: convert the card attributes to a number between 2 and 53 to represent the card CALLED BY: HeartsDeckGetCardValue PASS: ax = cardAttrs RETURN: ax = number representing card DESTROYED: nothing SIDE EFFECTS: none PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- PW 2/ 8/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckConvertCardAttributes proc near uses cx .enter mov cl, al call HeartsDeckGetCardRank xchg al, cl ;findSuit: and al, SUIT_MASK ;mask out the suit shr al, 1 ;move suit to low order bits mov ah, 13 mul ah ;muliply suit by 13 add al, cl ;add rank to 13*suit .leave ret HeartsDeckConvertCardAttributes endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckGetCardRank %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: will return the card rank (a number between 2 and 14) CALLED BY: PASS: al = card attributes RETURN: al = rank of card DESTROYED: nothing SIDE EFFECTS: none PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- PW 2/10/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckGetCardRank proc near .enter and al, RANK_MASK ;mask out the rank of the ;card cmp al, RANK_ACE jne notAce ;isAce: mov al, ACE_VALUE ;set al to the highest value jmp exitRoutine notAce: shr al, 1 ;move rank to low order bits shr al, 1 shr al, 1 exitRoutine: .leave ret HeartsDeckGetCardRank endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckDeleteCardFromArray %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: will delete the card whose value is passed in ax from the chunk array pointed to by ^lbx:si CALLED BY: PASS: ^lbx:si = handle to chunk array ax = card value to delete RETURN: Carry set if not in deck DESTROYED: nothing SIDE EFFECTS: will remove the card value from the chunk array PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- PW 1/28/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ if 0 HeartsDeckDeleteCardFromArray proc near uses ax,cx,dx,di,ds .enter class HeartsDeckClass mov dx, ax ;save the card value call MemLock mov ds, ax clr ax call ChunkArrayGetCount push bx mov bx, cx continueSearch: cmp bx, ax jz elementNotFound call ChunkArrayElementToPtr cmp dl, ds:[di] ;test the card number jz foundElement inc ax jmp continueSearch elementNotFound: pop bx stc jmp exitRoutine foundElement: pop bx call ChunkArrayDelete clc exitRoutine: call MemUnlock .leave ret HeartsDeckDeleteCardFromArray endp endif COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckRemoveNthCard %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: MSG_DECK_REMOVE_NTH_CARD method handler for DeckClass Removes a card from the deck's composite CALLED BY: DeckPopCard, others PASS: *ds:si = instance data of deck ^lcx:dx = child to remove - or - if cx = 0, dx = nth child to remove (0 = first child) CHANGES: if deck has children: the card indicated by cx,dx is removed from the vis tree and DI_nCards is updated accordingly RETURN: if deck has children: carry clear ^lcx:dx = removed card if not: carry set DESTROYED: ax, bx, cx, dx, di PSEUDO CODE/STRATEGY: call the superclass to actually do the removing then remove the card from the ChunkArray if necessary KNOWN BUGS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- PW 1/28/93 initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ if 0 HeartsDeckRemoveNthCard method HeartsDeckClass, MSG_DECK_REMOVE_NTH_CARD mov di, offset HeartsDeckClass call ObjCallSuperNoLock ret HeartsDeckRemoveNthCard endm endif COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckStartGame %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Checks to see if the deck has the two of clubs and if it does, then it starts the game and if not then it sends the START_GAME message to its neighbor. CALLED BY: MSG_HEARTS_DECK_START_GAME PASS: *ds:si = HeartsDeckClass object ds:di = HeartsDeckClass instance data ds:bx = HeartsDeckClass object (same as *ds:si) es = segment of HeartsDeckClass ax = message # RETURN: nothing DESTROYED: nothing SIDE EFFECTS: none PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- PW 1/28/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckStartGame method dynamic HeartsDeckClass, MSG_HEARTS_DECK_START_GAME uses ax, cx, dx .enter mov dl, TWO or CLUBS call HeartsDeckFindCardGivenAttr cmp cx, 0 jl notInTheDeck mov di, mask MF_CALL or mask MF_FIXUP_DS mov ax, MSG_HEARTS_DECK_PLAY_CARD call ObjCallInstanceNoLock jmp exitRoutine notInTheDeck: Deref_DI Deck_offset movdw bxsi, ds:[di].HI_neighborPointer mov di, mask MF_CALL or mask MF_FIXUP_DS mov ax, MSG_HEARTS_DECK_START_GAME call ObjMessage exitRoutine: .leave ret HeartsDeckStartGame endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckPlayCard %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Will play the next card if the deck is a computer player or will give up control to the user if it is the users turn to play a card. If 4 cards have been played, then it will enable to the take trigger, else it will send a message to the next player for him to play a card. CALLED BY: MSG_HEARTS_DECK_PLAY_CARD PASS: *ds:si = HeartsDeckClass object ds:di = HeartsDeckClass instance data ds:bx = HeartsDeckClass object (same as *ds:si) es = segment of HeartsDeckClass ax = message # RETURN: nothing DESTROYED: nothing SIDE EFFECTS: PSEUDO CODE/STRATEGY: watch for the special case of the beginning of the game because then the two of clubs must be played. If the deck is a computer player then : strategy is to figure out what card to play next switch that card with the first card play the first card call the neighbor to play a card else strategy is to let the user play a valid card call the neighbor to play a card also must check to see if 4 cards have been played. REVISION HISTORY: Name Date Description ---- ---- ----------- PW 1/28/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckPlayCard method dynamic HeartsDeckClass, MSG_HEARTS_DECK_PLAY_CARD uses ax, cx, dx, bp .enter mov ax, MSG_HEARTS_GAME_GET_CARDS_PLAYED call VisCallParent cmp cl, NUM_PLAYERS jz fourCardsPlayed cmp cl, 0 jg dontSetTheLead ;setTheLead: push cx ;save number of cards played mov cx, ds:[LMBH_handle] mov dx, si mov ax, MSG_HEARTS_GAME_SET_LEAD_POINTER call VisCallParent pop cx ;restore number of cards played dontSetTheLead: mov ax, handle MyDeck cmp ax, ds:[LMBH_handle] jnz computerPlayer mov ax, offset MyDeck cmp ax, si jz humanPlayer computerPlayer: mov di,offset BlankText call HeartsDeckDrawPlayerInstructions ; Slow the computer down a little so as not to boggle the user ; mov ax,COMPUTER_PLAYER_DELAY_TIMER_INTERVAL call TimerSleep cmp cl, 0 jl playTwoClubs jz playFirstCard call HeartsDeckFollowSuit jmp playTopCard fourCardsPlayed: ; Play sounds associated with trick taken ; if WAV_SOUND mov ax, MSG_HEARTS_GAME_CHECK_TAKEN_SOUND call VisCallParent endif ; Show which player took the trick ; push si mov bx, handle HeartsPlayingTable mov si, offset HeartsPlayingTable mov di, mask MF_CALL or mask MF_FIXUP_DS mov ax, MSG_HEARTS_GAME_GET_TAKE_POINTER call ObjMessage mov bx, cx ;bx <= take card handle mov si, dx ;si <= take card offset mov ax, MSG_HEARTS_DECK_INVERT mov di, mask MF_FIXUP_DS or mask MF_CALL call ObjMessage pop si ; Do the business of actually taking the trick ; clr cl ;set cards played to zero mov ax, MSG_HEARTS_GAME_SET_CARDS_PLAYED call VisCallParent call HeartsDeckSetTakeTrigger jmp exitRoutine playFirstCard: call HeartsDeckPlayFirstCard jmp playTopCard playTwoClubs: clr cl ;set cards played to zero mov ax, MSG_HEARTS_GAME_SET_CARDS_PLAYED call VisCallParent call HeartsDeckPlayTwoClubs jmp playTopCard humanPlayer: mov di,offset StartWithTwoOfClubsText cmp cl,0 jl drawInstructions mov di,offset ItsYourTurnText drawInstructions: call HeartsDeckDrawPlayerInstructions mov ax, DRAW_SCORE_HIGHLIGHTED call HeartsDeckSetHumanPlayer jmp exitRoutine playTopCard: mov cx, handle DiscardDeck mov dx, offset DiscardDeck mov ax, MSG_HEARTS_DECK_PLAY_TOP_CARD mov di, mask MF_FIXUP_DS or mask MF_CALL call ObjCallInstanceNoLock mov ax, MSG_HEARTS_GAME_GET_CARDS_PLAYED call VisCallParent inc cl ;cards played++ mov ax, MSG_HEARTS_GAME_SET_CARDS_PLAYED call VisCallParent ; Play sounds associated with card played if any ; mov ax, MSG_HEARTS_GAME_CHECK_PLAY_SOUND call VisCallParent Deref_DI Deck_offset movdw bxsi, ds:[di].HI_neighborPointer mov ax, MSG_HEARTS_DECK_PLAY_CARD mov di, mask MF_FIXUP_DS or mask MF_FORCE_QUEUE ;changed to force-queue to make the playing ;of the top card finish updating the screen ;before playing the next card. call ObjMessage exitRoutine: .leave ret HeartsDeckPlayCard endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckPlayFirstCard %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Will switch the top card of the deck with a card from the deck that should be played first CALLED BY: HeartsDeckPlayCard PASS: *ds:si = instance data of the deck RETURN: nothing DESTROYED: nothing SIDE EFFECTS: will probably switch the order to two cards in the deck PSEUDO CODE/STRATEGY: Check to see if there are any card of the correct suit in the deck, and if there are, then play the smallest one. If void in that suit, then play the worst card that is in the deck. REVISION HISTORY: Name Date Description ---- ---- ----------- PW 2/ 4/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckPlayFirstCard proc near uses ax,bx,cx,dx,si,di,bp .enter class HeartsDeckClass mov ax, MSG_HEARTS_GAME_CHECK_HEARTS_BROKEN call VisCallParent mov bl, cl ;bl <= Hearts Broken mov ax, MSG_DECK_GET_N_CARDS call ObjCallInstanceNoLock mov bp, cx ;bp <= card # clr dx ;dl <= best card number ;dh <= best chance bestCardLoop: dec bp push bp ;save card # mov ax, MSG_DECK_GET_NTH_CARD_ATTRIBUTES call ObjCallInstanceNoLock mov ax, bp ;ax <= card attr. and al, SUIT_MASK xor al, HEARTS ;al <= 0 if hearts or al, bl ;al <= 0 if hearts and ;hearts not broken tst al jz continueLoop ;heartsBroken: mov ax, bp ;ax <= card attr. call HeartsDeckGetChanceOfTaking and al, SUIT_MASK or RANK_MASK cmp al, JACK or DIAMONDS jne notTheJack tst cl jz takeThisOne ;we will win by leading ;jack of d. tst dh jnz continueLoop mov cl, 1 jmp newBestCard ;every card till now would ;definitly win, so lead ;jack to lose lead. notTheJack: cmp cx, 0 jl takeThisOne ;we won't win by leading ;this. cmp cl, dh jl continueLoop ;better chance of losing ;lead with other card newBestCard: pop dx ;get card number push dx ;save card number mov dh, cl ;set new best chance jmp continueLoop takeThisOne: pop cx jmp switchCards continueLoop: pop bp cmp bp, 0 jg bestCardLoop ;endLoop: mov cl, dl ;cl <= best card number ; clr ch switchCards: mov di, mask MF_FIXUP_DS or mask MF_CALL mov ax, MSG_HEARTS_DECK_SHIFT_CARDS clr ch ;redraw deck ; mov ch, 1 ;don't redraw deck call ObjCallInstanceNoLock ;exitRoutine: .leave ret HeartsDeckPlayFirstCard endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckCheckJackAndQueen %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Will check and see if the Jack of Diamonds or the Queen of Spades is an appropriate card to play CALLED BY: HeartsDeckFollowSuit PASS: *ds:si = instance data of the deck al = take card attributes cx = score of discard deck RETURN: Carry set if card appropriate to play and cx = location of card to play DESTROYED: ax, dx, cx SIDE EFFECTS: none PSEUDO CODE/STRATEGY: Check if Jack will take the trick and that taking the trick with the Jack is good. Check if Queen will not take the trick. REVISION HISTORY: Name Date Description ---- ---- ----------- PW 2/18/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckCheckJackAndQueen proc near .enter and al, SUIT_MASK cmp al, DIAMONDS ;check if lead card is diamond jne notDiamonds cmp cx, MAXIMUM_POINTS_BEFORE_DEFINITELY_BAD jg noTake ;not worth taking with jack mov dl, JACK or DIAMONDS call HeartsDeckFindCardGivenAttr cmp cx, 0 jl noTake ;don't have the jack mov dx, cx ;dx <= location of jack mov al, JACK or DIAMONDS call HeartsDeckGetChanceOfTaking tst cx jnz noTake ;not guaranteed to take jack mov cx, dx ;cx <= location of jack stc jmp exitRoutine notDiamonds: cmp al, SPADES ;check if lead card is spade jne noTake mov dl, QUEEN or SPADES call HeartsDeckFindCardGivenAttr cmp cx, 0 jl noTake ;don't have the queen mov dx, cx ;dx <= location of queen mov al, QUEEN or SPADES call HeartsDeckGetChanceOfTaking cmp cx, 0 jge noTake ;not guaranteed to lose mov cx, dx ;cx <= location of jack stc jmp exitRoutine noTake: clc exitRoutine: .leave ret HeartsDeckCheckJackAndQueen endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckFollowingPreventShoot %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Will switch the top card of the deck with a card from the deck that best prevents someone from shooting the moon. CALLED BY: HeartsDeckFollowSuit PASS: *ds:si = instance data of the deck cl = deck ID of deck trying to shoot RETURN: nothing DESTROYED: ax,bx,cx,dx,bp,di SIDE EFFECTS: will probably switch the order of two cards in the deck PSEUDO CODE/STRATEGY: check if deck is void in suit lead if not void : see if the highest card of the suit lead will take the trick or beat the card played by the shooter. If so, then lead that card, if not, then lead the smallest card of that suit. if void: Check if there are points in the discardDeck, and if there are, then don't play a heart. check if the shooter's card will take the trick, and if so, then dont play a heart. Otherwise dump a low bad card (smallest heart or the Queen of Spades). REVISION HISTORY: Name Date Description ---- ---- ----------- PW 4/ 7/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckFollowingPreventShoot proc near deckOffset local word push si shootDeck local word push cx takeCardAttr local byte cardNumber local byte cardAttr local byte ForceRef deckOffset ForceRef shootDeck ForceRef cardAttr .enter class HeartsDeckClass mov ax, MSG_HEARTS_GAME_GET_TAKE_CARD_ATTR call VisCallParent mov takeCardAttr, cl push bp ;save locals mov bp, cx ;bp <= take card attr. mov ax, MSG_HEARTS_DECK_COUNT_NUMBER_OF_SUIT call ObjCallInstanceNoLock pop bp ;restore locals jcxz voidInSuit ;notVoid: mov cardNumber, dl cmp cl, 1 je playCard ;only one card of ;correct suit. call HeartsDeckFollowingPreventShootNotVoid jmp playCard voidInSuit: call HeartsDeckFollowingPreventShootVoid playCard: mov cl, cardNumber clr ch ;redraw deck mov ax, MSG_HEARTS_DECK_SHIFT_CARDS call ObjCallInstanceNoLock .leave ret HeartsDeckFollowingPreventShoot endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckFollowingPreventShootNotVoid %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Will take care of the not void case for HeartsDeckFollowingPreventShoot CALLED BY: HeartsDeckFollowingPreventShoot PASS: dx = # of highest card. deckOffset shootDeck takeCardAttr cardNumber cardAttr RETURN: modified local varibles, namely cardNumber as the card to play. DESTROYED: ax, bx, cx, dx, di SIDE EFFECTS: PSEUDO CODE/STRATEGY: see if the highest card of the suit lead will take the trick or beat the card played by the shooter. If so, then lead that card, if not, then lead the smallest card of that suit. REVISION HISTORY: Name Date Description ---- ---- ----------- PW 4/ 8/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckFollowingPreventShootNotVoid proc near .enter inherit HeartsDeckFollowingPreventShoot push bp ;save locals mov bp, dx ;bp <= # of high card mov ax, MSG_DECK_GET_NTH_CARD_ATTRIBUTES call ObjCallInstanceNoLock mov ax, bp ;ax <= high card attrs. and bp, SUIT_MASK cmp bp, SPADES pop bp ;restore locals mov cardAttr, al jne notSpades ;checkIfQueenHasBeenPlayed: mov al, takeCardAttr call HeartsDeckGetCardRank cmp al, RANK_VALUE_OF_QUEEN jge notGaranteedToTakeTrick ;the queen or a higher ;card are out, dont ;try and take trick mov dl, mask HA_NO_QUEEN call HeartsDeckCheckIfCardHasBeenPlayed tst ch jnz notGaranteedToTakeTrick ;queen hasnt been ;played yet, dont ;try and take trick notSpades: mov cx, shootDeck mov ax, MSG_HEARTS_GAME_CHECK_IF_DECK_PLAYED call VisCallParent cmp cl, ch ;check if shooter has ;gone yet jl shooterHasGone ;shooterHasntGone: mov al, cardAttr call HeartsDeckGetChanceOfTaking jcxz exitRoutine ;will take trick jmp notGaranteedToTakeTrick shooterHasGone: inc cl sub ch, cl xchg ch, cl clr ch ;cx <= # of shooter ; card push bp ;save locals mov bp, cx ;bp <= # of shooter ; card mov bx, handle DiscardDeck mov si, offset DiscardDeck mov ax, MSG_DECK_GET_NTH_CARD_ATTRIBUTES mov di, mask MF_CALL or mask MF_FIXUP_DS call ObjMessage mov ax, bp ;ax <= shooter card ; attr. pop bp ;restore locals mov si, deckOffset ;restore offset call HeartsDeckGetCardRank mov ah, al ;ah <= rank of shooter ; card mov al, cardAttr call HeartsDeckGetCardRank cmp al, ah jg exitRoutine ;will beat shooters ;card notGaranteedToTakeTrick: push bp ;save locals mov al, takeCardAttr mov bp, ax mov cx, 1 ;find lowest card mov ax, MSG_HEARTS_DECK_FIND_HIGH_OR_LOW call ObjCallInstanceNoLock pop bp ;restore locals mov cardNumber, ch exitRoutine: mov cl, cardNumber clr ch mov di, 1 ;only check if Jack or ;Queen call HeartsDeckMakeSureNotDumbMove mov cardNumber, cl .leave ret HeartsDeckFollowingPreventShootNotVoid endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckFollowingPreventShootVoid %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Will take care of the void case for HeartsDeckFollowingPreventShoot CALLED BY: HeartsDeckFollowingPreventShoot PASS: deckOffset shootDeck takeCardAttr cardNumber cardAttr RETURN: modified local varibles, namely cardNumber as the card to play. DESTROYED: ax, bx, cx, dx, di SIDE EFFECTS: PSEUDO CODE/STRATEGY: Check if there are points in the discardDeck, and if there are, then don't play a heart. check if the shooter's card will take the trick, and if so, then dont play a heart. Otherwise dump a low bad card (smallest heart or the Queen of Spades). REVISION HISTORY: Name Date Description ---- ---- ----------- PW 4/ 8/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckFollowingPreventShootVoid proc near .enter inherit HeartsDeckFollowingPreventShoot mov bx, handle DiscardDeck mov si, offset DiscardDeck mov ax, MSG_HEARTS_DECK_CALCULATE_SCORE mov di, mask MF_CALL or mask MF_FIXUP_DS call ObjMessage mov si, deckOffset ;restore offset tst al ;check if any (+) pts. jg dontPlayHeart ;there are pts in deck ;checkIfShooterWillTakeTrick: mov cx, shootDeck mov ax, MSG_HEARTS_GAME_CHECK_IF_DECK_PLAYED call VisCallParent cmp cl, ch ;check if shooter has ;gone yet jge playLowHeart ;shooter hasn't gone ;shooterHasGone: cmp ch, NUM_PLAYERS -1 je dontPlayHeart ;were last deck to play ;card, shooter will ;take trick. inc cl sub ch, cl xchg ch, cl clr ch ;cx <= # of shooter ; card push bp ;save locals mov bp, cx ;bp <= # of shooter ; card mov bx, handle DiscardDeck mov si, offset DiscardDeck mov ax, MSG_DECK_GET_NTH_CARD_ATTRIBUTES mov di, mask MF_CALL or mask MF_FIXUP_DS call ObjMessage mov ax, bp ;ax <= shooter card ; attr. pop bp ;restore locals mov si, deckOffset ;restore offset call HeartsDeckGetChanceOfTaking jcxz dontPlayHeart ;shooter will take ;trick playLowHeart: mov dl, QUEEN or SPADES call HeartsDeckFindCardGivenAttr tst cx jge playQueen push bp ;save locals mov bp, HEARTS mov cx, 1 ;find lowest card mov ax, MSG_HEARTS_DECK_FIND_HIGH_OR_LOW call ObjCallInstanceNoLock pop bp ;restore locals jcxz dontPlayHeart ;dont have any hearts mov cardNumber, ch jmp exitRoutine playQueen: mov cardNumber, cl jmp exitRoutine dontPlayHeart: push bp ;save locals mov ax, MSG_DECK_GET_N_CARDS call ObjCallInstanceNoLock mov dx, MAXIMUM_STRATEGIC_POINTS ;dx <= lowest str. card val. mov bl, 1 ;bl <= lowest card number + 1 getNuetralCardVal: mov bp, cx ;bp <= card number dec bp mov ax, MSG_DECK_GET_NTH_CARD_ATTRIBUTES call ObjCallInstanceNoLock mov ax, bp ;ax <= nth card attr. and bp, SUIT_MASK cmp bp, HEARTS je notValidCard mov bp, cx ;save card number call HeartsDeckGetStrategicCardValue cmp cx, 0 jge valueIsPositive neg cx valueIsPositive: cmp cx, dx jg continueLoop mov bx, bp ;bx <= card number mov dx, cx ;dx <= str. card val. continueLoop: mov cx, bp ;restore card number notValidCard: loop getNuetralCardVal dec bl pop bp ;restore locals mov cardNumber, bl exitRoutine: .leave ret HeartsDeckFollowingPreventShootVoid endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckCheckIfPreventing %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Will return the deck ID of the deck that we are trying to prevent from shooting, or zero if we're not trying to prevent shooting. CALLED BY: HeartsDeckFollowSuit PASS: *ds:si = HeartsDeckClass object ds:di = HeartsDeckClass instance data RETURN: cx = 0 if not trying to prevent moon shoot = deck ID of deck trying to shoot DESTROYED: ax, dx, bp SIDE EFFECTS: none PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- PW 4/ 8/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckCheckIfPreventing method dynamic HeartsDeckClass, MSG_HEARTS_DECK_CHECK_IF_PREVENTING .enter mov ax, MSG_HEARTS_GAME_GET_SHOOT_DATA call VisCallParent cmp cl, 0 ;cmp shootData, 0 jg someonePossiblyShooting ;noOneShooting: BitClr ds:[di].HI_shootStyle.HSS_currentInfo, HSI_PREVENTING_SHOOT jmp dontPrevent someonePossiblyShooting: clr ch ;cx <= deck ID of deck ; possibly shooting test ds:[di].HI_shootStyle.HSS_currentInfo, mask HSI_PREVENTING_SHOOT jnz exitRoutine ;currently preventing ;notCurrentlyPreventing: push cx ;save deck ID call TimerGetCount mov dx, ax mov ax, MSG_GAME_SEED_RANDOM call VisCallParent mov dx, MAX_ODDS mov ax, MSG_GAME_RANDOM call VisCallParent pop cx ;restore deck ID cmp dl, ds:[di].HI_shootStyle.HSS_oddsOnPreventing jge probablyDontPrevent ;tryAndPrevent: BitSet ds:[di].HI_shootStyle.HSS_currentInfo, HSI_PREVENTING_SHOOT jmp exitRoutine probablyDontPrevent: ;check if shooter lead a ;shooting card cmp dl, ds:[di].HI_shootStyle.HSS_oddsOnBeingCautious jge dontPrevent ;dont try and prevent shooting mov bx, cx ;bx <= deck ID mov ax, MSG_HEARTS_GAME_GET_TAKE_CARD_ATTR call VisCallParent mov bp, cx ;bp <= take card attr and cl, SUIT_MASK cmp cl, HEARTS jne dontPrevent mov ax, MSG_DECK_GET_N_CARDS call ObjCallInstanceNoLock cmp cl, MANY_CARDS_LEFT jl dontPrevent ;too late in the game to be ;suspicious. mov cl, bl ;restore deck ID mov di, offset heartsDeckPlayersTable dec cl CheckHack < size optr eq 4 > shl cl, 1 shl cl, 1 ;multiply cl * 4 (size optr) clr ch add di, cx ;di <= offset for shooter deck mov ax, MSG_HEARTS_GAME_GET_LEAD_POINTER call VisCallParent cmpdw cs:[di], cxdx ;check if shooter lead. mov cx, bx ;restore deck ID jne dontPrevent ;shooter didnt lead mov ax, bp ;ax <= take card attr ; ; the take card attr is the same as the lead attribute because ; the person trying to shoot has to take the trick or it ; it is impossible to shoot. ; call HeartsDeckGetCardRank cmp al, RANK_VALUE_OF_JACK jge exitRoutine ;shooter lead higher than a ;jack of hearts, prevent ;from shooting. dontPrevent: clr cx exitRoutine: .leave ret HeartsDeckCheckIfPreventing endm heartsDeckPlayersTable optr \ ComputerDeck3, ComputerDeck2, ComputerDeck1, MyDeck COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckFollowSuit %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Will switch the top card of the deck with a card from the deck that obeys the follow suit rule. CALLED BY: HeartsDeckPlayCard PASS: *ds:si = instance data of the deck RETURN: nothing DESTROYED: nothing SIDE EFFECTS: will probably switch the order of two cards in the deck PSEUDO CODE/STRATEGY: Check to see if there are any card of the correct suit in the deck, and if there are, then play the smallest one. If void in that suit, then play the worst card that is in the deck. REVISION HISTORY: Name Date Description ---- ---- ----------- PW 2/ 2/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckFollowSuit proc near uses ax,bx,cx,dx,si,di,bp .enter class HeartsDeckClass mov ax, MSG_HEARTS_DECK_CHECK_IF_PREVENTING call ObjCallInstanceNoLock jcxz notPreventingShootingMoon ;preventingShootingMoon: call HeartsDeckFollowingPreventShoot jmp exitRoutine notPreventingShootingMoon: push si ;save offset mov bx, handle DiscardDeck mov si, offset DiscardDeck mov di, mask MF_FIXUP_DS or mask MF_CALL mov ax, MSG_HEARTS_DECK_CALCULATE_SCORE call ObjMessage pop si ;restore offset xchg dx, cx ;save worth taking? mov ax, MSG_HEARTS_GAME_GET_TAKE_CARD_ATTR call VisCallParent mov al, cl ;al <= takeCardAttr mov bp, ax xchg dx, cx ;restore worth taking? cmp cx, 0 jge notWorthTaking ;worthTaking: clr cx ;search for highest card jmp checkForSuit notWorthTaking: ;check to see if Jack of Diamonds or Queen of Spades is an ;appropriate card to play call HeartsDeckCheckJackAndQueen jc switchCards ;Jack or Queen is appropriate push si ;save offset clr cx ;search for highest card mov si, offset DiscardDeck mov di, mask MF_FIXUP_DS or mask MF_CALL mov ax, MSG_HEARTS_DECK_FIND_HIGH_OR_LOW call ObjMessage pop si ;restore offset mov ch, cl clr cl ;search for highest card ;that still wont take the ;trick push cx ;save what to search for mov ax, bp ;ax <= takeCardAttr and al, SUIT_MASK cmp al, DIAMONDS jne notDiamonds ;isDiamond: mov dl, mask HA_NO_JACK call HeartsDeckCheckIfCardHasBeenPlayed tst ch jz notDiamonds ;jack has been played ;jackHasntBeenPlayed: pop cx cmp ch, RANK_VALUE_OF_JACK jl checkForSuit ;highest card is lower than ;jack mov ch, RANK_VALUE_OF_JACK jmp checkForSuit notDiamonds: pop cx checkForSuit: mov ax, MSG_HEARTS_DECK_FIND_HIGH_OR_LOW call ObjCallInstanceNoLock tst cx jnz notVoid ;not void in suit ;voidInSuit: mov ax, MSG_DECK_GET_N_CARDS call ObjCallInstanceNoLock call HeartsDeckGetLowestCard jcxz exitRoutine jmp switchCards notVoid: mov cl, ch ;move card number into cl clr ch clr di ;check if deck is last. call HeartsDeckMakeSureNotDumbMove switchCards: mov ax, MSG_HEARTS_DECK_SHIFT_CARDS clr ch ;redraw deck call ObjCallInstanceNoLock exitRoutine: .leave ret HeartsDeckFollowSuit endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckGetNuetralCard %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: returns the number of the card that is most nuetral in the first cx cards of the deck CALLED BY: HeartsDeckComputerPassCards PASS: *ds:si = deck object cx = number of cards to look through, starting at zero RETURN: cx = number of card with the lowest value. DESTROYED: ax,bx,dx,bp SIDE EFFECTS: none PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- PW 3/18/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckGetNuetralCard proc near .enter class HeartsDeckClass mov dx, MAXIMUM_STRATEGIC_POINTS ;dx <= lowest str. card val. clr bx ;bx <= lowest card number getNuetralCardVal: mov bp, cx ;bp <= card number dec bp mov ax, MSG_DECK_GET_NTH_CARD_ATTRIBUTES call ObjCallInstanceNoLock mov ax, bp ;ax <= nth card attr. mov bp, cx ;save card number call HeartsDeckGetStrategicCardValue cmp cx, 0 jge valueIsPositive neg cx valueIsPositive: cmp cx, dx jg continueLoop mov bx, bp ;bx <= card number mov dx, cx ;dx <= str. card val. continueLoop: mov cx, bp ;restore card number loop getNuetralCardVal dec bx mov cx, bx ;cx <= card number .leave ret HeartsDeckGetNuetralCard endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckGetLowestCard %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: returns the number of the card with the lowest value in the first cx cards of the deck CALLED BY: HeartsDeckFollowSuit PASS: *ds:si = deck object cx = number of cards to look through, starting at zero RETURN: cx = number of card with the lowest value. DESTROYED: ax,bx,dx,bp SIDE EFFECTS: none PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- PW 3/ 1/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckGetLowestCard proc near .enter class HeartsDeckClass mov dx, MAXIMUM_STRATEGIC_POINTS ;dx <= lowest str. card val. clr bx ;bx <= lowest card number getLowestStrCardVal: mov bp, cx ;bp <= card number dec bp mov ax, MSG_DECK_GET_NTH_CARD_ATTRIBUTES call ObjCallInstanceNoLock mov ax, bp ;ax <= nth card attr. mov bp, cx ;save card number call HeartsDeckGetStrategicCardValue cmp cx, dx jg continueLoop mov bx, bp ;bx <= card number mov dx, cx ;dx <= str. card val. continueLoop: mov cx, bp ;restore card number loop getLowestStrCardVal dec bx mov cx, bx ;cx <= card number .leave ret HeartsDeckGetLowestCard endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckMakeSureNotDumbMove %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Will make sure that the Jack of Diamonds is not played if it won't take the trick. Also, will check that the Queen of Spades is not played if were going to take the trick CALLED BY: HeartsDeckFollowSuit PASS: cx = card number to play di = 0 if should also adjust for deck being last player of trick. != 0 if should only check about jack and queen *ds:si = HeartsDeck playing the card RETURN: cx = card number that should be played (possibly changed) DESTROYED: nothing SIDE EFFECTS: PSEUDO CODE/STRATEGY: assumption made: that the deck is sorted. check if bad card to play, and if it is then check if there is a better card to play of the same suit. REVISION HISTORY: Name Date Description ---- ---- ----------- PW 2/11/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckMakeSureNotDumbMove proc near uses ax,bx,dx,bp,di .enter class HeartsDeckClass push cx ;save card number mov bp, cx ;bp <= card number mov ax, MSG_DECK_GET_NTH_CARD_ATTRIBUTES call ObjCallInstanceNoLock push bp ;save card attr. mov ax, MSG_HEARTS_DECK_COUNT_NUMBER_OF_SUIT call ObjCallInstanceNoLock pop bp ;restore card attr. mov ax, bp ;ax <= card attr. pop dx ;restore card number cmp cl, 1 LONG je exitRoutine ;only one card of this suit ;(don't have any choice) and al, SUIT_MASK or RANK_MASK cmp al, JACK or DIAMONDS LONG je checkJackOfDiamonds cmp al, QUEEN or SPADES je checkQueenOfSpades tst di LONG jnz exitRoutine ;dont check if deck is last ;checkIfLastCard: call HeartsDeckCheckIfLastCard LONG jnc exitRoutine ;lastCard: mov ax, bp ;ax <= card attr. call HeartsDeckGetChanceOfTaking push cx ;save chance of taking push si ;save offset mov bx, handle DiscardDeck mov si, offset DiscardDeck mov di, mask MF_FIXUP_DS or mask MF_CALL mov ax, MSG_HEARTS_DECK_CALCULATE_SCORE call ObjMessage pop si ;restore offset pop ax ;ax <= chance of taking jcxz willTakeTrick ;no bad points, so take ;it high cmp ax, 0 LONG jl exitRoutine ;won't take trick cmp cx, 0 mov cx, 0 ;search for highest card jl findHighestCard ;going to take trick and ;get jack, make sure highest ;diamond is played willTakeTrick: mov ax, bp ;ax <= card attr and al, SUIT_MASK cmp al, DIAMONDS jne findHighestCard ;findLowestCard: push dx ;save card to play mov dl, mask HA_NO_JACK call HeartsDeckCheckIfCardHasBeenPlayed pop dx ;restore card to play findHighestCard: mov ax, MSG_HEARTS_DECK_FIND_HIGH_OR_LOW call ObjCallInstanceNoLock ;check to make sure not playing the queen of spades of jack of diamonds mov cl, ch ;set cx to card numher clr ch mov bp, cx ;bp <= card number mov ax, MSG_DECK_GET_NTH_CARD_ATTRIBUTES call ObjCallInstanceNoLock mov ax, bp ;ax <= card attr. and al, SUIT_MASK or RANK_MASK cmp al, JACK or DIAMONDS je exitRoutine cmp al, QUEEN or SPADES je exitRoutine mov dx, cx ;set dx to new card to play jmp exitRoutine checkQueenOfSpades: mov ax, bp ;ax <= card attr. call HeartsDeckGetChanceOfTaking cmp cx, 0 jl exitRoutine ;queen won't take trick mov bl, SPADES ;bl <= suit to check for tst dx ;check card number jz checkGreaterCard jmp checkSmallerCard checkJackOfDiamonds: mov ax, bp ;ax <= card attr. call HeartsDeckGetChanceOfTaking tst cx jz exitRoutine ;jack will take trick mov bl, DIAMONDS ;bl <= suit to check for tst dx ;check card number jz checkGreaterCard ; jmp checkSmallerCard checkSmallerCard: dec dx ;dx <= card # - 1 mov bp, dx ;bp <= card # - 1 mov ax, MSG_DECK_GET_NTH_CARD_ATTRIBUTES call ObjCallInstanceNoLock mov ax, bp ;ax <= card attr. and al, SUIT_MASK cmp al, bl ;check if same suit je exitRoutine inc dx ;dx <= card # checkGreaterCard: mov ax, MSG_DECK_GET_N_CARDS call ObjCallInstanceNoLock dec cx cmp cx, dx ;check if dx = last card je exitRoutine ;dx = last card inc dx ;dx <= card # + 1 mov bp, dx ;bp <= card # + 1 mov ax, MSG_DECK_GET_NTH_CARD_ATTRIBUTES call ObjCallInstanceNoLock mov ax, bp ;ax <= card attr. and al, SUIT_MASK cmp al, bl ;check if same suit je exitRoutine dec dx ;dx <= card # exitRoutine: mov cx, dx .leave ret HeartsDeckMakeSureNotDumbMove endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckCheckIfCardHasBeenPlayed %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Will return RANK_VALUE_OF_JACK if the jack has not been played, or zero if the Jack has been played CALLED BY: HeartsDeckMakeSureNotDumbMove PASS: *ds:si = HeartsDeckClass object playing the card dl = mask HA_NO_JACK or mask HA_NO_QUEEN depending if checking if jack or queen has been played. RETURN: ch = RANK_VALUE_OF_JACK if jack has not been played = 0 if card has been played. ds = updated segment (possibly moved) DESTROYED: ax, bx, di SIDE EFFECTS: none PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- PW 3/26/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckCheckIfCardHasBeenPlayed proc near uses dx,si,bp deckOD local word loopCounter local word .enter class HeartsDeckClass mov ax, ds:[LMBH_handle] mov deckOD, ax mov loopCounter, NUM_PLAYERS -1 Deref_DI Deck_offset movdw bxsi, ds:[di].HI_playersDataPtr call MemLock mov ds, ax continueLoop: mov ax, loopCounter call ChunkArrayElementToPtr test ds:[di].PD_cardAssumptions, dl jz jackNotPlayedYet dec loopCounter jge continueLoop ;jackHasBeenPlayed: clr ch jmp exitRoutine jackNotPlayedYet: mov ch, RANK_VALUE_OF_JACK ;search for greatest card ;lower than a jack exitRoutine: call MemUnlock mov bx, deckOD call MemDerefDS .leave ret HeartsDeckCheckIfCardHasBeenPlayed endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckCheckIfLastCard %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Will check and see if this player is the last player to have suit that was lead. CALLED BY: HeartsDeckMakeSureNotDumbMove PASS: *ds:si = HeartsDeckClass object bp = card attrs of card lead RETURN: ds = updated segment (possibly moved) carry set if person is last person with proper suit DESTROYED: ax, bx, cx, di SIDE EFFECTS: none PSEUDO CODE/STRATEGY: if three NUM_PLAYERS -1 cards have been played, then this is the last person to play. Check to see if the remaining players that have to play cards are void in the suit lead, and if all them are, then you are the last person to play a card. REVISION HISTORY: Name Date Description ---- ---- ----------- PW 3/25/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckCheckIfLastCard proc near uses dx,si,bp cardLead local word push bp deckOD local word loopCounter local byte arrayElement local byte cardSuit local byte .enter class HeartsDeckClass mov ax, ds:[LMBH_handle] mov deckOD, ax mov ax, MSG_HEARTS_GAME_GET_CARDS_PLAYED call VisCallParent cmp cl, NUM_PLAYERS - 1 je isLastCard mov loopCounter, NUM_PLAYERS - 1 sub loopCounter, cl mov ax, cardLead clr cardSuit and al, SUIT_MASK cmp al, HEARTS je setHearts cmp al, DIAMONDS je setDiamonds cmp al, CLUBS je setClubs ;setSpades: BitSet cardSuit, HS_SPADES jmp doneSettingSuit setHearts: BitSet cardSuit, HS_HEARTS jmp doneSettingSuit setDiamonds: BitSet cardSuit, HS_DIAMONDS jmp doneSettingSuit setClubs: BitSet cardSuit, HS_CLUBS doneSettingSuit: Deref_DI Deck_offset mov ch, ds:[di].HI_deckIdNumber and ch, ID_NUMBER_MASK mov arrayElement, ch ;arrayElement <= next deck's ; ID number. movdw bxsi, ds:[di].HI_playersDataPtr call MemLock mov ds, ax checkingLoop: clr ah mov al, arrayElement call ChunkArrayElementToPtr mov cl, ds:[di].PD_voidSuits test cl, cardSuit jz notVoidInSuit dec loopCounter jz noOneLeftWithSuit inc arrayElement and arrayElement, ID_NUMBER_MASK jmp checkingLoop notVoidInSuit: call MemUnlock clc jmp exitRoutine noOneLeftWithSuit: call MemUnlock isLastCard: stc exitRoutine: mov bx, deckOD call MemDerefDS .leave ret HeartsDeckCheckIfLastCard endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckPlayTwoClubs %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Will switch the two of clubs with the first card in the deck. CALLED BY: HeartsDeckPlayCard PASS: *ds:si = instance data of deck RETURN: nothing DESTROYED: nothing SIDE EFFECTS: changes order of cards in deck PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- PW 2/ 1/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckPlayTwoClubs proc near uses ax,cx,dx,di .enter class HeartsDeckClass mov dl, TWO or CLUBS call HeartsDeckFindCardGivenAttr mov di, mask MF_FIXUP_DS or mask MF_CALL mov ax, MSG_HEARTS_DECK_SHIFT_CARDS clr ch ;redraw deck ; mov ch, 1 ;don't redraw deck call ObjCallInstanceNoLock .leave ret HeartsDeckPlayTwoClubs endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckFindCard %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Will return the card number of the card in the deck CALLED BY: HeartsDeckPlayTwoClubs PASS: *ds:si = instance data of the deck ax = card value to find RETURN: cx = number of the card in the deck (-1 if not found) DESTROYED: nothing SIDE EFFECTS: none PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- PW 2/ 1/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ if 0 HeartsDeckFindCard proc near uses ax,dx .enter class HeartsDeckClass mov cl, 13 ;number of cards in a suit div cl cmp ah, 1 ;check the remainder ; je fixupAce jl fixupKing jne doneFixup ;fixupAce: sub al, 1 ;fixup the quotient jmp doneFixup fixupKing: mov ah, 13 doneFixup: shl ah, 1 shl ah, 1 shl ah, 1 shl al, 1 or al, ah mov dl, al ;dx <= card attributes call HeartsDeckFindCardGivenAttr ;exitRoutine: .leave ret HeartsDeckFindCard endp endif COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HeartsDeckFindCardGivenAttr %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Will return the card number of the card in the deck CALLED BY: HeartsDeckFindCard PASS: *ds:si = instance data of the deck dl = card attributes to find RETURN: cx = number of the card in the deck (-1 if not found) DESTROYED: nothing SIDE EFFECTS: none PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- PW 2/22/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HeartsDeckFindCardGivenAttr proc near uses ax,bx,bp .enter class HeartsDeckClass mov ax, MSG_DECK_GET_N_CARDS call ObjCallInstanceNoLock jcxz notFound countingLoop: dec cx mov bp, cx ;set card to find mov ax, MSG_DECK_GET_NTH_CARD_ATTRIBUTES call ObjCallInstanceNoLock mov bx, bp and bl, RANK_MASK or SUIT_MASK cmp bl, dl ;check if the same card jz foundCard tst cx jnz countingLoop notFound: mov cx, -1 ;card was not found foundCard: ;cx is already set to card number .leave ret HeartsDeckFindCardGivenAttr endp CommonCode ends ;end of CommonCode resource
/* * Copyright 2009-2017 Alibaba Cloud All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include <alibabacloud/emr/model/CreateBackupPlanRequest.h> using AlibabaCloud::Emr::Model::CreateBackupPlanRequest; CreateBackupPlanRequest::CreateBackupPlanRequest() : RpcServiceRequest("emr", "2016-04-08", "CreateBackupPlan") { setMethod(HttpRequest::Method::Post); } CreateBackupPlanRequest::~CreateBackupPlanRequest() {} long CreateBackupPlanRequest::getResourceOwnerId()const { return resourceOwnerId_; } void CreateBackupPlanRequest::setResourceOwnerId(long resourceOwnerId) { resourceOwnerId_ = resourceOwnerId; setParameter("ResourceOwnerId", std::to_string(resourceOwnerId)); } std::string CreateBackupPlanRequest::getDescription()const { return description_; } void CreateBackupPlanRequest::setDescription(const std::string& description) { description_ = description; setParameter("Description", description); } std::string CreateBackupPlanRequest::getClusterId()const { return clusterId_; } void CreateBackupPlanRequest::setClusterId(const std::string& clusterId) { clusterId_ = clusterId; setParameter("ClusterId", clusterId); } std::string CreateBackupPlanRequest::getAccessKeyId()const { return accessKeyId_; } void CreateBackupPlanRequest::setAccessKeyId(const std::string& accessKeyId) { accessKeyId_ = accessKeyId; setParameter("AccessKeyId", accessKeyId); } std::string CreateBackupPlanRequest::getRegionId()const { return regionId_; } void CreateBackupPlanRequest::setRegionId(const std::string& regionId) { regionId_ = regionId; setParameter("RegionId", regionId); } std::string CreateBackupPlanRequest::getName()const { return name_; } void CreateBackupPlanRequest::setName(const std::string& name) { name_ = name; setParameter("Name", name); } std::string CreateBackupPlanRequest::getRootPath()const { return rootPath_; } void CreateBackupPlanRequest::setRootPath(const std::string& rootPath) { rootPath_ = rootPath; setParameter("RootPath", rootPath); }
copyright zengfr site:http://github.com/zengfr/romhack 00042A move.l D1, (A0)+ 00042C dbra D0, $42a 014840 move.w (A1)+, D0 014842 add.w D4, D0 [base+6582, base+658A, base+6592, base+659A, base+65A2] 0148EE move.w (A1)+, D0 0148F0 add.w D4, D0 [base+6002, base+6022, base+602A, base+6102, base+610A, base+6112, base+611A, base+6182, base+618A, base+6192, base+619A, base+61A2, base+61AA, base+6222, base+622A, base+630A, base+6312, base+631A, base+6382, base+6392, base+639A, base+63A2, base+63AA, base+63B2, base+6422, base+642A, base+650A, base+6512, base+6582, base+658A, base+6592, base+659A, base+65A2] 081090 move.l (A1)+, (A0)+ 081092 dbra D0, $81090 [base+6574, base+6576, base+6578, base+657A, base+657C, base+657E, base+6580, base+6582, base+6584, base+6586, base+658E, base+6590, base+6592, base+6594, base+6596, base+6598, base+659A, base+659C, base+659E, base+65A2, base+65A4, base+65A6, base+65A8, base+65AA, base+65AC, base+65AE, base+65B0, base+65B2, base+65B4, base+65B6, base+65B8, base+65BA] 0AAACA move.l (A0), D2 0AAACC move.w D0, (A0) [123p+11A, 123p+11C, 123p+11E, 123p+120, 123p+122, 123p+124, 123p+126, 123p+128, 123p+12A, base+6FFE, enemy+BC, enemy+C0, enemy+C2, enemy+C4, enemy+CC, enemy+CE, enemy+D0, enemy+D2, enemy+D4, enemy+D6, enemy+D8, enemy+DA, item+86, item+88, item+8A, item+98, item+9A, item+9C, item+9E, item+A0, item+A2, item+A4, item+A6, scr1] 0AAACE move.w D0, ($2,A0) 0AAAD2 cmp.l (A0), D0 0AAAD4 bne $aaafc 0AAAD8 move.l D2, (A0)+ 0AAADA cmpa.l A0, A1 [123p+11A, 123p+11C, 123p+11E, 123p+120, 123p+122, 123p+124, 123p+126, 123p+128, 123p+12A, base+6FFE, enemy+BC, enemy+C0, enemy+C2, enemy+C4, enemy+CC, enemy+CE, enemy+D0, enemy+D2, enemy+D4, enemy+D6, enemy+D8, enemy+DA, item+86, item+88, item+8A, item+98, item+9A, item+9C, item+9E, item+A0, item+A2, item+A4, item+A6, scr1] 0AAAE6 move.l (A0), D2 0AAAE8 move.w D0, (A0) [123p+11A, 123p+11C, 123p+11E, 123p+120, 123p+122, 123p+124, 123p+126, 123p+128, 123p+12A, base+6FFE, enemy+BC, enemy+C0, enemy+C2, enemy+C4, enemy+CC, enemy+CE, enemy+D0, enemy+D2, enemy+D4, enemy+D6, enemy+D8, enemy+DA, item+86, item+88, item+8A, item+98, item+9A, item+9C, item+9E, item+A0, item+A2, item+A4, item+A6, scr1] 0AAAF4 move.l D2, (A0)+ 0AAAF6 cmpa.l A0, A1 [123p+11A, 123p+11C, 123p+11E, 123p+120, 123p+122, 123p+124, 123p+126, 123p+128, 123p+12A, base+6FFE, enemy+BC, enemy+C0, enemy+C2, enemy+C4, enemy+CC, enemy+CE, enemy+D0, enemy+D2, enemy+D4, enemy+D6, enemy+D8, enemy+DA, item+86, item+88, item+8A, item+98, item+9A, item+9C, item+9E, item+A0, item+A2, item+A4, item+A6, scr1] copyright zengfr site:http://github.com/zengfr/romhack
//============================================================================= // // OpenMesh // Copyright (C) 2003 by Computer Graphics Group, RWTH Aachen // www.openmesh.org // //----------------------------------------------------------------------------- // // License // // This library is free software; you can redistribute it and/or modify it // under the terms of the GNU Lesser General Public License as published // by the Free Software Foundation, version 2. // // This library 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 // Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // //----------------------------------------------------------------------------- // // $Revision: 1801 $ // $Date: 2008-05-19 11:53:56 +0200 (Mon, 19 May 2008) $ // //============================================================================= //============================================================================= // // CLASS TriMeshT - IMPLEMENTATION // //============================================================================= #define OPENMESH_TRIMESH_C //== INCLUDES ================================================================= #include <OpenMesh/Core/Mesh/TriMeshT.hh> #include <OpenMesh/Core/System/omstream.hh> #include <vector> //== NAMESPACES ============================================================== namespace OpenMesh { //== IMPLEMENTATION ========================================================== //============================================================================= } // namespace OpenMesh //=============================================================================
%include "include/u7bg-all-includes.asm" %include "../u7-common/patch-eop-promptToExit.asm"
segment .bss align 4 x: resb 4 segment .text align 4 global _main:function _main: align 4 xpl: push ebp mov ebp, esp sub esp, 4 push dword 0 lea eax, [ebp+-4] push eax pop ecx pop eax mov [ecx], eax push dword 4 push dword [esp] push dword $x pop ecx pop eax mov [ecx], eax add esp, 4 push dword $x pop eax push dword [eax] call printi add esp, 4 lea eax, [ebp+-4] push eax pop eax push dword [eax] pop eax leave ret extern argc extern argv extern envp extern readi extern readd extern printi extern prints extern printd extern println
// // TextEntityItem.cpp // libraries/entities/src // // Created by Brad Hefta-Gaub on 12/4/13. // Copyright 2013 High Fidelity, Inc. // // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // #include "TextEntityItem.h" #include <glm/gtx/transform.hpp> #include <QDebug> #include <ByteCountCoding.h> #include <GeometryUtil.h> #include "EntityItemProperties.h" #include "EntitiesLogging.h" #include "EntityTree.h" #include "EntityTreeElement.h" const QString TextEntityItem::DEFAULT_TEXT(""); const float TextEntityItem::DEFAULT_LINE_HEIGHT = 0.1f; const glm::u8vec3 TextEntityItem::DEFAULT_TEXT_COLOR = { 255, 255, 255 }; const float TextEntityItem::DEFAULT_TEXT_ALPHA = 1.0f; const glm::u8vec3 TextEntityItem::DEFAULT_BACKGROUND_COLOR = { 0, 0, 0}; const float TextEntityItem::DEFAULT_MARGIN = 0.0f; EntityItemPointer TextEntityItem::factory(const EntityItemID& entityID, const EntityItemProperties& properties) { EntityItemPointer entity(new TextEntityItem(entityID), [](EntityItem* ptr) { ptr->deleteLater(); }); entity->setProperties(properties); return entity; } TextEntityItem::TextEntityItem(const EntityItemID& entityItemID) : EntityItem(entityItemID) { _type = EntityTypes::Text; } void TextEntityItem::setUnscaledDimensions(const glm::vec3& value) { const float TEXT_ENTITY_ITEM_FIXED_DEPTH = 0.01f; // NOTE: Text Entities always have a "depth" of 1cm. EntityItem::setUnscaledDimensions(glm::vec3(value.x, value.y, TEXT_ENTITY_ITEM_FIXED_DEPTH)); } EntityItemProperties TextEntityItem::getProperties(const EntityPropertyFlags& desiredProperties, bool allowEmptyDesiredProperties) const { EntityItemProperties properties = EntityItem::getProperties(desiredProperties, allowEmptyDesiredProperties); // get the properties from our base class withReadLock([&] { _pulseProperties.getProperties(properties); }); COPY_ENTITY_PROPERTY_TO_PROPERTIES(billboardMode, getBillboardMode); COPY_ENTITY_PROPERTY_TO_PROPERTIES(text, getText); COPY_ENTITY_PROPERTY_TO_PROPERTIES(lineHeight, getLineHeight); COPY_ENTITY_PROPERTY_TO_PROPERTIES(textColor, getTextColor); COPY_ENTITY_PROPERTY_TO_PROPERTIES(textAlpha, getTextAlpha); COPY_ENTITY_PROPERTY_TO_PROPERTIES(backgroundColor, getBackgroundColor); COPY_ENTITY_PROPERTY_TO_PROPERTIES(backgroundAlpha, getBackgroundAlpha); COPY_ENTITY_PROPERTY_TO_PROPERTIES(leftMargin, getLeftMargin); COPY_ENTITY_PROPERTY_TO_PROPERTIES(rightMargin, getRightMargin); COPY_ENTITY_PROPERTY_TO_PROPERTIES(topMargin, getTopMargin); COPY_ENTITY_PROPERTY_TO_PROPERTIES(bottomMargin, getBottomMargin); COPY_ENTITY_PROPERTY_TO_PROPERTIES(unlit, getUnlit); return properties; } bool TextEntityItem::setProperties(const EntityItemProperties& properties) { bool somethingChanged = false; somethingChanged = EntityItem::setProperties(properties); // set the properties in our base class withWriteLock([&] { bool pulsePropertiesChanged = _pulseProperties.setProperties(properties); somethingChanged |= pulsePropertiesChanged; }); SET_ENTITY_PROPERTY_FROM_PROPERTIES(billboardMode, setBillboardMode); SET_ENTITY_PROPERTY_FROM_PROPERTIES(text, setText); SET_ENTITY_PROPERTY_FROM_PROPERTIES(lineHeight, setLineHeight); SET_ENTITY_PROPERTY_FROM_PROPERTIES(textColor, setTextColor); SET_ENTITY_PROPERTY_FROM_PROPERTIES(textAlpha, setTextAlpha); SET_ENTITY_PROPERTY_FROM_PROPERTIES(backgroundColor, setBackgroundColor); SET_ENTITY_PROPERTY_FROM_PROPERTIES(backgroundAlpha, setBackgroundAlpha); SET_ENTITY_PROPERTY_FROM_PROPERTIES(leftMargin, setLeftMargin); SET_ENTITY_PROPERTY_FROM_PROPERTIES(rightMargin, setRightMargin); SET_ENTITY_PROPERTY_FROM_PROPERTIES(topMargin, setTopMargin); SET_ENTITY_PROPERTY_FROM_PROPERTIES(bottomMargin, setBottomMargin); SET_ENTITY_PROPERTY_FROM_PROPERTIES(unlit, setUnlit); if (somethingChanged) { bool wantDebug = false; if (wantDebug) { uint64_t now = usecTimestampNow(); int elapsed = now - getLastEdited(); qCDebug(entities) << "TextEntityItem::setProperties() AFTER update... edited AGO=" << elapsed << "now=" << now << " getLastEdited()=" << getLastEdited(); } setLastEdited(properties._lastEdited); } return somethingChanged; } int TextEntityItem::readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead, ReadBitstreamToTreeParams& args, EntityPropertyFlags& propertyFlags, bool overwriteLocalData, bool& somethingChanged) { int bytesRead = 0; const unsigned char* dataAt = data; withWriteLock([&] { int bytesFromPulse = _pulseProperties.readEntitySubclassDataFromBuffer(dataAt, (bytesLeftToRead - bytesRead), args, propertyFlags, overwriteLocalData, somethingChanged); bytesRead += bytesFromPulse; dataAt += bytesFromPulse; }); READ_ENTITY_PROPERTY(PROP_BILLBOARD_MODE, BillboardMode, setBillboardMode); READ_ENTITY_PROPERTY(PROP_TEXT, QString, setText); READ_ENTITY_PROPERTY(PROP_LINE_HEIGHT, float, setLineHeight); READ_ENTITY_PROPERTY(PROP_TEXT_COLOR, glm::u8vec3, setTextColor); READ_ENTITY_PROPERTY(PROP_TEXT_ALPHA, float, setTextAlpha); READ_ENTITY_PROPERTY(PROP_BACKGROUND_COLOR, glm::u8vec3, setBackgroundColor); READ_ENTITY_PROPERTY(PROP_BACKGROUND_ALPHA, float, setBackgroundAlpha); READ_ENTITY_PROPERTY(PROP_LEFT_MARGIN, float, setLeftMargin); READ_ENTITY_PROPERTY(PROP_RIGHT_MARGIN, float, setRightMargin); READ_ENTITY_PROPERTY(PROP_TOP_MARGIN, float, setTopMargin); READ_ENTITY_PROPERTY(PROP_BOTTOM_MARGIN, float, setBottomMargin); READ_ENTITY_PROPERTY(PROP_UNLIT, bool, setUnlit); return bytesRead; } EntityPropertyFlags TextEntityItem::getEntityProperties(EncodeBitstreamParams& params) const { EntityPropertyFlags requestedProperties = EntityItem::getEntityProperties(params); requestedProperties += _pulseProperties.getEntityProperties(params); requestedProperties += PROP_BILLBOARD_MODE; requestedProperties += PROP_TEXT; requestedProperties += PROP_LINE_HEIGHT; requestedProperties += PROP_TEXT_COLOR; requestedProperties += PROP_TEXT_ALPHA; requestedProperties += PROP_BACKGROUND_COLOR; requestedProperties += PROP_BACKGROUND_ALPHA; requestedProperties += PROP_LEFT_MARGIN; requestedProperties += PROP_RIGHT_MARGIN; requestedProperties += PROP_TOP_MARGIN; requestedProperties += PROP_BOTTOM_MARGIN; requestedProperties += PROP_UNLIT; return requestedProperties; } void TextEntityItem::appendSubclassData(OctreePacketData* packetData, EncodeBitstreamParams& params, EntityTreeElementExtraEncodeDataPointer entityTreeElementExtraEncodeData, EntityPropertyFlags& requestedProperties, EntityPropertyFlags& propertyFlags, EntityPropertyFlags& propertiesDidntFit, int& propertyCount, OctreeElement::AppendState& appendState) const { bool successPropertyFits = true; withReadLock([&] { _pulseProperties.appendSubclassData(packetData, params, entityTreeElementExtraEncodeData, requestedProperties, propertyFlags, propertiesDidntFit, propertyCount, appendState); }); APPEND_ENTITY_PROPERTY(PROP_BILLBOARD_MODE, (uint32_t)getBillboardMode()); APPEND_ENTITY_PROPERTY(PROP_TEXT, getText()); APPEND_ENTITY_PROPERTY(PROP_LINE_HEIGHT, getLineHeight()); APPEND_ENTITY_PROPERTY(PROP_TEXT_COLOR, getTextColor()); APPEND_ENTITY_PROPERTY(PROP_TEXT_ALPHA, getTextAlpha()); APPEND_ENTITY_PROPERTY(PROP_BACKGROUND_COLOR, getBackgroundColor()); APPEND_ENTITY_PROPERTY(PROP_BACKGROUND_ALPHA, getBackgroundAlpha()); APPEND_ENTITY_PROPERTY(PROP_LEFT_MARGIN, getLeftMargin()); APPEND_ENTITY_PROPERTY(PROP_RIGHT_MARGIN, getRightMargin()); APPEND_ENTITY_PROPERTY(PROP_TOP_MARGIN, getTopMargin()); APPEND_ENTITY_PROPERTY(PROP_BOTTOM_MARGIN, getBottomMargin()); APPEND_ENTITY_PROPERTY(PROP_UNLIT, getUnlit()); } glm::vec3 TextEntityItem::getRaycastDimensions() const { glm::vec3 dimensions = getScaledDimensions(); if (getBillboardMode() != BillboardMode::NONE) { float max = glm::max(dimensions.x, glm::max(dimensions.y, dimensions.z)); const float SQRT_2 = 1.41421356237f; return glm::vec3(SQRT_2 * max); } return dimensions; } bool TextEntityItem::findDetailedRayIntersection(const glm::vec3& origin, const glm::vec3& direction, OctreeElementPointer& element, float& distance, BoxFace& face, glm::vec3& surfaceNormal, QVariantMap& extraInfo, bool precisionPicking) const { glm::vec3 dimensions = getScaledDimensions(); glm::vec2 xyDimensions(dimensions.x, dimensions.y); glm::quat rotation = getWorldOrientation(); glm::vec3 position = getWorldPosition() + rotation * (dimensions * (ENTITY_ITEM_DEFAULT_REGISTRATION_POINT - getRegistrationPoint())); rotation = EntityItem::getBillboardRotation(position, rotation, _billboardMode, EntityItem::getPrimaryViewFrustumPosition()); if (findRayRectangleIntersection(origin, direction, rotation, position, xyDimensions, distance)) { glm::vec3 forward = rotation * Vectors::FRONT; if (glm::dot(forward, direction) > 0.0f) { face = MAX_Z_FACE; surfaceNormal = -forward; } else { face = MIN_Z_FACE; surfaceNormal = forward; } return true; } return false; } bool TextEntityItem::findDetailedParabolaIntersection(const glm::vec3& origin, const glm::vec3& velocity, const glm::vec3& acceleration, OctreeElementPointer& element, float& parabolicDistance, BoxFace& face, glm::vec3& surfaceNormal, QVariantMap& extraInfo, bool precisionPicking) const { glm::vec3 dimensions = getScaledDimensions(); glm::vec2 xyDimensions(dimensions.x, dimensions.y); glm::quat rotation = getWorldOrientation(); glm::vec3 position = getWorldPosition() + rotation * (dimensions * (ENTITY_ITEM_DEFAULT_REGISTRATION_POINT - getRegistrationPoint())); glm::quat inverseRot = glm::inverse(rotation); glm::vec3 localOrigin = inverseRot * (origin - position); glm::vec3 localVelocity = inverseRot * velocity; glm::vec3 localAcceleration = inverseRot * acceleration; if (findParabolaRectangleIntersection(localOrigin, localVelocity, localAcceleration, xyDimensions, parabolicDistance)) { float localIntersectionVelocityZ = localVelocity.z + localAcceleration.z * parabolicDistance; glm::vec3 forward = rotation * Vectors::FRONT; if (localIntersectionVelocityZ > 0.0f) { face = MIN_Z_FACE; surfaceNormal = forward; } else { face = MAX_Z_FACE; surfaceNormal = -forward; } return true; } return false; } void TextEntityItem::setText(const QString& value) { withWriteLock([&] { _text = value; }); } QString TextEntityItem::getText() const { QString result; withReadLock([&] { result = _text; }); return result; } void TextEntityItem::setLineHeight(float value) { withWriteLock([&] { _lineHeight = value; }); } float TextEntityItem::getLineHeight() const { float result; withReadLock([&] { result = _lineHeight; }); return result; } void TextEntityItem::setTextColor(const glm::u8vec3& value) { withWriteLock([&] { _textColor = value; }); } glm::u8vec3 TextEntityItem::getTextColor() const { return resultWithReadLock<glm::u8vec3>([&] { return _textColor; }); } void TextEntityItem::setTextAlpha(float value) { withWriteLock([&] { _textAlpha = value; }); } float TextEntityItem::getTextAlpha() const { return resultWithReadLock<float>([&] { return _textAlpha; }); } void TextEntityItem::setBackgroundColor(const glm::u8vec3& value) { withWriteLock([&] { _backgroundColor = value; }); } glm::u8vec3 TextEntityItem::getBackgroundColor() const { return resultWithReadLock<glm::u8vec3>([&] { return _backgroundColor; }); } void TextEntityItem::setBackgroundAlpha(float value) { withWriteLock([&] { _backgroundAlpha = value; }); } float TextEntityItem::getBackgroundAlpha() const { return resultWithReadLock<float>([&] { return _backgroundAlpha; }); } BillboardMode TextEntityItem::getBillboardMode() const { BillboardMode result; withReadLock([&] { result = _billboardMode; }); return result; } void TextEntityItem::setBillboardMode(BillboardMode value) { withWriteLock([&] { _billboardMode = value; }); } void TextEntityItem::setLeftMargin(float value) { withWriteLock([&] { _leftMargin = value; }); } float TextEntityItem::getLeftMargin() const { return resultWithReadLock<float>([&] { return _leftMargin; }); } void TextEntityItem::setRightMargin(float value) { withWriteLock([&] { _rightMargin = value; }); } float TextEntityItem::getRightMargin() const { return resultWithReadLock<float>([&] { return _rightMargin; }); } void TextEntityItem::setTopMargin(float value) { withWriteLock([&] { _topMargin = value; }); } float TextEntityItem::getTopMargin() const { return resultWithReadLock<float>([&] { return _topMargin; }); } void TextEntityItem::setBottomMargin(float value) { withWriteLock([&] { _bottomMargin = value; }); } float TextEntityItem::getBottomMargin() const { return resultWithReadLock<float>([&] { return _bottomMargin; }); } void TextEntityItem::setUnlit(bool value) { withWriteLock([&] { _unlit = value; }); } bool TextEntityItem::getUnlit() const { return resultWithReadLock<bool>([&] { return _unlit; }); } PulsePropertyGroup TextEntityItem::getPulseProperties() const { return resultWithReadLock<PulsePropertyGroup>([&] { return _pulseProperties; }); }
; A307912: a(n) = n - 1 - pi(2*n-1) + pi(n), where pi is the prime counting function. ; 0,0,1,1,3,3,4,5,5,5,7,7,9,10,10,10,12,13,14,15,15,15,17,17,18,19,19,20,22,22,23,24,25,25,26,26,27,28,29,29,31,31,33,34,34,35,37,38,38,39,39,39,41,41,41,42,42,43,45,46,48,49,50,50,51,51,53,54 mov $2,$0 mov $4,$0 lpb $2 sub $2,1 add $4,1 add $3,$4 seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0. sub $0,$3 lpe
// Autogenerated from CppHeaderCreator // Created by Sc2ad // ========================================================================= #pragma once // Begin includes #include "extern/beatsaber-hook/shared/utils/typedefs.h" #include "extern/beatsaber-hook/shared/utils/byref.hpp" // Including type: MasterServer.BaseMasterServerMultipartMessage #include "MasterServer/BaseMasterServerMultipartMessage.hpp" // Including type: MasterServer.IDedicatedServerMessage #include "MasterServer/IDedicatedServerMessage.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils-methods.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils-properties.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils-fields.hpp" #include "extern/beatsaber-hook/shared/utils/utils.h" // Completed includes // Begin forward declares // Forward declaring namespace: GlobalNamespace namespace GlobalNamespace { // Forward declaring type: PacketPool`1<T> template<typename T> class PacketPool_1; } // Completed forward declares // Type namespace: MasterServer namespace MasterServer { // Forward declaring type: DedicatedServerMultipartMessage class DedicatedServerMultipartMessage; } #include "extern/beatsaber-hook/shared/utils/il2cpp-type-check.hpp" NEED_NO_BOX(MasterServer::DedicatedServerMultipartMessage); DEFINE_IL2CPP_ARG_TYPE(MasterServer::DedicatedServerMultipartMessage*, "MasterServer", "DedicatedServerMultipartMessage"); // Type namespace: MasterServer namespace MasterServer { // Size: 0x30 #pragma pack(push, 1) // Autogenerated type: MasterServer.DedicatedServerMultipartMessage // [TokenAttribute] Offset: FFFFFFFF class DedicatedServerMultipartMessage : public MasterServer::BaseMasterServerMultipartMessage/*, public MasterServer::IDedicatedServerMessage*/ { public: // Creating interface conversion operator: operator MasterServer::IDedicatedServerMessage operator MasterServer::IDedicatedServerMessage() noexcept { return *reinterpret_cast<MasterServer::IDedicatedServerMessage*>(this); } // static public PacketPool`1<MasterServer.DedicatedServerMultipartMessage> get_pool() // Offset: 0x12ECDC4 static GlobalNamespace::PacketPool_1<MasterServer::DedicatedServerMultipartMessage*>* get_pool(); // public System.Void .ctor() // Offset: 0x12ECE68 // Implemented from: MasterServer.BaseMasterServerMultipartMessage // Base method: System.Void BaseMasterServerMultipartMessage::.ctor() // Base method: System.Void BaseMasterServerReliableRequest::.ctor() // Base method: System.Void Object::.ctor() template<::il2cpp_utils::CreationType creationType = ::il2cpp_utils::CreationType::Temporary> static DedicatedServerMultipartMessage* New_ctor() { static auto ___internal__logger = ::Logger::get().WithContext("MasterServer::DedicatedServerMultipartMessage::.ctor"); return THROW_UNLESS((::il2cpp_utils::New<DedicatedServerMultipartMessage*, creationType>())); } // public override System.Void Release() // Offset: 0x12ECE0C // Implemented from: BaseMasterServerReliableRequest // Base method: System.Void BaseMasterServerReliableRequest::Release() void Release(); }; // MasterServer.DedicatedServerMultipartMessage #pragma pack(pop) } #include "extern/beatsaber-hook/shared/utils/il2cpp-utils-methods.hpp" // Writing MetadataGetter for method: MasterServer::DedicatedServerMultipartMessage::get_pool // Il2CppName: get_pool template<> struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<GlobalNamespace::PacketPool_1<MasterServer::DedicatedServerMultipartMessage*>* (*)()>(&MasterServer::DedicatedServerMultipartMessage::get_pool)> { static const MethodInfo* get() { return ::il2cpp_utils::FindMethod(classof(MasterServer::DedicatedServerMultipartMessage*), "get_pool", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{}); } }; // Writing MetadataGetter for method: MasterServer::DedicatedServerMultipartMessage::New_ctor // Il2CppName: .ctor // Cannot get method pointer of value based method overload from template for constructor! // Try using FindMethod instead! // Writing MetadataGetter for method: MasterServer::DedicatedServerMultipartMessage::Release // Il2CppName: Release template<> struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<void (MasterServer::DedicatedServerMultipartMessage::*)()>(&MasterServer::DedicatedServerMultipartMessage::Release)> { static const MethodInfo* get() { return ::il2cpp_utils::FindMethod(classof(MasterServer::DedicatedServerMultipartMessage*), "Release", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{}); } };
/* * Copyright (c) 2017-2019 THL A29 Limited, a Tencent company. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include <tencentcloud/bm/v20180423/model/ModifyDeviceAutoRenewFlagRequest.h> #include <tencentcloud/core/utils/rapidjson/document.h> #include <tencentcloud/core/utils/rapidjson/writer.h> #include <tencentcloud/core/utils/rapidjson/stringbuffer.h> using namespace TencentCloud::Bm::V20180423::Model; using namespace std; ModifyDeviceAutoRenewFlagRequest::ModifyDeviceAutoRenewFlagRequest() : m_autoRenewFlagHasBeenSet(false), m_instanceIdsHasBeenSet(false) { } string ModifyDeviceAutoRenewFlagRequest::ToJsonString() const { rapidjson::Document d; d.SetObject(); rapidjson::Document::AllocatorType& allocator = d.GetAllocator(); if (m_autoRenewFlagHasBeenSet) { rapidjson::Value iKey(rapidjson::kStringType); string key = "AutoRenewFlag"; iKey.SetString(key.c_str(), allocator); d.AddMember(iKey, m_autoRenewFlag, allocator); } if (m_instanceIdsHasBeenSet) { rapidjson::Value iKey(rapidjson::kStringType); string key = "InstanceIds"; iKey.SetString(key.c_str(), allocator); d.AddMember(iKey, rapidjson::Value(rapidjson::kArrayType).Move(), allocator); for (auto itr = m_instanceIds.begin(); itr != m_instanceIds.end(); ++itr) { d[key.c_str()].PushBack(rapidjson::Value().SetString((*itr).c_str(), allocator), allocator); } } rapidjson::StringBuffer buffer; rapidjson::Writer<rapidjson::StringBuffer> writer(buffer); d.Accept(writer); return buffer.GetString(); } uint64_t ModifyDeviceAutoRenewFlagRequest::GetAutoRenewFlag() const { return m_autoRenewFlag; } void ModifyDeviceAutoRenewFlagRequest::SetAutoRenewFlag(const uint64_t& _autoRenewFlag) { m_autoRenewFlag = _autoRenewFlag; m_autoRenewFlagHasBeenSet = true; } bool ModifyDeviceAutoRenewFlagRequest::AutoRenewFlagHasBeenSet() const { return m_autoRenewFlagHasBeenSet; } vector<string> ModifyDeviceAutoRenewFlagRequest::GetInstanceIds() const { return m_instanceIds; } void ModifyDeviceAutoRenewFlagRequest::SetInstanceIds(const vector<string>& _instanceIds) { m_instanceIds = _instanceIds; m_instanceIdsHasBeenSet = true; } bool ModifyDeviceAutoRenewFlagRequest::InstanceIdsHasBeenSet() const { return m_instanceIdsHasBeenSet; }
/* * Copyright (c) 2016-2020 ARM Limited. * * SPDX-License-Identifier: MIT * * 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 "arm_compute/runtime/NEON/functions/NEColorConvert.h" #include "arm_compute/core/NEON/kernels/NEColorConvertKernel.h" #include "support/MemorySupport.h" #include <utility> using namespace arm_compute; void NEColorConvert::configure(const ITensor *input, ITensor *output) { auto k = arm_compute::support::cpp14::make_unique<NEColorConvertKernel>(); k->configure(input, output); _kernel = std::move(k); } void NEColorConvert::configure(const IMultiImage *input, IImage *output) { auto k = arm_compute::support::cpp14::make_unique<NEColorConvertKernel>(); k->configure(input, output); _kernel = std::move(k); } void NEColorConvert::configure(const IImage *input, IMultiImage *output) { auto k = arm_compute::support::cpp14::make_unique<NEColorConvertKernel>(); k->configure(input, output); _kernel = std::move(k); } void NEColorConvert::configure(const IMultiImage *input, IMultiImage *output) { auto k = arm_compute::support::cpp14::make_unique<NEColorConvertKernel>(); k->configure(input, output); _kernel = std::move(k); }
; A291386: a(n) = (1/3)*A099432(n+1). ; Submitted by Christian Krause ; 2,11,54,252,1134,4977,21438,91017,381996,1588248,6552252,26853687,109438938,443837799,1792373346,7211142612,28915704810,115603540605,460942202070,1833459620517,7276826042712,28823185892016,113957884236024,449793742386627,1772580021170994,6975448310589507,27413041478940558,107597319879317292,421833505057932006,1651995289293404553,6463002089448455022,25260647698853884737,98642463171975273348,384870840721577154504,1500438977429131086516,5845111176024815172687,22753892822325331535370 add $0,1 seq $0,99432 ; Convolution of A030195(n) (generalized (3,3)-Fibonacci) with itself. div $0,3
#include <iostream> #include <opencv2/opencv.hpp> using namespace cv; using namespace std; int main(int argc, char** argv){ Mat image; if (argc < 5) { cout << "Quatro argumentos numéricos são necessários" << endl; return 0; } int ax = atoi(argv[1]); int ay = atoi(argv[2]); int bx = atoi(argv[3]); int by = atoi(argv[4]); image = imread("media/biel.png",CV_LOAD_IMAGE_GRAYSCALE); if(!image.data) cout << "nao abriu biel.png" << endl; namedWindow("janela",WINDOW_AUTOSIZE); if (ax > 0 && ay > 0 && bx < image.rows && by < image.cols){ for(int i=ax;i<bx;i++){ for(int j=ay;j<by;j++){ image.at<uchar>(i,j)= 255 - image.at<uchar>(i,j); } } } else{ cout << "Argumentos devem ser de pontos dentro da imagem"; } imshow("janela", image); waitKey(); return 0; }
# Christian Suleiman # GCD Recursive li $a0, 44 #load values into registers li $a1, 8 li $a2, 0 # hold the result/temp sub $sp,$sp,16 # creating space on stack for 4 4-bytes of data (return address, a, b, res) sw $ra,0($sp) #storing values in registers into newly created space on stack sw $a0,4($sp) sw $a1,8($sp) sw $a2,12($sp) jal gcd #call gcd function sw $t0,12($sp) # save return address j EXIT gcd: # a0 and a1 are the two integer parameters, assuming a0 > a1 and a0, a1 > 0 sub $sp,$sp,12 sw $ra,0($sp) sw $a0,4($sp) sw $a1,8($sp) move $t0, $a0 move $t1, $a1 #loop: beq $t1, $0, done #if second arg(a0 % a1) is 0 we are finished div $t0, $t1 #divide our operands . . . Quotient gets sent to LO and remainder gets sent to HI move $t0, $t1 # a = b in euclid's algorithm mfhi $t1 # b = remainder move $a1,$t1 move $a0,$t0 jal gcd #return to start of loop done: #essentially a loop of returning to the return address once solution is met lw $ra,0($sp) # loading top of stack pointer into $ra addi $sp,$sp,12 # deallocating space we used to store local variables jr $ra EXIT:
// Copyright (c) 2009-2017 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #if defined(HAVE_CONFIG_H) #include "config/ksoc-config.h" #endif #include <cstring> #if HAVE_DECL_STRNLEN == 0 size_t strnlen( const char *start, size_t max_len) { const char *end = (const char *)memchr(start, '\0', max_len); return end ? (size_t)(end - start) : max_len; } #endif // HAVE_DECL_STRNLEN
; A337843: a(n) is n + the number of digits in the decimal expansion of n. ; 1,2,3,4,5,6,7,8,9,10,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69 add $0,1 mov $1,$0 log $1,11 add $1,$0
INCLUDE "graphics/grafix.inc" EXTERN pixeladdress EXTERN __gfx_coords ; Generic code to handle the pixel commands ; Define NEEDxxx before including IF maxx <> 256 ld a,h cp maxx ret nc ENDIF ld a,l cp maxy ret nc ld (__gfx_coords),hl push bc ;Save callers value call pixeladdress ;hl = address, a = pixel number ld b,a ld a,1 jr z, rotated ; pixel is at bit 0... .plot_position rlca djnz plot_position ; a = byte holding pixel mask ; hl = address rotated: IF NEEDunplot cpl ENDIF ld e,a ;Save pixel mask ld c,1 ld b,@00000001 ld a,c out ($f1),a ld a,b out ($f2),a IF NEEDplot ld a,(hl) or e ld (hl),a inc c sla b ld a,c out ($f1),a ld a,b out ($f2),a ld a,(hl) or e ld (hl),a inc c sla b ld a,c out ($f1),a ld a,b out ($f2),a ld a,(hl) or e ld (hl),a ENDIF IF NEEDunplot ld a,(hl) and e ld (hl),a inc c sla b ld a,c out ($f1),a ld a,b out ($f2),a ld a,(hl) and e ld (hl),a inc c sla b ld a,c out ($f1),a ld a,b out ($f2),a ld a,(hl) and e ld (hl),a ENDIF IF NEEDxor ld a,(hl) xor e ld (hl),a inc c sla b ld a,c out ($f1),a ld a,b out ($f2),a ld a,(hl) xor e ld (hl),a inc c sla b ld a,c out ($f1),a ld a,b out ($f2),a ld a,(hl) xor e ld (hl),a xor l out (c),a ENDIF IF NEEDpoint ld a,(hl) and e jr z,got_point inc c sla b ld a,c out ($f1),a ld a,b out ($f2),a ld a,(hl) and e jr z,got_point inc c sla b ld a,c out ($f1),a ld a,b out ($f2),a ld a,(hl) and e got_point: ENDIF pop bc ;Restore callers ret
/* +----------------------------------------------------------------------+ | HipHop for PHP | +----------------------------------------------------------------------+ | Copyright (c) 2010-present Facebook, Inc. (http://www.facebook.com) | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ */ #include "hphp/runtime/vm/jit/irlower-internal.h" #include "hphp/runtime/base/datatype.h" #include "hphp/runtime/base/memory-manager.h" #include "hphp/runtime/base/runtime-option.h" #include "hphp/runtime/base/typed-value.h" #include "hphp/runtime/vm/act-rec.h" #include "hphp/runtime/vm/bytecode.h" #include "hphp/runtime/vm/func.h" #include "hphp/runtime/vm/resumable.h" #include "hphp/runtime/vm/jit/types.h" #include "hphp/runtime/vm/jit/abi.h" #include "hphp/runtime/vm/jit/arg-group.h" #include "hphp/runtime/vm/jit/bc-marker.h" #include "hphp/runtime/vm/jit/call-spec.h" #include "hphp/runtime/vm/jit/code-gen-cf.h" #include "hphp/runtime/vm/jit/code-gen-helpers.h" #include "hphp/runtime/vm/jit/extra-data.h" #include "hphp/runtime/vm/jit/fixup.h" #include "hphp/runtime/vm/jit/ir-instruction.h" #include "hphp/runtime/vm/jit/ir-opcode.h" #include "hphp/runtime/vm/jit/ssa-tmp.h" #include "hphp/runtime/vm/jit/tc.h" #include "hphp/runtime/vm/jit/target-profile.h" #include "hphp/runtime/vm/jit/translator-inline.h" #include "hphp/runtime/vm/jit/type.h" #include "hphp/runtime/vm/jit/unique-stubs.h" #include "hphp/runtime/vm/jit/vasm-gen.h" #include "hphp/runtime/vm/jit/vasm-instr.h" #include "hphp/runtime/vm/jit/vasm-reg.h" #include "hphp/util/trace.h" #include <folly/Optional.h> namespace HPHP { namespace jit { namespace irlower { TRACE_SET_MOD(irlower); /////////////////////////////////////////////////////////////////////////////// namespace { /////////////////////////////////////////////////////////////////////////////// template<class ExtraData> Vreg adjustSPForReturn(IRLS& env, const IRInstruction* inst) { auto const sp = srcLoc(env, inst, 0).reg(); auto const adjust = inst->extra<ExtraData>()->offset.offset; auto& v = vmain(env); auto const sync_sp = v.makeReg(); v << lea{sp[cellsToBytes(adjust)], sync_sp}; v << syncvmsp{sync_sp}; return sync_sp; } /* * Take the return value, given in `retVal' and `retLoc', and pack it into the * ABI-specified return registers. */ void prepare_return_regs(Vout& v, SSATmp* retVal, Vloc retLoc, const AuxUnion& aux) { using u_data_type = std::make_unsigned<data_type_t>::type; auto const tp = [&] { auto const mask = [&] { if (!aux.u_raw) return uint64_t{}; if (aux.u_raw == static_cast<uint32_t>(-1)) { return static_cast<uint64_t>(-1) << std::numeric_limits<u_data_type>::digits; } return uint64_t{aux.u_raw} << 32; }(); if (!retLoc.hasReg(1)) { auto const dt = static_cast<u_data_type>(retVal->type().toDataType()); static_assert(std::numeric_limits<u_data_type>::digits <= 32, ""); return v.cns(dt | mask); } auto const type = retLoc.reg(1); auto const extended = v.makeReg(); auto const result = v.makeReg(); // DataType is signed. We're using movzbq here to clear out the upper 7 // bytes of the register, not to actually extend the type value. v << movzbq{type, extended}; v << orq{extended, v.cns(mask), result, v.makeReg()}; return result; }(); auto const data = zeroExtendIfBool(v, retVal->type(), retLoc.reg(0)); v << syncvmret{data, tp}; } void asyncFuncRetImpl(IRLS& env, const IRInstruction* inst, TCA target) { auto const ret = inst->src(2); auto const retLoc = srcLoc(env, inst, 2); auto& v = vmain(env); adjustSPForReturn<IRSPRelOffsetData>(env, inst); // The asyncFuncRet{,Slow} stubs take the return TV as its arguments. copyTV(v, rarg(0), rarg(1), retLoc, ret); auto args = vm_regs_with_sp() | rarg(1); if (!ret->isA(TNull)) args |= rarg(0); v << jmpi{target, args}; } /////////////////////////////////////////////////////////////////////////////// } /////////////////////////////////////////////////////////////////////////////// void traceRet(ActRec* fp, TypedValue* sp, void* rip) { if (rip == tc::ustubs().callToExit) return; checkFrame(fp, sp, false /* fullCheck */); assertx(sp <= (TypedValue*)fp || isResumed(fp)); } void cgRetCtrl(IRLS& env, const IRInstruction* inst) { auto const fp = srcLoc(env, inst, 1).reg(); auto const sync_sp = adjustSPForReturn<RetCtrlData>(env, inst); auto& v = vmain(env); if (RuntimeOption::EvalHHIRGenerateAsserts) { auto rip = v.makeReg(); auto prev_fp = v.makeReg(); v << load{fp[AROFF(m_savedRip)], rip}; v << load{fp[AROFF(m_sfp)], prev_fp}; v << vcall{ CallSpec::direct(traceRet), v.makeVcallArgs({{prev_fp, sync_sp, rip}}), v.makeTuple({}), Fixup::none() }; } prepare_return_regs(v, inst->src(2), srcLoc(env, inst, 2), inst->extra<RetCtrl>()->aux); v << phpret{fp, php_return_regs()}; } void cgAsyncFuncRet(IRLS& env, const IRInstruction* inst) { asyncFuncRetImpl(env, inst, tc::ustubs().asyncFuncRet); } void cgAsyncFuncRetSlow(IRLS& env, const IRInstruction* inst) { asyncFuncRetImpl(env, inst, tc::ustubs().asyncFuncRetSlow); } void cgAsyncSwitchFast(IRLS& env, const IRInstruction* inst) { auto& v = vmain(env); adjustSPForReturn<IRSPRelOffsetData>(env, inst); v << jmpi{tc::ustubs().asyncSwitchCtrl, vm_regs_with_sp()}; } /////////////////////////////////////////////////////////////////////////////// void cgLdRetVal(IRLS& env, const IRInstruction* inst) { auto const fp = srcLoc(env, inst, 0).reg(); auto& v = vmain(env); loadTV(v, inst->dst(), dstLoc(env, inst, 0), fp[kArRetOff]); } void cgDbgTrashRetVal(IRLS& env, const IRInstruction* inst) { auto& v = vmain(env); trashFullTV(v, srcLoc(env, inst, 0).reg()[kArRetOff], kTVTrashJITRetVal); } /////////////////////////////////////////////////////////////////////////////// void cgGenericRetDecRefs(IRLS& env, const IRInstruction* inst) { auto const fp = srcLoc(env, inst, 0).reg(); auto const& marker = inst->marker(); auto const numLocals = marker.func()->numLocals(); auto& v = vmain(env); // TODO: assert that fp is the same value stored in rvmfp here. if (numLocals == 0) return; auto const target = numLocals > kNumFreeLocalsHelpers ? tc::ustubs().freeManyLocalsHelper : tc::ustubs().freeLocalsHelpers[numLocals - 1]; auto const startType = v.makeReg(); auto const startData = v.makeReg(); v << lea{ptrToLocalType(fp, numLocals - 1), startType}; v << lea{ptrToLocalData(fp, numLocals - 1), startData}; auto const fixupBcOff = marker.bcOff() - marker.func()->base(); auto const fix = Fixup::direct(fixupBcOff, marker.spOff()); // The stub uses arg reg 0 as scratch and to pass arguments to // destructors, so it expects the starting pointers in arg reg 1 and // 2. auto const args = v.makeVcallArgs({{v.cns(Vconst::Quad), startType, startData}}); v << vcall{CallSpec::stub(target), args, v.makeTuple({}), fix, DestType::None, false}; } /////////////////////////////////////////////////////////////////////////////// }}}
; A068346: a(n) = n'' = second arithmetic derivative of n. ; 0,0,0,0,4,0,1,0,16,5,1,0,32,0,6,12,80,0,10,0,44,7,1,0,48,7,8,27,80,0,1,0,176,9,1,16,92,0,10,32,72,0,1,0,112,16,10,0,240,9,39,24,92,0,108,32,96,13,1,0,96,0,14,20,640,21,1,0,156,15,1,0,220,0,16,16,176,21,1,0,368,216,1,0,128,13,39,80,188,0,44,24,272,19,14,44,560,0,18,55 seq $0,3415 ; a(n) = n' = arithmetic derivative of n: a(0) = a(1) = 0, a(prime) = 1, a(mn) = m*a(n) + n*a(m). seq $0,3415 ; a(n) = n' = arithmetic derivative of n: a(0) = a(1) = 0, a(prime) = 1, a(mn) = m*a(n) + n*a(m).
/* * Copyright (c) 2013 ARM Limited * All rights reserved * * The license below extends only to copyright in the software and shall * not be construed as granting a license to any other intellectual * property including but not limited to intellectual property relating * to a hardware implementation of the functionality of the software * licensed hereunder. You may use the software subject to the license * terms below provided that you ensure that this notice is replicated * unmodified and in its entirety in all distributions of the software, * modified or unmodified, in source code or in binary form. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer; * 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; * neither the name of the copyright holders nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * Authors: Matt Horsnell */ /** * @file This file initializes a simple trace unit which listens to * a probe point in the fetch and commit stage of the O3 pipeline * and simply outputs those events as a dissassembled instruction stream * to the trace output. */ #ifndef __CPU_O3_PROBE_SIMPLE_TRACE_HH__ #define __CPU_O3_PROBE_SIMPLE_TRACE_HH__ #include "cpu/o3/dyn_inst.hh" #include "cpu/o3/impl.hh" #include "cpu/static_inst_fwd.hh" #include "params/SimpleTrace.hh" #include "sim/probe/probe.hh" class SimpleTrace : public ProbeListenerObject { public: SimpleTrace(const SimpleTraceParams *params): ProbeListenerObject(params) { } /** Register the probe listeners. */ void regProbeListeners(); /** Returns the name of the trace. */ const std::string name() const { return ProbeListenerObject::name() + ".trace"; } private: void traceFetch(const O3CPUImpl::DynInstPtr &dynInst); void traceCommit(const O3CPUImpl::DynInstPtr &dynInst); void traceMispredict(const O3CPUImpl::DynInstPtr &dynInst); #if 0 void traceCyclesO3(const O3CPUImpl::DynInstPtr &inst); #endif void traceRetiredInstsO3(const O3CPUImpl::DynInstPtr &inst); void traceRetiredLoadsO3(const O3CPUImpl::DynInstPtr &inst); void traceRetiredStoresO3(const O3CPUImpl::DynInstPtr &inst); void traceRetiredBranchesO3(const O3CPUImpl::DynInstPtr &inst); }; #endif//__CPU_O3_PROBE_SIMPLE_TRACE_HH__
.P816 .ORG $4000 S1: SEI SEP #$30 SEC XCE S2: LDA #'a' loop: CLC XCE REP #$30 CLI JSL $E063 SEI SEP #$30 SEC XCE CLC ADC #1 CMP #'z'+1 BNE loop CLC XCE REP #$30 done: JML $E066 RTL
/* This lib is a tls client for FISCO BCOS2.0 (https://github.com/FISCO-BCOS/) This lib is free software: you can redistribute it and/or modify it under the terms of the MIT License as published by the Free Software Foundation. This project 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. @author: kentzhang @date: 2021-03 */ #include <stdlib.h> #include "tassl_sock_wrap.h" #include "native_tassl_sock_wrap.h" using namespace fisco_tassl_sock_wrap; //将tassl_sock_wrap.cpp里的TasslSockWrap类,桥接为native c代码接口 //基本逻辑就是new一个TasslSockWrap对象,把指针返回给上层,后续拿这个指针调用接口 //在mingw编译时,如果有namespace,则输出的def符号带上了其他特殊符号,所以不用namespace //using namespace native_fisco_tassl_sock_wrap; void * ssock_create(){ TasslSockWrap *pssock = new TasslSockWrap(); //printf("pssock create 0x%x\n",pssock); return (void *)pssock; } void ssock_release(void * p_void_ssock){ TasslSockWrap *pssock = (TasslSockWrap *)p_void_ssock; if(pssock==NULL){return;} pssock->finish(); delete pssock; } int ssock_init( void * p_void_ssock, const char *ca_crt_file_, const char * sign_crt_file_, const char * sign_key_file_, const char * en_crt_file_, const char * en_key_file_ ){ TasslSockWrap *pssock = (TasslSockWrap *)p_void_ssock; //printf("ssock_init pssock 0x%x\n",pssock); //printf("ssock_init pssock ca %s\n",ca_crt_file_); //printf("ssock_init pssock sign_crt %s\n",sign_crt_file_); //printf("ssock_init pssock sign_key_file_ %s\n",sign_key_file_); if(pssock==NULL){return -1;} return pssock->init(ca_crt_file_, sign_crt_file_, sign_key_file_, en_crt_file_, en_key_file_); } int ssock_try_connect(void * p_void_ssock,const char *host_,const int port_){ TasslSockWrap *pssock = (TasslSockWrap *)p_void_ssock; if(pssock==NULL){return -1;} return pssock->try_connect(host_,port_); } int ssock_finish(void * p_void_ssock){ TasslSockWrap *pssock = (TasslSockWrap *)p_void_ssock; if(pssock==NULL){return -1;} return pssock->finish(); } void ssock_set_echo_mode(void * p_void_ssock,int mode){ TasslSockWrap *pssock = (TasslSockWrap *)p_void_ssock; //printf("set echo mode ,pssock is 0x%x\n",pssock); if(pssock==NULL){return;} return pssock->set_echo_mode(mode); } int ssock_send(void * p_void_ssock,const char * buffer,const int len){ TasslSockWrap *pssock = (TasslSockWrap *)p_void_ssock; if(pssock==NULL){return -1;} return pssock->send(buffer,len); } int ssock_recv(void * p_void_ssock,char *buffer,const int buffersize){ TasslSockWrap *pssock = (TasslSockWrap *)p_void_ssock; if(pssock==NULL){return -1;} int retval = pssock->recv(buffer,buffersize); /*for(int i=0;i<retval;i++) { printf("%x",buffer[i]); } printf("\n"); fflush(stdout); */ return retval; }
#include "TriangleCounter.h" #include <cassert> #include <iostream> using namespace std; unsigned long long edge_to_id(const int u, const int v) { assert(MAX_NUM_NODES > u); assert(MAX_NUM_NODES > v); assert(u!=v); int n_u = (u<v ? u : v); int n_v = (u<v ? v : u); unsigned long long ret = static_cast<unsigned long long>(MAX_NUM_NODES) * static_cast<unsigned long long>(n_u) + static_cast<unsigned long long>(n_v); assert(ret); return ret; } TriangleCounter::TriangleCounter(bool local) : local_(local), triangles_(0), edges_present_original_(0), triangles_weight_(0.0) { } TriangleCounter::~TriangleCounter() { } bool TriangleCounter::add_edge_sample(const int u, const int v){ assert(u!=v); set_edge_ids_.insert(edge_to_id(u,v)); bool succeed = graph_.add_edge(u,v); //if (! succeed){ // cerr<<"NOT SUCCED ADD: "<<u<< " "<<v<<endl; //} //assert(succeed); // edge update need to be distinct return succeed; } bool TriangleCounter::remove_edge_sample(const int u, const int v){ assert(u!=v); set_edge_ids_.erase(edge_to_id(u,v)); return graph_.remove_edge(u,v); } void TriangleCounter::add_triangles(const int u, const int v, double weight){ assert(u!=v); int min_deg_n = (graph_.degree(u) <= graph_.degree(v) ? u : v); int max_deg_n = (graph_.degree(u) <= graph_.degree(v) ? v : u); vector<int> min_neighbors; graph_.neighbors(min_deg_n, & min_neighbors); for(const auto& n : min_neighbors){ if(n!= max_deg_n){ if(set_edge_ids_.find(edge_to_id(n, max_deg_n)) != set_edge_ids_.end()){ double weight_to_use = 0.0; if(edge_weight_.empty()){ // easy case used by most algorithms weight_to_use = weight; } else { // each triangle is weighted by the product of the weights of the edges assert(weight = 1.0); //not used in this case assert(edge_weight_[make_pair(u,v)]>0); assert(edge_weight_[make_pair(u,n)]>0); assert(edge_weight_[make_pair(v,n)]>0); weight_to_use = edge_weight_.at(make_pair(u,v))*edge_weight_.at(make_pair(n,v))*edge_weight_.at(make_pair(u,n)); } triangles_weight_ += weight_to_use; triangles_ += 1; if(local_){ triangles_local_map_[u]++; triangles_local_map_[v]++; triangles_local_map_[n]++; triangles_weight_local_map_[u]+=weight_to_use; triangles_weight_local_map_[v]+=weight_to_use; triangles_weight_local_map_[n]+=weight_to_use; } } } } } void TriangleCounter::remove_triangles(const int u, const int v, double weight){ assert(u!=v); int min_deg_n = (graph_.degree(u) <= graph_.degree(v) ? u : v); int max_deg_n = (graph_.degree(u) <= graph_.degree(v) ? v : u); vector<int> min_neighbors; graph_.neighbors(min_deg_n, & min_neighbors); for(const auto& n : min_neighbors){ if(n!= max_deg_n){ if(set_edge_ids_.find(edge_to_id(n, max_deg_n)) != set_edge_ids_.end()){ double weight_to_use = 0.0; if(edge_weight_.empty()){ // easy case used by most algorithms weight_to_use = weight; } else { // each triangle is weighted by the product of the weights of the edges assert(weight = 1.0); //not used in this case assert(edge_weight_[make_pair(u,v)]>0); assert(edge_weight_[make_pair(u,n)]>0); assert(edge_weight_[make_pair(v,n)]>0); weight_to_use = edge_weight_.at(make_pair(u,v))*edge_weight_.at(make_pair(n,v))*edge_weight_.at(make_pair(u,n)); } triangles_weight_ -= weight_to_use; triangles_ -= 1; if(local_){ triangles_local_map_[u]--; triangles_local_map_[v]--; triangles_local_map_[n]--; triangles_weight_local_map_[u]-=weight_to_use; triangles_weight_local_map_[v]-=weight_to_use; triangles_weight_local_map_[n]-=weight_to_use; // To avoid numerical error triangles_weight_local_map_[u]= max(triangles_weight_local_map_[u], 0.0); triangles_weight_local_map_[v]= max(triangles_weight_local_map_[v], 0.0); triangles_weight_local_map_[n]= max(triangles_weight_local_map_[n], 0.0); } } } } } void TriangleCounter::new_update(const EdgeUpdate& update){ if(update.is_add){ edges_present_original_++; } else { edges_present_original_--; } } void TriangleCounter::clear() { triangles_ = edges_present_original_ = triangles_weight_ = 0; graph_.clear(); set_edge_ids_.clear(); edge_weight_.clear(); } unsigned long long int TriangleCounter::edges_present_original() const { return edges_present_original_; } int TriangleCounter::common_neighbors(const int u, const int v) const { int min_deg_n = (graph_.degree(u) <= graph_.degree(v) ? u : v); int max_deg_n = (graph_.degree(u) <= graph_.degree(v) ? v : u); vector<int> min_neighbors; graph_.neighbors(min_deg_n, & min_neighbors); //unordered_set<int> min_set(min_neighbors.begin(), min_neighbors.end()); //vector<int> max_neighbors; //graph_.neighbors(max_deg_n, & max_neighbors); //int ret = 0; //for(const auto& n : max_neighbors){ // if(min_set.find(n) != min_set.end()){ // ret++; // } //} int ret = 0; for(const auto& n : min_neighbors){ if(n!= max_deg_n){ if(set_edge_ids_.find(edge_to_id(n, max_deg_n)) != set_edge_ids_.end()){ ret++; } } } return ret; }
; A053763: a(n) = 2^(n^2 - n). ; 1,1,4,64,4096,1048576,1073741824,4398046511104,72057594037927936,4722366482869645213696,1237940039285380274899124224,1298074214633706907132624082305024 bin $0,2 mov $1,4 pow $1,$0 mov $0,$1
; A017403: (11n+1)^3. ; 1,1728,12167,39304,91125,175616,300763,474552,704969,1000000,1367631,1815848,2352637,2985984,3723875,4574296,5545233,6644672,7880599,9261000,10793861,12487168,14348907,16387064 mul $0,11 add $0,1 pow $0,3
.globl Tela45 Tela45: addi $10, $0, 0xcff8cf sw $10, 268500992($0) addi $10, $0, 0x00d800 sw $10, 268500996($0) addi $10, $0, 0x00d800 sw $10, 268501000($0) addi $10, $0, 0x00d800 sw $10, 268501004($0) addi $10, $0, 0x00d800 sw $10, 268501008($0) addi $10, $0, 0x00d800 sw $10, 268501012($0) addi $10, $0, 0x00d800 sw $10, 268501016($0) addi $10, $0, 0x00d800 sw $10, 268501020($0) addi $10, $0, 0x00d800 sw $10, 268501024($0) addi $10, $0, 0x00d800 sw $10, 268501028($0) addi $10, $0, 0x00d800 sw $10, 268501032($0) addi $10, $0, 0x00d800 sw $10, 268501036($0) addi $10, $0, 0x00d800 sw $10, 268501040($0) addi $10, $0, 0x00d800 sw $10, 268501044($0) addi $10, $0, 0x00d800 sw $10, 268501048($0) addi $10, $0, 0x00d800 sw $10, 268501052($0) addi $10, $0, 0x00d800 sw $10, 268501056($0) addi $10, $0, 0x00d800 sw $10, 268501060($0) addi $10, $0, 0x00d800 sw $10, 268501064($0) addi $10, $0, 0x00d800 sw $10, 268501068($0) addi $10, $0, 0x00d800 sw $10, 268501072($0) addi $10, $0, 0x00d800 sw $10, 268501076($0) addi $10, $0, 0x00d800 sw $10, 268501080($0) addi $10, $0, 0x00d800 sw $10, 268501084($0) addi $10, $0, 0x00d800 sw $10, 268501088($0) addi $10, $0, 0x00d800 sw $10, 268501092($0) addi $10, $0, 0x00d800 sw $10, 268501096($0) addi $10, $0, 0x00d800 sw $10, 268501100($0) addi $10, $0, 0x00d800 sw $10, 268501104($0) addi $10, $0, 0x00d800 sw $10, 268501108($0) addi $10, $0, 0x00d800 sw $10, 268501112($0) addi $10, $0, 0x00d800 sw $10, 268501116($0) addi $10, $0, 0x00d800 sw $10, 268501120($0) addi $10, $0, 0x00d800 sw $10, 268501124($0) addi $10, $0, 0x00d800 sw $10, 268501128($0) addi $10, $0, 0x00d800 sw $10, 268501132($0) addi $10, $0, 0x00d800 sw $10, 268501136($0) addi $10, $0, 0x00d800 sw $10, 268501140($0) addi $10, $0, 0x00d800 sw $10, 268501144($0) addi $10, $0, 0x00d800 sw $10, 268501148($0) addi $10, $0, 0x00d800 sw $10, 268501152($0) addi $10, $0, 0x00d800 sw $10, 268501156($0) addi $10, $0, 0x00d800 sw $10, 268501160($0) addi $10, $0, 0x00d800 sw $10, 268501164($0) addi $10, $0, 0x00d800 sw $10, 268501168($0) addi $10, $0, 0x00d800 sw $10, 268501172($0) addi $10, $0, 0x00d800 sw $10, 268501176($0) addi $10, $0, 0x00d800 sw $10, 268501180($0) addi $10, $0, 0x00d800 sw $10, 268501184($0) addi $10, $0, 0x00d800 sw $10, 268501188($0) addi $10, $0, 0x00d800 sw $10, 268501192($0) addi $10, $0, 0x00d800 sw $10, 268501196($0) addi $10, $0, 0x00d800 sw $10, 268501200($0) addi $10, $0, 0x00d800 sw $10, 268501204($0) addi $10, $0, 0x00d800 sw $10, 268501208($0) addi $10, $0, 0x00d800 sw $10, 268501212($0) addi $10, $0, 0x00d800 sw $10, 268501216($0) addi $10, $0, 0x00d800 sw $10, 268501220($0) addi $10, $0, 0x00d800 sw $10, 268501224($0) addi $10, $0, 0x00d800 sw $10, 268501228($0) addi $10, $0, 0x00d800 sw $10, 268501232($0) addi $10, $0, 0x00d800 sw $10, 268501236($0) addi $10, $0, 0x00d800 sw $10, 268501240($0) addi $10, $0, 0x00d800 sw $10, 268501244($0) addi $10, $0, 0x00d800 sw $10, 268501248($0) addi $10, $0, 0xffffff sw $10, 268501252($0) addi $10, $0, 0xffffff sw $10, 268501256($0) addi $10, $0, 0xffffff sw $10, 268501260($0) addi $10, $0, 0xffffff sw $10, 268501264($0) addi $10, $0, 0xffffff sw $10, 268501268($0) addi $10, $0, 0xffffff sw $10, 268501272($0) addi $10, $0, 0xffffff sw $10, 268501276($0) addi $10, $0, 0xffffff sw $10, 268501280($0) addi $10, $0, 0xffffff sw $10, 268501284($0) addi $10, $0, 0xffffff sw $10, 268501288($0) addi $10, $0, 0xffffff sw $10, 268501292($0) addi $10, $0, 0xffffff sw $10, 268501296($0) addi $10, $0, 0xffffff sw $10, 268501300($0) addi $10, $0, 0xffffff sw $10, 268501304($0) addi $10, $0, 0xffffff sw $10, 268501308($0) addi $10, $0, 0xffffff sw $10, 268501312($0) addi $10, $0, 0xffffff sw $10, 268501316($0) addi $10, $0, 0xffffff sw $10, 268501320($0) addi $10, $0, 0xffffff sw $10, 268501324($0) addi $10, $0, 0xffffff sw $10, 268501328($0) addi $10, $0, 0xffffff sw $10, 268501332($0) addi $10, $0, 0xffffff sw $10, 268501336($0) addi $10, $0, 0xffffff sw $10, 268501340($0) addi $10, $0, 0xffffff sw $10, 268501344($0) addi $10, $0, 0xffffff sw $10, 268501348($0) addi $10, $0, 0xffffff sw $10, 268501352($0) addi $10, $0, 0xffffff sw $10, 268501356($0) addi $10, $0, 0xffffff sw $10, 268501360($0) addi $10, $0, 0xffffff sw $10, 268501364($0) addi $10, $0, 0xffffff sw $10, 268501368($0) addi $10, $0, 0xffffff sw $10, 268501372($0) addi $10, $0, 0xffffff sw $10, 268501376($0) addi $10, $0, 0xffffff sw $10, 268501380($0) addi $10, $0, 0xffffff sw $10, 268501384($0) addi $10, $0, 0xffffff sw $10, 268501388($0) addi $10, $0, 0xffffff sw $10, 268501392($0) addi $10, $0, 0xffffff sw $10, 268501396($0) addi $10, $0, 0xffffff sw $10, 268501400($0) addi $10, $0, 0xffffff sw $10, 268501404($0) addi $10, $0, 0xffffff sw $10, 268501408($0) addi $10, $0, 0xffffff sw $10, 268501412($0) addi $10, $0, 0xffffff sw $10, 268501416($0) addi $10, $0, 0xffffff sw $10, 268501420($0) addi $10, $0, 0xffffff sw $10, 268501424($0) addi $10, $0, 0xffffff sw $10, 268501428($0) addi $10, $0, 0xffffff sw $10, 268501432($0) addi $10, $0, 0xffffff sw $10, 268501436($0) addi $10, $0, 0xffffff sw $10, 268501440($0) addi $10, $0, 0xffffff sw $10, 268501444($0) addi $10, $0, 0xffffff sw $10, 268501448($0) addi $10, $0, 0xffffff sw $10, 268501452($0) addi $10, $0, 0xffffff sw $10, 268501456($0) addi $10, $0, 0xffffff sw $10, 268501460($0) addi $10, $0, 0xffffff sw $10, 268501464($0) addi $10, $0, 0xffffff sw $10, 268501468($0) addi $10, $0, 0xffffff sw $10, 268501472($0) addi $10, $0, 0xffffff sw $10, 268501476($0) addi $10, $0, 0xffffff sw $10, 268501480($0) addi $10, $0, 0xffffff sw $10, 268501484($0) addi $10, $0, 0xffffff sw $10, 268501488($0) addi $10, $0, 0xffffff sw $10, 268501492($0) addi $10, $0, 0xffffff sw $10, 268501496($0) addi $10, $0, 0x00d800 sw $10, 268501500($0) addi $10, $0, 0x00d800 sw $10, 268501504($0) addi $10, $0, 0xffffff sw $10, 268501508($0) addi $10, $0, 0xffffff sw $10, 268501512($0) addi $10, $0, 0xffffff sw $10, 268501516($0) addi $10, $0, 0xfefefe sw $10, 268501520($0) addi $10, $0, 0xfdfdfd sw $10, 268501524($0) addi $10, $0, 0xfcfcfc sw $10, 268501528($0) addi $10, $0, 0xfcfcfc sw $10, 268501532($0) addi $10, $0, 0xfcfcfc sw $10, 268501536($0) addi $10, $0, 0xfcfcfc sw $10, 268501540($0) addi $10, $0, 0xfcfcfc sw $10, 268501544($0) addi $10, $0, 0xfcfcfc sw $10, 268501548($0) addi $10, $0, 0xfcfcfc sw $10, 268501552($0) addi $10, $0, 0xfcfcfc sw $10, 268501556($0) addi $10, $0, 0xfcfcfc sw $10, 268501560($0) addi $10, $0, 0xfcfcfc sw $10, 268501564($0) addi $10, $0, 0xfcfcfc sw $10, 268501568($0) addi $10, $0, 0xfcfcfc sw $10, 268501572($0) addi $10, $0, 0xfcfcfc sw $10, 268501576($0) addi $10, $0, 0xfcfcfc sw $10, 268501580($0) addi $10, $0, 0xfcfcfc sw $10, 268501584($0) addi $10, $0, 0xfcfcfc sw $10, 268501588($0) addi $10, $0, 0xfcfcfc sw $10, 268501592($0) addi $10, $0, 0xfcfcfc sw $10, 268501596($0) addi $10, $0, 0xfcfcfc sw $10, 268501600($0) addi $10, $0, 0xfcfcfc sw $10, 268501604($0) addi $10, $0, 0xfcfcfc sw $10, 268501608($0) addi $10, $0, 0xfcfcfc sw $10, 268501612($0) addi $10, $0, 0xfcfcfc sw $10, 268501616($0) addi $10, $0, 0xfcfcfc sw $10, 268501620($0) addi $10, $0, 0xfcfcfc sw $10, 268501624($0) addi $10, $0, 0xfdfdfd sw $10, 268501628($0) addi $10, $0, 0xffffff sw $10, 268501632($0) addi $10, $0, 0xffffff sw $10, 268501636($0) addi $10, $0, 0xffffff sw $10, 268501640($0) addi $10, $0, 0xffffff sw $10, 268501644($0) addi $10, $0, 0xffffff sw $10, 268501648($0) addi $10, $0, 0xffffff sw $10, 268501652($0) addi $10, $0, 0xffffff sw $10, 268501656($0) addi $10, $0, 0xffffff sw $10, 268501660($0) addi $10, $0, 0xffffff sw $10, 268501664($0) addi $10, $0, 0xffffff sw $10, 268501668($0) addi $10, $0, 0xffffff sw $10, 268501672($0) addi $10, $0, 0xffffff sw $10, 268501676($0) addi $10, $0, 0xffffff sw $10, 268501680($0) addi $10, $0, 0xffffff sw $10, 268501684($0) addi $10, $0, 0xffffff sw $10, 268501688($0) addi $10, $0, 0xffffff sw $10, 268501692($0) addi $10, $0, 0xffffff sw $10, 268501696($0) addi $10, $0, 0xffffff sw $10, 268501700($0) addi $10, $0, 0xffffff sw $10, 268501704($0) addi $10, $0, 0xffffff sw $10, 268501708($0) addi $10, $0, 0xffffff sw $10, 268501712($0) addi $10, $0, 0xffffff sw $10, 268501716($0) addi $10, $0, 0xffffff sw $10, 268501720($0) addi $10, $0, 0xffffff sw $10, 268501724($0) addi $10, $0, 0xffffff sw $10, 268501728($0) addi $10, $0, 0xffffff sw $10, 268501732($0) addi $10, $0, 0xffffff sw $10, 268501736($0) addi $10, $0, 0xffffff sw $10, 268501740($0) addi $10, $0, 0xffffff sw $10, 268501744($0) addi $10, $0, 0xffffff sw $10, 268501748($0) addi $10, $0, 0xffffff sw $10, 268501752($0) addi $10, $0, 0x00d800 sw $10, 268501756($0) addi $10, $0, 0x00d800 sw $10, 268501760($0) addi $10, $0, 0xffffff sw $10, 268501764($0) addi $10, $0, 0xffffff sw $10, 268501768($0) addi $10, $0, 0xfdfdfd sw $10, 268501772($0) addi $10, $0, 0xffb000 sw $10, 268501776($0) addi $10, $0, 0xffb000 sw $10, 268501780($0) addi $10, $0, 0xffb000 sw $10, 268501784($0) addi $10, $0, 0xffb000 sw $10, 268501788($0) addi $10, $0, 0xffb000 sw $10, 268501792($0) addi $10, $0, 0xffb000 sw $10, 268501796($0) addi $10, $0, 0xffb000 sw $10, 268501800($0) addi $10, $0, 0xffb000 sw $10, 268501804($0) addi $10, $0, 0xffb000 sw $10, 268501808($0) addi $10, $0, 0xffb000 sw $10, 268501812($0) addi $10, $0, 0xffb000 sw $10, 268501816($0) addi $10, $0, 0xffb000 sw $10, 268501820($0) addi $10, $0, 0xffb000 sw $10, 268501824($0) addi $10, $0, 0xffb000 sw $10, 268501828($0) addi $10, $0, 0xffb000 sw $10, 268501832($0) addi $10, $0, 0xffb000 sw $10, 268501836($0) addi $10, $0, 0xffb000 sw $10, 268501840($0) addi $10, $0, 0xffb000 sw $10, 268501844($0) addi $10, $0, 0xffb000 sw $10, 268501848($0) addi $10, $0, 0xffb000 sw $10, 268501852($0) addi $10, $0, 0xffb000 sw $10, 268501856($0) addi $10, $0, 0xffb000 sw $10, 268501860($0) addi $10, $0, 0xffb000 sw $10, 268501864($0) addi $10, $0, 0xffb000 sw $10, 268501868($0) addi $10, $0, 0xffb000 sw $10, 268501872($0) addi $10, $0, 0xffb000 sw $10, 268501876($0) addi $10, $0, 0xffb000 sw $10, 268501880($0) addi $10, $0, 0xffb000 sw $10, 268501884($0) addi $10, $0, 0xfbfbfb sw $10, 268501888($0) addi $10, $0, 0xffffff sw $10, 268501892($0) addi $10, $0, 0xffffff sw $10, 268501896($0) addi $10, $0, 0xffffff sw $10, 268501900($0) addi $10, $0, 0xffffff sw $10, 268501904($0) addi $10, $0, 0xffffff sw $10, 268501908($0) addi $10, $0, 0xffffff sw $10, 268501912($0) addi $10, $0, 0xffffff sw $10, 268501916($0) addi $10, $0, 0xffffff sw $10, 268501920($0) addi $10, $0, 0xffffff sw $10, 268501924($0) addi $10, $0, 0xffffff sw $10, 268501928($0) addi $10, $0, 0xffffff sw $10, 268501932($0) addi $10, $0, 0xffffff sw $10, 268501936($0) addi $10, $0, 0xffffff sw $10, 268501940($0) addi $10, $0, 0xffffff sw $10, 268501944($0) addi $10, $0, 0xffffff sw $10, 268501948($0) addi $10, $0, 0xffffff sw $10, 268501952($0) addi $10, $0, 0xffffff sw $10, 268501956($0) addi $10, $0, 0xffffff sw $10, 268501960($0) addi $10, $0, 0xffffff sw $10, 268501964($0) addi $10, $0, 0xffffff sw $10, 268501968($0) addi $10, $0, 0xffffff sw $10, 268501972($0) addi $10, $0, 0xffffff sw $10, 268501976($0) addi $10, $0, 0xffffff sw $10, 268501980($0) addi $10, $0, 0xffffff sw $10, 268501984($0) addi $10, $0, 0xffffff sw $10, 268501988($0) addi $10, $0, 0xffffff sw $10, 268501992($0) addi $10, $0, 0xffffff sw $10, 268501996($0) addi $10, $0, 0xffffff sw $10, 268502000($0) addi $10, $0, 0xffffff sw $10, 268502004($0) addi $10, $0, 0xffffff sw $10, 268502008($0) addi $10, $0, 0x00d800 sw $10, 268502012($0) addi $10, $0, 0x00d800 sw $10, 268502016($0) addi $10, $0, 0xffffff sw $10, 268502020($0) addi $10, $0, 0xffffff sw $10, 268502024($0) addi $10, $0, 0xf9f9f9 sw $10, 268502028($0) addi $10, $0, 0xffb000 sw $10, 268502032($0) addi $10, $0, 0xffb000 sw $10, 268502036($0) addi $10, $0, 0xffb000 sw $10, 268502040($0) addi $10, $0, 0xffb000 sw $10, 268502044($0) addi $10, $0, 0xffb000 sw $10, 268502048($0) addi $10, $0, 0xffb000 sw $10, 268502052($0) addi $10, $0, 0xffb000 sw $10, 268502056($0) addi $10, $0, 0xffb000 sw $10, 268502060($0) addi $10, $0, 0xffb000 sw $10, 268502064($0) addi $10, $0, 0xffb000 sw $10, 268502068($0) addi $10, $0, 0xffb000 sw $10, 268502072($0) addi $10, $0, 0xffb000 sw $10, 268502076($0) addi $10, $0, 0xffb000 sw $10, 268502080($0) addi $10, $0, 0xffb000 sw $10, 268502084($0) addi $10, $0, 0xffb000 sw $10, 268502088($0) addi $10, $0, 0xffb000 sw $10, 268502092($0) addi $10, $0, 0xffb000 sw $10, 268502096($0) addi $10, $0, 0xffb000 sw $10, 268502100($0) addi $10, $0, 0xffb000 sw $10, 268502104($0) addi $10, $0, 0xffb000 sw $10, 268502108($0) addi $10, $0, 0xffb000 sw $10, 268502112($0) addi $10, $0, 0xffb000 sw $10, 268502116($0) addi $10, $0, 0x000000 sw $10, 268502120($0) addi $10, $0, 0x402c00 sw $10, 268502124($0) addi $10, $0, 0xffb000 sw $10, 268502128($0) addi $10, $0, 0xffb000 sw $10, 268502132($0) addi $10, $0, 0xffb000 sw $10, 268502136($0) addi $10, $0, 0xffb000 sw $10, 268502140($0) addi $10, $0, 0xf5f5f5 sw $10, 268502144($0) addi $10, $0, 0xfefefe sw $10, 268502148($0) addi $10, $0, 0xffffff sw $10, 268502152($0) addi $10, $0, 0x3d85c6 sw $10, 268502156($0) addi $10, $0, 0x3d85c6 sw $10, 268502160($0) addi $10, $0, 0x000000 sw $10, 268502164($0) addi $10, $0, 0x081119 sw $10, 268502168($0) addi $10, $0, 0xffffff sw $10, 268502172($0) addi $10, $0, 0xffffff sw $10, 268502176($0) addi $10, $0, 0xffffff sw $10, 268502180($0) addi $10, $0, 0xb7b7b7 sw $10, 268502184($0) addi $10, $0, 0xb7b7b7 sw $10, 268502188($0) addi $10, $0, 0x171717 sw $10, 268502192($0) addi $10, $0, 0x171717 sw $10, 268502196($0) addi $10, $0, 0x171717 sw $10, 268502200($0) addi $10, $0, 0x171717 sw $10, 268502204($0) addi $10, $0, 0xb7b7b7 sw $10, 268502208($0) addi $10, $0, 0xb7b7b7 sw $10, 268502212($0) addi $10, $0, 0xb7b7b7 sw $10, 268502216($0) addi $10, $0, 0xb7b7b7 sw $10, 268502220($0) addi $10, $0, 0xb7b7b7 sw $10, 268502224($0) addi $10, $0, 0x000000 sw $10, 268502228($0) addi $10, $0, 0x000000 sw $10, 268502232($0) addi $10, $0, 0xb7b7b7 sw $10, 268502236($0) addi $10, $0, 0xb7b7b7 sw $10, 268502240($0) addi $10, $0, 0xb7b7b7 sw $10, 268502244($0) addi $10, $0, 0xb7b7b7 sw $10, 268502248($0) addi $10, $0, 0xb7b7b7 sw $10, 268502252($0) addi $10, $0, 0xb7b7b7 sw $10, 268502256($0) addi $10, $0, 0xffffff sw $10, 268502260($0) addi $10, $0, 0xffffff sw $10, 268502264($0) addi $10, $0, 0x00d800 sw $10, 268502268($0) addi $10, $0, 0x00d800 sw $10, 268502272($0) addi $10, $0, 0xffffff sw $10, 268502276($0) addi $10, $0, 0xffffff sw $10, 268502280($0) addi $10, $0, 0xf6f6f6 sw $10, 268502284($0) addi $10, $0, 0xffb000 sw $10, 268502288($0) addi $10, $0, 0xffb000 sw $10, 268502292($0) addi $10, $0, 0xffb000 sw $10, 268502296($0) addi $10, $0, 0xffb000 sw $10, 268502300($0) addi $10, $0, 0xffb000 sw $10, 268502304($0) addi $10, $0, 0x000000 sw $10, 268502308($0) addi $10, $0, 0x000000 sw $10, 268502312($0) addi $10, $0, 0x000000 sw $10, 268502316($0) addi $10, $0, 0x000000 sw $10, 268502320($0) addi $10, $0, 0xffb000 sw $10, 268502324($0) addi $10, $0, 0xffb000 sw $10, 268502328($0) addi $10, $0, 0xffb000 sw $10, 268502332($0) addi $10, $0, 0xffb000 sw $10, 268502336($0) addi $10, $0, 0xffb000 sw $10, 268502340($0) addi $10, $0, 0xffb000 sw $10, 268502344($0) addi $10, $0, 0xffb000 sw $10, 268502348($0) addi $10, $0, 0xffb000 sw $10, 268502352($0) addi $10, $0, 0xffb000 sw $10, 268502356($0) addi $10, $0, 0xffb000 sw $10, 268502360($0) addi $10, $0, 0xffb000 sw $10, 268502364($0) addi $10, $0, 0xffb000 sw $10, 268502368($0) addi $10, $0, 0xffb000 sw $10, 268502372($0) addi $10, $0, 0x000000 sw $10, 268502376($0) addi $10, $0, 0x402c00 sw $10, 268502380($0) addi $10, $0, 0xffb000 sw $10, 268502384($0) addi $10, $0, 0xffb000 sw $10, 268502388($0) addi $10, $0, 0xffb000 sw $10, 268502392($0) addi $10, $0, 0xffb000 sw $10, 268502396($0) addi $10, $0, 0xf1f1f1 sw $10, 268502400($0) addi $10, $0, 0xfdfdfd sw $10, 268502404($0) addi $10, $0, 0x3d85c6 sw $10, 268502408($0) addi $10, $0, 0x3d85c6 sw $10, 268502412($0) addi $10, $0, 0x000000 sw $10, 268502416($0) addi $10, $0, 0x3d85c6 sw $10, 268502420($0) addi $10, $0, 0x000000 sw $10, 268502424($0) addi $10, $0, 0x050a10 sw $10, 268502428($0) addi $10, $0, 0xffffff sw $10, 268502432($0) addi $10, $0, 0xffffff sw $10, 268502436($0) addi $10, $0, 0xb7b7b7 sw $10, 268502440($0) addi $10, $0, 0xb7b7b7 sw $10, 268502444($0) addi $10, $0, 0x000000 sw $10, 268502448($0) addi $10, $0, 0x171717 sw $10, 268502452($0) addi $10, $0, 0x171717 sw $10, 268502456($0) addi $10, $0, 0x171717 sw $10, 268502460($0) addi $10, $0, 0xb7b7b7 sw $10, 268502464($0) addi $10, $0, 0xb7b7b7 sw $10, 268502468($0) addi $10, $0, 0xb7b7b7 sw $10, 268502472($0) addi $10, $0, 0xb7b7b7 sw $10, 268502476($0) addi $10, $0, 0xb7b7b7 sw $10, 268502480($0) addi $10, $0, 0xb7b7b7 sw $10, 268502484($0) addi $10, $0, 0xb7b7b7 sw $10, 268502488($0) addi $10, $0, 0xb7b7b7 sw $10, 268502492($0) addi $10, $0, 0x000000 sw $10, 268502496($0) addi $10, $0, 0xb7b7b7 sw $10, 268502500($0) addi $10, $0, 0xb7b7b7 sw $10, 268502504($0) addi $10, $0, 0xb7b7b7 sw $10, 268502508($0) addi $10, $0, 0xb7b7b7 sw $10, 268502512($0) addi $10, $0, 0xffffff sw $10, 268502516($0) addi $10, $0, 0xffffff sw $10, 268502520($0) addi $10, $0, 0x00d800 sw $10, 268502524($0) addi $10, $0, 0x00d800 sw $10, 268502528($0) addi $10, $0, 0xffffff sw $10, 268502532($0) addi $10, $0, 0xffffff sw $10, 268502536($0) addi $10, $0, 0xf6f6f6 sw $10, 268502540($0) addi $10, $0, 0xffb000 sw $10, 268502544($0) addi $10, $0, 0xffb000 sw $10, 268502548($0) addi $10, $0, 0xffb000 sw $10, 268502552($0) addi $10, $0, 0xffb000 sw $10, 268502556($0) addi $10, $0, 0xffb000 sw $10, 268502560($0) addi $10, $0, 0x000000 sw $10, 268502564($0) addi $10, $0, 0xffb000 sw $10, 268502568($0) addi $10, $0, 0xffb000 sw $10, 268502572($0) addi $10, $0, 0xffb000 sw $10, 268502576($0) addi $10, $0, 0xffb000 sw $10, 268502580($0) addi $10, $0, 0x000000 sw $10, 268502584($0) addi $10, $0, 0x000000 sw $10, 268502588($0) addi $10, $0, 0x000000 sw $10, 268502592($0) addi $10, $0, 0xffb000 sw $10, 268502596($0) addi $10, $0, 0xffb000 sw $10, 268502600($0) addi $10, $0, 0x000000 sw $10, 268502604($0) addi $10, $0, 0x000000 sw $10, 268502608($0) addi $10, $0, 0x000000 sw $10, 268502612($0) addi $10, $0, 0xffb000 sw $10, 268502616($0) addi $10, $0, 0xffb000 sw $10, 268502620($0) addi $10, $0, 0x000000 sw $10, 268502624($0) addi $10, $0, 0x000000 sw $10, 268502628($0) addi $10, $0, 0x000000 sw $10, 268502632($0) addi $10, $0, 0x402c00 sw $10, 268502636($0) addi $10, $0, 0xffb000 sw $10, 268502640($0) addi $10, $0, 0xffb000 sw $10, 268502644($0) addi $10, $0, 0xffb000 sw $10, 268502648($0) addi $10, $0, 0xffb000 sw $10, 268502652($0) addi $10, $0, 0xf1f1f1 sw $10, 268502656($0) addi $10, $0, 0x3d85c6 sw $10, 268502660($0) addi $10, $0, 0x3d85c6 sw $10, 268502664($0) addi $10, $0, 0x3d85c6 sw $10, 268502668($0) addi $10, $0, 0x000000 sw $10, 268502672($0) addi $10, $0, 0x3d85c6 sw $10, 268502676($0) addi $10, $0, 0x2c608f sw $10, 268502680($0) addi $10, $0, 0x000000 sw $10, 268502684($0) addi $10, $0, 0x3d85c6 sw $10, 268502688($0) addi $10, $0, 0xffffff sw $10, 268502692($0) addi $10, $0, 0xb7b7b7 sw $10, 268502696($0) addi $10, $0, 0xb7b7b7 sw $10, 268502700($0) addi $10, $0, 0x000000 sw $10, 268502704($0) addi $10, $0, 0xb7b7b7 sw $10, 268502708($0) addi $10, $0, 0xb7b7b7 sw $10, 268502712($0) addi $10, $0, 0xb7b7b7 sw $10, 268502716($0) addi $10, $0, 0xb7b7b7 sw $10, 268502720($0) addi $10, $0, 0x000000 sw $10, 268502724($0) addi $10, $0, 0xb7b7b7 sw $10, 268502728($0) addi $10, $0, 0x000000 sw $10, 268502732($0) addi $10, $0, 0xb7b7b7 sw $10, 268502736($0) addi $10, $0, 0x454545 sw $10, 268502740($0) addi $10, $0, 0x000000 sw $10, 268502744($0) addi $10, $0, 0xb7b7b7 sw $10, 268502748($0) addi $10, $0, 0x000000 sw $10, 268502752($0) addi $10, $0, 0x000000 sw $10, 268502756($0) addi $10, $0, 0x000000 sw $10, 268502760($0) addi $10, $0, 0xb7b7b7 sw $10, 268502764($0) addi $10, $0, 0xb7b7b7 sw $10, 268502768($0) addi $10, $0, 0xffffff sw $10, 268502772($0) addi $10, $0, 0xffffff sw $10, 268502776($0) addi $10, $0, 0x00d800 sw $10, 268502780($0) addi $10, $0, 0x00d800 sw $10, 268502784($0) addi $10, $0, 0xffffff sw $10, 268502788($0) addi $10, $0, 0xffffff sw $10, 268502792($0) addi $10, $0, 0xf6f6f6 sw $10, 268502796($0) addi $10, $0, 0xffb000 sw $10, 268502800($0) addi $10, $0, 0xffb000 sw $10, 268502804($0) addi $10, $0, 0xffb000 sw $10, 268502808($0) addi $10, $0, 0xffb000 sw $10, 268502812($0) addi $10, $0, 0xffb000 sw $10, 268502816($0) addi $10, $0, 0x000000 sw $10, 268502820($0) addi $10, $0, 0x000000 sw $10, 268502824($0) addi $10, $0, 0x000000 sw $10, 268502828($0) addi $10, $0, 0xffb000 sw $10, 268502832($0) addi $10, $0, 0x080600 sw $10, 268502836($0) addi $10, $0, 0x000000 sw $10, 268502840($0) addi $10, $0, 0xffb000 sw $10, 268502844($0) addi $10, $0, 0x000000 sw $10, 268502848($0) addi $10, $0, 0x0c0800 sw $10, 268502852($0) addi $10, $0, 0x785300 sw $10, 268502856($0) addi $10, $0, 0x000000 sw $10, 268502860($0) addi $10, $0, 0xffb000 sw $10, 268502864($0) addi $10, $0, 0x000000 sw $10, 268502868($0) addi $10, $0, 0x000000 sw $10, 268502872($0) addi $10, $0, 0xcf8f00 sw $10, 268502876($0) addi $10, $0, 0x000000 sw $10, 268502880($0) addi $10, $0, 0xffb000 sw $10, 268502884($0) addi $10, $0, 0x000000 sw $10, 268502888($0) addi $10, $0, 0x402c00 sw $10, 268502892($0) addi $10, $0, 0xffb000 sw $10, 268502896($0) addi $10, $0, 0xffb000 sw $10, 268502900($0) addi $10, $0, 0xffb000 sw $10, 268502904($0) addi $10, $0, 0xffb000 sw $10, 268502908($0) addi $10, $0, 0xf1f1f1 sw $10, 268502912($0) addi $10, $0, 0x3d85c6 sw $10, 268502916($0) addi $10, $0, 0x3d85c6 sw $10, 268502920($0) addi $10, $0, 0x3d85c6 sw $10, 268502924($0) addi $10, $0, 0x000000 sw $10, 268502928($0) addi $10, $0, 0x000000 sw $10, 268502932($0) addi $10, $0, 0x000000 sw $10, 268502936($0) addi $10, $0, 0x000000 sw $10, 268502940($0) addi $10, $0, 0x3d85c6 sw $10, 268502944($0) addi $10, $0, 0xffffff sw $10, 268502948($0) addi $10, $0, 0xb7b7b7 sw $10, 268502952($0) addi $10, $0, 0xb7b7b7 sw $10, 268502956($0) addi $10, $0, 0x000000 sw $10, 268502960($0) addi $10, $0, 0x000000 sw $10, 268502964($0) addi $10, $0, 0x000000 sw $10, 268502968($0) addi $10, $0, 0x454545 sw $10, 268502972($0) addi $10, $0, 0xb7b7b7 sw $10, 268502976($0) addi $10, $0, 0xa9a9a9 sw $10, 268502980($0) addi $10, $0, 0x000000 sw $10, 268502984($0) addi $10, $0, 0x030303 sw $10, 268502988($0) addi $10, $0, 0xb7b7b7 sw $10, 268502992($0) addi $10, $0, 0x454545 sw $10, 268502996($0) addi $10, $0, 0x000000 sw $10, 268503000($0) addi $10, $0, 0xb7b7b7 sw $10, 268503004($0) addi $10, $0, 0x000000 sw $10, 268503008($0) addi $10, $0, 0xb7b7b7 sw $10, 268503012($0) addi $10, $0, 0xb7b7b7 sw $10, 268503016($0) addi $10, $0, 0xb7b7b7 sw $10, 268503020($0) addi $10, $0, 0xb7b7b7 sw $10, 268503024($0) addi $10, $0, 0xffffff sw $10, 268503028($0) addi $10, $0, 0xffffff sw $10, 268503032($0) addi $10, $0, 0x00d800 sw $10, 268503036($0) addi $10, $0, 0x00d800 sw $10, 268503040($0) addi $10, $0, 0xffffff sw $10, 268503044($0) addi $10, $0, 0xffffff sw $10, 268503048($0) addi $10, $0, 0xf6f6f6 sw $10, 268503052($0) addi $10, $0, 0xffb000 sw $10, 268503056($0) addi $10, $0, 0xffb000 sw $10, 268503060($0) addi $10, $0, 0xffb000 sw $10, 268503064($0) addi $10, $0, 0xffb000 sw $10, 268503068($0) addi $10, $0, 0xffb000 sw $10, 268503072($0) addi $10, $0, 0x000000 sw $10, 268503076($0) addi $10, $0, 0xffb000 sw $10, 268503080($0) addi $10, $0, 0xffb000 sw $10, 268503084($0) addi $10, $0, 0xffb000 sw $10, 268503088($0) addi $10, $0, 0x000000 sw $10, 268503092($0) addi $10, $0, 0x000000 sw $10, 268503096($0) addi $10, $0, 0xffb000 sw $10, 268503100($0) addi $10, $0, 0x000000 sw $10, 268503104($0) addi $10, $0, 0x000000 sw $10, 268503108($0) addi $10, $0, 0x000000 sw $10, 268503112($0) addi $10, $0, 0x000000 sw $10, 268503116($0) addi $10, $0, 0xffb000 sw $10, 268503120($0) addi $10, $0, 0x000000 sw $10, 268503124($0) addi $10, $0, 0x000000 sw $10, 268503128($0) addi $10, $0, 0x402c00 sw $10, 268503132($0) addi $10, $0, 0x000000 sw $10, 268503136($0) addi $10, $0, 0xffb000 sw $10, 268503140($0) addi $10, $0, 0x000000 sw $10, 268503144($0) addi $10, $0, 0x402c00 sw $10, 268503148($0) addi $10, $0, 0xffb000 sw $10, 268503152($0) addi $10, $0, 0xffb000 sw $10, 268503156($0) addi $10, $0, 0xffb000 sw $10, 268503160($0) addi $10, $0, 0xffb000 sw $10, 268503164($0) addi $10, $0, 0xf1f1f1 sw $10, 268503168($0) addi $10, $0, 0x498dca sw $10, 268503172($0) addi $10, $0, 0x3d85c6 sw $10, 268503176($0) addi $10, $0, 0x3d85c6 sw $10, 268503180($0) addi $10, $0, 0x3d85c6 sw $10, 268503184($0) addi $10, $0, 0x3d85c6 sw $10, 268503188($0) addi $10, $0, 0x000000 sw $10, 268503192($0) addi $10, $0, 0x193651 sw $10, 268503196($0) addi $10, $0, 0x3d85c6 sw $10, 268503200($0) addi $10, $0, 0xffffff sw $10, 268503204($0) addi $10, $0, 0xb7b7b7 sw $10, 268503208($0) addi $10, $0, 0xb7b7b7 sw $10, 268503212($0) addi $10, $0, 0x000000 sw $10, 268503216($0) addi $10, $0, 0xb7b7b7 sw $10, 268503220($0) addi $10, $0, 0xb7b7b7 sw $10, 268503224($0) addi $10, $0, 0xb7b7b7 sw $10, 268503228($0) addi $10, $0, 0xb7b7b7 sw $10, 268503232($0) addi $10, $0, 0x4b4b4b sw $10, 268503236($0) addi $10, $0, 0x000000 sw $10, 268503240($0) addi $10, $0, 0x000000 sw $10, 268503244($0) addi $10, $0, 0xb7b7b7 sw $10, 268503248($0) addi $10, $0, 0x454545 sw $10, 268503252($0) addi $10, $0, 0x000000 sw $10, 268503256($0) addi $10, $0, 0xb7b7b7 sw $10, 268503260($0) addi $10, $0, 0x000000 sw $10, 268503264($0) addi $10, $0, 0xb7b7b7 sw $10, 268503268($0) addi $10, $0, 0xb7b7b7 sw $10, 268503272($0) addi $10, $0, 0xb7b7b7 sw $10, 268503276($0) addi $10, $0, 0xb7b7b7 sw $10, 268503280($0) addi $10, $0, 0xffffff sw $10, 268503284($0) addi $10, $0, 0xffffff sw $10, 268503288($0) addi $10, $0, 0x00d800 sw $10, 268503292($0) addi $10, $0, 0x00d800 sw $10, 268503296($0) addi $10, $0, 0xffffff sw $10, 268503300($0) addi $10, $0, 0xffffff sw $10, 268503304($0) addi $10, $0, 0xf6f6f6 sw $10, 268503308($0) addi $10, $0, 0xffb000 sw $10, 268503312($0) addi $10, $0, 0xffb000 sw $10, 268503316($0) addi $10, $0, 0xffb000 sw $10, 268503320($0) addi $10, $0, 0xffb000 sw $10, 268503324($0) addi $10, $0, 0xffb000 sw $10, 268503328($0) addi $10, $0, 0x000000 sw $10, 268503332($0) addi $10, $0, 0xffb000 sw $10, 268503336($0) addi $10, $0, 0xffb000 sw $10, 268503340($0) addi $10, $0, 0xffb000 sw $10, 268503344($0) addi $10, $0, 0xffb000 sw $10, 268503348($0) addi $10, $0, 0x000000 sw $10, 268503352($0) addi $10, $0, 0x604200 sw $10, 268503356($0) addi $10, $0, 0x000000 sw $10, 268503360($0) addi $10, $0, 0xffb000 sw $10, 268503364($0) addi $10, $0, 0xffb000 sw $10, 268503368($0) addi $10, $0, 0x000000 sw $10, 268503372($0) addi $10, $0, 0x604200 sw $10, 268503376($0) addi $10, $0, 0x000000 sw $10, 268503380($0) addi $10, $0, 0xfbad00 sw $10, 268503384($0) addi $10, $0, 0xffb000 sw $10, 268503388($0) addi $10, $0, 0x000000 sw $10, 268503392($0) addi $10, $0, 0x302100 sw $10, 268503396($0) addi $10, $0, 0x000000 sw $10, 268503400($0) addi $10, $0, 0x402c00 sw $10, 268503404($0) addi $10, $0, 0xffb000 sw $10, 268503408($0) addi $10, $0, 0xffb000 sw $10, 268503412($0) addi $10, $0, 0xffb000 sw $10, 268503416($0) addi $10, $0, 0xffb000 sw $10, 268503420($0) addi $10, $0, 0xf1f1f1 sw $10, 268503424($0) addi $10, $0, 0xfdfdfd sw $10, 268503428($0) addi $10, $0, 0x3d85c6 sw $10, 268503432($0) addi $10, $0, 0x3d85c6 sw $10, 268503436($0) addi $10, $0, 0x000000 sw $10, 268503440($0) addi $10, $0, 0x000000 sw $10, 268503444($0) addi $10, $0, 0x000000 sw $10, 268503448($0) addi $10, $0, 0x3d85c6 sw $10, 268503452($0) addi $10, $0, 0xffffff sw $10, 268503456($0) addi $10, $0, 0xffffff sw $10, 268503460($0) addi $10, $0, 0xb7b7b7 sw $10, 268503464($0) addi $10, $0, 0xb7b7b7 sw $10, 268503468($0) addi $10, $0, 0x000000 sw $10, 268503472($0) addi $10, $0, 0x000000 sw $10, 268503476($0) addi $10, $0, 0x000000 sw $10, 268503480($0) addi $10, $0, 0x000000 sw $10, 268503484($0) addi $10, $0, 0xb7b7b7 sw $10, 268503488($0) addi $10, $0, 0x000000 sw $10, 268503492($0) addi $10, $0, 0xb7b7b7 sw $10, 268503496($0) addi $10, $0, 0x000000 sw $10, 268503500($0) addi $10, $0, 0xb7b7b7 sw $10, 268503504($0) addi $10, $0, 0x454545 sw $10, 268503508($0) addi $10, $0, 0x000000 sw $10, 268503512($0) addi $10, $0, 0xb7b7b7 sw $10, 268503516($0) addi $10, $0, 0x000000 sw $10, 268503520($0) addi $10, $0, 0x000000 sw $10, 268503524($0) addi $10, $0, 0x000000 sw $10, 268503528($0) addi $10, $0, 0xb7b7b7 sw $10, 268503532($0) addi $10, $0, 0xb7b7b7 sw $10, 268503536($0) addi $10, $0, 0xffffff sw $10, 268503540($0) addi $10, $0, 0xffffff sw $10, 268503544($0) addi $10, $0, 0x00d800 sw $10, 268503548($0) addi $10, $0, 0x00d800 sw $10, 268503552($0) addi $10, $0, 0xffffff sw $10, 268503556($0) addi $10, $0, 0xffffff sw $10, 268503560($0) addi $10, $0, 0xf6f6f6 sw $10, 268503564($0) addi $10, $0, 0xffb000 sw $10, 268503568($0) addi $10, $0, 0xffb000 sw $10, 268503572($0) addi $10, $0, 0xffb000 sw $10, 268503576($0) addi $10, $0, 0xffb000 sw $10, 268503580($0) addi $10, $0, 0xffb000 sw $10, 268503584($0) addi $10, $0, 0xffb000 sw $10, 268503588($0) addi $10, $0, 0xffb000 sw $10, 268503592($0) addi $10, $0, 0xffb000 sw $10, 268503596($0) addi $10, $0, 0xffb000 sw $10, 268503600($0) addi $10, $0, 0xffb000 sw $10, 268503604($0) addi $10, $0, 0xffb000 sw $10, 268503608($0) addi $10, $0, 0x201600 sw $10, 268503612($0) addi $10, $0, 0xffb000 sw $10, 268503616($0) addi $10, $0, 0xffb000 sw $10, 268503620($0) addi $10, $0, 0xffb000 sw $10, 268503624($0) addi $10, $0, 0xffb000 sw $10, 268503628($0) addi $10, $0, 0x201600 sw $10, 268503632($0) addi $10, $0, 0xffb000 sw $10, 268503636($0) addi $10, $0, 0xffb000 sw $10, 268503640($0) addi $10, $0, 0xffb000 sw $10, 268503644($0) addi $10, $0, 0xffb000 sw $10, 268503648($0) addi $10, $0, 0x402c00 sw $10, 268503652($0) addi $10, $0, 0x906300 sw $10, 268503656($0) addi $10, $0, 0xffb000 sw $10, 268503660($0) addi $10, $0, 0xffb000 sw $10, 268503664($0) addi $10, $0, 0xffb000 sw $10, 268503668($0) addi $10, $0, 0xffb000 sw $10, 268503672($0) addi $10, $0, 0xffb000 sw $10, 268503676($0) addi $10, $0, 0xf1f1f1 sw $10, 268503680($0) addi $10, $0, 0xfdfdfd sw $10, 268503684($0) addi $10, $0, 0xffffff sw $10, 268503688($0) addi $10, $0, 0xffffff sw $10, 268503692($0) addi $10, $0, 0x5594cd sw $10, 268503696($0) addi $10, $0, 0x3d85c6 sw $10, 268503700($0) addi $10, $0, 0xffffff sw $10, 268503704($0) addi $10, $0, 0xffffff sw $10, 268503708($0) addi $10, $0, 0xffffff sw $10, 268503712($0) addi $10, $0, 0xffffff sw $10, 268503716($0) addi $10, $0, 0xb7b7b7 sw $10, 268503720($0) addi $10, $0, 0xb7b7b7 sw $10, 268503724($0) addi $10, $0, 0xb7b7b7 sw $10, 268503728($0) addi $10, $0, 0xb7b7b7 sw $10, 268503732($0) addi $10, $0, 0xb7b7b7 sw $10, 268503736($0) addi $10, $0, 0xb7b7b7 sw $10, 268503740($0) addi $10, $0, 0xb7b7b7 sw $10, 268503744($0) addi $10, $0, 0xb7b7b7 sw $10, 268503748($0) addi $10, $0, 0xb7b7b7 sw $10, 268503752($0) addi $10, $0, 0xb7b7b7 sw $10, 268503756($0) addi $10, $0, 0xb7b7b7 sw $10, 268503760($0) addi $10, $0, 0xb7b7b7 sw $10, 268503764($0) addi $10, $0, 0xb7b7b7 sw $10, 268503768($0) addi $10, $0, 0xb7b7b7 sw $10, 268503772($0) addi $10, $0, 0xb7b7b7 sw $10, 268503776($0) addi $10, $0, 0xb7b7b7 sw $10, 268503780($0) addi $10, $0, 0xb7b7b7 sw $10, 268503784($0) addi $10, $0, 0xb7b7b7 sw $10, 268503788($0) addi $10, $0, 0xb7b7b7 sw $10, 268503792($0) addi $10, $0, 0xffffff sw $10, 268503796($0) addi $10, $0, 0xffffff sw $10, 268503800($0) addi $10, $0, 0x00d800 sw $10, 268503804($0) addi $10, $0, 0x00d800 sw $10, 268503808($0) addi $10, $0, 0xffffff sw $10, 268503812($0) addi $10, $0, 0xffffff sw $10, 268503816($0) addi $10, $0, 0xf8f8f8 sw $10, 268503820($0) addi $10, $0, 0xffb000 sw $10, 268503824($0) addi $10, $0, 0xffb000 sw $10, 268503828($0) addi $10, $0, 0xffb000 sw $10, 268503832($0) addi $10, $0, 0xffb000 sw $10, 268503836($0) addi $10, $0, 0xffb000 sw $10, 268503840($0) addi $10, $0, 0xffb000 sw $10, 268503844($0) addi $10, $0, 0xffb000 sw $10, 268503848($0) addi $10, $0, 0xffb000 sw $10, 268503852($0) addi $10, $0, 0xffb000 sw $10, 268503856($0) addi $10, $0, 0xffb000 sw $10, 268503860($0) addi $10, $0, 0xffb000 sw $10, 268503864($0) addi $10, $0, 0xffb000 sw $10, 268503868($0) addi $10, $0, 0xffb000 sw $10, 268503872($0) addi $10, $0, 0xffb000 sw $10, 268503876($0) addi $10, $0, 0xffb000 sw $10, 268503880($0) addi $10, $0, 0xffb000 sw $10, 268503884($0) addi $10, $0, 0xffb000 sw $10, 268503888($0) addi $10, $0, 0xffb000 sw $10, 268503892($0) addi $10, $0, 0xffb000 sw $10, 268503896($0) addi $10, $0, 0xffb000 sw $10, 268503900($0) addi $10, $0, 0xffb000 sw $10, 268503904($0) addi $10, $0, 0xffb000 sw $10, 268503908($0) addi $10, $0, 0xffb000 sw $10, 268503912($0) addi $10, $0, 0xffb000 sw $10, 268503916($0) addi $10, $0, 0xffb000 sw $10, 268503920($0) addi $10, $0, 0xffb000 sw $10, 268503924($0) addi $10, $0, 0xffb000 sw $10, 268503928($0) addi $10, $0, 0xffb000 sw $10, 268503932($0) addi $10, $0, 0xf4f4f4 sw $10, 268503936($0) addi $10, $0, 0xfefefe sw $10, 268503940($0) addi $10, $0, 0xffffff sw $10, 268503944($0) addi $10, $0, 0xffffff sw $10, 268503948($0) addi $10, $0, 0xffffff sw $10, 268503952($0) addi $10, $0, 0xffffff sw $10, 268503956($0) addi $10, $0, 0xffffff sw $10, 268503960($0) addi $10, $0, 0xffffff sw $10, 268503964($0) addi $10, $0, 0xffffff sw $10, 268503968($0) addi $10, $0, 0xffffff sw $10, 268503972($0) addi $10, $0, 0xffffff sw $10, 268503976($0) addi $10, $0, 0xffffff sw $10, 268503980($0) addi $10, $0, 0xffffff sw $10, 268503984($0) addi $10, $0, 0xffffff sw $10, 268503988($0) addi $10, $0, 0xffffff sw $10, 268503992($0) addi $10, $0, 0xffffff sw $10, 268503996($0) addi $10, $0, 0xffffff sw $10, 268504000($0) addi $10, $0, 0xffffff sw $10, 268504004($0) addi $10, $0, 0xffffff sw $10, 268504008($0) addi $10, $0, 0xffffff sw $10, 268504012($0) addi $10, $0, 0xffffff sw $10, 268504016($0) addi $10, $0, 0xffffff sw $10, 268504020($0) addi $10, $0, 0xffffff sw $10, 268504024($0) addi $10, $0, 0xffffff sw $10, 268504028($0) addi $10, $0, 0xffffff sw $10, 268504032($0) addi $10, $0, 0xffffff sw $10, 268504036($0) addi $10, $0, 0xffffff sw $10, 268504040($0) addi $10, $0, 0xffffff sw $10, 268504044($0) addi $10, $0, 0xffffff sw $10, 268504048($0) addi $10, $0, 0xffffff sw $10, 268504052($0) addi $10, $0, 0xffffff sw $10, 268504056($0) addi $10, $0, 0x00d800 sw $10, 268504060($0) addi $10, $0, 0x00d800 sw $10, 268504064($0) addi $10, $0, 0xffffff sw $10, 268504068($0) addi $10, $0, 0xffffff sw $10, 268504072($0) addi $10, $0, 0xfcfcfc sw $10, 268504076($0) addi $10, $0, 0xf4f4f4 sw $10, 268504080($0) addi $10, $0, 0xeeeeee sw $10, 268504084($0) addi $10, $0, 0xececec sw $10, 268504088($0) addi $10, $0, 0xececec sw $10, 268504092($0) addi $10, $0, 0xececec sw $10, 268504096($0) addi $10, $0, 0xececec sw $10, 268504100($0) addi $10, $0, 0xececec sw $10, 268504104($0) addi $10, $0, 0xececec sw $10, 268504108($0) addi $10, $0, 0xececec sw $10, 268504112($0) addi $10, $0, 0xececec sw $10, 268504116($0) addi $10, $0, 0xececec sw $10, 268504120($0) addi $10, $0, 0xececec sw $10, 268504124($0) addi $10, $0, 0xececec sw $10, 268504128($0) addi $10, $0, 0xececec sw $10, 268504132($0) addi $10, $0, 0xececec sw $10, 268504136($0) addi $10, $0, 0xececec sw $10, 268504140($0) addi $10, $0, 0xececec sw $10, 268504144($0) addi $10, $0, 0xececec sw $10, 268504148($0) addi $10, $0, 0xececec sw $10, 268504152($0) addi $10, $0, 0xececec sw $10, 268504156($0) addi $10, $0, 0xececec sw $10, 268504160($0) addi $10, $0, 0xececec sw $10, 268504164($0) addi $10, $0, 0xececec sw $10, 268504168($0) addi $10, $0, 0xececec sw $10, 268504172($0) addi $10, $0, 0xececec sw $10, 268504176($0) addi $10, $0, 0xececec sw $10, 268504180($0) addi $10, $0, 0xededed sw $10, 268504184($0) addi $10, $0, 0xf2f2f2 sw $10, 268504188($0) addi $10, $0, 0xfbfbfb sw $10, 268504192($0) addi $10, $0, 0xffffff sw $10, 268504196($0) addi $10, $0, 0xffffff sw $10, 268504200($0) addi $10, $0, 0xffffff sw $10, 268504204($0) addi $10, $0, 0xffffff sw $10, 268504208($0) addi $10, $0, 0xffffff sw $10, 268504212($0) addi $10, $0, 0xffffff sw $10, 268504216($0) addi $10, $0, 0xffffff sw $10, 268504220($0) addi $10, $0, 0xffffff sw $10, 268504224($0) addi $10, $0, 0xffffff sw $10, 268504228($0) addi $10, $0, 0xffffff sw $10, 268504232($0) addi $10, $0, 0xffffff sw $10, 268504236($0) addi $10, $0, 0xffffff sw $10, 268504240($0) addi $10, $0, 0xffffff sw $10, 268504244($0) addi $10, $0, 0xffffff sw $10, 268504248($0) addi $10, $0, 0xffffff sw $10, 268504252($0) addi $10, $0, 0xffffff sw $10, 268504256($0) addi $10, $0, 0xffffff sw $10, 268504260($0) addi $10, $0, 0xffffff sw $10, 268504264($0) addi $10, $0, 0xffffff sw $10, 268504268($0) addi $10, $0, 0xffffff sw $10, 268504272($0) addi $10, $0, 0xffffff sw $10, 268504276($0) addi $10, $0, 0xffffff sw $10, 268504280($0) addi $10, $0, 0xffffff sw $10, 268504284($0) addi $10, $0, 0xffffff sw $10, 268504288($0) addi $10, $0, 0xffffff sw $10, 268504292($0) addi $10, $0, 0xffffff sw $10, 268504296($0) addi $10, $0, 0xffffff sw $10, 268504300($0) addi $10, $0, 0xffffff sw $10, 268504304($0) addi $10, $0, 0xffffff sw $10, 268504308($0) addi $10, $0, 0xffffff sw $10, 268504312($0) addi $10, $0, 0x00d800 sw $10, 268504316($0) addi $10, $0, 0x00d800 sw $10, 268504320($0) addi $10, $0, 0xffffff sw $10, 268504324($0) addi $10, $0, 0xffffff sw $10, 268504328($0) addi $10, $0, 0xffffff sw $10, 268504332($0) addi $10, $0, 0xfefefe sw $10, 268504336($0) addi $10, $0, 0xfcfcfc sw $10, 268504340($0) addi $10, $0, 0xfcfcfc sw $10, 268504344($0) addi $10, $0, 0xfcfcfc sw $10, 268504348($0) addi $10, $0, 0xfcfcfc sw $10, 268504352($0) addi $10, $0, 0xfcfcfc sw $10, 268504356($0) addi $10, $0, 0xfcfcfc sw $10, 268504360($0) addi $10, $0, 0xfcfcfc sw $10, 268504364($0) addi $10, $0, 0xfcfcfc sw $10, 268504368($0) addi $10, $0, 0xfcfcfc sw $10, 268504372($0) addi $10, $0, 0xfcfcfc sw $10, 268504376($0) addi $10, $0, 0xfcfcfc sw $10, 268504380($0) addi $10, $0, 0xfcfcfc sw $10, 268504384($0) addi $10, $0, 0xfcfcfc sw $10, 268504388($0) addi $10, $0, 0xfcfcfc sw $10, 268504392($0) addi $10, $0, 0xfcfcfc sw $10, 268504396($0) addi $10, $0, 0xfcfcfc sw $10, 268504400($0) addi $10, $0, 0xfcfcfc sw $10, 268504404($0) addi $10, $0, 0xfcfcfc sw $10, 268504408($0) addi $10, $0, 0xfcfcfc sw $10, 268504412($0) addi $10, $0, 0xfcfcfc sw $10, 268504416($0) addi $10, $0, 0xfcfcfc sw $10, 268504420($0) addi $10, $0, 0xfcfcfc sw $10, 268504424($0) addi $10, $0, 0xfcfcfc sw $10, 268504428($0) addi $10, $0, 0xfcfcfc sw $10, 268504432($0) addi $10, $0, 0xfcfcfc sw $10, 268504436($0) addi $10, $0, 0xfcfcfc sw $10, 268504440($0) addi $10, $0, 0xfdfdfd sw $10, 268504444($0) addi $10, $0, 0xffffff sw $10, 268504448($0) addi $10, $0, 0xffffff sw $10, 268504452($0) addi $10, $0, 0xffffff sw $10, 268504456($0) addi $10, $0, 0xffffff sw $10, 268504460($0) addi $10, $0, 0xffffff sw $10, 268504464($0) addi $10, $0, 0xffffff sw $10, 268504468($0) addi $10, $0, 0xffffff sw $10, 268504472($0) addi $10, $0, 0xffffff sw $10, 268504476($0) addi $10, $0, 0xffffff sw $10, 268504480($0) addi $10, $0, 0xffffff sw $10, 268504484($0) addi $10, $0, 0xffffff sw $10, 268504488($0) addi $10, $0, 0xffffff sw $10, 268504492($0) addi $10, $0, 0xffffff sw $10, 268504496($0) addi $10, $0, 0xffffff sw $10, 268504500($0) addi $10, $0, 0xffffff sw $10, 268504504($0) addi $10, $0, 0xffffff sw $10, 268504508($0) addi $10, $0, 0xffffff sw $10, 268504512($0) addi $10, $0, 0xffffff sw $10, 268504516($0) addi $10, $0, 0xffffff sw $10, 268504520($0) addi $10, $0, 0xffffff sw $10, 268504524($0) addi $10, $0, 0xffffff sw $10, 268504528($0) addi $10, $0, 0xffffff sw $10, 268504532($0) addi $10, $0, 0xffffff sw $10, 268504536($0) addi $10, $0, 0xffffff sw $10, 268504540($0) addi $10, $0, 0xffffff sw $10, 268504544($0) addi $10, $0, 0xffffff sw $10, 268504548($0) addi $10, $0, 0xffffff sw $10, 268504552($0) addi $10, $0, 0xffffff sw $10, 268504556($0) addi $10, $0, 0xffffff sw $10, 268504560($0) addi $10, $0, 0xffffff sw $10, 268504564($0) addi $10, $0, 0xffffff sw $10, 268504568($0) addi $10, $0, 0x00d800 sw $10, 268504572($0) addi $10, $0, 0x00d800 sw $10, 268504576($0) addi $10, $0, 0xffffff sw $10, 268504580($0) addi $10, $0, 0xffffff sw $10, 268504584($0) addi $10, $0, 0xffffff sw $10, 268504588($0) addi $10, $0, 0xffffff sw $10, 268504592($0) addi $10, $0, 0xffffff sw $10, 268504596($0) addi $10, $0, 0xffffff sw $10, 268504600($0) addi $10, $0, 0xffffff sw $10, 268504604($0) addi $10, $0, 0xffffff sw $10, 268504608($0) addi $10, $0, 0xffffff sw $10, 268504612($0) addi $10, $0, 0xffffff sw $10, 268504616($0) addi $10, $0, 0xffffff sw $10, 268504620($0) addi $10, $0, 0xffffff sw $10, 268504624($0) addi $10, $0, 0xffffff sw $10, 268504628($0) addi $10, $0, 0xffffff sw $10, 268504632($0) addi $10, $0, 0xffffff sw $10, 268504636($0) addi $10, $0, 0xffffff sw $10, 268504640($0) addi $10, $0, 0xffffff sw $10, 268504644($0) addi $10, $0, 0xffffff sw $10, 268504648($0) addi $10, $0, 0xffffff sw $10, 268504652($0) addi $10, $0, 0xffffff sw $10, 268504656($0) addi $10, $0, 0xffffff sw $10, 268504660($0) addi $10, $0, 0xffffff sw $10, 268504664($0) addi $10, $0, 0xffffff sw $10, 268504668($0) addi $10, $0, 0xffffff sw $10, 268504672($0) addi $10, $0, 0xffffff sw $10, 268504676($0) addi $10, $0, 0xffffff sw $10, 268504680($0) addi $10, $0, 0xffffff sw $10, 268504684($0) addi $10, $0, 0xffffff sw $10, 268504688($0) addi $10, $0, 0xffffff sw $10, 268504692($0) addi $10, $0, 0xffffff sw $10, 268504696($0) addi $10, $0, 0xffffff sw $10, 268504700($0) addi $10, $0, 0xffffff sw $10, 268504704($0) addi $10, $0, 0xffffff sw $10, 268504708($0) addi $10, $0, 0xffffff sw $10, 268504712($0) addi $10, $0, 0xffffff sw $10, 268504716($0) addi $10, $0, 0xffffff sw $10, 268504720($0) addi $10, $0, 0xffffff sw $10, 268504724($0) addi $10, $0, 0xffffff sw $10, 268504728($0) addi $10, $0, 0xffffff sw $10, 268504732($0) addi $10, $0, 0xffffff sw $10, 268504736($0) addi $10, $0, 0xffffff sw $10, 268504740($0) addi $10, $0, 0xffffff sw $10, 268504744($0) addi $10, $0, 0xffffff sw $10, 268504748($0) addi $10, $0, 0xffffff sw $10, 268504752($0) addi $10, $0, 0xffffff sw $10, 268504756($0) addi $10, $0, 0xffffff sw $10, 268504760($0) addi $10, $0, 0xffffff sw $10, 268504764($0) addi $10, $0, 0xffffff sw $10, 268504768($0) addi $10, $0, 0xffffff sw $10, 268504772($0) addi $10, $0, 0xffffff sw $10, 268504776($0) addi $10, $0, 0xffffff sw $10, 268504780($0) addi $10, $0, 0xffffff sw $10, 268504784($0) addi $10, $0, 0xffffff sw $10, 268504788($0) addi $10, $0, 0xffffff sw $10, 268504792($0) addi $10, $0, 0xffffff sw $10, 268504796($0) addi $10, $0, 0xffffff sw $10, 268504800($0) addi $10, $0, 0xffffff sw $10, 268504804($0) addi $10, $0, 0xffffff sw $10, 268504808($0) addi $10, $0, 0xffffff sw $10, 268504812($0) addi $10, $0, 0xffffff sw $10, 268504816($0) addi $10, $0, 0xffffff sw $10, 268504820($0) addi $10, $0, 0xffffff sw $10, 268504824($0) addi $10, $0, 0x00d800 sw $10, 268504828($0) addi $10, $0, 0x00d800 sw $10, 268504832($0) addi $10, $0, 0xffffff sw $10, 268504836($0) addi $10, $0, 0xffffff sw $10, 268504840($0) addi $10, $0, 0xffffff sw $10, 268504844($0) addi $10, $0, 0xffffff sw $10, 268504848($0) addi $10, $0, 0xffffff sw $10, 268504852($0) addi $10, $0, 0xffffff sw $10, 268504856($0) addi $10, $0, 0xffffff sw $10, 268504860($0) addi $10, $0, 0xffffff sw $10, 268504864($0) addi $10, $0, 0xffffff sw $10, 268504868($0) addi $10, $0, 0xffffff sw $10, 268504872($0) addi $10, $0, 0xffffff sw $10, 268504876($0) addi $10, $0, 0xffffff sw $10, 268504880($0) addi $10, $0, 0xffffff sw $10, 268504884($0) addi $10, $0, 0xffffff sw $10, 268504888($0) addi $10, $0, 0xffffff sw $10, 268504892($0) addi $10, $0, 0xffffff sw $10, 268504896($0) addi $10, $0, 0xffffff sw $10, 268504900($0) addi $10, $0, 0xffffff sw $10, 268504904($0) addi $10, $0, 0xffffff sw $10, 268504908($0) addi $10, $0, 0xffffff sw $10, 268504912($0) addi $10, $0, 0xffffff sw $10, 268504916($0) addi $10, $0, 0xffffff sw $10, 268504920($0) addi $10, $0, 0xffffff sw $10, 268504924($0) addi $10, $0, 0xffffff sw $10, 268504928($0) addi $10, $0, 0xffffff sw $10, 268504932($0) addi $10, $0, 0xffffff sw $10, 268504936($0) addi $10, $0, 0xffffff sw $10, 268504940($0) addi $10, $0, 0xffffff sw $10, 268504944($0) addi $10, $0, 0xffffff sw $10, 268504948($0) addi $10, $0, 0xffffff sw $10, 268504952($0) addi $10, $0, 0xffffff sw $10, 268504956($0) addi $10, $0, 0xffffff sw $10, 268504960($0) addi $10, $0, 0xffffff sw $10, 268504964($0) addi $10, $0, 0xffffff sw $10, 268504968($0) addi $10, $0, 0xffffff sw $10, 268504972($0) addi $10, $0, 0xffffff sw $10, 268504976($0) addi $10, $0, 0xffffff sw $10, 268504980($0) addi $10, $0, 0xffffff sw $10, 268504984($0) addi $10, $0, 0xffffff sw $10, 268504988($0) addi $10, $0, 0xffffff sw $10, 268504992($0) addi $10, $0, 0xffffff sw $10, 268504996($0) addi $10, $0, 0xffffff sw $10, 268505000($0) addi $10, $0, 0xffffff sw $10, 268505004($0) addi $10, $0, 0xffffff sw $10, 268505008($0) addi $10, $0, 0xffffff sw $10, 268505012($0) addi $10, $0, 0xffffff sw $10, 268505016($0) addi $10, $0, 0xffffff sw $10, 268505020($0) addi $10, $0, 0xffffff sw $10, 268505024($0) addi $10, $0, 0xffffff sw $10, 268505028($0) addi $10, $0, 0xffffff sw $10, 268505032($0) addi $10, $0, 0xffffff sw $10, 268505036($0) addi $10, $0, 0xffffff sw $10, 268505040($0) addi $10, $0, 0xffffff sw $10, 268505044($0) addi $10, $0, 0xffffff sw $10, 268505048($0) addi $10, $0, 0xffffff sw $10, 268505052($0) addi $10, $0, 0xffffff sw $10, 268505056($0) addi $10, $0, 0xffffff sw $10, 268505060($0) addi $10, $0, 0xffffff sw $10, 268505064($0) addi $10, $0, 0xffffff sw $10, 268505068($0) addi $10, $0, 0xffffff sw $10, 268505072($0) addi $10, $0, 0xffffff sw $10, 268505076($0) addi $10, $0, 0xffffff sw $10, 268505080($0) addi $10, $0, 0x00d800 sw $10, 268505084($0) addi $10, $0, 0x00d800 sw $10, 268505088($0) addi $10, $0, 0xffffff sw $10, 268505092($0) addi $10, $0, 0xffffff sw $10, 268505096($0) addi $10, $0, 0xffffff sw $10, 268505100($0) addi $10, $0, 0xffffff sw $10, 268505104($0) addi $10, $0, 0xffffff sw $10, 268505108($0) addi $10, $0, 0xffffff sw $10, 268505112($0) addi $10, $0, 0xffffff sw $10, 268505116($0) addi $10, $0, 0xffffff sw $10, 268505120($0) addi $10, $0, 0xffffff sw $10, 268505124($0) addi $10, $0, 0xffffff sw $10, 268505128($0) addi $10, $0, 0xffffff sw $10, 268505132($0) addi $10, $0, 0xffffff sw $10, 268505136($0) addi $10, $0, 0xffffff sw $10, 268505140($0) addi $10, $0, 0xffffff sw $10, 268505144($0) addi $10, $0, 0xffffff sw $10, 268505148($0) addi $10, $0, 0xffffff sw $10, 268505152($0) addi $10, $0, 0xffffff sw $10, 268505156($0) addi $10, $0, 0xffffff sw $10, 268505160($0) addi $10, $0, 0xffffff sw $10, 268505164($0) addi $10, $0, 0xffffff sw $10, 268505168($0) addi $10, $0, 0xffffff sw $10, 268505172($0) addi $10, $0, 0xffffff sw $10, 268505176($0) addi $10, $0, 0xffffff sw $10, 268505180($0) addi $10, $0, 0xffffff sw $10, 268505184($0) addi $10, $0, 0xffffff sw $10, 268505188($0) addi $10, $0, 0xffffff sw $10, 268505192($0) addi $10, $0, 0xffffff sw $10, 268505196($0) addi $10, $0, 0xffffff sw $10, 268505200($0) addi $10, $0, 0xffffff sw $10, 268505204($0) addi $10, $0, 0xffffff sw $10, 268505208($0) addi $10, $0, 0xffffff sw $10, 268505212($0) addi $10, $0, 0xffffff sw $10, 268505216($0) addi $10, $0, 0xffffff sw $10, 268505220($0) addi $10, $0, 0xffffff sw $10, 268505224($0) addi $10, $0, 0xffffff sw $10, 268505228($0) addi $10, $0, 0xffffff sw $10, 268505232($0) addi $10, $0, 0xffffff sw $10, 268505236($0) addi $10, $0, 0xffffff sw $10, 268505240($0) addi $10, $0, 0xffffff sw $10, 268505244($0) addi $10, $0, 0xffffff sw $10, 268505248($0) addi $10, $0, 0xffffff sw $10, 268505252($0) addi $10, $0, 0xffffff sw $10, 268505256($0) addi $10, $0, 0xffffff sw $10, 268505260($0) addi $10, $0, 0xffffff sw $10, 268505264($0) addi $10, $0, 0xffffff sw $10, 268505268($0) addi $10, $0, 0xffffff sw $10, 268505272($0) addi $10, $0, 0xffffff sw $10, 268505276($0) addi $10, $0, 0xffffff sw $10, 268505280($0) addi $10, $0, 0xffffff sw $10, 268505284($0) addi $10, $0, 0xffffff sw $10, 268505288($0) addi $10, $0, 0xffffff sw $10, 268505292($0) addi $10, $0, 0xffffff sw $10, 268505296($0) addi $10, $0, 0xffffff sw $10, 268505300($0) addi $10, $0, 0xffffff sw $10, 268505304($0) addi $10, $0, 0xffffff sw $10, 268505308($0) addi $10, $0, 0xffffff sw $10, 268505312($0) addi $10, $0, 0xffffff sw $10, 268505316($0) addi $10, $0, 0xffffff sw $10, 268505320($0) addi $10, $0, 0xffffff sw $10, 268505324($0) addi $10, $0, 0xffffff sw $10, 268505328($0) addi $10, $0, 0xffffff sw $10, 268505332($0) addi $10, $0, 0xffffff sw $10, 268505336($0) addi $10, $0, 0x00d800 sw $10, 268505340($0) addi $10, $0, 0x00d800 sw $10, 268505344($0) addi $10, $0, 0xffffff sw $10, 268505348($0) addi $10, $0, 0xffffff sw $10, 268505352($0) addi $10, $0, 0xffffff sw $10, 268505356($0) addi $10, $0, 0xffffff sw $10, 268505360($0) addi $10, $0, 0xffffff sw $10, 268505364($0) addi $10, $0, 0xffffff sw $10, 268505368($0) addi $10, $0, 0xffffff sw $10, 268505372($0) addi $10, $0, 0xffffff sw $10, 268505376($0) addi $10, $0, 0xffffff sw $10, 268505380($0) addi $10, $0, 0xffffff sw $10, 268505384($0) addi $10, $0, 0xffffff sw $10, 268505388($0) addi $10, $0, 0xffffff sw $10, 268505392($0) addi $10, $0, 0xffffff sw $10, 268505396($0) addi $10, $0, 0xffffff sw $10, 268505400($0) addi $10, $0, 0xffffff sw $10, 268505404($0) addi $10, $0, 0xffffff sw $10, 268505408($0) addi $10, $0, 0xffffff sw $10, 268505412($0) addi $10, $0, 0xffffff sw $10, 268505416($0) addi $10, $0, 0xffffff sw $10, 268505420($0) addi $10, $0, 0xffffff sw $10, 268505424($0) addi $10, $0, 0xffffff sw $10, 268505428($0) addi $10, $0, 0xffffff sw $10, 268505432($0) addi $10, $0, 0xffffff sw $10, 268505436($0) addi $10, $0, 0xffffff sw $10, 268505440($0) addi $10, $0, 0xffffff sw $10, 268505444($0) addi $10, $0, 0xffffff sw $10, 268505448($0) addi $10, $0, 0xffffff sw $10, 268505452($0) addi $10, $0, 0xffffff sw $10, 268505456($0) addi $10, $0, 0xffffff sw $10, 268505460($0) addi $10, $0, 0xffffff sw $10, 268505464($0) addi $10, $0, 0xffffff sw $10, 268505468($0) addi $10, $0, 0xffffff sw $10, 268505472($0) addi $10, $0, 0xffffff sw $10, 268505476($0) addi $10, $0, 0xffffff sw $10, 268505480($0) addi $10, $0, 0xffffff sw $10, 268505484($0) addi $10, $0, 0xffffff sw $10, 268505488($0) addi $10, $0, 0xffffff sw $10, 268505492($0) addi $10, $0, 0xffffff sw $10, 268505496($0) addi $10, $0, 0xffffff sw $10, 268505500($0) addi $10, $0, 0xffffff sw $10, 268505504($0) addi $10, $0, 0xffffff sw $10, 268505508($0) addi $10, $0, 0xffffff sw $10, 268505512($0) addi $10, $0, 0xffffff sw $10, 268505516($0) addi $10, $0, 0xffffff sw $10, 268505520($0) addi $10, $0, 0xffffff sw $10, 268505524($0) addi $10, $0, 0xffffff sw $10, 268505528($0) addi $10, $0, 0xffffff sw $10, 268505532($0) addi $10, $0, 0xffffff sw $10, 268505536($0) addi $10, $0, 0xffffff sw $10, 268505540($0) addi $10, $0, 0xffffff sw $10, 268505544($0) addi $10, $0, 0xffffff sw $10, 268505548($0) addi $10, $0, 0xffffff sw $10, 268505552($0) addi $10, $0, 0xffffff sw $10, 268505556($0) addi $10, $0, 0xffffff sw $10, 268505560($0) addi $10, $0, 0xffffff sw $10, 268505564($0) addi $10, $0, 0xffffff sw $10, 268505568($0) addi $10, $0, 0xffffff sw $10, 268505572($0) addi $10, $0, 0xffffff sw $10, 268505576($0) addi $10, $0, 0xffffff sw $10, 268505580($0) addi $10, $0, 0xffffff sw $10, 268505584($0) addi $10, $0, 0xffffff sw $10, 268505588($0) addi $10, $0, 0xffffff sw $10, 268505592($0) addi $10, $0, 0x00d800 sw $10, 268505596($0) addi $10, $0, 0x00d800 sw $10, 268505600($0) addi $10, $0, 0xffffff sw $10, 268505604($0) addi $10, $0, 0xffffff sw $10, 268505608($0) addi $10, $0, 0xffffff sw $10, 268505612($0) addi $10, $0, 0xffffff sw $10, 268505616($0) addi $10, $0, 0xffffff sw $10, 268505620($0) addi $10, $0, 0xffffff sw $10, 268505624($0) addi $10, $0, 0xffffff sw $10, 268505628($0) addi $10, $0, 0xffffff sw $10, 268505632($0) addi $10, $0, 0xffffff sw $10, 268505636($0) addi $10, $0, 0xffffff sw $10, 268505640($0) addi $10, $0, 0xffffff sw $10, 268505644($0) addi $10, $0, 0xffffff sw $10, 268505648($0) addi $10, $0, 0xffffff sw $10, 268505652($0) addi $10, $0, 0xffffff sw $10, 268505656($0) addi $10, $0, 0xffffff sw $10, 268505660($0) addi $10, $0, 0xffffff sw $10, 268505664($0) addi $10, $0, 0xffffff sw $10, 268505668($0) addi $10, $0, 0xffffff sw $10, 268505672($0) addi $10, $0, 0xffffff sw $10, 268505676($0) addi $10, $0, 0xffffff sw $10, 268505680($0) addi $10, $0, 0xffffff sw $10, 268505684($0) addi $10, $0, 0xffffff sw $10, 268505688($0) addi $10, $0, 0xffffff sw $10, 268505692($0) addi $10, $0, 0xffffff sw $10, 268505696($0) addi $10, $0, 0xffffff sw $10, 268505700($0) addi $10, $0, 0xffffff sw $10, 268505704($0) addi $10, $0, 0xffffff sw $10, 268505708($0) addi $10, $0, 0xffffff sw $10, 268505712($0) addi $10, $0, 0xffffff sw $10, 268505716($0) addi $10, $0, 0xffffff sw $10, 268505720($0) addi $10, $0, 0xffffff sw $10, 268505724($0) addi $10, $0, 0xffffff sw $10, 268505728($0) addi $10, $0, 0xffffff sw $10, 268505732($0) addi $10, $0, 0xffffff sw $10, 268505736($0) addi $10, $0, 0xffffff sw $10, 268505740($0) addi $10, $0, 0xffffff sw $10, 268505744($0) addi $10, $0, 0xffffff sw $10, 268505748($0) addi $10, $0, 0xffffff sw $10, 268505752($0) addi $10, $0, 0xffffff sw $10, 268505756($0) addi $10, $0, 0xffffff sw $10, 268505760($0) addi $10, $0, 0xffffff sw $10, 268505764($0) addi $10, $0, 0xffffff sw $10, 268505768($0) addi $10, $0, 0xffffff sw $10, 268505772($0) addi $10, $0, 0xffffff sw $10, 268505776($0) addi $10, $0, 0xffffff sw $10, 268505780($0) addi $10, $0, 0xffffff sw $10, 268505784($0) addi $10, $0, 0xffffff sw $10, 268505788($0) addi $10, $0, 0xffffff sw $10, 268505792($0) addi $10, $0, 0xffffff sw $10, 268505796($0) addi $10, $0, 0xffffff sw $10, 268505800($0) addi $10, $0, 0xffffff sw $10, 268505804($0) addi $10, $0, 0xffffff sw $10, 268505808($0) addi $10, $0, 0xffffff sw $10, 268505812($0) addi $10, $0, 0xffffff sw $10, 268505816($0) addi $10, $0, 0xffffff sw $10, 268505820($0) addi $10, $0, 0xffffff sw $10, 268505824($0) addi $10, $0, 0xffffff sw $10, 268505828($0) addi $10, $0, 0xffffff sw $10, 268505832($0) addi $10, $0, 0xffffff sw $10, 268505836($0) addi $10, $0, 0xffffff sw $10, 268505840($0) addi $10, $0, 0xffffff sw $10, 268505844($0) addi $10, $0, 0xffffff sw $10, 268505848($0) addi $10, $0, 0x00d800 sw $10, 268505852($0) addi $10, $0, 0x00d800 sw $10, 268505856($0) addi $10, $0, 0xffffff sw $10, 268505860($0) addi $10, $0, 0xffffff sw $10, 268505864($0) addi $10, $0, 0xffffff sw $10, 268505868($0) addi $10, $0, 0xffffff sw $10, 268505872($0) addi $10, $0, 0xffffff sw $10, 268505876($0) addi $10, $0, 0xffffff sw $10, 268505880($0) addi $10, $0, 0xffffff sw $10, 268505884($0) addi $10, $0, 0xffffff sw $10, 268505888($0) addi $10, $0, 0xffffff sw $10, 268505892($0) addi $10, $0, 0xffffff sw $10, 268505896($0) addi $10, $0, 0xffffff sw $10, 268505900($0) addi $10, $0, 0xffffff sw $10, 268505904($0) addi $10, $0, 0xffffff sw $10, 268505908($0) addi $10, $0, 0xffffff sw $10, 268505912($0) addi $10, $0, 0xffffff sw $10, 268505916($0) addi $10, $0, 0xffffff sw $10, 268505920($0) addi $10, $0, 0xffffff sw $10, 268505924($0) addi $10, $0, 0xffffff sw $10, 268505928($0) addi $10, $0, 0xffffff sw $10, 268505932($0) addi $10, $0, 0xffffff sw $10, 268505936($0) addi $10, $0, 0xffffff sw $10, 268505940($0) addi $10, $0, 0xffffff sw $10, 268505944($0) addi $10, $0, 0xefefef sw $10, 268505948($0) addi $10, $0, 0xffffff sw $10, 268505952($0) addi $10, $0, 0xffffff sw $10, 268505956($0) addi $10, $0, 0xfafafa sw $10, 268505960($0) addi $10, $0, 0xffffff sw $10, 268505964($0) addi $10, $0, 0xf5f5f5 sw $10, 268505968($0) addi $10, $0, 0xffffff sw $10, 268505972($0) addi $10, $0, 0xffffff sw $10, 268505976($0) addi $10, $0, 0xffffff sw $10, 268505980($0) addi $10, $0, 0xffffff sw $10, 268505984($0) addi $10, $0, 0xffffff sw $10, 268505988($0) addi $10, $0, 0xffffff sw $10, 268505992($0) addi $10, $0, 0xffffff sw $10, 268505996($0) addi $10, $0, 0xffffff sw $10, 268506000($0) addi $10, $0, 0xffffff sw $10, 268506004($0) addi $10, $0, 0xffffff sw $10, 268506008($0) addi $10, $0, 0xffffff sw $10, 268506012($0) addi $10, $0, 0xffffff sw $10, 268506016($0) addi $10, $0, 0xffffff sw $10, 268506020($0) addi $10, $0, 0xffffff sw $10, 268506024($0) addi $10, $0, 0xffffff sw $10, 268506028($0) addi $10, $0, 0xffffff sw $10, 268506032($0) addi $10, $0, 0xffffff sw $10, 268506036($0) addi $10, $0, 0xffffff sw $10, 268506040($0) addi $10, $0, 0xffffff sw $10, 268506044($0) addi $10, $0, 0xffffff sw $10, 268506048($0) addi $10, $0, 0xffffff sw $10, 268506052($0) addi $10, $0, 0xffffff sw $10, 268506056($0) addi $10, $0, 0xffffff sw $10, 268506060($0) addi $10, $0, 0xffffff sw $10, 268506064($0) addi $10, $0, 0xffffff sw $10, 268506068($0) addi $10, $0, 0xffffff sw $10, 268506072($0) addi $10, $0, 0xffffff sw $10, 268506076($0) addi $10, $0, 0xffffff sw $10, 268506080($0) addi $10, $0, 0xffffff sw $10, 268506084($0) addi $10, $0, 0xffffff sw $10, 268506088($0) addi $10, $0, 0xffffff sw $10, 268506092($0) addi $10, $0, 0xffffff sw $10, 268506096($0) addi $10, $0, 0xffffff sw $10, 268506100($0) addi $10, $0, 0xffffff sw $10, 268506104($0) addi $10, $0, 0x00d800 sw $10, 268506108($0) addi $10, $0, 0x00d800 sw $10, 268506112($0) addi $10, $0, 0xffffff sw $10, 268506116($0) addi $10, $0, 0xffffff sw $10, 268506120($0) addi $10, $0, 0xffffff sw $10, 268506124($0) addi $10, $0, 0xffffff sw $10, 268506128($0) addi $10, $0, 0xffffff sw $10, 268506132($0) addi $10, $0, 0xffffff sw $10, 268506136($0) addi $10, $0, 0xffffff sw $10, 268506140($0) addi $10, $0, 0xffffff sw $10, 268506144($0) addi $10, $0, 0xffffff sw $10, 268506148($0) addi $10, $0, 0xffffff sw $10, 268506152($0) addi $10, $0, 0xffffff sw $10, 268506156($0) addi $10, $0, 0xffffff sw $10, 268506160($0) addi $10, $0, 0xffffff sw $10, 268506164($0) addi $10, $0, 0xffffff sw $10, 268506168($0) addi $10, $0, 0xffffff sw $10, 268506172($0) addi $10, $0, 0xffffff sw $10, 268506176($0) addi $10, $0, 0xffffff sw $10, 268506180($0) addi $10, $0, 0xffffff sw $10, 268506184($0) addi $10, $0, 0xffffff sw $10, 268506188($0) addi $10, $0, 0xffffff sw $10, 268506192($0) addi $10, $0, 0xffffff sw $10, 268506196($0) addi $10, $0, 0xffffff sw $10, 268506200($0) addi $10, $0, 0xfdfdfd sw $10, 268506204($0) addi $10, $0, 0xf3f3f3 sw $10, 268506208($0) addi $10, $0, 0xffffff sw $10, 268506212($0) addi $10, $0, 0xfefefe sw $10, 268506216($0) addi $10, $0, 0xf4f4f4 sw $10, 268506220($0) addi $10, $0, 0xffffff sw $10, 268506224($0) addi $10, $0, 0xffffff sw $10, 268506228($0) addi $10, $0, 0x020001 sw $10, 268506232($0) addi $10, $0, 0x020001 sw $10, 268506236($0) addi $10, $0, 0x020001 sw $10, 268506240($0) addi $10, $0, 0x020001 sw $10, 268506244($0) addi $10, $0, 0xfdfdfd sw $10, 268506248($0) addi $10, $0, 0xffffff sw $10, 268506252($0) addi $10, $0, 0xffffff sw $10, 268506256($0) addi $10, $0, 0xffffff sw $10, 268506260($0) addi $10, $0, 0xffffff sw $10, 268506264($0) addi $10, $0, 0xffffff sw $10, 268506268($0) addi $10, $0, 0xffffff sw $10, 268506272($0) addi $10, $0, 0xffffff sw $10, 268506276($0) addi $10, $0, 0xffffff sw $10, 268506280($0) addi $10, $0, 0xffffff sw $10, 268506284($0) addi $10, $0, 0xffffff sw $10, 268506288($0) addi $10, $0, 0xffffff sw $10, 268506292($0) addi $10, $0, 0xffffff sw $10, 268506296($0) addi $10, $0, 0xffffff sw $10, 268506300($0) addi $10, $0, 0xffffff sw $10, 268506304($0) addi $10, $0, 0xffffff sw $10, 268506308($0) addi $10, $0, 0xffffff sw $10, 268506312($0) addi $10, $0, 0xffffff sw $10, 268506316($0) addi $10, $0, 0xffffff sw $10, 268506320($0) addi $10, $0, 0xffffff sw $10, 268506324($0) addi $10, $0, 0xffffff sw $10, 268506328($0) addi $10, $0, 0xffffff sw $10, 268506332($0) addi $10, $0, 0xffffff sw $10, 268506336($0) addi $10, $0, 0xffffff sw $10, 268506340($0) addi $10, $0, 0xffffff sw $10, 268506344($0) addi $10, $0, 0xffffff sw $10, 268506348($0) addi $10, $0, 0xffffff sw $10, 268506352($0) addi $10, $0, 0xffffff sw $10, 268506356($0) addi $10, $0, 0xffffff sw $10, 268506360($0) addi $10, $0, 0x00d800 sw $10, 268506364($0) addi $10, $0, 0x00d800 sw $10, 268506368($0) addi $10, $0, 0xffffff sw $10, 268506372($0) addi $10, $0, 0xffffff sw $10, 268506376($0) addi $10, $0, 0xffffff sw $10, 268506380($0) addi $10, $0, 0xffffff sw $10, 268506384($0) addi $10, $0, 0xffffff sw $10, 268506388($0) addi $10, $0, 0xffffff sw $10, 268506392($0) addi $10, $0, 0xffffff sw $10, 268506396($0) addi $10, $0, 0xffffff sw $10, 268506400($0) addi $10, $0, 0xffffff sw $10, 268506404($0) addi $10, $0, 0xffffff sw $10, 268506408($0) addi $10, $0, 0xffffff sw $10, 268506412($0) addi $10, $0, 0xffffff sw $10, 268506416($0) addi $10, $0, 0xffffff sw $10, 268506420($0) addi $10, $0, 0xffffff sw $10, 268506424($0) addi $10, $0, 0xffffff sw $10, 268506428($0) addi $10, $0, 0xffffff sw $10, 268506432($0) addi $10, $0, 0xffffff sw $10, 268506436($0) addi $10, $0, 0xffffff sw $10, 268506440($0) addi $10, $0, 0xffffff sw $10, 268506444($0) addi $10, $0, 0xffffff sw $10, 268506448($0) addi $10, $0, 0xffffff sw $10, 268506452($0) addi $10, $0, 0xffffff sw $10, 268506456($0) addi $10, $0, 0xffffff sw $10, 268506460($0) addi $10, $0, 0xffffff sw $10, 268506464($0) addi $10, $0, 0xf5f5f5 sw $10, 268506468($0) addi $10, $0, 0xf5f5f5 sw $10, 268506472($0) addi $10, $0, 0xffffff sw $10, 268506476($0) addi $10, $0, 0xcdcdcd sw $10, 268506480($0) addi $10, $0, 0xc5cecf sw $10, 268506484($0) addi $10, $0, 0x400102 sw $10, 268506488($0) addi $10, $0, 0x400102 sw $10, 268506492($0) addi $10, $0, 0x400102 sw $10, 268506496($0) addi $10, $0, 0x3f0101 sw $10, 268506500($0) addi $10, $0, 0xc9c9c4 sw $10, 268506504($0) addi $10, $0, 0xcacaca sw $10, 268506508($0) addi $10, $0, 0xffffff sw $10, 268506512($0) addi $10, $0, 0xffffff sw $10, 268506516($0) addi $10, $0, 0xffffff sw $10, 268506520($0) addi $10, $0, 0xffffff sw $10, 268506524($0) addi $10, $0, 0xffffff sw $10, 268506528($0) addi $10, $0, 0xffffff sw $10, 268506532($0) addi $10, $0, 0xffffff sw $10, 268506536($0) addi $10, $0, 0xffffff sw $10, 268506540($0) addi $10, $0, 0xffffff sw $10, 268506544($0) addi $10, $0, 0xffffff sw $10, 268506548($0) addi $10, $0, 0xffffff sw $10, 268506552($0) addi $10, $0, 0xffffff sw $10, 268506556($0) addi $10, $0, 0xffffff sw $10, 268506560($0) addi $10, $0, 0xffffff sw $10, 268506564($0) addi $10, $0, 0xffffff sw $10, 268506568($0) addi $10, $0, 0xffffff sw $10, 268506572($0) addi $10, $0, 0xffffff sw $10, 268506576($0) addi $10, $0, 0xffffff sw $10, 268506580($0) addi $10, $0, 0xffffff sw $10, 268506584($0) addi $10, $0, 0xffffff sw $10, 268506588($0) addi $10, $0, 0xffffff sw $10, 268506592($0) addi $10, $0, 0xffffff sw $10, 268506596($0) addi $10, $0, 0xffffff sw $10, 268506600($0) addi $10, $0, 0xffffff sw $10, 268506604($0) addi $10, $0, 0xffffff sw $10, 268506608($0) addi $10, $0, 0xffffff sw $10, 268506612($0) addi $10, $0, 0xffffff sw $10, 268506616($0) addi $10, $0, 0x00d800 sw $10, 268506620($0) addi $10, $0, 0x00d800 sw $10, 268506624($0) addi $10, $0, 0xffffff sw $10, 268506628($0) addi $10, $0, 0xffffff sw $10, 268506632($0) addi $10, $0, 0xffffff sw $10, 268506636($0) addi $10, $0, 0xffffff sw $10, 268506640($0) addi $10, $0, 0xffffff sw $10, 268506644($0) addi $10, $0, 0xffffff sw $10, 268506648($0) addi $10, $0, 0xffffff sw $10, 268506652($0) addi $10, $0, 0xffffff sw $10, 268506656($0) addi $10, $0, 0xffffff sw $10, 268506660($0) addi $10, $0, 0xffffff sw $10, 268506664($0) addi $10, $0, 0xffffff sw $10, 268506668($0) addi $10, $0, 0xffffff sw $10, 268506672($0) addi $10, $0, 0xffffff sw $10, 268506676($0) addi $10, $0, 0xffffff sw $10, 268506680($0) addi $10, $0, 0xffffff sw $10, 268506684($0) addi $10, $0, 0xffffff sw $10, 268506688($0) addi $10, $0, 0xffffff sw $10, 268506692($0) addi $10, $0, 0xffffff sw $10, 268506696($0) addi $10, $0, 0xffffff sw $10, 268506700($0) addi $10, $0, 0xffffff sw $10, 268506704($0) addi $10, $0, 0xffffff sw $10, 268506708($0) addi $10, $0, 0xffffff sw $10, 268506712($0) addi $10, $0, 0xffffff sw $10, 268506716($0) addi $10, $0, 0xffffff sw $10, 268506720($0) addi $10, $0, 0xffffff sw $10, 268506724($0) addi $10, $0, 0xffffff sw $10, 268506728($0) addi $10, $0, 0xffffff sw $10, 268506732($0) addi $10, $0, 0x070103 sw $10, 268506736($0) addi $10, $0, 0x070207 sw $10, 268506740($0) addi $10, $0, 0xe80001 sw $10, 268506744($0) addi $10, $0, 0xe20002 sw $10, 268506748($0) addi $10, $0, 0xe20002 sw $10, 268506752($0) addi $10, $0, 0xe20002 sw $10, 268506756($0) addi $10, $0, 0x100101 sw $10, 268506760($0) addi $10, $0, 0x020203 sw $10, 268506764($0) addi $10, $0, 0xffffff sw $10, 268506768($0) addi $10, $0, 0xffffff sw $10, 268506772($0) addi $10, $0, 0xffffff sw $10, 268506776($0) addi $10, $0, 0xffffff sw $10, 268506780($0) addi $10, $0, 0xffffff sw $10, 268506784($0) addi $10, $0, 0xffffff sw $10, 268506788($0) addi $10, $0, 0xffffff sw $10, 268506792($0) addi $10, $0, 0xffffff sw $10, 268506796($0) addi $10, $0, 0xffffff sw $10, 268506800($0) addi $10, $0, 0xffffff sw $10, 268506804($0) addi $10, $0, 0xffffff sw $10, 268506808($0) addi $10, $0, 0xffffff sw $10, 268506812($0) addi $10, $0, 0xffffff sw $10, 268506816($0) addi $10, $0, 0xffffff sw $10, 268506820($0) addi $10, $0, 0xffffff sw $10, 268506824($0) addi $10, $0, 0xffffff sw $10, 268506828($0) addi $10, $0, 0xffffff sw $10, 268506832($0) addi $10, $0, 0xffffff sw $10, 268506836($0) addi $10, $0, 0xffffff sw $10, 268506840($0) addi $10, $0, 0xffffff sw $10, 268506844($0) addi $10, $0, 0xffffff sw $10, 268506848($0) addi $10, $0, 0xffffff sw $10, 268506852($0) addi $10, $0, 0xffffff sw $10, 268506856($0) addi $10, $0, 0xffffff sw $10, 268506860($0) addi $10, $0, 0xffffff sw $10, 268506864($0) addi $10, $0, 0xffffff sw $10, 268506868($0) addi $10, $0, 0xffffff sw $10, 268506872($0) addi $10, $0, 0x00d800 sw $10, 268506876($0) addi $10, $0, 0x00d800 sw $10, 268506880($0) addi $10, $0, 0xffffff sw $10, 268506884($0) addi $10, $0, 0xffffff sw $10, 268506888($0) addi $10, $0, 0xffffff sw $10, 268506892($0) addi $10, $0, 0xffffff sw $10, 268506896($0) addi $10, $0, 0xffffff sw $10, 268506900($0) addi $10, $0, 0xffffff sw $10, 268506904($0) addi $10, $0, 0xffffff sw $10, 268506908($0) addi $10, $0, 0xffffff sw $10, 268506912($0) addi $10, $0, 0xffffff sw $10, 268506916($0) addi $10, $0, 0xffffff sw $10, 268506920($0) addi $10, $0, 0xffffff sw $10, 268506924($0) addi $10, $0, 0xffffff sw $10, 268506928($0) addi $10, $0, 0xffffff sw $10, 268506932($0) addi $10, $0, 0xffffff sw $10, 268506936($0) addi $10, $0, 0xffffff sw $10, 268506940($0) addi $10, $0, 0xffffff sw $10, 268506944($0) addi $10, $0, 0xffffff sw $10, 268506948($0) addi $10, $0, 0xffffff sw $10, 268506952($0) addi $10, $0, 0xffffff sw $10, 268506956($0) addi $10, $0, 0xffffff sw $10, 268506960($0) addi $10, $0, 0xffffff sw $10, 268506964($0) addi $10, $0, 0xffffff sw $10, 268506968($0) addi $10, $0, 0xffffff sw $10, 268506972($0) addi $10, $0, 0xffffff sw $10, 268506976($0) addi $10, $0, 0x020001 sw $10, 268506980($0) addi $10, $0, 0x020001 sw $10, 268506984($0) addi $10, $0, 0x020001 sw $10, 268506988($0) addi $10, $0, 0xdb0500 sw $10, 268506992($0) addi $10, $0, 0xd70602 sw $10, 268506996($0) addi $10, $0, 0xf7ffff sw $10, 268507000($0) addi $10, $0, 0xe12822 sw $10, 268507004($0) addi $10, $0, 0xe60004 sw $10, 268507008($0) addi $10, $0, 0xe20002 sw $10, 268507012($0) addi $10, $0, 0xe10102 sw $10, 268507016($0) addi $10, $0, 0xde0500 sw $10, 268507020($0) addi $10, $0, 0x020302 sw $10, 268507024($0) addi $10, $0, 0x020001 sw $10, 268507028($0) addi $10, $0, 0x020001 sw $10, 268507032($0) addi $10, $0, 0xffffff sw $10, 268507036($0) addi $10, $0, 0xffffff sw $10, 268507040($0) addi $10, $0, 0xffffff sw $10, 268507044($0) addi $10, $0, 0xffffff sw $10, 268507048($0) addi $10, $0, 0xffffff sw $10, 268507052($0) addi $10, $0, 0xffffff sw $10, 268507056($0) addi $10, $0, 0xffffff sw $10, 268507060($0) addi $10, $0, 0xffffff sw $10, 268507064($0) addi $10, $0, 0xffffff sw $10, 268507068($0) addi $10, $0, 0xffffff sw $10, 268507072($0) addi $10, $0, 0xffffff sw $10, 268507076($0) addi $10, $0, 0xffffff sw $10, 268507080($0) addi $10, $0, 0xffffff sw $10, 268507084($0) addi $10, $0, 0xffffff sw $10, 268507088($0) addi $10, $0, 0xffffff sw $10, 268507092($0) addi $10, $0, 0xffffff sw $10, 268507096($0) addi $10, $0, 0xffffff sw $10, 268507100($0) addi $10, $0, 0xffffff sw $10, 268507104($0) addi $10, $0, 0xffffff sw $10, 268507108($0) addi $10, $0, 0xffffff sw $10, 268507112($0) addi $10, $0, 0xffffff sw $10, 268507116($0) addi $10, $0, 0xffffff sw $10, 268507120($0) addi $10, $0, 0xffffff sw $10, 268507124($0) addi $10, $0, 0xffffff sw $10, 268507128($0) addi $10, $0, 0x00d800 sw $10, 268507132($0) addi $10, $0, 0x00d800 sw $10, 268507136($0) addi $10, $0, 0xffffff sw $10, 268507140($0) addi $10, $0, 0xffffff sw $10, 268507144($0) addi $10, $0, 0xffffff sw $10, 268507148($0) addi $10, $0, 0xffffff sw $10, 268507152($0) addi $10, $0, 0xffffff sw $10, 268507156($0) addi $10, $0, 0xffffff sw $10, 268507160($0) addi $10, $0, 0xffffff sw $10, 268507164($0) addi $10, $0, 0xffffff sw $10, 268507168($0) addi $10, $0, 0xffffff sw $10, 268507172($0) addi $10, $0, 0xffffff sw $10, 268507176($0) addi $10, $0, 0xffffff sw $10, 268507180($0) addi $10, $0, 0xffffff sw $10, 268507184($0) addi $10, $0, 0xffffff sw $10, 268507188($0) addi $10, $0, 0xffffff sw $10, 268507192($0) addi $10, $0, 0xffffff sw $10, 268507196($0) addi $10, $0, 0xffffff sw $10, 268507200($0) addi $10, $0, 0xffffff sw $10, 268507204($0) addi $10, $0, 0xffffff sw $10, 268507208($0) addi $10, $0, 0xffffff sw $10, 268507212($0) addi $10, $0, 0xffffff sw $10, 268507216($0) addi $10, $0, 0xffffff sw $10, 268507220($0) addi $10, $0, 0xffffff sw $10, 268507224($0) addi $10, $0, 0xf2f1f2 sw $10, 268507228($0) addi $10, $0, 0xe5e3e4 sw $10, 268507232($0) addi $10, $0, 0x191919 sw $10, 268507236($0) addi $10, $0, 0x191919 sw $10, 268507240($0) addi $10, $0, 0x191919 sw $10, 268507244($0) addi $10, $0, 0xe00702 sw $10, 268507248($0) addi $10, $0, 0xdb030a sw $10, 268507252($0) addi $10, $0, 0xf8dcd3 sw $10, 268507256($0) addi $10, $0, 0xde0105 sw $10, 268507260($0) addi $10, $0, 0xe42722 sw $10, 268507264($0) addi $10, $0, 0xe20004 sw $10, 268507268($0) addi $10, $0, 0xe20002 sw $10, 268507272($0) addi $10, $0, 0xdd0401 sw $10, 268507276($0) addi $10, $0, 0x191919 sw $10, 268507280($0) addi $10, $0, 0x191919 sw $10, 268507284($0) addi $10, $0, 0x191919 sw $10, 268507288($0) addi $10, $0, 0xe5e3e4 sw $10, 268507292($0) addi $10, $0, 0xe7e6e6 sw $10, 268507296($0) addi $10, $0, 0xffffff sw $10, 268507300($0) addi $10, $0, 0xffffff sw $10, 268507304($0) addi $10, $0, 0xffffff sw $10, 268507308($0) addi $10, $0, 0xffffff sw $10, 268507312($0) addi $10, $0, 0xffffff sw $10, 268507316($0) addi $10, $0, 0xffffff sw $10, 268507320($0) addi $10, $0, 0xffffff sw $10, 268507324($0) addi $10, $0, 0xffffff sw $10, 268507328($0) addi $10, $0, 0xffffff sw $10, 268507332($0) addi $10, $0, 0xffffff sw $10, 268507336($0) addi $10, $0, 0xffffff sw $10, 268507340($0) addi $10, $0, 0xffffff sw $10, 268507344($0) addi $10, $0, 0xffffff sw $10, 268507348($0) addi $10, $0, 0xffffff sw $10, 268507352($0) addi $10, $0, 0xffffff sw $10, 268507356($0) addi $10, $0, 0xffffff sw $10, 268507360($0) addi $10, $0, 0xffffff sw $10, 268507364($0) addi $10, $0, 0xffffff sw $10, 268507368($0) addi $10, $0, 0xffffff sw $10, 268507372($0) addi $10, $0, 0xffffff sw $10, 268507376($0) addi $10, $0, 0xffffff sw $10, 268507380($0) addi $10, $0, 0xffffff sw $10, 268507384($0) addi $10, $0, 0x00d800 sw $10, 268507388($0) addi $10, $0, 0x00d800 sw $10, 268507392($0) addi $10, $0, 0xffffff sw $10, 268507396($0) addi $10, $0, 0xffffff sw $10, 268507400($0) addi $10, $0, 0xffffff sw $10, 268507404($0) addi $10, $0, 0xffffff sw $10, 268507408($0) addi $10, $0, 0xffffff sw $10, 268507412($0) addi $10, $0, 0xffffff sw $10, 268507416($0) addi $10, $0, 0xffffff sw $10, 268507420($0) addi $10, $0, 0xffffff sw $10, 268507424($0) addi $10, $0, 0xffffff sw $10, 268507428($0) addi $10, $0, 0xffffff sw $10, 268507432($0) addi $10, $0, 0xffffff sw $10, 268507436($0) addi $10, $0, 0xffffff sw $10, 268507440($0) addi $10, $0, 0xffffff sw $10, 268507444($0) addi $10, $0, 0xffffff sw $10, 268507448($0) addi $10, $0, 0xffffff sw $10, 268507452($0) addi $10, $0, 0xffffff sw $10, 268507456($0) addi $10, $0, 0xffffff sw $10, 268507460($0) addi $10, $0, 0xffffff sw $10, 268507464($0) addi $10, $0, 0xffffff sw $10, 268507468($0) addi $10, $0, 0xffffff sw $10, 268507472($0) addi $10, $0, 0xffffff sw $10, 268507476($0) addi $10, $0, 0xffffff sw $10, 268507480($0) addi $10, $0, 0xb8b8b8 sw $10, 268507484($0) addi $10, $0, 0x010101 sw $10, 268507488($0) addi $10, $0, 0xffffff sw $10, 268507492($0) addi $10, $0, 0xffffff sw $10, 268507496($0) addi $10, $0, 0xffffff sw $10, 268507500($0) addi $10, $0, 0xe00400 sw $10, 268507504($0) addi $10, $0, 0xe10002 sw $10, 268507508($0) addi $10, $0, 0xe30002 sw $10, 268507512($0) addi $10, $0, 0xe20002 sw $10, 268507516($0) addi $10, $0, 0xe30002 sw $10, 268507520($0) addi $10, $0, 0xdc2621 sw $10, 268507524($0) addi $10, $0, 0xe20004 sw $10, 268507528($0) addi $10, $0, 0xde0400 sw $10, 268507532($0) addi $10, $0, 0xfefefe sw $10, 268507536($0) addi $10, $0, 0xffffff sw $10, 268507540($0) addi $10, $0, 0xffffff sw $10, 268507544($0) addi $10, $0, 0x020001 sw $10, 268507548($0) addi $10, $0, 0x2e2d2e sw $10, 268507552($0) addi $10, $0, 0xffffff sw $10, 268507556($0) addi $10, $0, 0xffffff sw $10, 268507560($0) addi $10, $0, 0xffffff sw $10, 268507564($0) addi $10, $0, 0xffffff sw $10, 268507568($0) addi $10, $0, 0xffffff sw $10, 268507572($0) addi $10, $0, 0xffffff sw $10, 268507576($0) addi $10, $0, 0xffffff sw $10, 268507580($0) addi $10, $0, 0xffffff sw $10, 268507584($0) addi $10, $0, 0xffffff sw $10, 268507588($0) addi $10, $0, 0xffffff sw $10, 268507592($0) addi $10, $0, 0xffffff sw $10, 268507596($0) addi $10, $0, 0xffffff sw $10, 268507600($0) addi $10, $0, 0xffffff sw $10, 268507604($0) addi $10, $0, 0xffffff sw $10, 268507608($0) addi $10, $0, 0xffffff sw $10, 268507612($0) addi $10, $0, 0xffffff sw $10, 268507616($0) addi $10, $0, 0xffffff sw $10, 268507620($0) addi $10, $0, 0xffffff sw $10, 268507624($0) addi $10, $0, 0xffffff sw $10, 268507628($0) addi $10, $0, 0xffffff sw $10, 268507632($0) addi $10, $0, 0xffffff sw $10, 268507636($0) addi $10, $0, 0xffffff sw $10, 268507640($0) addi $10, $0, 0x00d800 sw $10, 268507644($0) addi $10, $0, 0x00d800 sw $10, 268507648($0) addi $10, $0, 0xffffff sw $10, 268507652($0) addi $10, $0, 0xffffff sw $10, 268507656($0) addi $10, $0, 0xffffff sw $10, 268507660($0) addi $10, $0, 0xffffff sw $10, 268507664($0) addi $10, $0, 0xffffff sw $10, 268507668($0) addi $10, $0, 0xffffff sw $10, 268507672($0) addi $10, $0, 0xffffff sw $10, 268507676($0) addi $10, $0, 0xffffff sw $10, 268507680($0) addi $10, $0, 0xffffff sw $10, 268507684($0) addi $10, $0, 0xffffff sw $10, 268507688($0) addi $10, $0, 0xffffff sw $10, 268507692($0) addi $10, $0, 0xffffff sw $10, 268507696($0) addi $10, $0, 0xffffff sw $10, 268507700($0) addi $10, $0, 0xffffff sw $10, 268507704($0) addi $10, $0, 0xffffff sw $10, 268507708($0) addi $10, $0, 0xffffff sw $10, 268507712($0) addi $10, $0, 0xffffff sw $10, 268507716($0) addi $10, $0, 0xffffff sw $10, 268507720($0) addi $10, $0, 0xffffff sw $10, 268507724($0) addi $10, $0, 0xffffff sw $10, 268507728($0) addi $10, $0, 0xffffff sw $10, 268507732($0) addi $10, $0, 0x010101 sw $10, 268507736($0) addi $10, $0, 0x4a4a4a sw $10, 268507740($0) addi $10, $0, 0xfefefe sw $10, 268507744($0) addi $10, $0, 0xffffff sw $10, 268507748($0) addi $10, $0, 0xffffff sw $10, 268507752($0) addi $10, $0, 0xffffff sw $10, 268507756($0) addi $10, $0, 0xe00400 sw $10, 268507760($0) addi $10, $0, 0xe20002 sw $10, 268507764($0) addi $10, $0, 0xe20002 sw $10, 268507768($0) addi $10, $0, 0xe20002 sw $10, 268507772($0) addi $10, $0, 0xe20002 sw $10, 268507776($0) addi $10, $0, 0xe50002 sw $10, 268507780($0) addi $10, $0, 0xdf2824 sw $10, 268507784($0) addi $10, $0, 0xdf0400 sw $10, 268507788($0) addi $10, $0, 0xfefefe sw $10, 268507792($0) addi $10, $0, 0xffffff sw $10, 268507796($0) addi $10, $0, 0xffffff sw $10, 268507800($0) addi $10, $0, 0xfefdfe sw $10, 268507804($0) addi $10, $0, 0xd1cfd0 sw $10, 268507808($0) addi $10, $0, 0x010101 sw $10, 268507812($0) addi $10, $0, 0xffffff sw $10, 268507816($0) addi $10, $0, 0xffffff sw $10, 268507820($0) addi $10, $0, 0xffffff sw $10, 268507824($0) addi $10, $0, 0xffffff sw $10, 268507828($0) addi $10, $0, 0xffffff sw $10, 268507832($0) addi $10, $0, 0xffffff sw $10, 268507836($0) addi $10, $0, 0xffffff sw $10, 268507840($0) addi $10, $0, 0xffffff sw $10, 268507844($0) addi $10, $0, 0xffffff sw $10, 268507848($0) addi $10, $0, 0xffffff sw $10, 268507852($0) addi $10, $0, 0xffffff sw $10, 268507856($0) addi $10, $0, 0xffffff sw $10, 268507860($0) addi $10, $0, 0xffffff sw $10, 268507864($0) addi $10, $0, 0xffffff sw $10, 268507868($0) addi $10, $0, 0xffffff sw $10, 268507872($0) addi $10, $0, 0xffffff sw $10, 268507876($0) addi $10, $0, 0xffffff sw $10, 268507880($0) addi $10, $0, 0xffffff sw $10, 268507884($0) addi $10, $0, 0xffffff sw $10, 268507888($0) addi $10, $0, 0xffffff sw $10, 268507892($0) addi $10, $0, 0xffffff sw $10, 268507896($0) addi $10, $0, 0x00d800 sw $10, 268507900($0) addi $10, $0, 0x00d800 sw $10, 268507904($0) addi $10, $0, 0xffffff sw $10, 268507908($0) addi $10, $0, 0xffffff sw $10, 268507912($0) addi $10, $0, 0xffffff sw $10, 268507916($0) addi $10, $0, 0xffffff sw $10, 268507920($0) addi $10, $0, 0xffffff sw $10, 268507924($0) addi $10, $0, 0xffffff sw $10, 268507928($0) addi $10, $0, 0xffffff sw $10, 268507932($0) addi $10, $0, 0xffffff sw $10, 268507936($0) addi $10, $0, 0xffffff sw $10, 268507940($0) addi $10, $0, 0xffffff sw $10, 268507944($0) addi $10, $0, 0xffffff sw $10, 268507948($0) addi $10, $0, 0xffffff sw $10, 268507952($0) addi $10, $0, 0xffffff sw $10, 268507956($0) addi $10, $0, 0xffffff sw $10, 268507960($0) addi $10, $0, 0xffffff sw $10, 268507964($0) addi $10, $0, 0xffffff sw $10, 268507968($0) addi $10, $0, 0xffffff sw $10, 268507972($0) addi $10, $0, 0xffffff sw $10, 268507976($0) addi $10, $0, 0xffffff sw $10, 268507980($0) addi $10, $0, 0xffffff sw $10, 268507984($0) addi $10, $0, 0xffffff sw $10, 268507988($0) addi $10, $0, 0x020001 sw $10, 268507992($0) addi $10, $0, 0x474647 sw $10, 268507996($0) addi $10, $0, 0xffffff sw $10, 268508000($0) addi $10, $0, 0xffffff sw $10, 268508004($0) addi $10, $0, 0xffffff sw $10, 268508008($0) addi $10, $0, 0xffffff sw $10, 268508012($0) addi $10, $0, 0xd50901 sw $10, 268508016($0) addi $10, $0, 0xd90503 sw $10, 268508020($0) addi $10, $0, 0xe20002 sw $10, 268508024($0) addi $10, $0, 0xe20002 sw $10, 268508028($0) addi $10, $0, 0xe20002 sw $10, 268508032($0) addi $10, $0, 0xe20002 sw $10, 268508036($0) addi $10, $0, 0xd90407 sw $10, 268508040($0) addi $10, $0, 0xda2d24 sw $10, 268508044($0) addi $10, $0, 0xfefefe sw $10, 268508048($0) addi $10, $0, 0xffffff sw $10, 268508052($0) addi $10, $0, 0xffffff sw $10, 268508056($0) addi $10, $0, 0xffffff sw $10, 268508060($0) addi $10, $0, 0xd1d1d1 sw $10, 268508064($0) addi $10, $0, 0x020001 sw $10, 268508068($0) addi $10, $0, 0xffffff sw $10, 268508072($0) addi $10, $0, 0xffffff sw $10, 268508076($0) addi $10, $0, 0xffffff sw $10, 268508080($0) addi $10, $0, 0xffffff sw $10, 268508084($0) addi $10, $0, 0xffffff sw $10, 268508088($0) addi $10, $0, 0xffffff sw $10, 268508092($0) addi $10, $0, 0xffffff sw $10, 268508096($0) addi $10, $0, 0xffffff sw $10, 268508100($0) addi $10, $0, 0xffffff sw $10, 268508104($0) addi $10, $0, 0xffffff sw $10, 268508108($0) addi $10, $0, 0xffffff sw $10, 268508112($0) addi $10, $0, 0xffffff sw $10, 268508116($0) addi $10, $0, 0xffffff sw $10, 268508120($0) addi $10, $0, 0xffffff sw $10, 268508124($0) addi $10, $0, 0xffffff sw $10, 268508128($0) addi $10, $0, 0xffffff sw $10, 268508132($0) addi $10, $0, 0xffffff sw $10, 268508136($0) addi $10, $0, 0xffffff sw $10, 268508140($0) addi $10, $0, 0xffffff sw $10, 268508144($0) addi $10, $0, 0xffffff sw $10, 268508148($0) addi $10, $0, 0xffffff sw $10, 268508152($0) addi $10, $0, 0x00d800 sw $10, 268508156($0) addi $10, $0, 0x00d800 sw $10, 268508160($0) addi $10, $0, 0xffffff sw $10, 268508164($0) addi $10, $0, 0xffffff sw $10, 268508168($0) addi $10, $0, 0xffffff sw $10, 268508172($0) addi $10, $0, 0xffffff sw $10, 268508176($0) addi $10, $0, 0xffffff sw $10, 268508180($0) addi $10, $0, 0xffffff sw $10, 268508184($0) addi $10, $0, 0xffffff sw $10, 268508188($0) addi $10, $0, 0xffffff sw $10, 268508192($0) addi $10, $0, 0xffffff sw $10, 268508196($0) addi $10, $0, 0xffffff sw $10, 268508200($0) addi $10, $0, 0xffffff sw $10, 268508204($0) addi $10, $0, 0xffffff sw $10, 268508208($0) addi $10, $0, 0xffffff sw $10, 268508212($0) addi $10, $0, 0xffffff sw $10, 268508216($0) addi $10, $0, 0xffffff sw $10, 268508220($0) addi $10, $0, 0xffffff sw $10, 268508224($0) addi $10, $0, 0xffffff sw $10, 268508228($0) addi $10, $0, 0xffffff sw $10, 268508232($0) addi $10, $0, 0xffffff sw $10, 268508236($0) addi $10, $0, 0x4c4a4b sw $10, 268508240($0) addi $10, $0, 0x020001 sw $10, 268508244($0) addi $10, $0, 0xffffff sw $10, 268508248($0) addi $10, $0, 0xffffff sw $10, 268508252($0) addi $10, $0, 0xffffff sw $10, 268508256($0) addi $10, $0, 0xffffff sw $10, 268508260($0) addi $10, $0, 0xffffff sw $10, 268508264($0) addi $10, $0, 0xffffff sw $10, 268508268($0) addi $10, $0, 0xfffdfe sw $10, 268508272($0) addi $10, $0, 0xfcfefa sw $10, 268508276($0) addi $10, $0, 0xe20002 sw $10, 268508280($0) addi $10, $0, 0xe20002 sw $10, 268508284($0) addi $10, $0, 0xe20002 sw $10, 268508288($0) addi $10, $0, 0xe20002 sw $10, 268508292($0) addi $10, $0, 0xfafaf1 sw $10, 268508296($0) addi $10, $0, 0xfffdfe sw $10, 268508300($0) addi $10, $0, 0xffffff sw $10, 268508304($0) addi $10, $0, 0xffffff sw $10, 268508308($0) addi $10, $0, 0xffffff sw $10, 268508312($0) addi $10, $0, 0xffffff sw $10, 268508316($0) addi $10, $0, 0xffffff sw $10, 268508320($0) addi $10, $0, 0xffffff sw $10, 268508324($0) addi $10, $0, 0x010101 sw $10, 268508328($0) addi $10, $0, 0x070606 sw $10, 268508332($0) addi $10, $0, 0xffffff sw $10, 268508336($0) addi $10, $0, 0xffffff sw $10, 268508340($0) addi $10, $0, 0xffffff sw $10, 268508344($0) addi $10, $0, 0xffffff sw $10, 268508348($0) addi $10, $0, 0xffffff sw $10, 268508352($0) addi $10, $0, 0xffffff sw $10, 268508356($0) addi $10, $0, 0xffffff sw $10, 268508360($0) addi $10, $0, 0xffffff sw $10, 268508364($0) addi $10, $0, 0xffffff sw $10, 268508368($0) addi $10, $0, 0xffffff sw $10, 268508372($0) addi $10, $0, 0xffffff sw $10, 268508376($0) addi $10, $0, 0xffffff sw $10, 268508380($0) addi $10, $0, 0xffffff sw $10, 268508384($0) addi $10, $0, 0xffffff sw $10, 268508388($0) addi $10, $0, 0xffffff sw $10, 268508392($0) addi $10, $0, 0xffffff sw $10, 268508396($0) addi $10, $0, 0xffffff sw $10, 268508400($0) addi $10, $0, 0xffffff sw $10, 268508404($0) addi $10, $0, 0xffffff sw $10, 268508408($0) addi $10, $0, 0x00d800 sw $10, 268508412($0) addi $10, $0, 0x00d800 sw $10, 268508416($0) addi $10, $0, 0xffffff sw $10, 268508420($0) addi $10, $0, 0xffffff sw $10, 268508424($0) addi $10, $0, 0xffffff sw $10, 268508428($0) addi $10, $0, 0xffffff sw $10, 268508432($0) addi $10, $0, 0xffffff sw $10, 268508436($0) addi $10, $0, 0xffffff sw $10, 268508440($0) addi $10, $0, 0xffffff sw $10, 268508444($0) addi $10, $0, 0xffffff sw $10, 268508448($0) addi $10, $0, 0xffffff sw $10, 268508452($0) addi $10, $0, 0xffffff sw $10, 268508456($0) addi $10, $0, 0xffffff sw $10, 268508460($0) addi $10, $0, 0xffffff sw $10, 268508464($0) addi $10, $0, 0xffffff sw $10, 268508468($0) addi $10, $0, 0xffffff sw $10, 268508472($0) addi $10, $0, 0xffffff sw $10, 268508476($0) addi $10, $0, 0xffffff sw $10, 268508480($0) addi $10, $0, 0xffffff sw $10, 268508484($0) addi $10, $0, 0xffffff sw $10, 268508488($0) addi $10, $0, 0xffffff sw $10, 268508492($0) addi $10, $0, 0x4c4a4b sw $10, 268508496($0) addi $10, $0, 0x020001 sw $10, 268508500($0) addi $10, $0, 0xffffff sw $10, 268508504($0) addi $10, $0, 0xffffff sw $10, 268508508($0) addi $10, $0, 0xffffff sw $10, 268508512($0) addi $10, $0, 0xffffff sw $10, 268508516($0) addi $10, $0, 0xffffff sw $10, 268508520($0) addi $10, $0, 0xffffff sw $10, 268508524($0) addi $10, $0, 0xffffff sw $10, 268508528($0) addi $10, $0, 0xf5ffff sw $10, 268508532($0) addi $10, $0, 0xfffcfd sw $10, 268508536($0) addi $10, $0, 0xfffcfd sw $10, 268508540($0) addi $10, $0, 0xfffcfd sw $10, 268508544($0) addi $10, $0, 0xfffcfd sw $10, 268508548($0) addi $10, $0, 0xf8fefe sw $10, 268508552($0) addi $10, $0, 0xffffff sw $10, 268508556($0) addi $10, $0, 0xffffff sw $10, 268508560($0) addi $10, $0, 0xffffff sw $10, 268508564($0) addi $10, $0, 0xffffff sw $10, 268508568($0) addi $10, $0, 0xffffff sw $10, 268508572($0) addi $10, $0, 0xffffff sw $10, 268508576($0) addi $10, $0, 0xffffff sw $10, 268508580($0) addi $10, $0, 0x020001 sw $10, 268508584($0) addi $10, $0, 0x070606 sw $10, 268508588($0) addi $10, $0, 0xffffff sw $10, 268508592($0) addi $10, $0, 0xffffff sw $10, 268508596($0) addi $10, $0, 0xffffff sw $10, 268508600($0) addi $10, $0, 0xffffff sw $10, 268508604($0) addi $10, $0, 0xffffff sw $10, 268508608($0) addi $10, $0, 0xffffff sw $10, 268508612($0) addi $10, $0, 0xffffff sw $10, 268508616($0) addi $10, $0, 0xffffff sw $10, 268508620($0) addi $10, $0, 0xffffff sw $10, 268508624($0) addi $10, $0, 0xffffff sw $10, 268508628($0) addi $10, $0, 0xffffff sw $10, 268508632($0) addi $10, $0, 0xffffff sw $10, 268508636($0) addi $10, $0, 0xffffff sw $10, 268508640($0) addi $10, $0, 0xffffff sw $10, 268508644($0) addi $10, $0, 0xffffff sw $10, 268508648($0) addi $10, $0, 0xffffff sw $10, 268508652($0) addi $10, $0, 0xffffff sw $10, 268508656($0) addi $10, $0, 0xffffff sw $10, 268508660($0) addi $10, $0, 0xffffff sw $10, 268508664($0) addi $10, $0, 0x00d800 sw $10, 268508668($0) addi $10, $0, 0x00d800 sw $10, 268508672($0) addi $10, $0, 0xffffff sw $10, 268508676($0) addi $10, $0, 0xffffff sw $10, 268508680($0) addi $10, $0, 0xffffff sw $10, 268508684($0) addi $10, $0, 0xffffff sw $10, 268508688($0) addi $10, $0, 0xffffff sw $10, 268508692($0) addi $10, $0, 0xffffff sw $10, 268508696($0) addi $10, $0, 0xffffff sw $10, 268508700($0) addi $10, $0, 0xffffff sw $10, 268508704($0) addi $10, $0, 0xffffff sw $10, 268508708($0) addi $10, $0, 0xffffff sw $10, 268508712($0) addi $10, $0, 0xffffff sw $10, 268508716($0) addi $10, $0, 0xffffff sw $10, 268508720($0) addi $10, $0, 0xffffff sw $10, 268508724($0) addi $10, $0, 0xffffff sw $10, 268508728($0) addi $10, $0, 0xffffff sw $10, 268508732($0) addi $10, $0, 0xffffff sw $10, 268508736($0) addi $10, $0, 0xffffff sw $10, 268508740($0) addi $10, $0, 0xffffff sw $10, 268508744($0) addi $10, $0, 0xffffff sw $10, 268508748($0) addi $10, $0, 0x4c4a4b sw $10, 268508752($0) addi $10, $0, 0x020001 sw $10, 268508756($0) addi $10, $0, 0xffffff sw $10, 268508760($0) addi $10, $0, 0xffffff sw $10, 268508764($0) addi $10, $0, 0xffffff sw $10, 268508768($0) addi $10, $0, 0xffffff sw $10, 268508772($0) addi $10, $0, 0xf8fefe sw $10, 268508776($0) addi $10, $0, 0xfafefe sw $10, 268508780($0) addi $10, $0, 0xfdfcfe sw $10, 268508784($0) addi $10, $0, 0xffffff sw $10, 268508788($0) addi $10, $0, 0xffffff sw $10, 268508792($0) addi $10, $0, 0xffffff sw $10, 268508796($0) addi $10, $0, 0xffffff sw $10, 268508800($0) addi $10, $0, 0xffffff sw $10, 268508804($0) addi $10, $0, 0xffffff sw $10, 268508808($0) addi $10, $0, 0xfcfefd sw $10, 268508812($0) addi $10, $0, 0xfbfefe sw $10, 268508816($0) addi $10, $0, 0xfcfcf9 sw $10, 268508820($0) addi $10, $0, 0xffffff sw $10, 268508824($0) addi $10, $0, 0xffffff sw $10, 268508828($0) addi $10, $0, 0xffffff sw $10, 268508832($0) addi $10, $0, 0xffffff sw $10, 268508836($0) addi $10, $0, 0x020001 sw $10, 268508840($0) addi $10, $0, 0x070606 sw $10, 268508844($0) addi $10, $0, 0xffffff sw $10, 268508848($0) addi $10, $0, 0xffffff sw $10, 268508852($0) addi $10, $0, 0xffffff sw $10, 268508856($0) addi $10, $0, 0xffffff sw $10, 268508860($0) addi $10, $0, 0xffffff sw $10, 268508864($0) addi $10, $0, 0xffffff sw $10, 268508868($0) addi $10, $0, 0xffffff sw $10, 268508872($0) addi $10, $0, 0xffffff sw $10, 268508876($0) addi $10, $0, 0xffffff sw $10, 268508880($0) addi $10, $0, 0xffffff sw $10, 268508884($0) addi $10, $0, 0xffffff sw $10, 268508888($0) addi $10, $0, 0xffffff sw $10, 268508892($0) addi $10, $0, 0xffffff sw $10, 268508896($0) addi $10, $0, 0xffffff sw $10, 268508900($0) addi $10, $0, 0xffffff sw $10, 268508904($0) addi $10, $0, 0xffffff sw $10, 268508908($0) addi $10, $0, 0xffffff sw $10, 268508912($0) addi $10, $0, 0xffffff sw $10, 268508916($0) addi $10, $0, 0xffffff sw $10, 268508920($0) addi $10, $0, 0x00d800 sw $10, 268508924($0) addi $10, $0, 0x00d800 sw $10, 268508928($0) addi $10, $0, 0xffffff sw $10, 268508932($0) addi $10, $0, 0xffffff sw $10, 268508936($0) addi $10, $0, 0xffffff sw $10, 268508940($0) addi $10, $0, 0xffffff sw $10, 268508944($0) addi $10, $0, 0xffffff sw $10, 268508948($0) addi $10, $0, 0xffffff sw $10, 268508952($0) addi $10, $0, 0xffffff sw $10, 268508956($0) addi $10, $0, 0xffffff sw $10, 268508960($0) addi $10, $0, 0xffffff sw $10, 268508964($0) addi $10, $0, 0xffffff sw $10, 268508968($0) addi $10, $0, 0xffffff sw $10, 268508972($0) addi $10, $0, 0xffffff sw $10, 268508976($0) addi $10, $0, 0xffffff sw $10, 268508980($0) addi $10, $0, 0xffffff sw $10, 268508984($0) addi $10, $0, 0xffffff sw $10, 268508988($0) addi $10, $0, 0xffffff sw $10, 268508992($0) addi $10, $0, 0xffffff sw $10, 268508996($0) addi $10, $0, 0xffffff sw $10, 268509000($0) addi $10, $0, 0xffffff sw $10, 268509004($0) addi $10, $0, 0x4c4a4b sw $10, 268509008($0) addi $10, $0, 0x020001 sw $10, 268509012($0) addi $10, $0, 0xffffff sw $10, 268509016($0) addi $10, $0, 0xffffff sw $10, 268509020($0) addi $10, $0, 0xffffff sw $10, 268509024($0) addi $10, $0, 0xffffff sw $10, 268509028($0) addi $10, $0, 0xfef7fc sw $10, 268509032($0) addi $10, $0, 0xf74da5 sw $10, 268509036($0) addi $10, $0, 0xfffbf9 sw $10, 268509040($0) addi $10, $0, 0xffffff sw $10, 268509044($0) addi $10, $0, 0xffffff sw $10, 268509048($0) addi $10, $0, 0xffffff sw $10, 268509052($0) addi $10, $0, 0xffffff sw $10, 268509056($0) addi $10, $0, 0xffffff sw $10, 268509060($0) addi $10, $0, 0xffffff sw $10, 268509064($0) addi $10, $0, 0xfefefd sw $10, 268509068($0) addi $10, $0, 0xf74da5 sw $10, 268509072($0) addi $10, $0, 0xeeb9db sw $10, 268509076($0) addi $10, $0, 0xffffff sw $10, 268509080($0) addi $10, $0, 0xffffff sw $10, 268509084($0) addi $10, $0, 0xffffff sw $10, 268509088($0) addi $10, $0, 0xffffff sw $10, 268509092($0) addi $10, $0, 0x020001 sw $10, 268509096($0) addi $10, $0, 0x070606 sw $10, 268509100($0) addi $10, $0, 0xffffff sw $10, 268509104($0) addi $10, $0, 0xffffff sw $10, 268509108($0) addi $10, $0, 0xffffff sw $10, 268509112($0) addi $10, $0, 0xffffff sw $10, 268509116($0) addi $10, $0, 0xffffff sw $10, 268509120($0) addi $10, $0, 0xffffff sw $10, 268509124($0) addi $10, $0, 0xffffff sw $10, 268509128($0) addi $10, $0, 0xffffff sw $10, 268509132($0) addi $10, $0, 0xffffff sw $10, 268509136($0) addi $10, $0, 0xffffff sw $10, 268509140($0) addi $10, $0, 0xffffff sw $10, 268509144($0) addi $10, $0, 0xffffff sw $10, 268509148($0) addi $10, $0, 0xffffff sw $10, 268509152($0) addi $10, $0, 0xffffff sw $10, 268509156($0) addi $10, $0, 0xffffff sw $10, 268509160($0) addi $10, $0, 0xffffff sw $10, 268509164($0) addi $10, $0, 0xffffff sw $10, 268509168($0) addi $10, $0, 0xffffff sw $10, 268509172($0) addi $10, $0, 0xffffff sw $10, 268509176($0) addi $10, $0, 0x00d800 sw $10, 268509180($0) addi $10, $0, 0x00d800 sw $10, 268509184($0) addi $10, $0, 0xffffff sw $10, 268509188($0) addi $10, $0, 0xffffff sw $10, 268509192($0) addi $10, $0, 0xffffff sw $10, 268509196($0) addi $10, $0, 0xffffff sw $10, 268509200($0) addi $10, $0, 0xffffff sw $10, 268509204($0) addi $10, $0, 0xffffff sw $10, 268509208($0) addi $10, $0, 0xffffff sw $10, 268509212($0) addi $10, $0, 0xffffff sw $10, 268509216($0) addi $10, $0, 0xffffff sw $10, 268509220($0) addi $10, $0, 0xffffff sw $10, 268509224($0) addi $10, $0, 0xffffff sw $10, 268509228($0) addi $10, $0, 0xffffff sw $10, 268509232($0) addi $10, $0, 0xffffff sw $10, 268509236($0) addi $10, $0, 0xffffff sw $10, 268509240($0) addi $10, $0, 0xffffff sw $10, 268509244($0) addi $10, $0, 0xffffff sw $10, 268509248($0) addi $10, $0, 0xffffff sw $10, 268509252($0) addi $10, $0, 0xffffff sw $10, 268509256($0) addi $10, $0, 0xffffff sw $10, 268509260($0) addi $10, $0, 0x4c4a4b sw $10, 268509264($0) addi $10, $0, 0x020300 sw $10, 268509268($0) addi $10, $0, 0xf251a1 sw $10, 268509272($0) addi $10, $0, 0xd68cb4 sw $10, 268509276($0) addi $10, $0, 0xfdf9fe sw $10, 268509280($0) addi $10, $0, 0xe6589e sw $10, 268509284($0) addi $10, $0, 0xdc5c9c sw $10, 268509288($0) addi $10, $0, 0xfdfaff sw $10, 268509292($0) addi $10, $0, 0xe1579b sw $10, 268509296($0) addi $10, $0, 0xea54a1 sw $10, 268509300($0) addi $10, $0, 0xffffff sw $10, 268509304($0) addi $10, $0, 0xffffff sw $10, 268509308($0) addi $10, $0, 0xffffff sw $10, 268509312($0) addi $10, $0, 0xffffff sw $10, 268509316($0) addi $10, $0, 0xd45f95 sw $10, 268509320($0) addi $10, $0, 0xf54c9c sw $10, 268509324($0) addi $10, $0, 0xfdfaff sw $10, 268509328($0) addi $10, $0, 0xd49abc sw $10, 268509332($0) addi $10, $0, 0xe6579e sw $10, 268509336($0) addi $10, $0, 0xffffff sw $10, 268509340($0) addi $10, $0, 0xfcdbf1 sw $10, 268509344($0) addi $10, $0, 0xf252a5 sw $10, 268509348($0) addi $10, $0, 0x050301 sw $10, 268509352($0) addi $10, $0, 0x070606 sw $10, 268509356($0) addi $10, $0, 0xffffff sw $10, 268509360($0) addi $10, $0, 0xffffff sw $10, 268509364($0) addi $10, $0, 0xffffff sw $10, 268509368($0) addi $10, $0, 0xffffff sw $10, 268509372($0) addi $10, $0, 0xffffff sw $10, 268509376($0) addi $10, $0, 0xffffff sw $10, 268509380($0) addi $10, $0, 0xffffff sw $10, 268509384($0) addi $10, $0, 0xffffff sw $10, 268509388($0) addi $10, $0, 0xffffff sw $10, 268509392($0) addi $10, $0, 0xffffff sw $10, 268509396($0) addi $10, $0, 0xffffff sw $10, 268509400($0) addi $10, $0, 0xffffff sw $10, 268509404($0) addi $10, $0, 0xffffff sw $10, 268509408($0) addi $10, $0, 0xffffff sw $10, 268509412($0) addi $10, $0, 0xffffff sw $10, 268509416($0) addi $10, $0, 0xffffff sw $10, 268509420($0) addi $10, $0, 0xffffff sw $10, 268509424($0) addi $10, $0, 0xffffff sw $10, 268509428($0) addi $10, $0, 0xffffff sw $10, 268509432($0) addi $10, $0, 0x00d800 sw $10, 268509436($0) addi $10, $0, 0x00d800 sw $10, 268509440($0) addi $10, $0, 0xffffff sw $10, 268509444($0) addi $10, $0, 0xffffff sw $10, 268509448($0) addi $10, $0, 0xffffff sw $10, 268509452($0) addi $10, $0, 0xffffff sw $10, 268509456($0) addi $10, $0, 0xffffff sw $10, 268509460($0) addi $10, $0, 0xffffff sw $10, 268509464($0) addi $10, $0, 0xffffff sw $10, 268509468($0) addi $10, $0, 0xffffff sw $10, 268509472($0) addi $10, $0, 0xffffff sw $10, 268509476($0) addi $10, $0, 0xffffff sw $10, 268509480($0) addi $10, $0, 0xffffff sw $10, 268509484($0) addi $10, $0, 0xffffff sw $10, 268509488($0) addi $10, $0, 0xffffff sw $10, 268509492($0) addi $10, $0, 0xffffff sw $10, 268509496($0) addi $10, $0, 0xffffff sw $10, 268509500($0) addi $10, $0, 0xffffff sw $10, 268509504($0) addi $10, $0, 0xffffff sw $10, 268509508($0) addi $10, $0, 0xffffff sw $10, 268509512($0) addi $10, $0, 0xffffff sw $10, 268509516($0) addi $10, $0, 0x4f4f4f sw $10, 268509520($0) addi $10, $0, 0x080101 sw $10, 268509524($0) addi $10, $0, 0xfa4ca6 sw $10, 268509528($0) addi $10, $0, 0xe085b6 sw $10, 268509532($0) addi $10, $0, 0xf8fbfe sw $10, 268509536($0) addi $10, $0, 0xf94ba6 sw $10, 268509540($0) addi $10, $0, 0xe657a4 sw $10, 268509544($0) addi $10, $0, 0xffffff sw $10, 268509548($0) addi $10, $0, 0xfb4aaa sw $10, 268509552($0) addi $10, $0, 0xf74da1 sw $10, 268509556($0) addi $10, $0, 0xfafffc sw $10, 268509560($0) addi $10, $0, 0xfafffc sw $10, 268509564($0) addi $10, $0, 0xfafffc sw $10, 268509568($0) addi $10, $0, 0xfafffc sw $10, 268509572($0) addi $10, $0, 0xec579e sw $10, 268509576($0) addi $10, $0, 0xf84da6 sw $10, 268509580($0) addi $10, $0, 0xfffffe sw $10, 268509584($0) addi $10, $0, 0xe395c7 sw $10, 268509588($0) addi $10, $0, 0xf052a5 sw $10, 268509592($0) addi $10, $0, 0xf9fffb sw $10, 268509596($0) addi $10, $0, 0xfcd5ef sw $10, 268509600($0) addi $10, $0, 0xfa61b4 sw $10, 268509604($0) addi $10, $0, 0x180004 sw $10, 268509608($0) addi $10, $0, 0x0d0d0d sw $10, 268509612($0) addi $10, $0, 0xffffff sw $10, 268509616($0) addi $10, $0, 0xffffff sw $10, 268509620($0) addi $10, $0, 0xffffff sw $10, 268509624($0) addi $10, $0, 0xffffff sw $10, 268509628($0) addi $10, $0, 0xffffff sw $10, 268509632($0) addi $10, $0, 0xffffff sw $10, 268509636($0) addi $10, $0, 0xffffff sw $10, 268509640($0) addi $10, $0, 0xffffff sw $10, 268509644($0) addi $10, $0, 0xffffff sw $10, 268509648($0) addi $10, $0, 0xffffff sw $10, 268509652($0) addi $10, $0, 0xffffff sw $10, 268509656($0) addi $10, $0, 0xffffff sw $10, 268509660($0) addi $10, $0, 0xffffff sw $10, 268509664($0) addi $10, $0, 0xffffff sw $10, 268509668($0) addi $10, $0, 0xffffff sw $10, 268509672($0) addi $10, $0, 0xffffff sw $10, 268509676($0) addi $10, $0, 0xffffff sw $10, 268509680($0) addi $10, $0, 0xffffff sw $10, 268509684($0) addi $10, $0, 0xffffff sw $10, 268509688($0) addi $10, $0, 0x00d800 sw $10, 268509692($0) addi $10, $0, 0x00d800 sw $10, 268509696($0) addi $10, $0, 0xffffff sw $10, 268509700($0) addi $10, $0, 0xffffff sw $10, 268509704($0) addi $10, $0, 0xffffff sw $10, 268509708($0) addi $10, $0, 0xffffff sw $10, 268509712($0) addi $10, $0, 0xffffff sw $10, 268509716($0) addi $10, $0, 0xffffff sw $10, 268509720($0) addi $10, $0, 0xffffff sw $10, 268509724($0) addi $10, $0, 0xffffff sw $10, 268509728($0) addi $10, $0, 0xffffff sw $10, 268509732($0) addi $10, $0, 0xffffff sw $10, 268509736($0) addi $10, $0, 0xffffff sw $10, 268509740($0) addi $10, $0, 0xffffff sw $10, 268509744($0) addi $10, $0, 0xffffff sw $10, 268509748($0) addi $10, $0, 0xffffff sw $10, 268509752($0) addi $10, $0, 0xffffff sw $10, 268509756($0) addi $10, $0, 0xffffff sw $10, 268509760($0) addi $10, $0, 0xffffff sw $10, 268509764($0) addi $10, $0, 0xffffff sw $10, 268509768($0) addi $10, $0, 0xffffff sw $10, 268509772($0) addi $10, $0, 0xffffff sw $10, 268509776($0) addi $10, $0, 0xfdfffe sw $10, 268509780($0) addi $10, $0, 0x000300 sw $10, 268509784($0) addi $10, $0, 0x521b35 sw $10, 268509788($0) addi $10, $0, 0xf84ca7 sw $10, 268509792($0) addi $10, $0, 0xf8fdff sw $10, 268509796($0) addi $10, $0, 0xfafffb sw $10, 268509800($0) addi $10, $0, 0xfffefd sw $10, 268509804($0) addi $10, $0, 0xf7fffa sw $10, 268509808($0) addi $10, $0, 0xf1fdff sw $10, 268509812($0) addi $10, $0, 0xfa4ba6 sw $10, 268509816($0) addi $10, $0, 0xfa4ba6 sw $10, 268509820($0) addi $10, $0, 0xfa4ba6 sw $10, 268509824($0) addi $10, $0, 0xfa4ba6 sw $10, 268509828($0) addi $10, $0, 0xf9f8ff sw $10, 268509832($0) addi $10, $0, 0xfefffe sw $10, 268509836($0) addi $10, $0, 0xfffefd sw $10, 268509840($0) addi $10, $0, 0xfffdff sw $10, 268509844($0) addi $10, $0, 0xfdfdff sw $10, 268509848($0) addi $10, $0, 0xfb4ba6 sw $10, 268509852($0) addi $10, $0, 0xbf4686 sw $10, 268509856($0) addi $10, $0, 0x010006 sw $10, 268509860($0) addi $10, $0, 0xfbfeff sw $10, 268509864($0) addi $10, $0, 0xffffff sw $10, 268509868($0) addi $10, $0, 0xffffff sw $10, 268509872($0) addi $10, $0, 0xffffff sw $10, 268509876($0) addi $10, $0, 0xffffff sw $10, 268509880($0) addi $10, $0, 0xffffff sw $10, 268509884($0) addi $10, $0, 0xffffff sw $10, 268509888($0) addi $10, $0, 0xffffff sw $10, 268509892($0) addi $10, $0, 0xffffff sw $10, 268509896($0) addi $10, $0, 0xffffff sw $10, 268509900($0) addi $10, $0, 0xffffff sw $10, 268509904($0) addi $10, $0, 0xffffff sw $10, 268509908($0) addi $10, $0, 0xffffff sw $10, 268509912($0) addi $10, $0, 0xffffff sw $10, 268509916($0) addi $10, $0, 0xffffff sw $10, 268509920($0) addi $10, $0, 0xffffff sw $10, 268509924($0) addi $10, $0, 0xffffff sw $10, 268509928($0) addi $10, $0, 0xffffff sw $10, 268509932($0) addi $10, $0, 0xffffff sw $10, 268509936($0) addi $10, $0, 0xffffff sw $10, 268509940($0) addi $10, $0, 0xffffff sw $10, 268509944($0) addi $10, $0, 0x00d800 sw $10, 268509948($0) addi $10, $0, 0x00d800 sw $10, 268509952($0) addi $10, $0, 0xffffff sw $10, 268509956($0) addi $10, $0, 0xffffff sw $10, 268509960($0) addi $10, $0, 0xffffff sw $10, 268509964($0) addi $10, $0, 0xffffff sw $10, 268509968($0) addi $10, $0, 0xffffff sw $10, 268509972($0) addi $10, $0, 0xffffff sw $10, 268509976($0) addi $10, $0, 0xffffff sw $10, 268509980($0) addi $10, $0, 0xffffff sw $10, 268509984($0) addi $10, $0, 0xffffff sw $10, 268509988($0) addi $10, $0, 0xffffff sw $10, 268509992($0) addi $10, $0, 0xffffff sw $10, 268509996($0) addi $10, $0, 0xffffff sw $10, 268510000($0) addi $10, $0, 0xffffff sw $10, 268510004($0) addi $10, $0, 0xffffff sw $10, 268510008($0) addi $10, $0, 0xffffff sw $10, 268510012($0) addi $10, $0, 0xffffff sw $10, 268510016($0) addi $10, $0, 0xffffff sw $10, 268510020($0) addi $10, $0, 0xffffff sw $10, 268510024($0) addi $10, $0, 0xffffff sw $10, 268510028($0) addi $10, $0, 0xffffff sw $10, 268510032($0) addi $10, $0, 0xffffff sw $10, 268510036($0) addi $10, $0, 0x020001 sw $10, 268510040($0) addi $10, $0, 0x493e15 sw $10, 268510044($0) addi $10, $0, 0xfebb1c sw $10, 268510048($0) addi $10, $0, 0xedc513 sw $10, 268510052($0) addi $10, $0, 0xecc713 sw $10, 268510056($0) addi $10, $0, 0xecc713 sw $10, 268510060($0) addi $10, $0, 0xecc810 sw $10, 268510064($0) addi $10, $0, 0xeac912 sw $10, 268510068($0) addi $10, $0, 0xfdbc1a sw $10, 268510072($0) addi $10, $0, 0xfebc1a sw $10, 268510076($0) addi $10, $0, 0xfebc1a sw $10, 268510080($0) addi $10, $0, 0xfdbc1a sw $10, 268510084($0) addi $10, $0, 0xebc715 sw $10, 268510088($0) addi $10, $0, 0xecc71a sw $10, 268510092($0) addi $10, $0, 0xebc713 sw $10, 268510096($0) addi $10, $0, 0xebc812 sw $10, 268510100($0) addi $10, $0, 0xf5c212 sw $10, 268510104($0) addi $10, $0, 0xfdbc1a sw $10, 268510108($0) addi $10, $0, 0xcb982b sw $10, 268510112($0) addi $10, $0, 0x030104 sw $10, 268510116($0) addi $10, $0, 0xffffff sw $10, 268510120($0) addi $10, $0, 0xffffff sw $10, 268510124($0) addi $10, $0, 0xffffff sw $10, 268510128($0) addi $10, $0, 0xffffff sw $10, 268510132($0) addi $10, $0, 0xffffff sw $10, 268510136($0) addi $10, $0, 0xffffff sw $10, 268510140($0) addi $10, $0, 0xffffff sw $10, 268510144($0) addi $10, $0, 0xffffff sw $10, 268510148($0) addi $10, $0, 0xffffff sw $10, 268510152($0) addi $10, $0, 0xffffff sw $10, 268510156($0) addi $10, $0, 0xffffff sw $10, 268510160($0) addi $10, $0, 0xffffff sw $10, 268510164($0) addi $10, $0, 0xffffff sw $10, 268510168($0) addi $10, $0, 0xffffff sw $10, 268510172($0) addi $10, $0, 0xffffff sw $10, 268510176($0) addi $10, $0, 0xffffff sw $10, 268510180($0) addi $10, $0, 0xffffff sw $10, 268510184($0) addi $10, $0, 0xffffff sw $10, 268510188($0) addi $10, $0, 0xffffff sw $10, 268510192($0) addi $10, $0, 0xffffff sw $10, 268510196($0) addi $10, $0, 0xffffff sw $10, 268510200($0) addi $10, $0, 0x00d800 sw $10, 268510204($0) addi $10, $0, 0x00d800 sw $10, 268510208($0) addi $10, $0, 0xffffff sw $10, 268510212($0) addi $10, $0, 0xffffff sw $10, 268510216($0) addi $10, $0, 0xffffff sw $10, 268510220($0) addi $10, $0, 0xffffff sw $10, 268510224($0) addi $10, $0, 0xffffff sw $10, 268510228($0) addi $10, $0, 0xffffff sw $10, 268510232($0) addi $10, $0, 0xffffff sw $10, 268510236($0) addi $10, $0, 0xffffff sw $10, 268510240($0) addi $10, $0, 0xffffff sw $10, 268510244($0) addi $10, $0, 0xffffff sw $10, 268510248($0) addi $10, $0, 0xffffff sw $10, 268510252($0) addi $10, $0, 0xffffff sw $10, 268510256($0) addi $10, $0, 0xffffff sw $10, 268510260($0) addi $10, $0, 0xffffff sw $10, 268510264($0) addi $10, $0, 0xffffff sw $10, 268510268($0) addi $10, $0, 0xffffff sw $10, 268510272($0) addi $10, $0, 0xffffff sw $10, 268510276($0) addi $10, $0, 0xffffff sw $10, 268510280($0) addi $10, $0, 0xffffff sw $10, 268510284($0) addi $10, $0, 0xffffff sw $10, 268510288($0) addi $10, $0, 0xffffff sw $10, 268510292($0) addi $10, $0, 0x020001 sw $10, 268510296($0) addi $10, $0, 0x513712 sw $10, 268510300($0) addi $10, $0, 0xfac504 sw $10, 268510304($0) addi $10, $0, 0xfbc501 sw $10, 268510308($0) addi $10, $0, 0xfbc501 sw $10, 268510312($0) addi $10, $0, 0xfbc501 sw $10, 268510316($0) addi $10, $0, 0xfbc501 sw $10, 268510320($0) addi $10, $0, 0xfbc501 sw $10, 268510324($0) addi $10, $0, 0xfbc501 sw $10, 268510328($0) addi $10, $0, 0xfbc501 sw $10, 268510332($0) addi $10, $0, 0xfbc501 sw $10, 268510336($0) addi $10, $0, 0xfbc501 sw $10, 268510340($0) addi $10, $0, 0xf9c604 sw $10, 268510344($0) addi $10, $0, 0xfbc501 sw $10, 268510348($0) addi $10, $0, 0xfbc501 sw $10, 268510352($0) addi $10, $0, 0xfbc501 sw $10, 268510356($0) addi $10, $0, 0xfbc501 sw $10, 268510360($0) addi $10, $0, 0xfdc500 sw $10, 268510364($0) addi $10, $0, 0xc59f25 sw $10, 268510368($0) addi $10, $0, 0x010101 sw $10, 268510372($0) addi $10, $0, 0xffffff sw $10, 268510376($0) addi $10, $0, 0xffffff sw $10, 268510380($0) addi $10, $0, 0xffffff sw $10, 268510384($0) addi $10, $0, 0xffffff sw $10, 268510388($0) addi $10, $0, 0xffffff sw $10, 268510392($0) addi $10, $0, 0xffffff sw $10, 268510396($0) addi $10, $0, 0xffffff sw $10, 268510400($0) addi $10, $0, 0xffffff sw $10, 268510404($0) addi $10, $0, 0xffffff sw $10, 268510408($0) addi $10, $0, 0xffffff sw $10, 268510412($0) addi $10, $0, 0xffffff sw $10, 268510416($0) addi $10, $0, 0xffffff sw $10, 268510420($0) addi $10, $0, 0xffffff sw $10, 268510424($0) addi $10, $0, 0xffffff sw $10, 268510428($0) addi $10, $0, 0xffffff sw $10, 268510432($0) addi $10, $0, 0xffffff sw $10, 268510436($0) addi $10, $0, 0xffffff sw $10, 268510440($0) addi $10, $0, 0xffffff sw $10, 268510444($0) addi $10, $0, 0xffffff sw $10, 268510448($0) addi $10, $0, 0xffffff sw $10, 268510452($0) addi $10, $0, 0xffffff sw $10, 268510456($0) addi $10, $0, 0x00d800 sw $10, 268510460($0) addi $10, $0, 0x00d800 sw $10, 268510464($0) addi $10, $0, 0xffffff sw $10, 268510468($0) addi $10, $0, 0xffffff sw $10, 268510472($0) addi $10, $0, 0xffffff sw $10, 268510476($0) addi $10, $0, 0xffffff sw $10, 268510480($0) addi $10, $0, 0xffffff sw $10, 268510484($0) addi $10, $0, 0xffffff sw $10, 268510488($0) addi $10, $0, 0xffffff sw $10, 268510492($0) addi $10, $0, 0xffffff sw $10, 268510496($0) addi $10, $0, 0xffffff sw $10, 268510500($0) addi $10, $0, 0xffffff sw $10, 268510504($0) addi $10, $0, 0xffffff sw $10, 268510508($0) addi $10, $0, 0xffffff sw $10, 268510512($0) addi $10, $0, 0xffffff sw $10, 268510516($0) addi $10, $0, 0xffffff sw $10, 268510520($0) addi $10, $0, 0xffffff sw $10, 268510524($0) addi $10, $0, 0xffffff sw $10, 268510528($0) addi $10, $0, 0xffffff sw $10, 268510532($0) addi $10, $0, 0xffffff sw $10, 268510536($0) addi $10, $0, 0xffffff sw $10, 268510540($0) addi $10, $0, 0xffffff sw $10, 268510544($0) addi $10, $0, 0xffffff sw $10, 268510548($0) addi $10, $0, 0x020001 sw $10, 268510552($0) addi $10, $0, 0x513712 sw $10, 268510556($0) addi $10, $0, 0xfac504 sw $10, 268510560($0) addi $10, $0, 0xfbc501 sw $10, 268510564($0) addi $10, $0, 0xfbc501 sw $10, 268510568($0) addi $10, $0, 0xfbc501 sw $10, 268510572($0) addi $10, $0, 0xfbc501 sw $10, 268510576($0) addi $10, $0, 0xfbc501 sw $10, 268510580($0) addi $10, $0, 0xfbc501 sw $10, 268510584($0) addi $10, $0, 0xfbc501 sw $10, 268510588($0) addi $10, $0, 0xfac502 sw $10, 268510592($0) addi $10, $0, 0xf9c602 sw $10, 268510596($0) addi $10, $0, 0xfbc501 sw $10, 268510600($0) addi $10, $0, 0xfbc501 sw $10, 268510604($0) addi $10, $0, 0xfbc501 sw $10, 268510608($0) addi $10, $0, 0xfbc501 sw $10, 268510612($0) addi $10, $0, 0xfbc501 sw $10, 268510616($0) addi $10, $0, 0xfdc500 sw $10, 268510620($0) addi $10, $0, 0xc59f25 sw $10, 268510624($0) addi $10, $0, 0x010101 sw $10, 268510628($0) addi $10, $0, 0xffffff sw $10, 268510632($0) addi $10, $0, 0xffffff sw $10, 268510636($0) addi $10, $0, 0xffffff sw $10, 268510640($0) addi $10, $0, 0xffffff sw $10, 268510644($0) addi $10, $0, 0xffffff sw $10, 268510648($0) addi $10, $0, 0xffffff sw $10, 268510652($0) addi $10, $0, 0xffffff sw $10, 268510656($0) addi $10, $0, 0xffffff sw $10, 268510660($0) addi $10, $0, 0xffffff sw $10, 268510664($0) addi $10, $0, 0xffffff sw $10, 268510668($0) addi $10, $0, 0xffffff sw $10, 268510672($0) addi $10, $0, 0xffffff sw $10, 268510676($0) addi $10, $0, 0xffffff sw $10, 268510680($0) addi $10, $0, 0xffffff sw $10, 268510684($0) addi $10, $0, 0xffffff sw $10, 268510688($0) addi $10, $0, 0xffffff sw $10, 268510692($0) addi $10, $0, 0xffffff sw $10, 268510696($0) addi $10, $0, 0xffffff sw $10, 268510700($0) addi $10, $0, 0xffffff sw $10, 268510704($0) addi $10, $0, 0xffffff sw $10, 268510708($0) addi $10, $0, 0xffffff sw $10, 268510712($0) addi $10, $0, 0x00d800 sw $10, 268510716($0) addi $10, $0, 0x00d800 sw $10, 268510720($0) addi $10, $0, 0xffffff sw $10, 268510724($0) addi $10, $0, 0xffffff sw $10, 268510728($0) addi $10, $0, 0xffffff sw $10, 268510732($0) addi $10, $0, 0xffffff sw $10, 268510736($0) addi $10, $0, 0xffffff sw $10, 268510740($0) addi $10, $0, 0xffffff sw $10, 268510744($0) addi $10, $0, 0xffffff sw $10, 268510748($0) addi $10, $0, 0xffffff sw $10, 268510752($0) addi $10, $0, 0xffffff sw $10, 268510756($0) addi $10, $0, 0xffffff sw $10, 268510760($0) addi $10, $0, 0xffffff sw $10, 268510764($0) addi $10, $0, 0xffffff sw $10, 268510768($0) addi $10, $0, 0xffffff sw $10, 268510772($0) addi $10, $0, 0xffffff sw $10, 268510776($0) addi $10, $0, 0xffffff sw $10, 268510780($0) addi $10, $0, 0xffffff sw $10, 268510784($0) addi $10, $0, 0xffffff sw $10, 268510788($0) addi $10, $0, 0xffffff sw $10, 268510792($0) addi $10, $0, 0xffffff sw $10, 268510796($0) addi $10, $0, 0xffffff sw $10, 268510800($0) addi $10, $0, 0xffffff sw $10, 268510804($0) addi $10, $0, 0x020001 sw $10, 268510808($0) addi $10, $0, 0x513712 sw $10, 268510812($0) addi $10, $0, 0xfac504 sw $10, 268510816($0) addi $10, $0, 0xfbc501 sw $10, 268510820($0) addi $10, $0, 0xfbc501 sw $10, 268510824($0) addi $10, $0, 0xfbc501 sw $10, 268510828($0) addi $10, $0, 0xfbc501 sw $10, 268510832($0) addi $10, $0, 0xfbc501 sw $10, 268510836($0) addi $10, $0, 0xfbc501 sw $10, 268510840($0) addi $10, $0, 0xf8c701 sw $10, 268510844($0) addi $10, $0, 0xf8c700 sw $10, 268510848($0) addi $10, $0, 0xfbc501 sw $10, 268510852($0) addi $10, $0, 0xfbc501 sw $10, 268510856($0) addi $10, $0, 0xfbc501 sw $10, 268510860($0) addi $10, $0, 0xfbc501 sw $10, 268510864($0) addi $10, $0, 0xfbc501 sw $10, 268510868($0) addi $10, $0, 0xfbc501 sw $10, 268510872($0) addi $10, $0, 0xfdc500 sw $10, 268510876($0) addi $10, $0, 0xc59f25 sw $10, 268510880($0) addi $10, $0, 0x010101 sw $10, 268510884($0) addi $10, $0, 0xffffff sw $10, 268510888($0) addi $10, $0, 0xffffff sw $10, 268510892($0) addi $10, $0, 0xffffff sw $10, 268510896($0) addi $10, $0, 0xffffff sw $10, 268510900($0) addi $10, $0, 0xffffff sw $10, 268510904($0) addi $10, $0, 0xffffff sw $10, 268510908($0) addi $10, $0, 0xffffff sw $10, 268510912($0) addi $10, $0, 0xffffff sw $10, 268510916($0) addi $10, $0, 0xffffff sw $10, 268510920($0) addi $10, $0, 0xffffff sw $10, 268510924($0) addi $10, $0, 0xffffff sw $10, 268510928($0) addi $10, $0, 0xffffff sw $10, 268510932($0) addi $10, $0, 0xffffff sw $10, 268510936($0) addi $10, $0, 0xffffff sw $10, 268510940($0) addi $10, $0, 0xffffff sw $10, 268510944($0) addi $10, $0, 0xffffff sw $10, 268510948($0) addi $10, $0, 0xffffff sw $10, 268510952($0) addi $10, $0, 0xffffff sw $10, 268510956($0) addi $10, $0, 0xffffff sw $10, 268510960($0) addi $10, $0, 0xffffff sw $10, 268510964($0) addi $10, $0, 0xffffff sw $10, 268510968($0) addi $10, $0, 0x00d800 sw $10, 268510972($0) addi $10, $0, 0x00d800 sw $10, 268510976($0) addi $10, $0, 0xffffff sw $10, 268510980($0) addi $10, $0, 0xffffff sw $10, 268510984($0) addi $10, $0, 0xffffff sw $10, 268510988($0) addi $10, $0, 0xffffff sw $10, 268510992($0) addi $10, $0, 0xffffff sw $10, 268510996($0) addi $10, $0, 0xffffff sw $10, 268511000($0) addi $10, $0, 0xffffff sw $10, 268511004($0) addi $10, $0, 0xffffff sw $10, 268511008($0) addi $10, $0, 0xffffff sw $10, 268511012($0) addi $10, $0, 0xffffff sw $10, 268511016($0) addi $10, $0, 0xffffff sw $10, 268511020($0) addi $10, $0, 0xffffff sw $10, 268511024($0) addi $10, $0, 0xffffff sw $10, 268511028($0) addi $10, $0, 0xffffff sw $10, 268511032($0) addi $10, $0, 0xffffff sw $10, 268511036($0) addi $10, $0, 0xffffff sw $10, 268511040($0) addi $10, $0, 0xffffff sw $10, 268511044($0) addi $10, $0, 0xffffff sw $10, 268511048($0) addi $10, $0, 0xffffff sw $10, 268511052($0) addi $10, $0, 0xffffff sw $10, 268511056($0) addi $10, $0, 0xffffff sw $10, 268511060($0) addi $10, $0, 0x020001 sw $10, 268511064($0) addi $10, $0, 0x513712 sw $10, 268511068($0) addi $10, $0, 0xfac504 sw $10, 268511072($0) addi $10, $0, 0xfbc501 sw $10, 268511076($0) addi $10, $0, 0xfbc501 sw $10, 268511080($0) addi $10, $0, 0xfbc501 sw $10, 268511084($0) addi $10, $0, 0xf8c800 sw $10, 268511088($0) addi $10, $0, 0xe7b910 sw $10, 268511092($0) addi $10, $0, 0xfbc501 sw $10, 268511096($0) addi $10, $0, 0xfbc502 sw $10, 268511100($0) addi $10, $0, 0xfbc501 sw $10, 268511104($0) addi $10, $0, 0xfbc501 sw $10, 268511108($0) addi $10, $0, 0xfbc501 sw $10, 268511112($0) addi $10, $0, 0xfbc501 sw $10, 268511116($0) addi $10, $0, 0xfbc501 sw $10, 268511120($0) addi $10, $0, 0xfbc501 sw $10, 268511124($0) addi $10, $0, 0xfbc501 sw $10, 268511128($0) addi $10, $0, 0xfdc500 sw $10, 268511132($0) addi $10, $0, 0xc59f25 sw $10, 268511136($0) addi $10, $0, 0x010101 sw $10, 268511140($0) addi $10, $0, 0xffffff sw $10, 268511144($0) addi $10, $0, 0xffffff sw $10, 268511148($0) addi $10, $0, 0xffffff sw $10, 268511152($0) addi $10, $0, 0xffffff sw $10, 268511156($0) addi $10, $0, 0xffffff sw $10, 268511160($0) addi $10, $0, 0xffffff sw $10, 268511164($0) addi $10, $0, 0xffffff sw $10, 268511168($0) addi $10, $0, 0xffffff sw $10, 268511172($0) addi $10, $0, 0xffffff sw $10, 268511176($0) addi $10, $0, 0xffffff sw $10, 268511180($0) addi $10, $0, 0xffffff sw $10, 268511184($0) addi $10, $0, 0xffffff sw $10, 268511188($0) addi $10, $0, 0xffffff sw $10, 268511192($0) addi $10, $0, 0xffffff sw $10, 268511196($0) addi $10, $0, 0xffffff sw $10, 268511200($0) addi $10, $0, 0xffffff sw $10, 268511204($0) addi $10, $0, 0xffffff sw $10, 268511208($0) addi $10, $0, 0xffffff sw $10, 268511212($0) addi $10, $0, 0xffffff sw $10, 268511216($0) addi $10, $0, 0xffffff sw $10, 268511220($0) addi $10, $0, 0xffffff sw $10, 268511224($0) addi $10, $0, 0x00d800 sw $10, 268511228($0) addi $10, $0, 0x00d800 sw $10, 268511232($0) addi $10, $0, 0xffffff sw $10, 268511236($0) addi $10, $0, 0xffffff sw $10, 268511240($0) addi $10, $0, 0xffffff sw $10, 268511244($0) addi $10, $0, 0xffffff sw $10, 268511248($0) addi $10, $0, 0xffffff sw $10, 268511252($0) addi $10, $0, 0xffffff sw $10, 268511256($0) addi $10, $0, 0xffffff sw $10, 268511260($0) addi $10, $0, 0xffffff sw $10, 268511264($0) addi $10, $0, 0xffffff sw $10, 268511268($0) addi $10, $0, 0xffffff sw $10, 268511272($0) addi $10, $0, 0xffffff sw $10, 268511276($0) addi $10, $0, 0xffffff sw $10, 268511280($0) addi $10, $0, 0xffffff sw $10, 268511284($0) addi $10, $0, 0xffffff sw $10, 268511288($0) addi $10, $0, 0xffffff sw $10, 268511292($0) addi $10, $0, 0xffffff sw $10, 268511296($0) addi $10, $0, 0xffffff sw $10, 268511300($0) addi $10, $0, 0xffffff sw $10, 268511304($0) addi $10, $0, 0xffffff sw $10, 268511308($0) addi $10, $0, 0xffffff sw $10, 268511312($0) addi $10, $0, 0xffffff sw $10, 268511316($0) addi $10, $0, 0x020001 sw $10, 268511320($0) addi $10, $0, 0x513712 sw $10, 268511324($0) addi $10, $0, 0xfac504 sw $10, 268511328($0) addi $10, $0, 0xfbc501 sw $10, 268511332($0) addi $10, $0, 0xfbc501 sw $10, 268511336($0) addi $10, $0, 0xfdc500 sw $10, 268511340($0) addi $10, $0, 0xfdd140 sw $10, 268511344($0) addi $10, $0, 0xf9cd2c sw $10, 268511348($0) addi $10, $0, 0xfbc501 sw $10, 268511352($0) addi $10, $0, 0xfbc501 sw $10, 268511356($0) addi $10, $0, 0xfbc501 sw $10, 268511360($0) addi $10, $0, 0xfbc501 sw $10, 268511364($0) addi $10, $0, 0xfbc501 sw $10, 268511368($0) addi $10, $0, 0xfbc501 sw $10, 268511372($0) addi $10, $0, 0xfbc501 sw $10, 268511376($0) addi $10, $0, 0xfbc501 sw $10, 268511380($0) addi $10, $0, 0xfbc501 sw $10, 268511384($0) addi $10, $0, 0xfdc500 sw $10, 268511388($0) addi $10, $0, 0xc59f25 sw $10, 268511392($0) addi $10, $0, 0x010101 sw $10, 268511396($0) addi $10, $0, 0xffffff sw $10, 268511400($0) addi $10, $0, 0xffffff sw $10, 268511404($0) addi $10, $0, 0xffffff sw $10, 268511408($0) addi $10, $0, 0xffffff sw $10, 268511412($0) addi $10, $0, 0xffffff sw $10, 268511416($0) addi $10, $0, 0xffffff sw $10, 268511420($0) addi $10, $0, 0xffffff sw $10, 268511424($0) addi $10, $0, 0xffffff sw $10, 268511428($0) addi $10, $0, 0xffffff sw $10, 268511432($0) addi $10, $0, 0xffffff sw $10, 268511436($0) addi $10, $0, 0xffffff sw $10, 268511440($0) addi $10, $0, 0xffffff sw $10, 268511444($0) addi $10, $0, 0xffffff sw $10, 268511448($0) addi $10, $0, 0xffffff sw $10, 268511452($0) addi $10, $0, 0xffffff sw $10, 268511456($0) addi $10, $0, 0xffffff sw $10, 268511460($0) addi $10, $0, 0xffffff sw $10, 268511464($0) addi $10, $0, 0xffffff sw $10, 268511468($0) addi $10, $0, 0xffffff sw $10, 268511472($0) addi $10, $0, 0xffffff sw $10, 268511476($0) addi $10, $0, 0xffffff sw $10, 268511480($0) addi $10, $0, 0x00d800 sw $10, 268511484($0) addi $10, $0, 0x00d800 sw $10, 268511488($0) addi $10, $0, 0xffffff sw $10, 268511492($0) addi $10, $0, 0xffffff sw $10, 268511496($0) addi $10, $0, 0xffffff sw $10, 268511500($0) addi $10, $0, 0xffffff sw $10, 268511504($0) addi $10, $0, 0xffffff sw $10, 268511508($0) addi $10, $0, 0xffffff sw $10, 268511512($0) addi $10, $0, 0xffffff sw $10, 268511516($0) addi $10, $0, 0xffffff sw $10, 268511520($0) addi $10, $0, 0xffffff sw $10, 268511524($0) addi $10, $0, 0xffffff sw $10, 268511528($0) addi $10, $0, 0xffffff sw $10, 268511532($0) addi $10, $0, 0xffffff sw $10, 268511536($0) addi $10, $0, 0xffffff sw $10, 268511540($0) addi $10, $0, 0xffffff sw $10, 268511544($0) addi $10, $0, 0xffffff sw $10, 268511548($0) addi $10, $0, 0xffffff sw $10, 268511552($0) addi $10, $0, 0xffffff sw $10, 268511556($0) addi $10, $0, 0xffffff sw $10, 268511560($0) addi $10, $0, 0xffffff sw $10, 268511564($0) addi $10, $0, 0xffffff sw $10, 268511568($0) addi $10, $0, 0xffffff sw $10, 268511572($0) addi $10, $0, 0x020001 sw $10, 268511576($0) addi $10, $0, 0x513712 sw $10, 268511580($0) addi $10, $0, 0xfac504 sw $10, 268511584($0) addi $10, $0, 0xfbc501 sw $10, 268511588($0) addi $10, $0, 0xfbc404 sw $10, 268511592($0) addi $10, $0, 0xfcd23e sw $10, 268511596($0) addi $10, $0, 0xf2c423 sw $10, 268511600($0) addi $10, $0, 0xf8ce2e sw $10, 268511604($0) addi $10, $0, 0xfbc501 sw $10, 268511608($0) addi $10, $0, 0xfbc501 sw $10, 268511612($0) addi $10, $0, 0xfbc501 sw $10, 268511616($0) addi $10, $0, 0xfbc501 sw $10, 268511620($0) addi $10, $0, 0xfbc501 sw $10, 268511624($0) addi $10, $0, 0xfbc501 sw $10, 268511628($0) addi $10, $0, 0xfbc501 sw $10, 268511632($0) addi $10, $0, 0xfbc501 sw $10, 268511636($0) addi $10, $0, 0xfbc501 sw $10, 268511640($0) addi $10, $0, 0xfdc500 sw $10, 268511644($0) addi $10, $0, 0xc59f25 sw $10, 268511648($0) addi $10, $0, 0x010101 sw $10, 268511652($0) addi $10, $0, 0xffffff sw $10, 268511656($0) addi $10, $0, 0xffffff sw $10, 268511660($0) addi $10, $0, 0xffffff sw $10, 268511664($0) addi $10, $0, 0xffffff sw $10, 268511668($0) addi $10, $0, 0xffffff sw $10, 268511672($0) addi $10, $0, 0xffffff sw $10, 268511676($0) addi $10, $0, 0xffffff sw $10, 268511680($0) addi $10, $0, 0xffffff sw $10, 268511684($0) addi $10, $0, 0xffffff sw $10, 268511688($0) addi $10, $0, 0xffffff sw $10, 268511692($0) addi $10, $0, 0xffffff sw $10, 268511696($0) addi $10, $0, 0xffffff sw $10, 268511700($0) addi $10, $0, 0xffffff sw $10, 268511704($0) addi $10, $0, 0xffffff sw $10, 268511708($0) addi $10, $0, 0xffffff sw $10, 268511712($0) addi $10, $0, 0xffffff sw $10, 268511716($0) addi $10, $0, 0xffffff sw $10, 268511720($0) addi $10, $0, 0xffffff sw $10, 268511724($0) addi $10, $0, 0xffffff sw $10, 268511728($0) addi $10, $0, 0xffffff sw $10, 268511732($0) addi $10, $0, 0xffffff sw $10, 268511736($0) addi $10, $0, 0x00d800 sw $10, 268511740($0) addi $10, $0, 0x00d800 sw $10, 268511744($0) addi $10, $0, 0xffffff sw $10, 268511748($0) addi $10, $0, 0xffffff sw $10, 268511752($0) addi $10, $0, 0xffffff sw $10, 268511756($0) addi $10, $0, 0xffffff sw $10, 268511760($0) addi $10, $0, 0xffffff sw $10, 268511764($0) addi $10, $0, 0xffffff sw $10, 268511768($0) addi $10, $0, 0xffffff sw $10, 268511772($0) addi $10, $0, 0xffffff sw $10, 268511776($0) addi $10, $0, 0xffffff sw $10, 268511780($0) addi $10, $0, 0xffffff sw $10, 268511784($0) addi $10, $0, 0xffffff sw $10, 268511788($0) addi $10, $0, 0xffffff sw $10, 268511792($0) addi $10, $0, 0xffffff sw $10, 268511796($0) addi $10, $0, 0xffffff sw $10, 268511800($0) addi $10, $0, 0xffffff sw $10, 268511804($0) addi $10, $0, 0xffffff sw $10, 268511808($0) addi $10, $0, 0xffffff sw $10, 268511812($0) addi $10, $0, 0xffffff sw $10, 268511816($0) addi $10, $0, 0xffffff sw $10, 268511820($0) addi $10, $0, 0xffffff sw $10, 268511824($0) addi $10, $0, 0xffffff sw $10, 268511828($0) addi $10, $0, 0x020001 sw $10, 268511832($0) addi $10, $0, 0x503815 sw $10, 268511836($0) addi $10, $0, 0xfdc403 sw $10, 268511840($0) addi $10, $0, 0xf8c403 sw $10, 268511844($0) addi $10, $0, 0xfdcf31 sw $10, 268511848($0) addi $10, $0, 0xfad334 sw $10, 268511852($0) addi $10, $0, 0xeec007 sw $10, 268511856($0) addi $10, $0, 0xfac00b sw $10, 268511860($0) addi $10, $0, 0xfec206 sw $10, 268511864($0) addi $10, $0, 0xfec206 sw $10, 268511868($0) addi $10, $0, 0xfec206 sw $10, 268511872($0) addi $10, $0, 0xfec206 sw $10, 268511876($0) addi $10, $0, 0xfec206 sw $10, 268511880($0) addi $10, $0, 0xfec206 sw $10, 268511884($0) addi $10, $0, 0xfec206 sw $10, 268511888($0) addi $10, $0, 0xfec206 sw $10, 268511892($0) addi $10, $0, 0xfec206 sw $10, 268511896($0) addi $10, $0, 0xfec303 sw $10, 268511900($0) addi $10, $0, 0xc89e24 sw $10, 268511904($0) addi $10, $0, 0x030001 sw $10, 268511908($0) addi $10, $0, 0xffffff sw $10, 268511912($0) addi $10, $0, 0xffffff sw $10, 268511916($0) addi $10, $0, 0xffffff sw $10, 268511920($0) addi $10, $0, 0xffffff sw $10, 268511924($0) addi $10, $0, 0xffffff sw $10, 268511928($0) addi $10, $0, 0xffffff sw $10, 268511932($0) addi $10, $0, 0xffffff sw $10, 268511936($0) addi $10, $0, 0xffffff sw $10, 268511940($0) addi $10, $0, 0xffffff sw $10, 268511944($0) addi $10, $0, 0xffffff sw $10, 268511948($0) addi $10, $0, 0xffffff sw $10, 268511952($0) addi $10, $0, 0xffffff sw $10, 268511956($0) addi $10, $0, 0xffffff sw $10, 268511960($0) addi $10, $0, 0xffffff sw $10, 268511964($0) addi $10, $0, 0xffffff sw $10, 268511968($0) addi $10, $0, 0xffffff sw $10, 268511972($0) addi $10, $0, 0xffffff sw $10, 268511976($0) addi $10, $0, 0xffffff sw $10, 268511980($0) addi $10, $0, 0xffffff sw $10, 268511984($0) addi $10, $0, 0xffffff sw $10, 268511988($0) addi $10, $0, 0xffffff sw $10, 268511992($0) addi $10, $0, 0x00d800 sw $10, 268511996($0) addi $10, $0, 0x00d800 sw $10, 268512000($0) addi $10, $0, 0xffffff sw $10, 268512004($0) addi $10, $0, 0xffffff sw $10, 268512008($0) addi $10, $0, 0xffffff sw $10, 268512012($0) addi $10, $0, 0xffffff sw $10, 268512016($0) addi $10, $0, 0xffffff sw $10, 268512020($0) addi $10, $0, 0xffffff sw $10, 268512024($0) addi $10, $0, 0xffffff sw $10, 268512028($0) addi $10, $0, 0xffffff sw $10, 268512032($0) addi $10, $0, 0xffffff sw $10, 268512036($0) addi $10, $0, 0xffffff sw $10, 268512040($0) addi $10, $0, 0xffffff sw $10, 268512044($0) addi $10, $0, 0xffffff sw $10, 268512048($0) addi $10, $0, 0xffffff sw $10, 268512052($0) addi $10, $0, 0xffffff sw $10, 268512056($0) addi $10, $0, 0xffffff sw $10, 268512060($0) addi $10, $0, 0xffffff sw $10, 268512064($0) addi $10, $0, 0xffffff sw $10, 268512068($0) addi $10, $0, 0xffffff sw $10, 268512072($0) addi $10, $0, 0xffffff sw $10, 268512076($0) addi $10, $0, 0xffffff sw $10, 268512080($0) addi $10, $0, 0xffffff sw $10, 268512084($0) addi $10, $0, 0xfefdfe sw $10, 268512088($0) addi $10, $0, 0xb6b8b8 sw $10, 268512092($0) addi $10, $0, 0x06030d sw $10, 268512096($0) addi $10, $0, 0x060807 sw $10, 268512100($0) addi $10, $0, 0x433e3a sw $10, 268512104($0) addi $10, $0, 0x413f3a sw $10, 268512108($0) addi $10, $0, 0x040503 sw $10, 268512112($0) addi $10, $0, 0x040304 sw $10, 268512116($0) addi $10, $0, 0x040304 sw $10, 268512120($0) addi $10, $0, 0x040304 sw $10, 268512124($0) addi $10, $0, 0x040304 sw $10, 268512128($0) addi $10, $0, 0x040304 sw $10, 268512132($0) addi $10, $0, 0x040304 sw $10, 268512136($0) addi $10, $0, 0x040304 sw $10, 268512140($0) addi $10, $0, 0x040304 sw $10, 268512144($0) addi $10, $0, 0x040304 sw $10, 268512148($0) addi $10, $0, 0x040304 sw $10, 268512152($0) addi $10, $0, 0x06020a sw $10, 268512156($0) addi $10, $0, 0x332e31 sw $10, 268512160($0) addi $10, $0, 0xfdfefe sw $10, 268512164($0) addi $10, $0, 0xffffff sw $10, 268512168($0) addi $10, $0, 0xffffff sw $10, 268512172($0) addi $10, $0, 0xffffff sw $10, 268512176($0) addi $10, $0, 0xffffff sw $10, 268512180($0) addi $10, $0, 0xffffff sw $10, 268512184($0) addi $10, $0, 0xffffff sw $10, 268512188($0) addi $10, $0, 0xffffff sw $10, 268512192($0) addi $10, $0, 0xffffff sw $10, 268512196($0) addi $10, $0, 0xffffff sw $10, 268512200($0) addi $10, $0, 0xffffff sw $10, 268512204($0) addi $10, $0, 0xffffff sw $10, 268512208($0) addi $10, $0, 0xffffff sw $10, 268512212($0) addi $10, $0, 0xffffff sw $10, 268512216($0) addi $10, $0, 0xffffff sw $10, 268512220($0) addi $10, $0, 0xffffff sw $10, 268512224($0) addi $10, $0, 0xffffff sw $10, 268512228($0) addi $10, $0, 0xffffff sw $10, 268512232($0) addi $10, $0, 0xffffff sw $10, 268512236($0) addi $10, $0, 0xffffff sw $10, 268512240($0) addi $10, $0, 0xffffff sw $10, 268512244($0) addi $10, $0, 0xffffff sw $10, 268512248($0) addi $10, $0, 0x00d800 sw $10, 268512252($0) addi $10, $0, 0x00d800 sw $10, 268512256($0) addi $10, $0, 0xffffff sw $10, 268512260($0) addi $10, $0, 0xffffff sw $10, 268512264($0) addi $10, $0, 0xffffff sw $10, 268512268($0) addi $10, $0, 0xffffff sw $10, 268512272($0) addi $10, $0, 0xffffff sw $10, 268512276($0) addi $10, $0, 0xffffff sw $10, 268512280($0) addi $10, $0, 0xffffff sw $10, 268512284($0) addi $10, $0, 0xffffff sw $10, 268512288($0) addi $10, $0, 0xffffff sw $10, 268512292($0) addi $10, $0, 0xffffff sw $10, 268512296($0) addi $10, $0, 0xffffff sw $10, 268512300($0) addi $10, $0, 0xffffff sw $10, 268512304($0) addi $10, $0, 0xffffff sw $10, 268512308($0) addi $10, $0, 0xffffff sw $10, 268512312($0) addi $10, $0, 0xffffff sw $10, 268512316($0) addi $10, $0, 0xffffff sw $10, 268512320($0) addi $10, $0, 0xffffff sw $10, 268512324($0) addi $10, $0, 0xffffff sw $10, 268512328($0) addi $10, $0, 0xffffff sw $10, 268512332($0) addi $10, $0, 0xffffff sw $10, 268512336($0) addi $10, $0, 0xffffff sw $10, 268512340($0) addi $10, $0, 0xffffff sw $10, 268512344($0) addi $10, $0, 0xb8b6b7 sw $10, 268512348($0) addi $10, $0, 0x3e3c3d sw $10, 268512352($0) addi $10, $0, 0x414141 sw $10, 268512356($0) addi $10, $0, 0x040303 sw $10, 268512360($0) addi $10, $0, 0x040203 sw $10, 268512364($0) addi $10, $0, 0x030202 sw $10, 268512368($0) addi $10, $0, 0x030202 sw $10, 268512372($0) addi $10, $0, 0x030202 sw $10, 268512376($0) addi $10, $0, 0x030202 sw $10, 268512380($0) addi $10, $0, 0x030202 sw $10, 268512384($0) addi $10, $0, 0x030202 sw $10, 268512388($0) addi $10, $0, 0x030202 sw $10, 268512392($0) addi $10, $0, 0x030202 sw $10, 268512396($0) addi $10, $0, 0x030202 sw $10, 268512400($0) addi $10, $0, 0x030202 sw $10, 268512404($0) addi $10, $0, 0x030202 sw $10, 268512408($0) addi $10, $0, 0x030202 sw $10, 268512412($0) addi $10, $0, 0x2f2e2e sw $10, 268512416($0) addi $10, $0, 0xffffff sw $10, 268512420($0) addi $10, $0, 0xffffff sw $10, 268512424($0) addi $10, $0, 0xffffff sw $10, 268512428($0) addi $10, $0, 0xffffff sw $10, 268512432($0) addi $10, $0, 0xffffff sw $10, 268512436($0) addi $10, $0, 0xffffff sw $10, 268512440($0) addi $10, $0, 0xffffff sw $10, 268512444($0) addi $10, $0, 0xffffff sw $10, 268512448($0) addi $10, $0, 0xffffff sw $10, 268512452($0) addi $10, $0, 0xffffff sw $10, 268512456($0) addi $10, $0, 0xffffff sw $10, 268512460($0) addi $10, $0, 0xffffff sw $10, 268512464($0) addi $10, $0, 0xffffff sw $10, 268512468($0) addi $10, $0, 0xffffff sw $10, 268512472($0) addi $10, $0, 0xffffff sw $10, 268512476($0) addi $10, $0, 0xffffff sw $10, 268512480($0) addi $10, $0, 0xffffff sw $10, 268512484($0) addi $10, $0, 0xffffff sw $10, 268512488($0) addi $10, $0, 0xffffff sw $10, 268512492($0) addi $10, $0, 0xffffff sw $10, 268512496($0) addi $10, $0, 0xffffff sw $10, 268512500($0) addi $10, $0, 0xffffff sw $10, 268512504($0) addi $10, $0, 0x00d800 sw $10, 268512508($0) addi $10, $0, 0x00d800 sw $10, 268512512($0) addi $10, $0, 0xffffff sw $10, 268512516($0) addi $10, $0, 0xffffff sw $10, 268512520($0) addi $10, $0, 0xffffff sw $10, 268512524($0) addi $10, $0, 0xffffff sw $10, 268512528($0) addi $10, $0, 0xffffff sw $10, 268512532($0) addi $10, $0, 0xffffff sw $10, 268512536($0) addi $10, $0, 0xffffff sw $10, 268512540($0) addi $10, $0, 0xffffff sw $10, 268512544($0) addi $10, $0, 0xffffff sw $10, 268512548($0) addi $10, $0, 0xffffff sw $10, 268512552($0) addi $10, $0, 0xffffff sw $10, 268512556($0) addi $10, $0, 0xffffff sw $10, 268512560($0) addi $10, $0, 0xffffff sw $10, 268512564($0) addi $10, $0, 0xffffff sw $10, 268512568($0) addi $10, $0, 0xffffff sw $10, 268512572($0) addi $10, $0, 0xffffff sw $10, 268512576($0) addi $10, $0, 0xffffff sw $10, 268512580($0) addi $10, $0, 0xffffff sw $10, 268512584($0) addi $10, $0, 0xffffff sw $10, 268512588($0) addi $10, $0, 0xffffff sw $10, 268512592($0) addi $10, $0, 0xffffff sw $10, 268512596($0) addi $10, $0, 0xffffff sw $10, 268512600($0) addi $10, $0, 0xffffff sw $10, 268512604($0) addi $10, $0, 0xffffff sw $10, 268512608($0) addi $10, $0, 0xffffff sw $10, 268512612($0) addi $10, $0, 0xffffff sw $10, 268512616($0) addi $10, $0, 0xffffff sw $10, 268512620($0) addi $10, $0, 0xffffff sw $10, 268512624($0) addi $10, $0, 0xffffff sw $10, 268512628($0) addi $10, $0, 0xffffff sw $10, 268512632($0) addi $10, $0, 0xffffff sw $10, 268512636($0) addi $10, $0, 0xffffff sw $10, 268512640($0) addi $10, $0, 0xffffff sw $10, 268512644($0) addi $10, $0, 0xffffff sw $10, 268512648($0) addi $10, $0, 0xffffff sw $10, 268512652($0) addi $10, $0, 0xffffff sw $10, 268512656($0) addi $10, $0, 0xffffff sw $10, 268512660($0) addi $10, $0, 0xffffff sw $10, 268512664($0) addi $10, $0, 0xffffff sw $10, 268512668($0) addi $10, $0, 0xffffff sw $10, 268512672($0) addi $10, $0, 0xffffff sw $10, 268512676($0) addi $10, $0, 0xffffff sw $10, 268512680($0) addi $10, $0, 0xffffff sw $10, 268512684($0) addi $10, $0, 0xffffff sw $10, 268512688($0) addi $10, $0, 0xffffff sw $10, 268512692($0) addi $10, $0, 0xffffff sw $10, 268512696($0) addi $10, $0, 0xffffff sw $10, 268512700($0) addi $10, $0, 0xffffff sw $10, 268512704($0) addi $10, $0, 0xffffff sw $10, 268512708($0) addi $10, $0, 0xffffff sw $10, 268512712($0) addi $10, $0, 0xffffff sw $10, 268512716($0) addi $10, $0, 0xffffff sw $10, 268512720($0) addi $10, $0, 0xffffff sw $10, 268512724($0) addi $10, $0, 0xffffff sw $10, 268512728($0) addi $10, $0, 0xffffff sw $10, 268512732($0) addi $10, $0, 0xffffff sw $10, 268512736($0) addi $10, $0, 0xffffff sw $10, 268512740($0) addi $10, $0, 0xffffff sw $10, 268512744($0) addi $10, $0, 0xffffff sw $10, 268512748($0) addi $10, $0, 0xffffff sw $10, 268512752($0) addi $10, $0, 0xffffff sw $10, 268512756($0) addi $10, $0, 0xffffff sw $10, 268512760($0) addi $10, $0, 0x00d800 sw $10, 268512764($0) addi $10, $0, 0x00d800 sw $10, 268512768($0) addi $10, $0, 0xffffff sw $10, 268512772($0) addi $10, $0, 0xffffff sw $10, 268512776($0) addi $10, $0, 0xffffff sw $10, 268512780($0) addi $10, $0, 0xffffff sw $10, 268512784($0) addi $10, $0, 0xffffff sw $10, 268512788($0) addi $10, $0, 0xffffff sw $10, 268512792($0) addi $10, $0, 0xffffff sw $10, 268512796($0) addi $10, $0, 0xffffff sw $10, 268512800($0) addi $10, $0, 0xffffff sw $10, 268512804($0) addi $10, $0, 0xffffff sw $10, 268512808($0) addi $10, $0, 0xffffff sw $10, 268512812($0) addi $10, $0, 0xffffff sw $10, 268512816($0) addi $10, $0, 0xffffff sw $10, 268512820($0) addi $10, $0, 0xffffff sw $10, 268512824($0) addi $10, $0, 0xffffff sw $10, 268512828($0) addi $10, $0, 0xffffff sw $10, 268512832($0) addi $10, $0, 0xffffff sw $10, 268512836($0) addi $10, $0, 0xffffff sw $10, 268512840($0) addi $10, $0, 0xffffff sw $10, 268512844($0) addi $10, $0, 0xffffff sw $10, 268512848($0) addi $10, $0, 0xffffff sw $10, 268512852($0) addi $10, $0, 0xffffff sw $10, 268512856($0) addi $10, $0, 0xffffff sw $10, 268512860($0) addi $10, $0, 0xffffff sw $10, 268512864($0) addi $10, $0, 0xffffff sw $10, 268512868($0) addi $10, $0, 0xffffff sw $10, 268512872($0) addi $10, $0, 0xffffff sw $10, 268512876($0) addi $10, $0, 0xffffff sw $10, 268512880($0) addi $10, $0, 0xffffff sw $10, 268512884($0) addi $10, $0, 0xffffff sw $10, 268512888($0) addi $10, $0, 0xffffff sw $10, 268512892($0) addi $10, $0, 0xffffff sw $10, 268512896($0) addi $10, $0, 0xffffff sw $10, 268512900($0) addi $10, $0, 0xffffff sw $10, 268512904($0) addi $10, $0, 0xffffff sw $10, 268512908($0) addi $10, $0, 0xffffff sw $10, 268512912($0) addi $10, $0, 0xffffff sw $10, 268512916($0) addi $10, $0, 0xffffff sw $10, 268512920($0) addi $10, $0, 0xffffff sw $10, 268512924($0) addi $10, $0, 0xffffff sw $10, 268512928($0) addi $10, $0, 0xffffff sw $10, 268512932($0) addi $10, $0, 0xffffff sw $10, 268512936($0) addi $10, $0, 0xffffff sw $10, 268512940($0) addi $10, $0, 0xffffff sw $10, 268512944($0) addi $10, $0, 0xffffff sw $10, 268512948($0) addi $10, $0, 0xffffff sw $10, 268512952($0) addi $10, $0, 0xffffff sw $10, 268512956($0) addi $10, $0, 0xffffff sw $10, 268512960($0) addi $10, $0, 0xffffff sw $10, 268512964($0) addi $10, $0, 0xffffff sw $10, 268512968($0) addi $10, $0, 0xffffff sw $10, 268512972($0) addi $10, $0, 0xffffff sw $10, 268512976($0) addi $10, $0, 0xffffff sw $10, 268512980($0) addi $10, $0, 0xffffff sw $10, 268512984($0) addi $10, $0, 0xffffff sw $10, 268512988($0) addi $10, $0, 0xffffff sw $10, 268512992($0) addi $10, $0, 0xffffff sw $10, 268512996($0) addi $10, $0, 0xffffff sw $10, 268513000($0) addi $10, $0, 0xffffff sw $10, 268513004($0) addi $10, $0, 0xffffff sw $10, 268513008($0) addi $10, $0, 0xffffff sw $10, 268513012($0) addi $10, $0, 0xffffff sw $10, 268513016($0) addi $10, $0, 0x00d800 sw $10, 268513020($0) addi $10, $0, 0x00d800 sw $10, 268513024($0) addi $10, $0, 0xffffff sw $10, 268513028($0) addi $10, $0, 0xffffff sw $10, 268513032($0) addi $10, $0, 0xffffff sw $10, 268513036($0) addi $10, $0, 0xffffff sw $10, 268513040($0) addi $10, $0, 0xffffff sw $10, 268513044($0) addi $10, $0, 0xffffff sw $10, 268513048($0) addi $10, $0, 0xffffff sw $10, 268513052($0) addi $10, $0, 0xffffff sw $10, 268513056($0) addi $10, $0, 0xffffff sw $10, 268513060($0) addi $10, $0, 0xffffff sw $10, 268513064($0) addi $10, $0, 0xffffff sw $10, 268513068($0) addi $10, $0, 0xffffff sw $10, 268513072($0) addi $10, $0, 0xffffff sw $10, 268513076($0) addi $10, $0, 0xffffff sw $10, 268513080($0) addi $10, $0, 0xffffff sw $10, 268513084($0) addi $10, $0, 0xffffff sw $10, 268513088($0) addi $10, $0, 0xffffff sw $10, 268513092($0) addi $10, $0, 0xffffff sw $10, 268513096($0) addi $10, $0, 0xffffff sw $10, 268513100($0) addi $10, $0, 0xffffff sw $10, 268513104($0) addi $10, $0, 0xffffff sw $10, 268513108($0) addi $10, $0, 0xffffff sw $10, 268513112($0) addi $10, $0, 0xffffff sw $10, 268513116($0) addi $10, $0, 0xffffff sw $10, 268513120($0) addi $10, $0, 0xffffff sw $10, 268513124($0) addi $10, $0, 0xffffff sw $10, 268513128($0) addi $10, $0, 0xffffff sw $10, 268513132($0) addi $10, $0, 0xffffff sw $10, 268513136($0) addi $10, $0, 0xffffff sw $10, 268513140($0) addi $10, $0, 0xffffff sw $10, 268513144($0) addi $10, $0, 0xffffff sw $10, 268513148($0) addi $10, $0, 0xffffff sw $10, 268513152($0) addi $10, $0, 0xffffff sw $10, 268513156($0) addi $10, $0, 0xffffff sw $10, 268513160($0) addi $10, $0, 0xffffff sw $10, 268513164($0) addi $10, $0, 0xffffff sw $10, 268513168($0) addi $10, $0, 0xffffff sw $10, 268513172($0) addi $10, $0, 0xffffff sw $10, 268513176($0) addi $10, $0, 0xffffff sw $10, 268513180($0) addi $10, $0, 0xffffff sw $10, 268513184($0) addi $10, $0, 0xffffff sw $10, 268513188($0) addi $10, $0, 0xffffff sw $10, 268513192($0) addi $10, $0, 0xffffff sw $10, 268513196($0) addi $10, $0, 0xffffff sw $10, 268513200($0) addi $10, $0, 0xffffff sw $10, 268513204($0) addi $10, $0, 0xffffff sw $10, 268513208($0) addi $10, $0, 0xffffff sw $10, 268513212($0) addi $10, $0, 0xffffff sw $10, 268513216($0) addi $10, $0, 0xffffff sw $10, 268513220($0) addi $10, $0, 0xffffff sw $10, 268513224($0) addi $10, $0, 0xffffff sw $10, 268513228($0) addi $10, $0, 0xffffff sw $10, 268513232($0) addi $10, $0, 0xffffff sw $10, 268513236($0) addi $10, $0, 0xffffff sw $10, 268513240($0) addi $10, $0, 0xffffff sw $10, 268513244($0) addi $10, $0, 0xffffff sw $10, 268513248($0) addi $10, $0, 0xffffff sw $10, 268513252($0) addi $10, $0, 0xffffff sw $10, 268513256($0) addi $10, $0, 0xffffff sw $10, 268513260($0) addi $10, $0, 0xffffff sw $10, 268513264($0) addi $10, $0, 0xffffff sw $10, 268513268($0) addi $10, $0, 0xffffff sw $10, 268513272($0) addi $10, $0, 0x00d800 sw $10, 268513276($0) addi $10, $0, 0x00d800 sw $10, 268513280($0) addi $10, $0, 0xffffff sw $10, 268513284($0) addi $10, $0, 0xffffff sw $10, 268513288($0) addi $10, $0, 0xffffff sw $10, 268513292($0) addi $10, $0, 0xffffff sw $10, 268513296($0) addi $10, $0, 0xffffff sw $10, 268513300($0) addi $10, $0, 0xffffff sw $10, 268513304($0) addi $10, $0, 0xffffff sw $10, 268513308($0) addi $10, $0, 0xffffff sw $10, 268513312($0) addi $10, $0, 0xffffff sw $10, 268513316($0) addi $10, $0, 0xffffff sw $10, 268513320($0) addi $10, $0, 0xffffff sw $10, 268513324($0) addi $10, $0, 0xffffff sw $10, 268513328($0) addi $10, $0, 0xffffff sw $10, 268513332($0) addi $10, $0, 0xffffff sw $10, 268513336($0) addi $10, $0, 0xffffff sw $10, 268513340($0) addi $10, $0, 0xffffff sw $10, 268513344($0) addi $10, $0, 0xffffff sw $10, 268513348($0) addi $10, $0, 0xffffff sw $10, 268513352($0) addi $10, $0, 0xffffff sw $10, 268513356($0) addi $10, $0, 0xffffff sw $10, 268513360($0) addi $10, $0, 0xffffff sw $10, 268513364($0) addi $10, $0, 0xffffff sw $10, 268513368($0) addi $10, $0, 0xffffff sw $10, 268513372($0) addi $10, $0, 0xffffff sw $10, 268513376($0) addi $10, $0, 0xffffff sw $10, 268513380($0) addi $10, $0, 0xffffff sw $10, 268513384($0) addi $10, $0, 0xffffff sw $10, 268513388($0) addi $10, $0, 0xffffff sw $10, 268513392($0) addi $10, $0, 0xffffff sw $10, 268513396($0) addi $10, $0, 0xffffff sw $10, 268513400($0) addi $10, $0, 0xffffff sw $10, 268513404($0) addi $10, $0, 0xffffff sw $10, 268513408($0) addi $10, $0, 0xffffff sw $10, 268513412($0) addi $10, $0, 0xffffff sw $10, 268513416($0) addi $10, $0, 0xffffff sw $10, 268513420($0) addi $10, $0, 0xffffff sw $10, 268513424($0) addi $10, $0, 0xffffff sw $10, 268513428($0) addi $10, $0, 0xffffff sw $10, 268513432($0) addi $10, $0, 0xffffff sw $10, 268513436($0) addi $10, $0, 0xffffff sw $10, 268513440($0) addi $10, $0, 0xffffff sw $10, 268513444($0) addi $10, $0, 0xffffff sw $10, 268513448($0) addi $10, $0, 0xffffff sw $10, 268513452($0) addi $10, $0, 0xffffff sw $10, 268513456($0) addi $10, $0, 0xffffff sw $10, 268513460($0) addi $10, $0, 0xffffff sw $10, 268513464($0) addi $10, $0, 0xffffff sw $10, 268513468($0) addi $10, $0, 0xffffff sw $10, 268513472($0) addi $10, $0, 0xffffff sw $10, 268513476($0) addi $10, $0, 0xffffff sw $10, 268513480($0) addi $10, $0, 0xffffff sw $10, 268513484($0) addi $10, $0, 0xffffff sw $10, 268513488($0) addi $10, $0, 0xffffff sw $10, 268513492($0) addi $10, $0, 0xffffff sw $10, 268513496($0) addi $10, $0, 0xffffff sw $10, 268513500($0) addi $10, $0, 0xffffff sw $10, 268513504($0) addi $10, $0, 0xffffff sw $10, 268513508($0) addi $10, $0, 0xffffff sw $10, 268513512($0) addi $10, $0, 0xffffff sw $10, 268513516($0) addi $10, $0, 0xffffff sw $10, 268513520($0) addi $10, $0, 0xffffff sw $10, 268513524($0) addi $10, $0, 0xffffff sw $10, 268513528($0) addi $10, $0, 0x00d800 sw $10, 268513532($0) addi $10, $0, 0x00d800 sw $10, 268513536($0) addi $10, $0, 0xffffff sw $10, 268513540($0) addi $10, $0, 0xffffff sw $10, 268513544($0) addi $10, $0, 0xffffff sw $10, 268513548($0) addi $10, $0, 0xffffff sw $10, 268513552($0) addi $10, $0, 0xffffff sw $10, 268513556($0) addi $10, $0, 0xffffff sw $10, 268513560($0) addi $10, $0, 0xffffff sw $10, 268513564($0) addi $10, $0, 0xffffff sw $10, 268513568($0) addi $10, $0, 0xffffff sw $10, 268513572($0) addi $10, $0, 0xffffff sw $10, 268513576($0) addi $10, $0, 0xffffff sw $10, 268513580($0) addi $10, $0, 0xffffff sw $10, 268513584($0) addi $10, $0, 0xffffff sw $10, 268513588($0) addi $10, $0, 0xffffff sw $10, 268513592($0) addi $10, $0, 0xffffff sw $10, 268513596($0) addi $10, $0, 0xffffff sw $10, 268513600($0) addi $10, $0, 0xffffff sw $10, 268513604($0) addi $10, $0, 0xffffff sw $10, 268513608($0) addi $10, $0, 0xffffff sw $10, 268513612($0) addi $10, $0, 0xffffff sw $10, 268513616($0) addi $10, $0, 0xffffff sw $10, 268513620($0) addi $10, $0, 0xffffff sw $10, 268513624($0) addi $10, $0, 0xffffff sw $10, 268513628($0) addi $10, $0, 0xffffff sw $10, 268513632($0) addi $10, $0, 0xffffff sw $10, 268513636($0) addi $10, $0, 0xffffff sw $10, 268513640($0) addi $10, $0, 0xffffff sw $10, 268513644($0) addi $10, $0, 0xffffff sw $10, 268513648($0) addi $10, $0, 0xffffff sw $10, 268513652($0) addi $10, $0, 0xffffff sw $10, 268513656($0) addi $10, $0, 0xffffff sw $10, 268513660($0) addi $10, $0, 0xffffff sw $10, 268513664($0) addi $10, $0, 0xffffff sw $10, 268513668($0) addi $10, $0, 0xffffff sw $10, 268513672($0) addi $10, $0, 0xffffff sw $10, 268513676($0) addi $10, $0, 0xffffff sw $10, 268513680($0) addi $10, $0, 0xffffff sw $10, 268513684($0) addi $10, $0, 0xffffff sw $10, 268513688($0) addi $10, $0, 0xffffff sw $10, 268513692($0) addi $10, $0, 0xffffff sw $10, 268513696($0) addi $10, $0, 0xffffff sw $10, 268513700($0) addi $10, $0, 0xffffff sw $10, 268513704($0) addi $10, $0, 0xffffff sw $10, 268513708($0) addi $10, $0, 0xffffff sw $10, 268513712($0) addi $10, $0, 0xffffff sw $10, 268513716($0) addi $10, $0, 0xffffff sw $10, 268513720($0) addi $10, $0, 0xffffff sw $10, 268513724($0) addi $10, $0, 0xffffff sw $10, 268513728($0) addi $10, $0, 0xffffff sw $10, 268513732($0) addi $10, $0, 0xffffff sw $10, 268513736($0) addi $10, $0, 0xffffff sw $10, 268513740($0) addi $10, $0, 0xffffff sw $10, 268513744($0) addi $10, $0, 0xffffff sw $10, 268513748($0) addi $10, $0, 0xffffff sw $10, 268513752($0) addi $10, $0, 0xffffff sw $10, 268513756($0) addi $10, $0, 0xffffff sw $10, 268513760($0) addi $10, $0, 0xffffff sw $10, 268513764($0) addi $10, $0, 0xffffff sw $10, 268513768($0) addi $10, $0, 0xffffff sw $10, 268513772($0) addi $10, $0, 0xffffff sw $10, 268513776($0) addi $10, $0, 0xffffff sw $10, 268513780($0) addi $10, $0, 0xffffff sw $10, 268513784($0) addi $10, $0, 0x00d800 sw $10, 268513788($0) addi $10, $0, 0x00d800 sw $10, 268513792($0) addi $10, $0, 0xffffff sw $10, 268513796($0) addi $10, $0, 0xffffff sw $10, 268513800($0) addi $10, $0, 0xffffff sw $10, 268513804($0) addi $10, $0, 0xffffff sw $10, 268513808($0) addi $10, $0, 0xffffff sw $10, 268513812($0) addi $10, $0, 0xffffff sw $10, 268513816($0) addi $10, $0, 0xffffff sw $10, 268513820($0) addi $10, $0, 0xffffff sw $10, 268513824($0) addi $10, $0, 0xffffff sw $10, 268513828($0) addi $10, $0, 0xffffff sw $10, 268513832($0) addi $10, $0, 0xffffff sw $10, 268513836($0) addi $10, $0, 0xffffff sw $10, 268513840($0) addi $10, $0, 0xffffff sw $10, 268513844($0) addi $10, $0, 0xffffff sw $10, 268513848($0) addi $10, $0, 0xffffff sw $10, 268513852($0) addi $10, $0, 0xffffff sw $10, 268513856($0) addi $10, $0, 0xffffff sw $10, 268513860($0) addi $10, $0, 0xffffff sw $10, 268513864($0) addi $10, $0, 0xffffff sw $10, 268513868($0) addi $10, $0, 0xffffff sw $10, 268513872($0) addi $10, $0, 0xffffff sw $10, 268513876($0) addi $10, $0, 0xffffff sw $10, 268513880($0) addi $10, $0, 0xffffff sw $10, 268513884($0) addi $10, $0, 0xffffff sw $10, 268513888($0) addi $10, $0, 0xffffff sw $10, 268513892($0) addi $10, $0, 0xffffff sw $10, 268513896($0) addi $10, $0, 0xffffff sw $10, 268513900($0) addi $10, $0, 0xffffff sw $10, 268513904($0) addi $10, $0, 0xffffff sw $10, 268513908($0) addi $10, $0, 0xffffff sw $10, 268513912($0) addi $10, $0, 0xffffff sw $10, 268513916($0) addi $10, $0, 0xffffff sw $10, 268513920($0) addi $10, $0, 0xffffff sw $10, 268513924($0) addi $10, $0, 0xffffff sw $10, 268513928($0) addi $10, $0, 0xffffff sw $10, 268513932($0) addi $10, $0, 0xffffff sw $10, 268513936($0) addi $10, $0, 0xffffff sw $10, 268513940($0) addi $10, $0, 0xffffff sw $10, 268513944($0) addi $10, $0, 0xffffff sw $10, 268513948($0) addi $10, $0, 0xffffff sw $10, 268513952($0) addi $10, $0, 0xffffff sw $10, 268513956($0) addi $10, $0, 0xffffff sw $10, 268513960($0) addi $10, $0, 0xffffff sw $10, 268513964($0) addi $10, $0, 0xffffff sw $10, 268513968($0) addi $10, $0, 0xffffff sw $10, 268513972($0) addi $10, $0, 0xffffff sw $10, 268513976($0) addi $10, $0, 0xffffff sw $10, 268513980($0) addi $10, $0, 0xffffff sw $10, 268513984($0) addi $10, $0, 0xffffff sw $10, 268513988($0) addi $10, $0, 0xffffff sw $10, 268513992($0) addi $10, $0, 0xffffff sw $10, 268513996($0) addi $10, $0, 0xffffff sw $10, 268514000($0) addi $10, $0, 0xffffff sw $10, 268514004($0) addi $10, $0, 0xffffff sw $10, 268514008($0) addi $10, $0, 0xffffff sw $10, 268514012($0) addi $10, $0, 0xffffff sw $10, 268514016($0) addi $10, $0, 0xffffff sw $10, 268514020($0) addi $10, $0, 0xffffff sw $10, 268514024($0) addi $10, $0, 0xffffff sw $10, 268514028($0) addi $10, $0, 0xffffff sw $10, 268514032($0) addi $10, $0, 0xffffff sw $10, 268514036($0) addi $10, $0, 0xffffff sw $10, 268514040($0) addi $10, $0, 0x00d800 sw $10, 268514044($0) addi $10, $0, 0x00d800 sw $10, 268514048($0) addi $10, $0, 0xffffff sw $10, 268514052($0) addi $10, $0, 0xffffff sw $10, 268514056($0) addi $10, $0, 0xffffff sw $10, 268514060($0) addi $10, $0, 0xffffff sw $10, 268514064($0) addi $10, $0, 0xffffff sw $10, 268514068($0) addi $10, $0, 0xffffff sw $10, 268514072($0) addi $10, $0, 0xffffff sw $10, 268514076($0) addi $10, $0, 0xffffff sw $10, 268514080($0) addi $10, $0, 0xffffff sw $10, 268514084($0) addi $10, $0, 0xffffff sw $10, 268514088($0) addi $10, $0, 0xffffff sw $10, 268514092($0) addi $10, $0, 0xffffff sw $10, 268514096($0) addi $10, $0, 0xffffff sw $10, 268514100($0) addi $10, $0, 0xffffff sw $10, 268514104($0) addi $10, $0, 0xffffff sw $10, 268514108($0) addi $10, $0, 0xffffff sw $10, 268514112($0) addi $10, $0, 0xffffff sw $10, 268514116($0) addi $10, $0, 0xffffff sw $10, 268514120($0) addi $10, $0, 0xffffff sw $10, 268514124($0) addi $10, $0, 0xffffff sw $10, 268514128($0) addi $10, $0, 0xffffff sw $10, 268514132($0) addi $10, $0, 0xffffff sw $10, 268514136($0) addi $10, $0, 0xffffff sw $10, 268514140($0) addi $10, $0, 0xffffff sw $10, 268514144($0) addi $10, $0, 0xffffff sw $10, 268514148($0) addi $10, $0, 0xffffff sw $10, 268514152($0) addi $10, $0, 0xffffff sw $10, 268514156($0) addi $10, $0, 0xffffff sw $10, 268514160($0) addi $10, $0, 0xffffff sw $10, 268514164($0) addi $10, $0, 0xffffff sw $10, 268514168($0) addi $10, $0, 0xffffff sw $10, 268514172($0) addi $10, $0, 0xffffff sw $10, 268514176($0) addi $10, $0, 0xffffff sw $10, 268514180($0) addi $10, $0, 0xffffff sw $10, 268514184($0) addi $10, $0, 0xffffff sw $10, 268514188($0) addi $10, $0, 0xffffff sw $10, 268514192($0) addi $10, $0, 0xffffff sw $10, 268514196($0) addi $10, $0, 0xffffff sw $10, 268514200($0) addi $10, $0, 0xffffff sw $10, 268514204($0) addi $10, $0, 0xffffff sw $10, 268514208($0) addi $10, $0, 0xffffff sw $10, 268514212($0) addi $10, $0, 0xffffff sw $10, 268514216($0) addi $10, $0, 0xffffff sw $10, 268514220($0) addi $10, $0, 0xffffff sw $10, 268514224($0) addi $10, $0, 0xffffff sw $10, 268514228($0) addi $10, $0, 0xffffff sw $10, 268514232($0) addi $10, $0, 0xffffff sw $10, 268514236($0) addi $10, $0, 0xffffff sw $10, 268514240($0) addi $10, $0, 0xffffff sw $10, 268514244($0) addi $10, $0, 0xffffff sw $10, 268514248($0) addi $10, $0, 0xffffff sw $10, 268514252($0) addi $10, $0, 0xffffff sw $10, 268514256($0) addi $10, $0, 0xffffff sw $10, 268514260($0) addi $10, $0, 0xffffff sw $10, 268514264($0) addi $10, $0, 0xffffff sw $10, 268514268($0) addi $10, $0, 0xffffff sw $10, 268514272($0) addi $10, $0, 0xffffff sw $10, 268514276($0) addi $10, $0, 0xffffff sw $10, 268514280($0) addi $10, $0, 0xffffff sw $10, 268514284($0) addi $10, $0, 0xffffff sw $10, 268514288($0) addi $10, $0, 0xffffff sw $10, 268514292($0) addi $10, $0, 0xffffff sw $10, 268514296($0) addi $10, $0, 0x00d800 sw $10, 268514300($0) addi $10, $0, 0x00d800 sw $10, 268514304($0) addi $10, $0, 0xffffff sw $10, 268514308($0) addi $10, $0, 0xffffff sw $10, 268514312($0) addi $10, $0, 0xffffff sw $10, 268514316($0) addi $10, $0, 0xffffff sw $10, 268514320($0) addi $10, $0, 0xffffff sw $10, 268514324($0) addi $10, $0, 0xffffff sw $10, 268514328($0) addi $10, $0, 0xffffff sw $10, 268514332($0) addi $10, $0, 0xffffff sw $10, 268514336($0) addi $10, $0, 0xffffff sw $10, 268514340($0) addi $10, $0, 0xffffff sw $10, 268514344($0) addi $10, $0, 0xffffff sw $10, 268514348($0) addi $10, $0, 0xffffff sw $10, 268514352($0) addi $10, $0, 0xffffff sw $10, 268514356($0) addi $10, $0, 0xffffff sw $10, 268514360($0) addi $10, $0, 0xffffff sw $10, 268514364($0) addi $10, $0, 0xffffff sw $10, 268514368($0) addi $10, $0, 0xffffff sw $10, 268514372($0) addi $10, $0, 0xffffff sw $10, 268514376($0) addi $10, $0, 0xffffff sw $10, 268514380($0) addi $10, $0, 0xffffff sw $10, 268514384($0) addi $10, $0, 0xffffff sw $10, 268514388($0) addi $10, $0, 0xffffff sw $10, 268514392($0) addi $10, $0, 0xffffff sw $10, 268514396($0) addi $10, $0, 0xffffff sw $10, 268514400($0) addi $10, $0, 0xffffff sw $10, 268514404($0) addi $10, $0, 0xffffff sw $10, 268514408($0) addi $10, $0, 0xffffff sw $10, 268514412($0) addi $10, $0, 0xffffff sw $10, 268514416($0) addi $10, $0, 0xffffff sw $10, 268514420($0) addi $10, $0, 0xffffff sw $10, 268514424($0) addi $10, $0, 0xffffff sw $10, 268514428($0) addi $10, $0, 0xffffff sw $10, 268514432($0) addi $10, $0, 0xffffff sw $10, 268514436($0) addi $10, $0, 0xffffff sw $10, 268514440($0) addi $10, $0, 0xffffff sw $10, 268514444($0) addi $10, $0, 0xffffff sw $10, 268514448($0) addi $10, $0, 0xffffff sw $10, 268514452($0) addi $10, $0, 0xffffff sw $10, 268514456($0) addi $10, $0, 0xffffff sw $10, 268514460($0) addi $10, $0, 0xffffff sw $10, 268514464($0) addi $10, $0, 0xffffff sw $10, 268514468($0) addi $10, $0, 0xffffff sw $10, 268514472($0) addi $10, $0, 0xffffff sw $10, 268514476($0) addi $10, $0, 0xffffff sw $10, 268514480($0) addi $10, $0, 0xffffff sw $10, 268514484($0) addi $10, $0, 0xffffff sw $10, 268514488($0) addi $10, $0, 0xffffff sw $10, 268514492($0) addi $10, $0, 0xffffff sw $10, 268514496($0) addi $10, $0, 0xffffff sw $10, 268514500($0) addi $10, $0, 0xffffff sw $10, 268514504($0) addi $10, $0, 0xffffff sw $10, 268514508($0) addi $10, $0, 0xffffff sw $10, 268514512($0) addi $10, $0, 0xffffff sw $10, 268514516($0) addi $10, $0, 0xffffff sw $10, 268514520($0) addi $10, $0, 0xffffff sw $10, 268514524($0) addi $10, $0, 0xffffff sw $10, 268514528($0) addi $10, $0, 0xffffff sw $10, 268514532($0) addi $10, $0, 0xffffff sw $10, 268514536($0) addi $10, $0, 0xffffff sw $10, 268514540($0) addi $10, $0, 0xffffff sw $10, 268514544($0) addi $10, $0, 0xffffff sw $10, 268514548($0) addi $10, $0, 0xffffff sw $10, 268514552($0) addi $10, $0, 0x00d800 sw $10, 268514556($0) addi $10, $0, 0x00d800 sw $10, 268514560($0) addi $10, $0, 0xffffff sw $10, 268514564($0) addi $10, $0, 0xffffff sw $10, 268514568($0) addi $10, $0, 0xffffff sw $10, 268514572($0) addi $10, $0, 0xffffff sw $10, 268514576($0) addi $10, $0, 0xffffff sw $10, 268514580($0) addi $10, $0, 0xffffff sw $10, 268514584($0) addi $10, $0, 0xffffff sw $10, 268514588($0) addi $10, $0, 0xffffff sw $10, 268514592($0) addi $10, $0, 0xffffff sw $10, 268514596($0) addi $10, $0, 0xffffff sw $10, 268514600($0) addi $10, $0, 0xffffff sw $10, 268514604($0) addi $10, $0, 0xffffff sw $10, 268514608($0) addi $10, $0, 0xffffff sw $10, 268514612($0) addi $10, $0, 0xffffff sw $10, 268514616($0) addi $10, $0, 0xffffff sw $10, 268514620($0) addi $10, $0, 0xffffff sw $10, 268514624($0) addi $10, $0, 0xffffff sw $10, 268514628($0) addi $10, $0, 0xffffff sw $10, 268514632($0) addi $10, $0, 0xffffff sw $10, 268514636($0) addi $10, $0, 0xffffff sw $10, 268514640($0) addi $10, $0, 0xffffff sw $10, 268514644($0) addi $10, $0, 0xffffff sw $10, 268514648($0) addi $10, $0, 0xffffff sw $10, 268514652($0) addi $10, $0, 0xffffff sw $10, 268514656($0) addi $10, $0, 0xffffff sw $10, 268514660($0) addi $10, $0, 0xffffff sw $10, 268514664($0) addi $10, $0, 0xffffff sw $10, 268514668($0) addi $10, $0, 0xffffff sw $10, 268514672($0) addi $10, $0, 0xffffff sw $10, 268514676($0) addi $10, $0, 0xffffff sw $10, 268514680($0) addi $10, $0, 0xffffff sw $10, 268514684($0) addi $10, $0, 0xffffff sw $10, 268514688($0) addi $10, $0, 0xffffff sw $10, 268514692($0) addi $10, $0, 0xffffff sw $10, 268514696($0) addi $10, $0, 0xffffff sw $10, 268514700($0) addi $10, $0, 0xffffff sw $10, 268514704($0) addi $10, $0, 0xffffff sw $10, 268514708($0) addi $10, $0, 0xffffff sw $10, 268514712($0) addi $10, $0, 0xffffff sw $10, 268514716($0) addi $10, $0, 0xffffff sw $10, 268514720($0) addi $10, $0, 0xffffff sw $10, 268514724($0) addi $10, $0, 0xffffff sw $10, 268514728($0) addi $10, $0, 0xffffff sw $10, 268514732($0) addi $10, $0, 0xffffff sw $10, 268514736($0) addi $10, $0, 0xffffff sw $10, 268514740($0) addi $10, $0, 0xffffff sw $10, 268514744($0) addi $10, $0, 0xffffff sw $10, 268514748($0) addi $10, $0, 0xffffff sw $10, 268514752($0) addi $10, $0, 0xffffff sw $10, 268514756($0) addi $10, $0, 0xffffff sw $10, 268514760($0) addi $10, $0, 0xffffff sw $10, 268514764($0) addi $10, $0, 0xffffff sw $10, 268514768($0) addi $10, $0, 0xffffff sw $10, 268514772($0) addi $10, $0, 0xffffff sw $10, 268514776($0) addi $10, $0, 0xffffff sw $10, 268514780($0) addi $10, $0, 0xffffff sw $10, 268514784($0) addi $10, $0, 0xffffff sw $10, 268514788($0) addi $10, $0, 0xffffff sw $10, 268514792($0) addi $10, $0, 0xffffff sw $10, 268514796($0) addi $10, $0, 0xffffff sw $10, 268514800($0) addi $10, $0, 0xffffff sw $10, 268514804($0) addi $10, $0, 0xffffff sw $10, 268514808($0) addi $10, $0, 0x00d800 sw $10, 268514812($0) addi $10, $0, 0x00d800 sw $10, 268514816($0) addi $10, $0, 0xffffff sw $10, 268514820($0) addi $10, $0, 0xffffff sw $10, 268514824($0) addi $10, $0, 0xffffff sw $10, 268514828($0) addi $10, $0, 0xffffff sw $10, 268514832($0) addi $10, $0, 0xffffff sw $10, 268514836($0) addi $10, $0, 0xffffff sw $10, 268514840($0) addi $10, $0, 0xffffff sw $10, 268514844($0) addi $10, $0, 0xffffff sw $10, 268514848($0) addi $10, $0, 0xffffff sw $10, 268514852($0) addi $10, $0, 0xffffff sw $10, 268514856($0) addi $10, $0, 0xffffff sw $10, 268514860($0) addi $10, $0, 0xffffff sw $10, 268514864($0) addi $10, $0, 0xffffff sw $10, 268514868($0) addi $10, $0, 0xffffff sw $10, 268514872($0) addi $10, $0, 0xffffff sw $10, 268514876($0) addi $10, $0, 0xffffff sw $10, 268514880($0) addi $10, $0, 0xffffff sw $10, 268514884($0) addi $10, $0, 0xffffff sw $10, 268514888($0) addi $10, $0, 0xffffff sw $10, 268514892($0) addi $10, $0, 0xffffff sw $10, 268514896($0) addi $10, $0, 0xffffff sw $10, 268514900($0) addi $10, $0, 0xffffff sw $10, 268514904($0) addi $10, $0, 0xffffff sw $10, 268514908($0) addi $10, $0, 0xffffff sw $10, 268514912($0) addi $10, $0, 0xffffff sw $10, 268514916($0) addi $10, $0, 0xffffff sw $10, 268514920($0) addi $10, $0, 0xffffff sw $10, 268514924($0) addi $10, $0, 0xffffff sw $10, 268514928($0) addi $10, $0, 0xffffff sw $10, 268514932($0) addi $10, $0, 0xffffff sw $10, 268514936($0) addi $10, $0, 0xffffff sw $10, 268514940($0) addi $10, $0, 0xffffff sw $10, 268514944($0) addi $10, $0, 0xffffff sw $10, 268514948($0) addi $10, $0, 0xffffff sw $10, 268514952($0) addi $10, $0, 0xffffff sw $10, 268514956($0) addi $10, $0, 0xffffff sw $10, 268514960($0) addi $10, $0, 0xffffff sw $10, 268514964($0) addi $10, $0, 0xffffff sw $10, 268514968($0) addi $10, $0, 0xffffff sw $10, 268514972($0) addi $10, $0, 0xffffff sw $10, 268514976($0) addi $10, $0, 0xffffff sw $10, 268514980($0) addi $10, $0, 0xffffff sw $10, 268514984($0) addi $10, $0, 0xffffff sw $10, 268514988($0) addi $10, $0, 0xffffff sw $10, 268514992($0) addi $10, $0, 0xffffff sw $10, 268514996($0) addi $10, $0, 0xffffff sw $10, 268515000($0) addi $10, $0, 0xffffff sw $10, 268515004($0) addi $10, $0, 0xffffff sw $10, 268515008($0) addi $10, $0, 0xffffff sw $10, 268515012($0) addi $10, $0, 0xffffff sw $10, 268515016($0) addi $10, $0, 0xffffff sw $10, 268515020($0) addi $10, $0, 0xffffff sw $10, 268515024($0) addi $10, $0, 0xffffff sw $10, 268515028($0) addi $10, $0, 0xffffff sw $10, 268515032($0) addi $10, $0, 0xffffff sw $10, 268515036($0) addi $10, $0, 0xffffff sw $10, 268515040($0) addi $10, $0, 0xffffff sw $10, 268515044($0) addi $10, $0, 0xffffff sw $10, 268515048($0) addi $10, $0, 0xffffff sw $10, 268515052($0) addi $10, $0, 0xffffff sw $10, 268515056($0) addi $10, $0, 0xffffff sw $10, 268515060($0) addi $10, $0, 0xffffff sw $10, 268515064($0) addi $10, $0, 0x00d800 sw $10, 268515068($0) addi $10, $0, 0x00d800 sw $10, 268515072($0) addi $10, $0, 0xffffff sw $10, 268515076($0) addi $10, $0, 0xffffff sw $10, 268515080($0) addi $10, $0, 0xffffff sw $10, 268515084($0) addi $10, $0, 0xffffff sw $10, 268515088($0) addi $10, $0, 0xffffff sw $10, 268515092($0) addi $10, $0, 0xffffff sw $10, 268515096($0) addi $10, $0, 0xffffff sw $10, 268515100($0) addi $10, $0, 0xffffff sw $10, 268515104($0) addi $10, $0, 0xffffff sw $10, 268515108($0) addi $10, $0, 0xffffff sw $10, 268515112($0) addi $10, $0, 0xffffff sw $10, 268515116($0) addi $10, $0, 0xffffff sw $10, 268515120($0) addi $10, $0, 0xffffff sw $10, 268515124($0) addi $10, $0, 0xffffff sw $10, 268515128($0) addi $10, $0, 0xffffff sw $10, 268515132($0) addi $10, $0, 0xffffff sw $10, 268515136($0) addi $10, $0, 0xffffff sw $10, 268515140($0) addi $10, $0, 0xffffff sw $10, 268515144($0) addi $10, $0, 0xffffff sw $10, 268515148($0) addi $10, $0, 0xffffff sw $10, 268515152($0) addi $10, $0, 0xffffff sw $10, 268515156($0) addi $10, $0, 0xffffff sw $10, 268515160($0) addi $10, $0, 0xffffff sw $10, 268515164($0) addi $10, $0, 0xffffff sw $10, 268515168($0) addi $10, $0, 0xffffff sw $10, 268515172($0) addi $10, $0, 0xffffff sw $10, 268515176($0) addi $10, $0, 0xffffff sw $10, 268515180($0) addi $10, $0, 0xffffff sw $10, 268515184($0) addi $10, $0, 0xffffff sw $10, 268515188($0) addi $10, $0, 0xffffff sw $10, 268515192($0) addi $10, $0, 0xffffff sw $10, 268515196($0) addi $10, $0, 0xffffff sw $10, 268515200($0) addi $10, $0, 0xffffff sw $10, 268515204($0) addi $10, $0, 0xffffff sw $10, 268515208($0) addi $10, $0, 0xffffff sw $10, 268515212($0) addi $10, $0, 0xffffff sw $10, 268515216($0) addi $10, $0, 0xffffff sw $10, 268515220($0) addi $10, $0, 0xffffff sw $10, 268515224($0) addi $10, $0, 0xffffff sw $10, 268515228($0) addi $10, $0, 0xffffff sw $10, 268515232($0) addi $10, $0, 0xffffff sw $10, 268515236($0) addi $10, $0, 0xffffff sw $10, 268515240($0) addi $10, $0, 0xffffff sw $10, 268515244($0) addi $10, $0, 0xffffff sw $10, 268515248($0) addi $10, $0, 0xffffff sw $10, 268515252($0) addi $10, $0, 0xffffff sw $10, 268515256($0) addi $10, $0, 0xffffff sw $10, 268515260($0) addi $10, $0, 0xffffff sw $10, 268515264($0) addi $10, $0, 0xffffff sw $10, 268515268($0) addi $10, $0, 0xffffff sw $10, 268515272($0) addi $10, $0, 0xffffff sw $10, 268515276($0) addi $10, $0, 0xffffff sw $10, 268515280($0) addi $10, $0, 0xffffff sw $10, 268515284($0) addi $10, $0, 0xffffff sw $10, 268515288($0) addi $10, $0, 0xffffff sw $10, 268515292($0) addi $10, $0, 0xffffff sw $10, 268515296($0) addi $10, $0, 0xffffff sw $10, 268515300($0) addi $10, $0, 0xffffff sw $10, 268515304($0) addi $10, $0, 0xffffff sw $10, 268515308($0) addi $10, $0, 0xffffff sw $10, 268515312($0) addi $10, $0, 0xffffff sw $10, 268515316($0) addi $10, $0, 0xffffff sw $10, 268515320($0) addi $10, $0, 0x00d800 sw $10, 268515324($0) addi $10, $0, 0x00d800 sw $10, 268515328($0) addi $10, $0, 0xffffff sw $10, 268515332($0) addi $10, $0, 0xffffff sw $10, 268515336($0) addi $10, $0, 0xffffff sw $10, 268515340($0) addi $10, $0, 0xffffff sw $10, 268515344($0) addi $10, $0, 0xffffff sw $10, 268515348($0) addi $10, $0, 0xffffff sw $10, 268515352($0) addi $10, $0, 0xffffff sw $10, 268515356($0) addi $10, $0, 0xffffff sw $10, 268515360($0) addi $10, $0, 0xffffff sw $10, 268515364($0) addi $10, $0, 0xffffff sw $10, 268515368($0) addi $10, $0, 0xffffff sw $10, 268515372($0) addi $10, $0, 0xffffff sw $10, 268515376($0) addi $10, $0, 0xffffff sw $10, 268515380($0) addi $10, $0, 0xffffff sw $10, 268515384($0) addi $10, $0, 0xffffff sw $10, 268515388($0) addi $10, $0, 0xffffff sw $10, 268515392($0) addi $10, $0, 0xffffff sw $10, 268515396($0) addi $10, $0, 0xffffff sw $10, 268515400($0) addi $10, $0, 0xffffff sw $10, 268515404($0) addi $10, $0, 0xffffff sw $10, 268515408($0) addi $10, $0, 0xffffff sw $10, 268515412($0) addi $10, $0, 0xffffff sw $10, 268515416($0) addi $10, $0, 0xffffff sw $10, 268515420($0) addi $10, $0, 0xffffff sw $10, 268515424($0) addi $10, $0, 0xffffff sw $10, 268515428($0) addi $10, $0, 0xffffff sw $10, 268515432($0) addi $10, $0, 0xffffff sw $10, 268515436($0) addi $10, $0, 0xffffff sw $10, 268515440($0) addi $10, $0, 0xffffff sw $10, 268515444($0) addi $10, $0, 0xffffff sw $10, 268515448($0) addi $10, $0, 0xffffff sw $10, 268515452($0) addi $10, $0, 0xffffff sw $10, 268515456($0) addi $10, $0, 0xffffff sw $10, 268515460($0) addi $10, $0, 0xffffff sw $10, 268515464($0) addi $10, $0, 0xffffff sw $10, 268515468($0) addi $10, $0, 0xffffff sw $10, 268515472($0) addi $10, $0, 0xffffff sw $10, 268515476($0) addi $10, $0, 0xffffff sw $10, 268515480($0) addi $10, $0, 0xffffff sw $10, 268515484($0) addi $10, $0, 0xffffff sw $10, 268515488($0) addi $10, $0, 0xffffff sw $10, 268515492($0) addi $10, $0, 0xffffff sw $10, 268515496($0) addi $10, $0, 0xffffff sw $10, 268515500($0) addi $10, $0, 0xffffff sw $10, 268515504($0) addi $10, $0, 0xffffff sw $10, 268515508($0) addi $10, $0, 0xffffff sw $10, 268515512($0) addi $10, $0, 0xffffff sw $10, 268515516($0) addi $10, $0, 0xffffff sw $10, 268515520($0) addi $10, $0, 0xffffff sw $10, 268515524($0) addi $10, $0, 0xffffff sw $10, 268515528($0) addi $10, $0, 0xffffff sw $10, 268515532($0) addi $10, $0, 0xffffff sw $10, 268515536($0) addi $10, $0, 0xffffff sw $10, 268515540($0) addi $10, $0, 0xffffff sw $10, 268515544($0) addi $10, $0, 0xffffff sw $10, 268515548($0) addi $10, $0, 0xffffff sw $10, 268515552($0) addi $10, $0, 0xffffff sw $10, 268515556($0) addi $10, $0, 0xffffff sw $10, 268515560($0) addi $10, $0, 0xffffff sw $10, 268515564($0) addi $10, $0, 0xffffff sw $10, 268515568($0) addi $10, $0, 0xffffff sw $10, 268515572($0) addi $10, $0, 0xffffff sw $10, 268515576($0) addi $10, $0, 0x00d800 sw $10, 268515580($0) addi $10, $0, 0x00d800 sw $10, 268515584($0) addi $10, $0, 0xffffff sw $10, 268515588($0) addi $10, $0, 0xffffff sw $10, 268515592($0) addi $10, $0, 0xffffff sw $10, 268515596($0) addi $10, $0, 0xffffff sw $10, 268515600($0) addi $10, $0, 0xffffff sw $10, 268515604($0) addi $10, $0, 0xffffff sw $10, 268515608($0) addi $10, $0, 0xffffff sw $10, 268515612($0) addi $10, $0, 0xffffff sw $10, 268515616($0) addi $10, $0, 0xffffff sw $10, 268515620($0) addi $10, $0, 0xffffff sw $10, 268515624($0) addi $10, $0, 0xffffff sw $10, 268515628($0) addi $10, $0, 0xffffff sw $10, 268515632($0) addi $10, $0, 0xffffff sw $10, 268515636($0) addi $10, $0, 0xffffff sw $10, 268515640($0) addi $10, $0, 0xffffff sw $10, 268515644($0) addi $10, $0, 0xffffff sw $10, 268515648($0) addi $10, $0, 0xffffff sw $10, 268515652($0) addi $10, $0, 0xffffff sw $10, 268515656($0) addi $10, $0, 0xffffff sw $10, 268515660($0) addi $10, $0, 0xffffff sw $10, 268515664($0) addi $10, $0, 0xffffff sw $10, 268515668($0) addi $10, $0, 0xffffff sw $10, 268515672($0) addi $10, $0, 0xffffff sw $10, 268515676($0) addi $10, $0, 0xffffff sw $10, 268515680($0) addi $10, $0, 0xffffff sw $10, 268515684($0) addi $10, $0, 0xffffff sw $10, 268515688($0) addi $10, $0, 0xffffff sw $10, 268515692($0) addi $10, $0, 0xffffff sw $10, 268515696($0) addi $10, $0, 0xffffff sw $10, 268515700($0) addi $10, $0, 0xffffff sw $10, 268515704($0) addi $10, $0, 0xffffff sw $10, 268515708($0) addi $10, $0, 0xffffff sw $10, 268515712($0) addi $10, $0, 0xffffff sw $10, 268515716($0) addi $10, $0, 0xffffff sw $10, 268515720($0) addi $10, $0, 0xffffff sw $10, 268515724($0) addi $10, $0, 0xffffff sw $10, 268515728($0) addi $10, $0, 0xffffff sw $10, 268515732($0) addi $10, $0, 0xffffff sw $10, 268515736($0) addi $10, $0, 0xffffff sw $10, 268515740($0) addi $10, $0, 0xffffff sw $10, 268515744($0) addi $10, $0, 0xffffff sw $10, 268515748($0) addi $10, $0, 0xffffff sw $10, 268515752($0) addi $10, $0, 0xffffff sw $10, 268515756($0) addi $10, $0, 0xffffff sw $10, 268515760($0) addi $10, $0, 0xffffff sw $10, 268515764($0) addi $10, $0, 0xffffff sw $10, 268515768($0) addi $10, $0, 0xffffff sw $10, 268515772($0) addi $10, $0, 0xffffff sw $10, 268515776($0) addi $10, $0, 0xffffff sw $10, 268515780($0) addi $10, $0, 0xffffff sw $10, 268515784($0) addi $10, $0, 0xffffff sw $10, 268515788($0) addi $10, $0, 0xffffff sw $10, 268515792($0) addi $10, $0, 0xffffff sw $10, 268515796($0) addi $10, $0, 0xffffff sw $10, 268515800($0) addi $10, $0, 0xffffff sw $10, 268515804($0) addi $10, $0, 0xffffff sw $10, 268515808($0) addi $10, $0, 0xffffff sw $10, 268515812($0) addi $10, $0, 0xffffff sw $10, 268515816($0) addi $10, $0, 0xffffff sw $10, 268515820($0) addi $10, $0, 0xffffff sw $10, 268515824($0) addi $10, $0, 0xffffff sw $10, 268515828($0) addi $10, $0, 0xffffff sw $10, 268515832($0) addi $10, $0, 0x00d800 sw $10, 268515836($0) addi $10, $0, 0x00d800 sw $10, 268515840($0) addi $10, $0, 0xffffff sw $10, 268515844($0) addi $10, $0, 0xffffff sw $10, 268515848($0) addi $10, $0, 0xffffff sw $10, 268515852($0) addi $10, $0, 0xffffff sw $10, 268515856($0) addi $10, $0, 0xffffff sw $10, 268515860($0) addi $10, $0, 0xffffff sw $10, 268515864($0) addi $10, $0, 0xffffff sw $10, 268515868($0) addi $10, $0, 0xffffff sw $10, 268515872($0) addi $10, $0, 0xffffff sw $10, 268515876($0) addi $10, $0, 0xffffff sw $10, 268515880($0) addi $10, $0, 0xffffff sw $10, 268515884($0) addi $10, $0, 0xffffff sw $10, 268515888($0) addi $10, $0, 0xffffff sw $10, 268515892($0) addi $10, $0, 0xffffff sw $10, 268515896($0) addi $10, $0, 0xffffff sw $10, 268515900($0) addi $10, $0, 0xffffff sw $10, 268515904($0) addi $10, $0, 0xffffff sw $10, 268515908($0) addi $10, $0, 0xffffff sw $10, 268515912($0) addi $10, $0, 0xffffff sw $10, 268515916($0) addi $10, $0, 0xffffff sw $10, 268515920($0) addi $10, $0, 0xffffff sw $10, 268515924($0) addi $10, $0, 0xffffff sw $10, 268515928($0) addi $10, $0, 0xffffff sw $10, 268515932($0) addi $10, $0, 0xffffff sw $10, 268515936($0) addi $10, $0, 0xffffff sw $10, 268515940($0) addi $10, $0, 0xffffff sw $10, 268515944($0) addi $10, $0, 0xffffff sw $10, 268515948($0) addi $10, $0, 0xffffff sw $10, 268515952($0) addi $10, $0, 0xffffff sw $10, 268515956($0) addi $10, $0, 0xffffff sw $10, 268515960($0) addi $10, $0, 0xffffff sw $10, 268515964($0) addi $10, $0, 0xffffff sw $10, 268515968($0) addi $10, $0, 0xffffff sw $10, 268515972($0) addi $10, $0, 0xffffff sw $10, 268515976($0) addi $10, $0, 0xffffff sw $10, 268515980($0) addi $10, $0, 0xffffff sw $10, 268515984($0) addi $10, $0, 0xffffff sw $10, 268515988($0) addi $10, $0, 0xffffff sw $10, 268515992($0) addi $10, $0, 0xffffff sw $10, 268515996($0) addi $10, $0, 0xffffff sw $10, 268516000($0) addi $10, $0, 0xffffff sw $10, 268516004($0) addi $10, $0, 0xffffff sw $10, 268516008($0) addi $10, $0, 0xffffff sw $10, 268516012($0) addi $10, $0, 0xffffff sw $10, 268516016($0) addi $10, $0, 0xffffff sw $10, 268516020($0) addi $10, $0, 0xffffff sw $10, 268516024($0) addi $10, $0, 0xffffff sw $10, 268516028($0) addi $10, $0, 0xffffff sw $10, 268516032($0) addi $10, $0, 0xffffff sw $10, 268516036($0) addi $10, $0, 0xffffff sw $10, 268516040($0) addi $10, $0, 0xffffff sw $10, 268516044($0) addi $10, $0, 0xffffff sw $10, 268516048($0) addi $10, $0, 0xffffff sw $10, 268516052($0) addi $10, $0, 0xffffff sw $10, 268516056($0) addi $10, $0, 0xffffff sw $10, 268516060($0) addi $10, $0, 0xffffff sw $10, 268516064($0) addi $10, $0, 0xffffff sw $10, 268516068($0) addi $10, $0, 0xffffff sw $10, 268516072($0) addi $10, $0, 0xffffff sw $10, 268516076($0) addi $10, $0, 0xffffff sw $10, 268516080($0) addi $10, $0, 0xffffff sw $10, 268516084($0) addi $10, $0, 0xffffff sw $10, 268516088($0) addi $10, $0, 0x00d800 sw $10, 268516092($0) addi $10, $0, 0x00d800 sw $10, 268516096($0) addi $10, $0, 0xffffff sw $10, 268516100($0) addi $10, $0, 0xffffff sw $10, 268516104($0) addi $10, $0, 0xffffff sw $10, 268516108($0) addi $10, $0, 0xffffff sw $10, 268516112($0) addi $10, $0, 0xffffff sw $10, 268516116($0) addi $10, $0, 0xffffff sw $10, 268516120($0) addi $10, $0, 0xffffff sw $10, 268516124($0) addi $10, $0, 0xffffff sw $10, 268516128($0) addi $10, $0, 0xffffff sw $10, 268516132($0) addi $10, $0, 0xffffff sw $10, 268516136($0) addi $10, $0, 0xffffff sw $10, 268516140($0) addi $10, $0, 0xffffff sw $10, 268516144($0) addi $10, $0, 0xffffff sw $10, 268516148($0) addi $10, $0, 0xffffff sw $10, 268516152($0) addi $10, $0, 0x000000 sw $10, 268516156($0) addi $10, $0, 0x000000 sw $10, 268516160($0) addi $10, $0, 0x000000 sw $10, 268516164($0) addi $10, $0, 0x000000 sw $10, 268516168($0) addi $10, $0, 0x000000 sw $10, 268516172($0) addi $10, $0, 0x000000 sw $10, 268516176($0) addi $10, $0, 0xffffff sw $10, 268516180($0) addi $10, $0, 0xffffff sw $10, 268516184($0) addi $10, $0, 0xffffff sw $10, 268516188($0) addi $10, $0, 0x000000 sw $10, 268516192($0) addi $10, $0, 0x000000 sw $10, 268516196($0) addi $10, $0, 0x000000 sw $10, 268516200($0) addi $10, $0, 0x000000 sw $10, 268516204($0) addi $10, $0, 0x000000 sw $10, 268516208($0) addi $10, $0, 0x000000 sw $10, 268516212($0) addi $10, $0, 0xffffff sw $10, 268516216($0) addi $10, $0, 0xffffff sw $10, 268516220($0) addi $10, $0, 0xffffff sw $10, 268516224($0) addi $10, $0, 0xffffff sw $10, 268516228($0) addi $10, $0, 0x000000 sw $10, 268516232($0) addi $10, $0, 0x000000 sw $10, 268516236($0) addi $10, $0, 0x000000 sw $10, 268516240($0) addi $10, $0, 0x000000 sw $10, 268516244($0) addi $10, $0, 0x000000 sw $10, 268516248($0) addi $10, $0, 0x000000 sw $10, 268516252($0) addi $10, $0, 0xffffff sw $10, 268516256($0) addi $10, $0, 0xffffff sw $10, 268516260($0) addi $10, $0, 0xffffff sw $10, 268516264($0) addi $10, $0, 0x000000 sw $10, 268516268($0) addi $10, $0, 0x000000 sw $10, 268516272($0) addi $10, $0, 0x000000 sw $10, 268516276($0) addi $10, $0, 0x000000 sw $10, 268516280($0) addi $10, $0, 0x000000 sw $10, 268516284($0) addi $10, $0, 0x000000 sw $10, 268516288($0) addi $10, $0, 0xffffff sw $10, 268516292($0) addi $10, $0, 0xffffff sw $10, 268516296($0) addi $10, $0, 0xffffff sw $10, 268516300($0) addi $10, $0, 0xffffff sw $10, 268516304($0) addi $10, $0, 0xffffff sw $10, 268516308($0) addi $10, $0, 0xffffff sw $10, 268516312($0) addi $10, $0, 0xffffff sw $10, 268516316($0) addi $10, $0, 0xffffff sw $10, 268516320($0) addi $10, $0, 0xffffff sw $10, 268516324($0) addi $10, $0, 0xffffff sw $10, 268516328($0) addi $10, $0, 0xffffff sw $10, 268516332($0) addi $10, $0, 0xffffff sw $10, 268516336($0) addi $10, $0, 0xffffff sw $10, 268516340($0) addi $10, $0, 0xffffff sw $10, 268516344($0) addi $10, $0, 0x00d800 sw $10, 268516348($0) addi $10, $0, 0x00d800 sw $10, 268516352($0) addi $10, $0, 0xffffff sw $10, 268516356($0) addi $10, $0, 0xffffff sw $10, 268516360($0) addi $10, $0, 0xffffff sw $10, 268516364($0) addi $10, $0, 0xffffff sw $10, 268516368($0) addi $10, $0, 0xffffff sw $10, 268516372($0) addi $10, $0, 0xffffff sw $10, 268516376($0) addi $10, $0, 0xffffff sw $10, 268516380($0) addi $10, $0, 0xffffff sw $10, 268516384($0) addi $10, $0, 0xffffff sw $10, 268516388($0) addi $10, $0, 0xffffff sw $10, 268516392($0) addi $10, $0, 0xffffff sw $10, 268516396($0) addi $10, $0, 0xffffff sw $10, 268516400($0) addi $10, $0, 0xffffff sw $10, 268516404($0) addi $10, $0, 0xffffff sw $10, 268516408($0) addi $10, $0, 0xffffff sw $10, 268516412($0) addi $10, $0, 0xffffff sw $10, 268516416($0) addi $10, $0, 0xffffff sw $10, 268516420($0) addi $10, $0, 0xffffff sw $10, 268516424($0) addi $10, $0, 0xffffff sw $10, 268516428($0) addi $10, $0, 0xffffff sw $10, 268516432($0) addi $10, $0, 0xffffff sw $10, 268516436($0) addi $10, $0, 0xffffff sw $10, 268516440($0) addi $10, $0, 0xffffff sw $10, 268516444($0) addi $10, $0, 0xffffff sw $10, 268516448($0) addi $10, $0, 0xffffff sw $10, 268516452($0) addi $10, $0, 0xffffff sw $10, 268516456($0) addi $10, $0, 0xffffff sw $10, 268516460($0) addi $10, $0, 0xffffff sw $10, 268516464($0) addi $10, $0, 0xffffff sw $10, 268516468($0) addi $10, $0, 0xffffff sw $10, 268516472($0) addi $10, $0, 0xffffff sw $10, 268516476($0) addi $10, $0, 0xffffff sw $10, 268516480($0) addi $10, $0, 0xffffff sw $10, 268516484($0) addi $10, $0, 0xffffff sw $10, 268516488($0) addi $10, $0, 0xffffff sw $10, 268516492($0) addi $10, $0, 0xffffff sw $10, 268516496($0) addi $10, $0, 0xffffff sw $10, 268516500($0) addi $10, $0, 0xffffff sw $10, 268516504($0) addi $10, $0, 0xffffff sw $10, 268516508($0) addi $10, $0, 0xffffff sw $10, 268516512($0) addi $10, $0, 0xffffff sw $10, 268516516($0) addi $10, $0, 0xffffff sw $10, 268516520($0) addi $10, $0, 0xffffff sw $10, 268516524($0) addi $10, $0, 0xffffff sw $10, 268516528($0) addi $10, $0, 0xffffff sw $10, 268516532($0) addi $10, $0, 0xffffff sw $10, 268516536($0) addi $10, $0, 0xffffff sw $10, 268516540($0) addi $10, $0, 0xffffff sw $10, 268516544($0) addi $10, $0, 0xffffff sw $10, 268516548($0) addi $10, $0, 0xffffff sw $10, 268516552($0) addi $10, $0, 0xffffff sw $10, 268516556($0) addi $10, $0, 0xffffff sw $10, 268516560($0) addi $10, $0, 0xffffff sw $10, 268516564($0) addi $10, $0, 0xffffff sw $10, 268516568($0) addi $10, $0, 0xffffff sw $10, 268516572($0) addi $10, $0, 0xffffff sw $10, 268516576($0) addi $10, $0, 0xffffff sw $10, 268516580($0) addi $10, $0, 0xffffff sw $10, 268516584($0) addi $10, $0, 0xffffff sw $10, 268516588($0) addi $10, $0, 0xffffff sw $10, 268516592($0) addi $10, $0, 0xffffff sw $10, 268516596($0) addi $10, $0, 0xffffff sw $10, 268516600($0) addi $10, $0, 0x00d800 sw $10, 268516604($0) addi $10, $0, 0x00d800 sw $10, 268516608($0) addi $10, $0, 0xffffff sw $10, 268516612($0) addi $10, $0, 0xffffff sw $10, 268516616($0) addi $10, $0, 0xffffff sw $10, 268516620($0) addi $10, $0, 0xffffff sw $10, 268516624($0) addi $10, $0, 0xffffff sw $10, 268516628($0) addi $10, $0, 0xffffff sw $10, 268516632($0) addi $10, $0, 0xffffff sw $10, 268516636($0) addi $10, $0, 0xffffff sw $10, 268516640($0) addi $10, $0, 0xffffff sw $10, 268516644($0) addi $10, $0, 0xffffff sw $10, 268516648($0) addi $10, $0, 0xffffff sw $10, 268516652($0) addi $10, $0, 0xffffff sw $10, 268516656($0) addi $10, $0, 0xffffff sw $10, 268516660($0) addi $10, $0, 0xffffff sw $10, 268516664($0) addi $10, $0, 0xffffff sw $10, 268516668($0) addi $10, $0, 0xffffff sw $10, 268516672($0) addi $10, $0, 0xffffff sw $10, 268516676($0) addi $10, $0, 0xffffff sw $10, 268516680($0) addi $10, $0, 0xffffff sw $10, 268516684($0) addi $10, $0, 0xffffff sw $10, 268516688($0) addi $10, $0, 0xffffff sw $10, 268516692($0) addi $10, $0, 0xffffff sw $10, 268516696($0) addi $10, $0, 0xffffff sw $10, 268516700($0) addi $10, $0, 0xffffff sw $10, 268516704($0) addi $10, $0, 0xffffff sw $10, 268516708($0) addi $10, $0, 0xffffff sw $10, 268516712($0) addi $10, $0, 0xffffff sw $10, 268516716($0) addi $10, $0, 0xffffff sw $10, 268516720($0) addi $10, $0, 0xffffff sw $10, 268516724($0) addi $10, $0, 0xffffff sw $10, 268516728($0) addi $10, $0, 0xffffff sw $10, 268516732($0) addi $10, $0, 0xffffff sw $10, 268516736($0) addi $10, $0, 0xffffff sw $10, 268516740($0) addi $10, $0, 0xffffff sw $10, 268516744($0) addi $10, $0, 0xffffff sw $10, 268516748($0) addi $10, $0, 0xffffff sw $10, 268516752($0) addi $10, $0, 0xffffff sw $10, 268516756($0) addi $10, $0, 0xffffff sw $10, 268516760($0) addi $10, $0, 0xffffff sw $10, 268516764($0) addi $10, $0, 0xffffff sw $10, 268516768($0) addi $10, $0, 0xffffff sw $10, 268516772($0) addi $10, $0, 0xffffff sw $10, 268516776($0) addi $10, $0, 0xffffff sw $10, 268516780($0) addi $10, $0, 0xffffff sw $10, 268516784($0) addi $10, $0, 0xffffff sw $10, 268516788($0) addi $10, $0, 0xffffff sw $10, 268516792($0) addi $10, $0, 0xffffff sw $10, 268516796($0) addi $10, $0, 0xffffff sw $10, 268516800($0) addi $10, $0, 0xffffff sw $10, 268516804($0) addi $10, $0, 0xffffff sw $10, 268516808($0) addi $10, $0, 0xffffff sw $10, 268516812($0) addi $10, $0, 0xffffff sw $10, 268516816($0) addi $10, $0, 0xffffff sw $10, 268516820($0) addi $10, $0, 0xffffff sw $10, 268516824($0) addi $10, $0, 0xffffff sw $10, 268516828($0) addi $10, $0, 0xffffff sw $10, 268516832($0) addi $10, $0, 0xffffff sw $10, 268516836($0) addi $10, $0, 0xffffff sw $10, 268516840($0) addi $10, $0, 0xffffff sw $10, 268516844($0) addi $10, $0, 0xffffff sw $10, 268516848($0) addi $10, $0, 0xffffff sw $10, 268516852($0) addi $10, $0, 0xffffff sw $10, 268516856($0) addi $10, $0, 0x00d800 sw $10, 268516860($0) addi $10, $0, 0x00d800 sw $10, 268516864($0) addi $10, $0, 0xffffff sw $10, 268516868($0) addi $10, $0, 0xffffff sw $10, 268516872($0) addi $10, $0, 0xffffff sw $10, 268516876($0) addi $10, $0, 0xffffff sw $10, 268516880($0) addi $10, $0, 0xffffff sw $10, 268516884($0) addi $10, $0, 0xffffff sw $10, 268516888($0) addi $10, $0, 0xffffff sw $10, 268516892($0) addi $10, $0, 0xffffff sw $10, 268516896($0) addi $10, $0, 0xffffff sw $10, 268516900($0) addi $10, $0, 0xffffff sw $10, 268516904($0) addi $10, $0, 0xffffff sw $10, 268516908($0) addi $10, $0, 0xffffff sw $10, 268516912($0) addi $10, $0, 0xffffff sw $10, 268516916($0) addi $10, $0, 0xffffff sw $10, 268516920($0) addi $10, $0, 0xffffff sw $10, 268516924($0) addi $10, $0, 0xffffff sw $10, 268516928($0) addi $10, $0, 0xffffff sw $10, 268516932($0) addi $10, $0, 0xffffff sw $10, 268516936($0) addi $10, $0, 0xffffff sw $10, 268516940($0) addi $10, $0, 0xffffff sw $10, 268516944($0) addi $10, $0, 0xffffff sw $10, 268516948($0) addi $10, $0, 0xffffff sw $10, 268516952($0) addi $10, $0, 0xffffff sw $10, 268516956($0) addi $10, $0, 0xffffff sw $10, 268516960($0) addi $10, $0, 0xffffff sw $10, 268516964($0) addi $10, $0, 0xffffff sw $10, 268516968($0) addi $10, $0, 0xffffff sw $10, 268516972($0) addi $10, $0, 0xffffff sw $10, 268516976($0) addi $10, $0, 0xffffff sw $10, 268516980($0) addi $10, $0, 0xffffff sw $10, 268516984($0) addi $10, $0, 0xffffff sw $10, 268516988($0) addi $10, $0, 0xffffff sw $10, 268516992($0) addi $10, $0, 0xffffff sw $10, 268516996($0) addi $10, $0, 0xffffff sw $10, 268517000($0) addi $10, $0, 0xffffff sw $10, 268517004($0) addi $10, $0, 0xffffff sw $10, 268517008($0) addi $10, $0, 0xffffff sw $10, 268517012($0) addi $10, $0, 0xffffff sw $10, 268517016($0) addi $10, $0, 0xffffff sw $10, 268517020($0) addi $10, $0, 0xffffff sw $10, 268517024($0) addi $10, $0, 0xffffff sw $10, 268517028($0) addi $10, $0, 0xffffff sw $10, 268517032($0) addi $10, $0, 0xffffff sw $10, 268517036($0) addi $10, $0, 0xffffff sw $10, 268517040($0) addi $10, $0, 0xffffff sw $10, 268517044($0) addi $10, $0, 0xffffff sw $10, 268517048($0) addi $10, $0, 0xffffff sw $10, 268517052($0) addi $10, $0, 0xffffff sw $10, 268517056($0) addi $10, $0, 0xffffff sw $10, 268517060($0) addi $10, $0, 0xffffff sw $10, 268517064($0) addi $10, $0, 0xffffff sw $10, 268517068($0) addi $10, $0, 0xffffff sw $10, 268517072($0) addi $10, $0, 0xffffff sw $10, 268517076($0) addi $10, $0, 0xffffff sw $10, 268517080($0) addi $10, $0, 0xffffff sw $10, 268517084($0) addi $10, $0, 0xffffff sw $10, 268517088($0) addi $10, $0, 0xffffff sw $10, 268517092($0) addi $10, $0, 0xffffff sw $10, 268517096($0) addi $10, $0, 0xffffff sw $10, 268517100($0) addi $10, $0, 0xffffff sw $10, 268517104($0) addi $10, $0, 0xffffff sw $10, 268517108($0) addi $10, $0, 0xffffff sw $10, 268517112($0) addi $10, $0, 0x00d800 sw $10, 268517116($0) addi $10, $0, 0x00d800 sw $10, 268517120($0) addi $10, $0, 0x00d800 sw $10, 268517124($0) addi $10, $0, 0x00d800 sw $10, 268517128($0) addi $10, $0, 0x00d800 sw $10, 268517132($0) addi $10, $0, 0x00d800 sw $10, 268517136($0) addi $10, $0, 0x00d800 sw $10, 268517140($0) addi $10, $0, 0x00d800 sw $10, 268517144($0) addi $10, $0, 0x00d800 sw $10, 268517148($0) addi $10, $0, 0x00d800 sw $10, 268517152($0) addi $10, $0, 0x00d800 sw $10, 268517156($0) addi $10, $0, 0x00d800 sw $10, 268517160($0) addi $10, $0, 0x00d800 sw $10, 268517164($0) addi $10, $0, 0x00d800 sw $10, 268517168($0) addi $10, $0, 0x00d800 sw $10, 268517172($0) addi $10, $0, 0x00d800 sw $10, 268517176($0) addi $10, $0, 0x00d800 sw $10, 268517180($0) addi $10, $0, 0x00d800 sw $10, 268517184($0) addi $10, $0, 0x00d800 sw $10, 268517188($0) addi $10, $0, 0x00d800 sw $10, 268517192($0) addi $10, $0, 0x00d800 sw $10, 268517196($0) addi $10, $0, 0x00d800 sw $10, 268517200($0) addi $10, $0, 0x00d800 sw $10, 268517204($0) addi $10, $0, 0x00d800 sw $10, 268517208($0) addi $10, $0, 0x00d800 sw $10, 268517212($0) addi $10, $0, 0x00d800 sw $10, 268517216($0) addi $10, $0, 0x00d800 sw $10, 268517220($0) addi $10, $0, 0x00d800 sw $10, 268517224($0) addi $10, $0, 0x00d800 sw $10, 268517228($0) addi $10, $0, 0x00d800 sw $10, 268517232($0) addi $10, $0, 0x00d800 sw $10, 268517236($0) addi $10, $0, 0x00d800 sw $10, 268517240($0) addi $10, $0, 0x00d800 sw $10, 268517244($0) addi $10, $0, 0x00d800 sw $10, 268517248($0) addi $10, $0, 0x00d800 sw $10, 268517252($0) addi $10, $0, 0x00d800 sw $10, 268517256($0) addi $10, $0, 0x00d800 sw $10, 268517260($0) addi $10, $0, 0x00d800 sw $10, 268517264($0) addi $10, $0, 0x00d800 sw $10, 268517268($0) addi $10, $0, 0x00d800 sw $10, 268517272($0) addi $10, $0, 0x00d800 sw $10, 268517276($0) addi $10, $0, 0x00d800 sw $10, 268517280($0) addi $10, $0, 0x00d800 sw $10, 268517284($0) addi $10, $0, 0x00d800 sw $10, 268517288($0) addi $10, $0, 0x00d800 sw $10, 268517292($0) addi $10, $0, 0x00d800 sw $10, 268517296($0) addi $10, $0, 0x00d800 sw $10, 268517300($0) addi $10, $0, 0x00d800 sw $10, 268517304($0) addi $10, $0, 0x00d800 sw $10, 268517308($0) addi $10, $0, 0x00d800 sw $10, 268517312($0) addi $10, $0, 0x00d800 sw $10, 268517316($0) addi $10, $0, 0x00d800 sw $10, 268517320($0) addi $10, $0, 0x00d800 sw $10, 268517324($0) addi $10, $0, 0x00d800 sw $10, 268517328($0) addi $10, $0, 0x00d800 sw $10, 268517332($0) addi $10, $0, 0x00d800 sw $10, 268517336($0) addi $10, $0, 0x00d800 sw $10, 268517340($0) addi $10, $0, 0x00d800 sw $10, 268517344($0) addi $10, $0, 0x00d800 sw $10, 268517348($0) addi $10, $0, 0x00d800 sw $10, 268517352($0) addi $10, $0, 0x00d800 sw $10, 268517356($0) addi $10, $0, 0x00d800 sw $10, 268517360($0) addi $10, $0, 0x00d800 sw $10, 268517364($0) addi $10, $0, 0x00d800 sw $10, 268517368($0) addi $10, $0, 0x00d800 sw $10, 268517372($0) jr $ra
.text j to_user_mode j interrupt j exception to_user_mode: la $ra, main nop jr $ra main: # load SysTick => count clocks li $s7, 0x40000000 # $s7 0x40000000 lw $s6, 20($s7) # $s6 (0x40000014) # call bubble sort ori $a0, $0, 0 # $a0 0x00000000 start addr ori $a1, $0, 127 # $a1 n jal bubble_sort # load SysTick lw $s5, 20($s7) sub $s4, $s5, $s6 # lower 16 bits ori $t0, $0, 0xF and $s0, $t0, $s4 srl $s4, $s4, 4 and $s1, $t0, $s4 srl $s4, $s4, 4 and $s2, $t0, $s4 srl $s4, $s4, 4 and $s3, $t0, $s4 # use led sw $s4, 12($s7) ori $s6, $0, 0 # Timer interrupt subi $t0, $0, 0x000F sw $t0, 0($s7) # TH = 0xFFFFFFF1 subi $t0, $0, 1 sw $t0, 4($s7) # TL = 0xFFFFFFFF ori $t0, $0, 3 sw $t0, 8($s7) loop: j loop bubble_sort: addi $sp, $sp, -12 sw $ra, 0($sp) sw $s1, 4($sp) sw $s0, 8($sp) move $s0, $a0 # array addr move $s1, $a1 # n move $s2, $0 # sorted = false L0: bne $s2, $0, L0end ori $s2, 0x1 li $t0, 1 L1: bge $t0, $s1, L1end sll $t1, $t0, 2 add $t1, $t1, $s0 lw $t2, 0($t1) lw $t3, -4($t1) ble $t3, $t2, else sw $t3, 0($t1) sw $t2, -4($t1) move $s2, $0 else: addi $t0, $t0, 1 j L1 L1end: subi $s1, $s1, 1 j L0 L0end: lw $s0, 8($sp) lw $s1, 4($sp) lw $ra, 0($sp) addi $sp, $sp, 12 move $v0, $0 nop jr $ra interrupt: ori $t0, $0, 1 sw $t0, 8($s7) la $t1, show lui $t2, 0x8000 sll $t0, $s6, 2 add $t0, $t0, $t1 add $t0, $t0, $t2 nop jr $t0 show: j show_0 j show_1 j show_2 j show_3 show_0: li $t0, 0x00000100 move $t2, $s0 j BCD_switch show_1: li $t0, 0x00000200 move $t2, $s1 j BCD_switch show_2: li $t0, 0x00000400 move $t2, $s2 j BCD_switch show_3: li $t0, 0x00000800 move $t2, $s3 j BCD_switch BCD_switch: la $t1, BCD lui $t3, 0x8000 sll $t4, $t2, 2 add $t4, $t4, $t1 add $t4, $t4, $t3 nop jr $t4 BCD: j bcd_0 j bcd_1 j bcd_2 j bcd_3 j bcd_4 j bcd_5 j bcd_6 j bcd_7 j bcd_8 j bcd_9 j bcd_A j bcd_B j bcd_C j bcd_D j bcd_E j bcd_F bcd_0: li $t1, 0x3F add $t0, $t0, $t1 j interruptExit bcd_1: li $t1, 0x6 add $t0, $t0, $t1 j interruptExit bcd_2: li $t1, 0x5B add $t0, $t0, $t1 j interruptExit bcd_3: li $t1, 0x4F add $t0, $t0, $t1 j interruptExit bcd_4: li $t1, 0x66 add $t0, $t0, $t1 j interruptExit bcd_5: li $t1, 0x6D add $t0, $t0, $t1 j interruptExit bcd_6: li $t1, 0x7D add $t0, $t0, $t1 j interruptExit bcd_7: li $t1, 0x7 add $t0, $t0, $t1 j interruptExit bcd_8: li $t1, 0x7F add $t0, $t0, $t1 j interruptExit bcd_9: li $t1, 0x6F add $t0, $t0, $t1 j interruptExit bcd_A: li $t1, 0x77 add $t0, $t0, $t1 j interruptExit bcd_B: li $t1, 0x7C add $t0, $t0, $t1 j interruptExit bcd_C: li $t1, 0x39 add $t0, $t0, $t1 j interruptExit bcd_D: li $t1, 0x5E add $t0, $t0, $t1 j interruptExit bcd_E: li $t1, 0x79 add $t0, $t0, $t1 j interruptExit bcd_F: li $t1, 0x71 add $t0, $t0, $t1 j interruptExit interruptExit: addi $s6, $s6, 1 andi $s6, $s6, 3 sw $t0, 16($s7) li $t0, 3 sw $t0, 8($s7) # TCon = 3 jr $k0 exception: j exception
.global s_prepare_buffers s_prepare_buffers: push %r12 push %r13 push %r14 push %r15 push %r9 push %rcx push %rdi push %rdx push %rsi lea addresses_UC_ht+0x3253, %rdx nop add %r13, %r13 mov $0x6162636465666768, %rsi movq %rsi, (%rdx) nop nop nop inc %rdx lea addresses_WT_ht+0x3721, %r9 add $62650, %r15 movb $0x61, (%r9) nop nop nop nop nop xor $22598, %rdx lea addresses_D_ht+0x485b, %r13 nop nop nop cmp %rdx, %rdx mov (%r13), %r12 nop nop nop nop xor %rdx, %rdx lea addresses_normal_ht+0x3a53, %r15 nop inc %r13 mov (%r15), %rsi nop nop nop nop sub %r9, %r9 lea addresses_D_ht+0x2362, %r13 nop nop nop and $51986, %r14 mov (%r13), %r9d nop nop nop nop nop xor %r15, %r15 lea addresses_UC_ht+0xa253, %rsi nop nop nop cmp %r14, %r14 movb (%rsi), %r12b nop cmp %r15, %r15 lea addresses_D_ht+0xebb3, %r12 lfence mov $0x6162636465666768, %rdx movq %rdx, %xmm7 vmovups %ymm7, (%r12) nop add %rsi, %rsi lea addresses_A_ht+0xd2eb, %r14 add $158, %rdx mov $0x6162636465666768, %r13 movq %r13, %xmm7 and $0xffffffffffffffc0, %r14 movntdq %xmm7, (%r14) nop nop nop nop nop cmp %r15, %r15 lea addresses_WC_ht+0x11453, %r15 nop nop nop nop nop sub $8773, %r14 mov (%r15), %r13w nop nop nop nop xor %r15, %r15 lea addresses_UC_ht+0x1ee13, %rsi lea addresses_normal_ht+0x43d3, %rdi clflush (%rsi) nop nop and %r14, %r14 mov $5, %rcx rep movsw nop nop nop and %r9, %r9 lea addresses_WC_ht+0x7cd3, %rsi lea addresses_UC_ht+0x1f53, %rdi nop xor $10298, %r15 mov $115, %rcx rep movsq nop nop nop add $4969, %rdx pop %rsi pop %rdx pop %rdi pop %rcx pop %r9 pop %r15 pop %r14 pop %r13 pop %r12 ret .global s_faulty_load s_faulty_load: push %r12 push %r13 push %r15 push %r9 push %rcx push %rdi push %rsi // REPMOV lea addresses_WT+0x8a73, %rsi lea addresses_WC+0x6453, %rdi nop sub $58639, %r9 mov $15, %rcx rep movsl nop nop nop sub %rsi, %rsi // Load lea addresses_UC+0xa053, %r13 cmp $27378, %r15 movb (%r13), %cl nop nop nop nop nop dec %rsi // Faulty Load mov $0x2a93090000000a53, %rsi nop nop nop nop nop add $1786, %r12 vmovups (%rsi), %ymm4 vextracti128 $0, %ymm4, %xmm4 vpextrq $0, %xmm4, %rcx lea oracles, %r15 and $0xff, %rcx shlq $12, %rcx mov (%r15,%rcx,1), %rcx pop %rsi pop %rdi pop %rcx pop %r9 pop %r15 pop %r13 pop %r12 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_WT', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_WC', 'congruent': 9, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_UC', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 7, 'same': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 11, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 1, 'same': True}} {'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 2, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 11, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 11, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 5, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'size': 16, 'AVXalign': False, 'NT': True, 'congruent': 2, 'same': True}} {'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 9, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 7, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 6, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 8, 'same': False}} {'00': 1} 00 */
; A180677: The Gi4 sums of the Pell-Jacobsthal triangle A013609. ; Submitted by Jon Maiga ; 1,3,15,87,503,2871,16311,92599,525751,2985399,16952759,96267703,546663863,3104271799,17627835831,100100959671,568430652855,3227875241399,18329726840247,104086701305271,591063984860599,3356400287444407,19059565762670007,108231145260019127,614598514476543415,3490042843854761399,19818464843373702583,112540609476938132919,639070123823202004407,3629006676448585149879,20607581182048459255223,117021664614381543714231,664516124825454364028343,3773503663686305560882615,21428117946113279362035127 mov $3,$0 lpb $0 lpb $3 mov $2,$0 add $0,3 bin $2,$3 add $1,$2 mul $1,2 sub $3,1 lpe div $0,63 lpe mov $0,$1 add $0,1
; Generate all legal moves. calign 16 Gen_Legal: ; in: rbp address of position ; rbx address of state ; io: rdi address to write moves push rsi r12 r13 r14 r15 ; generate moves mov rax, qword[rbx+State.checkersBB] mov rsi, rdi mov r15, qword[rbx+State.pinned] mov r13d, dword[rbp+Pos.sideToMove] mov r12, qword[rbp+Pos.typeBB+8*King] and r12, qword[rbp+Pos.typeBB+8*r13] _tzcnt r14, r12 ; r15 = pinned pieces ; r14d = our king square ; r13d = side ; r12 = our king bitboard test rax, rax jnz .InCheck .NotInCheck: call Gen_NonEvasions jmp .GenDone .InCheck: call Gen_Evasions .GenDone: shl r14d, 6 mov edx, dword[rsi] mov ecx, edx mov eax, edx cmp rsi, rdi je .FilterDone test r15, r15 jne .FilterYesPinned .FilterNoPinned: and ecx, 0x0FC0 ; ecx shr 6 = source square add rsi, sizeof.ExtMove cmp ecx, r14d je .KingMove cmp edx, MOVE_TYPE_EPCAP shl 12 jae .EpCapture mov edx, dword[rsi] mov ecx, edx ; move is legal at this point mov eax, edx cmp rsi, rdi jne .FilterNoPinned .FilterDone: pop r15 r14 r13 r12 rsi ret calign 8 .KingMove: ; if they have an attacker to king's destination square, then move is illegal and eax, 63 ; eax = destination square mov ecx, r13d shl ecx, 6+3 mov rcx, qword[PawnAttacks+rcx+8*rax] ; pseudo legal castling moves are always legal ep captures have already been caught cmp edx, MOVE_TYPE_CASTLE shl 12 jae .FilterLegalChoose mov r9, qword[rbp+Pos.typeBB+8*r13] xor r13d, 1 mov r10, qword[rbp+Pos.typeBB+8*r13] or r9, r10 xor r13d, 1 ; pawn and rcx, qword[rbp+Pos.typeBB+8*Pawn] test rcx, r10 jnz .FilterIllegalChoose ; king mov rdx, qword[KingAttacks+8*rax] and rdx, qword[rbp+Pos.typeBB+8*King] test rdx, r10 jnz .FilterIllegalChoose ; knight mov rdx, qword[KnightAttacks+8*rax] and rdx, qword[rbp+Pos.typeBB+8*Knight] test rdx, r10 jnz .FilterIllegalChoose ; bishop + queen BishopAttacks rdx, rax, r9, r8 mov r8, qword[rbp+Pos.typeBB+8*Bishop] or r8, qword[rbp+Pos.typeBB+8*Queen] and r8, r10 test rdx, r8 jnz .FilterIllegalChoose ; rook + queen RookAttacks rdx, rax, r9, r8 mov r8, qword[rbp+Pos.typeBB+8*Rook] or r8, qword[rbp+Pos.typeBB+8*Queen] and r8, r10 test rdx, r8 jnz .FilterIllegalChoose .FilterLegalChoose: mov edx, dword[rsi] mov ecx, edx ; move is legal at this point mov eax, edx cmp rsi, rdi je .FilterDone test r15, r15 jz .FilterNoPinned jmp .FilterYesPinned .FilterIllegalChoose: sub rdi, sizeof.ExtMove sub rsi, sizeof.ExtMove mov edx, dword [rdi] mov dword [rsi], edx mov ecx, edx ; move is legal at this point mov eax, edx cmp rsi, rdi je .FilterDone test r15, r15 jz .FilterNoPinned calign 8 .FilterYesPinned: and ecx, 0x0FC0 ; ecx shr 6 = source square add rsi, sizeof.ExtMove cmp ecx, r14d je .KingMove cmp edx, MOVE_TYPE_EPCAP shl 12 jae .EpCapture shr ecx, 6 and eax, 0x0FFF bt r15, rcx jc .FilterYesPinnedWeArePinned .FilterYesPinnedLegal: mov edx, dword[rsi] mov ecx, edx ; move is legal at this point mov eax, edx cmp rsi, rdi jne .FilterYesPinned jmp .FilterDone .FilterYesPinnedWeArePinned: test r12, qword[LineBB+8*rax] jnz .FilterYesPinnedLegal .FilterYesPinnedIllegal: sub rdi, sizeof.ExtMove sub rsi, sizeof.ExtMove mov edx, dword[rdi] mov dword[rsi], edx mov ecx, edx ; move is legal at this point mov eax, edx cmp rsi, rdi jne .FilterYesPinned jmp .FilterDone calign 8 .EpCapture: ; for ep captures, just make the move and test if our king is attacked xor r13d, 1 mov r10, qword[rbp+Pos.typeBB+8*r13] xor r13d, 1 mov r9d, r14d shr r9d, 6 ; all pieces mov rdx, qword[rbp+Pos.typeBB+8*White] or rdx, qword[rbp+Pos.typeBB+8*Black] ; remove source square shr ecx, 6 btr rdx, rcx ; add destination square (ep square) and eax, 63 bts rdx, rax ; remove captured pawn lea ecx, [2*r13-1] lea ecx, [rax+8*rcx] btr rdx, rcx ; check for rook attacks RookAttacks rax, r9, rdx, r8 mov rcx, qword[rbp+Pos.typeBB+8*Rook] or rcx, qword[rbp+Pos.typeBB+8*Queen] and rcx, r10 test rax, rcx jnz .FilterIllegalChoose ; check for bishop attacks BishopAttacks rax, r9, rdx, r8 mov rcx, qword [rbp+Pos.typeBB+8*Bishop] or rcx, qword[rbp+Pos.typeBB+8*Queen] and rcx, r10 test rax, rcx jnz .FilterIllegalChoose jmp .FilterLegalChoose
/** * This file has been modified from its orginal sources. * * Copyright (c) 2012 Software in the Public Interest Inc (SPI) * Copyright (c) 2012 David Pratt * * 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. * *** * Copyright (c) 2008-2012 Appcelerator Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. **/ #include <cerrno> #include <vector> #include <algorithm> #include <cstring> #include <cstdio> #include <cstdlib> #include "tide.h" #include "thread_manager.h" #include <Poco/DirectoryIterator.h> #include <Poco/File.h> #include <Poco/FileStream.h> #include <Poco/Path.h> #include <Poco/Environment.h> #include <Poco/AutoPtr.h> #include <Poco/StringTokenizer.h> #include <Poco/Timespan.h> using Poco::File; using Poco::Path; using Poco::Environment; #define HOME_ENV "KR_HOME" #define RUNTIME_ENV "KR_RUNTIME" #define MODULES_ENV "KR_MODULES" #define DEBUG_ENV "KR_DEBUG" #define DEBUG_ARG "--debug" #define ATTACH_DEBUGGER_ARG "--attach-debugger" #define NO_CONSOLE_LOG_ARG "--no-console-logging" #define NO_FILE_LOG_ARG "--no-file-logging" #define PROFILE_ARG "--profile" #define LOGPATH_ARG "--logpath" #define BOOT_HOME_ARG "--start" #ifdef OS_WIN32 #define MODULE_SUFFIX "dll" #elif OS_OSX #define MODULE_SUFFIX "dylib" #elif OS_LINUX #define MODULE_SUFFIX "so" #endif #include <tide/javascript/javascript_module.h> #include <tide/api/api_module.h> extern "C" { #ifdef OS_WIN32 int Execute(HINSTANCE hInstance, int argc, const char **argv) #else int Execute(int argc, const char **argv) #endif { Host host(argc, argv); return host.Run(); } } namespace tide { JavaScriptModule* javascriptModule; APIModule* apiModule; static void LoadBuiltinModules(Host* host) { javascriptModule = new JavaScriptModule(host, ""); javascriptModule->Initialize(); apiModule = new APIModule(host, ""); apiModule->Initialize(); } static void UnloadBuiltinModules() { apiModule->Stop(); javascriptModule->Stop(); delete apiModule; delete javascriptModule; } static Host* hostInstance; Host::Host(int argc, const char *argv[]) : application(0), exiting(false), exitCode(0), debug(false), waitForDebugger(false), autoScan(false), profile(false), profileStream(0), consoleLogging(true), fileLogging(true), logger(0) { hostInstance = this; #ifdef DEBUG this->debug = true; #endif GlobalObject::Initialize(); this->SetupApplication(argc, argv); this->ParseCommandLineArguments(); // Depends on this->application if (Environment::has(DEBUG_ENV)) { std::string debug_val = Environment::get(DEBUG_ENV); this->debug = (debug_val == "true" || debug_val == "yes" || debug_val == "1"); } this->SetupLogging(); this->SetupProfiling(); // Call into the platform-specific initialization. this->Initialize(argc, argv); } Host* Host::GetInstance() { return hostInstance; } static void AssertEnvironmentVariable(std::string variable) { if (!Environment::has(variable)) { Logger* logger = Logger::Get("Host"); logger->Fatal("required variable '%s' not defined, aborting."); exit(__LINE__); } } void Host::SetupApplication(int argc, const char* argv[]) { AssertEnvironmentVariable(HOME_ENV); AssertEnvironmentVariable(RUNTIME_ENV); AssertEnvironmentVariable(MODULES_ENV); string applicationHome(Environment::get(HOME_ENV)); string runtimePath(Environment::get(RUNTIME_ENV)); string modulePaths(Environment::get(MODULES_ENV)); if (this->debug) { // Logging isn't activated yet -- need to just print here printf(">>> %s=%s\n", HOME_ENV, applicationHome.c_str()); printf(">>> %s=%s\n", RUNTIME_ENV, runtimePath.c_str()); printf(">>> %s=%s\n", MODULES_ENV, modulePaths.c_str()); } this->application = Application::NewApplication(applicationHome); if (this->application.isNull()) { std::cerr << "Could not load the application at: " << applicationHome << std::endl; exit(__LINE__); } this->application->SetArguments(argc, argv); // Re-resolve module/runtime dependencies of the application so that the // API module can introspect into the loaded components. this->application->ResolveDependencies(); if (!this->application->runtime.isNull()) { this->application->runtime->version = PRODUCT_VERSION; } // Parse the module paths, we'll later use this to load all the shared-objects. FileUtils::Tokenize(modulePaths, this->modulePaths, KR_LIB_SEP, true); } void Host::SetupLogging() { // Initialize the logger -- an empty logFilePath signfies no file logging, // but don't turn it off unless that was specified via the command-line. if (!this->fileLogging) { this->logFilePath = std::string(); } else if (this->logFilePath.empty()) { string dataDir = FileUtils::GetApplicationDataDirectory(this->application->name); this->logFilePath = FileUtils::Join(dataDir.c_str(), "tiapp.log", 0); } // If this application has no log level, we'll get a suitable default Logger::Level level = Logger::GetLevel(this->application->logLevel); Logger::Initialize(this->consoleLogging, this->logFilePath, level); this->logger = Logger::Get("Host"); } void Host::SetupProfiling() { if (this->profile) { // In the case of profiling, we wrap our top level global object // to use the profiled bound object which will profile all methods // going through this object and it's attached children this->profileStream = new Poco::FileOutputStream(this->profilePath); ProfiledBoundObject::SetStream(this->profileStream); GlobalObject::TurnOnProfiling(); logger->Info("Starting Profiler. Output going to %s", this->profilePath.c_str()); } } void Host::StopProfiling() { if (this->profile) { logger->Info("Stopping Profiler"); ProfiledBoundObject::SetStream(0); profileStream->flush(); profileStream->close(); profileStream = 0; this->profile = false; } } void Host::ParseCommandLineArguments() { if (this->application->HasArgument(DEBUG_ARG)) { this->debug = true; } if (this->application->HasArgument(ATTACH_DEBUGGER_ARG)) { this->waitForDebugger = true; } if (this->application->HasArgument(NO_CONSOLE_LOG_ARG)) { this->consoleLogging = false; } if (this->application->HasArgument(NO_FILE_LOG_ARG)) { this->fileLogging = false; } if (this->application->HasArgument(PROFILE_ARG)) { this->profilePath = this->application->GetArgumentValue(PROFILE_ARG); this->profile = !this->profilePath.empty(); } if (this->application->HasArgument(LOGPATH_ARG)) { this->logFilePath = this->application->GetArgumentValue(LOGPATH_ARG); } // Was this only used by the appinstaller? It complicates things a bit, // and the component list might not be correct after this point. -- Martin if (this->application->HasArgument(BOOT_HOME_ARG)) { string newHome = this->application->GetArgumentValue(BOOT_HOME_ARG); SharedApplication newApp = Application::NewApplication(newHome); if (!newApp.isNull()) { newApp->SetArguments(this->application->GetArguments()); newApp->ResolveDependencies(); if (!newApp->runtime.isNull()) { newApp->runtime->version = PRODUCT_VERSION; } this->application = newApp; } } } void Host::AddModuleProvider(ModuleProvider *provider) { Poco::Mutex::ScopedLock lock(moduleMutex); moduleProviders.push_back(provider); if (autoScan) { this->ScanInvalidModuleFiles(); } } /** * Find the module provider for a given filename or return NULL if * no module provider can be found. */ ModuleProvider* Host::FindModuleProvider(std::string& filename) { Poco::Mutex::ScopedLock lock(moduleMutex); std::vector<ModuleProvider*>::iterator iter; for (iter = moduleProviders.begin(); iter != moduleProviders.end(); iter++) { ModuleProvider *provider = (*iter); if (provider && provider->IsModule(filename)) { return provider; } } return 0; } void Host::RemoveModuleProvider(ModuleProvider *provider) { Poco::Mutex::ScopedLock lock(moduleMutex); std::vector<ModuleProvider*>::iterator iter = std::find( moduleProviders.begin(), moduleProviders.end(), provider); if (iter != moduleProviders.end()) { moduleProviders.erase(iter); } } void Host::UnloadModuleProviders() { while (moduleProviders.size() > 0) { ModuleProvider* provider = moduleProviders.at(0); this->RemoveModuleProvider(provider); } } bool Host::IsModule(std::string& filename) { static const std::string prefix("tide"); static const std::string suffix("."MODULE_SUFFIX); bool isModule = (filename.length() > suffix.length() && filename.substr(filename.length() - suffix.length()) == suffix); if (!isModule) { return false; } if (filename.find(prefix) != std::string::npos) { return true; } return false; } /** * Load a modules from a path given a module provider. * @param path Path to the module to attempt to load. * @param provider The provider to attempt to load with. * @return The module that was loaded or NULL on failure. */ SharedPtr<Module> Host::LoadModule(std::string& path, ModuleProvider* provider) { //TI-180: Don't load the same module twice if (!this->GetModuleByPath(path).isNull()) { logger->Warn("Module cannot be loaded twice: %s", path.c_str()); return 0; } try { logger->Debug("Loading module: %s", path.c_str()); SharedPtr<Module> module(provider->CreateModule(path)); module->Initialize(); // loadedModules keeps track of the Module which is loaded from the // module shared-object, while application->modules holds the KComponent // metadata description of each module. this->loadedModules.push_back(module); this->application->UsingModule(module->GetName(), module->GetVersion(), path); logger->Info("Loaded module = %s", module->GetName().c_str()); this->application->UsingModule(module->GetName(), module->GetVersion(), path); return module; } catch (tide::ValueException& e) { SharedString s = e.GetValue()->DisplayString(); logger->Error("Could not load module (%s): %s", path.c_str(), s->c_str()); #ifdef OS_OSX KrollDumpStackTrace(); #endif } catch(std::exception &e) { string msg = e.what(); logger->Error("Could not load module (%s): %s", path.c_str(), msg.c_str()); #ifdef OS_OSX KrollDumpStackTrace(); #endif } catch(...) { logger->Error("Could not load module (%s)", path.c_str()); #ifdef OS_OSX KrollDumpStackTrace(); #endif } return 0; } void Host::UnloadModules() { Poco::Mutex::ScopedLock lock(moduleMutex); // Stop all modules before unloading them for (size_t i = 0; i < this->loadedModules.size(); i++) { this->loadedModules.at(i)->Stop(); } // All modules are stopped now unloading them while (this->loadedModules.size() > 0) { this->UnregisterModule(this->loadedModules.at(0)); } } /** * Do the initial round of module loading. First load all modules that can be * loaded by the main Host module provider (shared libraries) and then load all * modules which can be loaded by freshly installed module providers. */ void Host::LoadModules() { LoadBuiltinModules(this); Poco::Mutex::ScopedLock lock(moduleMutex); /* Scan module paths for modules which can be * loaded by the basic shared-object provider */ std::vector<std::string>::iterator iter; iter = this->modulePaths.begin(); while (iter != this->modulePaths.end()) { this->FindBasicModules((*iter++)); } /* Try to load files that weren't modules * using newly available module providers */ this->ScanInvalidModuleFiles(); /* All modules are now loaded, so start them all */ this->StartModules(this->loadedModules); /* From now on, adding a module provider will trigger * a rescan of all invalid module files */ this->autoScan = true; } /** * Scan a directory (no-recursion) for shared-object modules and load them. */ void Host::FindBasicModules(std::string& dir) { Poco::Mutex::ScopedLock lock(moduleMutex); Poco::DirectoryIterator iter = Poco::DirectoryIterator(dir); Poco::DirectoryIterator end; while (iter != end) { Poco::File f = *iter; if (!f.isDirectory() && !f.isHidden()) { std::string fpath(iter.path().absolute().toString()); if (IsModule(fpath)) { this->LoadModule(fpath, this); } else { this->AddInvalidModuleFile(fpath); } } iter++; } } void Host::AddInvalidModuleFile(std::string path) { // Don't add module twice std::vector<std::string>& invalid = this->invalidModuleFiles; if (std::find(invalid.begin(), invalid.end(), path) == invalid.end()) { this->invalidModuleFiles.push_back(path); } } /** * Load modules from all paths in invalidModuleFiles that can be loaded by * module providers found in module_providers. */ void Host::ScanInvalidModuleFiles() { Poco::Mutex::ScopedLock lock(moduleMutex); this->autoScan = false; // Do not recursively scan ModuleList modulesLoaded; // Track loaded modules std::vector<std::string>::iterator iter; iter = this->invalidModuleFiles.begin(); while (iter != this->invalidModuleFiles.end()) { std::string path = *iter; ModuleProvider *provider = FindModuleProvider(path); if (provider != 0) { SharedPtr<Module> m = this->LoadModule(path, provider); // Module was loaded successfully if (!m.isNull()) modulesLoaded.push_back(m); // Erase path, even on failure iter = invalidModuleFiles.erase(iter); } else { iter++; } } if (modulesLoaded.size() > 0) { this->StartModules(modulesLoaded); /* If any of the invalid module files added * a ModuleProvider, let them load their modules */ this->ScanInvalidModuleFiles(); } this->autoScan = true; } /** * Call the Start() lifecycle event on a vector of modules. */ void Host::StartModules(ModuleList to_init) { Poco::Mutex::ScopedLock lock(moduleMutex); ModuleList::iterator iter = to_init.begin(); while (iter != to_init.end()) { (*iter)->Start(); *iter++; } } SharedPtr<Module> Host::GetModuleByPath(std::string& path) { Poco::Mutex::ScopedLock lock(moduleMutex); ModuleList::iterator iter = this->loadedModules.begin(); while (iter != this->loadedModules.end()) { SharedPtr<Module> m = (*iter++); if (m->GetPath() == path) return m; } return 0; } SharedPtr<Module> Host::GetModuleByName(std::string& name) { Poco::Mutex::ScopedLock lock(moduleMutex); ModuleList::iterator iter = this->loadedModules.begin(); while (iter != this->loadedModules.end()) { SharedPtr<Module> m = (*iter++); if (m->GetName() == name) return m; } return 0; } void Host::UnregisterModule(SharedPtr<Module> module) { Poco::Mutex::ScopedLock lock(moduleMutex); logger->Notice("Unregistering: %s", module->GetName().c_str()); module->Unload(); ModuleList::iterator j = this->loadedModules.begin(); while (j != this->loadedModules.end()) { if (module == (*j).get()) { j = this->loadedModules.erase(j); } else { j++; } } std::vector<SharedComponent>::iterator i = this->application->modules.begin(); while (i != this->application->modules.end()) { if (module->GetPath() == (*i)->path) { i = this->application->modules.erase(i); } else { i++; } } } int Host::Run() { if (this->waitForDebugger) this->WaitForDebugger(); try { Poco::Mutex::ScopedLock lock(moduleMutex); this->AddModuleProvider(this); this->LoadModules(); } catch (ValueException e) { SharedString ss = e.GetValue()->DisplayString(); logger->Error(*ss); return 1; } // Do not run if exit flag is set. This can happen if a loaded // module from above called exit(). if (this->exiting) { Host::Shutdown(); return this->exitCode; } try { while (this->RunLoop()) {} } catch (tide::ValueException& e) { logger->Error("Caught exception in main loop: %s", e.ToString().c_str()); } Host::Shutdown(); return this->exitCode; } void Host::Shutdown() { // Do not shut down the logger here, because logging // may need to happen after this method is called. static bool shutdown = false; if (shutdown) return; Poco::Mutex::ScopedLock lock(moduleMutex); this->UnloadModuleProviders(); this->UnloadModules(); UnloadBuiltinModules(); logger->Notice("Exiting with exit code: %i", exitCode); StopProfiling(); // Stop the profiler, if it was enabled Logger::Shutdown(); shutdown = true; } void Host::Exit(int exitCode) { logger->Notice("Received exit signal (%d)", exitCode); if (!GlobalObject::GetInstance()->FireEvent(Event::EXIT) || !GlobalObject::GetInstance()->FireEvent(Event::APP_EXIT)) { logger->Notice("Exit signal canceled by event handler"); return; } this->exitCode = exitCode; this->exiting = true; this->ExitImpl(exitCode); } KValueRef Host::RunOnMainThread(KMethodRef method, const ValueList& args, bool waitForCompletion) { return this->RunOnMainThread(method, 0, args, waitForCompletion); } KValueRef Host::RunOnMainThread(KMethodRef method, KObjectRef thisObject, const ValueList& args, bool waitForCompletion) { MainThreadJob* job = new MainThreadJob(method, thisObject, args, waitForCompletion); if (this->IsMainThread() && waitForCompletion) { job->Execute(); } else { Poco::ScopedLock<Poco::Mutex> s(jobQueueMutex); this->mainThreadJobs.push_back(job); // Enqueue job } this->SignalNewMainThreadJob(); if (!waitForCompletion) { return Value::Undefined; // Handler will cleanup } else { // If this is the main thread, Wait() will fall // through because we've already called Execute() above. job->Wait(); KValueRef result(job->GetResult()); ValueException exception(job->GetException()); delete job; if (!result.isNull()) return result; else throw exception; } } void Host::RunMainThreadJobs() { // Prevent other threads trying to queue while we clear the queue. // But don't block the invocation task while we actually execute // the jobs -- one of these jobs may try to add something to the // job queue -- deadlock-o-rama std::vector<MainThreadJob*> jobs; { Poco::ScopedLock<Poco::Mutex> s(jobQueueMutex); jobs = this->mainThreadJobs; this->mainThreadJobs.clear(); } for (size_t i = 0; i < jobs.size(); i++) { MainThreadJob* job = jobs[i]; // Job might be freed soon after Execute(), so get this value now. bool asynchronous = !job->ShouldWaitForCompletion(); job->Execute(); if (asynchronous) { job->PrintException(); delete job; } } } KValueRef RunOnMainThread(KMethodRef method, const ValueList& args, bool waitForCompletion) { return hostInstance->RunOnMainThread(method, args, waitForCompletion); } KValueRef RunOnMainThread(KMethodRef method, KObjectRef thisObject, const ValueList& args, bool waitForCompletion) { return hostInstance->RunOnMainThread(method, args, waitForCompletion); } bool IsMainThread() { return hostInstance->IsMainThread(); } }
.global s_prepare_buffers s_prepare_buffers: push %r11 push %r13 push %r15 push %r9 push %rcx push %rdi push %rdx push %rsi lea addresses_D_ht+0x2c8, %r11 nop nop add $45988, %rdi mov (%r11), %r15w sub %r9, %r9 lea addresses_A_ht+0xfd40, %r13 nop nop nop add %r9, %r9 mov (%r13), %rdx nop nop nop nop nop xor %r15, %r15 lea addresses_normal_ht+0x16228, %rsi lea addresses_A_ht+0x6ec8, %rdi clflush (%rsi) nop nop nop nop add $15854, %r13 mov $18, %rcx rep movsw nop nop nop nop lfence pop %rsi pop %rdx pop %rdi pop %rcx pop %r9 pop %r15 pop %r13 pop %r11 ret .global s_faulty_load s_faulty_load: push %r14 push %r15 push %rax push %rcx push %rdi push %rdx push %rsi // Store lea addresses_WC+0x11338, %rdi nop nop nop nop nop inc %rdx movb $0x51, (%rdi) sub %rdi, %rdi // Load lea addresses_WC+0x154c8, %rax xor $3258, %rcx vmovups (%rax), %ymm2 vextracti128 $1, %ymm2, %xmm2 vpextrq $1, %xmm2, %rdi nop xor $22541, %rax // Faulty Load lea addresses_UC+0x6ec8, %rdx nop nop and $63274, %rax vmovups (%rdx), %ymm5 vextracti128 $0, %ymm5, %xmm5 vpextrq $0, %xmm5, %rdi lea oracles, %rcx and $0xff, %rdi shlq $12, %rdi mov (%rcx,%rdi,1), %rdi pop %rsi pop %rdx pop %rdi pop %rcx pop %rax pop %r15 pop %r14 ret /* <gen_faulty_load> [REF] {'src': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 0, 'same': False, 'type': 'addresses_UC'}, 'OP': 'LOAD'} {'dst': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 4, 'same': False, 'type': 'addresses_WC'}, 'OP': 'STOR'} {'src': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 6, 'same': False, 'type': 'addresses_WC'}, 'OP': 'LOAD'} [Faulty Load] {'src': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 0, 'same': True, 'type': 'addresses_UC'}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 2, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'LOAD'} {'src': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 1, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'LOAD'} {'src': {'congruent': 1, 'same': False, 'type': 'addresses_normal_ht'}, 'dst': {'congruent': 8, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'REPM'} {'37': 21829} 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 */
#include "baldr/json.h" #include "baldr/rapidjson_utils.h" #include "test.h" #include <cstdint> #include <set> namespace { void TestJsonSerialize() { using namespace std; using namespace valhalla::baldr; stringstream result; result << *json::map( {{"hint_data", json::map( {{"locations", json::array({string("_____38_SADaFQQAKwEAABEAAAAAAAAAdgAAAFfLwga4tW0C4P6W-wAARAA"), string("fzhIAP____8wFAQA1AAAAC8BAAAAAAAAAAAAAP____9Uu20CGAiX-wAAAAA")})}, {"checksum", static_cast<uint64_t>(2875622111)}})}, {"route_name", json::array({string("West 26th Street"), string("Madison Avenue")})}, {"via_indices", json::array({uint64_t(0), uint64_t(9)})}, {"found_alternative", bool(false)}, {"route_summary", json::map({{"end_point", string("West 29th Street")}, {"start_point", string("West 26th Street")}, {"total_time", uint64_t(145)}, {"total_distance", uint64_t(878)}})}, {"via_points", json::array({json::array({json::fp_t{40.744377, 3}, json::fp_t{-73.990433, 3}}), json::array({json::fp_t{40.745811, 3}, json::fp_t{-73.988075, 3}})})}, {"route_instructions", json::array( {json::array({string("10"), string("West 26th Street"), uint64_t(216), uint64_t(0), uint64_t(52), string("215m"), string("SE"), uint64_t(118)}), json::array({string("1"), string("East 26th Street"), uint64_t(153), uint64_t(2), uint64_t(29), string("153m"), string("SE"), uint64_t(120)}), json::array({string("7"), string("Madison Avenue"), uint64_t(237), uint64_t(3), uint64_t(25), string("236m"), string("NE"), uint64_t(29)}), json::array({string("7"), string("East 29th Street"), uint64_t(155), uint64_t(6), uint64_t(29), string("154m"), string("NW"), uint64_t(299)}), json::array({string("1"), string("West 29th Street"), uint64_t(118), uint64_t(7), uint64_t(21), string("117m"), string("NW"), uint64_t(299)}), json::array({string("15"), string(""), uint64_t(0), uint64_t(8), uint64_t(0), string("0m"), string("N"), uint64_t(0)})})}, {"route_geometry", string("ozyulA~p_clCfc@ywApTar@li@ybBqe@c[ue@e[ue@i[ci@dcB}^rkA")}, {"status_message", string("Found route between points")}, {"status", uint64_t(0)}, {"escaped_string", string("\"\t\r\n\\\a")}}); stringstream answer; answer << "{\"escaped_string\":\"\\\"\\t\\r\\n\\\\\\u0007\",\"hint_data\":{\"checksum\":" "2875622111,\"locations\":[\"_____38_SADaFQQAKwEAABEAAAAAAAAAdgAAAFfLwga4tW0C4P6W-" "wAARAA\",\"fzhIAP____8wFAQA1AAAAC8BAAAAAAAAAAAAAP____9Uu20CGAiX-wAAAAA\"]},\"route_" "name\":[\"West 26th Street\",\"Madison " "Avenue\"],\"found_alternative\":false,\"route_summary\":{\"total_distance\":878," "\"total_time\":145,\"start_point\":\"West 26th Street\",\"end_point\":\"West 29th " "Street\"},\"via_points\":[[40.744,-73.990],[40.746,-73.988]],\"route_instructions\":[[" "\"10\",\"West 26th Street\",216,0,52,\"215m\",\"SE\",118],[\"1\",\"East 26th " "Street\",153,2,29,\"153m\",\"SE\",120],[\"7\",\"Madison " "Avenue\",237,3,25,\"236m\",\"NE\",29],[\"7\",\"East 29th " "Street\",155,6,29,\"154m\",\"NW\",299],[\"1\",\"West 29th " "Street\",118,7,21,\"117m\",\"NW\",299],[\"15\",\"\",0,8,0,\"0m\",\"N\",0]],\"route_" "geometry\":\"ozyulA~p_clCfc@ywApTar@li@ybBqe@c[ue@e[ue@i[ci@dcB}^rkA\",\"status_" "message\":\"Found route between points\",\"via_indices\":[0,9],\"status\":0}"; rapidjson::Document res, ans; if (res != ans) throw std::logic_error("Wrong json"); } } // namespace int main() { test::suite suite("json"); suite.test(TEST_CASE(TestJsonSerialize)); return suite.tear_down(); }
;;; Test program of devices/ccs811.asm ;;- The test program for ccs811-asm (asm version). ;;- ;;- This program reads data from CCS811 and show the received data via USART like this: ;;- ;;- #+begin_src sh ;;- $ dterm /dev/ttyUSB0 4800 ;;- # Hallo CCS811 ;;- # CCS811 found at 0x5A ;;- # Waiting for the first data .... ;;- # Entering interrupt mode ;;- eCO2: 406 ppm, eTVOC: 0 ppb [ 01 96 00 00 98 00 07 23 ] ;;- eCO2: 409 ppm, eTVOC: 1 ppb [ 01 99 00 01 98 00 07 21 ] ;;- eCO2: 413 ppm, eTVOC: 1 ppb [ 01 9D 00 01 98 00 07 20 ] ;;- eCO2: 413 ppm, eTVOC: 1 ppb [ 01 9D 00 01 98 00 07 20 ] ;;- eCO2: 406 ppm, eTVOC: 0 ppb [ 01 96 00 00 98 00 07 23 ] ;;- eCO2: 408 ppm, eTVOC: 1 ppb [ 01 98 00 01 98 00 07 22 ] ;;- : ;;- : ;;- #+end_src ;;- ;;- To compile this file, the following files are required ;;- (These files are parts of the pAVRlib). ;;- ;;- - [[../../devices/ccs811][devices/ccs811.asm]] ;;- - [[../../twi-controller][twi-controller.asm]] ;;- - [[../../usart][usart.asm]] ;;- - [[../../usart-puts][usart-puts.asm]] ;;- - [[../../usart-puthex][usart-puthex.asm]] ;;- - [[../../bin2ascii][bin2ascii.asm]] ;;- - [[../../bin2bcd16][bin2bcd16.asm]] ;;- - [[../../wait][wait.asm]] ;;- ;;- See also: ~examples/README.org~ ;;- ;;; ------------------------------------------------------------ ;;; Define your device in device.inc or use ;;; .include "m8def.inc" ;;; and so on as usual. .include "device.inc" ;;; ------------------------------------------------------------ .def CCS811ADDR = r27 ; interrupt vectors rjmp RESET #ifdef CCS811TEST_USE_INTERRUPT_MODE rjmp NewData ;rjmp EXT_INT0 #else reti #endif reti ;rjmp EXT_INT1 reti ;rjmp TIM2_COMP reti ;rjmp TIM2_OVF reti ;rjmp TIM1_CAPT reti ;rjmp TIM1_COMPA reti ;rjmp TIM1_COMPB reti ;rjmp INT_TIM1_OVF reti ;rjmp TIM0_OVF reti ;rjmp SPI_STC reti ;rjmp USART_RXC reti ;rjmp USART_UDRE reti ;rjmp USART_TXC reti ;rjmp ADC reti ;rjmp EE_RDY reti ;rjmp ANA_COMP reti ;rjmp TWI reti ;rjmp SPM_RDY RESET: ; set stack pointer ldi r16, low(RAMEND) out SPL, r16 ldi r16, high(RAMEND) out SPH, r16 rcall USART_INITIALIZE ldi r25, high(STR_HELLO) ldi r24, low (STR_HELLO) rcall USART_PUTS rcall TWI_INITIALIZE #ifdef CCS811_USE_RESET rcall CCS811_RESET ldi r24, 250 rcall Waitms #endif rcall CCS811_SEARCH sbrc r24, 7 rjmp ERROR_NO_DEVICE ;; found CCS811 mov CCS811ADDR, r24 ldi r25, high(STR_CCS811ADDR) ldi r24, low (STR_CCS811ADDR) rcall USART_PUTS mov r24, CCS811ADDR rcall USART_PUTHEX ldi r24, 0x0d rcall USART_TRANSMIT ldi r24, 0x0a rcall USART_TRANSMIT ;; initialize mov r24, CCS811ADDR rcall CCS811_INITIALIZE ;; error check sbrc r25, 7 ;; initialize error rjmp ERROR_INITIALIZE CCS811_SET_MEAS: ;; set measure mode ldi r16, (DRIVE_MODE_1s | INT_DATARDY) mov r0, r16 mov r24, CCS811ADDR ldi r22, MEAS_MODE ldi r20, 1 clr r19 clr r18 rcall CCS811_WRITE rcall Wait1ms ;; read STATUS (0x00) mov r24, CCS811ADDR ldi r22, STATUS ldi r20, 1 clr r19 clr r18 rcall CCS811_READ ldi r25, high(STR_FIRSTDATA) ldi r24, low (STR_FIRSTDATA) rcall USART_PUTS _first_data: ;; Wait for the first data rcall Wait1sec ;; read STATUS (0x00) mov r24, CCS811ADDR ldi r22, STATUS ldi r20, 1 clr r19 clr r18 rcall CCS811_READ ldi r24, '.' rcall USART_TRANSMIT sbrs r0, sDATA_READY rjmp _first_data ;; the first data is ready ldi r24, 0x0d rcall USART_TRANSMIT ldi r24, 0x0a rcall USART_TRANSMIT ;; read ALG_RESULT_DATA to reset interrupt mov r24, CCS811ADDR ldi r22, ALG_RESULT_DATA ldi r20, 8 clr r19 clr r18 rcall CCS811_READ #ifdef CCS811TEST_USE_INTERRUPT_MODE ldi r25, high(STR_INTR) ldi r24, low (STR_INTR) rcall USART_PUTS ;; enable interrupt push r16 ldi r16, (0<<ISC00) out MCUCR, r16 in r16, GICR ori r16, (1<<INT0) out GICR, r16 pop r16 sei WaitNewData: rjmp WaitNewData #else ; ifndef CCS811TEST_USE_INTERRUPT_MODE POLLING: rcall Wait1sec ;; read STATUS (0x00) mov r24, CCS811ADDR ldi r22, STATUS ldi r20, 1 clr r19 clr r18 rcall CCS811_READ ;; check if data is ready sbrs r0, sDATA_READY rjmp POLLING ;; read ALG_RESULT_DATA (0x02) mov r24, CCS811ADDR ldi r22, ALG_RESULT_DATA ldi r20, 8 clr r19 clr r18 rcall CCS811_READ rcall SHOW_DATA rcall DUMP_RAWDATA rjmp POLLING #endif ;;; ------------------------------------------------------------ ;;; error ERROR_NO_DEVICE: ldi r25, high(STR_ERRNODEV) ldi r24, low (STR_ERRNODEV) rcall USART_PUTS rjmp loop_error ERROR_INITIALIZE: ldi r25, high(STR_ERRINIT) ldi r24, low (STR_ERRINIT) rcall USART_PUTS rcall USART_PUTHEX ldi r24, 0x0d rcall USART_TRANSMIT ldi r24, 0x0a rcall USART_TRANSMIT rjmp loop_error ;;; not used (yet) ERROR_TWI: push r25 ldi r25, high(STR_ERROR) ldi r24, low (STR_ERROR) rcall USART_PUTS ldi r24, ':' rcall USART_TRANSMIT pop r25 mov r24, r25 ; TWI status rcall USART_PUTHEX ldi r24, 0x0d rcall USART_TRANSMIT ldi r24, 0x0a rcall USART_TRANSMIT loop_error: rjmp loop_error ;;; ------------------------------------------------------------ NewData: mov r24, CCS811ADDR ldi r22, ALG_RESULT_DATA ldi r20, 8 clr r19 clr r18 rcall CCS811_READ rcall SHOW_DATA rcall DUMP_RAWDATA reti SHOW_DATA: ;; eCO2 ldi r24, 'e' rcall USART_TRANSMIT ldi r24, 'C' rcall USART_TRANSMIT ldi r24, 'O' rcall USART_TRANSMIT ldi r24, '2' rcall USART_TRANSMIT ldi r24, ':' rcall USART_TRANSMIT ldi r24, ' ' rcall USART_TRANSMIT mov r25, r0 mov r24, r1 rcall BIN2BCD16 rcall BCDSHOW ldi r24, ' ' rcall USART_TRANSMIT ldi r24, 'p' rcall USART_TRANSMIT ldi r24, 'p' rcall USART_TRANSMIT ldi r24, 'm' rcall USART_TRANSMIT ldi r24, ',' rcall USART_TRANSMIT ;; eTVOC ldi r24, ' ' rcall USART_TRANSMIT ldi r24, 'e' rcall USART_TRANSMIT ldi r24, 'T' rcall USART_TRANSMIT ldi r24, 'V' rcall USART_TRANSMIT ldi r24, 'O' rcall USART_TRANSMIT ldi r24, 'C' rcall USART_TRANSMIT ldi r24, ':' rcall USART_TRANSMIT ldi r24, ' ' rcall USART_TRANSMIT mov r25, r2 mov r24, r3 rcall BIN2BCD16 rcall BCDSHOW ldi r24, ' ' rcall USART_TRANSMIT ldi r24, 'p' rcall USART_TRANSMIT ldi r24, 'p' rcall USART_TRANSMIT ldi r24, 'b' rcall USART_TRANSMIT ret ;;; ------------------------------------------------------------ BCDSHOW: push r18 push r17 push r16 mov r18, r25 mov r17, r24 mov r16, r23 mov r24, r18 andi r18, 0x0f brne _showdata18 ldi r18, ' ' subi r24, -' ' rjmp _showdata17 _showdata18: ldi r18, '0' subi r24, -'0' _showdata17: rcall USART_TRANSMIT push r17 swap r17 andi r17, 0x0f breq _showdata17_2 ldi r18, '0' _showdata17_2: add r17, r18 mov r24, r17 rcall USART_TRANSMIT pop r17 andi r17, 0x0f breq _showdata17_1 ldi r18, '0' _showdata17_1: add r17, r18 mov r24, r17 rcall USART_TRANSMIT push r16 swap r16 andi r16, 0x0f breq _showdata16_2 ldi r18, '0' _showdata16_2: add r16, r18 mov r24, r16 rcall USART_TRANSMIT pop r16 andi r16, 0x0f subi r16, -'0' mov r24, r16 rcall USART_TRANSMIT pop r16 pop r17 pop r18 ret ;;; ------------------------------------------------------------ DUMP_RAWDATA: push r31 push r30 clr r31 clr r30 ldi r24, ' ' rcall USART_TRANSMIT ldi r24, '[' rcall USART_TRANSMIT ldi r24, ' ' rcall USART_TRANSMIT _DUMP_RAWDATA_loop: ld r24, Z+ rcall USART_PUTHEX ldi r24, ' ' rcall USART_TRANSMIT cpi r30, 8 brne _DUMP_RAWDATA_loop ldi r24, ']' rcall USART_TRANSMIT ldi r24, 0x0d rcall USART_TRANSMIT ldi r24, 0x0a rcall USART_TRANSMIT pop r30 pop r31 ret ; ------------------------------------------------------------ .include "devices/ccs811.asm" .include "twi-controller.asm" .include "usart.asm" .include "usart-puts.asm" .include "usart-puthex.asm" .include "bin2ascii.asm" .include "bin2bcd16.asm" .include "wait.asm" ; ------------------------------------------------------------ STR_HELLO: .db "# Hallo CCS811", 0x0d, 0x0a, 0, 0 STR_FIRSTDATA: .db "# Waiting for the first data ", 0 STR_INTR: .db "# Entering interrupt mode", 0x0d, 0x0a, 0 STR_CCS811ADDR: .db "# CCS811 found at 0x", 0, 0 STR_ERROR: .db "! TWI Error. Status: ", 0 STR_ERRNODEV: .db "! No CCS811 found.", 0x0d, 0x0a, 0, 0 STR_ERRINIT: .db "! Initialize failed: ", 0
// Copyright (c) 2012-2015 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "key.h" #include "keystore.h" #include "validation.h" #include "policy/policy.h" #include "script/script.h" #include "script/script_error.h" #include "script/sign.h" #include "script/ismine.h" #include "test/test_aced.h" #include <vector> #include <boost/test/unit_test.hpp> // Helpers: static std::vector<unsigned char> Serialize(const CScript& s) { std::vector<unsigned char> sSerialized(s.begin(), s.end()); return sSerialized; } static bool Verify(const CScript& scriptSig, const CScript& scriptPubKey, bool fStrict, ScriptError& err) { // Create dummy to/from transactions: CMutableTransaction txFrom; txFrom.vout.resize(1); txFrom.vout[0].scriptPubKey = scriptPubKey; CMutableTransaction txTo; txTo.vin.resize(1); txTo.vout.resize(1); txTo.vin[0].prevout.n = 0; txTo.vin[0].prevout.hash = txFrom.GetHash(); txTo.vin[0].scriptSig = scriptSig; txTo.vout[0].nValue = 1; return VerifyScript(scriptSig, scriptPubKey, fStrict ? SCRIPT_VERIFY_P2SH : SCRIPT_VERIFY_NONE, MutableTransactionSignatureChecker(&txTo, 0), &err); } BOOST_FIXTURE_TEST_SUITE(script_P2SH_tests, BasicTestingSetup) BOOST_AUTO_TEST_CASE(sign) { LOCK(cs_main); // Pay-to-script-hash looks like this: // scriptSig: <sig> <sig...> <serialized_script> // scriptPubKey: HASH160 <hash> EQUAL // Test SignSignature() (and therefore the version of Solver() that signs transactions) CBasicKeyStore keystore; CKey key[4]; for (int i = 0; i < 4; i++) { key[i].MakeNewKey(true); keystore.AddKey(key[i]); } // 8 Scripts: checking all combinations of // different keys, straight/P2SH, pubkey/pubkeyhash CScript standardScripts[4]; standardScripts[0] << ToByteVector(key[0].GetPubKey()) << OP_CHECKSIG; standardScripts[1] = GetScriptForDestination(key[1].GetPubKey().GetID()); standardScripts[2] << ToByteVector(key[1].GetPubKey()) << OP_CHECKSIG; standardScripts[3] = GetScriptForDestination(key[2].GetPubKey().GetID()); CScript evalScripts[4]; for (int i = 0; i < 4; i++) { keystore.AddCScript(standardScripts[i]); evalScripts[i] = GetScriptForDestination(CScriptID(standardScripts[i])); } CMutableTransaction txFrom; // Funding transaction: std::string reason; txFrom.vout.resize(8); for (int i = 0; i < 4; i++) { txFrom.vout[i].scriptPubKey = evalScripts[i]; txFrom.vout[i].nValue = COIN; txFrom.vout[i+4].scriptPubKey = standardScripts[i]; txFrom.vout[i+4].nValue = COIN; } BOOST_CHECK(IsStandardTx(txFrom, reason)); CMutableTransaction txTo[8]; // Spending transactions for (int i = 0; i < 8; i++) { txTo[i].vin.resize(1); txTo[i].vout.resize(1); txTo[i].vin[0].prevout.n = i; txTo[i].vin[0].prevout.hash = txFrom.GetHash(); txTo[i].vout[0].nValue = 1; BOOST_CHECK_MESSAGE(IsMine(keystore, txFrom.vout[i].scriptPubKey), strprintf("IsMine %d", i)); } for (int i = 0; i < 8; i++) { BOOST_CHECK_MESSAGE(SignSignature(keystore, txFrom, txTo[i], 0), strprintf("SignSignature %d", i)); } // All of the above should be OK, and the txTos have valid signatures // Check to make sure signature verification fails if we use the wrong ScriptSig: for (int i = 0; i < 8; i++) for (int j = 0; j < 8; j++) { CScript sigSave = txTo[i].vin[0].scriptSig; txTo[i].vin[0].scriptSig = txTo[j].vin[0].scriptSig; const CTxOut& output = txFrom.vout[txTo[i].vin[0].prevout.n]; bool sigOK = CScriptCheck(output.scriptPubKey, output.nValue, txTo[i], 0, SCRIPT_VERIFY_P2SH | SCRIPT_VERIFY_STRICTENC, false)(); if (i == j) BOOST_CHECK_MESSAGE(sigOK, strprintf("VerifySignature %d %d", i, j)); else BOOST_CHECK_MESSAGE(!sigOK, strprintf("VerifySignature %d %d", i, j)); txTo[i].vin[0].scriptSig = sigSave; } } BOOST_AUTO_TEST_CASE(norecurse) { ScriptError err; // Make sure only the outer pay-to-script-hash does the // extra-validation thing: CScript invalidAsScript; invalidAsScript << OP_INVALIDOPCODE << OP_INVALIDOPCODE; CScript p2sh = GetScriptForDestination(CScriptID(invalidAsScript)); CScript scriptSig; scriptSig << Serialize(invalidAsScript); // Should not verify, because it will try to execute OP_INVALIDOPCODE BOOST_CHECK(!Verify(scriptSig, p2sh, true, err)); BOOST_CHECK_MESSAGE(err == SCRIPT_ERR_BAD_OPCODE, ScriptErrorString(err)); // Try to recur, and verification should succeed because // the inner HASH160 <> EQUAL should only check the hash: CScript p2sh2 = GetScriptForDestination(CScriptID(p2sh)); CScript scriptSig2; scriptSig2 << Serialize(invalidAsScript) << Serialize(p2sh); BOOST_CHECK(Verify(scriptSig2, p2sh2, true, err)); BOOST_CHECK_MESSAGE(err == SCRIPT_ERR_OK, ScriptErrorString(err)); } BOOST_AUTO_TEST_CASE(set) { LOCK(cs_main); // Test the CScript::Set* methods CBasicKeyStore keystore; CKey key[4]; std::vector<CPubKey> keys; for (int i = 0; i < 4; i++) { key[i].MakeNewKey(true); keystore.AddKey(key[i]); keys.push_back(key[i].GetPubKey()); } CScript inner[4]; inner[0] = GetScriptForDestination(key[0].GetPubKey().GetID()); inner[1] = GetScriptForMultisig(2, std::vector<CPubKey>(keys.begin(), keys.begin()+2)); inner[2] = GetScriptForMultisig(1, std::vector<CPubKey>(keys.begin(), keys.begin()+2)); inner[3] = GetScriptForMultisig(2, std::vector<CPubKey>(keys.begin(), keys.begin()+3)); CScript outer[4]; for (int i = 0; i < 4; i++) { outer[i] = GetScriptForDestination(CScriptID(inner[i])); keystore.AddCScript(inner[i]); } CMutableTransaction txFrom; // Funding transaction: std::string reason; txFrom.vout.resize(4); for (int i = 0; i < 4; i++) { txFrom.vout[i].scriptPubKey = outer[i]; txFrom.vout[i].nValue = CENT; } BOOST_CHECK(IsStandardTx(txFrom, reason)); CMutableTransaction txTo[4]; // Spending transactions for (int i = 0; i < 4; i++) { txTo[i].vin.resize(1); txTo[i].vout.resize(1); txTo[i].vin[0].prevout.n = i; txTo[i].vin[0].prevout.hash = txFrom.GetHash(); txTo[i].vout[0].nValue = 1*CENT; txTo[i].vout[0].scriptPubKey = inner[i]; BOOST_CHECK_MESSAGE(IsMine(keystore, txFrom.vout[i].scriptPubKey), strprintf("IsMine %d", i)); } for (int i = 0; i < 4; i++) { BOOST_CHECK_MESSAGE(SignSignature(keystore, txFrom, txTo[i], 0), strprintf("SignSignature %d", i)); BOOST_CHECK_MESSAGE(IsStandardTx(txTo[i], reason), strprintf("txTo[%d].IsStandard", i)); } } BOOST_AUTO_TEST_CASE(is) { // Test CScript::IsPayToScriptHash() uint160 dummy; CScript p2sh; p2sh << OP_HASH160 << ToByteVector(dummy) << OP_EQUAL; BOOST_CHECK(p2sh.IsPayToScriptHash()); // Not considered pay-to-script-hash if using one of the OP_PUSHDATA opcodes: static const unsigned char direct[] = { OP_HASH160, 20, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, OP_EQUAL }; BOOST_CHECK(CScript(direct, direct+sizeof(direct)).IsPayToScriptHash()); static const unsigned char pushdata1[] = { OP_HASH160, OP_PUSHDATA1, 20, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, OP_EQUAL }; BOOST_CHECK(!CScript(pushdata1, pushdata1+sizeof(pushdata1)).IsPayToScriptHash()); static const unsigned char pushdata2[] = { OP_HASH160, OP_PUSHDATA2, 20,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, OP_EQUAL }; BOOST_CHECK(!CScript(pushdata2, pushdata2+sizeof(pushdata2)).IsPayToScriptHash()); static const unsigned char pushdata4[] = { OP_HASH160, OP_PUSHDATA4, 20,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, OP_EQUAL }; BOOST_CHECK(!CScript(pushdata4, pushdata4+sizeof(pushdata4)).IsPayToScriptHash()); CScript not_p2sh; BOOST_CHECK(!not_p2sh.IsPayToScriptHash()); not_p2sh.clear(); not_p2sh << OP_HASH160 << ToByteVector(dummy) << ToByteVector(dummy) << OP_EQUAL; BOOST_CHECK(!not_p2sh.IsPayToScriptHash()); not_p2sh.clear(); not_p2sh << OP_NOP << ToByteVector(dummy) << OP_EQUAL; BOOST_CHECK(!not_p2sh.IsPayToScriptHash()); not_p2sh.clear(); not_p2sh << OP_HASH160 << ToByteVector(dummy) << OP_CHECKSIG; BOOST_CHECK(!not_p2sh.IsPayToScriptHash()); } BOOST_AUTO_TEST_CASE(switchover) { // Test switch over code CScript notValid; ScriptError err; notValid << OP_11 << OP_12 << OP_EQUALVERIFY; CScript scriptSig; scriptSig << Serialize(notValid); CScript fund = GetScriptForDestination(CScriptID(notValid)); // Validation should succeed under old rules (hash is correct): BOOST_CHECK(Verify(scriptSig, fund, false, err)); BOOST_CHECK_MESSAGE(err == SCRIPT_ERR_OK, ScriptErrorString(err)); // Fail under new: BOOST_CHECK(!Verify(scriptSig, fund, true, err)); BOOST_CHECK_MESSAGE(err == SCRIPT_ERR_EQUALVERIFY, ScriptErrorString(err)); } BOOST_AUTO_TEST_CASE(AreInputsStandard) { LOCK(cs_main); CCoinsView coinsDummy; CCoinsViewCache coins(&coinsDummy); CBasicKeyStore keystore; CKey key[6]; std::vector<CPubKey> keys; for (int i = 0; i < 6; i++) { key[i].MakeNewKey(true); keystore.AddKey(key[i]); } for (int i = 0; i < 3; i++) keys.push_back(key[i].GetPubKey()); CMutableTransaction txFrom; txFrom.vout.resize(7); // First three are standard: CScript pay1 = GetScriptForDestination(key[0].GetPubKey().GetID()); keystore.AddCScript(pay1); CScript pay1of3 = GetScriptForMultisig(1, keys); txFrom.vout[0].scriptPubKey = GetScriptForDestination(CScriptID(pay1)); // P2SH (OP_CHECKSIG) txFrom.vout[0].nValue = 1000; txFrom.vout[1].scriptPubKey = pay1; // ordinary OP_CHECKSIG txFrom.vout[1].nValue = 2000; txFrom.vout[2].scriptPubKey = pay1of3; // ordinary OP_CHECKMULTISIG txFrom.vout[2].nValue = 3000; // vout[3] is complicated 1-of-3 AND 2-of-3 // ... that is OK if wrapped in P2SH: CScript oneAndTwo; oneAndTwo << OP_1 << ToByteVector(key[0].GetPubKey()) << ToByteVector(key[1].GetPubKey()) << ToByteVector(key[2].GetPubKey()); oneAndTwo << OP_3 << OP_CHECKMULTISIGVERIFY; oneAndTwo << OP_2 << ToByteVector(key[3].GetPubKey()) << ToByteVector(key[4].GetPubKey()) << ToByteVector(key[5].GetPubKey()); oneAndTwo << OP_3 << OP_CHECKMULTISIG; keystore.AddCScript(oneAndTwo); txFrom.vout[3].scriptPubKey = GetScriptForDestination(CScriptID(oneAndTwo)); txFrom.vout[3].nValue = 4000; // vout[4] is max sigops: CScript fifteenSigops; fifteenSigops << OP_1; for (unsigned i = 0; i < MAX_P2SH_SIGOPS; i++) fifteenSigops << ToByteVector(key[i%3].GetPubKey()); fifteenSigops << OP_15 << OP_CHECKMULTISIG; keystore.AddCScript(fifteenSigops); txFrom.vout[4].scriptPubKey = GetScriptForDestination(CScriptID(fifteenSigops)); txFrom.vout[4].nValue = 5000; // vout[5/6] are non-standard because they exceed MAX_P2SH_SIGOPS CScript sixteenSigops; sixteenSigops << OP_16 << OP_CHECKMULTISIG; keystore.AddCScript(sixteenSigops); txFrom.vout[5].scriptPubKey = GetScriptForDestination(CScriptID(fifteenSigops)); txFrom.vout[5].nValue = 5000; CScript twentySigops; twentySigops << OP_CHECKMULTISIG; keystore.AddCScript(twentySigops); txFrom.vout[6].scriptPubKey = GetScriptForDestination(CScriptID(twentySigops)); txFrom.vout[6].nValue = 6000; AddCoins(coins, txFrom, 0); CMutableTransaction txTo; txTo.vout.resize(1); txTo.vout[0].scriptPubKey = GetScriptForDestination(key[1].GetPubKey().GetID()); txTo.vin.resize(5); for (int i = 0; i < 5; i++) { txTo.vin[i].prevout.n = i; txTo.vin[i].prevout.hash = txFrom.GetHash(); } BOOST_CHECK(SignSignature(keystore, txFrom, txTo, 0)); BOOST_CHECK(SignSignature(keystore, txFrom, txTo, 1)); BOOST_CHECK(SignSignature(keystore, txFrom, txTo, 2)); // SignSignature doesn't know how to sign these. We're // not testing validating signatures, so just create // dummy signatures that DO include the correct P2SH scripts: txTo.vin[3].scriptSig << OP_11 << OP_11 << std::vector<unsigned char>(oneAndTwo.begin(), oneAndTwo.end()); txTo.vin[4].scriptSig << std::vector<unsigned char>(fifteenSigops.begin(), fifteenSigops.end()); BOOST_CHECK(::AreInputsStandard(txTo, coins)); // 22 P2SH sigops for all inputs (1 for vin[0], 6 for vin[3], 15 for vin[4] BOOST_CHECK_EQUAL(GetP2SHSigOpCount(txTo, coins), 22U); CMutableTransaction txToNonStd1; txToNonStd1.vout.resize(1); txToNonStd1.vout[0].scriptPubKey = GetScriptForDestination(key[1].GetPubKey().GetID()); txToNonStd1.vout[0].nValue = 1000; txToNonStd1.vin.resize(1); txToNonStd1.vin[0].prevout.n = 5; txToNonStd1.vin[0].prevout.hash = txFrom.GetHash(); txToNonStd1.vin[0].scriptSig << std::vector<unsigned char>(sixteenSigops.begin(), sixteenSigops.end()); BOOST_CHECK(!::AreInputsStandard(txToNonStd1, coins)); BOOST_CHECK_EQUAL(GetP2SHSigOpCount(txToNonStd1, coins), 16U); CMutableTransaction txToNonStd2; txToNonStd2.vout.resize(1); txToNonStd2.vout[0].scriptPubKey = GetScriptForDestination(key[1].GetPubKey().GetID()); txToNonStd2.vout[0].nValue = 1000; txToNonStd2.vin.resize(1); txToNonStd2.vin[0].prevout.n = 6; txToNonStd2.vin[0].prevout.hash = txFrom.GetHash(); txToNonStd2.vin[0].scriptSig << std::vector<unsigned char>(twentySigops.begin(), twentySigops.end()); BOOST_CHECK(!::AreInputsStandard(txToNonStd2, coins)); BOOST_CHECK_EQUAL(GetP2SHSigOpCount(txToNonStd2, coins), 20U); } BOOST_AUTO_TEST_SUITE_END()
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Copyright(c) 2011-2016 Intel Corporation All rights reserved. ; ; Redistribution and use in source and binary forms, with or without ; modification, are permitted provided that the following conditions ; are met: ; * Redistributions of source code must retain the above copyright ; notice, this list of conditions and the following disclaimer. ; * 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. ; * Neither the name of Intel Corporation nor the names of its ; contributors may be used to endorse or promote products derived ; from this software without specific prior written permission. ; ; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ; "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ; LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR ; A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT ; OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ; SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ; LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ; DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ; THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; code to compute 16 SHA1 using SSE ;; %include "reg_sizes.asm" default rel ;; Magic functions defined in FIPS 180-1 ;; ; macro MAGIC_F0 F,B,C,D,T ;; F = (D ^ (B & (C ^ D))) %macro MAGIC_F0 5 %define %%regF %1 %define %%regB %2 %define %%regC %3 %define %%regD %4 %define %%regT %5 movdqa %%regF,%%regC pxor %%regF,%%regD pand %%regF,%%regB pxor %%regF,%%regD %endmacro ; macro MAGIC_F1 F,B,C,D,T ;; F = (B ^ C ^ D) %macro MAGIC_F1 5 %define %%regF %1 %define %%regB %2 %define %%regC %3 %define %%regD %4 %define %%regT %5 movdqa %%regF,%%regD pxor %%regF,%%regC pxor %%regF,%%regB %endmacro ; macro MAGIC_F2 F,B,C,D,T ;; F = ((B & C) | (B & D) | (C & D)) %macro MAGIC_F2 5 %define %%regF %1 %define %%regB %2 %define %%regC %3 %define %%regD %4 %define %%regT %5 movdqa %%regF,%%regB movdqa %%regT,%%regB por %%regF,%%regC pand %%regT,%%regC pand %%regF,%%regD por %%regF,%%regT %endmacro ; macro MAGIC_F3 F,B,C,D,T ;; F = (B ^ C ^ D) %macro MAGIC_F3 5 %define %%regF %1 %define %%regB %2 %define %%regC %3 %define %%regD %4 %define %%regT %5 MAGIC_F1 %%regF,%%regB,%%regC,%%regD,%%regT %endmacro ; PROLD reg, imm, tmp %macro PROLD 3 %define %%reg %1 %define %%imm %2 %define %%tmp %3 movdqa %%tmp, %%reg pslld %%reg, %%imm psrld %%tmp, (32-%%imm) por %%reg, %%tmp %endmacro %macro SHA1_STEP_00_15 11 %define %%regA %1 %define %%regB %2 %define %%regC %3 %define %%regD %4 %define %%regE %5 %define %%regT %6 %define %%regF %7 %define %%memW %8 %define %%immCNT %9 %define %%MAGIC %10 %define %%data %11 paddd %%regE,%%immCNT paddd %%regE,[%%data + (%%memW * 16)] movdqa %%regT,%%regA PROLD %%regT,5, %%regF paddd %%regE,%%regT %%MAGIC %%regF,%%regB,%%regC,%%regD,%%regT ;; FUN = MAGIC_Fi(B,C,D) PROLD %%regB,30, %%regT paddd %%regE,%%regF %endmacro %macro SHA1_STEP_16_79 11 %define %%regA %1 %define %%regB %2 %define %%regC %3 %define %%regD %4 %define %%regE %5 %define %%regT %6 %define %%regF %7 %define %%memW %8 %define %%immCNT %9 %define %%MAGIC %10 %define %%data %11 paddd %%regE,%%immCNT movdqa W14, [%%data + ((%%memW - 14) & 15) * 16] pxor W16, W14 pxor W16, [%%data + ((%%memW - 8) & 15) * 16] pxor W16, [%%data + ((%%memW - 3) & 15) * 16] movdqa %%regF, W16 pslld W16, 1 psrld %%regF, (32-1) por %%regF, W16 ROTATE_W movdqa [%%data + ((%%memW - 0) & 15) * 16],%%regF paddd %%regE,%%regF movdqa %%regT,%%regA PROLD %%regT,5, %%regF paddd %%regE,%%regT %%MAGIC %%regF,%%regB,%%regC,%%regD,%%regT ;; FUN = MAGIC_Fi(B,C,D) PROLD %%regB,30, %%regT paddd %%regE,%%regF %endmacro ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; %ifidn __OUTPUT_FORMAT__, elf64 ; Linux %define arg0 rdi %define arg1 rsi %define arg2 rdx %define arg3 rcx %define arg4 r8 %define arg5 r9 %define tmp1 r10 %define tmp2 r11 %define tmp3 r12 ; must be saved and restored %define tmp4 r13 ; must be saved and restored %define tmp5 r14 ; must be saved and restored %define tmp6 r15 ; must be saved and restored %define return rax %define func(x) x: %macro FUNC_SAVE 0 push r12 push r13 push r14 push r15 %endmacro %macro FUNC_RESTORE 0 pop r15 pop r14 pop r13 pop r12 %endmacro %else ; Windows %define arg0 rcx %define arg1 rdx %define arg2 r8 %define arg3 r9 %define arg4 r10 %define arg5 r11 %define tmp1 r12 ; must be saved and restored %define tmp2 r13 ; must be saved and restored %define tmp3 r14 ; must be saved and restored %define tmp4 r15 ; must be saved and restored %define tmp5 rdi ; must be saved and restored %define tmp6 rsi ; must be saved and restored %define return rax %define stack_size 10*16 + 7*8 ; must be an odd multiple of 8 %define func(x) proc_frame x %macro FUNC_SAVE 0 alloc_stack stack_size save_xmm128 xmm6, 0*16 save_xmm128 xmm7, 1*16 save_xmm128 xmm8, 2*16 save_xmm128 xmm9, 3*16 save_xmm128 xmm10, 4*16 save_xmm128 xmm11, 5*16 save_xmm128 xmm12, 6*16 save_xmm128 xmm13, 7*16 save_xmm128 xmm14, 8*16 save_xmm128 xmm15, 9*16 save_reg r12, 10*16 + 0*8 save_reg r13, 10*16 + 1*8 save_reg r14, 10*16 + 2*8 save_reg r15, 10*16 + 3*8 save_reg rdi, 10*16 + 4*8 save_reg rsi, 10*16 + 5*8 end_prolog %endmacro %macro FUNC_RESTORE 0 movdqa xmm6, [rsp + 0*16] movdqa xmm7, [rsp + 1*16] movdqa xmm8, [rsp + 2*16] movdqa xmm9, [rsp + 3*16] movdqa xmm10, [rsp + 4*16] movdqa xmm11, [rsp + 5*16] movdqa xmm12, [rsp + 6*16] movdqa xmm13, [rsp + 7*16] movdqa xmm14, [rsp + 8*16] movdqa xmm15, [rsp + 9*16] mov r12, [rsp + 10*16 + 0*8] mov r13, [rsp + 10*16 + 1*8] mov r14, [rsp + 10*16 + 2*8] mov r15, [rsp + 10*16 + 3*8] mov rdi, [rsp + 10*16 + 4*8] mov rsi, [rsp + 10*16 + 5*8] add rsp, stack_size %endmacro %endif ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; %define loops arg3 ;variables of mh_sha1 %define mh_in_p arg0 %define mh_digests_p arg1 %define mh_data_p arg2 %define mh_segs tmp1 ;variables used by storing segs_digests on stack %define RSP_SAVE tmp2 %define FRAMESZ 4*5*16 ;BYTES*DWORDS*SEGS %define pref tmp3 %macro PREFETCH_X 1 %define %%mem %1 prefetchnta %%mem %endmacro ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; %define MOVPS movups %define A xmm0 %define B xmm1 %define C xmm2 %define D xmm3 %define E xmm4 %define F xmm5 ; tmp %define G xmm6 ; tmp %define TMP G %define FUN F %define K xmm7 %define AA xmm8 %define BB xmm9 %define CC xmm10 %define DD xmm11 %define EE xmm12 %define T0 xmm6 %define T1 xmm7 %define T2 xmm8 %define T3 xmm9 %define T4 xmm10 %define T5 xmm11 %macro ROTATE_ARGS 0 %xdefine TMP_ E %xdefine E D %xdefine D C %xdefine C B %xdefine B A %xdefine A TMP_ %endm %define W14 xmm13 %define W15 xmm14 %define W16 xmm15 %macro ROTATE_W 0 %xdefine TMP_ W16 %xdefine W16 W15 %xdefine W15 W14 %xdefine W14 TMP_ %endm ;init hash digests ; segs_digests:low addr-> high_addr ; a | b | c | ...| p | (16) ; h0 | h0 | h0 | ...| h0 | | Aa| Ab | Ac |...| Ap | ; h1 | h1 | h1 | ...| h1 | | Ba| Bb | Bc |...| Bp | ; .... ; h4 | h4 | h4 | ...| h4 | | Ea| Eb | Ec |...| Ep | align 32 ;void mh_sha1_block_sse(const uint8_t * input_data, uint32_t digests[SHA1_DIGEST_WORDS][HASH_SEGS], ; uint8_t frame_buffer[MH_SHA1_BLOCK_SIZE], uint32_t num_blocks); ; arg 0 pointer to input data ; arg 1 pointer to digests, include segments digests(uint32_t digests[16][5]) ; arg 2 pointer to aligned_frame_buffer which is used to save the big_endian data. ; arg 3 number of 1KB blocks ; global mh_sha1_block_sse:function internal func(mh_sha1_block_sse) FUNC_SAVE ; save rsp mov RSP_SAVE, rsp cmp loops, 0 jle .return ; leave enough space to store segs_digests sub rsp, FRAMESZ ; align rsp to 16 Bytes needed by sse and rsp, ~0x0F %assign I 0 ; copy segs_digests into stack %rep 5 MOVPS A, [mh_digests_p + I*64 + 16*0] MOVPS B, [mh_digests_p + I*64 + 16*1] MOVPS C, [mh_digests_p + I*64 + 16*2] MOVPS D, [mh_digests_p + I*64 + 16*3] movdqa [rsp + I*64 + 16*0], A movdqa [rsp + I*64 + 16*1], B movdqa [rsp + I*64 + 16*2], C movdqa [rsp + I*64 + 16*3], D %assign I (I+1) %endrep .block_loop: ;transform to big-endian data and store on aligned_frame movdqa F, [PSHUFFLE_BYTE_FLIP_MASK] ;transform input data from DWORD*16_SEGS*5 to DWORD*4_SEGS*5*4 %assign I 0 %rep 16 MOVPS T0,[mh_in_p + I*64+0*16] MOVPS T1,[mh_in_p + I*64+1*16] MOVPS T2,[mh_in_p + I*64+2*16] MOVPS T3,[mh_in_p + I*64+3*16] pshufb T0, F movdqa [mh_data_p +(I)*16 +0*256],T0 pshufb T1, F movdqa [mh_data_p +(I)*16 +1*256],T1 pshufb T2, F movdqa [mh_data_p +(I)*16 +2*256],T2 pshufb T3, F movdqa [mh_data_p +(I)*16 +3*256],T3 %assign I (I+1) %endrep mov mh_segs, 0 ;start from the first 4 segments mov pref, 1024 ;avoid prefetch repeadtedly .segs_loop: ;; Initialize digests movdqa A, [rsp + 0*64 + mh_segs] movdqa B, [rsp + 1*64 + mh_segs] movdqa C, [rsp + 2*64 + mh_segs] movdqa D, [rsp + 3*64 + mh_segs] movdqa E, [rsp + 4*64 + mh_segs] movdqa AA, A movdqa BB, B movdqa CC, C movdqa DD, D movdqa EE, E ;; ;; perform 0-79 steps ;; movdqa K, [K00_19] ;; do rounds 0...15 %assign I 0 %rep 16 SHA1_STEP_00_15 A,B,C,D,E, TMP,FUN, I, K, MAGIC_F0, mh_data_p ROTATE_ARGS %assign I (I+1) %endrep ;; do rounds 16...19 movdqa W16, [mh_data_p + ((16 - 16) & 15) * 16] movdqa W15, [mh_data_p + ((16 - 15) & 15) * 16] %rep 4 SHA1_STEP_16_79 A,B,C,D,E, TMP,FUN, I, K, MAGIC_F0, mh_data_p ROTATE_ARGS %assign I (I+1) %endrep PREFETCH_X [mh_in_p + pref+128*0] ;; do rounds 20...39 movdqa K, [K20_39] %rep 20 SHA1_STEP_16_79 A,B,C,D,E, TMP,FUN, I, K, MAGIC_F1, mh_data_p ROTATE_ARGS %assign I (I+1) %endrep ;; do rounds 40...59 movdqa K, [K40_59] %rep 20 SHA1_STEP_16_79 A,B,C,D,E, TMP,FUN, I, K, MAGIC_F2, mh_data_p ROTATE_ARGS %assign I (I+1) %endrep PREFETCH_X [mh_in_p + pref+128*1] ;; do rounds 60...79 movdqa K, [K60_79] %rep 20 SHA1_STEP_16_79 A,B,C,D,E, TMP,FUN, I, K, MAGIC_F3, mh_data_p ROTATE_ARGS %assign I (I+1) %endrep paddd A, AA paddd B, BB paddd C, CC paddd D, DD paddd E, EE ; write out digests movdqa [rsp + 0*64 + mh_segs], A movdqa [rsp + 1*64 + mh_segs], B movdqa [rsp + 2*64 + mh_segs], C movdqa [rsp + 3*64 + mh_segs], D movdqa [rsp + 4*64 + mh_segs], E add pref, 256 add mh_data_p, 256 add mh_segs, 16 cmp mh_segs, 64 jc .segs_loop sub mh_data_p, (1024) add mh_in_p, (1024) sub loops, 1 jne .block_loop %assign I 0 ; copy segs_digests back to mh_digests_p %rep 5 movdqa A, [rsp + I*64 + 16*0] movdqa B, [rsp + I*64 + 16*1] movdqa C, [rsp + I*64 + 16*2] movdqa D, [rsp + I*64 + 16*3] MOVPS [mh_digests_p + I*64 + 16*0], A MOVPS [mh_digests_p + I*64 + 16*1], B MOVPS [mh_digests_p + I*64 + 16*2], C MOVPS [mh_digests_p + I*64 + 16*3], D %assign I (I+1) %endrep mov rsp, RSP_SAVE ; restore rsp .return: FUNC_RESTORE ret endproc_frame section .data align=16 align 16 PSHUFFLE_BYTE_FLIP_MASK: dq 0x0405060700010203, 0x0c0d0e0f08090a0b K00_19: dq 0x5A8279995A827999, 0x5A8279995A827999 K20_39: dq 0x6ED9EBA16ED9EBA1, 0x6ED9EBA16ED9EBA1 K40_59: dq 0x8F1BBCDC8F1BBCDC, 0x8F1BBCDC8F1BBCDC K60_79: dq 0xCA62C1D6CA62C1D6, 0xCA62C1D6CA62C1D6
.global s_prepare_buffers s_prepare_buffers: push %r14 push %r8 push %r9 push %rax push %rcx push %rdi push %rsi lea addresses_normal_ht+0xff81, %rsi lea addresses_WC_ht+0x8e49, %rdi clflush (%rsi) clflush (%rdi) add %r14, %r14 mov $64, %rcx rep movsb nop nop nop nop cmp %r9, %r9 lea addresses_WC_ht+0x1c141, %rsi lea addresses_UC_ht+0x192c9, %rdi sub %r14, %r14 mov $12, %rcx rep movsq nop nop xor $41016, %rcx lea addresses_normal_ht+0x1eac9, %r8 nop nop add $58402, %rax mov (%r8), %si nop and $105, %rax lea addresses_WC_ht+0xd549, %r14 nop nop nop nop nop dec %rsi mov (%r14), %di dec %rax lea addresses_WC_ht+0xc7fd, %rdi nop and %rax, %rax mov $0x6162636465666768, %r9 movq %r9, %xmm2 movups %xmm2, (%rdi) nop sub $62727, %r8 lea addresses_UC_ht+0x5899, %r9 and %r8, %r8 movups (%r9), %xmm1 vpextrq $1, %xmm1, %rdi nop nop and $9030, %rsi pop %rsi pop %rdi pop %rcx pop %rax pop %r9 pop %r8 pop %r14 ret .global s_faulty_load s_faulty_load: push %r10 push %r11 push %r8 push %rax push %rbp push %rcx push %rdx // Store lea addresses_WC+0xb3c9, %r8 nop nop nop and $57262, %rcx movw $0x5152, (%r8) nop nop nop cmp $58463, %rax // Store mov $0x6b9, %rcx nop xor $59193, %r11 mov $0x5152535455565758, %rdx movq %rdx, (%rcx) nop xor %r10, %r10 // Store lea addresses_WC+0xa5b9, %r11 and %rax, %rax mov $0x5152535455565758, %r8 movq %r8, %xmm1 movups %xmm1, (%r11) nop cmp %rbp, %rbp // Store mov $0x919, %r11 nop nop nop nop xor $2455, %rbp movw $0x5152, (%r11) nop xor $63692, %rcx // Faulty Load mov $0x28e5c20000000bc9, %r10 nop and %r8, %r8 mov (%r10), %edx lea oracles, %rax and $0xff, %rdx shlq $12, %rdx mov (%rax,%rdx,1), %rdx pop %rdx pop %rcx pop %rbp pop %rax pop %r8 pop %r11 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_NC', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 0}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WC', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 11}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_P', 'NT': True, 'AVXalign': False, 'size': 8, 'congruent': 4}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WC', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 4}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_P', 'NT': True, 'AVXalign': False, 'size': 2, 'congruent': 4}} [Faulty Load] {'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_NC', 'NT': False, 'AVXalign': True, 'size': 4, 'congruent': 0}} <gen_prepare_buffer> {'OP': 'REPM', 'src': {'same': False, 'congruent': 2, 'type': 'addresses_normal_ht'}, 'dst': {'same': False, 'congruent': 6, 'type': 'addresses_WC_ht'}} {'OP': 'REPM', 'src': {'same': False, 'congruent': 2, 'type': 'addresses_WC_ht'}, 'dst': {'same': False, 'congruent': 8, 'type': 'addresses_UC_ht'}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_normal_ht', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 8}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WC_ht', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 6}} {'OP': 'STOR', 'dst': {'same': True, 'type': 'addresses_WC_ht', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 2}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_UC_ht', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 4}} {'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 */
; These routines manage gradual fading ; (e.g., entering a doorway) LoadGBPal:: ld a, [wMapPalOffset] ;tells if wCurMap is dark (requires HM5_FLASH?) ld b, a ld hl, FadePal4 ld a, l sub b ld l, a jr nc, .ok dec h .ok ld a, [hli] ld [rBGP], a ld a, [hli] ld [rOBP0], a ld a, [hli] ld [rOBP1], a ret GBFadeInFromBlack:: ld hl, FadePal1 ld b, 4 jr GBFadeIncCommon GBFadeOutToWhite:: ld hl, FadePal6 ld b, 3 GBFadeIncCommon: ld a, [hli] ld [rBGP], a ld a, [hli] ld [rOBP0], a ld a, [hli] ld [rOBP1], a ld c, 8 call DelayFrames dec b jr nz, GBFadeIncCommon ret GBFadeOutToBlack:: ld hl, FadePal4 + 2 ld b, 4 jr GBFadeDecCommon GBFadeInFromWhite:: ld hl, FadePal7 + 2 ld b, 3 GBFadeDecCommon: ld a, [hld] ld [rOBP1], a ld a, [hld] ld [rOBP0], a ld a, [hld] ld [rBGP], a ld c, 8 call DelayFrames dec b jr nz, GBFadeDecCommon ret FadePal1:: db %11111111, %11111111, %11111111 FadePal2:: db %11111110, %11111110, %11111000 FadePal3:: db %11111001, %11100100, %11100100 FadePal4:: db %11100100, %11010000, %11100000 ; rBGP rOBP0 rOBP1 FadePal5:: db %11100100, %11010000, %11100000 FadePal6:: db %10010000, %10000000, %10010000 FadePal7:: db %01000000, %01000000, %01000000 FadePal8:: db %00000000, %00000000, %00000000
_sh: file format elf32-i386 Disassembly of section .text: 00001000 <main>: return 0; } int main(void) { 1000: 55 push %ebp 1001: 89 e5 mov %esp,%ebp 1003: 83 e4 f0 and $0xfffffff0,%esp 1006: 83 ec 10 sub $0x10,%esp static char buf[100]; int fd; // Ensure that three file descriptors are open. while((fd = open("console", O_RDWR)) >= 0){ 1009: eb 0e jmp 1019 <main+0x19> 100b: 90 nop 100c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi if(fd >= 3){ 1010: 83 f8 02 cmp $0x2,%eax 1013: 0f 8f cd 00 00 00 jg 10e6 <main+0xe6> while((fd = open("console", O_RDWR)) >= 0){ 1019: c7 44 24 04 02 00 00 movl $0x2,0x4(%esp) 1020: 00 1021: c7 04 24 85 23 00 00 movl $0x2385,(%esp) 1028: e8 f5 0d 00 00 call 1e22 <open> 102d: 85 c0 test %eax,%eax 102f: 79 df jns 1010 <main+0x10> 1031: eb 23 jmp 1056 <main+0x56> 1033: 90 nop 1034: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi } } // Read and run input commands. while(getcmd(buf, sizeof(buf)) >= 0){ if(buf[0] == 'c' && buf[1] == 'd' && buf[2] == ' '){ 1038: 80 3d c2 29 00 00 20 cmpb $0x20,0x29c2 103f: 90 nop 1040: 74 60 je 10a2 <main+0xa2> 1042: 8d b6 00 00 00 00 lea 0x0(%esi),%esi buf[strlen(buf)-1] = 0; // chop \n if(chdir(buf+3) < 0) printf(2, "cannot cd %s\n", buf+3); continue; } if(fork1() == 0) 1048: e8 43 01 00 00 call 1190 <fork1> 104d: 85 c0 test %eax,%eax 104f: 74 38 je 1089 <main+0x89> runcmd(parsecmd(buf)); wait(); 1051: e8 94 0d 00 00 call 1dea <wait> while(getcmd(buf, sizeof(buf)) >= 0){ 1056: c7 44 24 04 64 00 00 movl $0x64,0x4(%esp) 105d: 00 105e: c7 04 24 c0 29 00 00 movl $0x29c0,(%esp) 1065: e8 96 00 00 00 call 1100 <getcmd> 106a: 85 c0 test %eax,%eax 106c: 78 2f js 109d <main+0x9d> if(buf[0] == 'c' && buf[1] == 'd' && buf[2] == ' '){ 106e: 80 3d c0 29 00 00 63 cmpb $0x63,0x29c0 1075: 75 d1 jne 1048 <main+0x48> 1077: 80 3d c1 29 00 00 64 cmpb $0x64,0x29c1 107e: 74 b8 je 1038 <main+0x38> if(fork1() == 0) 1080: e8 0b 01 00 00 call 1190 <fork1> 1085: 85 c0 test %eax,%eax 1087: 75 c8 jne 1051 <main+0x51> runcmd(parsecmd(buf)); 1089: c7 04 24 c0 29 00 00 movl $0x29c0,(%esp) 1090: e8 ab 0a 00 00 call 1b40 <parsecmd> 1095: 89 04 24 mov %eax,(%esp) 1098: e8 13 01 00 00 call 11b0 <runcmd> } exit(); 109d: e8 40 0d 00 00 call 1de2 <exit> buf[strlen(buf)-1] = 0; // chop \n 10a2: c7 04 24 c0 29 00 00 movl $0x29c0,(%esp) 10a9: e8 92 0b 00 00 call 1c40 <strlen> if(chdir(buf+3) < 0) 10ae: c7 04 24 c3 29 00 00 movl $0x29c3,(%esp) buf[strlen(buf)-1] = 0; // chop \n 10b5: c6 80 bf 29 00 00 00 movb $0x0,0x29bf(%eax) if(chdir(buf+3) < 0) 10bc: e8 91 0d 00 00 call 1e52 <chdir> 10c1: 85 c0 test %eax,%eax 10c3: 79 91 jns 1056 <main+0x56> printf(2, "cannot cd %s\n", buf+3); 10c5: c7 44 24 08 c3 29 00 movl $0x29c3,0x8(%esp) 10cc: 00 10cd: c7 44 24 04 8d 23 00 movl $0x238d,0x4(%esp) 10d4: 00 10d5: c7 04 24 02 00 00 00 movl $0x2,(%esp) 10dc: e8 5f 0e 00 00 call 1f40 <printf> 10e1: e9 70 ff ff ff jmp 1056 <main+0x56> close(fd); 10e6: 89 04 24 mov %eax,(%esp) 10e9: e8 1c 0d 00 00 call 1e0a <close> 10ee: 66 90 xchg %ax,%ax break; 10f0: e9 61 ff ff ff jmp 1056 <main+0x56> 10f5: 66 90 xchg %ax,%ax 10f7: 66 90 xchg %ax,%ax 10f9: 66 90 xchg %ax,%ax 10fb: 66 90 xchg %ax,%ax 10fd: 66 90 xchg %ax,%ax 10ff: 90 nop 00001100 <getcmd>: { 1100: 55 push %ebp 1101: 89 e5 mov %esp,%ebp 1103: 56 push %esi 1104: 53 push %ebx 1105: 83 ec 10 sub $0x10,%esp 1108: 8b 5d 08 mov 0x8(%ebp),%ebx 110b: 8b 75 0c mov 0xc(%ebp),%esi printf(2, "$ "); 110e: c7 44 24 04 e4 22 00 movl $0x22e4,0x4(%esp) 1115: 00 1116: c7 04 24 02 00 00 00 movl $0x2,(%esp) 111d: e8 1e 0e 00 00 call 1f40 <printf> memset(buf, 0, nbuf); 1122: 89 74 24 08 mov %esi,0x8(%esp) 1126: 89 1c 24 mov %ebx,(%esp) 1129: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) 1130: 00 1131: e8 3a 0b 00 00 call 1c70 <memset> gets(buf, nbuf); 1136: 89 74 24 04 mov %esi,0x4(%esp) 113a: 89 1c 24 mov %ebx,(%esp) 113d: e8 8e 0b 00 00 call 1cd0 <gets> if(buf[0] == 0) // EOF 1142: 31 c0 xor %eax,%eax 1144: 80 3b 00 cmpb $0x0,(%ebx) 1147: 0f 94 c0 sete %al } 114a: 83 c4 10 add $0x10,%esp 114d: 5b pop %ebx if(buf[0] == 0) // EOF 114e: f7 d8 neg %eax } 1150: 5e pop %esi 1151: 5d pop %ebp 1152: c3 ret 1153: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 1159: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00001160 <panic>: } void panic(char *s) { 1160: 55 push %ebp 1161: 89 e5 mov %esp,%ebp 1163: 83 ec 18 sub $0x18,%esp printf(2, "%s\n", s); 1166: 8b 45 08 mov 0x8(%ebp),%eax 1169: c7 44 24 04 81 23 00 movl $0x2381,0x4(%esp) 1170: 00 1171: c7 04 24 02 00 00 00 movl $0x2,(%esp) 1178: 89 44 24 08 mov %eax,0x8(%esp) 117c: e8 bf 0d 00 00 call 1f40 <printf> exit(); 1181: e8 5c 0c 00 00 call 1de2 <exit> 1186: 8d 76 00 lea 0x0(%esi),%esi 1189: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00001190 <fork1>: } int fork1(void) { 1190: 55 push %ebp 1191: 89 e5 mov %esp,%ebp 1193: 83 ec 18 sub $0x18,%esp int pid; pid = fork(); 1196: e8 3f 0c 00 00 call 1dda <fork> if(pid == -1) 119b: 83 f8 ff cmp $0xffffffff,%eax 119e: 74 02 je 11a2 <fork1+0x12> panic("fork"); return pid; } 11a0: c9 leave 11a1: c3 ret panic("fork"); 11a2: c7 04 24 e7 22 00 00 movl $0x22e7,(%esp) 11a9: e8 b2 ff ff ff call 1160 <panic> 11ae: 66 90 xchg %ax,%ax 000011b0 <runcmd>: { 11b0: 55 push %ebp 11b1: 89 e5 mov %esp,%ebp 11b3: 53 push %ebx 11b4: 83 ec 24 sub $0x24,%esp 11b7: 8b 5d 08 mov 0x8(%ebp),%ebx if(cmd == 0) 11ba: 85 db test %ebx,%ebx 11bc: 74 5f je 121d <runcmd+0x6d> switch(cmd->type){ 11be: 83 3b 05 cmpl $0x5,(%ebx) 11c1: 0f 87 e7 00 00 00 ja 12ae <runcmd+0xfe> 11c7: 8b 03 mov (%ebx),%eax 11c9: ff 24 85 9c 23 00 00 jmp *0x239c(,%eax,4) if(pipe(p) < 0) 11d0: 8d 45 f0 lea -0x10(%ebp),%eax 11d3: 89 04 24 mov %eax,(%esp) 11d6: e8 17 0c 00 00 call 1df2 <pipe> 11db: 85 c0 test %eax,%eax 11dd: 0f 88 d7 00 00 00 js 12ba <runcmd+0x10a> if(fork1() == 0){ 11e3: e8 a8 ff ff ff call 1190 <fork1> 11e8: 85 c0 test %eax,%eax 11ea: 0f 84 2e 01 00 00 je 131e <runcmd+0x16e> if(fork1() == 0){ 11f0: e8 9b ff ff ff call 1190 <fork1> 11f5: 85 c0 test %eax,%eax 11f7: 0f 84 e9 00 00 00 je 12e6 <runcmd+0x136> close(p[0]); 11fd: 8b 45 f0 mov -0x10(%ebp),%eax 1200: 89 04 24 mov %eax,(%esp) 1203: e8 02 0c 00 00 call 1e0a <close> close(p[1]); 1208: 8b 45 f4 mov -0xc(%ebp),%eax 120b: 89 04 24 mov %eax,(%esp) 120e: e8 f7 0b 00 00 call 1e0a <close> wait(); 1213: e8 d2 0b 00 00 call 1dea <wait> wait(); 1218: e8 cd 0b 00 00 call 1dea <wait> 121d: 8d 76 00 lea 0x0(%esi),%esi exit(); 1220: e8 bd 0b 00 00 call 1de2 <exit> if(fork1() == 0) 1225: e8 66 ff ff ff call 1190 <fork1> 122a: 85 c0 test %eax,%eax 122c: 75 ef jne 121d <runcmd+0x6d> 122e: 66 90 xchg %ax,%ax 1230: eb 71 jmp 12a3 <runcmd+0xf3> if(ecmd->argv[0] == 0) 1232: 8b 43 04 mov 0x4(%ebx),%eax 1235: 85 c0 test %eax,%eax 1237: 74 e4 je 121d <runcmd+0x6d> exec(ecmd->argv[0], ecmd->argv); 1239: 8d 53 04 lea 0x4(%ebx),%edx 123c: 89 54 24 04 mov %edx,0x4(%esp) 1240: 89 04 24 mov %eax,(%esp) 1243: e8 d2 0b 00 00 call 1e1a <exec> printf(2, "exec %s failed\n", ecmd->argv[0]); 1248: 8b 43 04 mov 0x4(%ebx),%eax 124b: c7 44 24 04 f3 22 00 movl $0x22f3,0x4(%esp) 1252: 00 1253: c7 04 24 02 00 00 00 movl $0x2,(%esp) 125a: 89 44 24 08 mov %eax,0x8(%esp) 125e: e8 dd 0c 00 00 call 1f40 <printf> break; 1263: eb b8 jmp 121d <runcmd+0x6d> if(fork1() == 0) 1265: e8 26 ff ff ff call 1190 <fork1> 126a: 85 c0 test %eax,%eax 126c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 1270: 74 31 je 12a3 <runcmd+0xf3> wait(); 1272: e8 73 0b 00 00 call 1dea <wait> runcmd(lcmd->right); 1277: 8b 43 08 mov 0x8(%ebx),%eax 127a: 89 04 24 mov %eax,(%esp) 127d: e8 2e ff ff ff call 11b0 <runcmd> close(rcmd->fd); 1282: 8b 43 14 mov 0x14(%ebx),%eax 1285: 89 04 24 mov %eax,(%esp) 1288: e8 7d 0b 00 00 call 1e0a <close> if(open(rcmd->file, rcmd->mode) < 0){ 128d: 8b 43 10 mov 0x10(%ebx),%eax 1290: 89 44 24 04 mov %eax,0x4(%esp) 1294: 8b 43 08 mov 0x8(%ebx),%eax 1297: 89 04 24 mov %eax,(%esp) 129a: e8 83 0b 00 00 call 1e22 <open> 129f: 85 c0 test %eax,%eax 12a1: 78 23 js 12c6 <runcmd+0x116> runcmd(bcmd->cmd); 12a3: 8b 43 04 mov 0x4(%ebx),%eax 12a6: 89 04 24 mov %eax,(%esp) 12a9: e8 02 ff ff ff call 11b0 <runcmd> panic("runcmd"); 12ae: c7 04 24 ec 22 00 00 movl $0x22ec,(%esp) 12b5: e8 a6 fe ff ff call 1160 <panic> panic("pipe"); 12ba: c7 04 24 13 23 00 00 movl $0x2313,(%esp) 12c1: e8 9a fe ff ff call 1160 <panic> printf(2, "open %s failed\n", rcmd->file); 12c6: 8b 43 08 mov 0x8(%ebx),%eax 12c9: c7 44 24 04 03 23 00 movl $0x2303,0x4(%esp) 12d0: 00 12d1: c7 04 24 02 00 00 00 movl $0x2,(%esp) 12d8: 89 44 24 08 mov %eax,0x8(%esp) 12dc: e8 5f 0c 00 00 call 1f40 <printf> 12e1: e9 37 ff ff ff jmp 121d <runcmd+0x6d> close(0); 12e6: c7 04 24 00 00 00 00 movl $0x0,(%esp) 12ed: e8 18 0b 00 00 call 1e0a <close> dup(p[0]); 12f2: 8b 45 f0 mov -0x10(%ebp),%eax 12f5: 89 04 24 mov %eax,(%esp) 12f8: e8 5d 0b 00 00 call 1e5a <dup> close(p[0]); 12fd: 8b 45 f0 mov -0x10(%ebp),%eax 1300: 89 04 24 mov %eax,(%esp) 1303: e8 02 0b 00 00 call 1e0a <close> close(p[1]); 1308: 8b 45 f4 mov -0xc(%ebp),%eax 130b: 89 04 24 mov %eax,(%esp) 130e: e8 f7 0a 00 00 call 1e0a <close> runcmd(pcmd->right); 1313: 8b 43 08 mov 0x8(%ebx),%eax 1316: 89 04 24 mov %eax,(%esp) 1319: e8 92 fe ff ff call 11b0 <runcmd> close(1); 131e: c7 04 24 01 00 00 00 movl $0x1,(%esp) 1325: e8 e0 0a 00 00 call 1e0a <close> dup(p[1]); 132a: 8b 45 f4 mov -0xc(%ebp),%eax 132d: 89 04 24 mov %eax,(%esp) 1330: e8 25 0b 00 00 call 1e5a <dup> close(p[0]); 1335: 8b 45 f0 mov -0x10(%ebp),%eax 1338: 89 04 24 mov %eax,(%esp) 133b: e8 ca 0a 00 00 call 1e0a <close> close(p[1]); 1340: 8b 45 f4 mov -0xc(%ebp),%eax 1343: 89 04 24 mov %eax,(%esp) 1346: e8 bf 0a 00 00 call 1e0a <close> runcmd(pcmd->left); 134b: 8b 43 04 mov 0x4(%ebx),%eax 134e: 89 04 24 mov %eax,(%esp) 1351: e8 5a fe ff ff call 11b0 <runcmd> 1356: 8d 76 00 lea 0x0(%esi),%esi 1359: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00001360 <execcmd>: //PAGEBREAK! // Constructors struct cmd* execcmd(void) { 1360: 55 push %ebp 1361: 89 e5 mov %esp,%ebp 1363: 53 push %ebx 1364: 83 ec 14 sub $0x14,%esp struct execcmd *cmd; cmd = malloc(sizeof(*cmd)); 1367: c7 04 24 54 00 00 00 movl $0x54,(%esp) 136e: e8 4d 0e 00 00 call 21c0 <malloc> memset(cmd, 0, sizeof(*cmd)); 1373: c7 44 24 08 54 00 00 movl $0x54,0x8(%esp) 137a: 00 137b: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) 1382: 00 cmd = malloc(sizeof(*cmd)); 1383: 89 c3 mov %eax,%ebx memset(cmd, 0, sizeof(*cmd)); 1385: 89 04 24 mov %eax,(%esp) 1388: e8 e3 08 00 00 call 1c70 <memset> cmd->type = EXEC; return (struct cmd*)cmd; } 138d: 89 d8 mov %ebx,%eax cmd->type = EXEC; 138f: c7 03 01 00 00 00 movl $0x1,(%ebx) } 1395: 83 c4 14 add $0x14,%esp 1398: 5b pop %ebx 1399: 5d pop %ebp 139a: c3 ret 139b: 90 nop 139c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 000013a0 <redircmd>: struct cmd* redircmd(struct cmd *subcmd, char *file, char *efile, int mode, int fd) { 13a0: 55 push %ebp 13a1: 89 e5 mov %esp,%ebp 13a3: 53 push %ebx 13a4: 83 ec 14 sub $0x14,%esp struct redircmd *cmd; cmd = malloc(sizeof(*cmd)); 13a7: c7 04 24 18 00 00 00 movl $0x18,(%esp) 13ae: e8 0d 0e 00 00 call 21c0 <malloc> memset(cmd, 0, sizeof(*cmd)); 13b3: c7 44 24 08 18 00 00 movl $0x18,0x8(%esp) 13ba: 00 13bb: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) 13c2: 00 13c3: 89 04 24 mov %eax,(%esp) cmd = malloc(sizeof(*cmd)); 13c6: 89 c3 mov %eax,%ebx memset(cmd, 0, sizeof(*cmd)); 13c8: e8 a3 08 00 00 call 1c70 <memset> cmd->type = REDIR; cmd->cmd = subcmd; 13cd: 8b 45 08 mov 0x8(%ebp),%eax cmd->type = REDIR; 13d0: c7 03 02 00 00 00 movl $0x2,(%ebx) cmd->cmd = subcmd; 13d6: 89 43 04 mov %eax,0x4(%ebx) cmd->file = file; 13d9: 8b 45 0c mov 0xc(%ebp),%eax 13dc: 89 43 08 mov %eax,0x8(%ebx) cmd->efile = efile; 13df: 8b 45 10 mov 0x10(%ebp),%eax 13e2: 89 43 0c mov %eax,0xc(%ebx) cmd->mode = mode; 13e5: 8b 45 14 mov 0x14(%ebp),%eax 13e8: 89 43 10 mov %eax,0x10(%ebx) cmd->fd = fd; 13eb: 8b 45 18 mov 0x18(%ebp),%eax 13ee: 89 43 14 mov %eax,0x14(%ebx) return (struct cmd*)cmd; } 13f1: 83 c4 14 add $0x14,%esp 13f4: 89 d8 mov %ebx,%eax 13f6: 5b pop %ebx 13f7: 5d pop %ebp 13f8: c3 ret 13f9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 00001400 <pipecmd>: struct cmd* pipecmd(struct cmd *left, struct cmd *right) { 1400: 55 push %ebp 1401: 89 e5 mov %esp,%ebp 1403: 53 push %ebx 1404: 83 ec 14 sub $0x14,%esp struct pipecmd *cmd; cmd = malloc(sizeof(*cmd)); 1407: c7 04 24 0c 00 00 00 movl $0xc,(%esp) 140e: e8 ad 0d 00 00 call 21c0 <malloc> memset(cmd, 0, sizeof(*cmd)); 1413: c7 44 24 08 0c 00 00 movl $0xc,0x8(%esp) 141a: 00 141b: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) 1422: 00 1423: 89 04 24 mov %eax,(%esp) cmd = malloc(sizeof(*cmd)); 1426: 89 c3 mov %eax,%ebx memset(cmd, 0, sizeof(*cmd)); 1428: e8 43 08 00 00 call 1c70 <memset> cmd->type = PIPE; cmd->left = left; 142d: 8b 45 08 mov 0x8(%ebp),%eax cmd->type = PIPE; 1430: c7 03 03 00 00 00 movl $0x3,(%ebx) cmd->left = left; 1436: 89 43 04 mov %eax,0x4(%ebx) cmd->right = right; 1439: 8b 45 0c mov 0xc(%ebp),%eax 143c: 89 43 08 mov %eax,0x8(%ebx) return (struct cmd*)cmd; } 143f: 83 c4 14 add $0x14,%esp 1442: 89 d8 mov %ebx,%eax 1444: 5b pop %ebx 1445: 5d pop %ebp 1446: c3 ret 1447: 89 f6 mov %esi,%esi 1449: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00001450 <listcmd>: struct cmd* listcmd(struct cmd *left, struct cmd *right) { 1450: 55 push %ebp 1451: 89 e5 mov %esp,%ebp 1453: 53 push %ebx 1454: 83 ec 14 sub $0x14,%esp struct listcmd *cmd; cmd = malloc(sizeof(*cmd)); 1457: c7 04 24 0c 00 00 00 movl $0xc,(%esp) 145e: e8 5d 0d 00 00 call 21c0 <malloc> memset(cmd, 0, sizeof(*cmd)); 1463: c7 44 24 08 0c 00 00 movl $0xc,0x8(%esp) 146a: 00 146b: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) 1472: 00 1473: 89 04 24 mov %eax,(%esp) cmd = malloc(sizeof(*cmd)); 1476: 89 c3 mov %eax,%ebx memset(cmd, 0, sizeof(*cmd)); 1478: e8 f3 07 00 00 call 1c70 <memset> cmd->type = LIST; cmd->left = left; 147d: 8b 45 08 mov 0x8(%ebp),%eax cmd->type = LIST; 1480: c7 03 04 00 00 00 movl $0x4,(%ebx) cmd->left = left; 1486: 89 43 04 mov %eax,0x4(%ebx) cmd->right = right; 1489: 8b 45 0c mov 0xc(%ebp),%eax 148c: 89 43 08 mov %eax,0x8(%ebx) return (struct cmd*)cmd; } 148f: 83 c4 14 add $0x14,%esp 1492: 89 d8 mov %ebx,%eax 1494: 5b pop %ebx 1495: 5d pop %ebp 1496: c3 ret 1497: 89 f6 mov %esi,%esi 1499: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 000014a0 <backcmd>: struct cmd* backcmd(struct cmd *subcmd) { 14a0: 55 push %ebp 14a1: 89 e5 mov %esp,%ebp 14a3: 53 push %ebx 14a4: 83 ec 14 sub $0x14,%esp struct backcmd *cmd; cmd = malloc(sizeof(*cmd)); 14a7: c7 04 24 08 00 00 00 movl $0x8,(%esp) 14ae: e8 0d 0d 00 00 call 21c0 <malloc> memset(cmd, 0, sizeof(*cmd)); 14b3: c7 44 24 08 08 00 00 movl $0x8,0x8(%esp) 14ba: 00 14bb: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) 14c2: 00 14c3: 89 04 24 mov %eax,(%esp) cmd = malloc(sizeof(*cmd)); 14c6: 89 c3 mov %eax,%ebx memset(cmd, 0, sizeof(*cmd)); 14c8: e8 a3 07 00 00 call 1c70 <memset> cmd->type = BACK; cmd->cmd = subcmd; 14cd: 8b 45 08 mov 0x8(%ebp),%eax cmd->type = BACK; 14d0: c7 03 05 00 00 00 movl $0x5,(%ebx) cmd->cmd = subcmd; 14d6: 89 43 04 mov %eax,0x4(%ebx) return (struct cmd*)cmd; } 14d9: 83 c4 14 add $0x14,%esp 14dc: 89 d8 mov %ebx,%eax 14de: 5b pop %ebx 14df: 5d pop %ebp 14e0: c3 ret 14e1: eb 0d jmp 14f0 <gettoken> 14e3: 90 nop 14e4: 90 nop 14e5: 90 nop 14e6: 90 nop 14e7: 90 nop 14e8: 90 nop 14e9: 90 nop 14ea: 90 nop 14eb: 90 nop 14ec: 90 nop 14ed: 90 nop 14ee: 90 nop 14ef: 90 nop 000014f0 <gettoken>: char whitespace[] = " \t\r\n\v"; char symbols[] = "<|>&;()"; int gettoken(char **ps, char *es, char **q, char **eq) { 14f0: 55 push %ebp 14f1: 89 e5 mov %esp,%ebp 14f3: 57 push %edi 14f4: 56 push %esi 14f5: 53 push %ebx 14f6: 83 ec 1c sub $0x1c,%esp char *s; int ret; s = *ps; 14f9: 8b 45 08 mov 0x8(%ebp),%eax { 14fc: 8b 5d 0c mov 0xc(%ebp),%ebx 14ff: 8b 75 10 mov 0x10(%ebp),%esi s = *ps; 1502: 8b 38 mov (%eax),%edi while(s < es && strchr(whitespace, *s)) 1504: 39 df cmp %ebx,%edi 1506: 72 0f jb 1517 <gettoken+0x27> 1508: eb 24 jmp 152e <gettoken+0x3e> 150a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi s++; 1510: 83 c7 01 add $0x1,%edi while(s < es && strchr(whitespace, *s)) 1513: 39 df cmp %ebx,%edi 1515: 74 17 je 152e <gettoken+0x3e> 1517: 0f be 07 movsbl (%edi),%eax 151a: c7 04 24 ac 29 00 00 movl $0x29ac,(%esp) 1521: 89 44 24 04 mov %eax,0x4(%esp) 1525: e8 66 07 00 00 call 1c90 <strchr> 152a: 85 c0 test %eax,%eax 152c: 75 e2 jne 1510 <gettoken+0x20> if(q) 152e: 85 f6 test %esi,%esi 1530: 74 02 je 1534 <gettoken+0x44> *q = s; 1532: 89 3e mov %edi,(%esi) ret = *s; 1534: 0f b6 0f movzbl (%edi),%ecx 1537: 0f be f1 movsbl %cl,%esi switch(*s){ 153a: 80 f9 29 cmp $0x29,%cl ret = *s; 153d: 89 f0 mov %esi,%eax switch(*s){ 153f: 7f 4f jg 1590 <gettoken+0xa0> 1541: 80 f9 28 cmp $0x28,%cl 1544: 7d 55 jge 159b <gettoken+0xab> 1546: 84 c9 test %cl,%cl 1548: 0f 85 ca 00 00 00 jne 1618 <gettoken+0x128> ret = 'a'; while(s < es && !strchr(whitespace, *s) && !strchr(symbols, *s)) s++; break; } if(eq) 154e: 8b 45 14 mov 0x14(%ebp),%eax 1551: 85 c0 test %eax,%eax 1553: 74 05 je 155a <gettoken+0x6a> *eq = s; 1555: 8b 45 14 mov 0x14(%ebp),%eax 1558: 89 38 mov %edi,(%eax) while(s < es && strchr(whitespace, *s)) 155a: 39 df cmp %ebx,%edi 155c: 72 09 jb 1567 <gettoken+0x77> 155e: eb 1e jmp 157e <gettoken+0x8e> s++; 1560: 83 c7 01 add $0x1,%edi while(s < es && strchr(whitespace, *s)) 1563: 39 df cmp %ebx,%edi 1565: 74 17 je 157e <gettoken+0x8e> 1567: 0f be 07 movsbl (%edi),%eax 156a: c7 04 24 ac 29 00 00 movl $0x29ac,(%esp) 1571: 89 44 24 04 mov %eax,0x4(%esp) 1575: e8 16 07 00 00 call 1c90 <strchr> 157a: 85 c0 test %eax,%eax 157c: 75 e2 jne 1560 <gettoken+0x70> *ps = s; 157e: 8b 45 08 mov 0x8(%ebp),%eax 1581: 89 38 mov %edi,(%eax) return ret; } 1583: 83 c4 1c add $0x1c,%esp 1586: 89 f0 mov %esi,%eax 1588: 5b pop %ebx 1589: 5e pop %esi 158a: 5f pop %edi 158b: 5d pop %ebp 158c: c3 ret 158d: 8d 76 00 lea 0x0(%esi),%esi switch(*s){ 1590: 80 f9 3e cmp $0x3e,%cl 1593: 75 0b jne 15a0 <gettoken+0xb0> if(*s == '>'){ 1595: 80 7f 01 3e cmpb $0x3e,0x1(%edi) 1599: 74 6d je 1608 <gettoken+0x118> s++; 159b: 83 c7 01 add $0x1,%edi 159e: eb ae jmp 154e <gettoken+0x5e> switch(*s){ 15a0: 7f 56 jg 15f8 <gettoken+0x108> 15a2: 83 e9 3b sub $0x3b,%ecx 15a5: 80 f9 01 cmp $0x1,%cl 15a8: 76 f1 jbe 159b <gettoken+0xab> while(s < es && !strchr(whitespace, *s) && !strchr(symbols, *s)) 15aa: 39 fb cmp %edi,%ebx 15ac: 77 2b ja 15d9 <gettoken+0xe9> 15ae: 66 90 xchg %ax,%ax 15b0: eb 3b jmp 15ed <gettoken+0xfd> 15b2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 15b8: 0f be 07 movsbl (%edi),%eax 15bb: c7 04 24 a4 29 00 00 movl $0x29a4,(%esp) 15c2: 89 44 24 04 mov %eax,0x4(%esp) 15c6: e8 c5 06 00 00 call 1c90 <strchr> 15cb: 85 c0 test %eax,%eax 15cd: 75 1e jne 15ed <gettoken+0xfd> s++; 15cf: 83 c7 01 add $0x1,%edi while(s < es && !strchr(whitespace, *s) && !strchr(symbols, *s)) 15d2: 39 df cmp %ebx,%edi 15d4: 74 17 je 15ed <gettoken+0xfd> 15d6: 0f be 07 movsbl (%edi),%eax 15d9: 89 44 24 04 mov %eax,0x4(%esp) 15dd: c7 04 24 ac 29 00 00 movl $0x29ac,(%esp) 15e4: e8 a7 06 00 00 call 1c90 <strchr> 15e9: 85 c0 test %eax,%eax 15eb: 74 cb je 15b8 <gettoken+0xc8> ret = 'a'; 15ed: be 61 00 00 00 mov $0x61,%esi 15f2: e9 57 ff ff ff jmp 154e <gettoken+0x5e> 15f7: 90 nop switch(*s){ 15f8: 80 f9 7c cmp $0x7c,%cl 15fb: 74 9e je 159b <gettoken+0xab> 15fd: 8d 76 00 lea 0x0(%esi),%esi 1600: eb a8 jmp 15aa <gettoken+0xba> 1602: 8d b6 00 00 00 00 lea 0x0(%esi),%esi s++; 1608: 83 c7 02 add $0x2,%edi ret = '+'; 160b: be 2b 00 00 00 mov $0x2b,%esi 1610: e9 39 ff ff ff jmp 154e <gettoken+0x5e> 1615: 8d 76 00 lea 0x0(%esi),%esi switch(*s){ 1618: 80 f9 26 cmp $0x26,%cl 161b: 75 8d jne 15aa <gettoken+0xba> 161d: e9 79 ff ff ff jmp 159b <gettoken+0xab> 1622: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 1629: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00001630 <peek>: int peek(char **ps, char *es, char *toks) { 1630: 55 push %ebp 1631: 89 e5 mov %esp,%ebp 1633: 57 push %edi 1634: 56 push %esi 1635: 53 push %ebx 1636: 83 ec 1c sub $0x1c,%esp 1639: 8b 7d 08 mov 0x8(%ebp),%edi 163c: 8b 75 0c mov 0xc(%ebp),%esi char *s; s = *ps; 163f: 8b 1f mov (%edi),%ebx while(s < es && strchr(whitespace, *s)) 1641: 39 f3 cmp %esi,%ebx 1643: 72 0a jb 164f <peek+0x1f> 1645: eb 1f jmp 1666 <peek+0x36> 1647: 90 nop s++; 1648: 83 c3 01 add $0x1,%ebx while(s < es && strchr(whitespace, *s)) 164b: 39 f3 cmp %esi,%ebx 164d: 74 17 je 1666 <peek+0x36> 164f: 0f be 03 movsbl (%ebx),%eax 1652: c7 04 24 ac 29 00 00 movl $0x29ac,(%esp) 1659: 89 44 24 04 mov %eax,0x4(%esp) 165d: e8 2e 06 00 00 call 1c90 <strchr> 1662: 85 c0 test %eax,%eax 1664: 75 e2 jne 1648 <peek+0x18> *ps = s; 1666: 89 1f mov %ebx,(%edi) return *s && strchr(toks, *s); 1668: 0f be 13 movsbl (%ebx),%edx 166b: 31 c0 xor %eax,%eax 166d: 84 d2 test %dl,%dl 166f: 74 17 je 1688 <peek+0x58> 1671: 8b 45 10 mov 0x10(%ebp),%eax 1674: 89 54 24 04 mov %edx,0x4(%esp) 1678: 89 04 24 mov %eax,(%esp) 167b: e8 10 06 00 00 call 1c90 <strchr> 1680: 85 c0 test %eax,%eax 1682: 0f 95 c0 setne %al 1685: 0f b6 c0 movzbl %al,%eax } 1688: 83 c4 1c add $0x1c,%esp 168b: 5b pop %ebx 168c: 5e pop %esi 168d: 5f pop %edi 168e: 5d pop %ebp 168f: c3 ret 00001690 <parseredirs>: return cmd; } struct cmd* parseredirs(struct cmd *cmd, char **ps, char *es) { 1690: 55 push %ebp 1691: 89 e5 mov %esp,%ebp 1693: 57 push %edi 1694: 56 push %esi 1695: 53 push %ebx 1696: 83 ec 3c sub $0x3c,%esp 1699: 8b 75 0c mov 0xc(%ebp),%esi 169c: 8b 5d 10 mov 0x10(%ebp),%ebx 169f: 90 nop int tok; char *q, *eq; while(peek(ps, es, "<>")){ 16a0: c7 44 24 08 35 23 00 movl $0x2335,0x8(%esp) 16a7: 00 16a8: 89 5c 24 04 mov %ebx,0x4(%esp) 16ac: 89 34 24 mov %esi,(%esp) 16af: e8 7c ff ff ff call 1630 <peek> 16b4: 85 c0 test %eax,%eax 16b6: 0f 84 9c 00 00 00 je 1758 <parseredirs+0xc8> tok = gettoken(ps, es, 0, 0); 16bc: c7 44 24 0c 00 00 00 movl $0x0,0xc(%esp) 16c3: 00 16c4: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp) 16cb: 00 16cc: 89 5c 24 04 mov %ebx,0x4(%esp) 16d0: 89 34 24 mov %esi,(%esp) 16d3: e8 18 fe ff ff call 14f0 <gettoken> if(gettoken(ps, es, &q, &eq) != 'a') 16d8: 89 5c 24 04 mov %ebx,0x4(%esp) 16dc: 89 34 24 mov %esi,(%esp) tok = gettoken(ps, es, 0, 0); 16df: 89 c7 mov %eax,%edi if(gettoken(ps, es, &q, &eq) != 'a') 16e1: 8d 45 e4 lea -0x1c(%ebp),%eax 16e4: 89 44 24 0c mov %eax,0xc(%esp) 16e8: 8d 45 e0 lea -0x20(%ebp),%eax 16eb: 89 44 24 08 mov %eax,0x8(%esp) 16ef: e8 fc fd ff ff call 14f0 <gettoken> 16f4: 83 f8 61 cmp $0x61,%eax 16f7: 75 6a jne 1763 <parseredirs+0xd3> panic("missing file for redirection"); switch(tok){ 16f9: 83 ff 3c cmp $0x3c,%edi 16fc: 74 42 je 1740 <parseredirs+0xb0> 16fe: 83 ff 3e cmp $0x3e,%edi 1701: 74 05 je 1708 <parseredirs+0x78> 1703: 83 ff 2b cmp $0x2b,%edi 1706: 75 98 jne 16a0 <parseredirs+0x10> break; case '>': cmd = redircmd(cmd, q, eq, O_WRONLY|O_CREATE, 1); break; case '+': // >> cmd = redircmd(cmd, q, eq, O_WRONLY|O_CREATE, 1); 1708: c7 44 24 10 01 00 00 movl $0x1,0x10(%esp) 170f: 00 1710: c7 44 24 0c 01 02 00 movl $0x201,0xc(%esp) 1717: 00 1718: 8b 45 e4 mov -0x1c(%ebp),%eax 171b: 89 44 24 08 mov %eax,0x8(%esp) 171f: 8b 45 e0 mov -0x20(%ebp),%eax 1722: 89 44 24 04 mov %eax,0x4(%esp) 1726: 8b 45 08 mov 0x8(%ebp),%eax 1729: 89 04 24 mov %eax,(%esp) 172c: e8 6f fc ff ff call 13a0 <redircmd> 1731: 89 45 08 mov %eax,0x8(%ebp) break; 1734: e9 67 ff ff ff jmp 16a0 <parseredirs+0x10> 1739: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi cmd = redircmd(cmd, q, eq, O_RDONLY, 0); 1740: c7 44 24 10 00 00 00 movl $0x0,0x10(%esp) 1747: 00 1748: c7 44 24 0c 00 00 00 movl $0x0,0xc(%esp) 174f: 00 1750: eb c6 jmp 1718 <parseredirs+0x88> 1752: 8d b6 00 00 00 00 lea 0x0(%esi),%esi } } return cmd; } 1758: 8b 45 08 mov 0x8(%ebp),%eax 175b: 83 c4 3c add $0x3c,%esp 175e: 5b pop %ebx 175f: 5e pop %esi 1760: 5f pop %edi 1761: 5d pop %ebp 1762: c3 ret panic("missing file for redirection"); 1763: c7 04 24 18 23 00 00 movl $0x2318,(%esp) 176a: e8 f1 f9 ff ff call 1160 <panic> 176f: 90 nop 00001770 <parseexec>: return cmd; } struct cmd* parseexec(char **ps, char *es) { 1770: 55 push %ebp 1771: 89 e5 mov %esp,%ebp 1773: 57 push %edi 1774: 56 push %esi 1775: 53 push %ebx 1776: 83 ec 3c sub $0x3c,%esp 1779: 8b 75 08 mov 0x8(%ebp),%esi 177c: 8b 7d 0c mov 0xc(%ebp),%edi char *q, *eq; int tok, argc; struct execcmd *cmd; struct cmd *ret; if(peek(ps, es, "(")) 177f: c7 44 24 08 38 23 00 movl $0x2338,0x8(%esp) 1786: 00 1787: 89 34 24 mov %esi,(%esp) 178a: 89 7c 24 04 mov %edi,0x4(%esp) 178e: e8 9d fe ff ff call 1630 <peek> 1793: 85 c0 test %eax,%eax 1795: 0f 85 a5 00 00 00 jne 1840 <parseexec+0xd0> return parseblock(ps, es); ret = execcmd(); 179b: e8 c0 fb ff ff call 1360 <execcmd> cmd = (struct execcmd*)ret; argc = 0; ret = parseredirs(ret, ps, es); 17a0: 89 7c 24 08 mov %edi,0x8(%esp) 17a4: 89 74 24 04 mov %esi,0x4(%esp) 17a8: 89 04 24 mov %eax,(%esp) ret = execcmd(); 17ab: 89 c3 mov %eax,%ebx 17ad: 89 45 cc mov %eax,-0x34(%ebp) ret = parseredirs(ret, ps, es); 17b0: e8 db fe ff ff call 1690 <parseredirs> argc = 0; 17b5: c7 45 d4 00 00 00 00 movl $0x0,-0x2c(%ebp) ret = parseredirs(ret, ps, es); 17bc: 89 45 d0 mov %eax,-0x30(%ebp) while(!peek(ps, es, "|)&;")){ 17bf: eb 1d jmp 17de <parseexec+0x6e> 17c1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi cmd->argv[argc] = q; cmd->eargv[argc] = eq; argc++; if(argc >= MAXARGS) panic("too many args"); ret = parseredirs(ret, ps, es); 17c8: 8b 45 d0 mov -0x30(%ebp),%eax 17cb: 89 7c 24 08 mov %edi,0x8(%esp) 17cf: 89 74 24 04 mov %esi,0x4(%esp) 17d3: 89 04 24 mov %eax,(%esp) 17d6: e8 b5 fe ff ff call 1690 <parseredirs> 17db: 89 45 d0 mov %eax,-0x30(%ebp) while(!peek(ps, es, "|)&;")){ 17de: c7 44 24 08 4f 23 00 movl $0x234f,0x8(%esp) 17e5: 00 17e6: 89 7c 24 04 mov %edi,0x4(%esp) 17ea: 89 34 24 mov %esi,(%esp) 17ed: e8 3e fe ff ff call 1630 <peek> 17f2: 85 c0 test %eax,%eax 17f4: 75 62 jne 1858 <parseexec+0xe8> if((tok=gettoken(ps, es, &q, &eq)) == 0) 17f6: 8d 45 e4 lea -0x1c(%ebp),%eax 17f9: 89 44 24 0c mov %eax,0xc(%esp) 17fd: 8d 45 e0 lea -0x20(%ebp),%eax 1800: 89 44 24 08 mov %eax,0x8(%esp) 1804: 89 7c 24 04 mov %edi,0x4(%esp) 1808: 89 34 24 mov %esi,(%esp) 180b: e8 e0 fc ff ff call 14f0 <gettoken> 1810: 85 c0 test %eax,%eax 1812: 74 44 je 1858 <parseexec+0xe8> if(tok != 'a') 1814: 83 f8 61 cmp $0x61,%eax 1817: 75 61 jne 187a <parseexec+0x10a> cmd->argv[argc] = q; 1819: 8b 45 e0 mov -0x20(%ebp),%eax 181c: 83 c3 04 add $0x4,%ebx argc++; 181f: 83 45 d4 01 addl $0x1,-0x2c(%ebp) cmd->argv[argc] = q; 1823: 89 03 mov %eax,(%ebx) cmd->eargv[argc] = eq; 1825: 8b 45 e4 mov -0x1c(%ebp),%eax 1828: 89 43 28 mov %eax,0x28(%ebx) if(argc >= MAXARGS) 182b: 83 7d d4 0a cmpl $0xa,-0x2c(%ebp) 182f: 75 97 jne 17c8 <parseexec+0x58> panic("too many args"); 1831: c7 04 24 41 23 00 00 movl $0x2341,(%esp) 1838: e8 23 f9 ff ff call 1160 <panic> 183d: 8d 76 00 lea 0x0(%esi),%esi return parseblock(ps, es); 1840: 89 7c 24 04 mov %edi,0x4(%esp) 1844: 89 34 24 mov %esi,(%esp) 1847: e8 84 01 00 00 call 19d0 <parseblock> } cmd->argv[argc] = 0; cmd->eargv[argc] = 0; return ret; } 184c: 83 c4 3c add $0x3c,%esp 184f: 5b pop %ebx 1850: 5e pop %esi 1851: 5f pop %edi 1852: 5d pop %ebp 1853: c3 ret 1854: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 1858: 8b 45 cc mov -0x34(%ebp),%eax 185b: 8b 55 d4 mov -0x2c(%ebp),%edx 185e: 8d 04 90 lea (%eax,%edx,4),%eax cmd->argv[argc] = 0; 1861: c7 40 04 00 00 00 00 movl $0x0,0x4(%eax) cmd->eargv[argc] = 0; 1868: c7 40 2c 00 00 00 00 movl $0x0,0x2c(%eax) return ret; 186f: 8b 45 d0 mov -0x30(%ebp),%eax } 1872: 83 c4 3c add $0x3c,%esp 1875: 5b pop %ebx 1876: 5e pop %esi 1877: 5f pop %edi 1878: 5d pop %ebp 1879: c3 ret panic("syntax"); 187a: c7 04 24 3a 23 00 00 movl $0x233a,(%esp) 1881: e8 da f8 ff ff call 1160 <panic> 1886: 8d 76 00 lea 0x0(%esi),%esi 1889: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00001890 <parsepipe>: { 1890: 55 push %ebp 1891: 89 e5 mov %esp,%ebp 1893: 57 push %edi 1894: 56 push %esi 1895: 53 push %ebx 1896: 83 ec 1c sub $0x1c,%esp 1899: 8b 5d 08 mov 0x8(%ebp),%ebx 189c: 8b 75 0c mov 0xc(%ebp),%esi cmd = parseexec(ps, es); 189f: 89 1c 24 mov %ebx,(%esp) 18a2: 89 74 24 04 mov %esi,0x4(%esp) 18a6: e8 c5 fe ff ff call 1770 <parseexec> if(peek(ps, es, "|")){ 18ab: c7 44 24 08 54 23 00 movl $0x2354,0x8(%esp) 18b2: 00 18b3: 89 74 24 04 mov %esi,0x4(%esp) 18b7: 89 1c 24 mov %ebx,(%esp) cmd = parseexec(ps, es); 18ba: 89 c7 mov %eax,%edi if(peek(ps, es, "|")){ 18bc: e8 6f fd ff ff call 1630 <peek> 18c1: 85 c0 test %eax,%eax 18c3: 75 0b jne 18d0 <parsepipe+0x40> } 18c5: 83 c4 1c add $0x1c,%esp 18c8: 89 f8 mov %edi,%eax 18ca: 5b pop %ebx 18cb: 5e pop %esi 18cc: 5f pop %edi 18cd: 5d pop %ebp 18ce: c3 ret 18cf: 90 nop gettoken(ps, es, 0, 0); 18d0: 89 74 24 04 mov %esi,0x4(%esp) 18d4: 89 1c 24 mov %ebx,(%esp) 18d7: c7 44 24 0c 00 00 00 movl $0x0,0xc(%esp) 18de: 00 18df: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp) 18e6: 00 18e7: e8 04 fc ff ff call 14f0 <gettoken> cmd = pipecmd(cmd, parsepipe(ps, es)); 18ec: 89 74 24 04 mov %esi,0x4(%esp) 18f0: 89 1c 24 mov %ebx,(%esp) 18f3: e8 98 ff ff ff call 1890 <parsepipe> 18f8: 89 7d 08 mov %edi,0x8(%ebp) 18fb: 89 45 0c mov %eax,0xc(%ebp) } 18fe: 83 c4 1c add $0x1c,%esp 1901: 5b pop %ebx 1902: 5e pop %esi 1903: 5f pop %edi 1904: 5d pop %ebp cmd = pipecmd(cmd, parsepipe(ps, es)); 1905: e9 f6 fa ff ff jmp 1400 <pipecmd> 190a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 00001910 <parseline>: { 1910: 55 push %ebp 1911: 89 e5 mov %esp,%ebp 1913: 57 push %edi 1914: 56 push %esi 1915: 53 push %ebx 1916: 83 ec 1c sub $0x1c,%esp 1919: 8b 5d 08 mov 0x8(%ebp),%ebx 191c: 8b 75 0c mov 0xc(%ebp),%esi cmd = parsepipe(ps, es); 191f: 89 1c 24 mov %ebx,(%esp) 1922: 89 74 24 04 mov %esi,0x4(%esp) 1926: e8 65 ff ff ff call 1890 <parsepipe> 192b: 89 c7 mov %eax,%edi while(peek(ps, es, "&")){ 192d: eb 27 jmp 1956 <parseline+0x46> 192f: 90 nop gettoken(ps, es, 0, 0); 1930: c7 44 24 0c 00 00 00 movl $0x0,0xc(%esp) 1937: 00 1938: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp) 193f: 00 1940: 89 74 24 04 mov %esi,0x4(%esp) 1944: 89 1c 24 mov %ebx,(%esp) 1947: e8 a4 fb ff ff call 14f0 <gettoken> cmd = backcmd(cmd); 194c: 89 3c 24 mov %edi,(%esp) 194f: e8 4c fb ff ff call 14a0 <backcmd> 1954: 89 c7 mov %eax,%edi while(peek(ps, es, "&")){ 1956: c7 44 24 08 56 23 00 movl $0x2356,0x8(%esp) 195d: 00 195e: 89 74 24 04 mov %esi,0x4(%esp) 1962: 89 1c 24 mov %ebx,(%esp) 1965: e8 c6 fc ff ff call 1630 <peek> 196a: 85 c0 test %eax,%eax 196c: 75 c2 jne 1930 <parseline+0x20> if(peek(ps, es, ";")){ 196e: c7 44 24 08 52 23 00 movl $0x2352,0x8(%esp) 1975: 00 1976: 89 74 24 04 mov %esi,0x4(%esp) 197a: 89 1c 24 mov %ebx,(%esp) 197d: e8 ae fc ff ff call 1630 <peek> 1982: 85 c0 test %eax,%eax 1984: 75 0a jne 1990 <parseline+0x80> } 1986: 83 c4 1c add $0x1c,%esp 1989: 89 f8 mov %edi,%eax 198b: 5b pop %ebx 198c: 5e pop %esi 198d: 5f pop %edi 198e: 5d pop %ebp 198f: c3 ret gettoken(ps, es, 0, 0); 1990: 89 74 24 04 mov %esi,0x4(%esp) 1994: 89 1c 24 mov %ebx,(%esp) 1997: c7 44 24 0c 00 00 00 movl $0x0,0xc(%esp) 199e: 00 199f: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp) 19a6: 00 19a7: e8 44 fb ff ff call 14f0 <gettoken> cmd = listcmd(cmd, parseline(ps, es)); 19ac: 89 74 24 04 mov %esi,0x4(%esp) 19b0: 89 1c 24 mov %ebx,(%esp) 19b3: e8 58 ff ff ff call 1910 <parseline> 19b8: 89 7d 08 mov %edi,0x8(%ebp) 19bb: 89 45 0c mov %eax,0xc(%ebp) } 19be: 83 c4 1c add $0x1c,%esp 19c1: 5b pop %ebx 19c2: 5e pop %esi 19c3: 5f pop %edi 19c4: 5d pop %ebp cmd = listcmd(cmd, parseline(ps, es)); 19c5: e9 86 fa ff ff jmp 1450 <listcmd> 19ca: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 000019d0 <parseblock>: { 19d0: 55 push %ebp 19d1: 89 e5 mov %esp,%ebp 19d3: 57 push %edi 19d4: 56 push %esi 19d5: 53 push %ebx 19d6: 83 ec 1c sub $0x1c,%esp 19d9: 8b 5d 08 mov 0x8(%ebp),%ebx 19dc: 8b 75 0c mov 0xc(%ebp),%esi if(!peek(ps, es, "(")) 19df: c7 44 24 08 38 23 00 movl $0x2338,0x8(%esp) 19e6: 00 19e7: 89 1c 24 mov %ebx,(%esp) 19ea: 89 74 24 04 mov %esi,0x4(%esp) 19ee: e8 3d fc ff ff call 1630 <peek> 19f3: 85 c0 test %eax,%eax 19f5: 74 76 je 1a6d <parseblock+0x9d> gettoken(ps, es, 0, 0); 19f7: c7 44 24 0c 00 00 00 movl $0x0,0xc(%esp) 19fe: 00 19ff: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp) 1a06: 00 1a07: 89 74 24 04 mov %esi,0x4(%esp) 1a0b: 89 1c 24 mov %ebx,(%esp) 1a0e: e8 dd fa ff ff call 14f0 <gettoken> cmd = parseline(ps, es); 1a13: 89 74 24 04 mov %esi,0x4(%esp) 1a17: 89 1c 24 mov %ebx,(%esp) 1a1a: e8 f1 fe ff ff call 1910 <parseline> if(!peek(ps, es, ")")) 1a1f: c7 44 24 08 74 23 00 movl $0x2374,0x8(%esp) 1a26: 00 1a27: 89 74 24 04 mov %esi,0x4(%esp) 1a2b: 89 1c 24 mov %ebx,(%esp) cmd = parseline(ps, es); 1a2e: 89 c7 mov %eax,%edi if(!peek(ps, es, ")")) 1a30: e8 fb fb ff ff call 1630 <peek> 1a35: 85 c0 test %eax,%eax 1a37: 74 40 je 1a79 <parseblock+0xa9> gettoken(ps, es, 0, 0); 1a39: 89 74 24 04 mov %esi,0x4(%esp) 1a3d: 89 1c 24 mov %ebx,(%esp) 1a40: c7 44 24 0c 00 00 00 movl $0x0,0xc(%esp) 1a47: 00 1a48: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp) 1a4f: 00 1a50: e8 9b fa ff ff call 14f0 <gettoken> cmd = parseredirs(cmd, ps, es); 1a55: 89 74 24 08 mov %esi,0x8(%esp) 1a59: 89 5c 24 04 mov %ebx,0x4(%esp) 1a5d: 89 3c 24 mov %edi,(%esp) 1a60: e8 2b fc ff ff call 1690 <parseredirs> } 1a65: 83 c4 1c add $0x1c,%esp 1a68: 5b pop %ebx 1a69: 5e pop %esi 1a6a: 5f pop %edi 1a6b: 5d pop %ebp 1a6c: c3 ret panic("parseblock"); 1a6d: c7 04 24 58 23 00 00 movl $0x2358,(%esp) 1a74: e8 e7 f6 ff ff call 1160 <panic> panic("syntax - missing )"); 1a79: c7 04 24 63 23 00 00 movl $0x2363,(%esp) 1a80: e8 db f6 ff ff call 1160 <panic> 1a85: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 1a89: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00001a90 <nulterminate>: // NUL-terminate all the counted strings. struct cmd* nulterminate(struct cmd *cmd) { 1a90: 55 push %ebp 1a91: 89 e5 mov %esp,%ebp 1a93: 53 push %ebx 1a94: 83 ec 14 sub $0x14,%esp 1a97: 8b 5d 08 mov 0x8(%ebp),%ebx struct execcmd *ecmd; struct listcmd *lcmd; struct pipecmd *pcmd; struct redircmd *rcmd; if(cmd == 0) 1a9a: 85 db test %ebx,%ebx 1a9c: 0f 84 8e 00 00 00 je 1b30 <nulterminate+0xa0> return 0; switch(cmd->type){ 1aa2: 83 3b 05 cmpl $0x5,(%ebx) 1aa5: 77 49 ja 1af0 <nulterminate+0x60> 1aa7: 8b 03 mov (%ebx),%eax 1aa9: ff 24 85 b4 23 00 00 jmp *0x23b4(,%eax,4) nulterminate(pcmd->right); break; case LIST: lcmd = (struct listcmd*)cmd; nulterminate(lcmd->left); 1ab0: 8b 43 04 mov 0x4(%ebx),%eax 1ab3: 89 04 24 mov %eax,(%esp) 1ab6: e8 d5 ff ff ff call 1a90 <nulterminate> nulterminate(lcmd->right); 1abb: 8b 43 08 mov 0x8(%ebx),%eax 1abe: 89 04 24 mov %eax,(%esp) 1ac1: e8 ca ff ff ff call 1a90 <nulterminate> break; 1ac6: 89 d8 mov %ebx,%eax bcmd = (struct backcmd*)cmd; nulterminate(bcmd->cmd); break; } return cmd; } 1ac8: 83 c4 14 add $0x14,%esp 1acb: 5b pop %ebx 1acc: 5d pop %ebp 1acd: c3 ret 1ace: 66 90 xchg %ax,%ax for(i=0; ecmd->argv[i]; i++) 1ad0: 8b 4b 04 mov 0x4(%ebx),%ecx 1ad3: 89 d8 mov %ebx,%eax 1ad5: 85 c9 test %ecx,%ecx 1ad7: 74 17 je 1af0 <nulterminate+0x60> 1ad9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi *ecmd->eargv[i] = 0; 1ae0: 8b 50 2c mov 0x2c(%eax),%edx 1ae3: 83 c0 04 add $0x4,%eax 1ae6: c6 02 00 movb $0x0,(%edx) for(i=0; ecmd->argv[i]; i++) 1ae9: 8b 50 04 mov 0x4(%eax),%edx 1aec: 85 d2 test %edx,%edx 1aee: 75 f0 jne 1ae0 <nulterminate+0x50> } 1af0: 83 c4 14 add $0x14,%esp switch(cmd->type){ 1af3: 89 d8 mov %ebx,%eax } 1af5: 5b pop %ebx 1af6: 5d pop %ebp 1af7: c3 ret nulterminate(bcmd->cmd); 1af8: 8b 43 04 mov 0x4(%ebx),%eax 1afb: 89 04 24 mov %eax,(%esp) 1afe: e8 8d ff ff ff call 1a90 <nulterminate> } 1b03: 83 c4 14 add $0x14,%esp break; 1b06: 89 d8 mov %ebx,%eax } 1b08: 5b pop %ebx 1b09: 5d pop %ebp 1b0a: c3 ret 1b0b: 90 nop 1b0c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi nulterminate(rcmd->cmd); 1b10: 8b 43 04 mov 0x4(%ebx),%eax 1b13: 89 04 24 mov %eax,(%esp) 1b16: e8 75 ff ff ff call 1a90 <nulterminate> *rcmd->efile = 0; 1b1b: 8b 43 0c mov 0xc(%ebx),%eax 1b1e: c6 00 00 movb $0x0,(%eax) } 1b21: 83 c4 14 add $0x14,%esp break; 1b24: 89 d8 mov %ebx,%eax } 1b26: 5b pop %ebx 1b27: 5d pop %ebp 1b28: c3 ret 1b29: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi return 0; 1b30: 31 c0 xor %eax,%eax 1b32: eb 94 jmp 1ac8 <nulterminate+0x38> 1b34: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 1b3a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi 00001b40 <parsecmd>: { 1b40: 55 push %ebp 1b41: 89 e5 mov %esp,%ebp 1b43: 56 push %esi 1b44: 53 push %ebx 1b45: 83 ec 10 sub $0x10,%esp es = s + strlen(s); 1b48: 8b 5d 08 mov 0x8(%ebp),%ebx 1b4b: 89 1c 24 mov %ebx,(%esp) 1b4e: e8 ed 00 00 00 call 1c40 <strlen> 1b53: 01 c3 add %eax,%ebx cmd = parseline(&s, es); 1b55: 8d 45 08 lea 0x8(%ebp),%eax 1b58: 89 5c 24 04 mov %ebx,0x4(%esp) 1b5c: 89 04 24 mov %eax,(%esp) 1b5f: e8 ac fd ff ff call 1910 <parseline> peek(&s, es, ""); 1b64: c7 44 24 08 02 23 00 movl $0x2302,0x8(%esp) 1b6b: 00 1b6c: 89 5c 24 04 mov %ebx,0x4(%esp) cmd = parseline(&s, es); 1b70: 89 c6 mov %eax,%esi peek(&s, es, ""); 1b72: 8d 45 08 lea 0x8(%ebp),%eax 1b75: 89 04 24 mov %eax,(%esp) 1b78: e8 b3 fa ff ff call 1630 <peek> if(s != es){ 1b7d: 8b 45 08 mov 0x8(%ebp),%eax 1b80: 39 d8 cmp %ebx,%eax 1b82: 75 11 jne 1b95 <parsecmd+0x55> nulterminate(cmd); 1b84: 89 34 24 mov %esi,(%esp) 1b87: e8 04 ff ff ff call 1a90 <nulterminate> } 1b8c: 83 c4 10 add $0x10,%esp 1b8f: 89 f0 mov %esi,%eax 1b91: 5b pop %ebx 1b92: 5e pop %esi 1b93: 5d pop %ebp 1b94: c3 ret printf(2, "leftovers: %s\n", s); 1b95: 89 44 24 08 mov %eax,0x8(%esp) 1b99: c7 44 24 04 76 23 00 movl $0x2376,0x4(%esp) 1ba0: 00 1ba1: c7 04 24 02 00 00 00 movl $0x2,(%esp) 1ba8: e8 93 03 00 00 call 1f40 <printf> panic("syntax"); 1bad: c7 04 24 3a 23 00 00 movl $0x233a,(%esp) 1bb4: e8 a7 f5 ff ff call 1160 <panic> 1bb9: 66 90 xchg %ax,%ax 1bbb: 66 90 xchg %ax,%ax 1bbd: 66 90 xchg %ax,%ax 1bbf: 90 nop 00001bc0 <strcpy>: #include "user.h" #include "x86.h" char* strcpy(char *s, char *t) { 1bc0: 55 push %ebp 1bc1: 89 e5 mov %esp,%ebp 1bc3: 8b 45 08 mov 0x8(%ebp),%eax 1bc6: 8b 4d 0c mov 0xc(%ebp),%ecx 1bc9: 53 push %ebx char *os; os = s; while((*s++ = *t++) != 0) 1bca: 89 c2 mov %eax,%edx 1bcc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 1bd0: 83 c1 01 add $0x1,%ecx 1bd3: 0f b6 59 ff movzbl -0x1(%ecx),%ebx 1bd7: 83 c2 01 add $0x1,%edx 1bda: 84 db test %bl,%bl 1bdc: 88 5a ff mov %bl,-0x1(%edx) 1bdf: 75 ef jne 1bd0 <strcpy+0x10> ; return os; } 1be1: 5b pop %ebx 1be2: 5d pop %ebp 1be3: c3 ret 1be4: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 1bea: 8d bf 00 00 00 00 lea 0x0(%edi),%edi 00001bf0 <strcmp>: int strcmp(const char *p, const char *q) { 1bf0: 55 push %ebp 1bf1: 89 e5 mov %esp,%ebp 1bf3: 8b 55 08 mov 0x8(%ebp),%edx 1bf6: 53 push %ebx 1bf7: 8b 4d 0c mov 0xc(%ebp),%ecx while(*p && *p == *q) 1bfa: 0f b6 02 movzbl (%edx),%eax 1bfd: 84 c0 test %al,%al 1bff: 74 2d je 1c2e <strcmp+0x3e> 1c01: 0f b6 19 movzbl (%ecx),%ebx 1c04: 38 d8 cmp %bl,%al 1c06: 74 0e je 1c16 <strcmp+0x26> 1c08: eb 2b jmp 1c35 <strcmp+0x45> 1c0a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 1c10: 38 c8 cmp %cl,%al 1c12: 75 15 jne 1c29 <strcmp+0x39> p++, q++; 1c14: 89 d9 mov %ebx,%ecx 1c16: 83 c2 01 add $0x1,%edx while(*p && *p == *q) 1c19: 0f b6 02 movzbl (%edx),%eax p++, q++; 1c1c: 8d 59 01 lea 0x1(%ecx),%ebx while(*p && *p == *q) 1c1f: 0f b6 49 01 movzbl 0x1(%ecx),%ecx 1c23: 84 c0 test %al,%al 1c25: 75 e9 jne 1c10 <strcmp+0x20> 1c27: 31 c0 xor %eax,%eax return (uchar)*p - (uchar)*q; 1c29: 29 c8 sub %ecx,%eax } 1c2b: 5b pop %ebx 1c2c: 5d pop %ebp 1c2d: c3 ret 1c2e: 0f b6 09 movzbl (%ecx),%ecx while(*p && *p == *q) 1c31: 31 c0 xor %eax,%eax 1c33: eb f4 jmp 1c29 <strcmp+0x39> 1c35: 0f b6 cb movzbl %bl,%ecx 1c38: eb ef jmp 1c29 <strcmp+0x39> 1c3a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 00001c40 <strlen>: uint strlen(char *s) { 1c40: 55 push %ebp 1c41: 89 e5 mov %esp,%ebp 1c43: 8b 4d 08 mov 0x8(%ebp),%ecx int n; for(n = 0; s[n]; n++) 1c46: 80 39 00 cmpb $0x0,(%ecx) 1c49: 74 12 je 1c5d <strlen+0x1d> 1c4b: 31 d2 xor %edx,%edx 1c4d: 8d 76 00 lea 0x0(%esi),%esi 1c50: 83 c2 01 add $0x1,%edx 1c53: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1) 1c57: 89 d0 mov %edx,%eax 1c59: 75 f5 jne 1c50 <strlen+0x10> ; return n; } 1c5b: 5d pop %ebp 1c5c: c3 ret for(n = 0; s[n]; n++) 1c5d: 31 c0 xor %eax,%eax } 1c5f: 5d pop %ebp 1c60: c3 ret 1c61: eb 0d jmp 1c70 <memset> 1c63: 90 nop 1c64: 90 nop 1c65: 90 nop 1c66: 90 nop 1c67: 90 nop 1c68: 90 nop 1c69: 90 nop 1c6a: 90 nop 1c6b: 90 nop 1c6c: 90 nop 1c6d: 90 nop 1c6e: 90 nop 1c6f: 90 nop 00001c70 <memset>: void* memset(void *dst, int c, uint n) { 1c70: 55 push %ebp 1c71: 89 e5 mov %esp,%ebp 1c73: 8b 55 08 mov 0x8(%ebp),%edx 1c76: 57 push %edi } static inline void stosb(void *addr, int data, int cnt) { asm volatile("cld; rep stosb" : 1c77: 8b 4d 10 mov 0x10(%ebp),%ecx 1c7a: 8b 45 0c mov 0xc(%ebp),%eax 1c7d: 89 d7 mov %edx,%edi 1c7f: fc cld 1c80: f3 aa rep stos %al,%es:(%edi) stosb(dst, c, n); return dst; } 1c82: 89 d0 mov %edx,%eax 1c84: 5f pop %edi 1c85: 5d pop %ebp 1c86: c3 ret 1c87: 89 f6 mov %esi,%esi 1c89: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00001c90 <strchr>: char* strchr(const char *s, char c) { 1c90: 55 push %ebp 1c91: 89 e5 mov %esp,%ebp 1c93: 8b 45 08 mov 0x8(%ebp),%eax 1c96: 53 push %ebx 1c97: 8b 55 0c mov 0xc(%ebp),%edx for(; *s; s++) 1c9a: 0f b6 18 movzbl (%eax),%ebx 1c9d: 84 db test %bl,%bl 1c9f: 74 1d je 1cbe <strchr+0x2e> if(*s == c) 1ca1: 38 d3 cmp %dl,%bl 1ca3: 89 d1 mov %edx,%ecx 1ca5: 75 0d jne 1cb4 <strchr+0x24> 1ca7: eb 17 jmp 1cc0 <strchr+0x30> 1ca9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 1cb0: 38 ca cmp %cl,%dl 1cb2: 74 0c je 1cc0 <strchr+0x30> for(; *s; s++) 1cb4: 83 c0 01 add $0x1,%eax 1cb7: 0f b6 10 movzbl (%eax),%edx 1cba: 84 d2 test %dl,%dl 1cbc: 75 f2 jne 1cb0 <strchr+0x20> return (char*)s; return 0; 1cbe: 31 c0 xor %eax,%eax } 1cc0: 5b pop %ebx 1cc1: 5d pop %ebp 1cc2: c3 ret 1cc3: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 1cc9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00001cd0 <gets>: char* gets(char *buf, int max) { 1cd0: 55 push %ebp 1cd1: 89 e5 mov %esp,%ebp 1cd3: 57 push %edi 1cd4: 56 push %esi int i, cc; char c; for(i=0; i+1 < max; ){ 1cd5: 31 f6 xor %esi,%esi { 1cd7: 53 push %ebx 1cd8: 83 ec 2c sub $0x2c,%esp cc = read(0, &c, 1); 1cdb: 8d 7d e7 lea -0x19(%ebp),%edi for(i=0; i+1 < max; ){ 1cde: eb 31 jmp 1d11 <gets+0x41> cc = read(0, &c, 1); 1ce0: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) 1ce7: 00 1ce8: 89 7c 24 04 mov %edi,0x4(%esp) 1cec: c7 04 24 00 00 00 00 movl $0x0,(%esp) 1cf3: e8 02 01 00 00 call 1dfa <read> if(cc < 1) 1cf8: 85 c0 test %eax,%eax 1cfa: 7e 1d jle 1d19 <gets+0x49> break; buf[i++] = c; 1cfc: 0f b6 45 e7 movzbl -0x19(%ebp),%eax for(i=0; i+1 < max; ){ 1d00: 89 de mov %ebx,%esi buf[i++] = c; 1d02: 8b 55 08 mov 0x8(%ebp),%edx if(c == '\n' || c == '\r') 1d05: 3c 0d cmp $0xd,%al buf[i++] = c; 1d07: 88 44 1a ff mov %al,-0x1(%edx,%ebx,1) if(c == '\n' || c == '\r') 1d0b: 74 0c je 1d19 <gets+0x49> 1d0d: 3c 0a cmp $0xa,%al 1d0f: 74 08 je 1d19 <gets+0x49> for(i=0; i+1 < max; ){ 1d11: 8d 5e 01 lea 0x1(%esi),%ebx 1d14: 3b 5d 0c cmp 0xc(%ebp),%ebx 1d17: 7c c7 jl 1ce0 <gets+0x10> break; } buf[i] = '\0'; 1d19: 8b 45 08 mov 0x8(%ebp),%eax 1d1c: c6 04 30 00 movb $0x0,(%eax,%esi,1) return buf; } 1d20: 83 c4 2c add $0x2c,%esp 1d23: 5b pop %ebx 1d24: 5e pop %esi 1d25: 5f pop %edi 1d26: 5d pop %ebp 1d27: c3 ret 1d28: 90 nop 1d29: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 00001d30 <stat>: int stat(char *n, struct stat *st) { 1d30: 55 push %ebp 1d31: 89 e5 mov %esp,%ebp 1d33: 56 push %esi 1d34: 53 push %ebx 1d35: 83 ec 10 sub $0x10,%esp int fd; int r; fd = open(n, O_RDONLY); 1d38: 8b 45 08 mov 0x8(%ebp),%eax 1d3b: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) 1d42: 00 1d43: 89 04 24 mov %eax,(%esp) 1d46: e8 d7 00 00 00 call 1e22 <open> if(fd < 0) 1d4b: 85 c0 test %eax,%eax fd = open(n, O_RDONLY); 1d4d: 89 c3 mov %eax,%ebx if(fd < 0) 1d4f: 78 27 js 1d78 <stat+0x48> return -1; r = fstat(fd, st); 1d51: 8b 45 0c mov 0xc(%ebp),%eax 1d54: 89 1c 24 mov %ebx,(%esp) 1d57: 89 44 24 04 mov %eax,0x4(%esp) 1d5b: e8 da 00 00 00 call 1e3a <fstat> close(fd); 1d60: 89 1c 24 mov %ebx,(%esp) r = fstat(fd, st); 1d63: 89 c6 mov %eax,%esi close(fd); 1d65: e8 a0 00 00 00 call 1e0a <close> return r; 1d6a: 89 f0 mov %esi,%eax } 1d6c: 83 c4 10 add $0x10,%esp 1d6f: 5b pop %ebx 1d70: 5e pop %esi 1d71: 5d pop %ebp 1d72: c3 ret 1d73: 90 nop 1d74: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi return -1; 1d78: b8 ff ff ff ff mov $0xffffffff,%eax 1d7d: eb ed jmp 1d6c <stat+0x3c> 1d7f: 90 nop 00001d80 <atoi>: int atoi(const char *s) { 1d80: 55 push %ebp 1d81: 89 e5 mov %esp,%ebp 1d83: 8b 4d 08 mov 0x8(%ebp),%ecx 1d86: 53 push %ebx int n; n = 0; while('0' <= *s && *s <= '9') 1d87: 0f be 11 movsbl (%ecx),%edx 1d8a: 8d 42 d0 lea -0x30(%edx),%eax 1d8d: 3c 09 cmp $0x9,%al n = 0; 1d8f: b8 00 00 00 00 mov $0x0,%eax while('0' <= *s && *s <= '9') 1d94: 77 17 ja 1dad <atoi+0x2d> 1d96: 66 90 xchg %ax,%ax n = n*10 + *s++ - '0'; 1d98: 83 c1 01 add $0x1,%ecx 1d9b: 8d 04 80 lea (%eax,%eax,4),%eax 1d9e: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax while('0' <= *s && *s <= '9') 1da2: 0f be 11 movsbl (%ecx),%edx 1da5: 8d 5a d0 lea -0x30(%edx),%ebx 1da8: 80 fb 09 cmp $0x9,%bl 1dab: 76 eb jbe 1d98 <atoi+0x18> return n; } 1dad: 5b pop %ebx 1dae: 5d pop %ebp 1daf: c3 ret 00001db0 <memmove>: void* memmove(void *vdst, void *vsrc, int n) { 1db0: 55 push %ebp char *dst, *src; dst = vdst; src = vsrc; while(n-- > 0) 1db1: 31 d2 xor %edx,%edx { 1db3: 89 e5 mov %esp,%ebp 1db5: 56 push %esi 1db6: 8b 45 08 mov 0x8(%ebp),%eax 1db9: 53 push %ebx 1dba: 8b 5d 10 mov 0x10(%ebp),%ebx 1dbd: 8b 75 0c mov 0xc(%ebp),%esi while(n-- > 0) 1dc0: 85 db test %ebx,%ebx 1dc2: 7e 12 jle 1dd6 <memmove+0x26> 1dc4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi *dst++ = *src++; 1dc8: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx 1dcc: 88 0c 10 mov %cl,(%eax,%edx,1) 1dcf: 83 c2 01 add $0x1,%edx while(n-- > 0) 1dd2: 39 da cmp %ebx,%edx 1dd4: 75 f2 jne 1dc8 <memmove+0x18> return vdst; } 1dd6: 5b pop %ebx 1dd7: 5e pop %esi 1dd8: 5d pop %ebp 1dd9: c3 ret 00001dda <fork>: name: \ movl $SYS_ ## name, %eax; \ int $T_SYSCALL; \ ret SYSCALL(fork) 1dda: b8 01 00 00 00 mov $0x1,%eax 1ddf: cd 40 int $0x40 1de1: c3 ret 00001de2 <exit>: SYSCALL(exit) 1de2: b8 02 00 00 00 mov $0x2,%eax 1de7: cd 40 int $0x40 1de9: c3 ret 00001dea <wait>: SYSCALL(wait) 1dea: b8 03 00 00 00 mov $0x3,%eax 1def: cd 40 int $0x40 1df1: c3 ret 00001df2 <pipe>: SYSCALL(pipe) 1df2: b8 04 00 00 00 mov $0x4,%eax 1df7: cd 40 int $0x40 1df9: c3 ret 00001dfa <read>: SYSCALL(read) 1dfa: b8 05 00 00 00 mov $0x5,%eax 1dff: cd 40 int $0x40 1e01: c3 ret 00001e02 <write>: SYSCALL(write) 1e02: b8 10 00 00 00 mov $0x10,%eax 1e07: cd 40 int $0x40 1e09: c3 ret 00001e0a <close>: SYSCALL(close) 1e0a: b8 15 00 00 00 mov $0x15,%eax 1e0f: cd 40 int $0x40 1e11: c3 ret 00001e12 <kill>: SYSCALL(kill) 1e12: b8 06 00 00 00 mov $0x6,%eax 1e17: cd 40 int $0x40 1e19: c3 ret 00001e1a <exec>: SYSCALL(exec) 1e1a: b8 07 00 00 00 mov $0x7,%eax 1e1f: cd 40 int $0x40 1e21: c3 ret 00001e22 <open>: SYSCALL(open) 1e22: b8 0f 00 00 00 mov $0xf,%eax 1e27: cd 40 int $0x40 1e29: c3 ret 00001e2a <mknod>: SYSCALL(mknod) 1e2a: b8 11 00 00 00 mov $0x11,%eax 1e2f: cd 40 int $0x40 1e31: c3 ret 00001e32 <unlink>: SYSCALL(unlink) 1e32: b8 12 00 00 00 mov $0x12,%eax 1e37: cd 40 int $0x40 1e39: c3 ret 00001e3a <fstat>: SYSCALL(fstat) 1e3a: b8 08 00 00 00 mov $0x8,%eax 1e3f: cd 40 int $0x40 1e41: c3 ret 00001e42 <link>: SYSCALL(link) 1e42: b8 13 00 00 00 mov $0x13,%eax 1e47: cd 40 int $0x40 1e49: c3 ret 00001e4a <mkdir>: SYSCALL(mkdir) 1e4a: b8 14 00 00 00 mov $0x14,%eax 1e4f: cd 40 int $0x40 1e51: c3 ret 00001e52 <chdir>: SYSCALL(chdir) 1e52: b8 09 00 00 00 mov $0x9,%eax 1e57: cd 40 int $0x40 1e59: c3 ret 00001e5a <dup>: SYSCALL(dup) 1e5a: b8 0a 00 00 00 mov $0xa,%eax 1e5f: cd 40 int $0x40 1e61: c3 ret 00001e62 <getpid>: SYSCALL(getpid) 1e62: b8 0b 00 00 00 mov $0xb,%eax 1e67: cd 40 int $0x40 1e69: c3 ret 00001e6a <sbrk>: SYSCALL(sbrk) 1e6a: b8 0c 00 00 00 mov $0xc,%eax 1e6f: cd 40 int $0x40 1e71: c3 ret 00001e72 <sleep>: SYSCALL(sleep) 1e72: b8 0d 00 00 00 mov $0xd,%eax 1e77: cd 40 int $0x40 1e79: c3 ret 00001e7a <uptime>: SYSCALL(uptime) 1e7a: b8 0e 00 00 00 mov $0xe,%eax 1e7f: cd 40 int $0x40 1e81: c3 ret 00001e82 <shm_open>: SYSCALL(shm_open) 1e82: b8 16 00 00 00 mov $0x16,%eax 1e87: cd 40 int $0x40 1e89: c3 ret 00001e8a <shm_close>: SYSCALL(shm_close) 1e8a: b8 17 00 00 00 mov $0x17,%eax 1e8f: cd 40 int $0x40 1e91: c3 ret 1e92: 66 90 xchg %ax,%ax 1e94: 66 90 xchg %ax,%ax 1e96: 66 90 xchg %ax,%ax 1e98: 66 90 xchg %ax,%ax 1e9a: 66 90 xchg %ax,%ax 1e9c: 66 90 xchg %ax,%ax 1e9e: 66 90 xchg %ax,%ax 00001ea0 <printint>: write(fd, &c, 1); } static void printint(int fd, int xx, int base, int sgn) { 1ea0: 55 push %ebp 1ea1: 89 e5 mov %esp,%ebp 1ea3: 57 push %edi 1ea4: 56 push %esi 1ea5: 89 c6 mov %eax,%esi 1ea7: 53 push %ebx 1ea8: 83 ec 4c sub $0x4c,%esp char buf[16]; int i, neg; uint x; neg = 0; if(sgn && xx < 0){ 1eab: 8b 5d 08 mov 0x8(%ebp),%ebx 1eae: 85 db test %ebx,%ebx 1eb0: 74 09 je 1ebb <printint+0x1b> 1eb2: 89 d0 mov %edx,%eax 1eb4: c1 e8 1f shr $0x1f,%eax 1eb7: 84 c0 test %al,%al 1eb9: 75 75 jne 1f30 <printint+0x90> neg = 1; x = -xx; } else { x = xx; 1ebb: 89 d0 mov %edx,%eax neg = 0; 1ebd: c7 45 c4 00 00 00 00 movl $0x0,-0x3c(%ebp) 1ec4: 89 75 c0 mov %esi,-0x40(%ebp) } i = 0; 1ec7: 31 ff xor %edi,%edi 1ec9: 89 ce mov %ecx,%esi 1ecb: 8d 5d d7 lea -0x29(%ebp),%ebx 1ece: eb 02 jmp 1ed2 <printint+0x32> do{ buf[i++] = digits[x % base]; 1ed0: 89 cf mov %ecx,%edi 1ed2: 31 d2 xor %edx,%edx 1ed4: f7 f6 div %esi 1ed6: 8d 4f 01 lea 0x1(%edi),%ecx 1ed9: 0f b6 92 d3 23 00 00 movzbl 0x23d3(%edx),%edx }while((x /= base) != 0); 1ee0: 85 c0 test %eax,%eax buf[i++] = digits[x % base]; 1ee2: 88 14 0b mov %dl,(%ebx,%ecx,1) }while((x /= base) != 0); 1ee5: 75 e9 jne 1ed0 <printint+0x30> if(neg) 1ee7: 8b 55 c4 mov -0x3c(%ebp),%edx buf[i++] = digits[x % base]; 1eea: 89 c8 mov %ecx,%eax 1eec: 8b 75 c0 mov -0x40(%ebp),%esi if(neg) 1eef: 85 d2 test %edx,%edx 1ef1: 74 08 je 1efb <printint+0x5b> buf[i++] = '-'; 1ef3: 8d 4f 02 lea 0x2(%edi),%ecx 1ef6: c6 44 05 d8 2d movb $0x2d,-0x28(%ebp,%eax,1) while(--i >= 0) 1efb: 8d 79 ff lea -0x1(%ecx),%edi 1efe: 66 90 xchg %ax,%ax 1f00: 0f b6 44 3d d8 movzbl -0x28(%ebp,%edi,1),%eax 1f05: 83 ef 01 sub $0x1,%edi write(fd, &c, 1); 1f08: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) 1f0f: 00 1f10: 89 5c 24 04 mov %ebx,0x4(%esp) 1f14: 89 34 24 mov %esi,(%esp) 1f17: 88 45 d7 mov %al,-0x29(%ebp) 1f1a: e8 e3 fe ff ff call 1e02 <write> while(--i >= 0) 1f1f: 83 ff ff cmp $0xffffffff,%edi 1f22: 75 dc jne 1f00 <printint+0x60> putc(fd, buf[i]); } 1f24: 83 c4 4c add $0x4c,%esp 1f27: 5b pop %ebx 1f28: 5e pop %esi 1f29: 5f pop %edi 1f2a: 5d pop %ebp 1f2b: c3 ret 1f2c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi x = -xx; 1f30: 89 d0 mov %edx,%eax 1f32: f7 d8 neg %eax neg = 1; 1f34: c7 45 c4 01 00 00 00 movl $0x1,-0x3c(%ebp) 1f3b: eb 87 jmp 1ec4 <printint+0x24> 1f3d: 8d 76 00 lea 0x0(%esi),%esi 00001f40 <printf>: // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, char *fmt, ...) { 1f40: 55 push %ebp 1f41: 89 e5 mov %esp,%ebp 1f43: 57 push %edi char *s; int c, i, state; uint *ap; state = 0; 1f44: 31 ff xor %edi,%edi { 1f46: 56 push %esi 1f47: 53 push %ebx 1f48: 83 ec 3c sub $0x3c,%esp ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 1f4b: 8b 5d 0c mov 0xc(%ebp),%ebx ap = (uint*)(void*)&fmt + 1; 1f4e: 8d 45 10 lea 0x10(%ebp),%eax { 1f51: 8b 75 08 mov 0x8(%ebp),%esi ap = (uint*)(void*)&fmt + 1; 1f54: 89 45 d4 mov %eax,-0x2c(%ebp) for(i = 0; fmt[i]; i++){ 1f57: 0f b6 13 movzbl (%ebx),%edx 1f5a: 83 c3 01 add $0x1,%ebx 1f5d: 84 d2 test %dl,%dl 1f5f: 75 39 jne 1f9a <printf+0x5a> 1f61: e9 c2 00 00 00 jmp 2028 <printf+0xe8> 1f66: 66 90 xchg %ax,%ax c = fmt[i] & 0xff; if(state == 0){ if(c == '%'){ 1f68: 83 fa 25 cmp $0x25,%edx 1f6b: 0f 84 bf 00 00 00 je 2030 <printf+0xf0> write(fd, &c, 1); 1f71: 8d 45 e2 lea -0x1e(%ebp),%eax 1f74: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) 1f7b: 00 1f7c: 89 44 24 04 mov %eax,0x4(%esp) 1f80: 89 34 24 mov %esi,(%esp) state = '%'; } else { putc(fd, c); 1f83: 88 55 e2 mov %dl,-0x1e(%ebp) write(fd, &c, 1); 1f86: e8 77 fe ff ff call 1e02 <write> 1f8b: 83 c3 01 add $0x1,%ebx for(i = 0; fmt[i]; i++){ 1f8e: 0f b6 53 ff movzbl -0x1(%ebx),%edx 1f92: 84 d2 test %dl,%dl 1f94: 0f 84 8e 00 00 00 je 2028 <printf+0xe8> if(state == 0){ 1f9a: 85 ff test %edi,%edi c = fmt[i] & 0xff; 1f9c: 0f be c2 movsbl %dl,%eax if(state == 0){ 1f9f: 74 c7 je 1f68 <printf+0x28> } } else if(state == '%'){ 1fa1: 83 ff 25 cmp $0x25,%edi 1fa4: 75 e5 jne 1f8b <printf+0x4b> if(c == 'd'){ 1fa6: 83 fa 64 cmp $0x64,%edx 1fa9: 0f 84 31 01 00 00 je 20e0 <printf+0x1a0> printint(fd, *ap, 10, 1); ap++; } else if(c == 'x' || c == 'p'){ 1faf: 25 f7 00 00 00 and $0xf7,%eax 1fb4: 83 f8 70 cmp $0x70,%eax 1fb7: 0f 84 83 00 00 00 je 2040 <printf+0x100> printint(fd, *ap, 16, 0); ap++; } else if(c == 's'){ 1fbd: 83 fa 73 cmp $0x73,%edx 1fc0: 0f 84 a2 00 00 00 je 2068 <printf+0x128> s = "(null)"; while(*s != 0){ putc(fd, *s); s++; } } else if(c == 'c'){ 1fc6: 83 fa 63 cmp $0x63,%edx 1fc9: 0f 84 35 01 00 00 je 2104 <printf+0x1c4> putc(fd, *ap); ap++; } else if(c == '%'){ 1fcf: 83 fa 25 cmp $0x25,%edx 1fd2: 0f 84 e0 00 00 00 je 20b8 <printf+0x178> write(fd, &c, 1); 1fd8: 8d 45 e6 lea -0x1a(%ebp),%eax 1fdb: 83 c3 01 add $0x1,%ebx 1fde: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) 1fe5: 00 } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); putc(fd, c); } state = 0; 1fe6: 31 ff xor %edi,%edi write(fd, &c, 1); 1fe8: 89 44 24 04 mov %eax,0x4(%esp) 1fec: 89 34 24 mov %esi,(%esp) 1fef: 89 55 d0 mov %edx,-0x30(%ebp) 1ff2: c6 45 e6 25 movb $0x25,-0x1a(%ebp) 1ff6: e8 07 fe ff ff call 1e02 <write> putc(fd, c); 1ffb: 8b 55 d0 mov -0x30(%ebp),%edx write(fd, &c, 1); 1ffe: 8d 45 e7 lea -0x19(%ebp),%eax 2001: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) 2008: 00 2009: 89 44 24 04 mov %eax,0x4(%esp) 200d: 89 34 24 mov %esi,(%esp) putc(fd, c); 2010: 88 55 e7 mov %dl,-0x19(%ebp) write(fd, &c, 1); 2013: e8 ea fd ff ff call 1e02 <write> for(i = 0; fmt[i]; i++){ 2018: 0f b6 53 ff movzbl -0x1(%ebx),%edx 201c: 84 d2 test %dl,%dl 201e: 0f 85 76 ff ff ff jne 1f9a <printf+0x5a> 2024: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi } } } 2028: 83 c4 3c add $0x3c,%esp 202b: 5b pop %ebx 202c: 5e pop %esi 202d: 5f pop %edi 202e: 5d pop %ebp 202f: c3 ret state = '%'; 2030: bf 25 00 00 00 mov $0x25,%edi 2035: e9 51 ff ff ff jmp 1f8b <printf+0x4b> 203a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi printint(fd, *ap, 16, 0); 2040: 8b 45 d4 mov -0x2c(%ebp),%eax 2043: b9 10 00 00 00 mov $0x10,%ecx state = 0; 2048: 31 ff xor %edi,%edi printint(fd, *ap, 16, 0); 204a: c7 04 24 00 00 00 00 movl $0x0,(%esp) 2051: 8b 10 mov (%eax),%edx 2053: 89 f0 mov %esi,%eax 2055: e8 46 fe ff ff call 1ea0 <printint> ap++; 205a: 83 45 d4 04 addl $0x4,-0x2c(%ebp) 205e: e9 28 ff ff ff jmp 1f8b <printf+0x4b> 2063: 90 nop 2064: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi s = (char*)*ap; 2068: 8b 45 d4 mov -0x2c(%ebp),%eax ap++; 206b: 83 45 d4 04 addl $0x4,-0x2c(%ebp) s = (char*)*ap; 206f: 8b 38 mov (%eax),%edi s = "(null)"; 2071: b8 cc 23 00 00 mov $0x23cc,%eax 2076: 85 ff test %edi,%edi 2078: 0f 44 f8 cmove %eax,%edi while(*s != 0){ 207b: 0f b6 07 movzbl (%edi),%eax 207e: 84 c0 test %al,%al 2080: 74 2a je 20ac <printf+0x16c> 2082: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 2088: 88 45 e3 mov %al,-0x1d(%ebp) write(fd, &c, 1); 208b: 8d 45 e3 lea -0x1d(%ebp),%eax s++; 208e: 83 c7 01 add $0x1,%edi write(fd, &c, 1); 2091: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) 2098: 00 2099: 89 44 24 04 mov %eax,0x4(%esp) 209d: 89 34 24 mov %esi,(%esp) 20a0: e8 5d fd ff ff call 1e02 <write> while(*s != 0){ 20a5: 0f b6 07 movzbl (%edi),%eax 20a8: 84 c0 test %al,%al 20aa: 75 dc jne 2088 <printf+0x148> state = 0; 20ac: 31 ff xor %edi,%edi 20ae: e9 d8 fe ff ff jmp 1f8b <printf+0x4b> 20b3: 90 nop 20b4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi write(fd, &c, 1); 20b8: 8d 45 e5 lea -0x1b(%ebp),%eax state = 0; 20bb: 31 ff xor %edi,%edi write(fd, &c, 1); 20bd: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) 20c4: 00 20c5: 89 44 24 04 mov %eax,0x4(%esp) 20c9: 89 34 24 mov %esi,(%esp) 20cc: c6 45 e5 25 movb $0x25,-0x1b(%ebp) 20d0: e8 2d fd ff ff call 1e02 <write> 20d5: e9 b1 fe ff ff jmp 1f8b <printf+0x4b> 20da: 8d b6 00 00 00 00 lea 0x0(%esi),%esi printint(fd, *ap, 10, 1); 20e0: 8b 45 d4 mov -0x2c(%ebp),%eax 20e3: b9 0a 00 00 00 mov $0xa,%ecx state = 0; 20e8: 66 31 ff xor %di,%di printint(fd, *ap, 10, 1); 20eb: c7 04 24 01 00 00 00 movl $0x1,(%esp) 20f2: 8b 10 mov (%eax),%edx 20f4: 89 f0 mov %esi,%eax 20f6: e8 a5 fd ff ff call 1ea0 <printint> ap++; 20fb: 83 45 d4 04 addl $0x4,-0x2c(%ebp) 20ff: e9 87 fe ff ff jmp 1f8b <printf+0x4b> putc(fd, *ap); 2104: 8b 45 d4 mov -0x2c(%ebp),%eax state = 0; 2107: 31 ff xor %edi,%edi putc(fd, *ap); 2109: 8b 00 mov (%eax),%eax write(fd, &c, 1); 210b: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) 2112: 00 2113: 89 34 24 mov %esi,(%esp) putc(fd, *ap); 2116: 88 45 e4 mov %al,-0x1c(%ebp) write(fd, &c, 1); 2119: 8d 45 e4 lea -0x1c(%ebp),%eax 211c: 89 44 24 04 mov %eax,0x4(%esp) 2120: e8 dd fc ff ff call 1e02 <write> ap++; 2125: 83 45 d4 04 addl $0x4,-0x2c(%ebp) 2129: e9 5d fe ff ff jmp 1f8b <printf+0x4b> 212e: 66 90 xchg %ax,%ax 00002130 <free>: static Header base; static Header *freep; void free(void *ap) { 2130: 55 push %ebp Header *bp, *p; bp = (Header*)ap - 1; for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 2131: a1 24 2a 00 00 mov 0x2a24,%eax { 2136: 89 e5 mov %esp,%ebp 2138: 57 push %edi 2139: 56 push %esi 213a: 53 push %ebx 213b: 8b 5d 08 mov 0x8(%ebp),%ebx if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 213e: 8b 08 mov (%eax),%ecx bp = (Header*)ap - 1; 2140: 8d 53 f8 lea -0x8(%ebx),%edx for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 2143: 39 d0 cmp %edx,%eax 2145: 72 11 jb 2158 <free+0x28> 2147: 90 nop if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 2148: 39 c8 cmp %ecx,%eax 214a: 72 04 jb 2150 <free+0x20> 214c: 39 ca cmp %ecx,%edx 214e: 72 10 jb 2160 <free+0x30> 2150: 89 c8 mov %ecx,%eax for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 2152: 39 d0 cmp %edx,%eax if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 2154: 8b 08 mov (%eax),%ecx for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 2156: 73 f0 jae 2148 <free+0x18> 2158: 39 ca cmp %ecx,%edx 215a: 72 04 jb 2160 <free+0x30> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 215c: 39 c8 cmp %ecx,%eax 215e: 72 f0 jb 2150 <free+0x20> break; if(bp + bp->s.size == p->s.ptr){ 2160: 8b 73 fc mov -0x4(%ebx),%esi 2163: 8d 3c f2 lea (%edx,%esi,8),%edi 2166: 39 cf cmp %ecx,%edi 2168: 74 1e je 2188 <free+0x58> bp->s.size += p->s.ptr->s.size; bp->s.ptr = p->s.ptr->s.ptr; } else bp->s.ptr = p->s.ptr; 216a: 89 4b f8 mov %ecx,-0x8(%ebx) if(p + p->s.size == bp){ 216d: 8b 48 04 mov 0x4(%eax),%ecx 2170: 8d 34 c8 lea (%eax,%ecx,8),%esi 2173: 39 f2 cmp %esi,%edx 2175: 74 28 je 219f <free+0x6f> p->s.size += bp->s.size; p->s.ptr = bp->s.ptr; } else p->s.ptr = bp; 2177: 89 10 mov %edx,(%eax) freep = p; 2179: a3 24 2a 00 00 mov %eax,0x2a24 } 217e: 5b pop %ebx 217f: 5e pop %esi 2180: 5f pop %edi 2181: 5d pop %ebp 2182: c3 ret 2183: 90 nop 2184: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi bp->s.size += p->s.ptr->s.size; 2188: 03 71 04 add 0x4(%ecx),%esi 218b: 89 73 fc mov %esi,-0x4(%ebx) bp->s.ptr = p->s.ptr->s.ptr; 218e: 8b 08 mov (%eax),%ecx 2190: 8b 09 mov (%ecx),%ecx 2192: 89 4b f8 mov %ecx,-0x8(%ebx) if(p + p->s.size == bp){ 2195: 8b 48 04 mov 0x4(%eax),%ecx 2198: 8d 34 c8 lea (%eax,%ecx,8),%esi 219b: 39 f2 cmp %esi,%edx 219d: 75 d8 jne 2177 <free+0x47> p->s.size += bp->s.size; 219f: 03 4b fc add -0x4(%ebx),%ecx freep = p; 21a2: a3 24 2a 00 00 mov %eax,0x2a24 p->s.size += bp->s.size; 21a7: 89 48 04 mov %ecx,0x4(%eax) p->s.ptr = bp->s.ptr; 21aa: 8b 53 f8 mov -0x8(%ebx),%edx 21ad: 89 10 mov %edx,(%eax) } 21af: 5b pop %ebx 21b0: 5e pop %esi 21b1: 5f pop %edi 21b2: 5d pop %ebp 21b3: c3 ret 21b4: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 21ba: 8d bf 00 00 00 00 lea 0x0(%edi),%edi 000021c0 <malloc>: return freep; } void* malloc(uint nbytes) { 21c0: 55 push %ebp 21c1: 89 e5 mov %esp,%ebp 21c3: 57 push %edi 21c4: 56 push %esi 21c5: 53 push %ebx 21c6: 83 ec 1c sub $0x1c,%esp Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; 21c9: 8b 45 08 mov 0x8(%ebp),%eax if((prevp = freep) == 0){ 21cc: 8b 1d 24 2a 00 00 mov 0x2a24,%ebx nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; 21d2: 8d 48 07 lea 0x7(%eax),%ecx 21d5: c1 e9 03 shr $0x3,%ecx if((prevp = freep) == 0){ 21d8: 85 db test %ebx,%ebx nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; 21da: 8d 71 01 lea 0x1(%ecx),%esi if((prevp = freep) == 0){ 21dd: 0f 84 9b 00 00 00 je 227e <malloc+0xbe> 21e3: 8b 13 mov (%ebx),%edx 21e5: 8b 7a 04 mov 0x4(%edx),%edi base.s.ptr = freep = prevp = &base; base.s.size = 0; } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ if(p->s.size >= nunits){ 21e8: 39 fe cmp %edi,%esi 21ea: 76 64 jbe 2250 <malloc+0x90> 21ec: 8d 04 f5 00 00 00 00 lea 0x0(,%esi,8),%eax if(nu < 4096) 21f3: bb 00 80 00 00 mov $0x8000,%ebx 21f8: 89 45 e4 mov %eax,-0x1c(%ebp) 21fb: eb 0e jmp 220b <malloc+0x4b> 21fd: 8d 76 00 lea 0x0(%esi),%esi for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ 2200: 8b 02 mov (%edx),%eax if(p->s.size >= nunits){ 2202: 8b 78 04 mov 0x4(%eax),%edi 2205: 39 fe cmp %edi,%esi 2207: 76 4f jbe 2258 <malloc+0x98> 2209: 89 c2 mov %eax,%edx p->s.size = nunits; } freep = prevp; return (void*)(p + 1); } if(p == freep) 220b: 3b 15 24 2a 00 00 cmp 0x2a24,%edx 2211: 75 ed jne 2200 <malloc+0x40> if(nu < 4096) 2213: 8b 45 e4 mov -0x1c(%ebp),%eax 2216: 81 fe 00 10 00 00 cmp $0x1000,%esi 221c: bf 00 10 00 00 mov $0x1000,%edi 2221: 0f 43 fe cmovae %esi,%edi 2224: 0f 42 c3 cmovb %ebx,%eax p = sbrk(nu * sizeof(Header)); 2227: 89 04 24 mov %eax,(%esp) 222a: e8 3b fc ff ff call 1e6a <sbrk> if(p == (char*)-1) 222f: 83 f8 ff cmp $0xffffffff,%eax 2232: 74 18 je 224c <malloc+0x8c> hp->s.size = nu; 2234: 89 78 04 mov %edi,0x4(%eax) free((void*)(hp + 1)); 2237: 83 c0 08 add $0x8,%eax 223a: 89 04 24 mov %eax,(%esp) 223d: e8 ee fe ff ff call 2130 <free> return freep; 2242: 8b 15 24 2a 00 00 mov 0x2a24,%edx if((p = morecore(nunits)) == 0) 2248: 85 d2 test %edx,%edx 224a: 75 b4 jne 2200 <malloc+0x40> return 0; 224c: 31 c0 xor %eax,%eax 224e: eb 20 jmp 2270 <malloc+0xb0> if(p->s.size >= nunits){ 2250: 89 d0 mov %edx,%eax 2252: 89 da mov %ebx,%edx 2254: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi if(p->s.size == nunits) 2258: 39 fe cmp %edi,%esi 225a: 74 1c je 2278 <malloc+0xb8> p->s.size -= nunits; 225c: 29 f7 sub %esi,%edi 225e: 89 78 04 mov %edi,0x4(%eax) p += p->s.size; 2261: 8d 04 f8 lea (%eax,%edi,8),%eax p->s.size = nunits; 2264: 89 70 04 mov %esi,0x4(%eax) freep = prevp; 2267: 89 15 24 2a 00 00 mov %edx,0x2a24 return (void*)(p + 1); 226d: 83 c0 08 add $0x8,%eax } } 2270: 83 c4 1c add $0x1c,%esp 2273: 5b pop %ebx 2274: 5e pop %esi 2275: 5f pop %edi 2276: 5d pop %ebp 2277: c3 ret prevp->s.ptr = p->s.ptr; 2278: 8b 08 mov (%eax),%ecx 227a: 89 0a mov %ecx,(%edx) 227c: eb e9 jmp 2267 <malloc+0xa7> base.s.ptr = freep = prevp = &base; 227e: c7 05 24 2a 00 00 28 movl $0x2a28,0x2a24 2285: 2a 00 00 base.s.size = 0; 2288: ba 28 2a 00 00 mov $0x2a28,%edx base.s.ptr = freep = prevp = &base; 228d: c7 05 28 2a 00 00 28 movl $0x2a28,0x2a28 2294: 2a 00 00 base.s.size = 0; 2297: c7 05 2c 2a 00 00 00 movl $0x0,0x2a2c 229e: 00 00 00 22a1: e9 46 ff ff ff jmp 21ec <malloc+0x2c> 22a6: 66 90 xchg %ax,%ax 22a8: 66 90 xchg %ax,%ax 22aa: 66 90 xchg %ax,%ax 22ac: 66 90 xchg %ax,%ax 22ae: 66 90 xchg %ax,%ax 000022b0 <uacquire>: #include "uspinlock.h" #include "x86.h" void uacquire(struct uspinlock *lk) { 22b0: 55 push %ebp xchg(volatile uint *addr, uint newval) { uint result; // The + in "+m" denotes a read-modify-write operand. asm volatile("lock; xchgl %0, %1" : 22b1: b9 01 00 00 00 mov $0x1,%ecx 22b6: 89 e5 mov %esp,%ebp 22b8: 8b 55 08 mov 0x8(%ebp),%edx 22bb: 90 nop 22bc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 22c0: 89 c8 mov %ecx,%eax 22c2: f0 87 02 lock xchg %eax,(%edx) // The xchg is atomic. while(xchg(&lk->locked, 1) != 0) 22c5: 85 c0 test %eax,%eax 22c7: 75 f7 jne 22c0 <uacquire+0x10> ; // Tell the C compiler and the processor to not move loads or stores // past this point, to ensure that the critical section's memory // references happen after the lock is acquired. __sync_synchronize(); 22c9: 0f ae f0 mfence } 22cc: 5d pop %ebp 22cd: c3 ret 22ce: 66 90 xchg %ax,%ax 000022d0 <urelease>: void urelease (struct uspinlock *lk) { 22d0: 55 push %ebp 22d1: 89 e5 mov %esp,%ebp 22d3: 8b 45 08 mov 0x8(%ebp),%eax __sync_synchronize(); 22d6: 0f ae f0 mfence // Release the lock, equivalent to lk->locked = 0. // This code can't use a C assignment, since it might // not be atomic. A real OS would use C atomics here. asm volatile("movl $0, %0" : "+m" (lk->locked) : ); 22d9: c7 00 00 00 00 00 movl $0x0,(%eax) } 22df: 5d pop %ebp 22e0: c3 ret
.386p .model small FIRST_SEGMENT EQU 0 LOADER_BASE_SEGMENT EQU 800H KERNEL_BASE_SEGMENT EQU 1000H KERDLL_BASE_SEGMENT EQU 4000H FONT_BASE EQU 7600H BAKMBR_BASE EQU 7A00H INFO_BASE EQU 7800H LOADER_FLAG_OFFST EQU INFO_BASE LOADER_SEC_OFFSET EQU (INFO_BASE + 6) LOADER_SEC_CNT EQU (INFO_BASE + 4) KERNEL_SEC_OFFSET EQU (INFO_BASE + 12) KERNEL_SEC_CNT EQU (INFO_BASE + 10) BAKMBR_SEC_OFFSET EQU (INFO_BASE + 16) BAKMBR2_SEC_OFFSET EQU (INFO_BASE + 20) FONT_SEC_CNT EQU (INFO_BASE + 24) FONT_SEC_OFFSET EQU (INFO_BASE + 26) KERDLL_SEC_CNT EQU (INFO_BASE + 30) KERDLL_SEC_OFFSET EQU (INFO_BASE + 32) RM_SEG_LIMIT EQU 10000H RM_STACK_TOP EQU (RM_SEG_LIMIT - 10H) INSTALL_FLAG EQU 00474a4ch ;retn =c3 ;ret =c3 ;retf =cb ;retd =66cb ;ret 4 = c2 04 00 ;ret 8 = c2 08 00 ;cs = 0,ip = 7c00 MBR SEGMENT para use16 assume cs:MBR start: cli mov ax,0 mov cx,0 mov dx,0 mov bx,0 mov si,0 mov di,0 mov sp,RM_STACK_TOP movzx esp,sp mov ebp,esp mov ax,FIRST_SEGMENT mov ds,ax mov es,ax mov ss,ax mov fs,ax mov gs,ax push dword ptr 0 push dword ptr ds:[7c00h + 1bah] push word ptr 1 push word ptr INFO_BASE push word ptr FIRST_SEGMENT call near ptr __getLoaderSectors add sp,14 cmp ax,-1 jz _loadErr mov eax,dword ptr ds:[INFO_BASE] cmp eax,dword ptr INSTALL_FLAG jnz _loadErr push dword ptr 0 push dword ptr ds:[LOADER_SEC_OFFSET] push word ptr ds:[LOADER_SEC_CNT] push word ptr 0 push word ptr LOADER_BASE_SEGMENT call near ptr __getLoaderSectors add sp,14 cmp eax,-1 jz _loadErr call near ptr _loadOK ;low = offset,high = segment ;考虑这样调用跟com文件的加载方式有什么异同? push word ptr LOADER_BASE_SEGMENT push word ptr 0 retf ;mov ax,LOADER_BASE_SEGMENT ;mov _LoaderSeg,ax ;db eah ;dw 0 ;_LoaderSeg dw 0 ;mov bp,sp ;jmp dword ptr ss:[bp] ;call dword ptr ss:[bp] _loadOK: push word ptr 0ah lea ax, loaderOK add ax,7c00h push ax push word ptr FIRST_SEGMENT call __showMsg add sp,6 retn loaderOK db 'mbr read loader ok',0 _loadErr: push word ptr 8ch lea ax, loaderErr add ax,7c00h push ax push word ptr FIRST_SEGMENT call __showMsg add sp,6 hlt loaderErr db 'mbr read loader error',0 ;bp old bp ;bp + 2 ret address ;bp + 4 segment ;bp + 6 offset ;bp + 8 sector count ;bp + 10 sector no low ;bp + 14 sector no high __getLoaderSectors proc near push bp mov bp,sp push ds push si push dx sub sp,100h mov byte ptr ss:[esp],10h mov byte ptr ss:[esp + 1],0 mov ax,word ptr ss:[bp + 8] mov word ptr ss:[esp + 2],ax movzx eax,word ptr ss:[bp + 4] shl eax,16 mov ax,word ptr ss:[bp + 6] mov dword ptr ss:[esp + 4],eax mov eax,dword ptr ss:[bp + 10] mov dword ptr ss:[esp + 8],eax mov eax,dword ptr ss:[bp + 14] mov dword ptr ss:[esp + 12],eax mov ax,ss mov ds,ax mov si,sp mov ax,4200h mov dx,80h int 13h cmp ah,0 jnz _readerror mov eax,dword ptr ss:[bp + 10] jmp _readEnd _readerror: mov eax,-1 _readEnd: add sp,100h pop dx pop si pop ds mov sp,bp pop bp retn __getLoaderSectors endp ;bit 7 high ground ;bit 6 red ground ;bit 5 yellow ground ;bit 4 blue ground ;bit 3 high character ;bit 2 red character ;bit 1 yellow character ;bit 0 blue character __showMsg proc near push bp mov bp,sp push ds push es push si push di sub sp,100h mov ax,word ptr ss:[bp + 4] mov ds,ax mov ax,0b800h mov es,ax mov si,word ptr ss:[bp+6] mov di, word ptr ds:[_showPos] add word ptr ds:[_showPos],160 cld _showmbrok: lodsb cmp al,0 jz _okmbrend mov ah,byte ptr ss:[bp + 8] stosw jmp _showmbrok _okmbrend: mov ax,si sub ax,word ptr ss:[bp + 6] add sp,100h pop di pop si pop es pop ds mov sp,bp pop bp retn _showPos dw 0 __showMsg endp version db 1 MBR ends end start
//******************************************************************** //* //* Warning: This file was generated by ecore4CPP Generator //* //******************************************************************** #ifndef FUML_EVALUATION_HPP #define FUML_EVALUATION_HPP #include <list> #include <memory> #include <string> // forward declarations //********************************* // generated Includes #include <map> namespace persistence { namespace interfaces { class XLoadHandler; // used for Persistence class XSaveHandler; // used for Persistence } } namespace fUML { class FUMLFactory; } //Forward Declaration for used types namespace fUML { class Locus; } namespace fUML { class SemanticVisitor; } namespace fUML { class Value; } namespace uml { class ValueSpecification; } // base class includes #include "fUML/SemanticVisitor.hpp" // enum includes //********************************* namespace fUML { /*! */ class Evaluation:virtual public SemanticVisitor { public: Evaluation(const Evaluation &) {} Evaluation& operator=(Evaluation const&) = delete; protected: Evaluation(){} public: virtual std::shared_ptr<ecore::EObject> copy() const = 0; //destructor virtual ~Evaluation() {} //********************************* // Operations //********************************* /*! */ virtual std::shared_ptr<fUML::Value> evaluate() = 0; //********************************* // Attributes Getter Setter //********************************* //********************************* // Reference //********************************* /*! */ virtual std::shared_ptr<fUML::Locus > getLocus() const = 0; /*! */ virtual void setLocus(std::shared_ptr<fUML::Locus> _locus_locus) = 0; /*! */ virtual std::shared_ptr<uml::ValueSpecification > getSpecification() const = 0; /*! */ virtual void setSpecification(std::shared_ptr<uml::ValueSpecification> _specification_specification) = 0; protected: //********************************* // Attribute Members //********************************* //********************************* // Reference Members //********************************* /*! */ std::shared_ptr<fUML::Locus > m_locus; /*! */ std::shared_ptr<uml::ValueSpecification > m_specification; public: //********************************* // Union Getter //********************************* virtual std::shared_ptr<ecore::EObject> eContainer() const = 0; //********************************* // Persistence Functions //********************************* virtual void load(std::shared_ptr<persistence::interfaces::XLoadHandler> loadHandler) = 0; virtual void resolveReferences(const int featureID, std::list<std::shared_ptr<ecore::EObject> > references) = 0; virtual void save(std::shared_ptr<persistence::interfaces::XSaveHandler> saveHandler) const = 0; }; } #endif /* end of include guard: FUML_EVALUATION_HPP */
%ifdef CONFIG { "RegData": { "R15": "0x3" }, "MemoryRegions": { "0x100000000": "4096" } } %endif %macro cfmerge 0 ; Get CF sbb r14, r14 and r14, 1 ; Merge in to results shl r15, 1 or r15, r14 %endmacro mov rdx, 0xe0000000 mov rax, 0xFFFFFFFF80000000 mov [rdx + 8 * 0], rax mov [rdx + 8 * 1], rax mov [rdx + 8 * 2], rax mov rax, 0x01 mov [rdx + 8 * 3], eax mov rax, 0x0 mov [rdx + 8 * 3 + 4], eax xor r15, r15 ; Will contain our results db 0xF3 ; Prefix with F3. Shouldn't change behaviour bt word [rdx], 1 cfmerge mov r13, 32 db 0xF3 ; Prefix with F3. Shouldn't change behaviour bt dword [rdx], r13d cfmerge db 0xF3 ; Prefix with F3. Shouldn't change behaviour bt qword [rdx], 64 * 3 cfmerge hlt
; PROLOGUE(mpn_half) ; Copyright 2009 Jason Moxham ; ; Windows Conversion Copyright 2008 Brian Gladman ; ; This file is part of the MPIR Library. ; The MPIR Library is free software; you can redistribute it and/or modify ; it under the terms of the GNU Lesser General Public License as published ; by the Free Software Foundation; either version 2.1 of the License, or (at ; your option) any later version. ; The MPIR Library 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 Lesser General Public ; License for more details. ; You should have received a copy of the GNU Lesser General Public License ; along with the MPIR Library; see the file COPYING.LIB. If not, write ; to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, ; Boston, MA 02110-1301, USA. ; ; mp_limb_t mpn_half(mp_ptr, mp_size_t) ; rdi rsi ; rcx rdx %include "yasm_mac.inc" CPU Athlon64 BITS 64 LEAF_PROC mpn_half mov rax, rdx lea rcx, [rcx+rdx*8-8] shr rdx, 2 and eax, 3 jz .1 shr qword [rcx], 1 lea rcx, [rcx-8] dec rax jz .1 rcr qword [rcx], 1 lea rcx, [rcx-8] dec rax jz .1 rcr qword [rcx], 1 lea rcx, [rcx-8] dec rax .1: sbb r8, r8 cmp rdx, 0 jz .3 add r8, r8 xalign 16 .2: rcr qword [rcx], 1 nop rcr qword [rcx-8], 1 rcr qword [rcx-16], 1 rcr qword [rcx-24], 1 nop dec rdx lea rcx, [rcx-32] jnz .2 sbb r8, r8 .3: sub rax, r8 shl rax, 63 ret end
; A020708: Pisot sequences E(4,9), P(4,9). ; 4,9,20,44,97,214,472,1041,2296,5064,11169,24634,54332,119833,264300,582932,1285697,2835694,6254320,13794337,30424368,67103056,148000449,326425266,719953588,1587907625,3502240516,7724434620,17036776865,37575794246,82876023112,182788823089,403153440424,889182903960,1961154631009,4325462702442,9540108308844,21041371248697,46408205199836,102356518708516,225754408665729,497917022531294,1098190563771104,2422135536207937,5342188094947168 add $0,2 cal $0,8998 ; a(n) = 2*a(n-1) + a(n-3), with a(0)=1 and a(1)=2. mov $1,$0
// SPDX-License-Identifier: BSD-3-Clause // Copyright Contributors to the OpenColorIO Project. #include <cstdio> #include <iostream> #include <fstream> #include <string.h> #include <OpenColorIO/OpenColorIO.h> namespace OCIO = OCIO_NAMESPACE; #include "apputils/argparse.h" #include "utils/StringUtils.h" // Array of non OpenColorIO arguments. static std::vector<std::string> args; // Fill 'args' array with OpenColorIO arguments. static int parse_end_args(int argc, const char * argv[]) { while ( argc > 0) { args.push_back(argv[0]); argc--; argv++; } return 0; } void CreateOutputLutFile(const std::string & outLutFilepath, OCIO::ConstGroupTransformRcPtr transform) { // Get the processor. // Create an empty config but with the latest version. OCIO::ConfigRcPtr config = OCIO::Config::Create(); config->upgradeToLatestVersion(); OCIO::ConstProcessorRcPtr processor = config->getProcessor(transform); // CLF file format does not support inverse 1D LUTs, optimize the processor // to replace inverse 1D LUTs by 'fast forward' 1D LUTs. OCIO::ConstProcessorRcPtr optProcessor = processor->getOptimizedProcessor(OCIO::BIT_DEPTH_F32, OCIO::BIT_DEPTH_F32, OCIO::OPTIMIZATION_LUT_INV_FAST); // Create the CLF file. std::ofstream outfs(outLutFilepath, std::ios::out | std::ios::trunc); if (outfs.good()) { try { optProcessor->write("Academy/ASC Common LUT Format", outfs); } catch (OCIO::Exception) { outfs.close(); remove(outLutFilepath.c_str()); throw; } outfs.close(); } else { std::ostringstream oss; oss << "Could not open the file '" << outLutFilepath << "'." << std::endl; throw OCIO::Exception(oss.str().c_str()); } } int main(int argc, const char ** argv) { bool help = false, verbose = false, listCSCColorSpaces = false; std::string cscColorSpace; ArgParse ap; ap.options("ociomakeclf -- Convert a LUT into CLF format and optionally add conversions from/to ACES2065-1 to make it an LMT.\n" " If the csc argument is used, the CLF will contain the transforms:\n" " [ACES2065-1 to CSC space] [the LUT] [CSC space to ACES2065-1].\n\n" "usage: ociomakeclf inLutFilepath outLutFilepath --csc cscColorSpace\n" " or ociomakeclf inLutFilepath outLutFilepath\n" " or ociomakeclf --list\n", "%*", parse_end_args, "", "<SEPARATOR>", "Options:", "--help", &help, "Print help message", "--verbose", &verbose, "Display general information", "--list", &listCSCColorSpaces, "List of the supported CSC color spaces", "--csc %s", &cscColorSpace, "The color space that the input LUT expects and produces", nullptr); if (ap.parse(argc, argv) < 0) { std::cerr << std::endl << ap.geterror() << std::endl << std::endl; ap.usage(); return 1; } if (help) { ap.usage(); return 0; } // The LMT must accept and produce ACES2065-1 so look for all built-in transforms that produce // that (based on the naming conventions). static constexpr char BuiltinSuffix[] = "_to_ACES2065-1"; if (listCSCColorSpaces) { OCIO::ConstBuiltinTransformRegistryRcPtr registry = OCIO::BuiltinTransformRegistry::Get(); std::cout << "The list of supported color spaces converting to ACES2065-1, is:"; for (size_t idx = 0; idx < registry->getNumBuiltins(); ++idx) { std::string cscName = registry->getBuiltinStyle(idx); if (StringUtils::EndsWith(cscName, BuiltinSuffix)) { cscName.resize(cscName.size() - strlen(BuiltinSuffix)); std::cout << std::endl << "\t" << cscName; } } std::cout << std::endl << std::endl; return 0; } if (args.size() != 2) { std::cerr << "ERROR: Expecting 2 arguments, found " << args.size() << "." << std::endl; ap.usage(); return 1; } const std::string inLutFilepath = args[0].c_str(); const std::string outLutFilepath = args[1].c_str(); const std::string originalCSC = cscColorSpace; if (!cscColorSpace.empty()) { cscColorSpace += BuiltinSuffix; OCIO::ConstBuiltinTransformRegistryRcPtr registry = OCIO::BuiltinTransformRegistry::Get(); bool cscFound = false; for (size_t idx = 0; idx < registry->getNumBuiltins() && !cscFound; ++idx) { if (StringUtils::Compare(cscColorSpace.c_str(), registry->getBuiltinStyle(idx))) { cscFound = true; // Save the builtin transform name with the right cases. cscColorSpace = registry->getBuiltinStyle(idx); } } if (!cscFound) { std::cerr << "ERROR: The LUT color space name '" << originalCSC << "' is not supported." << std::endl; return 1; } } if (outLutFilepath.empty()) { std::cerr << "ERROR: The output file path is missing." << std::endl; return 1; } else { const std::string filepath = StringUtils::Lower(outLutFilepath); if (!StringUtils::EndsWith(filepath, ".clf")) { std::cerr << "ERROR: The output LUT file path '" << outLutFilepath << "' must have a .clf extension." << std::endl; return 1; } } if (verbose) { std::cout << "OCIO Version: " << OCIO::GetVersion() << std::endl; } try { if (verbose) { std::cout << "Building the transformation." << std::endl; } OCIO::GroupTransformRcPtr grp = OCIO::GroupTransform::Create(); grp->setDirection(OCIO::TRANSFORM_DIR_FORWARD); if (!cscColorSpace.empty()) { std::string description; description += "ACES LMT transform built from a look LUT expecting color space: "; description += originalCSC; grp->getFormatMetadata().addChildElement(OCIO::METADATA_DESCRIPTION, description.c_str()); } std::string description; description += "Original LUT name: "; description += inLutFilepath; grp->getFormatMetadata().addChildElement(OCIO::METADATA_DESCRIPTION, description.c_str()); if (!cscColorSpace.empty()) { // TODO: It should overwrite existing input and output descriptors if any. grp->getFormatMetadata().addChildElement(OCIO::METADATA_INPUT_DESCRIPTOR, "ACES2065-1"); grp->getFormatMetadata().addChildElement(OCIO::METADATA_OUTPUT_DESCRIPTOR, "ACES2065-1"); } if (!cscColorSpace.empty()) { // Create the color transformation from ACES2065-1 to the CSC color space. OCIO::BuiltinTransformRcPtr inBuiltin = OCIO::BuiltinTransform::Create(); inBuiltin->setStyle(cscColorSpace.c_str()); inBuiltin->setDirection(OCIO::TRANSFORM_DIR_INVERSE); grp->appendTransform(inBuiltin); } // Create the file transform for the input LUT file. OCIO::FileTransformRcPtr file = OCIO::FileTransform::Create(); file->setSrc(inLutFilepath.c_str()); file->setDirection(OCIO::TRANSFORM_DIR_FORWARD); file->setInterpolation(OCIO::INTERP_BEST); grp->appendTransform(file); if (!cscColorSpace.empty()) { // Create the color transformation from the CSC color space to ACES2065-1. OCIO::BuiltinTransformRcPtr outBuiltin = OCIO::BuiltinTransform::Create(); outBuiltin->setStyle(cscColorSpace.c_str()); outBuiltin->setDirection(OCIO::TRANSFORM_DIR_FORWARD); grp->appendTransform(outBuiltin); } if (verbose) { std::cout << "Creating the CLF lut file." << std::endl; } // Create the CLF file. CreateOutputLutFile(outLutFilepath, grp); } catch (OCIO::Exception & exception) { std::cerr << "ERROR: " << exception.what() << std::endl; return 1; } catch (...) { std::cerr << "ERROR: Unknown error encountered." << std::endl; return 1; } return 0; // Success. }
org 0x100 cpu 8086 programBase: pitCyclesPerScanline equ 76 ; Fixed by CGA hardware scanlinesPerFrame equ 262 ; Fixed by NTSC standard activeScanlines equ 200 ; Standard CGA full-screen visual_profiler equ 0 onScreenPitCycles equ pitCyclesPerScanline*activeScanlines - 22 offScreenPitCycles equ pitCyclesPerScanline*scanlinesPerFrame - (onScreenPitCycles) %include "tables.inc" setupMemory: mov ax,cs mov ds,ax cli mov ss,ax mov sp,stackHigh sti segmentAdjust equ ((sinTable - programBase) + 0x100) add ax,segmentAdjust >> 4 mov [innerLoopDS],ax mov ax,0x40 mov ds,ax checkMotorShutoff: cmp byte[0x40],0 je noMotorShutoff mov byte[0x40],1 jmp checkMotorShutoff noMotorShutoff: mov ax,cs mov ds,ax in al,0x61 or al,0x80 mov [port61high+1],al and al,0x7f mov [port61low+1],al mov si,image mov ax,0xb800 xor di,di mov es,ax mov cx,8000 rep movsw mov dx,0x3d8 mov al,9 out dx,al mov dl,0xd4 mov ax,0x0f03 out dx,ax mov ax,0x7f04 out dx,ax mov ax,0x6406 out dx,ax mov ax,0x7007 out dx,ax mov ax,0x0109 out dx,ax mov dl,0xda cli xor ax,ax mov ds,ax mov al,0x34 out 0x43,al %macro setPIT0Count 1 mov al,(%1) & 0xff out 0x40,al %if ((%1) & 0xff) != ((%1) >> 8) mov al,(%1) >> 8 %endif out 0x40,al %endmacro setPIT0Count 2 ; PIT was reset so we start counting down from 2 immediately %macro waitForVerticalSync 0 %%waitForVerticalSync: in al,dx test al,8 jz %%waitForVerticalSync ; jump if not +VSYNC, finish if +VSYNC %endmacro %macro waitForNoVerticalSync 0 %%waitForNoVerticalSync: in al,dx test al,8 jnz %%waitForNoVerticalSync ; jump if +VSYNC, finish if -VSYNC %endmacro ; Wait for a while to be sure that IRQ0 is pending waitForVerticalSync waitForNoVerticalSync waitForVerticalSync waitForDisplayEnable: in al,dx test al,1 jnz waitForDisplayEnable setPIT0Count onScreenPitCycles ; PIT channel 0 is now counting down from onScreenPitCycles in top half of onscreen area and IRQ0 is pending mov ax,[0x20] mov [cs:oldInterrupt8],ax mov ax,[0x22] mov [cs:oldInterrupt8+2],ax mov word[0x20],transitionHandler mov [0x22],cs idle: sti .loop: hlt jmp .loop transitionHandler: mov al,0x20 out 0x20,al ; PIT channel 0 is now counting down from onScreenPitCycles in onscreen area setPIT0Count offScreenPitCycles ; When the next interrupt happens, PIT channel 0 will start counting down from offScreenPitCycles in offscreen area mov word[0x20],offScreenHandler mov [0x22],cs mov ax,cs mov ds,ax sti foregroundTask: hlt jmp foregroundTask align 16, db 0 dataTables oldInterrupt8: dw 0, 0 frameCount: dw 0, 0 alphaX: dw 0 alphaY: dw 0 betaX: dw 0 betaY: dw 0 innerLoopDS: dw 0 offScreenHandler: push ax push ds push es push si push di mov al,0x20 out 0x20,al xor ax,ax mov ds,ax mov word[0x20],onScreenHandler setPIT0Count onScreenPitCycles mov ax,0xb800 mov es,ax mov ax,cs mov ds,ax mov si,plasmaData mov di,initialUpdateOffset updateRoutine pop di pop si pop es pop ds pop ax iret onScreenHandler: push ax push bx push cx push dx push si push di push bp push es push ds mov al,0x20 out 0x20,al xor ax,ax mov ds,ax mov word[0x20],offScreenHandler setPIT0Count offScreenPitCycles mov ax,cs mov ds,ax mov es,ax inc word[frameCount] jnz noFrameCountCarry inc word[frameCount+2] noFrameCountCarry: checkKey: ; Read the keyboard byte and store it in al,0x60 xchg ax,bx ; Acknowledge the previous byte port61high: mov al,0xcf out 0x61,al port61low: mov al,0x4f out 0x61,al cmp bl,1 je teardown ; Plasma inner loop ; Registers: ; SI = pointer into sinTable for alphaX ; BP = pointer into sinTable for betaX ; DX = pointer into sinTable for alphaY ; CX = pointer into sinTable for betaY ; ES:DI = plasmaData buffer pointer ; AL = v ; AH = vy ; BX = gradientTable ; DS:0 = sinTable ; SS:0 = sinTable %macro plasmaIteration 2 %if %2 != 0 add si,%2*5-1 %else dec si %endif lodsb %if %2 != 0 add bx,%2*40 %endif add al,[bx] xchg ax,si %if %1 == 1 mov si,[bp+si+1568] %else mov si,[bp+si] %endif xchg ax,si stosw %endmacro %macro plasmaIncrementY 0 add dx,24 and dx,0x1ff mov bx,dx mov ah,[bx] add cx,3 and cx,0x1ff mov bx,cx add ah,[bx] mov bx,gradientTable - segmentAdjust %endmacro mov ax,[innerLoopDS] mov ds,ax mov ss,ax mov dx,[alphaY - segmentAdjust] add dx,16 and dx,0x1ff mov [alphaY - segmentAdjust],dx mov bx,dx mov ah,[bx] mov cx,[betaY - segmentAdjust] dec cx and cx,0x1ff mov [betaY - segmentAdjust],cx mov bx,cx add ah,[bx] mov bx,gradientTable - segmentAdjust mov di,plasmaData mov si,[alphaX - segmentAdjust] add si,8 mov [alphaX - segmentAdjust],si mov bp,[betaX - segmentAdjust] add bp,2 mov [betaX - segmentAdjust],bp plasmaRoutine mov ax,cs mov ss,ax pop ds pop es pop bp pop di pop si pop dx pop cx pop bx pop ax iret teardown: xor ax,ax mov ds,ax cli mov ax,[cs:oldInterrupt8] mov [0x20],ax mov ax,[cs:oldInterrupt8+2] mov [0x22],ax sti in al,0x61 and al,0xfc out 0x61,al mov ax,cs mov ds,ax setPIT0Count 0 mov ax,3 int 0x10 mov ax,19912 mul word[frameCount] mov cx,dx mov ax,19912 mul word[frameCount+2] add ax,cx adc dx,0 mov cx,0x40 mov ds,cx add [0x6c],ax adc [0x6e],dx dateLoop: cmp word[0x6c],0x18 jb doneDateLoop cmp word[0x6e],0xb0 jb doneDateLoop mov byte[0x70],1 sub word[0x6c],0xb0 sbb word[0x6e],0x18 jmp dateLoop doneDateLoop: exit: mov ax,0x4c00 int 0x21 programEnd: section .bss stackLow: resb 1024 stackHigh: plasmaData:
MOV R0, 1 start: ADD R0, 1 JL R0, 8, start MOV R1, R0 MOV R0, 0 RET db str "This is a test " ; Argument passed in in R1. If it's prime, sets R2 to 0. If not-prime, sets it to 1. isPrime:
#include "../glfw/include/GLFW/glfw3.h" #include "glpch.h" #include "OrthographicCamera.h" #include <glm/gtc/matrix_transform.hpp> namespace GLCore::Utils { OrthographicCamera::OrthographicCamera(float left, float right, float bottom, float top) : m_ViewMatrix(glm::lookAt(m_Position , m_camera_front + m_Position , glm::vec3(0.0f, 1.0f, 0.0f))), m_ProjectionMatrix(glm::perspective(glm::radians(40.0f) , (float)(1600/1200) , 0.1f , 100.0f)) { m_ViewProjectionMatrix = m_ProjectionMatrix * m_ViewMatrix; } void OrthographicCamera::SetProjection(float left, float right, float bottom, float top) { //m_ProjectionMatrix = glm::ortho(left, right, bottom, top, -1.0f, 1.0f); //m_ViewProjectionMatrix = m_ProjectionMatrix * m_ViewMatrix; } void OrthographicCamera::setViewMatrix(glm::mat4& view) { m_ViewMatrix = view; } void OrthographicCamera::RecalculateViewMatrix() { glm::mat4 transform = glm::translate(glm::mat4(1.0f), m_Position) * glm::rotate(glm::mat4(1.0f), glm::radians(m_Rotation), glm::vec3(0, 0, 1)); m_ViewMatrix = glm::inverse(transform); m_ViewProjectionMatrix = m_ProjectionMatrix * m_ViewMatrix; } }
; A070709: n^7 mod 28. ; 0,1,16,3,4,5,20,7,8,9,24,11,12,13,0,15,16,17,4,19,20,21,8,23,24,25,12,27,0,1,16,3,4,5,20,7,8,9,24,11,12,13,0,15,16,17,4,19,20,21,8,23,24,25,12,27,0,1,16,3,4,5,20,7,8,9,24,11,12,13,0,15,16,17,4,19,20,21,8,23,24 pow $0,7 mod $0,28
.global s_prepare_buffers s_prepare_buffers: push %r13 push %r9 push %rax push %rbp push %rbx push %rcx push %rdi push %rsi lea addresses_WC_ht+0x15a7d, %rbp nop nop nop sub $40790, %rax mov (%rbp), %rbx nop nop nop nop add $23978, %r13 lea addresses_D_ht+0xe4f9, %rsi lea addresses_A_ht+0x8c25, %rdi nop nop nop sub %r9, %r9 mov $126, %rcx rep movsq nop nop nop nop nop and $2364, %rax lea addresses_UC_ht+0x16695, %rsi lea addresses_A_ht+0x39e5, %rdi nop nop nop nop cmp %r9, %r9 mov $34, %rcx rep movsw nop cmp %rcx, %rcx lea addresses_A_ht+0x19765, %r9 nop sub %rcx, %rcx vmovups (%r9), %ymm3 vextracti128 $1, %ymm3, %xmm3 vpextrq $0, %xmm3, %r13 nop nop cmp %rax, %rax lea addresses_A_ht+0x1c571, %rsi lea addresses_normal_ht+0x29d5, %rdi clflush (%rdi) nop nop nop nop sub %r13, %r13 mov $7, %rcx rep movsb nop and %rsi, %rsi lea addresses_D_ht+0xf025, %rdi nop nop nop add $31171, %r9 mov $0x6162636465666768, %rcx movq %rcx, (%rdi) nop sub %rcx, %rcx lea addresses_UC_ht+0x10305, %rbx nop nop and %rsi, %rsi mov $0x6162636465666768, %r13 movq %r13, %xmm2 movups %xmm2, (%rbx) nop nop add %rbx, %rbx lea addresses_D_ht+0x9625, %rbp nop nop add %rsi, %rsi movw $0x6162, (%rbp) nop nop nop add $57480, %rsi lea addresses_A_ht+0x1127b, %rbx nop sub $16719, %r13 movw $0x6162, (%rbx) nop and $23882, %rdi lea addresses_UC_ht+0x18f35, %r13 nop nop xor %rbx, %rbx movups (%r13), %xmm7 vpextrq $1, %xmm7, %rdi nop nop nop nop and $39020, %rbp lea addresses_D_ht+0x1b025, %r9 nop nop nop nop add %rsi, %rsi vmovups (%r9), %ymm3 vextracti128 $1, %ymm3, %xmm3 vpextrq $1, %xmm3, %rdi nop nop nop dec %rbx lea addresses_UC_ht+0x1ce25, %rdi nop nop cmp $50160, %rax mov $0x6162636465666768, %rcx movq %rcx, %xmm3 vmovups %ymm3, (%rdi) nop nop nop nop add %rcx, %rcx lea addresses_normal_ht+0xd6e6, %rbx nop nop nop xor %rbp, %rbp mov (%rbx), %rax inc %r13 lea addresses_normal_ht+0xb1a5, %rsi lea addresses_UC_ht+0x1b134, %rdi nop add %rax, %rax mov $107, %rcx rep movsb nop nop nop nop dec %r9 lea addresses_WT_ht+0xb0ed, %rsi clflush (%rsi) nop nop nop sub $40040, %rbp movl $0x61626364, (%rsi) nop nop cmp %rdi, %rdi pop %rsi pop %rdi pop %rcx pop %rbx pop %rbp pop %rax pop %r9 pop %r13 ret .global s_faulty_load s_faulty_load: push %r10 push %r11 push %r15 push %r8 push %r9 push %rax push %rbx // Load lea addresses_normal+0xa6a5, %rax nop inc %r15 mov (%rax), %r11d nop nop nop nop nop dec %r10 // Store lea addresses_normal+0x12ea5, %r9 clflush (%r9) nop add $4104, %rbx mov $0x5152535455565758, %r10 movq %r10, (%r9) sub %r10, %r10 // Faulty Load lea addresses_US+0xe425, %rbx clflush (%rbx) sub $54555, %r11 movups (%rbx), %xmm4 vpextrq $0, %xmm4, %r9 lea oracles, %r11 and $0xff, %r9 shlq $12, %r9 mov (%r11,%r9,1), %r9 pop %rbx pop %rax pop %r9 pop %r8 pop %r15 pop %r11 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'size': 32, 'NT': False, 'type': 'addresses_US', 'same': False, 'AVXalign': False, 'congruent': 0}} {'OP': 'LOAD', 'src': {'size': 4, 'NT': False, 'type': 'addresses_normal', 'same': False, 'AVXalign': False, 'congruent': 7}} {'OP': 'STOR', 'dst': {'size': 8, 'NT': False, 'type': 'addresses_normal', 'same': False, 'AVXalign': False, 'congruent': 6}} [Faulty Load] {'OP': 'LOAD', 'src': {'size': 16, 'NT': False, 'type': 'addresses_US', 'same': True, 'AVXalign': False, 'congruent': 0}} <gen_prepare_buffer> {'OP': 'LOAD', 'src': {'size': 8, 'NT': False, 'type': 'addresses_WC_ht', 'same': False, 'AVXalign': False, 'congruent': 3}} {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_D_ht', 'congruent': 0}, 'dst': {'same': False, 'type': 'addresses_A_ht', 'congruent': 11}} {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_UC_ht', 'congruent': 3}, 'dst': {'same': False, 'type': 'addresses_A_ht', 'congruent': 6}} {'OP': 'LOAD', 'src': {'size': 32, 'NT': False, 'type': 'addresses_A_ht', 'same': True, 'AVXalign': False, 'congruent': 3}} {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_A_ht', 'congruent': 1}, 'dst': {'same': False, 'type': 'addresses_normal_ht', 'congruent': 0}} {'OP': 'STOR', 'dst': {'size': 8, 'NT': False, 'type': 'addresses_D_ht', 'same': False, 'AVXalign': False, 'congruent': 10}} {'OP': 'STOR', 'dst': {'size': 16, 'NT': False, 'type': 'addresses_UC_ht', 'same': False, 'AVXalign': False, 'congruent': 5}} {'OP': 'STOR', 'dst': {'size': 2, 'NT': False, 'type': 'addresses_D_ht', 'same': False, 'AVXalign': False, 'congruent': 8}} {'OP': 'STOR', 'dst': {'size': 2, 'NT': False, 'type': 'addresses_A_ht', 'same': False, 'AVXalign': False, 'congruent': 1}} {'OP': 'LOAD', 'src': {'size': 16, 'NT': False, 'type': 'addresses_UC_ht', 'same': False, 'AVXalign': False, 'congruent': 3}} {'OP': 'LOAD', 'src': {'size': 32, 'NT': False, 'type': 'addresses_D_ht', 'same': False, 'AVXalign': False, 'congruent': 9}} {'OP': 'STOR', 'dst': {'size': 32, 'NT': False, 'type': 'addresses_UC_ht', 'same': False, 'AVXalign': False, 'congruent': 7}} {'OP': 'LOAD', 'src': {'size': 8, 'NT': False, 'type': 'addresses_normal_ht', 'same': False, 'AVXalign': False, 'congruent': 0}} {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_normal_ht', 'congruent': 5}, 'dst': {'same': False, 'type': 'addresses_UC_ht', 'congruent': 0}} {'OP': 'STOR', 'dst': {'size': 4, 'NT': False, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': True, 'congruent': 2}} {'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 */
; A246456: a(n) = sigma(n + sigma(n)). ; 3,6,8,12,12,39,24,24,36,56,24,90,40,60,56,48,48,80,56,96,54,90,48,224,120,126,68,224,60,216,104,120,121,180,84,128,124,171,120,252,84,288,120,255,168,180,120,308,162,168,168,372,108,360,128,372,138,266 mov $2,$0 seq $0,203 ; a(n) = sigma(n), the sum of the divisors of n. Also called sigma_1(n). add $0,$2 seq $0,319528 ; a(n) = 8 * sigma(n). div $0,8
; A052254: Partial sums of A050406. ; 1,17,108,444,1410,3762,8844,18876,37323,69355,122408,206856,336804,531012,813960,1217064,1780053,2552517,3595636,4984100,6808230,9176310,12217140,16082820,20951775,27032031,34564752,43828048,55141064,68868360,85424592,105279504,128963241,157071993,190273980,229315788,275029066,328337594,390264732,461941260,544613619,639652563,748562232,872989656,1014734700,1175760460,1358204120,1564388280,1796832765,2058266925,2351642436,2680146612,3047216238,3456551934,3912133060,4418233172,4979436039,5600652231,6287136288,7044504480,7878753168,8796277776,9803892384,10908849952,12118863185,13442126049,14887335948,16463716572,18181041426,20049658050,22080512940,24285177180,26675872795,29265499835,32067664200,35096706216,38367729972,41896633428,45700139304,49795826760,54202163877,58938540949,64025304596,69483792708,75336370230,81606465798,88318609236,95498469924,103172896047,111369954735,120118973104,129450580208,139396749912,149990844696,161267660400,173263471920,186016079865,199564858185,213950802780,229216581100,245406582746,262566971082,280745735868,299992746924,320359808835,341900716707,364671312984,388729545336,414135525628,440951589980,469242359928,499074804696,530518304589,563644715517,598528434660,635246467284,673878494718,714506943502,757217055716,802096960500,849237746775,898733537175,950681563200,1005182241600,1062339252000,1122259615776,1185053776192,1250835679808,1319722859169,1391836516785,1467301610412,1546246939644,1628805233826,1715113241298,1805311819980,1899546029308,1997965223531,2100723146379,2207978027112,2319892677960,2436634592964,2558376048228,2685294203592,2817571205736,2955394292725,3098955900005,3248453767860,3404091050340,3566076425670,3734624208150,3909954461556,4092293114052,4281872074623,4478929351039,4683709169360,4896462094992,5117445155304,5346921963816,5585162845968,5832444966480,6089052458313,6355276553241,6631415714044,6917775768332,7214670044010,7522419506394,7841352896988,8171806873932,8514126154131,8868663657075,9235780650360,9615846896920,10009240803980,10416349573740,10837569355800,11273305401336,11723972219037,12189993732813,12671803441284,13169844579060,13684570279822,14216443741214,14765938391556,15333538058388,15919737138855,16525040771943,17149965012576,17795037007584,18460795173552,19147789376560,19856581113824,20587743697248,21341862438897,22119534838401,22921370772300,23747992685340,24600035783730,25478148230370,26382991342060,27315239788700,28275581794491,29264719341147,30283368373128,31332259004904,32412135730260,33523757633652,34667898603624,35845347548296,37056908612933,38303401399605,39585661188948,40904539164036,42260902636374,43655635274022,45089637331860,46563825884004,48079135058383,49636516273487,51236938477296,52881388388400,54570870739320,56306408522040,58089043235760,59919835136880,61799863491225,63730226828521,65712043199132,67746450433068,69834606401274,71977689279210,74176897812732,76433451586284,78748591293411,81123579009603,83559698467480,86058255334328,88620577491996,91248015319164,93941941975992,96703753691160,99534870051309,102436734292893,105410813596452,108458599383316,111581607614750,114781379093550,118059479768100,121417501038900,124857060067575,128379800088375 lpb $0,1 mov $2,$0 cal $2,50406 ; Partial sums of A051880. sub $0,1 add $1,$2 lpe add $1,1
;****************************************************************************** .define dir_reg, 0x00 .define port_reg, 0x01 .define pin_reg, 0x02 .define prescaler_l, 0x03 .define prescaler_h, 0x04 .define count_ctrl, 0x05 .define uart_baud, 0x0A .define uart_ctrl, 0x0B .define uart_buffer, 0x0C .define motor_control, 0x0D .define motor_enable, 0x0E .define servo, 0x11 .define gpu_addr, 0x2000 .define gpu_ctrl_reg, 0x80 ;****************************************************************************** .code ldi r0, 0b00011111 ; set all gpio to output out r0, dir_reg ldi r0, 128 out r0, servo ldi r0, 0b00000100 ; setup the gpu out r0, gpu_ctrl_reg ldi r2, gpu_addr[l] ; setup the pointer to the v-ram ldi r3, gpu_addr[h] ldi r0, 32 ; This clears the screen by filling ldi r8, 0x60 ; it up with spaces ldi r9, 0x09 clear: sri r0, p2 api p8, -1 cpi r9, 0 bnz clear cpi r8, 0 bnz clear ldi r2, gpu_addr[l] ; reset the pointer to the v-ram ldi r3, gpu_addr[h] ldi r0, 95 str r0, p2, 0 ; print the cursor ldi r4, 0 ; r4 is the column counter ldi r6, gpu_addr[l] ldi r7, gpu_addr[h] stable: in r0, gpu_ctrl_reg ; wait for gpu clock to become stable ani r0, 0x80 bz stable ldi r0, 8 ; set the baud rate to 115200 out r0, uart_baud ;****************************************************************************** loop1: in r0, uart_ctrl ; poll for full rx buffer ani r0, 1 bz loop1 in r0, uart_buffer ; capture the data loop2: in r1, uart_ctrl ; poll for empty tx buffer ani r1, 2 bz loop2 out r0, uart_buffer ; echo the char back over the uart out r0, port_reg ; write the data to the gpio port ;****************************************************************************** cpi r0, 8 ; check if delete was sent bz delete cpi r0, 10 ; check to see if a newline was sent bz nl br normal delete: ldi r0, 32 str r0, p6, 0 ; print space to remove cursor cpi r4, 0 bnz skip1 ldi r4, 79 ; set col counter to the end api p2, -80 br done1 skip1: adi r4, -1 ; move the col counter back one done1: mvp p6, p2 add r6, r4 ; calculate the new pointer part 1 aci r7, 0 ; calculate the new pointer part 2 ldi r0, 95 str r0, p6, 0 ; delete char and print cursor br loop1 nl: ldi r0, 32 str r0, p6, 0 ; print space to remove cursor ldi r4, 0 ; set col counter to the start api p2, 80 mvp p6, p2 ldi r0, 95 str r0, p6, 0 ; print cursor br loop1 normal: str r0, p6, 0 ; write the data to the screen cpi r4, 79 bnz skip2 ldi r4, 0 ; set col counter to the start api p2, 80 ; move down a row br done2 skip2: adi r4, 1 done2: mvp p6, p2 add r6, r4 ; calculate the new pointer part 1 aci r7, 0 ; calculate the new pointer part 2 ldi r0, 95 str r0, p6, 0 ; print cursor br loop1 ; go get another char ;******************************************************************************
#include "AppDelegate.h" #include "cocos2d.h" #include "platform/android/jni/JniHelper.h" #include <jni.h> #include <android/log.h> #include "runtime/ConfigParser.h" #include "ide-support/CodeIDESupport.h" #define LOG_TAG "main" #define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG,LOG_TAG,__VA_ARGS__) using namespace cocos2d; void cocos_android_app_init (JNIEnv* env, jobject thiz) { LOGD("cocos_android_app_init"); AppDelegate *pAppDelegate = new AppDelegate(); } extern "C" { bool Java_org_cocos2dx_lua_AppActivity_nativeIsLandScape(JNIEnv *env, jobject thisz) { return ConfigParser::getInstance()->isLanscape(); } bool Java_org_cocos2dx_lua_AppActivity_nativeIsDebug(JNIEnv *env, jobject thisz) { #if (COCOS2D_DEBUG > 0) && (CC_CODE_IDE_DEBUG_SUPPORT > 0) return true; #else return false; #endif } }
.text .globl main main: li $v0, 5 syscall move $t0, $v0 li $v0, 5 syscall ble $v0, $t0, next move $t0, $v0 next: li $v0, 5 syscall ble $v0, $t0, fine move $t0, $v0 fine: li $v0, 10 syscall .data