text
stringlengths
1
1.05M
db DEX_KABUTOPS ; pokedex id db 60, 115, 105, 80, 70 ; hp atk def spd spc db ROCK, WATER ; type db 45 ; catch rate db 201 ; base exp INCBIN "gfx/pokemon/front/kabutops.pic", 0, 1 ; sprite dimensions dw KabutopsPicFront, KabutopsPicBack db SCRATCH, HARDEN, ABSORB, NO_MOVE ; level 1 learnset db GROWTH_MEDIUM_FAST ; growth rate ; tm/hm learnset tmhm RAZOR_WIND, SWORDS_DANCE, MEGA_KICK, TOXIC, BODY_SLAM, \ TAKE_DOWN, DOUBLE_EDGE, BUBBLEBEAM, WATER_GUN, ICE_BEAM, \ BLIZZARD, HYPER_BEAM, SUBMISSION, SEISMIC_TOSS, RAGE, \ MIMIC, DOUBLE_TEAM, REFLECT, BIDE, SKULL_BASH, \ REST, SUBSTITUTE, SURF ; end db 0 ; padding
; A154127: Period 6: repeat [1, 2, 5, 8, 7, 4]. ; 1,2,5,8,7,4,1,2,5,8,7,4,1,2,5,8,7,4,1,2,5,8,7,4,1,2,5,8,7,4,1,2,5,8,7,4,1,2,5,8,7,4,1,2,5,8,7,4,1,2,5,8,7,4,1,2,5,8,7,4,1,2,5,8,7,4,1,2,5,8,7,4,1,2,5,8,7,4,1,2,5,8,7,4,1,2 lpb $0,1 sub $0,6 lpe mul $0,9 sub $0,3 gcd $1,$0 sub $1,3 div $1,3 add $1,1
;; ;; Copyright (c) Microsoft. All rights reserved. ;; Licensed under the MIT license. See LICENSE file in the project root for full license information. ;; #include "AsmMacros.h" TEXTAREA ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; RhpGetThread ;; ;; ;; INPUT: none ;; ;; OUTPUT: r0: Thread pointer ;; ;; MUST PRESERVE ARGUMENT REGISTERS ;; @todo check the actual requirements here, r0 is both return and argument register ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; LEAF_ENTRY RhpGetThread ;; r0 = GetThread(), TRASHES r12 INLINE_GETTHREAD r0, r12 bx lr LEAF_END FASTCALL_ENDFUNC end
; A266397: Number of orbits of Aut(Z^7) as function of the infinity norm n of the representative lattice point of the orbit, when the cardinality of the orbit is equal to 26880. ; 0,0,9,31,70,130,215,329,476,660,885,1155,1474,1846,2275,2765,3320,3944,4641,5415,6270,7210,8239,9361,10580,11900,13325,14859,16506,18270,20155,22165,24304,26576,28985,31535,34230,37074,40071,43225,46540,50020,53669,57491,61490,65670,70035,74589,79336,84280,89425,94775,100334,106106,112095,118305,124740,131404,138301,145435,152810,160430,168299,176421,184800,193440,202345,211519,220966,230690,240695,250985,261564,272436,283605,295075,306850,318934,331331,344045,357080,370440,384129,398151,412510,427210,442255,457649,473396,489500,505965,522795,539994,557566,575515,593845,612560,631664,651161,671055,691350,712050,733159,754681,776620,798980,821765,844979,868626,892710,917235,942205,967624,993496,1019825,1046615,1073870,1101594,1129791,1158465,1187620,1217260,1247389,1278011,1309130,1340750,1372875,1405509,1438656,1472320,1506505,1541215,1576454,1612226,1648535,1685385,1722780,1760724,1799221,1838275,1877890,1918070,1958819,2000141,2042040,2084520,2127585,2171239,2215486,2260330,2305775,2351825,2398484,2445756,2493645,2542155,2591290,2641054,2691451,2742485,2794160,2846480,2899449,2953071,3007350,3062290,3117895,3174169,3231116,3288740,3347045,3406035,3465714,3526086,3587155,3648925,3711400,3774584,3838481,3903095,3968430,4034490,4101279,4168801,4237060,4306060,4375805,4446299,4517546,4589550,4662315,4735845,4810144,4885216,4961065,5037695,5115110,5193314,5272311,5352105,5432700,5514100,5596309,5679331,5763170,5847830,5933315,6019629,6106776,6194760,6283585,6373255,6463774,6555146,6647375,6740465,6834420,6929244,7024941,7121515,7218970,7317310,7416539,7516661,7617680,7719600,7822425,7926159,8030806,8136370,8242855,8350265,8458604,8567876,8678085,8789235,8901330,9014374,9128371,9243325,9359240,9476120,9593969,9712791,9832590,9953370,10075135,10197889,10321636,10446380 lpb $0,1 sub $0,1 add $1,$2 add $3,4 add $2,$3 add $2,5 lpe
// Copyright 2013 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 "ppapi/proxy/tcp_socket_resource_base.h" #include <cstring> #include "base/bind.h" #include "base/logging.h" #include "ppapi/c/pp_bool.h" #include "ppapi/c/pp_errors.h" #include "ppapi/proxy/error_conversion.h" #include "ppapi/proxy/ppapi_messages.h" #include "ppapi/shared_impl/ppapi_globals.h" #include "ppapi/shared_impl/private/ppb_x509_certificate_private_shared.h" #include "ppapi/shared_impl/socket_option_data.h" #include "ppapi/shared_impl/var.h" #include "ppapi/shared_impl/var_tracker.h" #include "ppapi/thunk/enter.h" #include "ppapi/thunk/ppb_x509_certificate_private_api.h" namespace ppapi { namespace proxy { const int32_t TCPSocketResourceBase::kMaxReadSize = 1024 * 1024; const int32_t TCPSocketResourceBase::kMaxWriteSize = 1024 * 1024; const int32_t TCPSocketResourceBase::kMaxSendBufferSize = 1024 * TCPSocketResourceBase::kMaxWriteSize; const int32_t TCPSocketResourceBase::kMaxReceiveBufferSize = 1024 * TCPSocketResourceBase::kMaxReadSize; TCPSocketResourceBase::TCPSocketResourceBase(Connection connection, PP_Instance instance, TCPSocketVersion version) : PluginResource(connection, instance), state_(TCPSocketState::INITIAL), read_buffer_(NULL), bytes_to_read_(-1), accepted_tcp_socket_(NULL), version_(version) { local_addr_.size = 0; memset(local_addr_.data, 0, arraysize(local_addr_.data) * sizeof(*local_addr_.data)); remote_addr_.size = 0; memset(remote_addr_.data, 0, arraysize(remote_addr_.data) * sizeof(*remote_addr_.data)); } TCPSocketResourceBase::TCPSocketResourceBase( Connection connection, PP_Instance instance, TCPSocketVersion version, const PP_NetAddress_Private& local_addr, const PP_NetAddress_Private& remote_addr) : PluginResource(connection, instance), state_(TCPSocketState::CONNECTED), read_buffer_(NULL), bytes_to_read_(-1), local_addr_(local_addr), remote_addr_(remote_addr), accepted_tcp_socket_(NULL), version_(version) { } TCPSocketResourceBase::~TCPSocketResourceBase() { CloseImpl(); } int32_t TCPSocketResourceBase::BindImpl( const PP_NetAddress_Private* addr, scoped_refptr<TrackedCallback> callback) { if (!addr) return PP_ERROR_BADARGUMENT; if (state_.IsPending(TCPSocketState::BIND)) return PP_ERROR_INPROGRESS; if (!state_.IsValidTransition(TCPSocketState::BIND)) return PP_ERROR_FAILED; bind_callback_ = callback; state_.SetPendingTransition(TCPSocketState::BIND); Call<PpapiPluginMsg_TCPSocket_BindReply>( BROWSER, PpapiHostMsg_TCPSocket_Bind(*addr), base::Bind(&TCPSocketResourceBase::OnPluginMsgBindReply, base::Unretained(this)), callback); return PP_OK_COMPLETIONPENDING; } int32_t TCPSocketResourceBase::ConnectImpl( const char* host, uint16_t port, scoped_refptr<TrackedCallback> callback) { if (!host) return PP_ERROR_BADARGUMENT; if (state_.IsPending(TCPSocketState::CONNECT)) return PP_ERROR_INPROGRESS; if (!state_.IsValidTransition(TCPSocketState::CONNECT)) return PP_ERROR_FAILED; connect_callback_ = callback; state_.SetPendingTransition(TCPSocketState::CONNECT); Call<PpapiPluginMsg_TCPSocket_ConnectReply>( BROWSER, PpapiHostMsg_TCPSocket_Connect(host, port), base::Bind(&TCPSocketResourceBase::OnPluginMsgConnectReply, base::Unretained(this)), callback); return PP_OK_COMPLETIONPENDING; } int32_t TCPSocketResourceBase::ConnectWithNetAddressImpl( const PP_NetAddress_Private* addr, scoped_refptr<TrackedCallback> callback) { if (!addr) return PP_ERROR_BADARGUMENT; if (state_.IsPending(TCPSocketState::CONNECT)) return PP_ERROR_INPROGRESS; if (!state_.IsValidTransition(TCPSocketState::CONNECT)) return PP_ERROR_FAILED; connect_callback_ = callback; state_.SetPendingTransition(TCPSocketState::CONNECT); Call<PpapiPluginMsg_TCPSocket_ConnectReply>( BROWSER, PpapiHostMsg_TCPSocket_ConnectWithNetAddress(*addr), base::Bind(&TCPSocketResourceBase::OnPluginMsgConnectReply, base::Unretained(this)), callback); return PP_OK_COMPLETIONPENDING; } PP_Bool TCPSocketResourceBase::GetLocalAddressImpl( PP_NetAddress_Private* local_addr) { if (!state_.IsBound() || !local_addr) return PP_FALSE; *local_addr = local_addr_; return PP_TRUE; } PP_Bool TCPSocketResourceBase::GetRemoteAddressImpl( PP_NetAddress_Private* remote_addr) { if (!state_.IsConnected() || !remote_addr) return PP_FALSE; *remote_addr = remote_addr_; return PP_TRUE; } int32_t TCPSocketResourceBase::SSLHandshakeImpl( const char* server_name, uint16_t server_port, scoped_refptr<TrackedCallback> callback) { if (!server_name) return PP_ERROR_BADARGUMENT; if (state_.IsPending(TCPSocketState::SSL_CONNECT) || TrackedCallback::IsPending(read_callback_) || TrackedCallback::IsPending(write_callback_)) { return PP_ERROR_INPROGRESS; } if (!state_.IsValidTransition(TCPSocketState::SSL_CONNECT)) return PP_ERROR_FAILED; ssl_handshake_callback_ = callback; state_.SetPendingTransition(TCPSocketState::SSL_CONNECT); Call<PpapiPluginMsg_TCPSocket_SSLHandshakeReply>( BROWSER, PpapiHostMsg_TCPSocket_SSLHandshake(server_name, server_port, trusted_certificates_, untrusted_certificates_), base::Bind(&TCPSocketResourceBase::OnPluginMsgSSLHandshakeReply, base::Unretained(this)), callback); return PP_OK_COMPLETIONPENDING; } PP_Resource TCPSocketResourceBase::GetServerCertificateImpl() { if (!server_certificate_.get()) return 0; return server_certificate_->GetReference(); } PP_Bool TCPSocketResourceBase::AddChainBuildingCertificateImpl( PP_Resource certificate, PP_Bool trusted) { // TODO(raymes): The plumbing for this functionality is implemented but the // certificates aren't yet used for the connection, so just return false for // now. return PP_FALSE; thunk::EnterResourceNoLock<thunk::PPB_X509Certificate_Private_API> enter_cert(certificate, true); if (enter_cert.failed()) return PP_FALSE; PP_Var der_var = enter_cert.object()->GetField( PP_X509CERTIFICATE_PRIVATE_RAW); ArrayBufferVar* der_array_buffer = ArrayBufferVar::FromPPVar(der_var); PP_Bool success = PP_FALSE; if (der_array_buffer) { const char* der_bytes = static_cast<const char*>(der_array_buffer->Map()); uint32_t der_length = der_array_buffer->ByteLength(); std::vector<char> der(der_bytes, der_bytes + der_length); if (PP_ToBool(trusted)) trusted_certificates_.push_back(der); else untrusted_certificates_.push_back(der); success = PP_TRUE; } PpapiGlobals::Get()->GetVarTracker()->ReleaseVar(der_var); return success; } int32_t TCPSocketResourceBase::ReadImpl( char* buffer, int32_t bytes_to_read, scoped_refptr<TrackedCallback> callback) { if (!buffer || bytes_to_read <= 0) return PP_ERROR_BADARGUMENT; if (!state_.IsConnected()) return PP_ERROR_FAILED; if (TrackedCallback::IsPending(read_callback_) || state_.IsPending(TCPSocketState::SSL_CONNECT)) return PP_ERROR_INPROGRESS; read_buffer_ = buffer; bytes_to_read_ = std::min(bytes_to_read, kMaxReadSize); read_callback_ = callback; Call<PpapiPluginMsg_TCPSocket_ReadReply>( BROWSER, PpapiHostMsg_TCPSocket_Read(bytes_to_read_), base::Bind(&TCPSocketResourceBase::OnPluginMsgReadReply, base::Unretained(this)), callback); return PP_OK_COMPLETIONPENDING; } int32_t TCPSocketResourceBase::WriteImpl( const char* buffer, int32_t bytes_to_write, scoped_refptr<TrackedCallback> callback) { if (!buffer || bytes_to_write <= 0) return PP_ERROR_BADARGUMENT; if (!state_.IsConnected()) return PP_ERROR_FAILED; if (TrackedCallback::IsPending(write_callback_) || state_.IsPending(TCPSocketState::SSL_CONNECT)) return PP_ERROR_INPROGRESS; if (bytes_to_write > kMaxWriteSize) bytes_to_write = kMaxWriteSize; write_callback_ = callback; Call<PpapiPluginMsg_TCPSocket_WriteReply>( BROWSER, PpapiHostMsg_TCPSocket_Write(std::string(buffer, bytes_to_write)), base::Bind(&TCPSocketResourceBase::OnPluginMsgWriteReply, base::Unretained(this)), callback); return PP_OK_COMPLETIONPENDING; } int32_t TCPSocketResourceBase::ListenImpl( int32_t backlog, scoped_refptr<TrackedCallback> callback) { if (backlog <= 0) return PP_ERROR_BADARGUMENT; if (state_.IsPending(TCPSocketState::LISTEN)) return PP_ERROR_INPROGRESS; if (!state_.IsValidTransition(TCPSocketState::LISTEN)) return PP_ERROR_FAILED; listen_callback_ = callback; state_.SetPendingTransition(TCPSocketState::LISTEN); Call<PpapiPluginMsg_TCPSocket_ListenReply>( BROWSER, PpapiHostMsg_TCPSocket_Listen(backlog), base::Bind(&TCPSocketResourceBase::OnPluginMsgListenReply, base::Unretained(this)), callback); return PP_OK_COMPLETIONPENDING; } int32_t TCPSocketResourceBase::AcceptImpl( PP_Resource* accepted_tcp_socket, scoped_refptr<TrackedCallback> callback) { if (!accepted_tcp_socket) return PP_ERROR_BADARGUMENT; if (TrackedCallback::IsPending(accept_callback_)) return PP_ERROR_INPROGRESS; if (state_.state() != TCPSocketState::LISTENING) return PP_ERROR_FAILED; accept_callback_ = callback; accepted_tcp_socket_ = accepted_tcp_socket; Call<PpapiPluginMsg_TCPSocket_AcceptReply>( BROWSER, PpapiHostMsg_TCPSocket_Accept(), base::Bind(&TCPSocketResourceBase::OnPluginMsgAcceptReply, base::Unretained(this)), callback); return PP_OK_COMPLETIONPENDING; } void TCPSocketResourceBase::CloseImpl() { if (state_.state() == TCPSocketState::CLOSED) return; state_.DoTransition(TCPSocketState::CLOSE, true); Post(BROWSER, PpapiHostMsg_TCPSocket_Close()); PostAbortIfNecessary(&bind_callback_); PostAbortIfNecessary(&connect_callback_); PostAbortIfNecessary(&ssl_handshake_callback_); PostAbortIfNecessary(&read_callback_); PostAbortIfNecessary(&write_callback_); PostAbortIfNecessary(&listen_callback_); PostAbortIfNecessary(&accept_callback_); read_buffer_ = NULL; bytes_to_read_ = -1; server_certificate_ = NULL; accepted_tcp_socket_ = NULL; } int32_t TCPSocketResourceBase::SetOptionImpl( PP_TCPSocket_Option name, const PP_Var& value, scoped_refptr<TrackedCallback> callback) { SocketOptionData option_data; switch (name) { case PP_TCPSOCKET_OPTION_NO_DELAY: { if (!state_.IsConnected()) return PP_ERROR_FAILED; if (value.type != PP_VARTYPE_BOOL) return PP_ERROR_BADARGUMENT; option_data.SetBool(PP_ToBool(value.value.as_bool)); break; } case PP_TCPSOCKET_OPTION_SEND_BUFFER_SIZE: case PP_TCPSOCKET_OPTION_RECV_BUFFER_SIZE: { if (!state_.IsConnected()) return PP_ERROR_FAILED; if (value.type != PP_VARTYPE_INT32) return PP_ERROR_BADARGUMENT; option_data.SetInt32(value.value.as_int); break; } default: { NOTREACHED(); return PP_ERROR_BADARGUMENT; } } set_option_callbacks_.push(callback); Call<PpapiPluginMsg_TCPSocket_SetOptionReply>( BROWSER, PpapiHostMsg_TCPSocket_SetOption(name, option_data), base::Bind(&TCPSocketResourceBase::OnPluginMsgSetOptionReply, base::Unretained(this)), callback); return PP_OK_COMPLETIONPENDING; } void TCPSocketResourceBase::PostAbortIfNecessary( scoped_refptr<TrackedCallback>* callback) { if (TrackedCallback::IsPending(*callback)) (*callback)->PostAbort(); } void TCPSocketResourceBase::OnPluginMsgBindReply( const ResourceMessageReplyParams& params, const PP_NetAddress_Private& local_addr) { // It is possible that CloseImpl() has been called. We don't want to update // class members in this case. if (!state_.IsPending(TCPSocketState::BIND)) return; DCHECK(TrackedCallback::IsPending(bind_callback_)); if (params.result() == PP_OK) { local_addr_ = local_addr; state_.CompletePendingTransition(true); } else { state_.CompletePendingTransition(false); } RunCallback(bind_callback_, params.result()); } void TCPSocketResourceBase::OnPluginMsgConnectReply( const ResourceMessageReplyParams& params, const PP_NetAddress_Private& local_addr, const PP_NetAddress_Private& remote_addr) { // It is possible that CloseImpl() has been called. We don't want to update // class members in this case. if (!state_.IsPending(TCPSocketState::CONNECT)) return; DCHECK(TrackedCallback::IsPending(connect_callback_)); if (params.result() == PP_OK) { local_addr_ = local_addr; remote_addr_ = remote_addr; state_.CompletePendingTransition(true); } else { if (version_ == TCP_SOCKET_VERSION_1_1_OR_ABOVE) { state_.CompletePendingTransition(false); } else { // In order to maintain backward compatibility, allow to connect the // socket again. state_ = TCPSocketState(TCPSocketState::INITIAL); } } RunCallback(connect_callback_, params.result()); } void TCPSocketResourceBase::OnPluginMsgSSLHandshakeReply( const ResourceMessageReplyParams& params, const PPB_X509Certificate_Fields& certificate_fields) { // It is possible that CloseImpl() has been called. We don't want to // update class members in this case. if (!state_.IsPending(TCPSocketState::SSL_CONNECT)) return; DCHECK(TrackedCallback::IsPending(ssl_handshake_callback_)); if (params.result() == PP_OK) { state_.CompletePendingTransition(true); server_certificate_ = new PPB_X509Certificate_Private_Shared( OBJECT_IS_PROXY, pp_instance(), certificate_fields); } else { state_.CompletePendingTransition(false); } RunCallback(ssl_handshake_callback_, params.result()); } void TCPSocketResourceBase::OnPluginMsgReadReply( const ResourceMessageReplyParams& params, const std::string& data) { // It is possible that CloseImpl() has been called. We shouldn't access the // buffer in that case. The user may have released it. if (!state_.IsConnected() || !TrackedCallback::IsPending(read_callback_) || !read_buffer_) { return; } const bool succeeded = params.result() == PP_OK; if (succeeded) { CHECK_LE(static_cast<int32_t>(data.size()), bytes_to_read_); if (!data.empty()) memmove(read_buffer_, data.c_str(), data.size()); } read_buffer_ = NULL; bytes_to_read_ = -1; RunCallback(read_callback_, succeeded ? static_cast<int32_t>(data.size()) : params.result()); } void TCPSocketResourceBase::OnPluginMsgWriteReply( const ResourceMessageReplyParams& params) { if (!state_.IsConnected() || !TrackedCallback::IsPending(write_callback_)) return; RunCallback(write_callback_, params.result()); } void TCPSocketResourceBase::OnPluginMsgListenReply( const ResourceMessageReplyParams& params) { if (!state_.IsPending(TCPSocketState::LISTEN)) return; DCHECK(TrackedCallback::IsPending(listen_callback_)); state_.CompletePendingTransition(params.result() == PP_OK); RunCallback(listen_callback_, params.result()); } void TCPSocketResourceBase::OnPluginMsgAcceptReply( const ResourceMessageReplyParams& params, int pending_host_id, const PP_NetAddress_Private& local_addr, const PP_NetAddress_Private& remote_addr) { // It is possible that CloseImpl() has been called. We shouldn't access the // output parameter in that case. The user may have released it. if (state_.state() != TCPSocketState::LISTENING || !TrackedCallback::IsPending(accept_callback_) || !accepted_tcp_socket_) { return; } if (params.result() == PP_OK) { *accepted_tcp_socket_ = CreateAcceptedSocket(pending_host_id, local_addr, remote_addr); } accepted_tcp_socket_ = NULL; RunCallback(accept_callback_, params.result()); } void TCPSocketResourceBase::OnPluginMsgSetOptionReply( const ResourceMessageReplyParams& params) { if (set_option_callbacks_.empty()) { NOTREACHED(); return; } scoped_refptr<TrackedCallback> callback = set_option_callbacks_.front(); set_option_callbacks_.pop(); if (TrackedCallback::IsPending(callback)) RunCallback(callback, params.result()); } void TCPSocketResourceBase::RunCallback(scoped_refptr<TrackedCallback> callback, int32_t pp_result) { callback->Run(ConvertNetworkAPIErrorForCompatibility( pp_result, version_ == TCP_SOCKET_VERSION_PRIVATE)); } } // namespace ppapi } // namespace proxy
#include "IniConfigurationSourceFactory.hpp" #include "IniConfigurationSource.hpp" namespace IniConfigurationPlugin { const NOU::NOU_DAT_ALG::StringView8 IniConfigurationSourceFactory::EXTENSION = "ini"; const NOU::NOU_DAT_ALG::StringView8& IniConfigurationSourceFactory::getAssociatedExtension() const { return EXTENSION; } NOE::NOE_CORE::ConfigurationSource* IniConfigurationSourceFactory::build(const NOU::NOU_FILE_MNGT::Path &path) { return NOE::NOE_CORE::ConfigurationSourceFactory::allocateSource<IniConfigurationSource>(path); } }
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r12 push %r13 push %r15 push %rbx push %rcx push %rdi push %rsi lea addresses_normal_ht+0x1c963, %rbx nop nop nop add %rdi, %rdi movups (%rbx), %xmm1 vpextrq $0, %xmm1, %r15 nop nop nop nop xor %rcx, %rcx lea addresses_D_ht+0x1336b, %r10 nop nop nop nop nop add %rdi, %rdi movl $0x61626364, (%r10) nop nop nop sub $13565, %rdi lea addresses_A_ht+0xae6b, %rsi lea addresses_WC_ht+0x968b, %rdi nop nop nop and %r13, %r13 mov $107, %rcx rep movsw nop nop nop add $28281, %r13 lea addresses_WC_ht+0x5ba, %rsi lea addresses_WT_ht+0xda7b, %rdi nop nop xor $10290, %r12 mov $123, %rcx rep movsb nop xor $21770, %r13 lea addresses_WT_ht+0x338b, %rcx nop and $146, %r15 mov $0x6162636465666768, %r10 movq %r10, (%rcx) nop nop nop inc %r13 lea addresses_WT_ht+0x838b, %r15 nop nop nop nop xor %rbx, %rbx mov $0x6162636465666768, %rdi movq %rdi, %xmm1 vmovups %ymm1, (%r15) nop nop nop sub $44237, %rbx lea addresses_UC_ht+0xa837, %r12 nop nop nop nop add %r10, %r10 movw $0x6162, (%r12) cmp %r12, %r12 lea addresses_WC_ht+0x5a4b, %rsi lea addresses_D_ht+0x5f2b, %rdi nop nop add %r10, %r10 mov $99, %rcx rep movsq nop nop nop nop nop sub %rdi, %rdi lea addresses_WT_ht+0x14a1b, %rsi lea addresses_UC_ht+0xac8b, %rdi clflush (%rsi) nop nop nop nop inc %rbx mov $78, %rcx rep movsw nop nop nop dec %r10 lea addresses_UC_ht+0x1948b, %r13 nop nop nop sub $47165, %r10 movw $0x6162, (%r13) nop and $46174, %rsi lea addresses_normal_ht+0x368b, %r15 nop nop nop nop nop dec %rsi movl $0x61626364, (%r15) sub %r10, %r10 lea addresses_normal_ht+0x23db, %r10 nop cmp %rsi, %rsi mov (%r10), %r13 nop inc %r12 lea addresses_UC_ht+0x500b, %rsi lea addresses_normal_ht+0xe38b, %rdi nop nop nop nop dec %r12 mov $98, %rcx rep movsw nop nop nop nop cmp %rdi, %rdi lea addresses_WT_ht+0x5d8b, %rcx nop nop nop nop nop sub $15567, %r15 movl $0x61626364, (%rcx) nop nop nop nop inc %rdi pop %rsi pop %rdi pop %rcx pop %rbx pop %r15 pop %r13 pop %r12 pop %r10 ret .global s_faulty_load s_faulty_load: push %r12 push %r14 push %r9 push %rax push %rcx push %rdi push %rsi // REPMOV lea addresses_WC+0x13f4b, %rsi lea addresses_normal+0xb8b, %rdi nop nop nop nop sub $60504, %r9 mov $83, %rcx rep movsq xor $18177, %r9 // Load mov $0x117bfd0000000a8b, %r14 clflush (%r14) nop xor $41050, %rax mov (%r14), %r12d nop nop nop nop dec %r9 // Store mov $0x5ab0af00000008b7, %rsi xor $971, %rdi movw $0x5152, (%rsi) nop nop nop nop nop sub %rdi, %rdi // Store mov $0x2bb9a4000000098b, %rax nop nop nop nop inc %rsi movw $0x5152, (%rax) nop nop nop nop nop add %r12, %r12 // Faulty Load lea addresses_D+0x12b8b, %rdi nop cmp $29625, %r12 movaps (%rdi), %xmm6 vpextrq $1, %xmm6, %rcx lea oracles, %r9 and $0xff, %rcx shlq $12, %rcx mov (%r9,%rcx,1), %rcx pop %rsi pop %rdi pop %rcx pop %rax pop %r9 pop %r14 pop %r12 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 1, 'type': 'addresses_D', 'congruent': 0}} {'dst': {'same': False, 'congruent': 11, 'type': 'addresses_normal'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 6, 'type': 'addresses_WC'}} {'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_NC', 'congruent': 7}} {'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 2, 'type': 'addresses_NC', 'congruent': 0}, 'OP': 'STOR'} {'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 2, 'type': 'addresses_NC', 'congruent': 9}, 'OP': 'STOR'} [Faulty Load] {'OP': 'LOAD', 'src': {'same': True, 'NT': True, 'AVXalign': True, 'size': 16, 'type': 'addresses_D', 'congruent': 0}} <gen_prepare_buffer> {'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 16, 'type': 'addresses_normal_ht', 'congruent': 2}} {'dst': {'same': False, 'NT': False, 'AVXalign': True, 'size': 4, 'type': 'addresses_D_ht', 'congruent': 4}, 'OP': 'STOR'} {'dst': {'same': False, 'congruent': 7, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 4, 'type': 'addresses_A_ht'}} {'dst': {'same': False, 'congruent': 4, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 0, 'type': 'addresses_WC_ht'}} {'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_WT_ht', 'congruent': 11}, 'OP': 'STOR'} {'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_WT_ht', 'congruent': 10}, 'OP': 'STOR'} {'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 2, 'type': 'addresses_UC_ht', 'congruent': 0}, 'OP': 'STOR'} {'dst': {'same': True, 'congruent': 4, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 5, 'type': 'addresses_WC_ht'}} {'dst': {'same': False, 'congruent': 8, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 4, 'type': 'addresses_WT_ht'}} {'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 2, 'type': 'addresses_UC_ht', 'congruent': 8}, 'OP': 'STOR'} {'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_normal_ht', 'congruent': 7}, 'OP': 'STOR'} {'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_normal_ht', 'congruent': 4}} {'dst': {'same': True, 'congruent': 11, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 5, 'type': 'addresses_UC_ht'}} {'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_WT_ht', 'congruent': 8}, 'OP': 'STOR'} {'45': 21, '44': 9, '48': 487, '49': 102, '38': 12408, '00': 8802} 38 00 38 00 38 38 38 00 38 00 00 38 38 38 38 00 38 00 00 38 38 38 38 38 38 38 38 00 00 00 38 00 38 00 00 00 38 38 48 38 38 38 38 00 00 38 00 00 38 38 38 38 38 38 38 00 38 38 38 38 00 38 00 00 38 38 48 00 38 38 00 00 00 38 38 00 00 38 38 38 38 38 38 38 38 00 38 38 38 38 38 00 38 38 38 38 00 38 38 38 38 38 38 00 38 48 38 38 38 38 38 00 38 38 38 00 00 00 38 38 38 38 00 38 00 38 00 38 38 00 38 48 38 38 00 00 00 38 38 38 38 38 00 00 38 38 00 38 38 00 00 38 38 38 00 00 38 00 38 38 38 38 48 38 00 00 38 00 38 00 00 38 00 00 00 38 48 00 38 38 00 38 00 38 38 00 38 00 38 00 38 38 00 38 00 00 00 00 00 00 00 38 00 00 38 38 38 38 38 38 38 00 38 00 38 38 00 38 00 38 38 38 00 38 38 00 38 00 00 00 38 38 38 38 38 38 48 38 00 38 00 00 38 38 38 00 00 38 38 38 48 00 00 38 00 00 38 00 00 38 00 00 00 38 38 38 00 38 38 38 38 00 38 00 38 38 38 38 38 38 00 38 00 38 00 00 38 38 00 38 38 38 38 38 38 38 00 00 00 38 00 00 38 38 38 38 00 38 00 00 00 00 38 38 38 38 38 00 48 38 00 00 38 38 38 38 00 00 00 00 38 38 38 38 38 00 38 00 38 00 38 38 00 00 00 38 38 00 00 00 38 00 00 38 00 00 00 38 38 00 38 49 38 00 00 38 00 38 00 00 38 38 38 00 38 48 00 38 38 38 38 00 38 00 00 38 00 38 00 00 00 00 38 38 00 00 00 00 00 38 38 38 38 00 00 38 00 00 38 00 38 38 00 38 38 38 38 38 38 38 00 00 00 00 00 38 38 38 38 38 00 00 38 38 38 38 38 00 38 38 48 38 00 38 38 38 00 38 00 38 00 00 38 00 00 38 38 38 00 38 00 00 00 38 00 00 00 00 00 00 38 38 38 00 38 38 00 00 38 38 00 38 38 38 38 48 38 38 38 00 00 00 00 00 38 00 00 00 38 38 38 38 38 48 38 00 38 38 00 00 38 38 38 38 00 38 38 38 00 38 38 38 00 38 00 38 00 38 00 00 00 00 00 38 00 00 00 00 38 00 38 38 00 38 38 38 00 00 38 38 38 38 48 38 38 38 38 00 00 38 38 38 00 38 48 38 00 38 38 38 38 00 00 00 00 38 38 38 00 38 38 00 38 00 38 00 00 38 38 00 38 38 00 38 00 38 38 00 38 00 38 00 38 38 00 38 49 38 38 00 00 38 38 00 38 00 38 00 38 00 38 38 38 38 38 00 38 38 00 38 38 00 38 38 38 00 38 00 00 00 38 00 00 00 38 00 00 38 38 38 38 38 38 38 38 38 38 00 38 00 38 38 38 38 48 00 00 38 38 38 38 38 00 00 00 38 38 48 00 38 38 38 38 00 00 00 00 00 38 38 38 38 38 38 00 38 38 38 00 00 00 00 38 38 38 38 38 38 38 38 00 00 00 00 00 38 38 38 00 38 48 38 00 38 38 38 38 00 00 38 38 38 38 38 00 00 38 38 38 38 38 38 00 00 00 00 38 00 38 48 38 38 38 38 00 38 38 00 00 38 00 38 00 38 00 38 38 38 38 00 38 38 00 38 38 00 38 38 38 38 38 38 38 38 00 38 38 38 00 38 49 00 00 38 00 38 38 38 38 00 38 00 00 38 38 38 38 48 38 38 38 38 38 00 38 38 00 38 38 38 38 38 38 00 00 00 38 38 00 00 00 38 38 00 38 38 00 38 00 38 00 38 00 38 38 38 00 38 48 38 38 38 00 00 00 00 38 38 38 00 38 00 38 00 00 00 38 00 38 38 38 38 38 38 38 38 48 00 38 38 38 38 38 00 00 38 38 00 38 00 38 38 38 00 38 38 38 38 00 00 00 38 38 00 38 38 00 38 00 00 38 38 00 00 00 38 38 00 00 38 00 38 00 38 38 38 38 38 38 00 00 38 00 00 38 38 38 38 00 38 38 00 00 38 00 00 38 38 38 38 38 00 00 00 38 00 38 00 00 38 38 00 38 38 38 38 00 38 38 38 38 00 38 38 00 38 38 48 38 38 00 38 38 00 38 38 00 00 38 00 38 00 48 00 00 38 38 38 38 38 */
; Top-hole Golf ; Copyright 2020-2021 Matthew Clarke waypts_c_BEGIN = * ; ***************** ; *** CONSTANTS *** ; ***************** WAYPTS_MAX = 3 ; ***************** ; *** VARIABLES *** ; ***************** waypts_box_x0_lo !fill WAYPTS_MAX-1 waypts_box_x0_hi !fill WAYPTS_MAX-1 waypts_box_z0_lo !fill WAYPTS_MAX-1 waypts_box_z0_hi !fill WAYPTS_MAX-1 waypts_box_x1_lo !fill WAYPTS_MAX-1 waypts_box_x1_hi !fill WAYPTS_MAX-1 waypts_box_z1_lo !fill WAYPTS_MAX-1 waypts_box_z1_hi !fill WAYPTS_MAX-1 waypts_x_lo !fill WAYPTS_MAX waypts_x_hi !fill WAYPTS_MAX waypts_z_lo !fill WAYPTS_MAX waypts_z_hi !fill WAYPTS_MAX ; Storage for axis-aligned coordinates of current waypoint (relative to ; ball's position). This is what gets rotated. waypts_aa_x_lo !byte 0 waypts_aa_x_hi !byte 0 waypts_aa_z_lo !byte 0 waypts_aa_z_hi !byte 0 waypts_n !byte 0 waypts_current_i !byte 0 ;waypts_iter !byte 0 ; ******************* ; ****** MACROS ***** ; ******************* ; ******************* ; *** SUBROUTINES *** ; ******************* ; INPUTS: ball_world_x_lo, etc. ; OUTPUTS: X = index for current waypoint !zone { waypts_find_index ldx #0 .loop ; Is this the last waypoint? inx cpx waypts_n bne + ; Last waypoint is the one we're looking for. dex stx waypts_current_i rts ; EXIT POINT. + dex ; Not the last waypoint so there should be a box associated with it. ; Is the ball located inside it? ; For all following subtractions, a<b should hold for a-b. lda waypts_box_x0_lo,x sec sbc ball_world_x_lo lda waypts_box_x0_hi,x sbc ball_world_x_hi +bge_s .next lda ball_world_x_lo sec sbc waypts_box_x1_lo,x lda ball_world_x_hi sbc waypts_box_x1_hi,x +bge_s .next lda ball_world_z_lo sec sbc waypts_box_z0_lo,x lda ball_world_z_hi sbc waypts_box_z0_hi,x +bge_s .next lda waypts_box_z1_lo,x sec sbc ball_world_z_lo lda waypts_box_z1_hi,x sbc ball_world_z_hi +bge_s .next ; So this is the index we're looking for (in X). stx waypts_current_i rts ; EXIT POINT. .next inx jmp .loop ; NOTE: never reach this... ; rts ; end sub waypts_find_index } ; !zone ; ************************************************** ; INPUTS: P0-P1 - address of first byte of waypoints data. ; OUTPUT: P0-P1 - address of byte following waypoints data. ; NOTE: data format is: number of waypoints; ; ... then, for each waypoint: ; (box) x0-lo,x0-hi,z0-lo,z0-hi, x1-lo,x1-hi,z1-lo,z1-hi ; (point) x-lo,x-hi, z-lo,z-hi !zone { waypts_load ldy #0 lda (P0),y sta waypts_n beq .end ; Use X to keep track of waypoint index. ldx #0 .loop_top iny lda (P0),y sta waypts_box_x0_lo,x iny lda (P0),y sta waypts_box_x0_hi,x iny lda (P0),y sta waypts_box_z0_lo,x iny lda (P0),y sta waypts_box_z0_hi,x iny lda (P0),y sta waypts_box_x1_lo,x iny lda (P0),y sta waypts_box_x1_hi,x iny lda (P0),y sta waypts_box_z1_lo,x iny lda (P0),y sta waypts_box_z1_hi,x iny lda (P0),y sta waypts_x_lo,x iny lda (P0),y sta waypts_x_hi,x iny lda (P0),y sta waypts_z_lo,x iny lda (P0),y sta waypts_z_hi,x inx cpx waypts_n bne .loop_top .end ; Make sure P0-P1 now point to the byte following the waypoints data. iny sty P2 ; This is what we need to add! lda P0 clc adc P2 sta P0 lda P1 adc #0 sta P1 rts ; end sub waypts_load } ; !zone ; ************************************************** ; OUTPUT: C flag set if there shouldn't be any rotation; otherwise C flag ; clear. ; NOTE: you should call waypts_find_index before calling this, so that ; the index is valid. !zone { waypts_calc_rotation ; Check for the easiest case first - no rotation (- coordinates will be ; 0,0). ldx waypts_current_i lda waypts_x_lo,x ora waypts_x_hi,x ora waypts_z_lo,x ora waypts_z_hi,x beq .no_rotation ; A rotation must be executed. First we must find out the waypoint's ; coordinates relative to the ball's current (world) position. lda waypts_x_lo,x sec sbc ball_world_x_lo sta waypts_aa_x_lo lda waypts_x_hi,x sbc ball_world_x_hi sta waypts_aa_x_hi lda waypts_z_lo,x sec sbc ball_world_z_lo sta waypts_aa_z_lo lda waypts_z_hi,x sbc ball_world_z_hi sta waypts_aa_z_hi jsr waypts_rotate_to_pos_z_axis clc rts .no_rotation lda #0 sta hole_current_rotation_quadrants sta hole_current_rotation_angle sec rts ; end sub waypts_calc_rotation } ; !zone ; ************************************************** ; FIXME: this routine is repeated almost verbatim in 'target' module!!! ; OUTPUT: we record the rotation necessary to get the current waypoint ; aligned with the positive z-axis. ; NOTE: we're not bothered about actually fully rotating the waypoint. As soon ; as we get the quadrant and angle (for trig-table lookup) we're done. !zone { waypts_rotate_to_pos_z_axis lda waypts_aa_x_lo sta maths_mod08 lda waypts_aa_x_hi sta maths_mod09 lda waypts_aa_z_lo sta maths_mod10 lda waypts_aa_z_hi sta maths_mod11 clc jsr maths_s_rotate_vec_to_pos_z_axis sta hole_current_rotation_angle rts ; end sub waypts_rotate_to_pos_z_axis } ; !zone ; ************************************************** ; ************************************************** ; ************************************************** ; ************************************************** ; ************************************************** ; ************************************************** ; ************************************************** ; ************************************************** ; ************************************************** ; ************************************************** ; ************************************************** ; ************************************************** ; ************************************************** ; ************************************************** ; ************************************************** ; ************************************************** ; ************************************************** waypts_c_SIZE = *-waypts_c_BEGIN
; A244050: Partial sums of A243980. ; 4,20,52,112,196,328,492,716,992,1340,1736,2244,2808,3468,4224,5104,6056,7164,8352,9708,11192,12820,14544,16508,18596,20852,23268,25908,28668,31716,34892,38320,41940,45776,49804,54196,58740,63524,68532,73900,79436,85356,91452,97884,104628,111660,118884,126604,134552,142872,151480,160480,169696,179392,189376,199840,210624,221768,233152,245208,257512,270200,283304,296916,310864,325388,340184,355484,371168,387428,403976,421304,438928,457008,475584,494720,514240,534432,554944,576200,597940,620184,642764,666240,690148,714584,739500,765136,791132,818064,845444,873496,902060,931200,960820,991448,1022468,1054172,1086500,1119696,1153300,1187768,1222652,1258376,1294868,1332008,1369580,1408272,1447404,1487400,1528004,1569600,1611652,1654664,1698252,1742680,1787836,1833712,1880164,1928056,1976480,2025648,2075488,2126224,2177584,2230192,2283312,2337452,2392296,2448148,2504528,2562252,2620616,2679796,2739936,2801156,2862928,2925852,2989336,3054164,3119760,3186220,3253352,3322096,3391560,3461912,3533176,3605504,3678432,3752848,3827872,3904096,3981256,4059568,4138648,4219296,4300576,4382816,4465920,4550536,4635920,4722756,4810248,4898916,4988736,5079564,5171064,5264484,5358636,5454084,5550572,5648292,5746708,5846564,5947412,6049748,6153044,6257420,6362516,6469796,6577804,6687156,6797500,6909284,7021980,7136212,7251308,7367748,7485468,7604628,7724556,7846516,7969252,8093164,8218420,8345272,8472916,8602432,8732748,8864924,8998188,9132676,9268124,9405588,9544060,9683780,9824748,9967452,10111116,10257084,10403900,10552228,10701708,10852484,11004316,11158548,11313804,11470380,11628140,11787916,11948700,12111308,12274812,12440332,12607464,12775964,12945376,13117028,13289600,13463900,13639736,13817372,13995944,14176700,14358608,14542196,14727064,14913660,15101216,15291748,15483248,15676344,15870896,16067184,16264840,16464512,16665304,16868016,17072072,17278000 mov $4,$0 mov $6,$0 add $6,1 lpb $6 clr $0,4 mov $0,$4 sub $6,1 sub $0,$6 add $3,1 mul $3,$0 cal $3,24916 ; a(n) = Sum_{k=1..n} k*floor(n/k); also Sum_{k=1..n} sigma(k) where sigma(n) = sum of divisors of n (A000203). add $5,$3 lpe mov $1,$5 sub $1,1 mul $1,4 add $1,4
;;; $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ;;; ;;; ASM Source code for Red GBC, by Evan Bowman, 2021 ;;; ;;; ;;; The following licence covers the source code included in this file. The ;;; game's characters and artwork belong to Evan Bowman, and should not be used ;;; without permission. ;;; ;;; ;;; Redistribution and use in source and binary forms, with or without ;;; modification, are permitted provided that the following conditions are met: ;;; ;;; 1. Redistributions of source code must retain the above copyright notice, ;;; this list of conditions and the following disclaimer. ;;; ;;; 2. Redistributions in binary form must reproduce the above copyright notice, ;;; this list of conditions and the following disclaimer in the documentation ;;; and/or other materials provided with the distribution. ;;; ;;; 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 HOLDER 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. ;;; ;;; $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ;;; ############################################################################ SECTION "WRAM3_UNUSED", WRAMX, BANK[3] ;;; TODO... var_wram3_TODO: DS 1 ;;; ############################################################################
; A321383: Numbers k such that the concatenation k21 is a square. ; 1,15,37,79,123,193,259,357,445,571,681,835,967,1149,1303,1513,1689,1927,2125,2391,2611,2905,3147,3469,3733,4083,4369,4747,5055,5461,5791,6225,6577,7039,7413,7903,8299,8817,9235,9781,10221,10795,11257,11859,12343,12973,13479,14137,14665,15351,15901,16615,17187,17929,18523,19293,19909,20707,21345,22171,22831,23685,24367,25249,25953,26863,27589,28527,29275,30241,31011,32005,32797,33819,34633,35683,36519,37597,38455,39561,40441,41575,42477,43639,44563,45753,46699,47917,48885,50131,51121,52395,53407,54709,55743,57073,58129,59487,60565,61951 lpb $0 mov $2,$0 trn $0,2 trn $2,1 seq $2,156619 ; Numbers congruent to {7, 18} mod 25. add $1,$2 lpe mul $1,2 add $1,1 mov $0,$1
; A070410: a(n) = 7^n mod 25. ; 1,7,24,18,1,7,24,18,1,7,24,18,1,7,24,18,1,7,24,18,1,7,24,18,1,7,24,18,1,7,24,18,1,7,24,18,1,7,24,18,1,7,24,18,1,7,24,18,1,7,24,18,1,7,24,18,1,7,24,18,1,7,24,18,1,7,24,18,1,7,24,18,1,7,24,18,1,7,24,18,1,7,24,18,1,7,24,18,1,7,24,18,1,7,24,18,1,7,24,18,1,7,24,18,1,7,24,18,1,7,24,18,1,7,24,18,1,7,24,18,1,7,24,18,1,7,24,18,1,7,24,18,1,7,24,18,1,7,24,18,1,7,24,18,1,7,24,18,1,7,24,18,1,7,24,18,1,7,24,18,1,7,24,18,1,7,24,18,1,7,24,18,1,7,24,18,1,7,24,18,1,7,24,18,1,7,24,18,1,7,24,18,1,7,24,18,1,7,24,18,1,7,24,18,1,7,24,18,1,7,24,18,1,7,24,18,1,7,24,18,1,7,24,18,1,7,24,18,1,7,24,18,1,7,24,18,1,7,24,18,1,7,24,18,1,7,24,18,1,7 mov $1,1 mov $2,$0 lpb $2 mul $1,7 mod $1,25 sub $2,1 lpe
dnl AMD64 mpn_addmul_1 and mpn_submul_1 optimised for Intel Haswell. dnl Contributed to the GNU project by Torbjörn Granlund. dnl Copyright 2013 Free Software Foundation, Inc. dnl This file is part of the GNU MP Library. dnl dnl The GNU MP Library is free software; you can redistribute it and/or modify dnl it under the terms of either: dnl dnl * the GNU Lesser General Public License as published by the Free dnl Software Foundation; either version 3 of the License, or (at your dnl option) any later version. dnl dnl or dnl dnl * the GNU General Public License as published by the Free Software dnl Foundation; either version 2 of the License, or (at your option) any dnl later version. dnl dnl or both in parallel, as here. dnl dnl The GNU MP Library is distributed in the hope that it will be useful, but dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License dnl for more details. dnl dnl You should have received copies of the GNU General Public License and the dnl GNU Lesser General Public License along with the GNU MP Library. If not, dnl see https://www.gnu.org/licenses/. include(`../config.m4') C cycles/limb C AMD K8,K9 n/a C AMD K10 n/a C AMD bull n/a C AMD pile n/a C AMD steam ? C AMD bobcat n/a C AMD jaguar ? C Intel P4 n/a C Intel core n/a C Intel NHM n/a C Intel SBR n/a C Intel IBR n/a C Intel HWL 2.32 C Intel BWL ? C Intel atom n/a C VIA nano n/a C The loop of this code is the result of running a code generation and C optimisation tool suite written by David Harvey and Torbjörn Granlund. C TODO C * Handle small n separately, for lower overhead. define(`rp', `%rdi') C rcx define(`up', `%rsi') C rdx define(`n_param', `%rdx') C r8 define(`v0_param',`%rcx') C r9 define(`n', `%rbp') define(`v0', `%rdx') ifdef(`OPERATION_addmul_1',` define(`ADDSUB', `add') define(`ADCSBB', `adc') define(`func', `mpn_addmul_1') ') ifdef(`OPERATION_submul_1',` define(`ADDSUB', `sub') define(`ADCSBB', `sbb') define(`func', `mpn_submul_1') ') ABI_SUPPORT(DOS64) ABI_SUPPORT(STD64) MULFUNC_PROLOGUE(mpn_addmul_1 mpn_submul_1) ASM_START() TEXT ALIGN(16) PROLOGUE(func) FUNC_ENTRY(4) push %rbx push %rbp push %r12 push %r13 mov n_param, n mov v0_param, v0 test $1, R8(n) jnz L(bx1) L(bx0): shr $2, n jc L(b10) L(b00): mulx( (up), %r13, %r12) mulx( 8,(up), %rbx, %rax) add %r12, %rbx adc $0, %rax mov (rp), %r12 mov 8(rp), %rcx mulx( 16,(up), %r9, %r8) lea -16(rp), rp lea 16(up), up ADDSUB %r13, %r12 jmp L(lo0) L(bx1): shr $2, n jc L(b11) L(b01): mulx( (up), %r11, %r10) jnz L(gt1) L(n1): ADDSUB %r11, (rp) mov $0, R32(%rax) adc %r10, %rax jmp L(ret) L(gt1): mulx( 8,(up), %r13, %r12) mulx( 16,(up), %rbx, %rax) lea 24(up), up add %r10, %r13 adc %r12, %rbx adc $0, %rax mov (rp), %r10 mov 8(rp), %r12 mov 16(rp), %rcx lea -8(rp), rp ADDSUB %r11, %r10 jmp L(lo1) L(b11): mulx( (up), %rbx, %rax) mov (rp), %rcx mulx( 8,(up), %r9, %r8) lea 8(up), up lea -24(rp), rp inc n C adjust n ADDSUB %rbx, %rcx jmp L(lo3) L(b10): mulx( (up), %r9, %r8) mulx( 8,(up), %r11, %r10) lea -32(rp), rp mov $0, R32(%rax) clc C clear cf jz L(end) C depends on old shift ALIGN(16) L(top): adc %rax, %r9 lea 32(rp), rp adc %r8, %r11 mulx( 16,(up), %r13, %r12) mov (rp), %r8 mulx( 24,(up), %rbx, %rax) lea 32(up), up adc %r10, %r13 adc %r12, %rbx adc $0, %rax mov 8(rp), %r10 mov 16(rp), %r12 ADDSUB %r9, %r8 mov 24(rp), %rcx mov %r8, (rp) ADCSBB %r11, %r10 L(lo1): mulx( (up), %r9, %r8) mov %r10, 8(rp) ADCSBB %r13, %r12 L(lo0): mov %r12, 16(rp) ADCSBB %rbx, %rcx L(lo3): mulx( 8,(up), %r11, %r10) mov %rcx, 24(rp) dec n jnz L(top) L(end): adc %rax, %r9 adc %r8, %r11 mov 32(rp), %r8 mov %r10, %rax adc $0, %rax mov 40(rp), %r10 ADDSUB %r9, %r8 mov %r8, 32(rp) ADCSBB %r11, %r10 mov %r10, 40(rp) adc $0, %rax L(ret): pop %r13 pop %r12 pop %rbp pop %rbx FUNC_EXIT() ret EPILOGUE()
LKS_OAM4_Clear: lda #-32 sta MEM_OAML + 1,x sta MEM_OAML + 5,x sta MEM_OAML + 9,x sta MEM_OAML + 13,x rtl LKS_OAM_Clear: stz LKS_OAM stz LKS_OAM+1 ;Clear OAM stz MEM_OAMH +$00 stz MEM_OAMH +$01 stz MEM_OAMH +$02 stz MEM_OAMH +$03 stz MEM_OAMH +$04 stz MEM_OAMH +$05 stz MEM_OAMH +$06 stz MEM_OAMH +$07 stz MEM_OAMH +$08 stz MEM_OAMH +$09 stz MEM_OAMH +$0A stz MEM_OAMH +$0B stz MEM_OAMH +$0C stz MEM_OAMH +$0D stz MEM_OAMH +$0E stz MEM_OAMH +$0F stz MEM_OAMH +$10 stz MEM_OAMH +$11 stz MEM_OAMH +$12 stz MEM_OAMH +$13 stz MEM_OAMH +$14 stz MEM_OAMH +$15 stz MEM_OAMH +$16 stz MEM_OAMH +$17 stz MEM_OAMH +$18 stz MEM_OAMH +$19 stz MEM_OAMH +$1A stz MEM_OAMH +$1B stz MEM_OAMH +$1C stz MEM_OAMH +$1D stz MEM_OAMH +$1E stz MEM_OAMH +$1F lda #-32 LKS_OAM4_Clear $00 LKS_OAM4_Clear $01 LKS_OAM4_Clear $02 LKS_OAM4_Clear $03 LKS_OAM4_Clear $04 LKS_OAM4_Clear $05 LKS_OAM4_Clear $06 LKS_OAM4_Clear $07 LKS_OAM4_Clear $08 LKS_OAM4_Clear $09 LKS_OAM4_Clear $0A LKS_OAM4_Clear $0B LKS_OAM4_Clear $0C LKS_OAM4_Clear $0D LKS_OAM4_Clear $0E LKS_OAM4_Clear $0F LKS_OAM4_Clear $10 LKS_OAM4_Clear $11 LKS_OAM4_Clear $12 LKS_OAM4_Clear $13 LKS_OAM4_Clear $14 LKS_OAM4_Clear $15 LKS_OAM4_Clear $16 LKS_OAM4_Clear $17 LKS_OAM4_Clear $18 LKS_OAM4_Clear $19 LKS_OAM4_Clear $1A LKS_OAM4_Clear $1B LKS_OAM4_Clear $1C LKS_OAM4_Clear $1D LKS_OAM4_Clear $1E LKS_OAM4_Clear $1F rtl LKS_OAM_Draw: ;Y rep #$20 lda LKS_OAM+_sprsz and #$FE clc adc LKS_OAM+_spry sta LKS_OAM+_sprtmp1 sep #$20 lda LKS_OAM+_sprtmp1+1 cmp #$00 beq + iny iny iny iny rtl +: ;X droite lda LKS_OAM+_sprx+1 cmp #$01 bmi + iny iny iny iny rtl +: ;X gauche rep #$20 lda LKS_OAM+_sprsz and #$FE clc adc LKS_OAM+_sprx sta LKS_OAM+_sprtmp1 sta LKS_OAM+_sprtmp2 sep #$20 lda LKS_OAM+_sprtmp1+1 cmp #$0 bpl + iny iny iny iny rtl +: rep #$20 tya phy sta LKS_OAM+_sprtmp1 lsr lsr lsr lsr tay sep #$20 lda LKS_OAM+_sprtmp1 and #$0F cmp #$00 bne + lda #$01 bra ++ +: cmp #$04 bne + lda #$04 bra ++ +: cmp #$08 bne + lda #$10 bra ++ +: cmp #$0C bne + lda #$40 bra ++ +: ++: sta LKS_OAM+_sprtmp1 asl sta LKS_OAM+_sprtmp1+1 lda LKS_OAM+_sprsz bit #1 beq + lda MEM_OAMH,y ora LKS_OAM+_sprtmp1+1 sta MEM_OAMH,y +: lda LKS_OAM+_sprtmp2+1 cmp #$1 beq + ;clipping lda LKS_OAM+_sprsz and #$FE clc adc LKS_OAM+_sprx bcc + lda MEM_OAMH,y ora LKS_OAM+_sprtmp1 sta MEM_OAMH,y +: ply ;-------- lda LKS_OAM+_sprx sta MEM_OAML,y iny lda LKS_OAM+_spry sta MEM_OAML,y iny lda LKS_OAM+_sprtile sta MEM_OAML,y iny lda LKS_OAM+_sprext sta MEM_OAML,y iny rtl ;------------------------------------------------- LKS_OAM_Draw_Meta: ;Y rep #$20 lda LKS_OAM+_sprsz and #$F0 lsr a clc adc LKS_OAM+_spry sta LKS_OAM+_sprtmp1 sep #$20 lda LKS_OAM+_sprtmp1+1 cmp #$00 beq + iny iny iny iny rtl +: ;X droite lda LKS_OAM+_sprx+1 cmp #$01 bmi + iny iny iny iny rtl +: ;X gauche rep #$20 lda LKS_OAM+_sprsz and #$0E inc a asl a asl a asl a clc adc LKS_OAM+_sprx sta LKS_OAM+_sprtmp1 sta LKS_OAM+_sprtmp2 sep #$20 lda LKS_OAM+_sprtmp1+1 cmp #$0 bpl + iny iny iny iny rtl +: rep #$20 tya phy sta LKS_OAM+_sprtmp1 lsr lsr lsr lsr tay sep #$20 lda LKS_OAM+_sprtmp1 and #$0F cmp #$00 bne + lda #$01 bra ++ +: cmp #$04 bne + lda #$04 bra ++ +: cmp #$08 bne + lda #$10 bra ++ +: cmp #$0C bne + lda #$40 bra ++ +: ++: sta LKS_OAM+_sprtmp1 asl sta LKS_OAM+_sprtmp1+1 lda LKS_OAM+_sprsz bit #1 beq + lda MEM_OAMH,y ora LKS_OAM+_sprtmp1+1 sta MEM_OAMH,y +: lda LKS_OAM+_sprtmp2+1 cmp #$1 beq + ;clipping lda LKS_OAM+_sprsz and #$FE clc adc LKS_OAM+_sprx bcc + lda MEM_OAMH,y ora LKS_OAM+_sprtmp1 sta MEM_OAMH,y +: ply ;-------- lda LKS_OAM+_sprx sta MEM_OAML,y iny lda LKS_OAM+_spry sta MEM_OAML,y iny lda LKS_OAM+_sprtile sta MEM_OAML,y iny lda LKS_OAM+_sprext sta MEM_OAML,y iny rtl LKS_OAM_Draw_Meta2x1: rtl
//===--- MagicNumbersCheck.cpp - clang-tidy-------------------------------===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // A checker for magic numbers: integer or floating point literals embedded // in the code, outside the definition of a constant or an enumeration. // //===----------------------------------------------------------------------===// #include "MagicNumbersCheck.h" #include "../utils/OptionsUtils.h" #include "clang/AST/ASTContext.h" #include "clang/ASTMatchers/ASTMatchFinder.h" #include "llvm/ADT/STLExtras.h" #include <algorithm> using namespace clang::ast_matchers; using namespace clang::ast_type_traits; namespace { bool isUsedToInitializeAConstant(const MatchFinder::MatchResult &Result, const DynTypedNode &Node) { const auto *AsDecl = Node.get<clang::DeclaratorDecl>(); if (AsDecl) { if (AsDecl->getType().isConstQualified()) return true; return AsDecl->isImplicit(); } if (Node.get<clang::EnumConstantDecl>() != nullptr) return true; return llvm::any_of(Result.Context->getParents(Node), [&Result](const DynTypedNode &Parent) { return isUsedToInitializeAConstant(Result, Parent); }); } } // namespace namespace clang { namespace tidy { namespace readability { const char DefaultIgnoredIntegerValues[] = "1;2;3;4;"; const char DefaultIgnoredFloatingPointValues[] = "1.0;100.0;"; MagicNumbersCheck::MagicNumbersCheck(StringRef Name, ClangTidyContext *Context) : ClangTidyCheck(Name, Context), IgnoreAllFloatingPointValues( Options.get("IgnoreAllFloatingPointValues", false)), IgnorePowersOf2IntegerValues( Options.get("IgnorePowersOf2IntegerValues", false)) { // Process the set of ignored integer values. const std::vector<std::string> IgnoredIntegerValuesInput = utils::options::parseStringList( Options.get("IgnoredIntegerValues", DefaultIgnoredIntegerValues)); IgnoredIntegerValues.resize(IgnoredIntegerValuesInput.size()); llvm::transform(IgnoredIntegerValuesInput, IgnoredIntegerValues.begin(), [](const std::string &Value) { return std::stoll(Value); }); llvm::sort(IgnoredIntegerValues.begin(), IgnoredIntegerValues.end()); if (!IgnoreAllFloatingPointValues) { // Process the set of ignored floating point values. const std::vector<std::string> IgnoredFloatingPointValuesInput = utils::options::parseStringList(Options.get( "IgnoredFloatingPointValues", DefaultIgnoredFloatingPointValues)); IgnoredFloatingPointValues.reserve(IgnoredFloatingPointValuesInput.size()); IgnoredDoublePointValues.reserve(IgnoredFloatingPointValuesInput.size()); for (const auto &InputValue : IgnoredFloatingPointValuesInput) { llvm::APFloat FloatValue(llvm::APFloat::IEEEsingle()); FloatValue.convertFromString(InputValue, DefaultRoundingMode); IgnoredFloatingPointValues.push_back(FloatValue.convertToFloat()); llvm::APFloat DoubleValue(llvm::APFloat::IEEEdouble()); DoubleValue.convertFromString(InputValue, DefaultRoundingMode); IgnoredDoublePointValues.push_back(DoubleValue.convertToDouble()); } llvm::sort(IgnoredFloatingPointValues.begin(), IgnoredFloatingPointValues.end()); llvm::sort(IgnoredDoublePointValues.begin(), IgnoredDoublePointValues.end()); } } void MagicNumbersCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) { Options.store(Opts, "IgnoredIntegerValues", DefaultIgnoredIntegerValues); Options.store(Opts, "IgnoredFloatingPointValues", DefaultIgnoredFloatingPointValues); } void MagicNumbersCheck::registerMatchers(MatchFinder *Finder) { Finder->addMatcher(integerLiteral().bind("integer"), this); if (!IgnoreAllFloatingPointValues) Finder->addMatcher(floatLiteral().bind("float"), this); } void MagicNumbersCheck::check(const MatchFinder::MatchResult &Result) { checkBoundMatch<IntegerLiteral>(Result, "integer"); checkBoundMatch<FloatingLiteral>(Result, "float"); } bool MagicNumbersCheck::isConstant(const MatchFinder::MatchResult &Result, const Expr &ExprResult) const { return llvm::any_of( Result.Context->getParents(ExprResult), [&Result](const DynTypedNode &Parent) { return isUsedToInitializeAConstant(Result, Parent) || // Ignore this instance, because this match reports the location // where the template is defined, not where it is instantiated. Parent.get<SubstNonTypeTemplateParmExpr>(); }); } bool MagicNumbersCheck::isIgnoredValue(const IntegerLiteral *Literal) const { const llvm::APInt IntValue = Literal->getValue(); const int64_t Value = IntValue.getZExtValue(); if (Value == 0) return true; if (IgnorePowersOf2IntegerValues && IntValue.isPowerOf2()) return true; return std::binary_search(IgnoredIntegerValues.begin(), IgnoredIntegerValues.end(), Value); } bool MagicNumbersCheck::isIgnoredValue(const FloatingLiteral *Literal) const { const llvm::APFloat FloatValue = Literal->getValue(); if (FloatValue.isZero()) return true; if (&FloatValue.getSemantics() == &llvm::APFloat::IEEEsingle()) { const float Value = FloatValue.convertToFloat(); return std::binary_search(IgnoredFloatingPointValues.begin(), IgnoredFloatingPointValues.end(), Value); } if (&FloatValue.getSemantics() == &llvm::APFloat::IEEEdouble()) { const double Value = FloatValue.convertToDouble(); return std::binary_search(IgnoredDoublePointValues.begin(), IgnoredDoublePointValues.end(), Value); } return false; } bool MagicNumbersCheck::isSyntheticValue(const SourceManager *SourceManager, const IntegerLiteral *Literal) const { const std::pair<FileID, unsigned> FileOffset = SourceManager->getDecomposedLoc(Literal->getLocation()); if (FileOffset.first.isInvalid()) return false; const StringRef BufferIdentifier = SourceManager->getBuffer(FileOffset.first)->getBufferIdentifier(); return BufferIdentifier.empty(); } } // namespace readability } // namespace tidy } // namespace clang
; A017641: a(n) = 12n + 10. ; 10,22,34,46,58,70,82,94,106,118,130,142,154,166,178,190,202,214,226,238,250,262,274,286,298,310,322,334,346,358,370,382,394,406,418,430,442,454,466,478,490,502,514,526,538,550,562,574,586,598,610,622,634 mov $1,$0 mul $1,12 add $1,10
/* Bullet Continuous Collision Detection and Physics Library Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com//Bullet/ This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ ///btSoftBodyHelpers.cpp by Nathanael Presson #include "btSoftBodyInternals.h" #include <stdio.h> #include <string.h> #include "btSoftBodyHelpers.h" #include "..//LinearMath//btConvexHull.h" #include "..//LinearMath//btConvexHullComputer.h" // static void drawVertex( btIDebugDraw* idraw, const btVector3& x,btScalar s,const btVector3& c) { idraw->drawLine(x-btVector3(s,0,0),x+btVector3(s,0,0),c); idraw->drawLine(x-btVector3(0,s,0),x+btVector3(0,s,0),c); idraw->drawLine(x-btVector3(0,0,s),x+btVector3(0,0,s),c); } // static void drawBox( btIDebugDraw* idraw, const btVector3& mins, const btVector3& maxs, const btVector3& color) { const btVector3 c[]={ btVector3(mins.x(),mins.y(),mins.z()), btVector3(maxs.x(),mins.y(),mins.z()), btVector3(maxs.x(),maxs.y(),mins.z()), btVector3(mins.x(),maxs.y(),mins.z()), btVector3(mins.x(),mins.y(),maxs.z()), btVector3(maxs.x(),mins.y(),maxs.z()), btVector3(maxs.x(),maxs.y(),maxs.z()), btVector3(mins.x(),maxs.y(),maxs.z())}; idraw->drawLine(c[0],c[1],color);idraw->drawLine(c[1],c[2],color); idraw->drawLine(c[2],c[3],color);idraw->drawLine(c[3],c[0],color); idraw->drawLine(c[4],c[5],color);idraw->drawLine(c[5],c[6],color); idraw->drawLine(c[6],c[7],color);idraw->drawLine(c[7],c[4],color); idraw->drawLine(c[0],c[4],color);idraw->drawLine(c[1],c[5],color); idraw->drawLine(c[2],c[6],color);idraw->drawLine(c[3],c[7],color); } // static void drawTree( btIDebugDraw* idraw, const btDbvtNode* node, int depth, const btVector3& ncolor, const btVector3& lcolor, int mindepth, int maxdepth) { if(node) { if(node->isinternal()&&((depth<maxdepth)||(maxdepth<0))) { drawTree(idraw,node->childs[0],depth+1,ncolor,lcolor,mindepth,maxdepth); drawTree(idraw,node->childs[1],depth+1,ncolor,lcolor,mindepth,maxdepth); } if(depth>=mindepth) { const btScalar scl=(btScalar)(node->isinternal()?1:1); const btVector3 mi=node->volume.Center()-node->volume.Extents()*scl; const btVector3 mx=node->volume.Center()+node->volume.Extents()*scl; drawBox(idraw,mi,mx,node->isleaf()?lcolor:ncolor); } } } // template <typename T> static inline T sum(const btAlignedObjectArray<T>& items) { T v; if(items.size()) { v=items[0]; for(int i=1,ni=items.size();i<ni;++i) { v+=items[i]; } } return(v); } // template <typename T,typename Q> static inline void add(btAlignedObjectArray<T>& items,const Q& value) { for(int i=0,ni=items.size();i<ni;++i) { items[i]+=value; } } // template <typename T,typename Q> static inline void mul(btAlignedObjectArray<T>& items,const Q& value) { for(int i=0,ni=items.size();i<ni;++i) { items[i]*=value; } } // template <typename T> static inline T average(const btAlignedObjectArray<T>& items) { const btScalar n=(btScalar)(items.size()>0?items.size():1); return(sum(items)/n); } #if 0 // inline static btScalar tetravolume(const btVector3& x0, const btVector3& x1, const btVector3& x2, const btVector3& x3) { const btVector3 a=x1-x0; const btVector3 b=x2-x0; const btVector3 c=x3-x0; return(btDot(a,btCross(b,c))); } #endif // #if 0 static btVector3 stresscolor(btScalar stress) { static const btVector3 spectrum[]= { btVector3(1,0,1), btVector3(0,0,1), btVector3(0,1,1), btVector3(0,1,0), btVector3(1,1,0), btVector3(1,0,0), btVector3(1,0,0)}; static const int ncolors=sizeof(spectrum)/sizeof(spectrum[0])-1; static const btScalar one=1; stress=btMax<btScalar>(0,btMin<btScalar>(1,stress))*ncolors; const int sel=(int)stress; const btScalar frc=stress-sel; return(spectrum[sel]+(spectrum[sel+1]-spectrum[sel])*frc); } #endif // void btSoftBodyHelpers::Draw( btSoftBody* psb, btIDebugDraw* idraw, int drawflags) { const btScalar scl=(btScalar)0.1; const btScalar nscl=scl*5; const btVector3 lcolor=btVector3(0,0,0); const btVector3 ncolor=btVector3(1,1,1); const btVector3 ccolor=btVector3(1,0,0); int i,j,nj; /* Clusters */ if(0!=(drawflags&fDrawFlags::Clusters)) { srand(1806); for(i=0;i<psb->m_clusters.size();++i) { if(psb->m_clusters[i]->m_collide) { btVector3 color( rand()/(btScalar)RAND_MAX, rand()/(btScalar)RAND_MAX, rand()/(btScalar)RAND_MAX); color=color.normalized()*0.75; btAlignedObjectArray<btVector3> vertices; vertices.resize(psb->m_clusters[i]->m_nodes.size()); for(j=0,nj=vertices.size();j<nj;++j) { vertices[j]=psb->m_clusters[i]->m_nodes[j]->m_x; } #define USE_NEW_CONVEX_HULL_COMPUTER #ifdef USE_NEW_CONVEX_HULL_COMPUTER btConvexHullComputer computer; int stride = sizeof(btVector3); int count = vertices.size(); btScalar shrink=0.f; btScalar shrinkClamp=0.f; computer.compute(&vertices[0].getX(),stride,count,shrink,shrinkClamp); for (int i=0;i<computer.faces.size();i++) { int face = computer.faces[i]; //printf("face=%d\n",face); const btConvexHullComputer::Edge* firstEdge = &computer.edges[face]; const btConvexHullComputer::Edge* edge = firstEdge->getNextEdgeOfFace(); int v0 = firstEdge->getSourceVertex(); int v1 = firstEdge->getTargetVertex(); while (edge!=firstEdge) { int v2 = edge->getTargetVertex(); idraw->drawTriangle(computer.vertices[v0],computer.vertices[v1],computer.vertices[v2],color,1); edge = edge->getNextEdgeOfFace(); v0=v1; v1=v2; }; } #else HullDesc hdsc(QF_TRIANGLES,vertices.size(),&vertices[0]); HullResult hres; HullLibrary hlib; hdsc.mMaxVertices=vertices.size(); hlib.CreateConvexHull(hdsc,hres); const btVector3 center=average(hres.m_OutputVertices); add(hres.m_OutputVertices,-center); mul(hres.m_OutputVertices,(btScalar)1); add(hres.m_OutputVertices,center); for(j=0;j<(int)hres.mNumFaces;++j) { const int idx[]={hres.m_Indices[j*3+0],hres.m_Indices[j*3+1],hres.m_Indices[j*3+2]}; idraw->drawTriangle(hres.m_OutputVertices[idx[0]], hres.m_OutputVertices[idx[1]], hres.m_OutputVertices[idx[2]], color,1); } hlib.ReleaseResult(hres); #endif } /* Velocities */ #if 0 for(int j=0;j<psb->m_clusters[i].m_nodes.size();++j) { const btSoftBody::Cluster& c=psb->m_clusters[i]; const btVector3 r=c.m_nodes[j]->m_x-c.m_com; const btVector3 v=c.m_lv+btCross(c.m_av,r); idraw->drawLine(c.m_nodes[j]->m_x,c.m_nodes[j]->m_x+v,btVector3(1,0,0)); } #endif /* Frame */ // btSoftBody::Cluster& c=*psb->m_clusters[i]; // idraw->drawLine(c.m_com,c.m_framexform*btVector3(10,0,0),btVector3(1,0,0)); // idraw->drawLine(c.m_com,c.m_framexform*btVector3(0,10,0),btVector3(0,1,0)); // idraw->drawLine(c.m_com,c.m_framexform*btVector3(0,0,10),btVector3(0,0,1)); } } else { /* Nodes */ if(0!=(drawflags&fDrawFlags::Nodes)) { for(i=0;i<psb->m_nodes.size();++i) { const btSoftBody::Node& n=psb->m_nodes[i]; if(0==(n.m_material->m_flags&btSoftBody::fMaterial::DebugDraw)) continue; idraw->drawLine(n.m_x-btVector3(scl,0,0),n.m_x+btVector3(scl,0,0),btVector3(1,0,0)); idraw->drawLine(n.m_x-btVector3(0,scl,0),n.m_x+btVector3(0,scl,0),btVector3(0,1,0)); idraw->drawLine(n.m_x-btVector3(0,0,scl),n.m_x+btVector3(0,0,scl),btVector3(0,0,1)); } } /* Links */ if(0!=(drawflags&fDrawFlags::Links)) { for(i=0;i<psb->m_links.size();++i) { const btSoftBody::Link& l=psb->m_links[i]; if(0==(l.m_material->m_flags&btSoftBody::fMaterial::DebugDraw)) continue; idraw->drawLine(l.m_n[0]->m_x,l.m_n[1]->m_x,lcolor); } } /* Normals */ if(0!=(drawflags&fDrawFlags::Normals)) { for(i=0;i<psb->m_nodes.size();++i) { const btSoftBody::Node& n=psb->m_nodes[i]; if(0==(n.m_material->m_flags&btSoftBody::fMaterial::DebugDraw)) continue; const btVector3 d=n.m_n*nscl; idraw->drawLine(n.m_x,n.m_x+d,ncolor); idraw->drawLine(n.m_x,n.m_x-d,ncolor*0.5); } } /* Contacts */ if(0!=(drawflags&fDrawFlags::Contacts)) { static const btVector3 axis[]={btVector3(1,0,0), btVector3(0,1,0), btVector3(0,0,1)}; for(i=0;i<psb->m_rcontacts.size();++i) { const btSoftBody::RContact& c=psb->m_rcontacts[i]; const btVector3 o= c.m_node->m_x-c.m_cti.m_normal* (btDot(c.m_node->m_x,c.m_cti.m_normal)+c.m_cti.m_offset); const btVector3 x=btCross(c.m_cti.m_normal,axis[c.m_cti.m_normal.minAxis()]).normalized(); const btVector3 y=btCross(x,c.m_cti.m_normal).normalized(); idraw->drawLine(o-x*nscl,o+x*nscl,ccolor); idraw->drawLine(o-y*nscl,o+y*nscl,ccolor); idraw->drawLine(o,o+c.m_cti.m_normal*nscl*3,btVector3(1,1,0)); } } /* Faces */ if(0!=(drawflags&fDrawFlags::Faces)) { const btScalar scl=(btScalar)0.8; const btScalar alp=(btScalar)1; const btVector3 col(0,(btScalar)0.7,0); for(i=0;i<psb->m_faces.size();++i) { const btSoftBody::Face& f=psb->m_faces[i]; if(0==(f.m_material->m_flags&btSoftBody::fMaterial::DebugDraw)) continue; const btVector3 x[]={f.m_n[0]->m_x,f.m_n[1]->m_x,f.m_n[2]->m_x}; const btVector3 c=(x[0]+x[1]+x[2])/3; idraw->drawTriangle((x[0]-c)*scl+c, (x[1]-c)*scl+c, (x[2]-c)*scl+c, col,alp); } } /* Tetras */ if(0!=(drawflags&fDrawFlags::Tetras)) { const btScalar scl=(btScalar)0.8; const btScalar alp=(btScalar)1; const btVector3 col((btScalar)0.3,(btScalar)0.3,(btScalar)0.7); for(int i=0;i<psb->m_tetras.size();++i) { const btSoftBody::Tetra& t=psb->m_tetras[i]; if(0==(t.m_material->m_flags&btSoftBody::fMaterial::DebugDraw)) continue; const btVector3 x[]={t.m_n[0]->m_x,t.m_n[1]->m_x,t.m_n[2]->m_x,t.m_n[3]->m_x}; const btVector3 c=(x[0]+x[1]+x[2]+x[3])/4; idraw->drawTriangle((x[0]-c)*scl+c,(x[1]-c)*scl+c,(x[2]-c)*scl+c,col,alp); idraw->drawTriangle((x[0]-c)*scl+c,(x[1]-c)*scl+c,(x[3]-c)*scl+c,col,alp); idraw->drawTriangle((x[1]-c)*scl+c,(x[2]-c)*scl+c,(x[3]-c)*scl+c,col,alp); idraw->drawTriangle((x[2]-c)*scl+c,(x[0]-c)*scl+c,(x[3]-c)*scl+c,col,alp); } } } /* Anchors */ if(0!=(drawflags&fDrawFlags::Anchors)) { for(i=0;i<psb->m_anchors.size();++i) { const btSoftBody::Anchor& a=psb->m_anchors[i]; const btVector3 q=a.m_body->getWorldTransform()*a.m_local; drawVertex(idraw,a.m_node->m_x,0.25,btVector3(1,0,0)); drawVertex(idraw,q,0.25,btVector3(0,1,0)); idraw->drawLine(a.m_node->m_x,q,btVector3(1,1,1)); } for(i=0;i<psb->m_nodes.size();++i) { const btSoftBody::Node& n=psb->m_nodes[i]; if(0==(n.m_material->m_flags&btSoftBody::fMaterial::DebugDraw)) continue; if(n.m_im<=0) { drawVertex(idraw,n.m_x,0.25,btVector3(1,0,0)); } } } /* Notes */ if(0!=(drawflags&fDrawFlags::Notes)) { for(i=0;i<psb->m_notes.size();++i) { const btSoftBody::Note& n=psb->m_notes[i]; btVector3 p=n.m_offset; for(int j=0;j<n.m_rank;++j) { p+=n.m_nodes[j]->m_x*n.m_coords[j]; } idraw->draw3dText(p,n.m_text); } } /* Node tree */ if(0!=(drawflags&fDrawFlags::NodeTree)) DrawNodeTree(psb,idraw); /* Face tree */ if(0!=(drawflags&fDrawFlags::FaceTree)) DrawFaceTree(psb,idraw); /* Cluster tree */ if(0!=(drawflags&fDrawFlags::ClusterTree)) DrawClusterTree(psb,idraw); /* Joints */ if(0!=(drawflags&fDrawFlags::Joints)) { for(i=0;i<psb->m_joints.size();++i) { const btSoftBody::Joint* pj=psb->m_joints[i]; switch(pj->Type()) { case btSoftBody::Joint::eType::Linear: { const btSoftBody::LJoint* pjl=(const btSoftBody::LJoint*)pj; const btVector3 a0=pj->m_bodies[0].xform()*pjl->m_refs[0]; const btVector3 a1=pj->m_bodies[1].xform()*pjl->m_refs[1]; idraw->drawLine(pj->m_bodies[0].xform().getOrigin(),a0,btVector3(1,1,0)); idraw->drawLine(pj->m_bodies[1].xform().getOrigin(),a1,btVector3(0,1,1)); drawVertex(idraw,a0,0.25,btVector3(1,1,0)); drawVertex(idraw,a1,0.25,btVector3(0,1,1)); } break; case btSoftBody::Joint::eType::Angular: { //const btSoftBody::AJoint* pja=(const btSoftBody::AJoint*)pj; const btVector3 o0=pj->m_bodies[0].xform().getOrigin(); const btVector3 o1=pj->m_bodies[1].xform().getOrigin(); const btVector3 a0=pj->m_bodies[0].xform().getBasis()*pj->m_refs[0]; const btVector3 a1=pj->m_bodies[1].xform().getBasis()*pj->m_refs[1]; idraw->drawLine(o0,o0+a0*10,btVector3(1,1,0)); idraw->drawLine(o0,o0+a1*10,btVector3(1,1,0)); idraw->drawLine(o1,o1+a0*10,btVector3(0,1,1)); idraw->drawLine(o1,o1+a1*10,btVector3(0,1,1)); break; } default: { } } } } } // void btSoftBodyHelpers::DrawInfos( btSoftBody* psb, btIDebugDraw* idraw, bool masses, bool areas, bool /*stress*/) { for(int i=0;i<psb->m_nodes.size();++i) { const btSoftBody::Node& n=psb->m_nodes[i]; char text[2048]={0}; char buff[1024]; if(masses) { sprintf(buff," M(%.2f)",1/n.m_im); strcat(text,buff); } if(areas) { sprintf(buff," A(%.2f)",n.m_area); strcat(text,buff); } if(text[0]) idraw->draw3dText(n.m_x,text); } } // void btSoftBodyHelpers::DrawNodeTree( btSoftBody* psb, btIDebugDraw* idraw, int mindepth, int maxdepth) { drawTree(idraw,psb->m_ndbvt.m_root,0,btVector3(1,0,1),btVector3(1,1,1),mindepth,maxdepth); } // void btSoftBodyHelpers::DrawFaceTree( btSoftBody* psb, btIDebugDraw* idraw, int mindepth, int maxdepth) { drawTree(idraw,psb->m_fdbvt.m_root,0,btVector3(0,1,0),btVector3(1,0,0),mindepth,maxdepth); } // void btSoftBodyHelpers::DrawClusterTree( btSoftBody* psb, btIDebugDraw* idraw, int mindepth, int maxdepth) { drawTree(idraw,psb->m_cdbvt.m_root,0,btVector3(0,1,1),btVector3(1,0,0),mindepth,maxdepth); } //The btSoftBody object from the BulletSDK includes an array of Nodes and Links. These links appear // to be first set up to connect a node to between 5 and 6 of its neighbors [480 links], //and then to the rest of the nodes after the execution of the Floyd-Warshall graph algorithm //[another 930 links]. //The way the links are stored by default, we have a number of cases where adjacent links share a node in common // - this leads to the creation of a data dependency through memory. //The PSolve_Links() function reads and writes nodes as it iterates over each link. //So, we now have the possibility of a data dependency between iteration X //that processes link L with iteration X+1 that processes link L+1 //because L and L+1 have one node in common, and iteration X updates the positions of that node, //and iteration X+1 reads in the position of that shared node. // //Such a memory dependency limits the ability of a modern CPU to speculate beyond //a certain point because it has to respect a possible dependency //- this prevents the CPU from making full use of its out-of-order resources. //If we re-order the links such that we minimize the cases where a link L and L+1 share a common node, //we create a temporal gap between when the node position is written, //and when it is subsequently read. This in turn allows the CPU to continue execution without //risking a dependency violation. Such a reordering would result in significant speedups on //modern CPUs with lots of execution resources. //In our testing, we see it have a tremendous impact not only on the A7, //but also on all x86 cores that ship with modern Macs. //The attached source file includes a single function (ReoptimizeLinkOrder) which can be called on a //btSoftBody object in the solveConstraints() function before the actual solver is invoked, //or right after generateBendingConstraints() once we have all 1410 links. //=================================================================== // // // This function takes in a list of interdependent Links and tries // to maximize the distance between calculation // of dependent links. This increases the amount of parallelism that can // be exploited by out-of-order instruction processors with large but // (inevitably) finite instruction windows. // //=================================================================== // A small structure to track lists of dependent link calculations class LinkDeps_t { public: int value; // A link calculation that is dependent on this one // Positive values = "input A" while negative values = "input B" LinkDeps_t *next; // Next dependence in the list }; typedef LinkDeps_t *LinkDepsPtr_t; // Dependency list constants #define REOP_NOT_DEPENDENT -1 #define REOP_NODE_COMPLETE -2 // Must be less than REOP_NOT_DEPENDENT void btSoftBodyHelpers::ReoptimizeLinkOrder(btSoftBody *psb /* This can be replaced by a btSoftBody pointer */) { int i, nLinks=psb->m_links.size(), nNodes=psb->m_nodes.size(); btSoftBody::Link *lr; int ar, br; btSoftBody::Node *node0 = &(psb->m_nodes[0]); btSoftBody::Node *node1 = &(psb->m_nodes[1]); LinkDepsPtr_t linkDep; int readyListHead, readyListTail, linkNum, linkDepFrees, depLink; // Allocate temporary buffers int *nodeWrittenAt = new int[nNodes+1]; // What link calculation produced this node's current values? int *linkDepA = new int[nLinks]; // Link calculation input is dependent upon prior calculation #N int *linkDepB = new int[nLinks]; int *readyList = new int[nLinks]; // List of ready-to-process link calculations (# of links, maximum) LinkDeps_t *linkDepFreeList = new LinkDeps_t[2*nLinks]; // Dependent-on-me list elements (2x# of links, maximum) LinkDepsPtr_t *linkDepListStarts = new LinkDepsPtr_t[nLinks]; // Start nodes of dependent-on-me lists, one for each link // Copy the original, unsorted links to a side buffer btSoftBody::Link *linkBuffer = new btSoftBody::Link[nLinks]; memcpy(linkBuffer, &(psb->m_links[0]), sizeof(btSoftBody::Link)*nLinks); // Clear out the node setup and ready list for (i=0; i < nNodes+1; i++) { nodeWrittenAt[i] = REOP_NOT_DEPENDENT; } for (i=0; i < nLinks; i++) { linkDepListStarts[i] = NULL; } readyListHead = readyListTail = linkDepFrees = 0; // Initial link analysis to set up data structures for (i=0; i < nLinks; i++) { // Note which prior link calculations we are dependent upon & build up dependence lists lr = &(psb->m_links[i]); ar = (lr->m_n[0] - node0)/(node1 - node0); br = (lr->m_n[1] - node0)/(node1 - node0); if (nodeWrittenAt[ar] > REOP_NOT_DEPENDENT) { linkDepA[i] = nodeWrittenAt[ar]; linkDep = &linkDepFreeList[linkDepFrees++]; linkDep->value = i; linkDep->next = linkDepListStarts[nodeWrittenAt[ar]]; linkDepListStarts[nodeWrittenAt[ar]] = linkDep; } else { linkDepA[i] = REOP_NOT_DEPENDENT; } if (nodeWrittenAt[br] > REOP_NOT_DEPENDENT) { linkDepB[i] = nodeWrittenAt[br]; linkDep = &linkDepFreeList[linkDepFrees++]; linkDep->value = -(i+1); linkDep->next = linkDepListStarts[nodeWrittenAt[br]]; linkDepListStarts[nodeWrittenAt[br]] = linkDep; } else { linkDepB[i] = REOP_NOT_DEPENDENT; } // Add this link to the initial ready list, if it is not dependent on any other links if ((linkDepA[i] == REOP_NOT_DEPENDENT) && (linkDepB[i] == REOP_NOT_DEPENDENT)) { readyList[readyListTail++] = i; linkDepA[i] = linkDepB[i] = REOP_NODE_COMPLETE; // Probably not needed now } // Update the nodes to mark which ones are calculated by this link nodeWrittenAt[ar] = nodeWrittenAt[br] = i; } // Process the ready list and create the sorted list of links // -- By treating the ready list as a queue, we maximize the distance between any // inter-dependent node calculations // -- All other (non-related) nodes in the ready list will automatically be inserted // in between each set of inter-dependent link calculations by this loop i = 0; while (readyListHead != readyListTail) { // Use ready list to select the next link to process linkNum = readyList[readyListHead++]; // Copy the next-to-calculate link back into the original link array psb->m_links[i++] = linkBuffer[linkNum]; // Free up any link inputs that are dependent on this one linkDep = linkDepListStarts[linkNum]; while (linkDep) { depLink = linkDep->value; if (depLink >= 0) { linkDepA[depLink] = REOP_NOT_DEPENDENT; } else { depLink = -depLink - 1; linkDepB[depLink] = REOP_NOT_DEPENDENT; } // Add this dependent link calculation to the ready list if *both* inputs are clear if ((linkDepA[depLink] == REOP_NOT_DEPENDENT) && (linkDepB[depLink] == REOP_NOT_DEPENDENT)) { readyList[readyListTail++] = depLink; linkDepA[depLink] = linkDepB[depLink] = REOP_NODE_COMPLETE; // Probably not needed now } linkDep = linkDep->next; } } // Delete the temporary buffers delete [] nodeWrittenAt; delete [] linkDepA; delete [] linkDepB; delete [] readyList; delete [] linkDepFreeList; delete [] linkDepListStarts; delete [] linkBuffer; } // void btSoftBodyHelpers::DrawFrame( btSoftBody* psb, btIDebugDraw* idraw) { if(psb->m_pose.m_bframe) { static const btScalar ascl=10; static const btScalar nscl=(btScalar)0.1; const btVector3 com=psb->m_pose.m_com; const btMatrix3x3 trs=psb->m_pose.m_rot*psb->m_pose.m_scl; const btVector3 Xaxis=(trs*btVector3(1,0,0)).normalized(); const btVector3 Yaxis=(trs*btVector3(0,1,0)).normalized(); const btVector3 Zaxis=(trs*btVector3(0,0,1)).normalized(); idraw->drawLine(com,com+Xaxis*ascl,btVector3(1,0,0)); idraw->drawLine(com,com+Yaxis*ascl,btVector3(0,1,0)); idraw->drawLine(com,com+Zaxis*ascl,btVector3(0,0,1)); for(int i=0;i<psb->m_pose.m_pos.size();++i) { const btVector3 x=com+trs*psb->m_pose.m_pos[i]; drawVertex(idraw,x,nscl,btVector3(1,0,1)); } } } // btSoftBody* btSoftBodyHelpers::CreateRope( btSoftBodyWorldInfo& worldInfo, const btVector3& from, const btVector3& to, int res, int fixeds) { /* Create nodes */ const int r=res+2; btVector3* x=new btVector3[r]; btScalar* m=new btScalar[r]; int i; for(i=0;i<r;++i) { const btScalar t=i/(btScalar)(r-1); x[i]=lerp(from,to,t); m[i]=1; } btSoftBody* psb= new btSoftBody(&worldInfo,r,x,m); if(fixeds&1) psb->setMass(0,0); if(fixeds&2) psb->setMass(r-1,0); delete[] x; delete[] m; /* Create links */ for(i=1;i<r;++i) { psb->appendLink(i-1,i); } /* Finished */ return(psb); } // btSoftBody* btSoftBodyHelpers::CreatePatch(btSoftBodyWorldInfo& worldInfo,const btVector3& corner00, const btVector3& corner10, const btVector3& corner01, const btVector3& corner11, int resx, int resy, int fixeds, bool gendiags) { #define IDX(_x_,_y_) ((_y_)*rx+(_x_)) /* Create nodes */ if((resx<2)||(resy<2)) return(0); const int rx=resx; const int ry=resy; const int tot=rx*ry; btVector3* x=new btVector3[tot]; btScalar* m=new btScalar[tot]; int iy; for(iy=0;iy<ry;++iy) { const btScalar ty=iy/(btScalar)(ry-1); const btVector3 py0=lerp(corner00,corner01,ty); const btVector3 py1=lerp(corner10,corner11,ty); for(int ix=0;ix<rx;++ix) { const btScalar tx=ix/(btScalar)(rx-1); x[IDX(ix,iy)]=lerp(py0,py1,tx); m[IDX(ix,iy)]=1; } } btSoftBody* psb=new btSoftBody(&worldInfo,tot,x,m); if(fixeds&1) psb->setMass(IDX(0,0),0); if(fixeds&2) psb->setMass(IDX(rx-1,0),0); if(fixeds&4) psb->setMass(IDX(0,ry-1),0); if(fixeds&8) psb->setMass(IDX(rx-1,ry-1),0); delete[] x; delete[] m; /* Create links and faces */ for(iy=0;iy<ry;++iy) { for(int ix=0;ix<rx;++ix) { const int idx=IDX(ix,iy); const bool mdx=(ix+1)<rx; const bool mdy=(iy+1)<ry; if(mdx) psb->appendLink(idx,IDX(ix+1,iy)); if(mdy) psb->appendLink(idx,IDX(ix,iy+1)); if(mdx&&mdy) { if((ix+iy)&1) { psb->appendFace(IDX(ix,iy),IDX(ix+1,iy),IDX(ix+1,iy+1)); psb->appendFace(IDX(ix,iy),IDX(ix+1,iy+1),IDX(ix,iy+1)); if(gendiags) { psb->appendLink(IDX(ix,iy),IDX(ix+1,iy+1)); } } else { psb->appendFace(IDX(ix,iy+1),IDX(ix,iy),IDX(ix+1,iy)); psb->appendFace(IDX(ix,iy+1),IDX(ix+1,iy),IDX(ix+1,iy+1)); if(gendiags) { psb->appendLink(IDX(ix+1,iy),IDX(ix,iy+1)); } } } } } /* Finished */ #undef IDX return(psb); } // btSoftBody* btSoftBodyHelpers::CreatePatchUV(btSoftBodyWorldInfo& worldInfo, const btVector3& corner00, const btVector3& corner10, const btVector3& corner01, const btVector3& corner11, int resx, int resy, int fixeds, bool gendiags, float* tex_coords) { /* * * corners: * * [0][0] corner00 ------- corner01 [resx][0] * | | * | | * [0][resy] corner10 -------- corner11 [resx][resy] * * * * * * * "fixedgs" map: * * corner00 --> +1 * corner01 --> +2 * corner10 --> +4 * corner11 --> +8 * upper middle --> +16 * left middle --> +32 * right middle --> +64 * lower middle --> +128 * center --> +256 * * * tex_coords size (resx-1)*(resy-1)*12 * * * * SINGLE QUAD INTERNALS * * 1) btSoftBody's nodes and links, * diagonal link is optional ("gendiags") * * * node00 ------ node01 * | . * | . * | . * | . * | . * node10 node11 * * * * 2) Faces: * two triangles, * UV Coordinates (hier example for single quad) * * (0,1) (0,1) (1,1) * 1 |\ 3 \-----| 2 * | \ \ | * | \ \ | * | \ \ | * | \ \ | * 2 |-----\ 3 \| 1 * (0,0) (1,0) (1,0) * * * * * * */ #define IDX(_x_,_y_) ((_y_)*rx+(_x_)) /* Create nodes */ if((resx<2)||(resy<2)) return(0); const int rx=resx; const int ry=resy; const int tot=rx*ry; btVector3* x=new btVector3[tot]; btScalar* m=new btScalar[tot]; int iy; for(iy=0;iy<ry;++iy) { const btScalar ty=iy/(btScalar)(ry-1); const btVector3 py0=lerp(corner00,corner01,ty); const btVector3 py1=lerp(corner10,corner11,ty); for(int ix=0;ix<rx;++ix) { const btScalar tx=ix/(btScalar)(rx-1); x[IDX(ix,iy)]=lerp(py0,py1,tx); m[IDX(ix,iy)]=1; } } btSoftBody* psb=new btSoftBody(&worldInfo,tot,x,m); if(fixeds&1) psb->setMass(IDX(0,0),0); if(fixeds&2) psb->setMass(IDX(rx-1,0),0); if(fixeds&4) psb->setMass(IDX(0,ry-1),0); if(fixeds&8) psb->setMass(IDX(rx-1,ry-1),0); if(fixeds&16) psb->setMass(IDX((rx-1)/2,0),0); if(fixeds&32) psb->setMass(IDX(0,(ry-1)/2),0); if(fixeds&64) psb->setMass(IDX(rx-1,(ry-1)/2),0); if(fixeds&128) psb->setMass(IDX((rx-1)/2,ry-1),0); if(fixeds&256) psb->setMass(IDX((rx-1)/2,(ry-1)/2),0); delete[] x; delete[] m; int z = 0; /* Create links and faces */ for(iy=0;iy<ry;++iy) { for(int ix=0;ix<rx;++ix) { const bool mdx=(ix+1)<rx; const bool mdy=(iy+1)<ry; int node00=IDX(ix,iy); int node01=IDX(ix+1,iy); int node10=IDX(ix,iy+1); int node11=IDX(ix+1,iy+1); if(mdx) psb->appendLink(node00,node01); if(mdy) psb->appendLink(node00,node10); if(mdx&&mdy) { psb->appendFace(node00,node10,node11); if (tex_coords) { tex_coords[z+0]=CalculateUV(resx,resy,ix,iy,0); tex_coords[z+1]=CalculateUV(resx,resy,ix,iy,1); tex_coords[z+2]=CalculateUV(resx,resy,ix,iy,0); tex_coords[z+3]=CalculateUV(resx,resy,ix,iy,2); tex_coords[z+4]=CalculateUV(resx,resy,ix,iy,3); tex_coords[z+5]=CalculateUV(resx,resy,ix,iy,2); } psb->appendFace(node11,node01,node00); if (tex_coords) { tex_coords[z+6 ]=CalculateUV(resx,resy,ix,iy,3); tex_coords[z+7 ]=CalculateUV(resx,resy,ix,iy,2); tex_coords[z+8 ]=CalculateUV(resx,resy,ix,iy,3); tex_coords[z+9 ]=CalculateUV(resx,resy,ix,iy,1); tex_coords[z+10]=CalculateUV(resx,resy,ix,iy,0); tex_coords[z+11]=CalculateUV(resx,resy,ix,iy,1); } if (gendiags) psb->appendLink(node00,node11); z += 12; } } } /* Finished */ #undef IDX return(psb); } float btSoftBodyHelpers::CalculateUV(int resx,int resy,int ix,int iy,int id) { /* * * * node00 --- node01 * | | * node10 --- node11 * * * ID map: * * node00 s --> 0 * node00 t --> 1 * * node01 s --> 3 * node01 t --> 1 * * node10 s --> 0 * node10 t --> 2 * * node11 s --> 3 * node11 t --> 2 * * */ float tc=0.0f; if (id == 0) { tc = (1.0f/((resx-1))*ix); } else if (id==1) { tc = (1.0f/((resy-1))*(resy-1-iy)); } else if (id==2) { tc = (1.0f/((resy-1))*(resy-1-iy-1)); } else if (id==3) { tc = (1.0f/((resx-1))*(ix+1)); } return tc; } // btSoftBody* btSoftBodyHelpers::CreateEllipsoid(btSoftBodyWorldInfo& worldInfo,const btVector3& center, const btVector3& radius, int res) { struct Hammersley { static void Generate(btVector3* x,int n) { for(int i=0;i<n;i++) { btScalar p=0.5,t=0; for(int j=i;j;p*=0.5,j>>=1) if(j&1) t+=p; btScalar w=2*t-1; btScalar a=(SIMD_PI+2*i*SIMD_PI)/n; btScalar s=btSqrt(1-w*w); *x++=btVector3(s*btCos(a),s*btSin(a),w); } } }; btAlignedObjectArray<btVector3> vtx; vtx.resize(3+res); Hammersley::Generate(&vtx[0],vtx.size()); for(int i=0;i<vtx.size();++i) { vtx[i]=vtx[i]*radius+center; } return(CreateFromConvexHull(worldInfo,&vtx[0],vtx.size())); } // btSoftBody* btSoftBodyHelpers::CreateFromTriMesh(btSoftBodyWorldInfo& worldInfo,const btScalar* vertices, const int* triangles, int ntriangles, bool randomizeConstraints) { int maxidx=0; int i,j,ni; for(i=0,ni=ntriangles*3;i<ni;++i) { maxidx=btMax(triangles[i],maxidx); } ++maxidx; btAlignedObjectArray<bool> chks; btAlignedObjectArray<btVector3> vtx; chks.resize(maxidx*maxidx,false); vtx.resize(maxidx); for(i=0,j=0,ni=maxidx*3;i<ni;++j,i+=3) { vtx[j]=btVector3(vertices[i],vertices[i+1],vertices[i+2]); } btSoftBody* psb=new btSoftBody(&worldInfo,vtx.size(),&vtx[0],0); for( i=0,ni=ntriangles*3;i<ni;i+=3) { const int idx[]={triangles[i],triangles[i+1],triangles[i+2]}; #define IDX(_x_,_y_) ((_y_)*maxidx+(_x_)) for(int j=2,k=0;k<3;j=k++) { if(!chks[IDX(idx[j],idx[k])]) { chks[IDX(idx[j],idx[k])]=true; chks[IDX(idx[k],idx[j])]=true; psb->appendLink(idx[j],idx[k]); } } #undef IDX psb->appendFace(idx[0],idx[1],idx[2]); } if (randomizeConstraints) { psb->randomizeConstraints(); } return(psb); } // btSoftBody* btSoftBodyHelpers::CreateFromConvexHull(btSoftBodyWorldInfo& worldInfo, const btVector3* vertices, int nvertices, bool randomizeConstraints) { HullDesc hdsc(QF_TRIANGLES,nvertices,vertices); HullResult hres; HullLibrary hlib;/*??*/ hdsc.mMaxVertices=nvertices; hlib.CreateConvexHull(hdsc,hres); btSoftBody* psb=new btSoftBody(&worldInfo,(int)hres.mNumOutputVertices, &hres.m_OutputVertices[0],0); for(int i=0;i<(int)hres.mNumFaces;++i) { const int idx[]={ static_cast<int>(hres.m_Indices[i*3+0]), static_cast<int>(hres.m_Indices[i*3+1]), static_cast<int>(hres.m_Indices[i*3+2])}; if(idx[0]<idx[1]) psb->appendLink( idx[0],idx[1]); if(idx[1]<idx[2]) psb->appendLink( idx[1],idx[2]); if(idx[2]<idx[0]) psb->appendLink( idx[2],idx[0]); psb->appendFace(idx[0],idx[1],idx[2]); } hlib.ReleaseResult(hres); if (randomizeConstraints) { psb->randomizeConstraints(); } return(psb); } static int nextLine(const char* buffer) { int numBytesRead=0; while (*buffer != '\n') { buffer++; numBytesRead++; } if (buffer[0]==0x0a) { buffer++; numBytesRead++; } return numBytesRead; } /* Create from TetGen .ele, .face, .node data */ btSoftBody* btSoftBodyHelpers::CreateFromTetGenData(btSoftBodyWorldInfo& worldInfo, const char* ele, const char* face, const char* node, bool bfacelinks, bool btetralinks, bool bfacesfromtetras) { btAlignedObjectArray<btVector3> pos; int nnode=0; int ndims=0; int nattrb=0; int hasbounds=0; int result = sscanf(node,"%d %d %d %d",&nnode,&ndims,&nattrb,&hasbounds); result = sscanf(node,"%d %d %d %d",&nnode,&ndims,&nattrb,&hasbounds); node += nextLine(node); pos.resize(nnode); for(int i=0;i<pos.size();++i) { int index=0; //int bound=0; float x,y,z; sscanf(node,"%d %f %f %f",&index,&x,&y,&z); // sn>>index; // sn>>x;sn>>y;sn>>z; node += nextLine(node); //for(int j=0;j<nattrb;++j) // sn>>a; //if(hasbounds) // sn>>bound; pos[index].setX(btScalar(x)); pos[index].setY(btScalar(y)); pos[index].setZ(btScalar(z)); } btSoftBody* psb=new btSoftBody(&worldInfo,nnode,&pos[0],0); #if 0 if(face&&face[0]) { int nface=0; sf>>nface;sf>>hasbounds; for(int i=0;i<nface;++i) { int index=0; int bound=0; int ni[3]; sf>>index; sf>>ni[0];sf>>ni[1];sf>>ni[2]; sf>>bound; psb->appendFace(ni[0],ni[1],ni[2]); if(btetralinks) { psb->appendLink(ni[0],ni[1],0,true); psb->appendLink(ni[1],ni[2],0,true); psb->appendLink(ni[2],ni[0],0,true); } } } #endif if(ele&&ele[0]) { int ntetra=0; int ncorner=0; int neattrb=0; sscanf(ele,"%d %d %d",&ntetra,&ncorner,&neattrb); ele += nextLine(ele); //se>>ntetra;se>>ncorner;se>>neattrb; for(int i=0;i<ntetra;++i) { int index=0; int ni[4]; //se>>index; //se>>ni[0];se>>ni[1];se>>ni[2];se>>ni[3]; sscanf(ele,"%d %d %d %d %d",&index,&ni[0],&ni[1],&ni[2],&ni[3]); ele+=nextLine(ele); //for(int j=0;j<neattrb;++j) // se>>a; psb->appendTetra(ni[0],ni[1],ni[2],ni[3]); if(btetralinks) { psb->appendLink(ni[0],ni[1],0,true); psb->appendLink(ni[1],ni[2],0,true); psb->appendLink(ni[2],ni[0],0,true); psb->appendLink(ni[0],ni[3],0,true); psb->appendLink(ni[1],ni[3],0,true); psb->appendLink(ni[2],ni[3],0,true); } } } printf("Nodes: %u\r\n",psb->m_nodes.size()); printf("Links: %u\r\n",psb->m_links.size()); printf("Faces: %u\r\n",psb->m_faces.size()); printf("Tetras: %u\r\n",psb->m_tetras.size()); return(psb); }
;/************************************************************************************************************************************ ;* PORT 1 ISR (Starting a Command Receive) ;* Here starts the hard real time stuff. ;* MCLK is 16 MHz (See Clocking.asm) -> 0.0625 us per cycle ;* Entering ISR takes 6 cycles (4.5.1.5.1) + Time needed to wake up from LPM1 (~4 us) ;* Each BIT.B takes 5-1 cycles (4.5.1.5.4) ;* Each JNZ or JZ takes 2 cycles regardless whether it is taken or not (4.5.1.5.3) ;* Start this ISR at t = 0.375 us + wake up time (~1.5 us?) TODO: Find out this exact wakeup time or why we have this gap. ;* Listed instruction cycles are taken from MSP430FR5969 User Guide (SLAU367F). ;* ;* Purpose: ;* This ISR kicks in on a falling edge and tries to find the rising edge marking the end of the delimiter of a PREAMBLE/FRAME-SYNC. ;* After that, we disable PORT1 interrupts and setup Timer0A0. ;* In the worst case (readers with 6.25 Tari), we only have 0.475*6.25 us = 47 clock cycles) before the falling edge of data-0. ;* Then we quickly return from this interrupt and wait for Timer0A0 to wake us up on the data-0 falling edge. ;* An ASCII drawing of the situation can be found below: ;* ;* | data-0 | RTCAL | ;* /-----\_____/------------------------\____/ - Wave form ;* ;************************************************************************************************************************************* .cdecls C, LIST, "../globals.h" .retain .retainrefs RX_ISR: ; XOR.B #PIN_AUX3, &PIN_AUX3_OUT BIT.B #PIN_RX, &PRXIN ;[4] JNZ badDelim ;[2] BIT.B #PIN_RX, &PRXIN ;[4] JNZ badDelim ;[2] BIT.B #PIN_RX, &PRXIN ;[4] JNZ badDelim ;[2] ;;;Around 2.7us BIT.B #PIN_RX, &PRXIN ;[4] JNZ badDelim ;[2] BIT.B #PIN_RX, &PRXIN ;[4] JNZ badDelim ;[2] BIT.B #PIN_RX, &PRXIN ;[4] JNZ badDelim ;[2] BIT.B #PIN_RX, &PRXIN ;[4] JNZ badDelim ;[2] BIT.B #PIN_RX, &PRXIN ;[4] JNZ badDelim ;[2] BIT.B #PIN_RX, &PRXIN ;[4] JNZ badDelim BIT.B #PIN_RX, &PRXIN ;[4] JNZ badDelim ;[2] BIT.B #PIN_RX, &PRXIN ;[4] JNZ badDelim ;[2] BIT.B #PIN_RX, &PRXIN ;[4] JNZ badDelim ;[2] BIT.B #PIN_RX, &PRXIN ;[4] JNZ badDelim ;[2] BIT.B #PIN_RX, &PRXIN ;[4] JNZ badDelim ;[2] BIT.B #PIN_RX, &PRXIN ;[4] JNZ badDelim ;[2] ; BIT.B #PIN_RX, &PRXIN ;[4] ; JNZ badDelim ;[2] ; BIT.B #PIN_RX, &PRXIN ;[3] ; JNZ badDelim ;[2] ; BIT.B #PIN_RX, &PRXIN ;[3] ; JNZ badDelim ;[2] ;;;Around 8.5us ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;********************************************************************************************************************************* ; JUST RIGHT (8us < DELIM <16us @ 16MHz) ;********************************************************************************************************************************* BIT.B #PIN_RX, &PRXIN ;[4] JNZ goodDelim ;[2] BIT.B #PIN_RX, &PRXIN ;[4] JNZ goodDelim ;[2] BIT.B #PIN_RX, &PRXIN ;[4] JNZ goodDelim ;[2] BIT.B #PIN_RX, &PRXIN ;[4] JNZ goodDelim ;[2] BIT.B #PIN_RX, &PRXIN ;[4] JNZ goodDelim BIT.B #PIN_RX, &PRXIN ;[4] JNZ goodDelim BIT.B #PIN_RX, &PRXIN ;[4] JNZ goodDelim BIT.B #PIN_RX, &PRXIN ;[4] JNZ goodDelim BIT.B #PIN_RX, &PRXIN ;[4] JNZ goodDelim BIT.B #PIN_RX, &PRXIN ;[4] JNZ goodDelim BIT.B #PIN_RX, &PRXIN ;[4] JNZ goodDelim ;[2] BIT.B #PIN_RX, &PRXIN ;[4] JNZ goodDelim ;[2] BIT.B #PIN_RX, &PRXIN ;[4] JNZ goodDelim ;[2] BIT.B #PIN_RX, &PRXIN ;[4] JNZ goodDelim ;[2] BIT.B #PIN_RX, &PRXIN ;[4] JNZ goodDelim ;[2] BIT.B #PIN_RX, &PRXIN ;[4] JNZ goodDelim ;[2] BIT.B #PIN_RX, &PRXIN ;[4] JNZ goodDelim ;[2] BIT.B #PIN_RX, &PRXIN ;[4] JNZ goodDelim BIT.B #PIN_RX, &PRXIN ;[4] JNZ goodDelim ; XOR.B #PIN_AUX3, &PIN_AUX3_OUT ; BIT.B #PIN_RX, &PRXIN ;[4] ; JNZ goodDelim ; BIT.B #PIN_RX, &PRXIN ;[4] ; JNZ goodDelim ; BIT.B #PIN_RX, &PRXIN ;[4] ; JNZ goodDelim ; BIT.B #PIN_RX, &PRXIN ;[4] ; JNZ goodDelim ;;;Around 16us ; Delim is too short so go back to sleep. badDelim: ; XOR.B #PIN_AUX3, &PIN_AUX3_OUT BIC.W #(CCIE),&TA0CCTL0 ; Disable timer interrupt to avoid entering lpm1 instead of lpm4. CLR &TA0CTL ;[] Disable TimerA since we should again look for the next delim and stay in lpm4 BIT.B R15, R14 ;[] BIC #CCIFG, &TA0CCTL0 ;[] Clear the interrupt flag for Timer0A0 Compare (safety). CLR &TA0R ;[] Reset TAR value CLR &(rfid.edge_capture_prev_ccr) ;[] Clear previous value of CCR capture. CLR.B &PRXIFG ;[] Clear the Port 1 flag. RETI ; We found a delim ~12.5 us, now turn off PORT1 and prepare Timer0A0. goodDelim: ;[24] BIS.B #PIN_RX, &PRXSEL0 ;[5] Enable Timer0A0 BIC.B #PIN_RX, &PRXSEL1 ;[5] Enable Timer0A0 CLR.B &PRXIE ;[4] Disable the Port 1 Interrupt BIC #(SCG1), 0(SP) ;[5] Enable the DCO to start counting BIS.W #(CM_2+CCIE), &TA0CCTL0 ;[5] Wake up so we can make use of Timer0A0 control registers? MOV #(TASSEL__SMCLK+MC__CONTINOUS) , &TA0CTL ;[] SMCLK and continuous mode. (TASSEL1 + MC1), now timer0A0 can be started startupT0A0_ISR: ;[22] BIC #CCIFG, &TA0CCTL0 ;[5] Clear the interrupt flag for Timer0A0 Compare CLR &TA0R ;[4] ***Reset clock!*** CLR &(rfid.edge_capture_prev_ccr) ;[4] Clear previous value of CCR capture CLR.B &PRXIFG ;[4] Clear the Port 1 flag. RETI ;[5] Return from interrupt (46 cycles total). ;************************************************************************************************************************************* ; DEFINE THE INTERRUPT VECTOR ASSIGNMENT ;************************************************************************************************************************************* ;.sect ".int36" ; Port 1 Vector ;.short RX_ISR ; This sect/short pair sets int02 = RX_ISR addr. .end
#ifndef VMENU_HPP_DF9F4258_12AF_4721_9D5F_BE29A59649C2 #define VMENU_HPP_DF9F4258_12AF_4721_9D5F_BE29A59649C2 #pragma once /* vmenu.hpp Обычное вертикальное меню а так же: * список в DI_COMBOBOX * список в DI_LISTBOX * ... */ /* Copyright © 1996 Eugene Roshal Copyright © 2000 Far Group All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The name of the authors may not be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR 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. */ #include "modal.hpp" #include "bitflags.hpp" #include "farcolor.hpp" #include "common/range.hpp" // Цветовые атрибуты - индексы в массиве цветов enum vmenu_colors { VMenuColorBody = 0, // подложка VMenuColorBox = 1, // рамка VMenuColorTitle = 2, // заголовок - верхний и нижний VMenuColorText = 3, // Текст пункта VMenuColorHilite = 4, // HotKey VMenuColorSeparator = 5, // separator VMenuColorSelected = 6, // Выбранный VMenuColorHSelect = 7, // Выбранный - HotKey VMenuColorScrollBar = 8, // ScrollBar VMenuColorDisabled = 9, // Disabled VMenuColorArrows =10, // '<' & '>' обычные VMenuColorArrowsSelect =11, // '<' & '>' выбранные VMenuColorArrowsDisabled =12, // '<' & '>' Disabled VMenuColorGrayed =13, // "серый" VMenuColorSelGrayed =14, // выбранный "серый" VMENU_COLOR_COUNT, // всегда последняя - размерность массива }; enum VMENU_FLAGS { VMENU_NONE =0x00000000, VMENU_ALWAYSSCROLLBAR =0x00000100, // всегда показывать скроллбар VMENU_LISTBOX =0x00000200, // Это список в диалоге VMENU_SHOWNOBOX =0x00000400, // показать без рамки VMENU_AUTOHIGHLIGHT =0x00000800, // автоматически выбирать симолы подсветки VMENU_REVERSEHIGHLIGHT =0x00001000, // ... только с конца VMENU_UPDATEREQUIRED =0x00002000, // лист необходимо обновить (перерисовать) VMENU_DISABLEDRAWBACKGROUND=0x00004000, // подложку не рисовать VMENU_WRAPMODE =0x00008000, // зацикленный список (при перемещении) VMENU_SHOWAMPERSAND =0x00010000, // символ '&' показывать AS IS VMENU_WARNDIALOG =0x00020000, // VMENU_LISTHASFOCUS =0x00200000, // меню является списком в диалоге и имеет фокус VMENU_COMBOBOX =0x00400000, // меню является комбобоксом и обрабатывается менеджером по-особому. VMENU_MOUSEDOWN =0x00800000, // VMENU_CHANGECONSOLETITLE =0x01000000, // VMENU_MOUSEREACTION =0x02000000, // реагировать на движение мыши? (перемещать позицию при перемещении курсора мыши?) VMENU_DISABLED =0x04000000, // VMENU_NOMERGEBORDER =0x08000000, // VMENU_REFILTERREQUIRED =0x10000000, // перед отрисовкой необходимо обновить фильтр VMENU_LISTSINGLEBOX =0x20000000, // список, всегда с одинарной рамкой VMENU_COMBOBOXEVENTKEY =0x40000000, // посылать события клавиатуры в диалоговую проц. для открытого комбобокса VMENU_COMBOBOXEVENTMOUSE =0x80000000, // посылать события мыши в диалоговую проц. для открытого комбобокса }; class Dialog; class SaveScreen; struct menu_item { string Name; LISTITEMFLAGS Flags{}; DWORD AccelKey{}; menu_item() = default; explicit menu_item(string_view const Text): Name(string(Text)) { } menu_item(string_view const Text, LISTITEMFLAGS const Flags, DWORD const AccelKey = 0): Name(string(Text)), Flags(Flags), AccelKey(AccelKey) { } unsigned long long SetCheck(int Value) { if (Value) { Flags|=LIF_CHECKED; Flags &= ~0xFFFF; if (Value!=1) Flags|=Value&0xFFFF; } else { Flags&=~(0xFFFF|LIF_CHECKED); } return Flags; } LISTITEMFLAGS SetSelect(bool Value) { if (Value) Flags|=LIF_SELECTED; else Flags&=~LIF_SELECTED; return Flags;} LISTITEMFLAGS SetDisable(bool Value) { if (Value) Flags|=LIF_DISABLE; else Flags&=~LIF_DISABLE; return Flags;} LISTITEMFLAGS SetGrayed(bool Value) { if (Value) Flags|=LIF_GRAYED; else Flags&=~LIF_GRAYED; return Flags;} }; struct MenuItemEx: menu_item { NONCOPYABLE(MenuItemEx); MOVABLE(MenuItemEx); MenuItemEx() = default; using menu_item::menu_item; std::any ComplexUserData; intptr_t SimpleUserData{}; int ShowPos{}; short AmpPos{}; // Позиция автоназначенной подсветки short Len[2]{}; // размеры 2-х частей short Idx2{}; // начало 2-й части std::list<std::pair<int, int>> Annotations; }; struct SortItemParam { bool Reverse; int Offset; }; class window; class VMenu: public SimpleModal { struct private_tag {}; public: static vmenu_ptr create(string Title, range<const menu_item*> Data, int MaxHeight = 0, DWORD Flags = 0, dialog_ptr ParentDialog = nullptr); VMenu(private_tag, string Title, int MaxHeight, dialog_ptr ParentDialog); ~VMenu() override; void Show() override; void Hide() override; string GetTitle() const override; FARMACROAREA GetMacroArea() const override; int GetTypeAndName(string &strType, string &strName) override; int GetType() const override { return CheckFlags(VMENU_COMBOBOX) ? windowtype_combobox : windowtype_menu; } bool ProcessKey(const Manager::Key& Key) override; bool ProcessMouse(const MOUSE_EVENT_RECORD *MouseEvent) override; long long VMProcess(int OpCode, void* vParam = nullptr, long long iParam = 0) override; void ResizeConsole() override; void SetDeleting() override; void ShowConsoleTitle() override; void FastShow() { ShowMenu(); } void ResetCursor(); void SetTitle(const string& Title); void SetBottomTitle(const wchar_t *BottomTitle); string &GetBottomTitle(string &strDest) const; void SetDialogStyle(bool Style) { ChangeFlags(VMENU_WARNDIALOG, Style); SetColors(nullptr); } void SetUpdateRequired(bool SetUpdate) { ChangeFlags(VMENU_UPDATEREQUIRED, SetUpdate); } void SetBoxType(int BoxType); void SetMenuFlags(DWORD Flags) { VMFlags.Set(Flags); } void ClearFlags(DWORD Flags) { VMFlags.Clear(Flags); } bool CheckFlags(DWORD Flags) const { return VMFlags.Check(Flags); } DWORD GetFlags() const { return VMFlags.Flags(); } DWORD ChangeFlags(DWORD Flags, bool Status) { return VMFlags.Change(Flags, Status); } void AssignHighlights(int Reverse); void SetColors(const FarDialogItemColors *ColorsIn = nullptr); void GetColors(FarDialogItemColors *ColorsOut); void SetOneColor(int Index, PaletteColors Color); bool ProcessFilterKey(int Key); void clear(); int DeleteItem(int ID, int Count = 1); int AddItem(MenuItemEx&& NewItem, int PosAdd = 0x7FFFFFFF); int AddItem(const FarList *NewItem); int AddItem(const wchar_t *NewStrItem); int InsertItem(const FarListInsert *NewItem); bool UpdateItem(const FarListUpdate *NewItem); int FindItem(const FarListFind *FindItem); int FindItem(int StartIndex, const string& Pattern, unsigned long long Flags = 0); void RestoreFilteredItems(); void FilterStringUpdated(); void FilterUpdateHeight(bool bShrink = false); void SetFilterEnabled(bool bEnabled) { bFilterEnabled = bEnabled; } void SetFilterLocked(bool bLocked) { bFilterEnabled = bLocked; } bool AddToFilter(string_view Str); void SetFilterString(const wchar_t *str); // SelectPos == -1 & non-empty Items - everything is filtered size_t size() const { return SelectPos == -1? 0 : Items.size(); } bool empty() const { return SelectPos == -1 || Items.empty(); } int GetShowItemCount() const { return static_cast<int>(Items.size() - ItemHiddenCount); } int GetVisualPos(int Pos); int VisualPosToReal(int VPos); intptr_t GetSimpleUserData(int Position = -1) const; std::any* GetComplexUserData(int Position = -1); template<class T> T* GetComplexUserDataPtr(int Position = -1) { return std::any_cast<T>(GetComplexUserData(Position)); } void SetComplexUserData(const std::any& Data, int Position = -1); int GetSelectPos() const { return SelectPos; } int GetLastSelectPosResult() const { return SelectPosResult; } int GetSelectPos(FarListPos *ListPos) const; int SetSelectPos(const FarListPos *ListPos, int Direct = 0); int SetSelectPos(int Pos, int Direct, bool stop_on_edge = false); int GetCheck(int Position = -1); void SetCheck(int Check, int Position = -1); bool UpdateRequired() const; void UpdateItemFlags(int Pos, unsigned long long NewFlags); MenuItemEx& at(size_t n); MenuItemEx& current() { return at(-1); } bool Pack(); bool GetVMenuInfo(FarListInfo* Info) const; void SetMaxHeight(int NewMaxHeight); size_t GetVDialogItemID() const { return DialogItemID; } void SetVDialogItemID(size_t NewDialogItemID) { DialogItemID = NewDialogItemID; } void SetId(const GUID& Id); const GUID& Id() const; bool IsComboBox() const { return GetDialog() && CheckFlags(VMENU_COMBOBOX); } dialog_ptr GetDialog() const {return ParentDialog.lock();} void SortItems(bool Reverse = false, int Offset = 0); template<class predicate> void SortItems(predicate Pred, bool Reverse = false, int Offset = 0) { SortItemParam Param { Reverse, Offset }; std::sort(ALL_RANGE(Items), [&](const auto& a, const auto& b) { return Pred(a, b, Param); }); // скорректируем SelectPos UpdateSelectPos(); SetMenuFlags(VMENU_UPDATEREQUIRED); } static FarListItem *MenuItem2FarList(const MenuItemEx *ListItem, FarListItem *Item); static std::vector<string> AddHotkeys(range<menu_item*> MenuItems); private: void init(range<const menu_item*> Data, DWORD Flags); void DisplayObject() override; void ShowMenu(bool IsParent = false); void DrawTitles() const; int GetItemPosition(int Position) const; bool CheckKeyHiOrAcc(DWORD Key,int Type,int Translate,bool ChangePos,int& NewPos); int CheckHighlights(wchar_t Chr,int StartPos=0); wchar_t GetHighlights(const MenuItemEx *_item) const; bool ShiftItemShowPos(int Pos,int Direct); bool ItemCanHaveFocus(unsigned long long Flags) const; bool ItemCanBeEntered(unsigned long long Flags) const; bool ItemIsVisible(unsigned long long Flags) const; void UpdateMaxLengthFromTitles(); void UpdateMaxLength(size_t Length); void UpdateInternalCounters(unsigned long long OldFlags, unsigned long long NewFlags); bool ShouldSendKeyToFilter(int Key) const; //корректировка текущей позиции и флагов SELECTED void UpdateSelectPos(); string strTitle; string strBottomTitle; int SelectPos; int SelectPosResult; int TopPos; int MaxHeight; bool WasAutoHeight; size_t m_MaxLength; int m_BoxType; window_ptr CurrentWindow; bool PrevCursorVisible; DWORD PrevCursorSize; // переменная, отвечающая за отображение scrollbar в DI_LISTBOX & DI_COMBOBOX BitFlags VMFlags; BitFlags VMOldFlags; // Для LisBox - родитель в виде диалога std::weak_ptr<Dialog> ParentDialog; size_t DialogItemID; bool bFilterEnabled; bool bFilterLocked; string strFilter; std::vector<MenuItemEx> Items; intptr_t ItemHiddenCount; intptr_t ItemSubMenusCount; FarColor Colors[VMENU_COLOR_COUNT]; size_t MaxLineWidth; bool bRightBtnPressed; GUID MenuId; }; #endif // VMENU_HPP_DF9F4258_12AF_4721_9D5F_BE29A59649C2
copyright zengfr site:http://github.com/zengfr/romhack 00042A move.l D1, (A0)+ 00042C dbra D0, $42a 009612 move.l D1, (A0)+ [base+ 3A, base+ 4A, base+ 5A, base+ 8A, base+ 9A, base+ AA, base+ BA, base+ EA, base+ FA, base+12A, base+13A, base+16A, base+17A, base+1CA, base+1DA, base+20A, base+21A, base+24A, base+25A, base+28A, base+29A, base+2AA, base+2BA, base+2EA, base+2FA, base+32A, base+33A, base+36A, base+37A, base+3CA, base+3DA, base+40A, base+41A, base+42A] 009614 move.l D2, (A0)+ [base+ 3C, base+ 4C, base+ 4E, base+ 5C, base+ 5E, base+ EC, base+ EE, base+ FC, base+ FE, base+16C, base+16E, base+17C, base+17E, base+20C, base+20E, base+21C, base+21E, base+28C, base+28E, base+29C, base+29E, base+2AC, base+2AE, base+2BC, base+2BE, base+32C, base+32E, base+33C, base+33E, base+3CC, base+3CE, base+3DC, base+3DE, base+42E] 00968E move.l D1, (A0)+ [base+ 3A, base+ 4A, base+ 5A, base+ 8A, base+ 9A, base+ AA, base+ BA, base+ EA, base+ FA, base+12A, base+13A, base+16A, base+17A, base+1CA, base+1DA, base+20A, base+21A, base+24A, base+25A, base+28A, base+29A, base+2AA, base+2BA, base+2EA, base+2FA, base+32A, base+33A, base+36A, base+37A, base+3CA, base+3DA, base+40A, base+41A, base+42A] 009690 move.l D2, (A0)+ [base+ 3C, base+ 4C, base+ 4E, base+ 5C, base+ 5E, base+ EC, base+ EE, base+ FC, base+ FE, base+16C, base+16E, base+17C, base+17E, base+20C, base+20E, base+21C, base+21E, base+28C, base+28E, base+29C, base+29E, base+2AC, base+2AE, base+2BC, base+2BE, base+32C, base+32E, base+33C, base+33E, base+3CC, base+3CE, base+3DC, base+3DE, base+42E] 009716 move.l D1, (A0)+ [base+14A, base+16A, base+17A, base+18A, base+1CA, base+1FA, base+22A, base+27A, base+28A, base+2AA, base+2EA, base+32A, base+34A, base+39A, base+3EA, base+3FA, base+42A] 009718 move.l D2, (A0)+ [base+14C, base+14E, base+16C, base+16E, base+17C, base+17E, base+18C, base+18E, base+1CC, base+1CE, base+1FC, base+1FE, base+22C, base+22E, base+27C, base+27E, base+28C, base+28E, base+2AC, base+2AE, base+2EE, base+32C, base+32E, base+34C, base+34E, base+39C, base+39E, base+3EE, base+3FC, base+3FE, base+42C, base+42E] 00A61C move.l D1, (A0)+ 00A61E move.l D1, (A0)+ 00A64C move.l D1, (A0)+ [base+ 3A, base+ 4A, base+ 5A, base+ 8A, base+ 9A, base+ AA, base+ BA, base+ EA, base+ FA, base+12A, base+13A, base+16A, base+17A, base+1CA, base+1DA, base+20A, base+21A, base+24A, base+25A, base+28A, base+29A, base+2AA, base+2BA, base+2EA, base+2FA, base+32A, base+33A, base+36A, base+37A, base+3CA, base+3DA, base+40A, base+41A, base+42A] 00A64E move.l D2, (A0)+ [base+ 3C, base+ 4C, base+ 4E, base+ 5C, base+ 5E, base+ EC, base+ EE, base+ FC, base+ FE, base+16C, base+16E, base+17C, base+17E, base+20C, base+20E, base+21C, base+21E, base+28C, base+28E, base+29C, base+29E, base+2AC, base+2AE, base+2BC, base+2BE, base+32C, base+32E, base+33C, base+33E, base+3CC, base+3CE, base+3DC, base+3DE, base+42E] 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
; A198793: Triangle T(n,k), read by rows, given by (1,0,0,1,0,0,0,0,0,0,0,...) DELTA (0,1,1,0,0,0,0,0,0,0,0,...) where DELTA is the operator defined in A084938. ; Submitted by Jon Maiga ; 1,1,0,1,1,0,1,2,2,0,1,3,6,4,0,1,4,12,16,8,0,1,5,20,40,40,16,0,1,6,30,80,120,96,32,0,1,7,42,140,280,336,224,64,0,1,8,56,224,560,896,896,512,128,0,1,9,72,336,1008,2016,2688,2304,1152,256,0 lpb $0 add $1,1 sub $0,$1 lpe sub $1,1 bin $1,$0 mov $2,$0 mov $0,2 pow $0,$2 mul $1,$0 dif $1,2 mov $0,$1
; A056833: Nearest integer to n^2/7. ; 0,0,1,1,2,4,5,7,9,12,14,17,21,24,28,32,37,41,46,52,57,63,69,76,82,89,97,104,112,120,129,137,146,156,165,175,185,196,206,217,229,240,252,264,277,289,302,316,329,343,357,372,386,401,417,432,448 pow $0,2 add $0,4 div $0,7
; A056488: Number of periodic palindromes using a maximum of six different symbols. ; 6,21,36,126,216,756,1296,4536,7776,27216,46656,163296,279936,979776,1679616,5878656,10077696,35271936,60466176,211631616,362797056,1269789696,2176782336,7618738176,13060694016,45712429056,78364164096,274274574336,470184984576,1645647446016,2821109907456,9873884676096,16926659444736,59243308056576,101559956668416,355459848339456,609359740010496,2132759090036736,3656158440062976,12796554540220416,21936950640377856,76779327241322496,131621703842267136,460675963447934976,789730223053602816,2764055780687609856,4738381338321616896,16584334684125659136,28430288029929701376,99506008104753954816,170581728179578208256,597036048628523728896,1023490369077469249536,3582216291771142373376,6140942214464815497216,21493297750626854240256,36845653286788892983296,128959786503761125441536,221073919720733357899776,773758719022566752649216,1326443518324400147398656,4642552314135400515895296,7958661109946400884391936,27855313884812403095371776,47751966659678405306351616,167131883308874418572230656,286511799958070431838109696,1002791299853246511433383936,1719070799748422591028658176,6016747799119479068600303616,10314424798490535546171949056,36100486794716874411601821696,61886548790943213277031694336,216602920768301246469610930176,371319292745659279662190166016,1299617524609807478817665581056,2227915756473955677973140996096,7797705147658844872905993486336,13367494538843734067838845976576,46786230885953069237435960918016,80204967233062404407033075859456,280717385315718415424615765508096,481229803398374426442198455156736,1684304311894310492547694593048576,2887378820390246558653190730940416,10105825871365862955286167558291456,17324272922341479351919144385642496,60634955228195177731717005349748736,103945637534048876111514866313854976,363809731369171066390302032098492416,623673825204293256669089197883129856 lpb $0 mov $2,$1 trn $2,$0 sub $0,1 add $1,1 mul $2,5 add $1,$2 lpe mul $1,15 add $1,6 mov $0,$1
%include "../defaults_bin.asm" mov ax,0xe000 mov ds,ax mov cx,0 cld loopTop: lodsb cmp al,0 jne notZero printCharacter mov al,0 jmp notEOF notZero: cmp al,26 jne notEOF printCharacter 0 mov al,1 notEOF: printCharacter loop loopTop retf
// Copyright (c) 2011-2014 The Bitcoin developers // Copyright (c) 2014-2015 The Dash developers // Copyright (c) 2015-2018 The PIVX developers // Copyright (c) 2018 The SKW Core developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "walletmodel.h" #include "addresstablemodel.h" #include "guiconstants.h" #include "recentrequeststablemodel.h" #include "transactiontablemodel.h" #include "base58.h" #include "db.h" #include "keystore.h" #include "main.h" #include "spork.h" #include "sync.h" #include "ui_interface.h" #include "wallet.h" #include "walletdb.h" // for BackupWallet #include <stdint.h> #include <QDebug> #include <QSet> #include <QTimer> using namespace std; WalletModel::WalletModel(CWallet* wallet, OptionsModel* optionsModel, QObject* parent) : QObject(parent), wallet(wallet), optionsModel(optionsModel), addressTableModel(0), transactionTableModel(0), recentRequestsTableModel(0), cachedBalance(0), cachedUnconfirmedBalance(0), cachedImmatureBalance(0), cachedEncryptionStatus(Unencrypted), cachedNumBlocks(0) { fHaveWatchOnly = wallet->HaveWatchOnly(); fHaveMultiSig = wallet->HaveMultiSig(); fForceCheckBalanceChanged = false; addressTableModel = new AddressTableModel(wallet, this); transactionTableModel = new TransactionTableModel(wallet, this); recentRequestsTableModel = new RecentRequestsTableModel(wallet, this); // This timer will be fired repeatedly to update the balance pollTimer = new QTimer(this); connect(pollTimer, SIGNAL(timeout()), this, SLOT(pollBalanceChanged())); pollTimer->start(MODEL_UPDATE_DELAY); subscribeToCoreSignals(); } WalletModel::~WalletModel() { unsubscribeFromCoreSignals(); } CAmount WalletModel::getBalance(const CCoinControl* coinControl) const { if (coinControl) { CAmount nBalance = 0; std::vector<COutput> vCoins; wallet->AvailableCoins(vCoins, true, coinControl); BOOST_FOREACH (const COutput& out, vCoins) if (out.fSpendable) nBalance += out.tx->vout[out.i].nValue; return nBalance; } return wallet->GetBalance(); } CAmount WalletModel::getUnconfirmedBalance() const { return wallet->GetUnconfirmedBalance(); } CAmount WalletModel::getImmatureBalance() const { return wallet->GetImmatureBalance(); } CAmount WalletModel::getLockedBalance() const { return wallet->GetLockedCoins(); } bool WalletModel::haveWatchOnly() const { return fHaveWatchOnly; } CAmount WalletModel::getWatchBalance() const { return wallet->GetWatchOnlyBalance(); } CAmount WalletModel::getWatchUnconfirmedBalance() const { return wallet->GetUnconfirmedWatchOnlyBalance(); } CAmount WalletModel::getWatchImmatureBalance() const { return wallet->GetImmatureWatchOnlyBalance(); } void WalletModel::updateStatus() { EncryptionStatus newEncryptionStatus = getEncryptionStatus(); if (cachedEncryptionStatus != newEncryptionStatus) emit encryptionStatusChanged(newEncryptionStatus); } void WalletModel::pollBalanceChanged() { // Get required locks upfront. This avoids the GUI from getting stuck on // periodical polls if the core is holding the locks for a longer time - // for example, during a wallet rescan. TRY_LOCK(cs_main, lockMain); if (!lockMain) return; TRY_LOCK(wallet->cs_wallet, lockWallet); if (!lockWallet) return; if (fForceCheckBalanceChanged || chainActive.Height() != cachedNumBlocks || cachedTxLocks != nCompleteTXLocks) { fForceCheckBalanceChanged = false; // Balance and number of transactions might have changed cachedNumBlocks = chainActive.Height(); checkBalanceChanged(); if (transactionTableModel) { transactionTableModel->updateConfirmations(); } } } void WalletModel::emitBalanceChanged() { // Force update of UI elements even when no values have changed emit balanceChanged(cachedBalance, cachedUnconfirmedBalance, cachedImmatureBalance, 0,0,0, cachedWatchOnlyBalance, cachedWatchUnconfBalance, cachedWatchImmatureBalance); } void WalletModel::checkBalanceChanged() { TRY_LOCK(cs_main, lockMain); if (!lockMain) return; CAmount newBalance = getBalance(); CAmount newUnconfirmedBalance = getUnconfirmedBalance(); CAmount newImmatureBalance = getImmatureBalance(); CAmount newWatchOnlyBalance = 0; CAmount newWatchUnconfBalance = 0; CAmount newWatchImmatureBalance = 0; if (haveWatchOnly()) { newWatchOnlyBalance = getWatchBalance(); newWatchUnconfBalance = getWatchUnconfirmedBalance(); newWatchImmatureBalance = getWatchImmatureBalance(); } if (cachedBalance != newBalance || cachedUnconfirmedBalance != newUnconfirmedBalance || cachedImmatureBalance != newImmatureBalance || cachedWatchOnlyBalance != newWatchOnlyBalance || cachedWatchUnconfBalance != newWatchUnconfBalance || cachedWatchImmatureBalance != newWatchImmatureBalance || cachedTxLocks != nCompleteTXLocks ) { cachedBalance = newBalance; cachedUnconfirmedBalance = newUnconfirmedBalance; cachedImmatureBalance = newImmatureBalance; cachedTxLocks = nCompleteTXLocks; cachedWatchOnlyBalance = newWatchOnlyBalance; cachedWatchUnconfBalance = newWatchUnconfBalance; cachedWatchImmatureBalance = newWatchImmatureBalance; emit balanceChanged(newBalance, newUnconfirmedBalance, newImmatureBalance, 0,0,0, newWatchOnlyBalance, newWatchUnconfBalance, newWatchImmatureBalance); } } void WalletModel::updateTransaction() { // Balance and number of transactions might have changed fForceCheckBalanceChanged = true; } void WalletModel::updateAddressBook(const QString& address, const QString& label, bool isMine, const QString& purpose, int status) { if (addressTableModel) addressTableModel->updateEntry(address, label, isMine, purpose, status); } void WalletModel::updateAddressBook(const QString &pubCoin, const QString &isUsed, int status) { if(addressTableModel) addressTableModel->updateEntry(pubCoin, isUsed, status); } void WalletModel::updateWatchOnlyFlag(bool fHaveWatchonly) { fHaveWatchOnly = fHaveWatchonly; emit notifyWatchonlyChanged(fHaveWatchonly); } void WalletModel::updateMultiSigFlag(bool fHaveMultiSig) { this->fHaveMultiSig = fHaveMultiSig; emit notifyMultiSigChanged(fHaveMultiSig); } bool WalletModel::validateAddress(const QString& address) { CBitcoinAddress addressParsed(address.toStdString()); return addressParsed.IsValid(); } void WalletModel::updateAddressBookLabels(const CTxDestination& dest, const string& strName, const string& strPurpose) { LOCK(wallet->cs_wallet); std::map<CTxDestination, CAddressBookData>::iterator mi = wallet->mapAddressBook.find(dest); // Check if we have a new address or an updated label if (mi == wallet->mapAddressBook.end()) { wallet->SetAddressBook(dest, strName, strPurpose); } else if (mi->second.name != strName) { wallet->SetAddressBook(dest, strName, ""); // "" means don't change purpose } } WalletModel::SendCoinsReturn WalletModel::prepareTransaction(WalletModelTransaction& transaction, const CCoinControl* coinControl) { CAmount total = 0; QList<SendCoinsRecipient> recipients = transaction.getRecipients(); std::vector<std::pair<CScript, CAmount> > vecSend; if (recipients.empty()) { return OK; } QSet<QString> setAddress; // Used to detect duplicates int nAddresses = 0; // Pre-check input data for validity foreach (const SendCoinsRecipient& rcp, recipients) { if (rcp.paymentRequest.IsInitialized()) { // PaymentRequest... CAmount subtotal = 0; const payments::PaymentDetails& details = rcp.paymentRequest.getDetails(); for (int i = 0; i < details.outputs_size(); i++) { const payments::Output& out = details.outputs(i); if (out.amount() <= 0) continue; subtotal += out.amount(); const unsigned char* scriptStr = (const unsigned char*)out.script().data(); CScript scriptPubKey(scriptStr, scriptStr + out.script().size()); vecSend.push_back(std::pair<CScript, CAmount>(scriptPubKey, out.amount())); } if (subtotal <= 0) { return InvalidAmount; } total += subtotal; } else { // User-entered SKW address / amount: if (!validateAddress(rcp.address)) { return InvalidAddress; } if (rcp.amount <= 0) { return InvalidAmount; } setAddress.insert(rcp.address); ++nAddresses; CScript scriptPubKey = GetScriptForDestination(CBitcoinAddress(rcp.address.toStdString()).Get()); vecSend.push_back(std::pair<CScript, CAmount>(scriptPubKey, rcp.amount)); total += rcp.amount; } } if (setAddress.size() != nAddresses) { return DuplicateAddress; } CAmount nBalance = getBalance(coinControl); if (total > nBalance) { return AmountExceedsBalance; } { LOCK2(cs_main, wallet->cs_wallet); transaction.newPossibleKeyChange(wallet); CAmount nFeeRequired = 0; std::string strFailReason; CWalletTx* newTx = transaction.getTransaction(); CReserveKey* keyChange = transaction.getPossibleKeyChange(); if (recipients[0].useSwiftTX && total > GetSporkValue(SPORK_3_SWIFTTX_MAX_VALUE) * COIN) { emit message(tr("Send Coins"), tr("SwiftX doesn't support sending values that high yet. Transactions are currently limited to %1 SKW.").arg(GetSporkValue(SPORK_3_SWIFTTX_MAX_VALUE)), CClientUIInterface::MSG_ERROR); return TransactionCreationFailed; } bool fCreated = wallet->CreateTransaction(vecSend, *newTx, *keyChange, nFeeRequired, strFailReason, coinControl, recipients[0].inputType, recipients[0].useSwiftTX); transaction.setTransactionFee(nFeeRequired); if (recipients[0].useSwiftTX && newTx->GetValueOut() > GetSporkValue(SPORK_3_SWIFTTX_MAX_VALUE) * COIN) { emit message(tr("Send Coins"), tr("SwiftX doesn't support sending values that high yet. Transactions are currently limited to %1 SKW.").arg(GetSporkValue(SPORK_3_SWIFTTX_MAX_VALUE)), CClientUIInterface::MSG_ERROR); return TransactionCreationFailed; } if (!fCreated) { if ((total + nFeeRequired) > nBalance) { return SendCoinsReturn(AmountWithFeeExceedsBalance); } emit message(tr("Send Coins"), QString::fromStdString(strFailReason), CClientUIInterface::MSG_ERROR); return TransactionCreationFailed; } // reject insane fee if (nFeeRequired > ::minRelayTxFee.GetFee(transaction.getTransactionSize()) * 10000) return InsaneFee; } return SendCoinsReturn(OK); } WalletModel::SendCoinsReturn WalletModel::sendCoins(WalletModelTransaction& transaction) { QByteArray transaction_array; /* store serialized transaction */ { LOCK2(cs_main, wallet->cs_wallet); CWalletTx* newTx = transaction.getTransaction(); QList<SendCoinsRecipient> recipients = transaction.getRecipients(); // Store PaymentRequests in wtx.vOrderForm in wallet. foreach (const SendCoinsRecipient& rcp, recipients) { if (rcp.paymentRequest.IsInitialized()) { std::string key("PaymentRequest"); std::string value; rcp.paymentRequest.SerializeToString(&value); newTx->vOrderForm.push_back(make_pair(key, value)); } else if (!rcp.message.isEmpty()) // Message from normal SKW:URI (SKW:XyZ...?message=example) { newTx->vOrderForm.push_back(make_pair("Message", rcp.message.toStdString())); } } CReserveKey* keyChange = transaction.getPossibleKeyChange(); transaction.getRecipients(); if (!wallet->CommitTransaction(*newTx, *keyChange, (recipients[0].useSwiftTX) ? "ix" : "tx")) return TransactionCommitFailed; CTransaction* t = (CTransaction*)newTx; CDataStream ssTx(SER_NETWORK, PROTOCOL_VERSION); ssTx << *t; transaction_array.append(&(ssTx[0]), ssTx.size()); } // Add addresses / update labels that we've sent to to the address book, // and emit coinsSent signal for each recipient foreach (const SendCoinsRecipient& rcp, transaction.getRecipients()) { // Don't touch the address book when we have a payment request if (!rcp.paymentRequest.IsInitialized()) { std::string strAddress = rcp.address.toStdString(); CTxDestination dest = CBitcoinAddress(strAddress).Get(); std::string strLabel = rcp.label.toStdString(); updateAddressBookLabels(dest, strLabel, "send"); } emit coinsSent(wallet, rcp, transaction_array); } checkBalanceChanged(); // update balance immediately, otherwise there could be a short noticeable delay until pollBalanceChanged hits return SendCoinsReturn(OK); } OptionsModel* WalletModel::getOptionsModel() { return optionsModel; } AddressTableModel* WalletModel::getAddressTableModel() { return addressTableModel; } TransactionTableModel* WalletModel::getTransactionTableModel() { return transactionTableModel; } RecentRequestsTableModel* WalletModel::getRecentRequestsTableModel() { return recentRequestsTableModel; } WalletModel::EncryptionStatus WalletModel::getEncryptionStatus() const { if (!wallet->IsCrypted()) { return Unencrypted; } else if (wallet->IsLocked()) { return Locked; } else { return Unlocked; } } bool WalletModel::setWalletEncrypted(bool encrypted, const SecureString& passphrase) { if (encrypted) { // Encrypt return wallet->EncryptWallet(passphrase); } else { // Decrypt -- TODO; not supported yet return false; } } bool WalletModel::setWalletLocked(bool locked, const SecureString& passPhrase, bool anonymizeOnly) { if (locked) { // Lock return wallet->Lock(); } else { // Unlock return wallet->Unlock(passPhrase, anonymizeOnly); } } bool WalletModel::changePassphrase(const SecureString& oldPass, const SecureString& newPass) { bool retval; { LOCK(wallet->cs_wallet); wallet->Lock(); // Make sure wallet is locked before attempting pass change retval = wallet->ChangeWalletPassphrase(oldPass, newPass); } return retval; } bool WalletModel::backupWallet(const QString& filename) { return BackupWallet(*wallet, filename.toLocal8Bit().data()); } // Handlers for core signals static void NotifyKeyStoreStatusChanged(WalletModel* walletmodel, CCryptoKeyStore* wallet) { qDebug() << "NotifyKeyStoreStatusChanged"; QMetaObject::invokeMethod(walletmodel, "updateStatus", Qt::QueuedConnection); } static void NotifyAddressBookChanged(WalletModel* walletmodel, CWallet* wallet, const CTxDestination& address, const std::string& label, bool isMine, const std::string& purpose, ChangeType status) { QString strAddress = QString::fromStdString(CBitcoinAddress(address).ToString()); QString strLabel = QString::fromStdString(label); QString strPurpose = QString::fromStdString(purpose); qDebug() << "NotifyAddressBookChanged : " + strAddress + " " + strLabel + " isMine=" + QString::number(isMine) + " purpose=" + strPurpose + " status=" + QString::number(status); QMetaObject::invokeMethod(walletmodel, "updateAddressBook", Qt::QueuedConnection, Q_ARG(QString, strAddress), Q_ARG(QString, strLabel), Q_ARG(bool, isMine), Q_ARG(QString, strPurpose), Q_ARG(int, status)); } // queue notifications to show a non freezing progress dialog e.g. for rescan static bool fQueueNotifications = false; static std::vector<std::pair<uint256, ChangeType> > vQueueNotifications; static void NotifyTransactionChanged(WalletModel* walletmodel, CWallet* wallet, const uint256& hash, ChangeType status) { if (fQueueNotifications) { vQueueNotifications.push_back(make_pair(hash, status)); return; } QString strHash = QString::fromStdString(hash.GetHex()); qDebug() << "NotifyTransactionChanged : " + strHash + " status= " + QString::number(status); QMetaObject::invokeMethod(walletmodel, "updateTransaction", Qt::QueuedConnection /*, Q_ARG(QString, strHash), Q_ARG(int, status)*/); } static void ShowProgress(WalletModel* walletmodel, const std::string& title, int nProgress) { // emits signal "showProgress" QMetaObject::invokeMethod(walletmodel, "showProgress", Qt::QueuedConnection, Q_ARG(QString, QString::fromStdString(title)), Q_ARG(int, nProgress)); } static void NotifyWatchonlyChanged(WalletModel* walletmodel, bool fHaveWatchonly) { QMetaObject::invokeMethod(walletmodel, "updateWatchOnlyFlag", Qt::QueuedConnection, Q_ARG(bool, fHaveWatchonly)); } static void NotifyMultiSigChanged(WalletModel* walletmodel, bool fHaveMultiSig) { QMetaObject::invokeMethod(walletmodel, "updateMultiSigFlag", Qt::QueuedConnection, Q_ARG(bool, fHaveMultiSig)); } static void NotifyxSKWReset(WalletModel* walletmodel) { qDebug() << "NotifyxSKWReset"; QMetaObject::invokeMethod(walletmodel, "checkBalanceChanged", Qt::QueuedConnection); } void WalletModel::subscribeToCoreSignals() { // Connect signals to wallet wallet->NotifyStatusChanged.connect(boost::bind(&NotifyKeyStoreStatusChanged, this, _1)); wallet->NotifyAddressBookChanged.connect(boost::bind(NotifyAddressBookChanged, this, _1, _2, _3, _4, _5, _6)); wallet->NotifyTransactionChanged.connect(boost::bind(NotifyTransactionChanged, this, _1, _2, _3)); wallet->ShowProgress.connect(boost::bind(ShowProgress, this, _1, _2)); wallet->NotifyWatchonlyChanged.connect(boost::bind(NotifyWatchonlyChanged, this, _1)); wallet->NotifyMultiSigChanged.connect(boost::bind(NotifyMultiSigChanged, this, _1)); wallet->NotifyxSKWReset.connect(boost::bind(NotifyxSKWReset, this)); } void WalletModel::unsubscribeFromCoreSignals() { // Disconnect signals from wallet wallet->NotifyStatusChanged.disconnect(boost::bind(&NotifyKeyStoreStatusChanged, this, _1)); wallet->NotifyAddressBookChanged.disconnect(boost::bind(NotifyAddressBookChanged, this, _1, _2, _3, _4, _5, _6)); wallet->NotifyTransactionChanged.disconnect(boost::bind(NotifyTransactionChanged, this, _1, _2, _3)); wallet->ShowProgress.disconnect(boost::bind(ShowProgress, this, _1, _2)); wallet->NotifyWatchonlyChanged.disconnect(boost::bind(NotifyWatchonlyChanged, this, _1)); wallet->NotifyMultiSigChanged.disconnect(boost::bind(NotifyMultiSigChanged, this, _1)); wallet->NotifyxSKWReset.disconnect(boost::bind(NotifyxSKWReset, this)); } // WalletModel::UnlockContext implementation WalletModel::UnlockContext WalletModel::requestUnlock(AskPassphraseDialog::Context context, bool relock) { bool was_locked = getEncryptionStatus() == Locked; if (!was_locked) { setWalletLocked(true); was_locked = getEncryptionStatus() == Locked; } if (was_locked) { // Request UI to unlock wallet emit requireUnlock(context); } // If wallet is still locked, unlock was failed or cancelled, mark context as invalid bool valid = getEncryptionStatus() != Locked; return UnlockContext(valid, relock); // return UnlockContext(this, valid, was_locked && !isAnonymizeOnlyUnlocked()); } WalletModel::UnlockContext::UnlockContext(bool valid, bool relock) : valid(valid), relock(relock) { } WalletModel::UnlockContext::~UnlockContext() { /* if (valid && relock) { wallet->setWalletLocked(true); } */ } void WalletModel::UnlockContext::CopyFrom(const UnlockContext& rhs) { // Transfer context; old object no longer relocks wallet *this = rhs; rhs.relock = false; } bool WalletModel::getPubKey(const CKeyID& address, CPubKey& vchPubKeyOut) const { return wallet->GetPubKey(address, vchPubKeyOut); } // returns a list of COutputs from COutPoints void WalletModel::getOutputs(const std::vector<COutPoint>& vOutpoints, std::vector<COutput>& vOutputs) { LOCK2(cs_main, wallet->cs_wallet); BOOST_FOREACH (const COutPoint& outpoint, vOutpoints) { if (!wallet->mapWallet.count(outpoint.hash)) continue; int nDepth = wallet->mapWallet[outpoint.hash].GetDepthInMainChain(); if (nDepth < 0) continue; COutput out(&wallet->mapWallet[outpoint.hash], outpoint.n, nDepth, true); vOutputs.push_back(out); } } bool WalletModel::isSpent(const COutPoint& outpoint) const { LOCK2(cs_main, wallet->cs_wallet); return wallet->IsSpent(outpoint.hash, outpoint.n); } // AvailableCoins + LockedCoins grouped by wallet address (put change in one group with wallet address) void WalletModel::listCoins(std::map<QString, std::vector<COutput> >& mapCoins) const { std::vector<COutput> vCoins; wallet->AvailableCoins(vCoins); LOCK2(cs_main, wallet->cs_wallet); // ListLockedCoins, mapWallet std::vector<COutPoint> vLockedCoins; wallet->ListLockedCoins(vLockedCoins); // add locked coins BOOST_FOREACH (const COutPoint& outpoint, vLockedCoins) { if (!wallet->mapWallet.count(outpoint.hash)) continue; int nDepth = wallet->mapWallet[outpoint.hash].GetDepthInMainChain(); if (nDepth < 0) continue; COutput out(&wallet->mapWallet[outpoint.hash], outpoint.n, nDepth, true); if (outpoint.n < out.tx->vout.size() && wallet->IsMine(out.tx->vout[outpoint.n]) == ISMINE_SPENDABLE) vCoins.push_back(out); } BOOST_FOREACH (const COutput& out, vCoins) { COutput cout = out; while (wallet->IsChange(cout.tx->vout[cout.i]) && cout.tx->vin.size() > 0 && wallet->IsMine(cout.tx->vin[0])) { if (!wallet->mapWallet.count(cout.tx->vin[0].prevout.hash)) break; cout = COutput(&wallet->mapWallet[cout.tx->vin[0].prevout.hash], cout.tx->vin[0].prevout.n, 0, true); } CTxDestination address; if (!out.fSpendable || !ExtractDestination(cout.tx->vout[cout.i].scriptPubKey, address)) continue; mapCoins[QString::fromStdString(CBitcoinAddress(address).ToString())].push_back(out); } } bool WalletModel::isLockedCoin(uint256 hash, unsigned int n) const { LOCK2(cs_main, wallet->cs_wallet); return wallet->IsLockedCoin(hash, n); } void WalletModel::lockCoin(COutPoint& output) { LOCK2(cs_main, wallet->cs_wallet); wallet->LockCoin(output); } void WalletModel::unlockCoin(COutPoint& output) { LOCK2(cs_main, wallet->cs_wallet); wallet->UnlockCoin(output); } void WalletModel::listLockedCoins(std::vector<COutPoint>& vOutpts) { LOCK2(cs_main, wallet->cs_wallet); wallet->ListLockedCoins(vOutpts); } void WalletModel::loadReceiveRequests(std::vector<std::string>& vReceiveRequests) { LOCK(wallet->cs_wallet); BOOST_FOREACH (const PAIRTYPE(CTxDestination, CAddressBookData) & item, wallet->mapAddressBook) BOOST_FOREACH (const PAIRTYPE(std::string, std::string) & item2, item.second.destdata) if (item2.first.size() > 2 && item2.first.substr(0, 2) == "rr") // receive request vReceiveRequests.push_back(item2.second); } bool WalletModel::saveReceiveRequest(const std::string& sAddress, const int64_t nId, const std::string& sRequest) { CTxDestination dest = CBitcoinAddress(sAddress).Get(); std::stringstream ss; ss << nId; std::string key = "rr" + ss.str(); // "rr" prefix = "receive request" in destdata LOCK(wallet->cs_wallet); if (sRequest.empty()) return wallet->EraseDestData(dest, key); else return wallet->AddDestData(dest, key, sRequest); } bool WalletModel::isMine(CBitcoinAddress address) { return IsMine(*wallet, address.Get()); }
; SMSQ SER/PAR/PRT serial mouse V2.10  1999 Tony Tebby section spp xdef spp_mouse xref pt_button3 xref iob_anew xref iob_gbyt xref gu_achpp include 'dev8_keys_mse' include 'dev8_keys_iod' include 'dev8_keys_buf' include 'dev8_keys_con' include 'dev8_keys_sys' include 'dev8_keys_qlv' include 'dev8_keys_serparprt' include 'dev8_keys_qdos_sms' include 'dev8_mac_assert' ;+++ ; Serial mouse driver. ; This driver modifies the standard serial port driver. ; The routine calls the mouse detection routine for each port in turn. ; If a mouse is detected ; this routine ; sets the the port number to zero to prevent the port being used ; sets up a linkage block ; sets up an input buffer ; links the mouse polling routine in ; If a mouse is not detected ; the mouse detection routine resets the port ; Thereafter, the normal input server puts the data read from the mouse into ; into the input buffer (7 bit data) and the scheduler routine decodes the ; packets. ; ; a3 c p SER/PAR/PRT linkage block ; status return 0 ;--- spp_mouse sppm.reg reg d1/d2/d3/d4/d5/d6/a0/a1/a2/a3/a4 moveq #sms.xtop,d0 trap #do.sms2 movem.l sppm.reg,-(sp) move.w spd_nser(a3),d6 move.l spd_pser(a3),a3 move.w #spd.len,d0 mulu d6,d0 add.l d0,a3 ; off end of linkage blocks bra.s sppm_eloop sppm_loop move.l spd_mouse(a3),d0 ble.s sppm_eloop move.l d0,a4 jsr (a4) ; check for mouse beq.s sppm_set ; ... found sppm_eloop sub.w #spd.len,a3 dbra d6,sppm_loop bra.s sppm_ok sppm_set clr.w spd_port(a3) ; invalidate the port move.l #mse.len,d0 jsr gu_achpp ; allocate (pseudo channel) block bne.s sppm_exit move.l #mse.id,mse_id(a0) ; set flag move.w #mse.pack,mse_packp(a0) ; initialise the packet pointer move.l a3,mse_slnk(a0) ; use ser port output op to enable lea mse_buff(a0),a2 lea spd_ibuf(a3),a1 move.l #mse.buff,d0 ; buffer size jsr iob_anew ; allocate a new one bne.s sppm_exit ; ... give up clr.l buf_ptrg(a2) ; ... say permanent lea sppm_poll,a4 move.l a4,iod_plad(a0) ; set up scheduler lea iod_pllk(a0),a0 moveq #sms.lpol,d0 ; and link in trap #do.sms2 sppm_ok moveq #0,d0 ; error is quite normal sppm_exit movem.l (sp)+,sppm.reg sppm_rts1 rts ;--- mouse polling routine sppm_poll move.l sys_clnk(a6),d0 ; pointer linkage beq.s sppm_rts1 move.l d0,a4 move.l mse_buff(a3),a2 move.l mse_slnk(a3),a5 sppm_gbyte jsr iob_gbyt ; get a byte from the buffer bne.l sppm_check ; nothing more to fetch tst.b spd_iact(a5) ; input active? bne.s sppm_proc ; ... yes process byte exg a3,a5 move.l spd_iopr(a3),a1 jsr (a1) ; re-enable handshaking exg a3,a5 sppm_proc move.w mse_packp(a3),d2 ; packet pointer bclr #6,d1 ; start byte beq.s sppm_nbyte ; next byte clr.w d2 sppm_nbyte cmp.w #mse.pack,d2 ; packet overfull? bge.s sppm_gbyte move.b d1,mse_pack(a3,d2.w) ; add to packet addq.w #1,d2 move.w d2,mse_packp(a3) subq.w #3,d2 ; 3 byte packet complete? bne.s sppm_gbyte move.b mse_pack(a3),d0 ; first byte (d0 was 0)) move.b d0,d1 lsl.b #6,d1 ; ms bits of x inc lsr.b #2,d0 move.b d0,d2 lsl.b #6,d2 ; ms bits of y lsr.b #2,d0 ; buttons move.b sppm_but(pc,d0.w),mse_button(a3) ; set the button number bpl.s sppm_inc ; not centre clr.b mse_button(a3) ; ... centre, clear left / right move.b #mse.mid,mse_b3(a3) ; fake centre button sppm_inc or.b mse_pack+1(a3),d1 ; x increment or.b mse_pack+2(a3),d2 ; y increment ext.w d1 move.w d1,d0 ; supposed count bpl.s sppm_ycount ; ... its positive neg.w d0 sppm_ycount ext.w d2 ; y increment / count move.w d2,d3 ; other supposed cont bge.s sppm_addinc ; ... its positive neg.w d3 sppm_addinc cmp.w d0,d3 ; is y count greater? ble.s sppm_setinc ; ... no move.w d3,d0 ; ... yes sppm_setinc add.w d0,pt_xicnt(a4) ; update count add.w d1,pt_xinc(a4) add.w d2,pt_yinc(a4) ; and distance moved bra sppm_gbyte sppm_check cmp.b #mse.mid,mse_b3(a3) ; is middle button pressed? bne.s sppm_button ; ... no clr.b mse_b3(a3) ; ... yes, clear it jmp pt_button3 ; and do button 3 code sppm_button move.b mse_button(a3),pt_bpoll(a4) ; this is new key beq.s sppm_rts ; ... none clr.b pt_lstuf(a4) ; it isn't a stuff clr.b mse_b3(a3) ; kill centre button sppm_rts rts sppm_but dc.b 0,2,1,-1 ; button decode end
// This file is part of www.nand2tetris.org // and the book "The Elements of Computing Systems" // by Nisan and Schocken, MIT Press. // File name: projects/06/rect/Rect.asm // Draws a rectangle at the top-left corner of the screen. // The rectangle is 16 pixels wide and R0 pixels high. @100 D=A @R0 M=D @R0 D=M @INFINITE_LOOP D;JLE @counter M=D @SCREEN D=A @address M=D (LOOP) @address A=M M=-1 @address D=M @32 D=D+A @address M=D @counter MD=M-1 @LOOP D;JGT (INFINITE_LOOP) @INFINITE_LOOP 0;JMP
// ========================================================================== // SeqAn-Flexbar // ========================================================================== // Copyright (c) 2006-2015, Knut Reinert, FU Berlin // 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 Knut Reinert or the FU Berlin 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 KNUT REINERT OR THE FU BERLIN 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. // // ========================================================================== // Author: Sebastian Roskosch <serosko@zedat.fu-berlin.de> // Author: Benjamin Strauch <b.strauch@fu-berlin.de> // Author: Jochen Singer <jochen.singer@fu-berlin.de> // ========================================================================== // This file provides tests for the general processing functions of // seqan-flexbar which is based in the implementation of the original // flexbar program in [1]. // [1] Dodt, M.; Roehr, J.T.; Ahmed, R.; Dieterich, C. FLEXBAR—Flexible // Barcode and Adapter Processing for Next-Generation Sequencing Platforms. // Biology 2012, 1, 895-905. // ========================================================================== #undef SEQAN_ENABLE_TESTING #define SEQAN_ENABLE_TESTING 1 #include <seqan/basic.h> #include <seqan/sequence.h> #ifdef _OPENMP #include <omp.h> #endif #include "general_processing.h" using namespace seqan; SEQAN_DEFINE_TEST(findN_test) { StringSet<String<Dna5> >seqs; appendValue(seqs, "ATGACTGTACACGTGATCGTACGTAGCAGC"); appendValue(seqs, "ATGGNGGGTACACGTGATCGTACGTAGCAGC"); appendValue(seqs, "NGGGACTGTACACGTGATCGTACGTAGCAGGN"); appendValue(seqs, "NATGACTGTAGGNGGGATCGTACGTAGCAGGN"); appendValue(seqs, "NGGGACTGTAGGNGGGATGGNGGGTAGCAGGN"); appendValue(seqs, "NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN"); appendValue(seqs, "ACTGTACGTGATCG.AATGCTGACTGACTGAC"); appendValue(seqs, ".ACTGTACGTGATCG.AATGCTGACTGACTGAC"); appendValue(seqs, "ACT.GTACGTGATCG.AATGCTGACTGA.CTGAC"); appendValue(seqs, "ACT.GTACGTGATCG.AATGC.TGACTGACTG.AC"); appendValue(seqs, "......."); appendValue(seqs, ""); unsigned allowed = 3; StringSet<int> exspectedNoSub; appendValue(exspectedNoSub, 0); appendValue(exspectedNoSub, 1); appendValue(exspectedNoSub, 2); appendValue(exspectedNoSub, 3); appendValue(exspectedNoSub, -1); appendValue(exspectedNoSub, -1); appendValue(exspectedNoSub, 1); appendValue(exspectedNoSub, 2); appendValue(exspectedNoSub, 3); appendValue(exspectedNoSub, -1); appendValue(exspectedNoSub, -1); appendValue(exspectedNoSub, 0); StringSet<int> res; resize(res, length(seqs)); for (unsigned i = 0; i < length(seqs); ++i) { res[i] = findN(seqs[i], allowed); //Test WITHOUT substitutions } for (unsigned i = 0; i < length(exspectedNoSub); ++i) { SEQAN_ASSERT_EQ(exspectedNoSub[i], res[i]); } StringSet<String<Dna5> > seqs2 = seqs; seqs2[1][4] = 'A'; seqs2[2][0] = 'A'; seqs2[2][31] = 'A'; seqs2[3][0] = 'A'; seqs2[3][12] = 'A'; seqs2[3][31] = 'A'; seqs2[4][0] = 'A'; seqs2[4][12] = 'A'; seqs2[4][20] = 'A'; seqs2[5][0] = 'A'; seqs2[5][1] = 'A'; seqs2[5][2] = 'A'; for (unsigned i = 0; i < length(seqs); ++i) { res[i] = findN(seqs[i], allowed, 'A'); //Test WITH substitutions } for (unsigned i = 0; i < 5; ++i) { SEQAN_ASSERT_EQ(exspectedNoSub[i], res[i]); } } SEQAN_DEFINE_TEST(processN_test) { GeneralStats stats; StringSet<String<Dna5> >seqs; appendValue(seqs, "ATGACTGTACACGTGATCGTACGTAGCAGC"); appendValue(seqs, "ATGGNGGGTACACGTGATCGTACGTAGCAGC"); appendValue(seqs, "NGGGACTGTACACGTGATCGTACGTAGCAGGN"); appendValue(seqs, "NATGACTGTAGGNGGGATCGTACGTAGCAGGN"); appendValue(seqs, "NGGGACTGTAGGNGGGATGGNGGGTAGCAGGN"); appendValue(seqs, "ATGACTGTACACGTGATCGTACGTAGCAGC"); StringSet<String<Dna5> >seqs2 = seqs; StringSet<String<char> > ids; appendValue(ids, "Null"); appendValue(ids, "Eins"); appendValue(ids, "Zwei"); appendValue(ids, "Drei"); appendValue(ids, "Vier"); appendValue(ids, "Null2"); StringSet<String<char> > ids2 = ids; unsigned allowed = 3; StringSet<String<Dna5> > exspectedNoSub; appendValue(exspectedNoSub, "ATGACTGTACACGTGATCGTACGTAGCAGC"); appendValue(exspectedNoSub, "ATGGNGGGTACACGTGATCGTACGTAGCAGC"); appendValue(exspectedNoSub, "NGGGACTGTACACGTGATCGTACGTAGCAGGN"); appendValue(exspectedNoSub, "NATGACTGTAGGNGGGATCGTACGTAGCAGGN"); appendValue(exspectedNoSub, "ATGACTGTACACGTGATCGTACGTAGCAGC"); processN(seqs2, ids2, allowed, stats); //No Substitutions SEQAN_ASSERT_EQ(stats.removedSeqs, 1u); SEQAN_ASSERT_EQ(stats.uncalledBases, 6u); for (unsigned i = 0; i < length(exspectedNoSub); ++i) { SEQAN_ASSERT_EQ(exspectedNoSub[i], seqs2[i]); } stats.removedSeqs = 0; stats.uncalledBases = 0; seqs2 = seqs; ids2 = ids; Dna substitute = 'A'; StringSet<String<Dna5> > exspectedSub = exspectedNoSub; exspectedSub[1][4] = substitute; exspectedSub[2][0] = substitute; exspectedSub[2][31] = substitute; exspectedSub[3][0] = substitute; exspectedSub[3][12] = substitute; exspectedSub[3][31] = substitute; processN(seqs2, ids2, allowed, substitute, stats); SEQAN_ASSERT_EQ(stats.removedSeqs, 1u); SEQAN_ASSERT_EQ(stats.uncalledBases, 6u); for (unsigned i = 0; i < length(exspectedSub); ++i) { SEQAN_ASSERT_EQ(exspectedSub[i], seqs2[i]); } } SEQAN_DEFINE_TEST(processN_paired_test) { GeneralStats stats; StringSet<String<Dna5> >seqs; appendValue(seqs, "ATGACTGTACACGTGATCGTACGTAGCAGC"); appendValue(seqs, "ATGGNGGGTACACGTGATCGTACGTAGCAGC"); appendValue(seqs, "NGGGACTGTACACGTGATCGTACGTAGCAGGN"); appendValue(seqs, "NATGACTGTAGGNGGGATCGTACGTAGCAGGN"); appendValue(seqs, "NGGGACTGTAGGNGGGATGGNGGGTAGCAGGN"); appendValue(seqs, "ATGACTGTACACGTGATCGTACGTAGCAGC"); StringSet<String<Dna5> >seqsRev; appendValue(seqsRev, "ATGACTGTACACGTGATCGTACGTAGCAGC"); appendValue(seqsRev, "ATGNGNGGGTANCACGTGATCGTNACGTAGCANGC"); appendValue(seqsRev, "NGGGACTGTACACGTGATCGTACGTAGCAGGN"); appendValue(seqsRev, "NATGACTGTAGGNGGGATCGTACGTAGCAGGN"); appendValue(seqsRev, "NGGGACTGTAGGNGGGATGGNGGGTAGCAGGN"); appendValue(seqsRev, "ATGACTGTACACGTGATCGTACGTAGCAGC"); StringSet<String<Dna5> >seqs2 = seqs; StringSet<String<Dna5> >seqsRev2 = seqsRev; StringSet<String<char> > ids; appendValue(ids, "Null"); appendValue(ids, "Eins"); appendValue(ids, "Zwei"); appendValue(ids, "Drei"); appendValue(ids, "Vier"); appendValue(ids, "Null2"); StringSet<String<char> > exspectedIds; appendValue(exspectedIds, "Null"); appendValue(exspectedIds, "Null2"); //Due to swap action! appendValue(exspectedIds, "Zwei"); appendValue(exspectedIds, "Drei"); StringSet<String<char> > ids2 = ids; StringSet<String<char> > idsRev2 = ids; unsigned allowed = 3; StringSet<String<Dna5> > exspectedNoSub; appendValue(exspectedNoSub, "ATGACTGTACACGTGATCGTACGTAGCAGC"); appendValue(exspectedNoSub, "ATGACTGTACACGTGATCGTACGTAGCAGC"); //Due to swap action! appendValue(exspectedNoSub, "NGGGACTGTACACGTGATCGTACGTAGCAGGN"); appendValue(exspectedNoSub, "NATGACTGTAGGNGGGATCGTACGTAGCAGGN"); processN(seqs2, ids2, seqsRev2, idsRev2, allowed, stats); //No Substitutions SEQAN_ASSERT_EQ(stats.removedSeqs, 4u); SEQAN_ASSERT_EQ(stats.uncalledBases, 10u); for (unsigned i = 0; i < length(exspectedNoSub); ++i) { SEQAN_ASSERT_EQ(ids2[i], exspectedIds[i]); SEQAN_ASSERT_EQ(exspectedNoSub[i], seqs2[i]); SEQAN_ASSERT_EQ(idsRev2[i], exspectedIds[i]); } stats.removedSeqs = 0; stats.uncalledBases = 0; seqs2 = seqs; seqsRev2 = seqsRev; ids2 = ids; idsRev2 = ids; Dna substitute = 'A'; StringSet<String<Dna5> > exspectedSub = exspectedNoSub; exspectedSub[2][0] = substitute; exspectedSub[2][31] = substitute; exspectedSub[3][0] = substitute; exspectedSub[3][12] = substitute; exspectedSub[3][31] = substitute; processN(seqs2, ids2, seqsRev2, idsRev2, allowed, substitute, stats); SEQAN_ASSERT_EQ(stats.removedSeqs, 4u); SEQAN_ASSERT_EQ(stats.uncalledBases, 10u); for (unsigned i = 0; i < length(exspectedSub); ++i) { SEQAN_ASSERT_EQ(exspectedSub[i], seqs2[i]); } } SEQAN_DEFINE_TEST(processN_multiplex_test) { GeneralStats stats; StringSet<String<Dna5> >multiplex; appendValue(multiplex, "ACTGTA"); appendValue(multiplex, "TGACGT"); appendValue(multiplex, "GTACGA"); appendValue(multiplex, "GTACTG"); appendValue(multiplex, "AAAAAA"); appendValue(multiplex, "GGGTAC"); StringSet<String<Dna5> >multiplex2 = multiplex; StringSet<String<Dna5> > exspectedMultiplex; appendValue(exspectedMultiplex, "ACTGTA"); appendValue(exspectedMultiplex, "TGACGT"); appendValue(exspectedMultiplex, "GTACGA"); appendValue(exspectedMultiplex, "GTACTG"); appendValue(exspectedMultiplex, "GGGTAC"); StringSet<String<Dna5> >seqs; appendValue(seqs, "ATGACTGTACACGTGATCGTACGTAGCAGC"); appendValue(seqs, "ATGGNGGGTACACGTGATCGTACGTAGCAGC"); appendValue(seqs, "NGGGACTGTACACGTGATCGTACGTAGCAGGN"); appendValue(seqs, "NATGACTGTAGGNGGGATCGTACGTAGCAGGN"); appendValue(seqs, "NGGGACTGTAGGNGGGATGGNGGGTAGCAGGN"); appendValue(seqs, "ATGACTGTACACGTGATCGTACGTAGCAGC"); StringSet<String<Dna5> >seqs2 = seqs; StringSet<String<char> > ids; appendValue(ids, "Null"); appendValue(ids, "Eins"); appendValue(ids, "Zwei"); appendValue(ids, "Drei"); appendValue(ids, "Vier"); appendValue(ids, "Null2"); StringSet<String<char> > ids2 = ids; unsigned allowed = 3; StringSet<String<Dna5> > exspectedNoSub; appendValue(exspectedNoSub, "ATGACTGTACACGTGATCGTACGTAGCAGC"); appendValue(exspectedNoSub, "ATGGNGGGTACACGTGATCGTACGTAGCAGC"); appendValue(exspectedNoSub, "NGGGACTGTACACGTGATCGTACGTAGCAGGN"); appendValue(exspectedNoSub, "NATGACTGTAGGNGGGATCGTACGTAGCAGGN"); appendValue(exspectedNoSub, "ATGACTGTACACGTGATCGTACGTAGCAGC"); processN(seqs2, ids2, multiplex2, allowed, stats); //No Substitutions SEQAN_ASSERT_EQ(stats.removedSeqs, 1u); SEQAN_ASSERT_EQ(stats.uncalledBases, 6u); for (unsigned i = 0; i < length(exspectedNoSub); ++i) { SEQAN_ASSERT_EQ(exspectedNoSub[i], seqs2[i]); SEQAN_ASSERT_EQ(exspectedMultiplex[i], multiplex2[i]); } stats.removedSeqs = 0; stats.uncalledBases = 0; seqs2 = seqs; ids2 = ids; multiplex2 = multiplex; Dna substitute = 'A'; StringSet<String<Dna5> > exspectedSub = exspectedNoSub; exspectedSub[1][4] = substitute; exspectedSub[2][0] = substitute; exspectedSub[2][31] = substitute; exspectedSub[3][0] = substitute; exspectedSub[3][12] = substitute; exspectedSub[3][31] = substitute; processN(seqs2, ids2, multiplex2, allowed, substitute, stats); SEQAN_ASSERT_EQ(stats.removedSeqs, 1u); SEQAN_ASSERT_EQ(stats.uncalledBases, 6u); for (unsigned i = 0; i < length(exspectedSub); ++i) { SEQAN_ASSERT_EQ(exspectedSub[i], seqs2[i]); SEQAN_ASSERT_EQ(exspectedMultiplex[i], multiplex2[i]); } } SEQAN_DEFINE_TEST(processN_paired_multiplex_test) { GeneralStats stats; StringSet<String<Dna5Q> >multiplex; appendValue(multiplex, "ACTGTA"); appendValue(multiplex, "TGACGT"); appendValue(multiplex, "GTACGA"); appendValue(multiplex, "GTACTG"); appendValue(multiplex, "AAAAAA"); appendValue(multiplex, "GGGTAC"); StringSet<String<Dna5Q> >multiplex2 = multiplex; StringSet<String<Dna5Q> > exspectedMultiplex; appendValue(exspectedMultiplex, "ACTGTA"); appendValue(exspectedMultiplex, "GGGTAC"); appendValue(exspectedMultiplex, "GTACGA"); appendValue(exspectedMultiplex, "GTACTG"); StringSet<String<Dna5> >seqs; appendValue(seqs, "ATGACTGTACACGTGATCGTACGTAGCAGC"); appendValue(seqs, "ATGGNGGGTACACGTGATCGTACGTAGCAGC"); appendValue(seqs, "NGGGACTGTACACGTGATCGTACGTAGCAGGN"); appendValue(seqs, "NATGACTGTAGGNGGGATCGTACGTAGCAGGN"); appendValue(seqs, "NGGGACTGTAGGNGGGATGGNGGGTAGCAGGN"); appendValue(seqs, "ATGACTGTACACGTGATCGTACGTAGCAGC"); StringSet<String<Dna5> >seqsRev; appendValue(seqsRev, "ATGACTGTACACGTGATCGTACGTAGCAGC"); appendValue(seqsRev, "ATGNGNGGGTANCACGTGATCGTNACGTAGCANGC"); appendValue(seqsRev, "NGGGACTGTACACGTGATCGTACGTAGCAGGN"); appendValue(seqsRev, "NATGACTGTAGGNGGGATCGTACGTAGCAGGN"); appendValue(seqsRev, "NGGGACTGTAGGNGGGATGGNGGGTAGCAGGN"); appendValue(seqsRev, "ATGACTGTACACGTGATCGTACGTAGCAGC"); StringSet<String<Dna5> >seqs2 = seqs; StringSet<String<Dna5> >seqsRev2 = seqsRev; StringSet<String<char> > ids; appendValue(ids, "Null"); appendValue(ids, "Eins"); appendValue(ids, "Zwei"); appendValue(ids, "Drei"); appendValue(ids, "Vier"); appendValue(ids, "Null2"); StringSet<String<char> > exspectedIds; appendValue(exspectedIds, "Null"); appendValue(exspectedIds, "Null2"); //Due to swap action! appendValue(exspectedIds, "Zwei"); appendValue(exspectedIds, "Drei"); StringSet<String<char> > ids2 = ids; StringSet<String<char> > idsRev2 = ids; unsigned allowed = 3; StringSet<String<Dna5> > exspectedNoSub; appendValue(exspectedNoSub, "ATGACTGTACACGTGATCGTACGTAGCAGC"); appendValue(exspectedNoSub, "ATGACTGTACACGTGATCGTACGTAGCAGC"); //Due to swap action! appendValue(exspectedNoSub, "NGGGACTGTACACGTGATCGTACGTAGCAGGN"); appendValue(exspectedNoSub, "NATGACTGTAGGNGGGATCGTACGTAGCAGGN"); processN(seqs2, ids2, seqsRev2, idsRev2, multiplex2, allowed, stats); //No Substitutions SEQAN_ASSERT_EQ(stats.removedSeqs, 4u); SEQAN_ASSERT_EQ(stats.uncalledBases, 10u); for (unsigned i = 0; i < length(exspectedNoSub); ++i) { SEQAN_ASSERT_EQ(exspectedNoSub[i], seqs2[i]); SEQAN_ASSERT_EQ(ids2[i], exspectedIds[i]); SEQAN_ASSERT_EQ(idsRev2[i], exspectedIds[i]); SEQAN_ASSERT_EQ(multiplex2[i], exspectedMultiplex[i]); } stats.removedSeqs = 0; stats.uncalledBases = 0; seqs2 = seqs; seqsRev2 = seqsRev; ids2 = ids; idsRev2 = ids; multiplex2 = multiplex; Dna substitute = 'A'; StringSet<String<Dna5> > exspectedSub = exspectedNoSub; exspectedSub[2][0] = substitute; exspectedSub[2][31] = substitute; exspectedSub[3][0] = substitute; exspectedSub[3][12] = substitute; exspectedSub[3][31] = substitute; processN(seqs2, ids2, seqsRev2, idsRev2, multiplex2, allowed, substitute, stats); SEQAN_ASSERT_EQ(stats.removedSeqs, 4u); SEQAN_ASSERT_EQ(stats.uncalledBases, 10u); for (unsigned i = 0; i < length(exspectedSub); ++i) { SEQAN_ASSERT_EQ(exspectedSub[i], seqs2[i]); SEQAN_ASSERT_EQ(multiplex2[i], exspectedMultiplex[i]); } } SEQAN_DEFINE_TEST(preTrim_test) { GeneralStats stats; StringSet<String<Dna> > seqs; appendValue(seqs, "ACGTAACTGA"); appendValue(seqs, "AAAAAACTTTTT"); appendValue(seqs, "AAAAAAG"); appendValue(seqs, "TACGG"); appendValue(seqs, "TAAAAAA"); appendValue(seqs, ""); appendValue(seqs, "GATTACAGATTACA"); StringSet<String<Dna> > seqs2 = seqs; StringSet<String<char> > ids; appendValue(ids, "loeschenTrim"); appendValue(ids, "Head/Tail"); appendValue(ids, "Head"); appendValue(ids, "loeschenNone"); appendValue(ids, "Tail"); appendValue(ids, "loeschenLeer"); appendValue(ids, "None"); StringSet<String<char> > ids2 = ids; preTrim(seqs2, ids2, 3, 3, 4, stats); SEQAN_ASSERT_EQ(seqs2[0], "TAAC"); SEQAN_ASSERT_EQ(ids2[0], "loeschenTrim"); SEQAN_ASSERT_EQ(seqs2[1], "AAACTT"); SEQAN_ASSERT_EQ(ids2[1], "Head/Tail"); SEQAN_ASSERT_EQ(seqs2[2], "TACAGATT"); SEQAN_ASSERT_EQ(ids2[2], "None"); SEQAN_ASSERT_EQ(length(ids2), 3u); SEQAN_ASSERT_EQ(length(seqs2), 3u); seqs2 = seqs; ids2 = ids; preTrim(seqs2, ids2, 6, 5, 1, stats); SEQAN_ASSERT_EQ(seqs2[1], "C"); SEQAN_ASSERT_EQ(ids2[1], "Head/Tail"); SEQAN_ASSERT_EQ(seqs2[0], "AGA"); SEQAN_ASSERT_EQ(ids2[0], "None"); SEQAN_ASSERT_EQ(length(ids2), 2u); SEQAN_ASSERT_EQ(length(seqs2), 2u); seqs2 = seqs; ids2 = ids; preTrim(seqs2, ids2, 6, 0, 1, stats); SEQAN_ASSERT_EQ(seqs2[2], "G"); SEQAN_ASSERT_EQ(ids2[2], "Head"); seqs2 = seqs; ids2 = ids; preTrim(seqs2, ids2, 0, 6, 1, stats); SEQAN_ASSERT_EQ(seqs2[4], "T"); SEQAN_ASSERT_EQ(ids2[4], "Tail"); seqs2 = seqs; ids2 = ids; preTrim(seqs2, ids2, 0, 0, 6, stats); SEQAN_ASSERT_EQ(seqs2[4], "TAAAAAA"); SEQAN_ASSERT_EQ(ids2[4], "Tail"); SEQAN_ASSERT_EQ(seqs2[3], "GATTACAGATTACA"); SEQAN_ASSERT_EQ(ids2[3], "None"); SEQAN_ASSERT_EQ(length(seqs2), 5u); SEQAN_ASSERT_EQ(length(ids2), 5u); } SEQAN_DEFINE_TEST(preTrim_paired_test) { GeneralStats stats; StringSet<String<Dna> > seqs; appendValue(seqs, "ACGTAACTGA"); appendValue(seqs, "AAAAAACTTTTT"); appendValue(seqs, "AAAAAAG"); appendValue(seqs, "TACGG"); appendValue(seqs, "TAAAAAA"); appendValue(seqs, ""); appendValue(seqs, "GATTACAGATTACA"); StringSet<String<Dna> > seqs2 = seqs; StringSet<String<Dna> > seqsRev = seqs; seqsRev[6] = "GTCA"; StringSet<String<Dna> > seqsRev2 = seqsRev; StringSet<String<char> > ids; appendValue(ids, "loeschenTrim"); appendValue(ids, "Head/Tail"); appendValue(ids, "Head"); appendValue(ids, "loeschenNone"); appendValue(ids, "Tail"); appendValue(ids, "loeschenLeer"); appendValue(ids, "loeschenRev"); StringSet<String<char> > ids2 = ids; StringSet<String<char> > idsRev = ids; StringSet<String<char> > idsRev2 = idsRev; preTrim(seqs2, ids2, seqsRev2, idsRev2, 3, 3, 4, stats); SEQAN_ASSERT_EQ(seqs2[0], "TAAC"); SEQAN_ASSERT_EQ(ids2[0], "loeschenTrim"); SEQAN_ASSERT_EQ(seqs2[1], "AAACTT"); SEQAN_ASSERT_EQ(ids2[1], "Head/Tail"); SEQAN_ASSERT_EQ(length(ids2), 2u); SEQAN_ASSERT_EQ(length(seqs2), 2u); seqs2 = seqs; seqsRev2 = seqsRev; ids2 = ids; idsRev2 = idsRev; preTrim(seqs2, ids2, seqsRev2, idsRev2, 6, 5, 1, stats); SEQAN_ASSERT_EQ(seqs2[0], "C"); SEQAN_ASSERT_EQ(ids2[0], "Head/Tail"); SEQAN_ASSERT_EQ(length(ids2), 1u); SEQAN_ASSERT_EQ(length(seqs2), 1u); seqs2 = seqs; seqsRev2 = seqsRev; ids2 = ids; idsRev2 = idsRev; preTrim(seqs2, ids2, seqsRev2, idsRev2, 6, 0, 1, stats); SEQAN_ASSERT_EQ(seqs2[2], "G"); SEQAN_ASSERT_EQ(ids2[2], "Head"); seqs2 = seqs; seqsRev2 = seqsRev; ids2 = ids; idsRev2 = idsRev; preTrim(seqs2, ids2, seqsRev2, idsRev2, 0, 6, 1, stats); SEQAN_ASSERT_EQ(seqs2[3], "T"); SEQAN_ASSERT_EQ(ids2[3], "Tail"); seqs2 = seqs; seqsRev2 = seqsRev; ids2 = ids; idsRev2 = idsRev; preTrim(seqs2, ids2, seqsRev2, idsRev2, 0, 0, 6, stats); SEQAN_ASSERT_EQ(seqs2[3], "TAAAAAA"); SEQAN_ASSERT_EQ(ids2[3], "Tail"); SEQAN_ASSERT_EQ(length(seqs2), 4u); SEQAN_ASSERT_EQ(length(ids2), 4u); } SEQAN_DEFINE_TEST(trimTo_test) { GeneralStats stats; StringSet<String<char> > seqs; appendValue(seqs, "123456789"); appendValue(seqs, "123456"); appendValue(seqs, "1234567"); appendValue(seqs, ""); StringSet<String<char> > ids; appendValue(ids, "neun"); appendValue(ids, "sechs"); appendValue(ids, "sieben"); appendValue(ids, "null"); trimTo(seqs, ids, 7, stats); SEQAN_ASSERT_EQ(seqs[0], "1234567"); SEQAN_ASSERT_EQ(seqs[1], "1234567"); SEQAN_ASSERT_EQ(ids[0], "neun"); SEQAN_ASSERT_EQ(ids[1], "sieben"); SEQAN_ASSERT_EQ(length(seqs), 2u); SEQAN_ASSERT_EQ(length(ids), 2u); } SEQAN_DEFINE_TEST(trimTo_paired_test) { GeneralStats stats; StringSet<String<char> > seqs; appendValue(seqs, "123456789"); appendValue(seqs, "123456"); appendValue(seqs, "1234567"); appendValue(seqs, ""); StringSet<String<char> > seqsRev = seqs; seqsRev[0] = "123456"; StringSet<String<char> > ids; appendValue(ids, "neun"); appendValue(ids, "fuenf"); appendValue(ids, "sieben"); appendValue(ids, "null"); StringSet<String<char> > idsRev = ids; trimTo(seqs, ids, seqsRev, idsRev, 7, stats); SEQAN_ASSERT_EQ(seqs[0], "1234567"); SEQAN_ASSERT_EQ(ids[0], "sieben"); SEQAN_ASSERT_EQ(length(seqs), 1u); SEQAN_ASSERT_EQ(length(ids), 1u); } SEQAN_BEGIN_TESTSUITE(test_my_app_funcs) { int tnum = 1; #ifdef _OPENMP omp_set_num_threads(8); tnum = omp_get_max_threads(); #endif std::cout<<"\nRunning Tests using " << tnum << " thread(s).\n\n"; SEQAN_CALL_TEST(findN_test); SEQAN_CALL_TEST(processN_test); SEQAN_CALL_TEST(processN_paired_test); SEQAN_CALL_TEST(processN_multiplex_test); SEQAN_CALL_TEST(processN_paired_multiplex_test); SEQAN_CALL_TEST(preTrim_test); SEQAN_CALL_TEST(preTrim_paired_test); SEQAN_CALL_TEST(trimTo_test); SEQAN_CALL_TEST(trimTo_paired_test); } SEQAN_END_TESTSUITE
# A demonstration of some simple MIPS instructions # used to test QtSPIM # Declare main as a global function .globl main # All program code is placed after the # .text assembler directive .text # The label 'main' represents the starting point main: li $t2, 25 # Load immediate value (25) lw $t3, value # Load the word stored in value (see bottom) add $t4, $t2, $t3 # Add sub $t5, $t2, $t3 # Subtract sw $t5, Z #Store the answer in Z (declared at the bottom) sw $t4, 4($sp) # Exit the program by means of a syscall. # There are many syscalls - pick the desired one # by placing its code in $v0. The code for exit is "10" li $v0, 10 # Sets $v0 to "10" to select exit syscall syscall # Exit # All memory structures are placed after the # .data assembler directive .data # The .word assembler directive reserves space # in memory for a single 4-byte word (or multiple 4-byte words) # and assigns that memory location an initial value # (or a comma separated list of initial values) value: .word 12 Z: .word 0
; A109522: a(n)=the (1,2)-entry in the matrix P^n + F^n, where the 2 X 2 matrices P and F are defined by P=[0,1;1,0] and F=[0,1;1,1]. ; 0,2,1,3,3,6,8,14,21,35,55,90,144,234,377,611,987,1598,2584,4182,6765,10947,17711,28658,46368,75026,121393,196419,317811,514230,832040,1346270,2178309,3524579,5702887,9227466,14930352,24157818,39088169 mov $18,$0 mov $20,2 lpb $20 clr $0,18 mov $0,$18 sub $20,1 add $0,$20 sub $0,1 mov $15,$0 mov $17,$0 lpb $17 mov $0,$15 sub $17,1 sub $0,$17 mov $11,$0 mov $13,2 lpb $13 clr $0,11 mov $0,$11 sub $13,1 add $0,$13 sub $0,1 mov $5,$0 mov $7,$0 add $7,1 mov $8,$0 lpb $7 mov $0,$5 sub $7,1 sub $0,$7 add $0,1 mov $4,1 add $4,$0 mov $2,$4 sub $4,$0 mov $1,$4 lpb $0 sub $0,1 trn $1,$3 mov $3,$1 mov $1,$4 trn $1,3 add $3,1 add $4,$3 div $3,$2 mov $2,2 add $2,$1 lpe mul $2,2 mov $1,$2 sub $1,3 mov $3,2 add $6,$1 lpe mov $1,$6 div $1,2 mov $10,$8 mul $10,2 add $1,$10 mov $14,$13 lpb $14 mov $12,$1 sub $14,1 lpe lpe lpb $11 mov $11,0 sub $12,$1 lpe mov $1,$12 sub $1,1 mul $1,2 add $16,$1 lpe mov $1,$16 mov $21,$20 lpb $21 mov $19,$1 sub $21,1 lpe lpe lpb $18 mov $18,0 sub $19,$1 lpe mov $1,$19 div $1,2
_date: file format elf32-i386 Disassembly of section .text: 00000000 <main>: #include "types.h" #include "user.h" #include "date.h" int main (int argc, char *argv[]) { 0: 8d 4c 24 04 lea 0x4(%esp),%ecx 4: 83 e4 f0 and $0xfffffff0,%esp 7: ff 71 fc pushl -0x4(%ecx) a: 55 push %ebp b: 89 e5 mov %esp,%ebp d: 51 push %ecx struct rtcdate r; if (date(&r)) { e: 8d 45 e0 lea -0x20(%ebp),%eax { 11: 83 ec 30 sub $0x30,%esp if (date(&r)) { 14: 50 push %eax 15: e8 39 03 00 00 call 353 <date> 1a: 83 c4 10 add $0x10,%esp 1d: 85 c0 test %eax,%eax 1f: 74 13 je 34 <main+0x34> printf(2, "date failed\n"); 21: 50 push %eax 22: 50 push %eax 23: 68 a8 07 00 00 push $0x7a8 28: 6a 02 push $0x2 2a: e8 11 04 00 00 call 440 <printf> exit (); 2f: e8 7f 02 00 00 call 2b3 <exit> } printf(1, "%d/%d/%d %d:%d:%d\n", r.day, r.month, r.year, r.hour, r.minute, r.second); 34: ff 75 e0 pushl -0x20(%ebp) 37: ff 75 e4 pushl -0x1c(%ebp) 3a: ff 75 e8 pushl -0x18(%ebp) 3d: ff 75 f4 pushl -0xc(%ebp) 40: ff 75 f0 pushl -0x10(%ebp) 43: ff 75 ec pushl -0x14(%ebp) 46: 68 b5 07 00 00 push $0x7b5 4b: 6a 01 push $0x1 4d: e8 ee 03 00 00 call 440 <printf> exit(); 52: 83 c4 20 add $0x20,%esp 55: e8 59 02 00 00 call 2b3 <exit> 5a: 66 90 xchg %ax,%ax 5c: 66 90 xchg %ax,%ax 5e: 66 90 xchg %ax,%ax 00000060 <strcpy>: #include "user.h" #include "x86.h" char* strcpy(char *s, char *t) { 60: 55 push %ebp char *os; os = s; while((*s++ = *t++) != 0) 61: 31 c0 xor %eax,%eax { 63: 89 e5 mov %esp,%ebp 65: 53 push %ebx 66: 8b 4d 08 mov 0x8(%ebp),%ecx 69: 8b 5d 0c mov 0xc(%ebp),%ebx 6c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi while((*s++ = *t++) != 0) 70: 0f b6 14 03 movzbl (%ebx,%eax,1),%edx 74: 88 14 01 mov %dl,(%ecx,%eax,1) 77: 83 c0 01 add $0x1,%eax 7a: 84 d2 test %dl,%dl 7c: 75 f2 jne 70 <strcpy+0x10> ; return os; } 7e: 89 c8 mov %ecx,%eax 80: 5b pop %ebx 81: 5d pop %ebp 82: c3 ret 83: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 00000090 <strcmp>: int strcmp(const char *p, const char *q) { 90: 55 push %ebp 91: 89 e5 mov %esp,%ebp 93: 53 push %ebx 94: 8b 4d 08 mov 0x8(%ebp),%ecx 97: 8b 55 0c mov 0xc(%ebp),%edx while(*p && *p == *q) 9a: 0f b6 01 movzbl (%ecx),%eax 9d: 0f b6 1a movzbl (%edx),%ebx a0: 84 c0 test %al,%al a2: 75 1d jne c1 <strcmp+0x31> a4: eb 2a jmp d0 <strcmp+0x40> a6: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi ad: 8d 76 00 lea 0x0(%esi),%esi b0: 0f b6 41 01 movzbl 0x1(%ecx),%eax p++, q++; b4: 83 c1 01 add $0x1,%ecx b7: 83 c2 01 add $0x1,%edx while(*p && *p == *q) ba: 0f b6 1a movzbl (%edx),%ebx bd: 84 c0 test %al,%al bf: 74 0f je d0 <strcmp+0x40> c1: 38 d8 cmp %bl,%al c3: 74 eb je b0 <strcmp+0x20> return (uchar)*p - (uchar)*q; c5: 29 d8 sub %ebx,%eax } c7: 5b pop %ebx c8: 5d pop %ebp c9: c3 ret ca: 8d b6 00 00 00 00 lea 0x0(%esi),%esi d0: 31 c0 xor %eax,%eax return (uchar)*p - (uchar)*q; d2: 29 d8 sub %ebx,%eax } d4: 5b pop %ebx d5: 5d pop %ebp d6: c3 ret d7: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi de: 66 90 xchg %ax,%ax 000000e0 <strlen>: uint strlen(char *s) { e0: 55 push %ebp e1: 89 e5 mov %esp,%ebp e3: 8b 55 08 mov 0x8(%ebp),%edx int n; for(n = 0; s[n]; n++) e6: 80 3a 00 cmpb $0x0,(%edx) e9: 74 15 je 100 <strlen+0x20> eb: 31 c0 xor %eax,%eax ed: 8d 76 00 lea 0x0(%esi),%esi f0: 83 c0 01 add $0x1,%eax f3: 80 3c 02 00 cmpb $0x0,(%edx,%eax,1) f7: 89 c1 mov %eax,%ecx f9: 75 f5 jne f0 <strlen+0x10> ; return n; } fb: 89 c8 mov %ecx,%eax fd: 5d pop %ebp fe: c3 ret ff: 90 nop for(n = 0; s[n]; n++) 100: 31 c9 xor %ecx,%ecx } 102: 5d pop %ebp 103: 89 c8 mov %ecx,%eax 105: c3 ret 106: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 10d: 8d 76 00 lea 0x0(%esi),%esi 00000110 <memset>: void* memset(void *dst, int c, uint n) { 110: 55 push %ebp 111: 89 e5 mov %esp,%ebp 113: 57 push %edi 114: 8b 55 08 mov 0x8(%ebp),%edx } static inline void stosb(void *addr, int data, int cnt) { asm volatile("cld; rep stosb" : 117: 8b 4d 10 mov 0x10(%ebp),%ecx 11a: 8b 45 0c mov 0xc(%ebp),%eax 11d: 89 d7 mov %edx,%edi 11f: fc cld 120: f3 aa rep stos %al,%es:(%edi) stosb(dst, c, n); return dst; } 122: 89 d0 mov %edx,%eax 124: 5f pop %edi 125: 5d pop %ebp 126: c3 ret 127: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 12e: 66 90 xchg %ax,%ax 00000130 <strchr>: char* strchr(const char *s, char c) { 130: 55 push %ebp 131: 89 e5 mov %esp,%ebp 133: 8b 45 08 mov 0x8(%ebp),%eax 136: 0f b6 4d 0c movzbl 0xc(%ebp),%ecx for(; *s; s++) 13a: 0f b6 10 movzbl (%eax),%edx 13d: 84 d2 test %dl,%dl 13f: 75 12 jne 153 <strchr+0x23> 141: eb 1d jmp 160 <strchr+0x30> 143: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 147: 90 nop 148: 0f b6 50 01 movzbl 0x1(%eax),%edx 14c: 83 c0 01 add $0x1,%eax 14f: 84 d2 test %dl,%dl 151: 74 0d je 160 <strchr+0x30> if(*s == c) 153: 38 d1 cmp %dl,%cl 155: 75 f1 jne 148 <strchr+0x18> return (char*)s; return 0; } 157: 5d pop %ebp 158: c3 ret 159: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi return 0; 160: 31 c0 xor %eax,%eax } 162: 5d pop %ebp 163: c3 ret 164: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 16b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 16f: 90 nop 00000170 <gets>: char* gets(char *buf, int max) { 170: 55 push %ebp 171: 89 e5 mov %esp,%ebp 173: 57 push %edi 174: 56 push %esi int i, cc; char c; for(i=0; i+1 < max; ){ 175: 31 f6 xor %esi,%esi { 177: 53 push %ebx 178: 89 f3 mov %esi,%ebx 17a: 83 ec 1c sub $0x1c,%esp 17d: 8b 7d 08 mov 0x8(%ebp),%edi for(i=0; i+1 < max; ){ 180: eb 2f jmp 1b1 <gets+0x41> 182: 8d b6 00 00 00 00 lea 0x0(%esi),%esi cc = read(0, &c, 1); 188: 83 ec 04 sub $0x4,%esp 18b: 8d 45 e7 lea -0x19(%ebp),%eax 18e: 6a 01 push $0x1 190: 50 push %eax 191: 6a 00 push $0x0 193: e8 33 01 00 00 call 2cb <read> if(cc < 1) 198: 83 c4 10 add $0x10,%esp 19b: 85 c0 test %eax,%eax 19d: 7e 1c jle 1bb <gets+0x4b> break; buf[i++] = c; 19f: 0f b6 45 e7 movzbl -0x19(%ebp),%eax 1a3: 83 c7 01 add $0x1,%edi 1a6: 88 47 ff mov %al,-0x1(%edi) if(c == '\n' || c == '\r') 1a9: 3c 0a cmp $0xa,%al 1ab: 74 23 je 1d0 <gets+0x60> 1ad: 3c 0d cmp $0xd,%al 1af: 74 1f je 1d0 <gets+0x60> for(i=0; i+1 < max; ){ 1b1: 83 c3 01 add $0x1,%ebx 1b4: 89 fe mov %edi,%esi 1b6: 3b 5d 0c cmp 0xc(%ebp),%ebx 1b9: 7c cd jl 188 <gets+0x18> 1bb: 89 f3 mov %esi,%ebx break; } buf[i] = '\0'; return buf; } 1bd: 8b 45 08 mov 0x8(%ebp),%eax buf[i] = '\0'; 1c0: c6 03 00 movb $0x0,(%ebx) } 1c3: 8d 65 f4 lea -0xc(%ebp),%esp 1c6: 5b pop %ebx 1c7: 5e pop %esi 1c8: 5f pop %edi 1c9: 5d pop %ebp 1ca: c3 ret 1cb: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 1cf: 90 nop 1d0: 8b 75 08 mov 0x8(%ebp),%esi 1d3: 8b 45 08 mov 0x8(%ebp),%eax 1d6: 01 de add %ebx,%esi 1d8: 89 f3 mov %esi,%ebx buf[i] = '\0'; 1da: c6 03 00 movb $0x0,(%ebx) } 1dd: 8d 65 f4 lea -0xc(%ebp),%esp 1e0: 5b pop %ebx 1e1: 5e pop %esi 1e2: 5f pop %edi 1e3: 5d pop %ebp 1e4: c3 ret 1e5: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 1ec: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 000001f0 <stat>: int stat(char *n, struct stat *st) { 1f0: 55 push %ebp 1f1: 89 e5 mov %esp,%ebp 1f3: 56 push %esi 1f4: 53 push %ebx int fd; int r; fd = open(n, O_RDONLY); 1f5: 83 ec 08 sub $0x8,%esp 1f8: 6a 00 push $0x0 1fa: ff 75 08 pushl 0x8(%ebp) 1fd: e8 f1 00 00 00 call 2f3 <open> if(fd < 0) 202: 83 c4 10 add $0x10,%esp 205: 85 c0 test %eax,%eax 207: 78 27 js 230 <stat+0x40> return -1; r = fstat(fd, st); 209: 83 ec 08 sub $0x8,%esp 20c: ff 75 0c pushl 0xc(%ebp) 20f: 89 c3 mov %eax,%ebx 211: 50 push %eax 212: e8 f4 00 00 00 call 30b <fstat> close(fd); 217: 89 1c 24 mov %ebx,(%esp) r = fstat(fd, st); 21a: 89 c6 mov %eax,%esi close(fd); 21c: e8 ba 00 00 00 call 2db <close> return r; 221: 83 c4 10 add $0x10,%esp } 224: 8d 65 f8 lea -0x8(%ebp),%esp 227: 89 f0 mov %esi,%eax 229: 5b pop %ebx 22a: 5e pop %esi 22b: 5d pop %ebp 22c: c3 ret 22d: 8d 76 00 lea 0x0(%esi),%esi return -1; 230: be ff ff ff ff mov $0xffffffff,%esi 235: eb ed jmp 224 <stat+0x34> 237: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 23e: 66 90 xchg %ax,%ax 00000240 <atoi>: int atoi(const char *s) { 240: 55 push %ebp 241: 89 e5 mov %esp,%ebp 243: 53 push %ebx 244: 8b 55 08 mov 0x8(%ebp),%edx int n; n = 0; while('0' <= *s && *s <= '9') 247: 0f be 02 movsbl (%edx),%eax 24a: 8d 48 d0 lea -0x30(%eax),%ecx 24d: 80 f9 09 cmp $0x9,%cl n = 0; 250: b9 00 00 00 00 mov $0x0,%ecx while('0' <= *s && *s <= '9') 255: 77 1e ja 275 <atoi+0x35> 257: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 25e: 66 90 xchg %ax,%ax n = n*10 + *s++ - '0'; 260: 83 c2 01 add $0x1,%edx 263: 8d 0c 89 lea (%ecx,%ecx,4),%ecx 266: 8d 4c 48 d0 lea -0x30(%eax,%ecx,2),%ecx while('0' <= *s && *s <= '9') 26a: 0f be 02 movsbl (%edx),%eax 26d: 8d 58 d0 lea -0x30(%eax),%ebx 270: 80 fb 09 cmp $0x9,%bl 273: 76 eb jbe 260 <atoi+0x20> return n; } 275: 89 c8 mov %ecx,%eax 277: 5b pop %ebx 278: 5d pop %ebp 279: c3 ret 27a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 00000280 <memmove>: void* memmove(void *vdst, void *vsrc, int n) { 280: 55 push %ebp 281: 89 e5 mov %esp,%ebp 283: 57 push %edi 284: 8b 45 10 mov 0x10(%ebp),%eax 287: 8b 55 08 mov 0x8(%ebp),%edx 28a: 56 push %esi 28b: 8b 75 0c mov 0xc(%ebp),%esi char *dst, *src; dst = vdst; src = vsrc; while(n-- > 0) 28e: 85 c0 test %eax,%eax 290: 7e 13 jle 2a5 <memmove+0x25> 292: 01 d0 add %edx,%eax dst = vdst; 294: 89 d7 mov %edx,%edi 296: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 29d: 8d 76 00 lea 0x0(%esi),%esi *dst++ = *src++; 2a0: a4 movsb %ds:(%esi),%es:(%edi) while(n-- > 0) 2a1: 39 f8 cmp %edi,%eax 2a3: 75 fb jne 2a0 <memmove+0x20> return vdst; } 2a5: 5e pop %esi 2a6: 89 d0 mov %edx,%eax 2a8: 5f pop %edi 2a9: 5d pop %ebp 2aa: c3 ret 000002ab <fork>: name: \ movl $SYS_ ## name, %eax; \ int $T_SYSCALL; \ ret SYSCALL(fork) 2ab: b8 01 00 00 00 mov $0x1,%eax 2b0: cd 40 int $0x40 2b2: c3 ret 000002b3 <exit>: SYSCALL(exit) 2b3: b8 02 00 00 00 mov $0x2,%eax 2b8: cd 40 int $0x40 2ba: c3 ret 000002bb <wait>: SYSCALL(wait) 2bb: b8 03 00 00 00 mov $0x3,%eax 2c0: cd 40 int $0x40 2c2: c3 ret 000002c3 <pipe>: SYSCALL(pipe) 2c3: b8 04 00 00 00 mov $0x4,%eax 2c8: cd 40 int $0x40 2ca: c3 ret 000002cb <read>: SYSCALL(read) 2cb: b8 05 00 00 00 mov $0x5,%eax 2d0: cd 40 int $0x40 2d2: c3 ret 000002d3 <write>: SYSCALL(write) 2d3: b8 10 00 00 00 mov $0x10,%eax 2d8: cd 40 int $0x40 2da: c3 ret 000002db <close>: SYSCALL(close) 2db: b8 15 00 00 00 mov $0x15,%eax 2e0: cd 40 int $0x40 2e2: c3 ret 000002e3 <kill>: SYSCALL(kill) 2e3: b8 06 00 00 00 mov $0x6,%eax 2e8: cd 40 int $0x40 2ea: c3 ret 000002eb <exec>: SYSCALL(exec) 2eb: b8 07 00 00 00 mov $0x7,%eax 2f0: cd 40 int $0x40 2f2: c3 ret 000002f3 <open>: SYSCALL(open) 2f3: b8 0f 00 00 00 mov $0xf,%eax 2f8: cd 40 int $0x40 2fa: c3 ret 000002fb <mknod>: SYSCALL(mknod) 2fb: b8 11 00 00 00 mov $0x11,%eax 300: cd 40 int $0x40 302: c3 ret 00000303 <unlink>: SYSCALL(unlink) 303: b8 12 00 00 00 mov $0x12,%eax 308: cd 40 int $0x40 30a: c3 ret 0000030b <fstat>: SYSCALL(fstat) 30b: b8 08 00 00 00 mov $0x8,%eax 310: cd 40 int $0x40 312: c3 ret 00000313 <link>: SYSCALL(link) 313: b8 13 00 00 00 mov $0x13,%eax 318: cd 40 int $0x40 31a: c3 ret 0000031b <mkdir>: SYSCALL(mkdir) 31b: b8 14 00 00 00 mov $0x14,%eax 320: cd 40 int $0x40 322: c3 ret 00000323 <chdir>: SYSCALL(chdir) 323: b8 09 00 00 00 mov $0x9,%eax 328: cd 40 int $0x40 32a: c3 ret 0000032b <dup>: SYSCALL(dup) 32b: b8 0a 00 00 00 mov $0xa,%eax 330: cd 40 int $0x40 332: c3 ret 00000333 <getpid>: SYSCALL(getpid) 333: b8 0b 00 00 00 mov $0xb,%eax 338: cd 40 int $0x40 33a: c3 ret 0000033b <sbrk>: SYSCALL(sbrk) 33b: b8 0c 00 00 00 mov $0xc,%eax 340: cd 40 int $0x40 342: c3 ret 00000343 <sleep>: SYSCALL(sleep) 343: b8 0d 00 00 00 mov $0xd,%eax 348: cd 40 int $0x40 34a: c3 ret 0000034b <uptime>: SYSCALL(uptime) 34b: b8 0e 00 00 00 mov $0xe,%eax 350: cd 40 int $0x40 352: c3 ret 00000353 <date>: SYSCALL(date) // date system call added for part 1 353: b8 16 00 00 00 mov $0x16,%eax 358: cd 40 int $0x40 35a: c3 ret 0000035b <getuid>: SYSCALL(getuid) //Gets the UID of a process 35b: b8 17 00 00 00 mov $0x17,%eax 360: cd 40 int $0x40 362: c3 ret 00000363 <getgid>: SYSCALL(getgid) //Gets the GID of a process 363: b8 18 00 00 00 mov $0x18,%eax 368: cd 40 int $0x40 36a: c3 ret 0000036b <getppid>: SYSCALL(getppid) //Gets the PPID of a process 36b: b8 19 00 00 00 mov $0x19,%eax 370: cd 40 int $0x40 372: c3 ret 00000373 <setuid>: SYSCALL(setuid) //Sets a new UID for a process 373: b8 1a 00 00 00 mov $0x1a,%eax 378: cd 40 int $0x40 37a: c3 ret 0000037b <setgid>: SYSCALL(setgid) //Sets a new GID for a process 37b: b8 1b 00 00 00 mov $0x1b,%eax 380: cd 40 int $0x40 382: c3 ret 00000383 <cps>: SYSCALL(cps) 383: b8 1c 00 00 00 mov $0x1c,%eax 388: cd 40 int $0x40 38a: c3 ret 38b: 66 90 xchg %ax,%ax 38d: 66 90 xchg %ax,%ax 38f: 90 nop 00000390 <printint>: write(fd, &c, 1); } static void printint(int fd, int xx, int base, int sgn) { 390: 55 push %ebp 391: 89 e5 mov %esp,%ebp 393: 57 push %edi 394: 56 push %esi 395: 53 push %ebx 396: 83 ec 3c sub $0x3c,%esp 399: 89 4d c4 mov %ecx,-0x3c(%ebp) uint x; neg = 0; if(sgn && xx < 0){ neg = 1; x = -xx; 39c: 89 d1 mov %edx,%ecx { 39e: 89 45 b8 mov %eax,-0x48(%ebp) if(sgn && xx < 0){ 3a1: 85 d2 test %edx,%edx 3a3: 0f 89 7f 00 00 00 jns 428 <printint+0x98> 3a9: f6 45 08 01 testb $0x1,0x8(%ebp) 3ad: 74 79 je 428 <printint+0x98> neg = 1; 3af: c7 45 bc 01 00 00 00 movl $0x1,-0x44(%ebp) x = -xx; 3b6: f7 d9 neg %ecx } else { x = xx; } i = 0; 3b8: 31 db xor %ebx,%ebx 3ba: 8d 75 d7 lea -0x29(%ebp),%esi 3bd: 8d 76 00 lea 0x0(%esi),%esi do{ buf[i++] = digits[x % base]; 3c0: 89 c8 mov %ecx,%eax 3c2: 31 d2 xor %edx,%edx 3c4: 89 cf mov %ecx,%edi 3c6: f7 75 c4 divl -0x3c(%ebp) 3c9: 0f b6 92 d0 07 00 00 movzbl 0x7d0(%edx),%edx 3d0: 89 45 c0 mov %eax,-0x40(%ebp) 3d3: 89 d8 mov %ebx,%eax 3d5: 8d 5b 01 lea 0x1(%ebx),%ebx }while((x /= base) != 0); 3d8: 8b 4d c0 mov -0x40(%ebp),%ecx buf[i++] = digits[x % base]; 3db: 88 14 1e mov %dl,(%esi,%ebx,1) }while((x /= base) != 0); 3de: 39 7d c4 cmp %edi,-0x3c(%ebp) 3e1: 76 dd jbe 3c0 <printint+0x30> if(neg) 3e3: 8b 4d bc mov -0x44(%ebp),%ecx 3e6: 85 c9 test %ecx,%ecx 3e8: 74 0c je 3f6 <printint+0x66> buf[i++] = '-'; 3ea: c6 44 1d d8 2d movb $0x2d,-0x28(%ebp,%ebx,1) buf[i++] = digits[x % base]; 3ef: 89 d8 mov %ebx,%eax buf[i++] = '-'; 3f1: ba 2d 00 00 00 mov $0x2d,%edx while(--i >= 0) 3f6: 8b 7d b8 mov -0x48(%ebp),%edi 3f9: 8d 5c 05 d7 lea -0x29(%ebp,%eax,1),%ebx 3fd: eb 07 jmp 406 <printint+0x76> 3ff: 90 nop 400: 0f b6 13 movzbl (%ebx),%edx 403: 83 eb 01 sub $0x1,%ebx write(fd, &c, 1); 406: 83 ec 04 sub $0x4,%esp 409: 88 55 d7 mov %dl,-0x29(%ebp) 40c: 6a 01 push $0x1 40e: 56 push %esi 40f: 57 push %edi 410: e8 be fe ff ff call 2d3 <write> while(--i >= 0) 415: 83 c4 10 add $0x10,%esp 418: 39 de cmp %ebx,%esi 41a: 75 e4 jne 400 <printint+0x70> putc(fd, buf[i]); } 41c: 8d 65 f4 lea -0xc(%ebp),%esp 41f: 5b pop %ebx 420: 5e pop %esi 421: 5f pop %edi 422: 5d pop %ebp 423: c3 ret 424: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi neg = 0; 428: c7 45 bc 00 00 00 00 movl $0x0,-0x44(%ebp) 42f: eb 87 jmp 3b8 <printint+0x28> 431: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 438: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 43f: 90 nop 00000440 <printf>: // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, char *fmt, ...) { 440: 55 push %ebp 441: 89 e5 mov %esp,%ebp 443: 57 push %edi 444: 56 push %esi 445: 53 push %ebx 446: 83 ec 2c sub $0x2c,%esp int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 449: 8b 75 0c mov 0xc(%ebp),%esi 44c: 0f b6 1e movzbl (%esi),%ebx 44f: 84 db test %bl,%bl 451: 0f 84 b8 00 00 00 je 50f <printf+0xcf> ap = (uint*)(void*)&fmt + 1; 457: 8d 45 10 lea 0x10(%ebp),%eax 45a: 83 c6 01 add $0x1,%esi write(fd, &c, 1); 45d: 8d 7d e7 lea -0x19(%ebp),%edi state = 0; 460: 31 d2 xor %edx,%edx ap = (uint*)(void*)&fmt + 1; 462: 89 45 d0 mov %eax,-0x30(%ebp) 465: eb 37 jmp 49e <printf+0x5e> 467: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 46e: 66 90 xchg %ax,%ax 470: 89 55 d4 mov %edx,-0x2c(%ebp) c = fmt[i] & 0xff; if(state == 0){ if(c == '%'){ state = '%'; 473: ba 25 00 00 00 mov $0x25,%edx if(c == '%'){ 478: 83 f8 25 cmp $0x25,%eax 47b: 74 17 je 494 <printf+0x54> write(fd, &c, 1); 47d: 83 ec 04 sub $0x4,%esp 480: 88 5d e7 mov %bl,-0x19(%ebp) 483: 6a 01 push $0x1 485: 57 push %edi 486: ff 75 08 pushl 0x8(%ebp) 489: e8 45 fe ff ff call 2d3 <write> 48e: 8b 55 d4 mov -0x2c(%ebp),%edx } else { putc(fd, c); 491: 83 c4 10 add $0x10,%esp for(i = 0; fmt[i]; i++){ 494: 0f b6 1e movzbl (%esi),%ebx 497: 83 c6 01 add $0x1,%esi 49a: 84 db test %bl,%bl 49c: 74 71 je 50f <printf+0xcf> c = fmt[i] & 0xff; 49e: 0f be cb movsbl %bl,%ecx 4a1: 0f b6 c3 movzbl %bl,%eax if(state == 0){ 4a4: 85 d2 test %edx,%edx 4a6: 74 c8 je 470 <printf+0x30> } } else if(state == '%'){ 4a8: 83 fa 25 cmp $0x25,%edx 4ab: 75 e7 jne 494 <printf+0x54> if(c == 'd'){ 4ad: 83 f8 64 cmp $0x64,%eax 4b0: 0f 84 9a 00 00 00 je 550 <printf+0x110> printint(fd, *ap, 10, 1); ap++; } else if(c == 'x' || c == 'p'){ 4b6: 81 e1 f7 00 00 00 and $0xf7,%ecx 4bc: 83 f9 70 cmp $0x70,%ecx 4bf: 74 5f je 520 <printf+0xe0> printint(fd, *ap, 16, 0); ap++; } else if(c == 's'){ 4c1: 83 f8 73 cmp $0x73,%eax 4c4: 0f 84 d6 00 00 00 je 5a0 <printf+0x160> s = "(null)"; while(*s != 0){ putc(fd, *s); s++; } } else if(c == 'c'){ 4ca: 83 f8 63 cmp $0x63,%eax 4cd: 0f 84 8d 00 00 00 je 560 <printf+0x120> putc(fd, *ap); ap++; } else if(c == '%'){ 4d3: 83 f8 25 cmp $0x25,%eax 4d6: 0f 84 b4 00 00 00 je 590 <printf+0x150> write(fd, &c, 1); 4dc: 83 ec 04 sub $0x4,%esp 4df: c6 45 e7 25 movb $0x25,-0x19(%ebp) 4e3: 6a 01 push $0x1 4e5: 57 push %edi 4e6: ff 75 08 pushl 0x8(%ebp) 4e9: e8 e5 fd ff ff call 2d3 <write> putc(fd, c); } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); putc(fd, c); 4ee: 88 5d e7 mov %bl,-0x19(%ebp) write(fd, &c, 1); 4f1: 83 c4 0c add $0xc,%esp 4f4: 6a 01 push $0x1 4f6: 83 c6 01 add $0x1,%esi 4f9: 57 push %edi 4fa: ff 75 08 pushl 0x8(%ebp) 4fd: e8 d1 fd ff ff call 2d3 <write> for(i = 0; fmt[i]; i++){ 502: 0f b6 5e ff movzbl -0x1(%esi),%ebx putc(fd, c); 506: 83 c4 10 add $0x10,%esp } state = 0; 509: 31 d2 xor %edx,%edx for(i = 0; fmt[i]; i++){ 50b: 84 db test %bl,%bl 50d: 75 8f jne 49e <printf+0x5e> } } } 50f: 8d 65 f4 lea -0xc(%ebp),%esp 512: 5b pop %ebx 513: 5e pop %esi 514: 5f pop %edi 515: 5d pop %ebp 516: c3 ret 517: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 51e: 66 90 xchg %ax,%ax printint(fd, *ap, 16, 0); 520: 83 ec 0c sub $0xc,%esp 523: b9 10 00 00 00 mov $0x10,%ecx 528: 6a 00 push $0x0 52a: 8b 5d d0 mov -0x30(%ebp),%ebx 52d: 8b 45 08 mov 0x8(%ebp),%eax 530: 8b 13 mov (%ebx),%edx 532: e8 59 fe ff ff call 390 <printint> ap++; 537: 89 d8 mov %ebx,%eax 539: 83 c4 10 add $0x10,%esp state = 0; 53c: 31 d2 xor %edx,%edx ap++; 53e: 83 c0 04 add $0x4,%eax 541: 89 45 d0 mov %eax,-0x30(%ebp) 544: e9 4b ff ff ff jmp 494 <printf+0x54> 549: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi printint(fd, *ap, 10, 1); 550: 83 ec 0c sub $0xc,%esp 553: b9 0a 00 00 00 mov $0xa,%ecx 558: 6a 01 push $0x1 55a: eb ce jmp 52a <printf+0xea> 55c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi putc(fd, *ap); 560: 8b 5d d0 mov -0x30(%ebp),%ebx write(fd, &c, 1); 563: 83 ec 04 sub $0x4,%esp putc(fd, *ap); 566: 8b 03 mov (%ebx),%eax write(fd, &c, 1); 568: 6a 01 push $0x1 ap++; 56a: 83 c3 04 add $0x4,%ebx write(fd, &c, 1); 56d: 57 push %edi 56e: ff 75 08 pushl 0x8(%ebp) putc(fd, *ap); 571: 88 45 e7 mov %al,-0x19(%ebp) write(fd, &c, 1); 574: e8 5a fd ff ff call 2d3 <write> ap++; 579: 89 5d d0 mov %ebx,-0x30(%ebp) 57c: 83 c4 10 add $0x10,%esp state = 0; 57f: 31 d2 xor %edx,%edx 581: e9 0e ff ff ff jmp 494 <printf+0x54> 586: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 58d: 8d 76 00 lea 0x0(%esi),%esi putc(fd, c); 590: 88 5d e7 mov %bl,-0x19(%ebp) write(fd, &c, 1); 593: 83 ec 04 sub $0x4,%esp 596: e9 59 ff ff ff jmp 4f4 <printf+0xb4> 59b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 59f: 90 nop s = (char*)*ap; 5a0: 8b 45 d0 mov -0x30(%ebp),%eax 5a3: 8b 18 mov (%eax),%ebx ap++; 5a5: 83 c0 04 add $0x4,%eax 5a8: 89 45 d0 mov %eax,-0x30(%ebp) if(s == 0) 5ab: 85 db test %ebx,%ebx 5ad: 74 17 je 5c6 <printf+0x186> while(*s != 0){ 5af: 0f b6 03 movzbl (%ebx),%eax state = 0; 5b2: 31 d2 xor %edx,%edx while(*s != 0){ 5b4: 84 c0 test %al,%al 5b6: 0f 84 d8 fe ff ff je 494 <printf+0x54> 5bc: 89 75 d4 mov %esi,-0x2c(%ebp) 5bf: 89 de mov %ebx,%esi 5c1: 8b 5d 08 mov 0x8(%ebp),%ebx 5c4: eb 1a jmp 5e0 <printf+0x1a0> s = "(null)"; 5c6: bb c8 07 00 00 mov $0x7c8,%ebx while(*s != 0){ 5cb: 89 75 d4 mov %esi,-0x2c(%ebp) 5ce: b8 28 00 00 00 mov $0x28,%eax 5d3: 89 de mov %ebx,%esi 5d5: 8b 5d 08 mov 0x8(%ebp),%ebx 5d8: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 5df: 90 nop write(fd, &c, 1); 5e0: 83 ec 04 sub $0x4,%esp s++; 5e3: 83 c6 01 add $0x1,%esi 5e6: 88 45 e7 mov %al,-0x19(%ebp) write(fd, &c, 1); 5e9: 6a 01 push $0x1 5eb: 57 push %edi 5ec: 53 push %ebx 5ed: e8 e1 fc ff ff call 2d3 <write> while(*s != 0){ 5f2: 0f b6 06 movzbl (%esi),%eax 5f5: 83 c4 10 add $0x10,%esp 5f8: 84 c0 test %al,%al 5fa: 75 e4 jne 5e0 <printf+0x1a0> 5fc: 8b 75 d4 mov -0x2c(%ebp),%esi state = 0; 5ff: 31 d2 xor %edx,%edx 601: e9 8e fe ff ff jmp 494 <printf+0x54> 606: 66 90 xchg %ax,%ax 608: 66 90 xchg %ax,%ax 60a: 66 90 xchg %ax,%ax 60c: 66 90 xchg %ax,%ax 60e: 66 90 xchg %ax,%ax 00000610 <free>: static Header base; static Header *freep; void free(void *ap) { 610: 55 push %ebp Header *bp, *p; bp = (Header*)ap - 1; for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 611: a1 78 0a 00 00 mov 0xa78,%eax { 616: 89 e5 mov %esp,%ebp 618: 57 push %edi 619: 56 push %esi 61a: 53 push %ebx 61b: 8b 5d 08 mov 0x8(%ebp),%ebx 61e: 8b 10 mov (%eax),%edx bp = (Header*)ap - 1; 620: 8d 4b f8 lea -0x8(%ebx),%ecx for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 623: 39 c8 cmp %ecx,%eax 625: 73 19 jae 640 <free+0x30> 627: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 62e: 66 90 xchg %ax,%ax 630: 39 d1 cmp %edx,%ecx 632: 72 14 jb 648 <free+0x38> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 634: 39 d0 cmp %edx,%eax 636: 73 10 jae 648 <free+0x38> { 638: 89 d0 mov %edx,%eax for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 63a: 8b 10 mov (%eax),%edx 63c: 39 c8 cmp %ecx,%eax 63e: 72 f0 jb 630 <free+0x20> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 640: 39 d0 cmp %edx,%eax 642: 72 f4 jb 638 <free+0x28> 644: 39 d1 cmp %edx,%ecx 646: 73 f0 jae 638 <free+0x28> break; if(bp + bp->s.size == p->s.ptr){ 648: 8b 73 fc mov -0x4(%ebx),%esi 64b: 8d 3c f1 lea (%ecx,%esi,8),%edi 64e: 39 fa cmp %edi,%edx 650: 74 1e je 670 <free+0x60> bp->s.size += p->s.ptr->s.size; bp->s.ptr = p->s.ptr->s.ptr; } else bp->s.ptr = p->s.ptr; 652: 89 53 f8 mov %edx,-0x8(%ebx) if(p + p->s.size == bp){ 655: 8b 50 04 mov 0x4(%eax),%edx 658: 8d 34 d0 lea (%eax,%edx,8),%esi 65b: 39 f1 cmp %esi,%ecx 65d: 74 28 je 687 <free+0x77> p->s.size += bp->s.size; p->s.ptr = bp->s.ptr; } else p->s.ptr = bp; 65f: 89 08 mov %ecx,(%eax) freep = p; } 661: 5b pop %ebx freep = p; 662: a3 78 0a 00 00 mov %eax,0xa78 } 667: 5e pop %esi 668: 5f pop %edi 669: 5d pop %ebp 66a: c3 ret 66b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 66f: 90 nop bp->s.size += p->s.ptr->s.size; 670: 03 72 04 add 0x4(%edx),%esi 673: 89 73 fc mov %esi,-0x4(%ebx) bp->s.ptr = p->s.ptr->s.ptr; 676: 8b 10 mov (%eax),%edx 678: 8b 12 mov (%edx),%edx 67a: 89 53 f8 mov %edx,-0x8(%ebx) if(p + p->s.size == bp){ 67d: 8b 50 04 mov 0x4(%eax),%edx 680: 8d 34 d0 lea (%eax,%edx,8),%esi 683: 39 f1 cmp %esi,%ecx 685: 75 d8 jne 65f <free+0x4f> p->s.size += bp->s.size; 687: 03 53 fc add -0x4(%ebx),%edx freep = p; 68a: a3 78 0a 00 00 mov %eax,0xa78 p->s.size += bp->s.size; 68f: 89 50 04 mov %edx,0x4(%eax) p->s.ptr = bp->s.ptr; 692: 8b 53 f8 mov -0x8(%ebx),%edx 695: 89 10 mov %edx,(%eax) } 697: 5b pop %ebx 698: 5e pop %esi 699: 5f pop %edi 69a: 5d pop %ebp 69b: c3 ret 69c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 000006a0 <malloc>: return freep; } void* malloc(uint nbytes) { 6a0: 55 push %ebp 6a1: 89 e5 mov %esp,%ebp 6a3: 57 push %edi 6a4: 56 push %esi 6a5: 53 push %ebx 6a6: 83 ec 1c sub $0x1c,%esp Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; 6a9: 8b 45 08 mov 0x8(%ebp),%eax if((prevp = freep) == 0){ 6ac: 8b 3d 78 0a 00 00 mov 0xa78,%edi nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; 6b2: 8d 70 07 lea 0x7(%eax),%esi 6b5: c1 ee 03 shr $0x3,%esi 6b8: 83 c6 01 add $0x1,%esi if((prevp = freep) == 0){ 6bb: 85 ff test %edi,%edi 6bd: 0f 84 ad 00 00 00 je 770 <malloc+0xd0> base.s.ptr = freep = prevp = &base; base.s.size = 0; } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ 6c3: 8b 07 mov (%edi),%eax if(p->s.size >= nunits){ 6c5: 8b 48 04 mov 0x4(%eax),%ecx 6c8: 39 f1 cmp %esi,%ecx 6ca: 73 71 jae 73d <malloc+0x9d> 6cc: 81 fe 00 10 00 00 cmp $0x1000,%esi 6d2: bb 00 10 00 00 mov $0x1000,%ebx 6d7: 0f 43 de cmovae %esi,%ebx p = sbrk(nu * sizeof(Header)); 6da: 8d 0c dd 00 00 00 00 lea 0x0(,%ebx,8),%ecx 6e1: 89 4d e4 mov %ecx,-0x1c(%ebp) 6e4: eb 1b jmp 701 <malloc+0x61> 6e6: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 6ed: 8d 76 00 lea 0x0(%esi),%esi for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ 6f0: 8b 10 mov (%eax),%edx if(p->s.size >= nunits){ 6f2: 8b 4a 04 mov 0x4(%edx),%ecx 6f5: 39 f1 cmp %esi,%ecx 6f7: 73 4f jae 748 <malloc+0xa8> 6f9: 8b 3d 78 0a 00 00 mov 0xa78,%edi 6ff: 89 d0 mov %edx,%eax p->s.size = nunits; } freep = prevp; return (void*)(p + 1); } if(p == freep) 701: 39 c7 cmp %eax,%edi 703: 75 eb jne 6f0 <malloc+0x50> p = sbrk(nu * sizeof(Header)); 705: 83 ec 0c sub $0xc,%esp 708: ff 75 e4 pushl -0x1c(%ebp) 70b: e8 2b fc ff ff call 33b <sbrk> if(p == (char*)-1) 710: 83 c4 10 add $0x10,%esp 713: 83 f8 ff cmp $0xffffffff,%eax 716: 74 1b je 733 <malloc+0x93> hp->s.size = nu; 718: 89 58 04 mov %ebx,0x4(%eax) free((void*)(hp + 1)); 71b: 83 ec 0c sub $0xc,%esp 71e: 83 c0 08 add $0x8,%eax 721: 50 push %eax 722: e8 e9 fe ff ff call 610 <free> return freep; 727: a1 78 0a 00 00 mov 0xa78,%eax if((p = morecore(nunits)) == 0) 72c: 83 c4 10 add $0x10,%esp 72f: 85 c0 test %eax,%eax 731: 75 bd jne 6f0 <malloc+0x50> return 0; } } 733: 8d 65 f4 lea -0xc(%ebp),%esp return 0; 736: 31 c0 xor %eax,%eax } 738: 5b pop %ebx 739: 5e pop %esi 73a: 5f pop %edi 73b: 5d pop %ebp 73c: c3 ret if(p->s.size >= nunits){ 73d: 89 c2 mov %eax,%edx 73f: 89 f8 mov %edi,%eax 741: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi if(p->s.size == nunits) 748: 39 ce cmp %ecx,%esi 74a: 74 54 je 7a0 <malloc+0x100> p->s.size -= nunits; 74c: 29 f1 sub %esi,%ecx 74e: 89 4a 04 mov %ecx,0x4(%edx) p += p->s.size; 751: 8d 14 ca lea (%edx,%ecx,8),%edx p->s.size = nunits; 754: 89 72 04 mov %esi,0x4(%edx) freep = prevp; 757: a3 78 0a 00 00 mov %eax,0xa78 } 75c: 8d 65 f4 lea -0xc(%ebp),%esp return (void*)(p + 1); 75f: 8d 42 08 lea 0x8(%edx),%eax } 762: 5b pop %ebx 763: 5e pop %esi 764: 5f pop %edi 765: 5d pop %ebp 766: c3 ret 767: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 76e: 66 90 xchg %ax,%ax base.s.ptr = freep = prevp = &base; 770: c7 05 78 0a 00 00 7c movl $0xa7c,0xa78 777: 0a 00 00 base.s.size = 0; 77a: bf 7c 0a 00 00 mov $0xa7c,%edi base.s.ptr = freep = prevp = &base; 77f: c7 05 7c 0a 00 00 7c movl $0xa7c,0xa7c 786: 0a 00 00 for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ 789: 89 f8 mov %edi,%eax base.s.size = 0; 78b: c7 05 80 0a 00 00 00 movl $0x0,0xa80 792: 00 00 00 if(p->s.size >= nunits){ 795: e9 32 ff ff ff jmp 6cc <malloc+0x2c> 79a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi prevp->s.ptr = p->s.ptr; 7a0: 8b 0a mov (%edx),%ecx 7a2: 89 08 mov %ecx,(%eax) 7a4: eb b1 jmp 757 <malloc+0xb7>
.global s_prepare_buffers s_prepare_buffers: push %r11 push %r15 push %r8 push %rax push %rbx push %rcx push %rdi push %rsi lea addresses_normal_ht+0x1a7fb, %rsi lea addresses_D_ht+0x1b58c, %rdi xor %rbx, %rbx mov $96, %rcx rep movsb nop nop cmp $26944, %rbx lea addresses_UC_ht+0x162cc, %rcx nop nop nop add $25852, %r15 mov (%rcx), %eax nop nop nop nop sub %rsi, %rsi lea addresses_UC_ht+0x1cfa4, %rsi nop xor %r11, %r11 movl $0x61626364, (%rsi) nop nop nop nop sub $44976, %rbx lea addresses_UC_ht+0x132cc, %rsi lea addresses_UC_ht+0x144cc, %rdi nop nop nop nop nop add %r8, %r8 mov $14, %rcx rep movsl nop nop mfence pop %rsi pop %rdi pop %rcx pop %rbx pop %rax pop %r8 pop %r15 pop %r11 ret .global s_faulty_load s_faulty_load: push %r11 push %r12 push %r8 push %rbp push %rbx push %rcx push %rdi push %rsi // Load lea addresses_A+0x110ac, %rdi nop nop nop and %r8, %r8 vmovups (%rdi), %ymm5 vextracti128 $0, %ymm5, %xmm5 vpextrq $0, %xmm5, %r12 nop nop nop nop nop sub %rbp, %rbp // Load lea addresses_WT+0x72cc, %rdi add $41964, %rcx mov (%rdi), %rbx nop nop nop nop nop and %rcx, %rcx // Store lea addresses_US+0x18acc, %rbp nop nop nop nop nop xor $55095, %r8 mov $0x5152535455565758, %r11 movq %r11, (%rbp) nop nop nop nop nop and $28472, %r12 // Store lea addresses_PSE+0xea0c, %rbp nop sub $26219, %r12 movl $0x51525354, (%rbp) nop nop nop nop nop cmp $43393, %r8 // Load lea addresses_D+0x15ecc, %r11 nop inc %rdi mov (%r11), %ecx nop nop nop nop sub %r12, %r12 // Store lea addresses_PSE+0x13c0c, %rcx xor $10450, %r8 movb $0x51, (%rcx) nop nop nop mfence // Store lea addresses_WC+0xf18c, %r12 nop nop sub %r11, %r11 mov $0x5152535455565758, %rbp movq %rbp, %xmm7 vmovups %ymm7, (%r12) nop xor %rdi, %rdi // REPMOV lea addresses_normal+0x8acc, %rsi lea addresses_WC+0x1becc, %rdi nop nop nop nop nop add %r12, %r12 mov $121, %rcx rep movsl add $48863, %rbx // Store lea addresses_WC+0x143ac, %r12 nop nop and %rbx, %rbx movb $0x51, (%r12) nop nop nop add %rbp, %rbp // Load lea addresses_A+0xf2cc, %rbp nop nop nop and %rcx, %rcx mov (%rbp), %ebx // Exception!!! nop nop nop xor %rdi, %rdi div %rdi nop nop nop nop and $30093, %r8 // Store lea addresses_UC+0x15b6c, %rdi nop dec %r12 movb $0x51, (%rdi) nop add $15464, %r8 // Store lea addresses_WT+0x1b104, %rbx nop xor $57215, %r12 movw $0x5152, (%rbx) nop nop dec %rsi // Store lea addresses_WT+0x1294c, %rbp nop nop nop nop nop inc %rcx movl $0x51525354, (%rbp) nop nop nop nop nop cmp $63528, %rsi // Load lea addresses_normal+0x15d8c, %rdi clflush (%rdi) inc %rbx mov (%rdi), %r12 // Exception!!! nop nop nop xor %rbx, %rbx div %rbx nop nop sub $60408, %rsi // Faulty Load lea addresses_PSE+0x11acc, %rdi nop nop nop xor $1723, %r12 mov (%rdi), %ebp lea oracles, %rcx and $0xff, %rbp shlq $12, %rbp mov (%rcx,%rbp,1), %rbp pop %rsi pop %rdi pop %rcx pop %rbx pop %rbp pop %r8 pop %r12 pop %r11 ret /* <gen_faulty_load> [REF] {'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_PSE', 'AVXalign': False, 'size': 8}, 'OP': 'LOAD'} {'src': {'NT': False, 'same': False, 'congruent': 5, 'type': 'addresses_A', 'AVXalign': False, 'size': 32}, 'OP': 'LOAD'} {'src': {'NT': False, 'same': False, 'congruent': 11, 'type': 'addresses_WT', 'AVXalign': False, 'size': 8}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 9, 'type': 'addresses_US', 'AVXalign': False, 'size': 8}} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 6, 'type': 'addresses_PSE', 'AVXalign': False, 'size': 4}} {'src': {'NT': False, 'same': False, 'congruent': 10, 'type': 'addresses_D', 'AVXalign': False, 'size': 4}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 6, 'type': 'addresses_PSE', 'AVXalign': True, 'size': 1}} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 3, 'type': 'addresses_WC', 'AVXalign': False, 'size': 32}} {'src': {'same': False, 'congruent': 11, 'type': 'addresses_normal'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 9, 'type': 'addresses_WC'}} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 3, 'type': 'addresses_WC', 'AVXalign': False, 'size': 1}} {'src': {'NT': False, 'same': False, 'congruent': 11, 'type': 'addresses_A', 'AVXalign': False, 'size': 4}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 4, 'type': 'addresses_UC', 'AVXalign': True, 'size': 1}} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 1, 'type': 'addresses_WT', 'AVXalign': False, 'size': 2}} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 5, 'type': 'addresses_WT', 'AVXalign': False, 'size': 4}} {'src': {'NT': False, 'same': False, 'congruent': 6, 'type': 'addresses_normal', 'AVXalign': False, 'size': 8}, 'OP': 'LOAD'} [Faulty Load] {'src': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_PSE', 'AVXalign': False, 'size': 4}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'same': True, 'congruent': 0, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 4, 'type': 'addresses_D_ht'}} {'src': {'NT': False, 'same': False, 'congruent': 11, 'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 4}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 1, 'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 4}} {'src': {'same': False, 'congruent': 9, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 9, 'type': 'addresses_UC_ht'}} {'8f': 1} 8f */
section .data buffer times 500 db 0 value db 0 section .text global _start _start: mov ESI , 0 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 13 mov [buffer + ESI] , AH loop_start_1: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 2 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 5 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 2 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 6 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1 loop_end_1: ; RIGHT ADD ESI , 5 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 6 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 3 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 10 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 15 mov [buffer + ESI] , AH loop_start_19: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_19 loop_start_20: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_20 ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_20 loop_end_20: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH loop_start_24: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_24 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_24 loop_end_24: ; RIGHT ADD ESI , 9 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_19 loop_end_19: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH loop_start_31: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_31 ; RIGHT ADD ESI , 8 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_31 loop_end_31: ; LEFT SUB ESI , 9 loop_start_37: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_37 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_37 loop_end_37: ; RIGHT ADD ESI , 8 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 7 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 5 mov [buffer + ESI] , AH loop_start_45: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_45 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH loop_start_47: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_47 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 9 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_47 loop_end_47: ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_45 loop_end_45: ; RIGHT ADD ESI , 7 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 27 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 17 loop_start_60: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_60 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_60 loop_end_60: ; RIGHT ADD ESI , 3 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH loop_start_66: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_66 ; RIGHT ADD ESI , 6 loop_start_68: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_68 ; RIGHT ADD ESI , 7 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_68 loop_end_68: ; LEFT SUB ESI , 9 loop_start_74: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_74 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_74 loop_end_74: ; RIGHT ADD ESI , 7 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 6 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 4 mov [buffer + ESI] , AH loop_start_82: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_82 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH loop_start_84: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_84 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 9 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_84 loop_end_84: ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_82 loop_end_82: ; RIGHT ADD ESI , 6 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 6 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 7 mov [buffer + ESI] , AH loop_start_96: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_96 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH loop_start_98: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_98 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 9 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_98 loop_end_98: ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_96 loop_end_96: ; RIGHT ADD ESI , 6 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 16 loop_start_109: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_109 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_109 loop_end_109: ; RIGHT ADD ESI , 3 loop_start_113: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_113 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 6 loop_start_116: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_116 ; RIGHT ADD ESI , 7 loop_start_118: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_118 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 6 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 6 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_118 loop_end_118: ; LEFT SUB ESI , 6 loop_start_125: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_125 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 6 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_125 loop_end_125: ; RIGHT ADD ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_116 loop_end_116: ; LEFT SUB ESI , 9 loop_start_138: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_138 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_138 loop_end_138: ; RIGHT ADD ESI , 9 loop_start_142: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_142 ; RIGHT ADD ESI , 8 loop_start_144: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_144 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 7 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 7 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_144 loop_end_144: ; LEFT SUB ESI , 7 loop_start_151: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_151 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 7 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_151 loop_end_151: ; RIGHT ADD ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_142 loop_end_142: ; LEFT SUB ESI , 9 loop_start_164: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_164 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_164 loop_end_164: ; RIGHT ADD ESI , 7 loop_start_168: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_168 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 7 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 7 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_168 loop_end_168: ; LEFT SUB ESI , 7 loop_start_175: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_175 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 7 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 5 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_175 loop_end_175: ; RIGHT ADD ESI , 9 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 15 mov [buffer + ESI] , AH loop_start_185: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_185 loop_start_186: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_186 ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_186 loop_end_186: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; LEFT SUB ESI , 9 loop_start_209: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_209 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_209 loop_end_209: ; RIGHT ADD ESI , 9 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_185 loop_end_185: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH loop_start_216: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_216 ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_216 loop_end_216: ; LEFT SUB ESI , 9 loop_start_222: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_222 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_222 loop_end_222: ; RIGHT ADD ESI , 9 loop_start_226: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_226 ; RIGHT ADD ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 loop_start_230: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_230 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_230 loop_end_230: ; LEFT SUB ESI , 4 loop_start_237: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_237 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 5 loop_start_242: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_242 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 loop_start_245: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_245 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_245 loop_end_245: ; LEFT SUB ESI , 2 loop_start_252: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_252 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_252 loop_end_252: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_242 loop_end_242: ; LEFT SUB ESI , 8 loop_start_264: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_264 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_264 loop_end_264: mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_237 loop_end_237: ; RIGHT ADD ESI , 9 loop_start_269: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_269 ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_269 loop_end_269: ; LEFT SUB ESI , 9 loop_start_273: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_273 ; RIGHT ADD ESI , 1 loop_start_275: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_275 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 9 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_275 loop_end_275: ; LEFT SUB ESI , 10 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_273 loop_end_273: ; RIGHT ADD ESI , 1 loop_start_284: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_284 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 9 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_284 loop_end_284: ; LEFT SUB ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_226 loop_end_226: ; LEFT SUB ESI , 9 loop_start_295: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_295 ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 loop_start_301: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_301 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 loop_start_306: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_306 ; LEFT SUB ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 6 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 6 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_306 loop_end_306: ; LEFT SUB ESI , 1 loop_start_316: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_316 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_316 loop_end_316: ; RIGHT ADD ESI , 4 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_301 loop_end_301: ; LEFT SUB ESI , 3 loop_start_325: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_325 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_325 loop_end_325: ; LEFT SUB ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_295 loop_end_295: ; RIGHT ADD ESI , 9 loop_start_336: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_336 ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_336 loop_end_336: ; LEFT SUB ESI , 9 loop_start_342: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_342 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_342 loop_end_342: ; RIGHT ADD ESI , 9 loop_start_346: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_346 ; RIGHT ADD ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 loop_start_350: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_350 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 5 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_350 loop_end_350: ; LEFT SUB ESI , 5 loop_start_357: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_357 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 6 loop_start_362: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_362 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 loop_start_365: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_365 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_365 loop_end_365: ; LEFT SUB ESI , 3 loop_start_372: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_372 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_372 loop_end_372: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_362 loop_end_362: ; LEFT SUB ESI , 8 loop_start_384: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_384 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_384 loop_end_384: mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_357 loop_end_357: ; RIGHT ADD ESI , 9 loop_start_389: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_389 ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_389 loop_end_389: ; LEFT SUB ESI , 9 loop_start_393: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_393 ; RIGHT ADD ESI , 2 loop_start_395: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_395 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 9 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_395 loop_end_395: ; LEFT SUB ESI , 11 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_393 loop_end_393: ; RIGHT ADD ESI , 2 loop_start_404: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_404 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 9 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_404 loop_end_404: ; LEFT SUB ESI , 2 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_346 loop_end_346: ; LEFT SUB ESI , 9 loop_start_415: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_415 ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 loop_start_421: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_421 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 loop_start_426: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_426 ; LEFT SUB ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 6 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 6 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_426 loop_end_426: ; LEFT SUB ESI , 1 loop_start_436: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_436 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_436 loop_end_436: ; RIGHT ADD ESI , 4 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_421 loop_end_421: ; LEFT SUB ESI , 3 loop_start_445: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_445 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_445 loop_end_445: ; LEFT SUB ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_415 loop_end_415: ; RIGHT ADD ESI , 9 loop_start_456: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_456 ; RIGHT ADD ESI , 4 loop_start_458: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_458 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 36 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 36 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_458 loop_end_458: ; RIGHT ADD ESI , 5 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_456 loop_end_456: ; LEFT SUB ESI , 9 loop_start_467: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_467 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_467 loop_end_467: ; RIGHT ADD ESI , 9 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 15 mov [buffer + ESI] , AH loop_start_472: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_472 loop_start_473: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_473 ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_473 loop_end_473: ; LEFT SUB ESI , 9 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 9 loop_start_479: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_479 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_479 loop_end_479: ; RIGHT ADD ESI , 9 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_472 loop_end_472: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 21 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 loop_start_489: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_489 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_489 loop_end_489: ; RIGHT ADD ESI , 9 loop_start_493: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_493 ; RIGHT ADD ESI , 3 loop_start_495: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_495 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_495 loop_end_495: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 loop_start_503: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_503 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 loop_start_508: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_508 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_508 loop_end_508: ; LEFT SUB ESI , 4 loop_start_515: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_515 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 13 loop_start_520: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_520 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_520 loop_end_520: ; RIGHT ADD ESI , 4 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 loop_start_527: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_527 ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_527 loop_end_527: ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_515 loop_end_515: mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_503 loop_end_503: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 loop_start_537: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_537 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_537 loop_end_537: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 loop_start_545: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_545 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 loop_start_550: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_550 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_550 loop_end_550: ; LEFT SUB ESI , 3 loop_start_557: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_557 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 12 loop_start_562: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_562 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_562 loop_end_562: ; RIGHT ADD ESI , 3 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 6 loop_start_569: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_569 ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_569 loop_end_569: ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_557 loop_end_557: mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_545 loop_end_545: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 loop_start_580: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_580 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 loop_start_583: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_583 ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_583 loop_end_583: ; LEFT SUB ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_580 loop_end_580: ; RIGHT ADD ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_493 loop_end_493: ; LEFT SUB ESI , 9 loop_start_591: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_591 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_591 loop_end_591: ; LEFT SUB ESI , 7 loop_start_595: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_595 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_595 loop_end_595: ; RIGHT ADD ESI , 9 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 26 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 loop_start_606: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_606 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_606 loop_end_606: ; LEFT SUB ESI , 4 loop_start_613: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_613 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_613 loop_end_613: ; RIGHT ADD ESI , 2 loop_start_622: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_622 ; LEFT SUB ESI , 7 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 loop_start_626: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_626 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_626 loop_end_626: ; RIGHT ADD ESI , 1 loop_start_636: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_636 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 loop_start_639: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_639 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_639 loop_end_639: ; RIGHT ADD ESI , 3 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_636 loop_end_636: ; RIGHT ADD ESI , 13 loop_start_650: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_650 ; RIGHT ADD ESI , 2 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_650 loop_end_650: ; LEFT SUB ESI , 9 loop_start_660: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_660 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_660 loop_end_660: ; RIGHT ADD ESI , 3 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 6 loop_start_666: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_666 ; RIGHT ADD ESI , 5 loop_start_668: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_668 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_668 loop_end_668: ; LEFT SUB ESI , 4 loop_start_675: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_675 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_675 loop_end_675: ; RIGHT ADD ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_666 loop_end_666: ; LEFT SUB ESI , 9 loop_start_686: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_686 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_686 loop_end_686: ; RIGHT ADD ESI , 9 loop_start_690: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_690 ; RIGHT ADD ESI , 2 loop_start_692: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_692 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 9 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_692 loop_end_692: ; RIGHT ADD ESI , 7 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_690 loop_end_690: ; LEFT SUB ESI , 9 loop_start_701: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_701 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_701 loop_end_701: ; RIGHT ADD ESI , 9 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 15 mov [buffer + ESI] , AH loop_start_706: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_706 loop_start_707: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_707 ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_707 loop_end_707: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; LEFT SUB ESI , 9 loop_start_730: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_730 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_730 loop_end_730: ; RIGHT ADD ESI , 9 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_706 loop_end_706: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH loop_start_737: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_737 ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_737 loop_end_737: ; LEFT SUB ESI , 9 loop_start_743: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_743 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_743 loop_end_743: ; RIGHT ADD ESI , 9 loop_start_747: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_747 ; RIGHT ADD ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 loop_start_751: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_751 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 5 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_751 loop_end_751: ; LEFT SUB ESI , 5 loop_start_758: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_758 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 6 loop_start_763: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_763 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 loop_start_766: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_766 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_766 loop_end_766: ; LEFT SUB ESI , 2 loop_start_773: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_773 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_773 loop_end_773: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_763 loop_end_763: ; LEFT SUB ESI , 8 loop_start_785: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_785 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_785 loop_end_785: mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_758 loop_end_758: ; RIGHT ADD ESI , 9 loop_start_790: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_790 ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_790 loop_end_790: ; LEFT SUB ESI , 9 loop_start_794: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_794 ; RIGHT ADD ESI , 1 loop_start_796: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_796 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 9 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_796 loop_end_796: ; LEFT SUB ESI , 10 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_794 loop_end_794: ; RIGHT ADD ESI , 1 loop_start_805: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_805 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 9 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_805 loop_end_805: ; LEFT SUB ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_747 loop_end_747: ; LEFT SUB ESI , 9 loop_start_816: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_816 ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 loop_start_822: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_822 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 loop_start_827: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_827 ; LEFT SUB ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 7 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 7 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_827 loop_end_827: ; LEFT SUB ESI , 1 loop_start_837: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_837 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_837 loop_end_837: ; RIGHT ADD ESI , 3 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_822 loop_end_822: ; LEFT SUB ESI , 2 loop_start_846: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_846 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_846 loop_end_846: ; LEFT SUB ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_816 loop_end_816: ; RIGHT ADD ESI , 9 loop_start_857: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_857 ; RIGHT ADD ESI , 6 loop_start_859: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_859 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 5 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_859 loop_end_859: ; LEFT SUB ESI , 5 loop_start_866: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_866 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_866 loop_end_866: ; RIGHT ADD ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_857 loop_end_857: ; LEFT SUB ESI , 9 loop_start_877: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_877 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_877 loop_end_877: ; RIGHT ADD ESI , 9 loop_start_881: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_881 ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_881 loop_end_881: ; LEFT SUB ESI , 9 loop_start_887: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_887 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_887 loop_end_887: ; RIGHT ADD ESI , 9 loop_start_891: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_891 ; RIGHT ADD ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 loop_start_895: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_895 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 5 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_895 loop_end_895: ; LEFT SUB ESI , 5 loop_start_902: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_902 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 6 loop_start_907: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_907 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 loop_start_910: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_910 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_910 loop_end_910: ; LEFT SUB ESI , 2 loop_start_917: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_917 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_917 loop_end_917: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_907 loop_end_907: ; LEFT SUB ESI , 8 loop_start_929: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_929 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_929 loop_end_929: mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_902 loop_end_902: ; RIGHT ADD ESI , 9 loop_start_934: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_934 ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_934 loop_end_934: ; LEFT SUB ESI , 9 loop_start_938: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_938 ; RIGHT ADD ESI , 1 loop_start_940: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_940 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 9 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_940 loop_end_940: ; LEFT SUB ESI , 10 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_938 loop_end_938: ; RIGHT ADD ESI , 1 loop_start_949: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_949 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 9 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_949 loop_end_949: ; LEFT SUB ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_891 loop_end_891: ; LEFT SUB ESI , 9 loop_start_960: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_960 ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 loop_start_966: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_966 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 loop_start_971: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_971 ; LEFT SUB ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 6 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 6 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_971 loop_end_971: ; LEFT SUB ESI , 1 loop_start_981: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_981 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_981 loop_end_981: ; RIGHT ADD ESI , 4 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_966 loop_end_966: ; LEFT SUB ESI , 3 loop_start_990: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_990 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_990 loop_end_990: ; LEFT SUB ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_960 loop_end_960: ; RIGHT ADD ESI , 9 loop_start_1001: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1001 ; RIGHT ADD ESI , 4 loop_start_1003: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1003 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 36 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 36 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1003 loop_end_1003: ; RIGHT ADD ESI , 5 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1001 loop_end_1001: ; LEFT SUB ESI , 9 loop_start_1012: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1012 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1012 loop_end_1012: ; RIGHT ADD ESI , 9 loop_start_1016: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1016 ; RIGHT ADD ESI , 3 loop_start_1018: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1018 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 36 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 36 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1018 loop_end_1018: ; RIGHT ADD ESI , 6 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1016 loop_end_1016: ; LEFT SUB ESI , 9 loop_start_1027: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1027 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1027 loop_end_1027: ; RIGHT ADD ESI , 9 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 15 mov [buffer + ESI] , AH loop_start_1032: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1032 loop_start_1033: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1033 ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1033 loop_end_1033: ; LEFT SUB ESI , 9 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 9 loop_start_1039: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1039 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1039 loop_end_1039: ; RIGHT ADD ESI , 9 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1032 loop_end_1032: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH loop_start_1046: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1046 ; RIGHT ADD ESI , 8 loop_start_1048: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1048 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 7 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 7 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1048 loop_end_1048: ; LEFT SUB ESI , 7 loop_start_1055: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1055 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 7 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 6 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1055 loop_end_1055: ; RIGHT ADD ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1046 loop_end_1046: ; LEFT SUB ESI , 9 loop_start_1066: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1066 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1066 loop_end_1066: ; RIGHT ADD ESI , 9 loop_start_1070: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1070 ; RIGHT ADD ESI , 6 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1070 loop_end_1070: ; LEFT SUB ESI , 9 loop_start_1076: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1076 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1076 loop_end_1076: ; RIGHT ADD ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 loop_start_1082: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1082 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1082 loop_end_1082: ; RIGHT ADD ESI , 1 loop_start_1091: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1091 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 6 loop_start_1094: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1094 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 2 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1094 loop_end_1094: ; RIGHT ADD ESI , 5 loop_start_1103: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1103 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 5 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1103 loop_end_1103: ; LEFT SUB ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1091 loop_end_1091: ; LEFT SUB ESI , 1 loop_start_1116: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1116 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1116 loop_end_1116: ; LEFT SUB ESI , 5 loop_start_1123: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1123 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 5 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1123 loop_end_1123: ; RIGHT ADD ESI , 6 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; LEFT SUB ESI , 6 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 loop_start_1134: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1134 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1134 loop_end_1134: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 loop_start_1142: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1142 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 loop_start_1147: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1147 ; RIGHT ADD ESI , 2 loop_start_1149: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1149 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1149 loop_end_1149: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 loop_start_1157: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1157 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 loop_start_1162: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1162 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1162 loop_end_1162: ; LEFT SUB ESI , 3 loop_start_1169: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1169 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 12 loop_start_1174: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1174 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1174 loop_end_1174: ; RIGHT ADD ESI , 3 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 6 loop_start_1181: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1181 ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1181 loop_end_1181: ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1169 loop_end_1169: mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1157 loop_end_1157: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 loop_start_1191: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1191 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1191 loop_end_1191: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 loop_start_1199: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1199 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 loop_start_1204: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1204 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1204 loop_end_1204: ; LEFT SUB ESI , 2 loop_start_1211: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1211 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 11 loop_start_1216: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1216 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1216 loop_end_1216: ; RIGHT ADD ESI , 4 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 loop_start_1223: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1223 ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1223 loop_end_1223: ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1211 loop_end_1211: mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1199 loop_end_1199: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 loop_start_1234: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1234 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 loop_start_1237: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1237 ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1237 loop_end_1237: ; LEFT SUB ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1234 loop_end_1234: ; RIGHT ADD ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1147 loop_end_1147: ; LEFT SUB ESI , 9 loop_start_1245: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1245 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1245 loop_end_1245: ; RIGHT ADD ESI , 4 loop_start_1249: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1249 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1249 loop_end_1249: ; LEFT SUB ESI , 4 loop_start_1256: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1256 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 loop_start_1261: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1261 ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 loop_start_1265: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1265 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1265 loop_end_1265: ; LEFT SUB ESI , 2 loop_start_1272: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1272 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1272 loop_end_1272: ; RIGHT ADD ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1261 loop_end_1261: ; LEFT SUB ESI , 8 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 loop_start_1283: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1283 ; RIGHT ADD ESI , 1 loop_start_1285: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1285 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 loop_start_1290: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1290 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 14 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 11 loop_start_1297: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1297 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1297 loop_end_1297: ; LEFT SUB ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1290 loop_end_1290: ; RIGHT ADD ESI , 1 loop_start_1306: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1306 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 14 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 11 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1306 loop_end_1306: ; LEFT SUB ESI , 2 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1285 loop_end_1285: ; RIGHT ADD ESI , 1 loop_start_1317: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1317 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 loop_start_1322: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1322 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 14 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 11 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1322 loop_end_1322: ; LEFT SUB ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1317 loop_end_1317: ; RIGHT ADD ESI , 1 loop_start_1333: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1333 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1333 loop_end_1333: ; LEFT SUB ESI , 12 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1283 loop_end_1283: ; RIGHT ADD ESI , 4 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1256 loop_end_1256: ; RIGHT ADD ESI , 3 loop_start_1346: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1346 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1346 loop_end_1346: ; LEFT SUB ESI , 3 loop_start_1353: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1353 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 6 loop_start_1358: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1358 ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 loop_start_1362: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1362 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1362 loop_end_1362: ; LEFT SUB ESI , 1 loop_start_1369: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1369 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1369 loop_end_1369: ; RIGHT ADD ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1358 loop_end_1358: ; LEFT SUB ESI , 8 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 loop_start_1380: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1380 ; RIGHT ADD ESI , 1 loop_start_1382: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1382 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 loop_start_1387: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1387 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 14 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 10 loop_start_1394: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1394 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1394 loop_end_1394: ; RIGHT ADD ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1387 loop_end_1387: ; LEFT SUB ESI , 1 loop_start_1403: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1403 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 14 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 10 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1403 loop_end_1403: ; LEFT SUB ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1382 loop_end_1382: ; RIGHT ADD ESI , 2 loop_start_1414: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1414 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 loop_start_1419: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1419 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 14 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 10 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1419 loop_end_1419: ; RIGHT ADD ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1414 loop_end_1414: ; LEFT SUB ESI , 1 loop_start_1430: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1430 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1430 loop_end_1430: ; LEFT SUB ESI , 11 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1380 loop_end_1380: ; RIGHT ADD ESI , 6 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 6 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1353 loop_end_1353: mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1142 loop_end_1142: ; RIGHT ADD ESI , 4 loop_start_1444: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1444 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1444 loop_end_1444: ; LEFT SUB ESI , 4 loop_start_1451: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1451 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 loop_start_1456: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1456 ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1456 loop_end_1456: ; LEFT SUB ESI , 9 loop_start_1460: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1460 ; RIGHT ADD ESI , 1 loop_start_1462: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1462 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 loop_start_1467: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1467 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 14 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 11 loop_start_1474: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1474 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1474 loop_end_1474: ; LEFT SUB ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1467 loop_end_1467: ; RIGHT ADD ESI , 1 loop_start_1483: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1483 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 14 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 11 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1483 loop_end_1483: ; LEFT SUB ESI , 2 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1462 loop_end_1462: ; RIGHT ADD ESI , 1 loop_start_1494: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1494 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 loop_start_1499: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1499 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 14 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 11 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1499 loop_end_1499: ; LEFT SUB ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1494 loop_end_1494: ; RIGHT ADD ESI , 1 loop_start_1510: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1510 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1510 loop_end_1510: ; LEFT SUB ESI , 12 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1460 loop_end_1460: mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1451 loop_end_1451: ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 loop_start_1526: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1526 ; RIGHT ADD ESI , 2 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 6 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1526 loop_end_1526: ; LEFT SUB ESI , 9 loop_start_1534: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1534 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1534 loop_end_1534: ; RIGHT ADD ESI , 9 loop_start_1538: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1538 ; RIGHT ADD ESI , 5 loop_start_1540: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1540 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1540 loop_end_1540: ; LEFT SUB ESI , 4 loop_start_1547: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1547 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1547 loop_end_1547: ; RIGHT ADD ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1538 loop_end_1538: ; LEFT SUB ESI , 9 loop_start_1558: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1558 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1558 loop_end_1558: ; RIGHT ADD ESI , 9 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 15 mov [buffer + ESI] , AH loop_start_1563: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1563 loop_start_1564: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1564 ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1564 loop_end_1564: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; LEFT SUB ESI , 9 loop_start_1587: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1587 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1587 loop_end_1587: ; RIGHT ADD ESI , 9 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1563 loop_end_1563: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH loop_start_1594: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1594 ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1594 loop_end_1594: ; LEFT SUB ESI , 9 loop_start_1600: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1600 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1600 loop_end_1600: ; RIGHT ADD ESI , 9 loop_start_1604: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1604 ; RIGHT ADD ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 loop_start_1608: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1608 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1608 loop_end_1608: ; LEFT SUB ESI , 4 loop_start_1615: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1615 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 5 loop_start_1620: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1620 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 loop_start_1623: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1623 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1623 loop_end_1623: ; LEFT SUB ESI , 2 loop_start_1630: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1630 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1630 loop_end_1630: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1620 loop_end_1620: ; LEFT SUB ESI , 8 loop_start_1642: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1642 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1642 loop_end_1642: mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1615 loop_end_1615: ; RIGHT ADD ESI , 9 loop_start_1647: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1647 ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1647 loop_end_1647: ; LEFT SUB ESI , 9 loop_start_1651: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1651 ; RIGHT ADD ESI , 1 loop_start_1653: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1653 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 9 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1653 loop_end_1653: ; LEFT SUB ESI , 10 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1651 loop_end_1651: ; RIGHT ADD ESI , 1 loop_start_1662: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1662 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 9 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1662 loop_end_1662: ; LEFT SUB ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1604 loop_end_1604: ; LEFT SUB ESI , 9 loop_start_1673: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1673 ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 loop_start_1679: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1679 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 loop_start_1684: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1684 ; LEFT SUB ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 7 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 7 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1684 loop_end_1684: ; LEFT SUB ESI , 1 loop_start_1694: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1694 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1694 loop_end_1694: ; RIGHT ADD ESI , 3 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1679 loop_end_1679: ; LEFT SUB ESI , 2 loop_start_1703: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1703 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1703 loop_end_1703: ; LEFT SUB ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1673 loop_end_1673: ; RIGHT ADD ESI , 9 loop_start_1714: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1714 ; RIGHT ADD ESI , 3 loop_start_1716: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1716 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 36 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 36 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1716 loop_end_1716: ; RIGHT ADD ESI , 6 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1714 loop_end_1714: ; LEFT SUB ESI , 9 loop_start_1725: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1725 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1725 loop_end_1725: ; RIGHT ADD ESI , 5 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 15 mov [buffer + ESI] , AH loop_start_1732: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1732 loop_start_1733: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1733 ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1733 loop_end_1733: ; LEFT SUB ESI , 9 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 9 loop_start_1739: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1739 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1739 loop_end_1739: ; RIGHT ADD ESI , 9 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1732 loop_end_1732: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH loop_start_1746: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1746 ; RIGHT ADD ESI , 3 loop_start_1748: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1748 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1748 loop_end_1748: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 loop_start_1756: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1756 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 loop_start_1761: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1761 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1761 loop_end_1761: ; LEFT SUB ESI , 4 loop_start_1768: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1768 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 13 loop_start_1773: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1773 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1773 loop_end_1773: ; RIGHT ADD ESI , 4 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 loop_start_1780: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1780 ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1780 loop_end_1780: ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1768 loop_end_1768: mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1756 loop_end_1756: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 loop_start_1790: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1790 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1790 loop_end_1790: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 loop_start_1798: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1798 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 loop_start_1803: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1803 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1803 loop_end_1803: ; LEFT SUB ESI , 3 loop_start_1810: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1810 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 12 loop_start_1815: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1815 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1815 loop_end_1815: ; RIGHT ADD ESI , 3 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 6 loop_start_1822: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1822 ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1822 loop_end_1822: ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1810 loop_end_1810: mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1798 loop_end_1798: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 loop_start_1833: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1833 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 loop_start_1836: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1836 ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1836 loop_end_1836: ; LEFT SUB ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1833 loop_end_1833: ; RIGHT ADD ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1746 loop_end_1746: ; LEFT SUB ESI , 9 loop_start_1844: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1844 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1844 loop_end_1844: ; RIGHT ADD ESI , 3 loop_start_1848: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1848 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1848 loop_end_1848: ; LEFT SUB ESI , 3 loop_start_1855: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1855 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 6 loop_start_1860: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1860 ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 loop_start_1864: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1864 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1864 loop_end_1864: ; LEFT SUB ESI , 3 loop_start_1871: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1871 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1871 loop_end_1871: ; RIGHT ADD ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1860 loop_end_1860: ; LEFT SUB ESI , 8 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 loop_start_1882: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1882 ; RIGHT ADD ESI , 1 loop_start_1884: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1884 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 loop_start_1889: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1889 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 10 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 12 loop_start_1896: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1896 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1896 loop_end_1896: ; LEFT SUB ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1889 loop_end_1889: ; RIGHT ADD ESI , 1 loop_start_1905: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1905 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 10 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 12 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1905 loop_end_1905: ; LEFT SUB ESI , 3 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1884 loop_end_1884: ; RIGHT ADD ESI , 2 loop_start_1916: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1916 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 loop_start_1921: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1921 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 10 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 12 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1921 loop_end_1921: ; LEFT SUB ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1916 loop_end_1916: ; RIGHT ADD ESI , 1 loop_start_1932: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1932 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1932 loop_end_1932: ; LEFT SUB ESI , 13 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1882 loop_end_1882: mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1855 loop_end_1855: ; RIGHT ADD ESI , 4 loop_start_1942: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1942 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1942 loop_end_1942: ; LEFT SUB ESI , 4 loop_start_1949: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1949 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 loop_start_1954: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1954 ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 loop_start_1958: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1958 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1958 loop_end_1958: ; LEFT SUB ESI , 2 loop_start_1965: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1965 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1965 loop_end_1965: ; RIGHT ADD ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1954 loop_end_1954: ; LEFT SUB ESI , 8 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 loop_start_1976: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1976 ; RIGHT ADD ESI , 1 loop_start_1978: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1978 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 loop_start_1983: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1983 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 10 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 11 loop_start_1990: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1990 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1990 loop_end_1990: ; RIGHT ADD ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1983 loop_end_1983: ; LEFT SUB ESI , 1 loop_start_1999: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1999 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 10 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 11 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1999 loop_end_1999: ; LEFT SUB ESI , 2 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1978 loop_end_1978: ; RIGHT ADD ESI , 3 loop_start_2010: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2010 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 loop_start_2015: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2015 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 10 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 11 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2015 loop_end_2015: ; RIGHT ADD ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2010 loop_end_2010: ; LEFT SUB ESI , 1 loop_start_2026: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2026 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2026 loop_end_2026: ; LEFT SUB ESI , 12 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1976 loop_end_1976: ; RIGHT ADD ESI , 5 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 5 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1949 loop_end_1949: ; RIGHT ADD ESI , 9 loop_start_2039: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2039 ; RIGHT ADD ESI , 3 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2039 loop_end_2039: ; LEFT SUB ESI , 9 loop_start_2049: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2049 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2049 loop_end_2049: ; RIGHT ADD ESI , 3 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 loop_start_2057: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2057 ; RIGHT ADD ESI , 7 loop_start_2059: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2059 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 6 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 6 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2059 loop_end_2059: ; LEFT SUB ESI , 6 loop_start_2066: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2066 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 6 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2066 loop_end_2066: ; RIGHT ADD ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2057 loop_end_2057: ; LEFT SUB ESI , 9 loop_start_2077: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2077 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2077 loop_end_2077: ; RIGHT ADD ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 loop_start_2083: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2083 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2083 loop_end_2083: ; RIGHT ADD ESI , 2 loop_start_2092: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2092 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 7 loop_start_2095: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2095 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 2 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2095 loop_end_2095: ; RIGHT ADD ESI , 5 loop_start_2104: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2104 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 5 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2104 loop_end_2104: ; LEFT SUB ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2092 loop_end_2092: ; LEFT SUB ESI , 2 loop_start_2117: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2117 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2117 loop_end_2117: ; LEFT SUB ESI , 5 loop_start_2124: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2124 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 5 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2124 loop_end_2124: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 loop_start_2132: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2132 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2132 loop_end_2132: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 loop_start_2140: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2140 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 loop_start_2145: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2145 ; RIGHT ADD ESI , 3 loop_start_2147: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2147 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2147 loop_end_2147: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 loop_start_2155: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2155 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 loop_start_2160: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2160 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2160 loop_end_2160: ; LEFT SUB ESI , 2 loop_start_2167: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2167 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 11 loop_start_2172: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2172 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2172 loop_end_2172: ; RIGHT ADD ESI , 4 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 loop_start_2179: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2179 ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2179 loop_end_2179: ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2167 loop_end_2167: mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2155 loop_end_2155: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 loop_start_2189: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2189 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2189 loop_end_2189: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 loop_start_2197: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2197 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 loop_start_2202: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2202 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2202 loop_end_2202: ; LEFT SUB ESI , 3 loop_start_2209: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2209 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 12 loop_start_2214: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2214 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2214 loop_end_2214: ; RIGHT ADD ESI , 3 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 6 loop_start_2221: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2221 ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2221 loop_end_2221: ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2209 loop_end_2209: mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2197 loop_end_2197: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 loop_start_2232: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2232 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 loop_start_2235: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2235 ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2235 loop_end_2235: ; LEFT SUB ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2232 loop_end_2232: ; RIGHT ADD ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2145 loop_end_2145: ; LEFT SUB ESI , 9 loop_start_2243: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2243 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2243 loop_end_2243: ; RIGHT ADD ESI , 3 loop_start_2247: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2247 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2247 loop_end_2247: ; LEFT SUB ESI , 3 loop_start_2254: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2254 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 6 loop_start_2259: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2259 ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 loop_start_2263: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2263 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2263 loop_end_2263: ; LEFT SUB ESI , 1 loop_start_2270: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2270 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2270 loop_end_2270: ; RIGHT ADD ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2259 loop_end_2259: ; LEFT SUB ESI , 8 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 loop_start_2281: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2281 ; RIGHT ADD ESI , 1 loop_start_2283: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2283 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 loop_start_2288: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2288 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 13 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 10 loop_start_2295: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2295 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2295 loop_end_2295: ; RIGHT ADD ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2288 loop_end_2288: ; LEFT SUB ESI , 1 loop_start_2304: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2304 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 13 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 10 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2304 loop_end_2304: ; LEFT SUB ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2283 loop_end_2283: ; RIGHT ADD ESI , 2 loop_start_2315: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2315 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 loop_start_2320: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2320 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 13 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 10 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2320 loop_end_2320: ; RIGHT ADD ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2315 loop_end_2315: ; LEFT SUB ESI , 1 loop_start_2331: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2331 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2331 loop_end_2331: ; LEFT SUB ESI , 11 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2281 loop_end_2281: ; RIGHT ADD ESI , 5 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 loop_start_2342: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2342 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 7 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 7 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2342 loop_end_2342: ; LEFT SUB ESI , 7 loop_start_2349: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2349 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 7 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 5 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2349 loop_end_2349: mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2254 loop_end_2254: ; RIGHT ADD ESI , 4 loop_start_2359: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2359 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2359 loop_end_2359: ; LEFT SUB ESI , 4 loop_start_2366: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2366 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 loop_start_2371: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2371 ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 loop_start_2375: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2375 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2375 loop_end_2375: ; LEFT SUB ESI , 2 loop_start_2382: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2382 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2382 loop_end_2382: ; RIGHT ADD ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2371 loop_end_2371: ; LEFT SUB ESI , 8 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 loop_start_2393: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2393 ; RIGHT ADD ESI , 1 loop_start_2395: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2395 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 loop_start_2400: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2400 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 13 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 11 loop_start_2407: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2407 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2407 loop_end_2407: ; LEFT SUB ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2400 loop_end_2400: ; RIGHT ADD ESI , 1 loop_start_2416: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2416 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 13 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 11 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2416 loop_end_2416: ; LEFT SUB ESI , 2 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2395 loop_end_2395: ; RIGHT ADD ESI , 1 loop_start_2427: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2427 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 loop_start_2432: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2432 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 13 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 11 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2432 loop_end_2432: ; LEFT SUB ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2427 loop_end_2427: ; RIGHT ADD ESI , 1 loop_start_2443: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2443 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2443 loop_end_2443: ; LEFT SUB ESI , 12 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2393 loop_end_2393: mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2366 loop_end_2366: ; RIGHT ADD ESI , 4 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2140 loop_end_2140: ; RIGHT ADD ESI , 4 loop_start_2457: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2457 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2457 loop_end_2457: ; LEFT SUB ESI , 4 loop_start_2464: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2464 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 loop_start_2471: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2471 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 7 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 7 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2471 loop_end_2471: ; LEFT SUB ESI , 7 loop_start_2478: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2478 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 7 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 5 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2478 loop_end_2478: ; RIGHT ADD ESI , 9 loop_start_2487: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2487 ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2487 loop_end_2487: ; LEFT SUB ESI , 9 loop_start_2491: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2491 ; RIGHT ADD ESI , 1 loop_start_2493: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2493 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 loop_start_2498: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2498 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 13 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 11 loop_start_2505: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2505 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2505 loop_end_2505: ; LEFT SUB ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2498 loop_end_2498: ; RIGHT ADD ESI , 1 loop_start_2514: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2514 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 13 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 11 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2514 loop_end_2514: ; LEFT SUB ESI , 2 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2493 loop_end_2493: ; RIGHT ADD ESI , 1 loop_start_2525: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2525 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 loop_start_2530: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2530 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 13 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 11 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2530 loop_end_2530: ; LEFT SUB ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2525 loop_end_2525: ; RIGHT ADD ESI , 1 loop_start_2541: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2541 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2541 loop_end_2541: ; LEFT SUB ESI , 12 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2491 loop_end_2491: mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2464 loop_end_2464: ; RIGHT ADD ESI , 9 loop_start_2551: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2551 ; RIGHT ADD ESI , 2 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 6 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2551 loop_end_2551: ; LEFT SUB ESI , 9 loop_start_2559: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2559 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2559 loop_end_2559: ; RIGHT ADD ESI , 3 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 loop_start_2567: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2567 ; RIGHT ADD ESI , 5 loop_start_2569: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2569 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2569 loop_end_2569: ; LEFT SUB ESI , 4 loop_start_2576: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2576 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2576 loop_end_2576: ; RIGHT ADD ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2567 loop_end_2567: ; LEFT SUB ESI , 9 loop_start_2587: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2587 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2587 loop_end_2587: ; RIGHT ADD ESI , 9 loop_start_2591: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2591 ; RIGHT ADD ESI , 6 loop_start_2593: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2593 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 5 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2593 loop_end_2593: ; LEFT SUB ESI , 5 loop_start_2600: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2600 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2600 loop_end_2600: ; RIGHT ADD ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2591 loop_end_2591: ; LEFT SUB ESI , 9 loop_start_2611: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2611 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2611 loop_end_2611: ; RIGHT ADD ESI , 9 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 15 mov [buffer + ESI] , AH loop_start_2616: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2616 loop_start_2617: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2617 ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2617 loop_end_2617: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; LEFT SUB ESI , 9 loop_start_2640: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2640 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2640 loop_end_2640: ; RIGHT ADD ESI , 9 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2616 loop_end_2616: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH loop_start_2647: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2647 ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2647 loop_end_2647: ; LEFT SUB ESI , 9 loop_start_2653: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2653 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2653 loop_end_2653: ; RIGHT ADD ESI , 9 loop_start_2657: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2657 ; RIGHT ADD ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 loop_start_2661: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2661 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2661 loop_end_2661: ; LEFT SUB ESI , 4 loop_start_2668: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2668 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 5 loop_start_2673: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2673 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 loop_start_2676: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2676 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2676 loop_end_2676: ; LEFT SUB ESI , 2 loop_start_2683: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2683 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2683 loop_end_2683: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2673 loop_end_2673: ; LEFT SUB ESI , 8 loop_start_2695: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2695 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2695 loop_end_2695: mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2668 loop_end_2668: ; RIGHT ADD ESI , 9 loop_start_2700: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2700 ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2700 loop_end_2700: ; LEFT SUB ESI , 9 loop_start_2704: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2704 ; RIGHT ADD ESI , 1 loop_start_2706: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2706 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 9 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2706 loop_end_2706: ; LEFT SUB ESI , 10 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2704 loop_end_2704: ; RIGHT ADD ESI , 1 loop_start_2715: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2715 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 9 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2715 loop_end_2715: ; LEFT SUB ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2657 loop_end_2657: ; LEFT SUB ESI , 9 loop_start_2726: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2726 ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 loop_start_2732: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2732 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 loop_start_2737: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2737 ; LEFT SUB ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 6 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 6 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2737 loop_end_2737: ; LEFT SUB ESI , 1 loop_start_2747: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2747 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2747 loop_end_2747: ; RIGHT ADD ESI , 4 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2732 loop_end_2732: ; LEFT SUB ESI , 3 loop_start_2756: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2756 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2756 loop_end_2756: ; LEFT SUB ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2726 loop_end_2726: ; RIGHT ADD ESI , 9 loop_start_2767: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2767 ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2767 loop_end_2767: ; LEFT SUB ESI , 9 loop_start_2773: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2773 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2773 loop_end_2773: ; RIGHT ADD ESI , 9 loop_start_2777: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2777 ; RIGHT ADD ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 loop_start_2781: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2781 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 5 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2781 loop_end_2781: ; LEFT SUB ESI , 5 loop_start_2788: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2788 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 6 loop_start_2793: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2793 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 loop_start_2796: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2796 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2796 loop_end_2796: ; LEFT SUB ESI , 3 loop_start_2803: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2803 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2803 loop_end_2803: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2793 loop_end_2793: ; LEFT SUB ESI , 8 loop_start_2815: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2815 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2815 loop_end_2815: mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2788 loop_end_2788: ; RIGHT ADD ESI , 9 loop_start_2820: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2820 ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2820 loop_end_2820: ; LEFT SUB ESI , 9 loop_start_2824: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2824 ; RIGHT ADD ESI , 2 loop_start_2826: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2826 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 9 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2826 loop_end_2826: ; LEFT SUB ESI , 11 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2824 loop_end_2824: ; RIGHT ADD ESI , 2 loop_start_2835: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2835 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 9 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2835 loop_end_2835: ; LEFT SUB ESI , 2 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2777 loop_end_2777: ; LEFT SUB ESI , 9 loop_start_2846: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2846 ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 loop_start_2852: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2852 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 loop_start_2857: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2857 ; LEFT SUB ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 6 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 6 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2857 loop_end_2857: ; LEFT SUB ESI , 1 loop_start_2867: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2867 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2867 loop_end_2867: ; RIGHT ADD ESI , 4 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2852 loop_end_2852: ; LEFT SUB ESI , 3 loop_start_2876: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2876 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2876 loop_end_2876: ; LEFT SUB ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2846 loop_end_2846: ; RIGHT ADD ESI , 9 loop_start_2887: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2887 ; RIGHT ADD ESI , 4 loop_start_2889: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2889 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 36 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 36 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2889 loop_end_2889: ; RIGHT ADD ESI , 5 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2887 loop_end_2887: ; LEFT SUB ESI , 9 loop_start_2898: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2898 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2898 loop_end_2898: ; RIGHT ADD ESI , 9 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 15 mov [buffer + ESI] , AH loop_start_2903: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2903 loop_start_2904: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2904 ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2904 loop_end_2904: ; LEFT SUB ESI , 9 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 9 loop_start_2910: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2910 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2910 loop_end_2910: ; RIGHT ADD ESI , 9 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2903 loop_end_2903: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 21 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 loop_start_2920: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2920 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2920 loop_end_2920: ; RIGHT ADD ESI , 9 loop_start_2924: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2924 ; RIGHT ADD ESI , 3 loop_start_2926: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2926 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2926 loop_end_2926: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 loop_start_2934: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2934 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 loop_start_2939: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2939 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2939 loop_end_2939: ; LEFT SUB ESI , 4 loop_start_2946: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2946 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 13 loop_start_2951: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2951 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2951 loop_end_2951: ; RIGHT ADD ESI , 4 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 loop_start_2958: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2958 ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2958 loop_end_2958: ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2946 loop_end_2946: mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2934 loop_end_2934: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 loop_start_2968: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2968 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2968 loop_end_2968: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 loop_start_2976: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2976 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 loop_start_2981: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2981 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2981 loop_end_2981: ; LEFT SUB ESI , 3 loop_start_2988: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2988 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 12 loop_start_2993: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2993 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2993 loop_end_2993: ; RIGHT ADD ESI , 3 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 6 loop_start_3000: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3000 ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3000 loop_end_3000: ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2988 loop_end_2988: mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2976 loop_end_2976: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 loop_start_3011: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3011 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 loop_start_3014: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3014 ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3014 loop_end_3014: ; LEFT SUB ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3011 loop_end_3011: ; RIGHT ADD ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2924 loop_end_2924: ; LEFT SUB ESI , 9 loop_start_3022: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3022 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3022 loop_end_3022: ; RIGHT ADD ESI , 2 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 loop_start_3028: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3028 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3028 loop_end_3028: ; LEFT SUB ESI , 4 loop_start_3035: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3035 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3035 loop_end_3035: ; RIGHT ADD ESI , 2 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_622 loop_end_622: ; LEFT SUB ESI , 2 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 loop_start_3048: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3048 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3048 loop_end_3048: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 loop_start_3056: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3056 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 6 ; PRINT TO STDOUT mov AH , [buffer + ESI] mov [value] , AH mov EAX , 4 mov EBX , 1 mov ECX , value mov EDX , 1 int 0x80 ; RIGHT ADD ESI , 2 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3056 loop_end_3056: ; RIGHT ADD ESI , 4 loop_start_3065: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3065 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 7 ; PRINT TO STDOUT mov AH , [buffer + ESI] mov [value] , AH mov EAX , 4 mov EBX , 1 mov ECX , value mov EDX , 1 int 0x80 ; RIGHT ADD ESI , 7 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3065 loop_end_3065: ; LEFT SUB ESI , 3 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 loop_start_3084: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3084 ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3084 loop_end_3084: ; LEFT SUB ESI , 9 loop_start_3100: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3100 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3100 loop_end_3100: ; RIGHT ADD ESI , 9 loop_start_3104: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3104 ; RIGHT ADD ESI , 5 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3104 loop_end_3104: ; LEFT SUB ESI , 9 loop_start_3110: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3110 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3110 loop_end_3110: ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 11 mov [buffer + ESI] , AH loop_start_3115: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3115 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH loop_start_3117: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3117 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 9 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3117 loop_end_3117: ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3115 loop_end_3115: ; RIGHT ADD ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 9 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 14 loop_start_3130: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3130 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3130 loop_end_3130: ; RIGHT ADD ESI , 7 loop_start_3134: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3134 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 7 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 7 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3134 loop_end_3134: ; LEFT SUB ESI , 7 loop_start_3141: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3141 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 7 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 loop_start_3147: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3147 ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3147 loop_end_3147: ; LEFT SUB ESI , 9 loop_start_3151: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3151 ; RIGHT ADD ESI , 7 loop_start_3153: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3153 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 6 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 6 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3153 loop_end_3153: ; LEFT SUB ESI , 6 loop_start_3160: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3160 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 6 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 7 loop_start_3165: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3165 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3165 loop_end_3165: ; RIGHT ADD ESI , 7 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3160 loop_end_3160: ; LEFT SUB ESI , 10 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3151 loop_end_3151: mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3141 loop_end_3141: ; RIGHT ADD ESI , 7 loop_start_3177: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3177 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 7 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 7 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3177 loop_end_3177: ; LEFT SUB ESI , 7 loop_start_3184: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3184 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 7 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 loop_start_3189: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3189 ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 loop_start_3193: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3193 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3193 loop_end_3193: ; LEFT SUB ESI , 4 loop_start_3200: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3200 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3200 loop_end_3200: ; RIGHT ADD ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3189 loop_end_3189: ; LEFT SUB ESI , 2 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 7 loop_start_3211: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3211 ; RIGHT ADD ESI , 5 loop_start_3213: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3213 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3213 loop_end_3213: ; LEFT SUB ESI , 14 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3211 loop_end_3211: ; RIGHT ADD ESI , 9 loop_start_3222: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3222 ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3222 loop_end_3222: ; LEFT SUB ESI , 9 loop_start_3226: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3226 ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 7 loop_start_3232: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3232 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 7 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 loop_start_3237: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3237 ; LEFT SUB ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3237 loop_end_3237: ; LEFT SUB ESI , 1 loop_start_3247: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3247 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3247 loop_end_3247: ; RIGHT ADD ESI , 7 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3232 loop_end_3232: ; LEFT SUB ESI , 6 loop_start_3256: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3256 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 6 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 6 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3256 loop_end_3256: ; LEFT SUB ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3226 loop_end_3226: ; RIGHT ADD ESI , 7 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3184 loop_end_3184: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 7 loop_start_3275: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3275 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 7 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 7 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3275 loop_end_3275: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 7 loop_start_3283: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3283 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 7 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 loop_start_3288: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3288 ; RIGHT ADD ESI , 5 loop_start_3290: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3290 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3290 loop_end_3290: ; RIGHT ADD ESI , 4 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3288 loop_end_3288: ; LEFT SUB ESI , 9 loop_start_3299: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3299 ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 7 loop_start_3305: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3305 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 7 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 loop_start_3310: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3310 ; LEFT SUB ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3310 loop_end_3310: ; LEFT SUB ESI , 1 loop_start_3320: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3320 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3320 loop_end_3320: ; RIGHT ADD ESI , 7 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3305 loop_end_3305: ; LEFT SUB ESI , 6 loop_start_3329: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3329 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 6 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 6 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3329 loop_end_3329: ; LEFT SUB ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3299 loop_end_3299: ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 5 mov [buffer + ESI] , AH loop_start_3341: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3341 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH loop_start_3343: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3343 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 9 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3343 loop_end_3343: ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3341 loop_end_3341: ; RIGHT ADD ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 5 loop_start_3354: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3354 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3354 loop_end_3354: ; RIGHT ADD ESI , 9 loop_start_3358: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3358 ; RIGHT ADD ESI , 5 loop_start_3360: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3360 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 5 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3360 loop_end_3360: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 5 loop_start_3368: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3368 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 loop_start_3373: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3373 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 7 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 7 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3373 loop_end_3373: ; LEFT SUB ESI , 7 loop_start_3380: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3380 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 7 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 16 loop_start_3385: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3385 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3385 loop_end_3385: ; RIGHT ADD ESI , 4 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 loop_start_3392: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3392 ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3392 loop_end_3392: ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3380 loop_end_3380: mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3368 loop_end_3368: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 7 loop_start_3402: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3402 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 7 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 7 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3402 loop_end_3402: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 7 loop_start_3410: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3410 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 7 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 loop_start_3415: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3415 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 5 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3415 loop_end_3415: ; LEFT SUB ESI , 5 loop_start_3422: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3422 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 14 loop_start_3427: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3427 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3427 loop_end_3427: ; RIGHT ADD ESI , 3 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 6 loop_start_3434: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3434 ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3434 loop_end_3434: ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3422 loop_end_3422: mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3410 loop_end_3410: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 loop_start_3445: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3445 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 loop_start_3448: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3448 ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3448 loop_end_3448: ; LEFT SUB ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3445 loop_end_3445: ; RIGHT ADD ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3358 loop_end_3358: ; LEFT SUB ESI , 9 loop_start_3456: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3456 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3456 loop_end_3456: ; RIGHT ADD ESI , 4 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 5 mov [buffer + ESI] , AH loop_start_3463: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3463 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH loop_start_3465: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3465 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 9 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3465 loop_end_3465: ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3463 loop_end_3463: ; RIGHT ADD ESI , 4 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 5 loop_start_3476: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3476 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3476 loop_end_3476: mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3283 loop_end_3283: ; RIGHT ADD ESI , 3 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_113 loop_end_113: ; LEFT SUB ESI , 4 ; PRINT TO STDOUT mov AH , [buffer + ESI] mov [value] , AH mov EAX , 4 mov EBX , 1 mov ECX , value mov EDX , 1 int 0x80 ; RIGHT ADD ESI , 10 loop_start_3485: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3485 ; RIGHT ADD ESI , 6 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3485 loop_end_3485: ; LEFT SUB ESI , 9 loop_start_3491: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3491 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3491 loop_end_3491: ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 10 mov [buffer + ESI] , AH loop_start_3496: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3496 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH loop_start_3498: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3498 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 9 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3498 loop_end_3498: ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3496 loop_end_3496: ; RIGHT ADD ESI , 5 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 9 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 15 loop_start_3511: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3511 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3511 loop_end_3511: ; RIGHT ADD ESI , 8 loop_start_3515: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3515 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 8 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3515 loop_end_3515: ; LEFT SUB ESI , 8 loop_start_3522: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3522 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 8 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 loop_start_3528: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3528 ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3528 loop_end_3528: ; LEFT SUB ESI , 9 loop_start_3532: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3532 ; RIGHT ADD ESI , 8 loop_start_3534: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3534 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 7 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 7 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3534 loop_end_3534: ; LEFT SUB ESI , 7 loop_start_3541: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3541 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 7 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 8 loop_start_3546: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3546 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3546 loop_end_3546: ; RIGHT ADD ESI , 8 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3541 loop_end_3541: ; LEFT SUB ESI , 10 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3532 loop_end_3532: mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3522 loop_end_3522: ; RIGHT ADD ESI , 8 loop_start_3558: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3558 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 8 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3558 loop_end_3558: ; LEFT SUB ESI , 8 loop_start_3565: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3565 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 8 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 loop_start_3570: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3570 ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 loop_start_3574: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3574 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 5 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3574 loop_end_3574: ; LEFT SUB ESI , 5 loop_start_3581: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3581 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 5 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3581 loop_end_3581: ; RIGHT ADD ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3570 loop_end_3570: ; LEFT SUB ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 8 loop_start_3592: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3592 ; RIGHT ADD ESI , 6 loop_start_3594: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3594 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3594 loop_end_3594: ; LEFT SUB ESI , 15 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3592 loop_end_3592: ; RIGHT ADD ESI , 9 loop_start_3603: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3603 ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3603 loop_end_3603: ; LEFT SUB ESI , 9 loop_start_3607: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3607 ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 8 loop_start_3613: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3613 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 8 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 loop_start_3618: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3618 ; LEFT SUB ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3618 loop_end_3618: ; LEFT SUB ESI , 1 loop_start_3628: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3628 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3628 loop_end_3628: ; RIGHT ADD ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3613 loop_end_3613: ; LEFT SUB ESI , 7 loop_start_3637: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3637 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 7 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 7 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3637 loop_end_3637: ; LEFT SUB ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3607 loop_end_3607: ; RIGHT ADD ESI , 8 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 5 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3565 loop_end_3565: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 8 loop_start_3656: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3656 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 8 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3656 loop_end_3656: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 8 loop_start_3664: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3664 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 8 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 loop_start_3669: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3669 ; RIGHT ADD ESI , 6 loop_start_3671: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3671 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3671 loop_end_3671: ; RIGHT ADD ESI , 3 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3669 loop_end_3669: ; LEFT SUB ESI , 9 loop_start_3680: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3680 ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 8 loop_start_3686: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3686 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 8 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 loop_start_3691: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3691 ; LEFT SUB ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3691 loop_end_3691: ; LEFT SUB ESI , 1 loop_start_3701: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3701 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3701 loop_end_3701: ; RIGHT ADD ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3686 loop_end_3686: ; LEFT SUB ESI , 7 loop_start_3710: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3710 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 7 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 7 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3710 loop_end_3710: ; LEFT SUB ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3680 loop_end_3680: ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 5 mov [buffer + ESI] , AH loop_start_3722: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3722 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH loop_start_3724: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3724 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 9 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3724 loop_end_3724: ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3722 loop_end_3722: ; RIGHT ADD ESI , 5 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 27 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 6 loop_start_3737: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3737 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3737 loop_end_3737: ; RIGHT ADD ESI , 9 loop_start_3741: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3741 ; RIGHT ADD ESI , 6 loop_start_3743: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3743 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 6 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 6 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3743 loop_end_3743: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 6 loop_start_3751: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3751 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 6 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 loop_start_3756: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3756 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 8 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3756 loop_end_3756: ; LEFT SUB ESI , 8 loop_start_3763: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3763 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 8 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 17 loop_start_3768: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3768 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3768 loop_end_3768: ; RIGHT ADD ESI , 4 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 loop_start_3775: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3775 ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3775 loop_end_3775: ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3763 loop_end_3763: mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3751 loop_end_3751: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 8 loop_start_3785: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3785 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 8 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3785 loop_end_3785: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 8 loop_start_3793: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3793 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 8 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 loop_start_3798: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3798 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 6 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 6 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3798 loop_end_3798: ; LEFT SUB ESI , 6 loop_start_3805: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3805 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 6 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 15 loop_start_3810: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3810 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3810 loop_end_3810: ; RIGHT ADD ESI , 3 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 6 loop_start_3817: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3817 ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3817 loop_end_3817: ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3805 loop_end_3805: mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3793 loop_end_3793: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 loop_start_3828: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3828 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 loop_start_3831: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3831 ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3831 loop_end_3831: ; LEFT SUB ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3828 loop_end_3828: ; RIGHT ADD ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3741 loop_end_3741: ; LEFT SUB ESI , 9 loop_start_3839: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3839 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3839 loop_end_3839: ; RIGHT ADD ESI , 4 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 5 mov [buffer + ESI] , AH loop_start_3846: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3846 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH loop_start_3848: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3848 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 9 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3848 loop_end_3848: ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3846 loop_end_3846: ; RIGHT ADD ESI , 5 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 27 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 6 loop_start_3861: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3861 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3861 loop_end_3861: mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3664 loop_end_3664: ; RIGHT ADD ESI , 3 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_66 loop_end_66: ;exit mov EAX , 1 int 0x80 ;exit
// See the file "COPYING" in the main distribution directory for copyright. #include "zeek/packet_analysis/protocol/udp/UDP.h" #include "zeek/RunState.h" #include "zeek/Conn.h" #include "zeek/session/Manager.h" #include "zeek/analyzer/Manager.h" #include "zeek/analyzer/protocol/pia/PIA.h" #include "zeek/analyzer/protocol/conn-size/ConnSize.h" #include "zeek/packet_analysis/protocol/udp/events.bif.h" using namespace zeek::packet_analysis::UDP; using namespace zeek::packet_analysis::IP; constexpr uint32_t HIST_ORIG_DATA_PKT = 0x1; constexpr uint32_t HIST_RESP_DATA_PKT = 0x2; constexpr uint32_t HIST_ORIG_CORRUPT_PKT = 0x4; constexpr uint32_t HIST_RESP_CORRUPT_PKT = 0x8; enum UDP_EndpointState { UDP_INACTIVE, // no packet seen UDP_ACTIVE, // packets seen }; UDPAnalyzer::UDPAnalyzer() : IPBasedAnalyzer("UDP", TRANSPORT_UDP, UDP_PORT_MASK, false) { // TODO: remove once the other plugins are done new_plugin = true; } UDPAnalyzer::~UDPAnalyzer() { } SessionAdapter* UDPAnalyzer::MakeSessionAdapter(Connection* conn) { auto* root = new UDPSessionAdapter(conn); root->SetParent(this); conn->EnableStatusUpdateTimer(); conn->SetInactivityTimeout(zeek::detail::udp_inactivity_timeout); return root; } zeek::analyzer::pia::PIA* UDPAnalyzer::MakePIA(Connection* conn) { return new analyzer::pia::PIA_UDP(conn); } void UDPAnalyzer::Initialize() { IPBasedAnalyzer::Initialize(); const auto& id = detail::global_scope()->Find("Tunnel::vxlan_ports"); if ( ! (id && id->GetVal()) ) reporter->FatalError("Tunnel::vxlan_ports not defined"); auto table_val = id->GetVal()->AsTableVal(); auto port_list = table_val->ToPureListVal(); for ( auto i = 0; i < port_list->Length(); ++i ) vxlan_ports.emplace_back(port_list->Idx(i)->AsPortVal()->Port()); } bool UDPAnalyzer::WantConnection(uint16_t src_port, uint16_t dst_port, const u_char* data, bool& flip_roles) const { flip_roles = IsLikelyServerPort(src_port) && ! IsLikelyServerPort(dst_port); return true; } bool UDPAnalyzer::BuildConnTuple(size_t len, const uint8_t* data, Packet* packet, ConnTuple& tuple) { uint32_t min_hdr_len = sizeof(struct udphdr); if ( ! CheckHeaderTrunc(min_hdr_len, len, packet) ) return false; tuple.src_addr = packet->ip_hdr->SrcAddr(); tuple.dst_addr = packet->ip_hdr->DstAddr(); const struct udphdr* up = (const struct udphdr *) packet->ip_hdr->Payload(); tuple.src_port = up->uh_sport; tuple.dst_port = up->uh_dport; tuple.is_one_way = false; tuple.proto = TRANSPORT_UDP; return true; } void UDPAnalyzer::DeliverPacket(Connection* c, double t, bool is_orig, int remaining, Packet* pkt) { auto* adapter = static_cast<UDPSessionAdapter*>(c->GetSessionAdapter()); const u_char* data = pkt->ip_hdr->Payload(); int len = pkt->ip_hdr->PayloadLen(); const struct udphdr* up = (const struct udphdr*) data; const std::unique_ptr<IP_Hdr>& ip = pkt->ip_hdr; adapter->DeliverPacket(len, data, is_orig, -1, ip.get(), remaining); // Increment data before checksum check so that data will // point to UDP payload even if checksum fails. Particularly, // it allows event packet_contents to get to the data. data += sizeof(struct udphdr); // We need the min() here because Ethernet frame padding can lead to // remaining > len. if ( packet_contents ) adapter->PacketContents(data, std::min(len, remaining) - sizeof(struct udphdr)); int chksum = up->uh_sum; auto validate_checksum = ! run_state::current_pkt->l3_checksummed && ! zeek::detail::ignore_checksums && ! zeek::id::find_val<TableVal>("ignore_checksums_nets")->Contains(ip->IPHeaderSrcAddr()) && remaining >=len; constexpr auto vxlan_len = 8; constexpr auto eth_len = 14; if ( validate_checksum && len > ((int)sizeof(struct udphdr) + vxlan_len + eth_len) && (data[0] & 0x08) == 0x08 ) { if ( std::find(vxlan_ports.begin(), vxlan_ports.end(), ntohs(up->uh_dport)) != vxlan_ports.end() ) { // Looks like VXLAN on a well-known port, so the checksum should be // transmitted as zero, and we should accept that. If not // transmitted as zero, then validating the checksum is optional. if ( chksum == 0 ) validate_checksum = false; else validate_checksum = BifConst::Tunnel::validate_vxlan_checksums; } } if ( validate_checksum ) { bool bad = false; if ( ip->IP4_Hdr() ) { if ( chksum && ! ValidateChecksum(ip.get(), up, len) ) bad = true; } /* checksum is not optional for IPv6 */ else if ( ! ValidateChecksum(ip.get(), up, len) ) bad = true; if ( bad ) { adapter->HandleBadChecksum(is_orig); return; } } int ulen = ntohs(up->uh_ulen); if ( ulen != len ) adapter->Weird("UDP_datagram_length_mismatch", util::fmt("%d != %d", ulen, len)); len -= sizeof(struct udphdr); ulen -= sizeof(struct udphdr); remaining -= sizeof(struct udphdr); c->SetLastTime(run_state::current_timestamp); if ( udp_contents ) { static auto udp_content_ports = id::find_val<TableVal>("udp_content_ports"); static auto udp_content_delivery_ports_orig = id::find_val<TableVal>("udp_content_delivery_ports_orig"); static auto udp_content_delivery_ports_resp = id::find_val<TableVal>("udp_content_delivery_ports_resp"); bool do_udp_contents = false; const auto& sport_val = val_mgr->Port(ntohs(up->uh_sport), TRANSPORT_UDP); const auto& dport_val = val_mgr->Port(ntohs(up->uh_dport), TRANSPORT_UDP); if ( udp_content_ports->FindOrDefault(dport_val) || udp_content_ports->FindOrDefault(sport_val) ) do_udp_contents = true; else { uint16_t p = zeek::detail::udp_content_delivery_ports_use_resp ? c->RespPort() : up->uh_dport; const auto& port_val = zeek::val_mgr->Port(ntohs(p), TRANSPORT_UDP); if ( is_orig ) { auto result = udp_content_delivery_ports_orig->FindOrDefault(port_val); if ( zeek::detail::udp_content_deliver_all_orig || (result && result->AsBool()) ) do_udp_contents = true; } else { auto result = udp_content_delivery_ports_resp->FindOrDefault(port_val); if ( zeek::detail::udp_content_deliver_all_resp || (result && result->AsBool()) ) do_udp_contents = true; } } if ( do_udp_contents ) adapter->EnqueueConnEvent(udp_contents, adapter->ConnVal(), val_mgr->Bool(is_orig), make_intrusive<StringVal>(len, (const char*) data)); } if ( is_orig ) { c->CheckHistory(HIST_ORIG_DATA_PKT, 'D'); adapter->UpdateLength(is_orig, ulen); adapter->Event(udp_request); } else { c->CheckHistory(HIST_RESP_DATA_PKT, 'd'); adapter->UpdateLength(is_orig, ulen); adapter->Event(udp_reply); } // Send the packet back into the packet analysis framework. ForwardPacket(len, data, pkt); // Also try sending it into session analysis. if ( remaining >= len ) adapter->ForwardPacket(len, data, is_orig, -1, ip.get(), remaining); } bool UDPAnalyzer::ValidateChecksum(const IP_Hdr* ip, const udphdr* up, int len) { auto sum = detail::ip_in_cksum(ip->IP4_Hdr(), ip->SrcAddr(), ip->DstAddr(), IPPROTO_UDP, reinterpret_cast<const uint8_t*>(up), len); return sum == 0xffff; } void UDPSessionAdapter::AddExtraAnalyzers(Connection* conn) { static analyzer::Tag analyzer_connsize = analyzer_mgr->GetComponentTag("CONNSIZE"); if ( analyzer_mgr->IsEnabled(analyzer_connsize) ) // Add ConnSize analyzer. Needs to see packets, not stream. AddChildAnalyzer(new analyzer::conn_size::ConnSize_Analyzer(conn)); } void UDPSessionAdapter::UpdateConnVal(RecordVal* conn_val) { auto orig_endp = conn_val->GetField("orig"); auto resp_endp = conn_val->GetField("resp"); UpdateEndpointVal(orig_endp, true); UpdateEndpointVal(resp_endp, false); // Call children's UpdateConnVal Analyzer::UpdateConnVal(conn_val); } void UDPSessionAdapter::UpdateEndpointVal(const ValPtr& endp_arg, bool is_orig) { bro_int_t size = is_orig ? request_len : reply_len; auto endp = endp_arg->AsRecordVal(); if ( size < 0 ) { endp->Assign(0, val_mgr->Count(0)); endp->Assign(1, UDP_INACTIVE); } else { endp->Assign(0, static_cast<uint64_t>(size)); endp->Assign(1, UDP_ACTIVE); } } void UDPSessionAdapter::UpdateLength(bool is_orig, int len) { if ( is_orig ) { if ( request_len < 0 ) request_len = len; else { request_len += len; #ifdef DEBUG if ( request_len < 0 ) reporter->Warning("wrapping around for UDP request length"); #endif } } else { if ( reply_len < 0 ) reply_len = len; else { reply_len += len; #ifdef DEBUG if ( reply_len < 0 ) reporter->Warning("wrapping around for UDP reply length"); #endif } } } void UDPSessionAdapter::HandleBadChecksum(bool is_orig) { Weird("bad_UDP_checksum"); if ( is_orig ) { uint32_t t = req_chk_thresh; if ( Conn()->ScaledHistoryEntry('C', req_chk_cnt, req_chk_thresh) ) ChecksumEvent(is_orig, t); } else { uint32_t t = rep_chk_thresh; if ( Conn()->ScaledHistoryEntry('c', rep_chk_cnt, rep_chk_thresh) ) ChecksumEvent(is_orig, t); } } void UDPSessionAdapter::ChecksumEvent(bool is_orig, uint32_t threshold) { Conn()->HistoryThresholdEvent(udp_multiple_checksum_errors, is_orig, threshold); }
; A010720: Period 2: repeat (5,9). ; 5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5 mod $0,2 pow $1,$0 gcd $1,5 add $1,4
; SPIR-V ; Version: 1.0 ; Generator: Khronos Glslang Reference Front End; 10 ; Bound: 105 ; Schema: 0 OpCapability Shader %1 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 OpEntryPoint Fragment %4 "main" %86 OpExecutionMode %4 OriginUpperLeft OpSource ESSL 320 OpName %4 "main" OpName %11 "arr" OpName %14 "buf0" OpMemberName %14 0 "_GLF_uniform_int_values" OpName %16 "" OpName %43 "i" OpName %59 "a" OpName %86 "_GLF_color" OpDecorate %13 ArrayStride 16 OpMemberDecorate %14 0 Offset 0 OpDecorate %14 Block OpDecorate %16 DescriptorSet 0 OpDecorate %16 Binding 0 OpDecorate %86 Location 0 %2 = OpTypeVoid %3 = OpTypeFunction %2 %6 = OpTypeInt 32 1 %7 = OpTypeInt 32 0 %8 = OpConstant %7 10 %9 = OpTypeArray %6 %8 %10 = OpTypePointer Function %9 %12 = OpConstant %7 5 %13 = OpTypeArray %6 %12 %14 = OpTypeStruct %13 %15 = OpTypePointer Uniform %14 %16 = OpVariable %15 Uniform %17 = OpConstant %6 0 %18 = OpConstant %6 3 %19 = OpTypePointer Uniform %6 %22 = OpConstant %6 4 %42 = OpTypePointer Function %6 %44 = OpConstant %6 2 %57 = OpTypeBool %61 = OpConstant %6 1 %83 = OpTypeFloat 32 %84 = OpTypeVector %83 4 %85 = OpTypePointer Output %84 %86 = OpVariable %85 Output %4 = OpFunction %2 None %3 %5 = OpLabel %11 = OpVariable %10 Function %43 = OpVariable %42 Function %59 = OpVariable %42 Function %20 = OpAccessChain %19 %16 %17 %18 %21 = OpLoad %6 %20 %23 = OpAccessChain %19 %16 %17 %22 %24 = OpLoad %6 %23 %25 = OpAccessChain %19 %16 %17 %18 %26 = OpLoad %6 %25 %27 = OpAccessChain %19 %16 %17 %18 %28 = OpLoad %6 %27 %29 = OpAccessChain %19 %16 %17 %18 %30 = OpLoad %6 %29 %31 = OpAccessChain %19 %16 %17 %18 %32 = OpLoad %6 %31 %33 = OpAccessChain %19 %16 %17 %18 %34 = OpLoad %6 %33 %35 = OpAccessChain %19 %16 %17 %18 %36 = OpLoad %6 %35 %37 = OpAccessChain %19 %16 %17 %18 %38 = OpLoad %6 %37 %39 = OpAccessChain %19 %16 %17 %18 %40 = OpLoad %6 %39 %41 = OpCompositeConstruct %9 %21 %24 %26 %28 %30 %32 %34 %36 %38 %40 OpStore %11 %41 %45 = OpAccessChain %19 %16 %17 %44 %46 = OpLoad %6 %45 OpStore %43 %46 %47 = OpAccessChain %19 %16 %17 %18 %48 = OpLoad %6 %47 OpStore %43 %48 OpBranch %49 %49 = OpLabel OpLoopMerge %51 %52 None OpBranch %53 %53 = OpLabel %54 = OpLoad %6 %43 %55 = OpAccessChain %19 %16 %17 %17 %56 = OpLoad %6 %55 %58 = OpSLessThan %57 %54 %56 OpBranchConditional %58 %50 %51 %50 = OpLabel %60 = OpLoad %6 %43 %62 = OpIAdd %6 %60 %61 OpStore %59 %62 OpBranch %63 %63 = OpLabel OpLoopMerge %65 %66 None OpBranch %67 %67 = OpLabel %68 = OpLoad %6 %43 %69 = OpLoad %6 %59 %70 = OpSLessThan %57 %68 %69 OpBranchConditional %70 %64 %65 %64 = OpLabel %71 = OpAccessChain %19 %16 %17 %18 %72 = OpLoad %6 %71 %73 = OpAccessChain %42 %11 %72 %74 = OpLoad %6 %73 OpStore %43 %74 OpBranch %66 %66 = OpLabel OpBranch %63 %65 = OpLabel OpBranch %52 %52 = OpLabel %75 = OpLoad %6 %43 %76 = OpIAdd %6 %75 %61 OpStore %43 %76 OpBranch %49 %51 = OpLabel %77 = OpLoad %6 %43 %78 = OpAccessChain %19 %16 %17 %61 %79 = OpLoad %6 %78 %80 = OpIEqual %57 %77 %79 OpSelectionMerge %82 None OpBranchConditional %80 %81 %100 %81 = OpLabel %87 = OpAccessChain %19 %16 %17 %18 %88 = OpLoad %6 %87 %89 = OpConvertSToF %83 %88 %90 = OpAccessChain %19 %16 %17 %44 %91 = OpLoad %6 %90 %92 = OpConvertSToF %83 %91 %93 = OpAccessChain %19 %16 %17 %44 %94 = OpLoad %6 %93 %95 = OpConvertSToF %83 %94 %96 = OpAccessChain %19 %16 %17 %18 %97 = OpLoad %6 %96 %98 = OpConvertSToF %83 %97 %99 = OpCompositeConstruct %84 %89 %92 %95 %98 OpStore %86 %99 OpBranch %82 %100 = OpLabel %101 = OpAccessChain %19 %16 %17 %44 %102 = OpLoad %6 %101 %103 = OpConvertSToF %83 %102 %104 = OpCompositeConstruct %84 %103 %103 %103 %103 OpStore %86 %104 OpBranch %82 %82 = OpLabel OpReturn OpFunctionEnd
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Copyright (c) GeoWorks 1992 -- All Rights Reserved PROJECT: PC GEOS MODULE: FILE: nontsStrings.asm AUTHOR: Adam de Boor, May 9, 1992 ROUTINES: Name Description ---- ----------- REVISION HISTORY: Name Date Description ---- ---- ----------- Adam 5/ 9/92 Initial revision DESCRIPTION: String-data for the driver. $Id: nontsStrings.asm,v 1.2 98/02/23 20:17:56 gene Exp $ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ NTSDriverInfoSegment segment lmem LMEM_TYPE_GENERAL NTSDriverExtInfo DriverExtendedInfoTable < {}, ; lmem header added by Esp length ntsNameTable, ; number of supported "devices" offset ntsNameTable, ; names of supported "devices" offset ntsInfoTable > ntsNameTable lptr.char ntsName lptr.char 0 ; terminate table LocalDefString ntsName <"No Task-Switcher", 0> ntsInfoTable word 0 ; ntsName NTSDriverInfoSegment ends NTSStrings segment lmem LMEM_TYPE_GENERAL ; ; Name of the environment variable holding the command prompt string. ; (SBCS, used to search DOS environment string) ; promptVariable chunk.char 'PROMPT=' ; ; String to stick before any existing prompt when invoking DosExec ; (DBCS, will be converted to DOS and copied into environment string) ; if DBCS_PCGEOS promptMessage chunk.wchar 'Type "exit" to return to \1.$_', 0 else promptMessage chunk.char 'Type "exit" to return to \1.$_', 0 endif ; ; Default DOS prompt if no PROMPT variable in the environment. Appended to ; promptMessage ; (SBCS, to copy into environment string w/o conversion to DOS) ; defaultPrompt chunk.char '$n$g', 0 ; ; Default product name, in the absence of a .ini file preferences. ; LocalDefString defaultProduct <'Ensemble',0> ; ; Resident strings (null-terminated for NTSSizeWithProductName and ; NTSCopyWithProductName) ; if DBCS_PCGEOS DE_execError chunk.wchar \ "\r\nUnable to run DOS program (Error Code: DE-01)\r\n$", 0 else DE_execError chunk.char \ "\r\nUnable to run DOS program (Error Code: DE-01)\r\n$", 0 endif if DBCS_PCGEOS DE_prompt chunk.wchar \ "\r\nPress ENTER to return to \1, or ESC to exit to DOS.\r\n$", 0 else DE_prompt chunk.char \ "\r\nPress ENTER to return to \1, or ESC to exit to DOS.\r\n$", 0 endif if DBCS_PCGEOS DE_failedReload chunk.wchar \ "\r\nCould not find the loader file. You may need to restart your computer. (Error Code DE-02)\r\n$", 0 else DE_failedReload chunk.char \ "\r\nCould not find the loader file. You may need to restart your computer. (Error Code DE-02)\r\n$", 0 endif if DBCS_PCGEOS noMemError chunk.wchar \ "\r\nNot enough DOS memory to reload \1. A DOS program may not\r\n", "have released all the memory it used. (Error Code: DE-03)\r\n$", 0 else noMemError chunk.char \ "\r\nNot enough DOS memory to reload \1. A DOS program may not\r\n", "have released all the memory it used. (Error Code: DE-03)\r\n$", 0 endif NTSStrings ends
// Copyright (c) 2007-2021 Hartmut Kaiser // Copyright (c) 2014-2015 Agustin Berge // // SPDX-License-Identifier: BSL-1.0 // 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) #pragma once #include <pika/local/config.hpp> #include <pika/allocator_support/allocator_deleter.hpp> #include <pika/allocator_support/internal_allocator.hpp> #include <pika/async_base/launch_policy.hpp> #include <pika/errors/try_catch_exception_ptr.hpp> #include <pika/futures/detail/future_data.hpp> #include <pika/futures/traits/acquire_shared_state.hpp> #include <pika/futures/traits/future_access.hpp> #include <pika/futures/traits/future_traits.hpp> #include <pika/modules/errors.hpp> #include <pika/modules/memory.hpp> #include <pika/threading_base/annotated_function.hpp> #include <pika/threading_base/thread_description.hpp> #include <exception> #include <functional> #include <memory> #include <mutex> #include <type_traits> #include <utility> /////////////////////////////////////////////////////////////////////////////// namespace pika { namespace lcos { namespace detail { template <typename Future, typename SourceState, typename DestinationState> PIKA_FORCEINLINE void transfer_result( SourceState&& src, DestinationState const& dest) { pika::detail::try_catch_exception_ptr( [&]() { traits::future_access<Future>::transfer_result( traits::future_access<Future>::create( PIKA_FORWARD(SourceState, src)), *dest); }, [&](std::exception_ptr ep) { (*dest).set_exception(PIKA_MOVE(ep)); }); } template <typename Func, typename Future, typename Continuation> void invoke_continuation_nounwrap( Func& func, Future&& future, Continuation& cont, std::false_type) { pika::intrusive_ptr<Continuation> keep_alive(&cont); pika::detail::try_catch_exception_ptr( [&]() { cont.set_value(func(PIKA_FORWARD(Future, future))); }, [&](std::exception_ptr ep) { cont.set_exception(PIKA_MOVE(ep)); }); } template <typename Func, typename Future, typename Continuation> void invoke_continuation_nounwrap( Func& func, Future&& future, Continuation& cont, std::true_type) { pika::intrusive_ptr<Continuation> keep_alive(&cont); pika::detail::try_catch_exception_ptr( [&]() { func(PIKA_FORWARD(Future, future)); cont.set_value(util::unused); }, [&](std::exception_ptr ep) { cont.set_exception(PIKA_MOVE(ep)); }); } template <typename Func, typename Future, typename Continuation> std::enable_if_t<!traits::detail::is_unique_future< util::invoke_result_t<Func, Future>>::value> invoke_continuation(Func& func, Future&& future, Continuation& cont) { using is_void = std::is_void<util::invoke_result_t<Func, Future>>; pika::scoped_annotation annotate(func); invoke_continuation_nounwrap( func, PIKA_FORWARD(Future, future), cont, is_void()); } template <typename Func, typename Future, typename Continuation> std::enable_if_t<traits::detail::is_unique_future< util::invoke_result_t<Func, Future>>::value> invoke_continuation(Func& func, Future&& future, Continuation& cont) { pika::detail::try_catch_exception_ptr( [&]() { using inner_future = util::invoke_result_t<Func, Future>; using inner_shared_state_ptr = traits::detail::shared_state_ptr_for_t<inner_future>; // take by value, as the future may go away immediately inner_shared_state_ptr inner_state = traits::detail::get_shared_state( func(PIKA_FORWARD(Future, future))); typename inner_shared_state_ptr::element_type* ptr = inner_state.get(); if (ptr == nullptr) { PIKA_THROW_EXCEPTION(no_state, "invoke_continuation", "the inner future has no valid shared state"); } // Bind an on_completed handler to this future which will transfer // its result to the new future. pika::intrusive_ptr<Continuation> cont_(&cont); ptr->execute_deferred(); ptr->set_on_completed( [inner_state = PIKA_MOVE(inner_state), cont_ = PIKA_MOVE(cont_)]() mutable -> void { return transfer_result<inner_future>( PIKA_MOVE(inner_state), PIKA_MOVE(cont_)); }); }, [&](std::exception_ptr ep) { cont.set_exception(PIKA_MOVE(ep)); }); } /////////////////////////////////////////////////////////////////////////// template <typename Future, typename F, typename ContResult> class continuation : public detail::future_data<ContResult> { private: using base_type = future_data<ContResult>; using mutex_type = typename base_type::mutex_type; using result_type = typename base_type::result_type; protected: using base_type::mtx_; threads::thread_id_type get_id() const { std::lock_guard<mutex_type> l(mtx_); return id_; } void set_id(threads::thread_id_type const& id) { std::lock_guard<mutex_type> l(mtx_); id_ = id; } struct reset_id { reset_id(continuation& target) : target_(target) { if (threads::get_self_ptr() != nullptr) target.set_id(threads::get_self_id()); } ~reset_id() { target_.set_id(threads::invalid_thread_id); } continuation& target_; }; public: using init_no_addref = typename base_type::init_no_addref; template <typename Func, typename Enable = std::enable_if_t< !std::is_same<std::decay_t<Func>, continuation>::value>> // NOLINTNEXTLINE(bugprone-forwarding-reference-overload) continuation(Func&& f) : started_(false) , id_(threads::invalid_thread_id) , f_(PIKA_FORWARD(Func, f)) { } template <typename Func> continuation(init_no_addref no_addref, Func&& f) : base_type(no_addref) , started_(false) , id_(threads::invalid_thread_id) , f_(PIKA_FORWARD(Func, f)) { } protected: void run_impl(traits::detail::shared_state_ptr_for_t<Future>&& f) { Future future = traits::future_access<Future>::create(PIKA_MOVE(f)); invoke_continuation(f_, PIKA_MOVE(future), *this); } void run_impl_nounwrap( traits::detail::shared_state_ptr_for_t<Future>&& f) { using is_void = std::is_void<util::invoke_result_t<F, Future>>; Future future = traits::future_access<Future>::create(PIKA_MOVE(f)); invoke_continuation_nounwrap( f_, PIKA_MOVE(future), *this, is_void{}); } public: void run(traits::detail::shared_state_ptr_for_t<Future>&& f, error_code& ec = throws) { { std::lock_guard<mutex_type> l(mtx_); if (started_) { PIKA_THROWS_IF(ec, task_already_started, "continuation::run", "this task has already been started"); return; } started_ = true; } run_impl(PIKA_MOVE(f)); if (&ec != &throws) ec = make_success_code(); } void run_nounwrap(traits::detail::shared_state_ptr_for_t<Future>&& f, error_code& ec = throws) { { std::lock_guard<mutex_type> l(mtx_); if (started_) { PIKA_THROWS_IF(ec, task_already_started, "continuation::run_nounwrap", "this task has already been started"); return; } started_ = true; } run_impl_nounwrap(PIKA_MOVE(f)); if (&ec != &throws) ec = make_success_code(); } protected: void async_impl(traits::detail::shared_state_ptr_for_t<Future>&& f) { reset_id r(*this); Future future = traits::future_access<Future>::create(PIKA_MOVE(f)); invoke_continuation(f_, PIKA_MOVE(future), *this); } void async_impl_nounwrap( traits::detail::shared_state_ptr_for_t<Future>&& f) { using is_void = std::is_void<util::invoke_result_t<F, Future>>; reset_id r(*this); Future future = traits::future_access<Future>::create(PIKA_MOVE(f)); invoke_continuation_nounwrap( f_, PIKA_MOVE(future), *this, is_void{}); } public: /////////////////////////////////////////////////////////////////////// template <typename Spawner> void async(traits::detail::shared_state_ptr_for_t<Future>&& f, Spawner&& spawner, error_code& ec = pika::throws) { { std::unique_lock<mutex_type> l(this->mtx_); if (started_) { l.unlock(); PIKA_THROWS_IF(ec, task_already_started, "continuation::async", "this task has already been started"); return; } started_ = true; } pika::intrusive_ptr<continuation> this_(this); pika::util::thread_description desc(f_, "async"); spawner( [this_ = PIKA_MOVE(this_), f = PIKA_MOVE(f)]() mutable -> void { this_->async_impl(PIKA_MOVE(f)); }, desc); if (&ec != &throws) ec = make_success_code(); } /////////////////////////////////////////////////////////////////////// template <typename Spawner> void async_nounwrap(traits::detail::shared_state_ptr_for_t<Future>&& f, Spawner&& spawner, error_code& ec = pika::throws) { { std::unique_lock<mutex_type> l(this->mtx_); if (started_) { l.unlock(); PIKA_THROWS_IF(ec, task_already_started, "continuation::async_nounwrap", "this task has already been started"); return; } started_ = true; } pika::intrusive_ptr<continuation> this_(this); pika::util::thread_description desc(f_, "async_nounwrap"); spawner( [this_ = PIKA_MOVE(this_), f = PIKA_MOVE(f)]() mutable -> void { this_->async_impl_nounwrap(PIKA_MOVE(f)); }, desc); if (&ec != &throws) ec = make_success_code(); } /////////////////////////////////////////////////////////////////////// // cancellation support bool cancelable() const noexcept { return true; } void cancel() { std::unique_lock<mutex_type> l(this->mtx_); pika::detail::try_catch_exception_ptr( [&]() { if (!this->started_) PIKA_THROW_THREAD_INTERRUPTED_EXCEPTION(); if (this->is_ready()) return; // nothing we can do if (id_ != threads::invalid_thread_id) { // interrupt the executing thread threads::interrupt_thread(id_); this->started_ = true; l.unlock(); this->set_error(future_cancelled, "continuation<Future, ContResult>::cancel", "future has been canceled"); } else { l.unlock(); PIKA_THROW_EXCEPTION(future_can_not_be_cancelled, "continuation<Future, ContResult>::cancel", "future can't be canceled at this time"); } }, [&](std::exception_ptr ep) { this->started_ = true; this->set_exception(ep); std::rethrow_exception(PIKA_MOVE(ep)); }); } public: /////////////////////////////////////////////////////////////////////// // TODO: Reduce duplication! template <typename Spawner, typename Policy> void attach(Future const& future, std::remove_reference_t<Spawner>& spawner, Policy&& policy, error_code& /*ec*/ = throws) { using shared_state_ptr = traits::detail::shared_state_ptr_for_t<Future>; // bind an on_completed handler to this future which will invoke // the continuation pika::intrusive_ptr<continuation> this_(this); shared_state_ptr state = traits::detail::get_shared_state(future); typename shared_state_ptr::element_type* ptr = state.get(); if (ptr == nullptr) { PIKA_THROW_EXCEPTION(no_state, "continuation::attach", "the future to attach has no valid shared state"); } ptr->execute_deferred(); ptr->set_on_completed( [this_ = PIKA_MOVE(this_), state = PIKA_MOVE(state), policy = PIKA_FORWARD(Policy, policy), &spawner]() mutable -> void { if (pika::detail::has_async_policy(policy)) { this_->async(PIKA_MOVE(state), spawner); } else { this_->run(PIKA_MOVE(state)); } }); } template <typename Spawner, typename Policy> void attach(Future const& future, std::remove_reference_t<Spawner>&& spawner, Policy&& policy, error_code& /*ec*/ = throws) { using shared_state_ptr = traits::detail::shared_state_ptr_for_t<Future>; // bind an on_completed handler to this future which will invoke // the continuation pika::intrusive_ptr<continuation> this_(this); shared_state_ptr state = traits::detail::get_shared_state(future); typename shared_state_ptr::element_type* ptr = state.get(); if (ptr == nullptr) { PIKA_THROW_EXCEPTION(no_state, "continuation::attach", "the future to attach has no valid shared state"); } ptr->execute_deferred(); ptr->set_on_completed( [this_ = PIKA_MOVE(this_), state = PIKA_MOVE(state), policy = PIKA_FORWARD(Policy, policy), spawner = PIKA_MOVE(spawner)]() mutable -> void { if (pika::detail::has_async_policy(policy)) { this_->async(PIKA_MOVE(state), PIKA_MOVE(spawner)); } else { this_->run(PIKA_MOVE(state)); } }); } /////////////////////////////////////////////////////////////////////// template <typename Spawner, typename Policy> void attach_nounwrap(Future const& future, std::remove_reference_t<Spawner>& spawner, Policy&& policy, error_code& /*ec*/ = throws) { using shared_state_ptr = traits::detail::shared_state_ptr_for_t<Future>; // bind an on_completed handler to this future which will invoke // the continuation pika::intrusive_ptr<continuation> this_(this); shared_state_ptr state = traits::detail::get_shared_state(future); typename shared_state_ptr::element_type* ptr = state.get(); if (ptr == nullptr) { PIKA_THROW_EXCEPTION(no_state, "continuation::attach_nounwrap", "the future to attach has no valid shared state"); } ptr->execute_deferred(); ptr->set_on_completed( [this_ = PIKA_MOVE(this_), state = PIKA_MOVE(state), policy = PIKA_FORWARD(Policy, policy), &spawner]() mutable -> void { if (pika::detail::has_async_policy(policy)) { this_->async_nounwrap(PIKA_MOVE(state), spawner); } else { this_->run_nounwrap(PIKA_MOVE(state)); } }); } template <typename Spawner, typename Policy> void attach_nounwrap(Future const& future, std::remove_reference_t<Spawner>&& spawner, Policy&& policy, error_code& /*ec*/ = throws) { using shared_state_ptr = traits::detail::shared_state_ptr_for_t<Future>; // bind an on_completed handler to this future which will invoke // the continuation pika::intrusive_ptr<continuation> this_(this); shared_state_ptr state = traits::detail::get_shared_state(future); typename shared_state_ptr::element_type* ptr = state.get(); if (ptr == nullptr) { PIKA_THROW_EXCEPTION(no_state, "continuation::attach_nounwrap", "the future to attach has no valid shared state"); } ptr->execute_deferred(); ptr->set_on_completed( [this_ = PIKA_MOVE(this_), state = PIKA_MOVE(state), policy = PIKA_FORWARD(Policy, policy), spawner = PIKA_MOVE(spawner)]() mutable -> void { if (pika::detail::has_async_policy(policy)) { this_->async_nounwrap( PIKA_MOVE(state), PIKA_MOVE(spawner)); } else { this_->run_nounwrap(PIKA_MOVE(state)); } }); } protected: bool started_; threads::thread_id_type id_; std::decay_t<F> f_; }; template <typename Allocator, typename Future, typename F, typename ContResult> class continuation_allocator : public continuation<Future, F, ContResult> { using base_type = continuation<Future, F, ContResult>; using other_allocator = typename std::allocator_traits< Allocator>::template rebind_alloc<continuation_allocator>; public: using init_no_addref = typename base_type::init_no_addref; template <typename Func> continuation_allocator(other_allocator const& alloc, Func&& f) : base_type(PIKA_FORWARD(Func, f)) , alloc_(alloc) { } template <typename Func> continuation_allocator( init_no_addref no_addref, other_allocator const& alloc, Func&& f) : base_type(no_addref, PIKA_FORWARD(Func, f)) , alloc_(alloc) { } private: void destroy() noexcept override { using traits = std::allocator_traits<other_allocator>; other_allocator alloc(alloc_); traits::destroy(alloc, this); traits::deallocate(alloc, this, 1); } other_allocator alloc_; }; }}} // namespace pika::lcos::detail namespace pika { namespace traits { namespace detail { template <typename Future, typename F, typename ContResult, typename Allocator> struct shared_state_allocator< lcos::detail::continuation<Future, F, ContResult>, Allocator> { using type = lcos::detail::continuation_allocator<Allocator, Future, F, ContResult>; }; }}} // namespace pika::traits::detail /////////////////////////////////////////////////////////////////////////////// namespace pika { namespace lcos { namespace detail { /////////////////////////////////////////////////////////////////////////// template <typename ContResult> class unwrap_continuation : public future_data<ContResult> { private: template <typename Inner> void on_inner_ready( traits::detail::shared_state_ptr_for_t<Inner>&& inner_state) { transfer_result<Inner>(PIKA_MOVE(inner_state), this); } template <typename Outer> void on_outer_ready( traits::detail::shared_state_ptr_for_t<Outer>&& outer_state) { using inner_future = traits::future_traits_t<Outer>; using inner_shared_state_ptr = traits::detail::shared_state_ptr_for_t<inner_future>; // Bind an on_completed handler to this future which will transfer // its result to the new future. pika::intrusive_ptr<unwrap_continuation> this_(this); pika::detail::try_catch_exception_ptr( [&]() { // if we get here, this future is ready Outer outer = traits::future_access<Outer>::create( PIKA_MOVE(outer_state)); // take by value, as the future will go away immediately inner_shared_state_ptr inner_state = traits::detail::get_shared_state(outer.get()); typename inner_shared_state_ptr::element_type* ptr = inner_state.get(); if (ptr == nullptr) { PIKA_THROW_EXCEPTION(no_state, "unwrap_continuation<ContResult>::on_outer_ready", "the inner future has no valid shared state"); } ptr->execute_deferred(); ptr->set_on_completed( [this_ = PIKA_MOVE(this_), inner_state = PIKA_MOVE(inner_state)]() mutable -> void { return this_->template on_inner_ready<inner_future>( PIKA_MOVE(inner_state)); }); }, [&](std::exception_ptr ep) { this->set_exception(PIKA_MOVE(ep)); }); } public: using init_no_addref = typename future_data<ContResult>::init_no_addref; unwrap_continuation() = default; unwrap_continuation(init_no_addref no_addref) : future_data<ContResult>(no_addref) { } template <typename Future> void attach(Future&& future) { using outer_shared_state_ptr = traits::detail::shared_state_ptr_for_t<Future>; // Bind an on_completed handler to this future which will wait for // the inner future and will transfer its result to the new future. pika::intrusive_ptr<unwrap_continuation> this_(this); outer_shared_state_ptr outer_state = traits::detail::get_shared_state(future); typename outer_shared_state_ptr::element_type* ptr = outer_state.get(); if (ptr == nullptr) { PIKA_THROW_EXCEPTION(no_state, "unwrap_continuation<ContResult>::attach", "the future has no valid shared state"); } ptr->execute_deferred(); ptr->set_on_completed( [this_ = PIKA_MOVE(this_), outer_state = PIKA_MOVE(outer_state)]() mutable -> void { return this_->template on_outer_ready<Future>( PIKA_MOVE(outer_state)); }); } }; template <typename Allocator, typename ContResult> class unwrap_continuation_allocator : public unwrap_continuation<ContResult> { using base_type = unwrap_continuation<ContResult>; using other_allocator = typename std::allocator_traits< Allocator>::template rebind_alloc<unwrap_continuation_allocator>; public: using init_no_addref = typename base_type::init_no_addref; unwrap_continuation_allocator(other_allocator const& alloc) : alloc_(alloc) { } unwrap_continuation_allocator( init_no_addref no_addref, other_allocator const& alloc) : base_type(no_addref) , alloc_(alloc) { } private: void destroy() noexcept override { using traits = std::allocator_traits<other_allocator>; other_allocator alloc(alloc_); traits::destroy(alloc, this); traits::deallocate(alloc, this, 1); } other_allocator alloc_; }; }}} // namespace pika::lcos::detail namespace pika { namespace traits { namespace detail { template <typename ContResult, typename Allocator> struct shared_state_allocator<lcos::detail::unwrap_continuation<ContResult>, Allocator> { using type = lcos::detail::unwrap_continuation_allocator<Allocator, ContResult>; }; }}} // namespace pika::traits::detail namespace pika { namespace lcos { namespace detail { template <typename Allocator, typename Future> inline traits::detail::shared_state_ptr_t<future_unwrap_result_t<Future>> unwrap_impl_alloc(Allocator const& a, Future&& future, error_code& /*ec*/) { using base_allocator = Allocator; using result_type = future_unwrap_result_t<Future>; using shared_state = traits::shared_state_allocator_t< detail::unwrap_continuation<result_type>, base_allocator>; using other_allocator = typename std::allocator_traits< base_allocator>::template rebind_alloc<shared_state>; using traits = std::allocator_traits<other_allocator>; using init_no_addref = typename shared_state::init_no_addref; using unique_ptr = std::unique_ptr<shared_state, util::allocator_deleter<other_allocator>>; other_allocator alloc(a); unique_ptr p(traits::allocate(alloc, 1), util::allocator_deleter<other_allocator>{alloc}); traits::construct(alloc, p.get(), init_no_addref{}, alloc); // create a continuation pika::traits::detail::shared_state_ptr_t<result_type> result( p.release(), false); static_cast<shared_state*>(result.get()) ->attach(PIKA_FORWARD(Future, future)); return result; } template <typename Future> inline traits::detail::shared_state_ptr_t<future_unwrap_result_t<Future>> unwrap_impl(Future&& future, error_code& ec) { return unwrap_impl_alloc( util::internal_allocator<>{}, PIKA_FORWARD(Future, future), ec); } template <typename Allocator, typename Future> inline traits::detail::shared_state_ptr_t<future_unwrap_result_t<Future>> unwrap_alloc(Allocator const& a, Future&& future, error_code& ec) { return unwrap_impl_alloc(a, PIKA_FORWARD(Future, future), ec); } template <typename Future> inline traits::detail::shared_state_ptr_t<future_unwrap_result_t<Future>> unwrap(Future&& future, error_code& ec) { return unwrap_impl(PIKA_FORWARD(Future, future), ec); } }}} // namespace pika::lcos::detail
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Copyright (c) Berkeley Softworks 1990 -- All Rights Reserved PROJECT: PC GEOS MODULE: Okidata Print Driver FILE: oki9ControlCodes.asm AUTHOR: Dave Durran, 1 March 1990 ROUTINES: Name Description ---- ----------- REVISION HISTORY: Name Date Description ---- ---- ----------- Dave 3/1/90 Initial revision Dave 5/92 Initial 2.0 version DC_ESCRIPTION: This file contains all the style setting routines for the oki9 driver. $Id: oki9ControlCodes.asm,v 1.1 97/04/18 11:53:41 newdeal Exp $ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ;***************************************************************************** ; ;CONTROL CODES FOR THE OKI 9-PIN PRINTERS..... ; ; the first byte is the byte count for the control code. ; ;***************************************************************************** ;__________Job Control______________________________________ pr_codes_ResetPrinter label byte byte 1 byte C_DC1 ;enable printing. pr_codes_InitPrinter label byte byte 15 ;byte count byte C_ESC,"%C001" ;set margin all the way to left. byte 01eh ;set 10-pitch byte C_ESC,04bh ;reset superscript byte C_ESC,04dh ;reset subscript byte C_ESC,"I" ;reset bold byte C_ESC,"D" ;reset underline pr_codes_InitTextMode label byte byte C_NULL ;count ;__________Cursor Control______________________________________ pr_codes_InitPaperLength label byte byte 8 byte C_ESC,"%9",PR_MAX_LINE_FEED ;set line spacing to max byte C_ESC,"F99" ;set the form length to 99 line pr_codes_FormFeed label byte byte 6 byte C_ESC,"%9",2 ;set 2/144" line spacing. byte C_ESC,"F" ;set the page length. pr_codes_SetTab label byte byte 2,C_ESC,C_HT pr_codes_DoTab label byte byte 2,C_CR,C_HT pr_codes_SetLineFeed label byte byte 3,C_ESC,"%","9" pr_codes_SetMaxLineFeed label byte byte 4,C_ESC,"%","9",PR_MAX_LINE_FEED pr_codes_Do1ScanlineFeed label byte byte 5,C_ESC,"%","9",1,C_LF ;__________Graphics Control______________________________________ pr_codes_EnterGraphics label byte byte 3,C_CR,1ch,03h pr_codes_ExitGraphics label byte byte 2, 03h, 02h ;__________Pitch Control______________________________________ pr_codes_Set5Pitch label byte byte 2, 01eh, 01fh pr_codes_Set6Pitch label byte byte 2, 01ch, 01fh pr_codes_Set10Pitch label byte byte 1, 01eh pr_codes_Set12Pitch label byte byte 1, 01ch pr_codes_Set17Pitch label byte byte 1, 01dh pr_codes_SetProportional label byte byte C_NULL ;no proport. code, but code has to be present. ;__________Style Control______________________________________ pr_codes_SetSubscript label byte byte 2,C_ESC,"L" pr_codes_SetSuperscript label byte byte 2,C_ESC,"J" pr_codes_SetNLQ label byte byte 2,C_ESC,"1" pr_codes_SetBold label byte byte 2,C_ESC,"H" pr_codes_SetItalic label byte byte 2,C_ESC,"T" pr_codes_SetUnderline label byte byte 2,C_ESC,"C" pr_codes_ResetSuperscript label byte byte 2,C_ESC,04bh pr_codes_ResetSubscript label byte byte 2,C_ESC,04dh pr_codes_ResetNLQ label byte byte 2,C_ESC,"0" pr_codes_ResetBold label byte byte 2,C_ESC,"I" pr_codes_ResetItalic label byte byte 2,C_ESC,"I" pr_codes_ResetUnderline label byte byte 2,C_ESC,"D"
; ; Copyright (c) 2010 The VP8 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. ; EXPORT |vp8_short_idct4x4llm_1_neon| EXPORT |vp8_dc_only_idct_neon| ARM REQUIRE8 PRESERVE8 AREA ||.text||, CODE, READONLY, ALIGN=2 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;void vp8_short_idct4x4llm_1_c(short *input, short *output, int pitch); ; r0 short *input; ; r1 short *output; ; r2 int pitch; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |vp8_short_idct4x4llm_1_neon| PROC vld1.16 {d0[]}, [r0] ;load input[0] add r3, r1, r2 add r12, r3, r2 vrshr.s16 d0, d0, #3 add r0, r12, r2 vst1.16 {d0}, [r1] vst1.16 {d0}, [r3] vst1.16 {d0}, [r12] vst1.16 {d0}, [r0] bx lr ENDP ;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;void vp8_dc_only_idct_c(short input_dc, short *output, int pitch); ; r0 short input_dc; ; r1 short *output; ; r2 int pitch; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |vp8_dc_only_idct_neon| PROC vdup.16 d0, r0 add r3, r1, r2 add r12, r3, r2 vrshr.s16 d0, d0, #3 add r0, r12, r2 vst1.16 {d0}, [r1] vst1.16 {d0}, [r3] vst1.16 {d0}, [r12] vst1.16 {d0}, [r0] bx lr ENDP END
setrepeat 3 frame 0, 05 frame 5, 05 dorepeat 1 setrepeat 2 frame 0, 05 frame 4, 05 dorepeat 5 endanim
; ; Copyright (c) 2010 The VP8 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. ; EXPORT |vp8_decode_value_neon| EXPORT |vp8dx_start_decode_neon| EXPORT |vp8dx_stop_decode_neon| EXPORT |vp8dx_decode_bool_neon| ARM REQUIRE8 PRESERVE8 INCLUDE vpx_asm_offsets.asm AREA |.text|, CODE, READONLY ; name this block of code ; int z = 0; ; int bit; ; for ( bit=bits-1; bit>=0; bit-- ) ; { ; z |= (vp8dx_decode_bool(br, 0x80)<<bit); ; } ; return z; ;int vp8_decode_value_neon ( BOOL_DECODER *br, int bits ) |vp8_decode_value_neon| PROC stmdb sp!, {r4 - r6, lr} mov r4, r0 mov r5, r1 mov r6, #0 subs r5, r5, #1 bmi decode_value_exit decode_value_loop mov r1, #0x80 mov r0, r4 bl vp8dx_decode_bool_neon_internal ; needed for conversion to s file orr r6, r6, r0, lsl r5 subs r5, r5, #1 bpl decode_value_loop decode_value_exit mov r0, r6 ldmia sp!, {r4 - r6, pc} ENDP ; |vp8_decode_value_neon| ;void vp8dx_start_decode_neon ( BOOL_DECODER *br, unsigned char *source ) |vp8dx_start_decode_neon| PROC stmdb sp!, {r4 - r5, lr} mov r2, #0 mov r3, #255 str r2, [r0, #bool_decoder_lowvalue] str r3, [r0, #bool_decoder_range] str r1, [r0, #bool_decoder_buffer] mov r3, #8 mov r2, #4 str r3, [r0, #bool_decoder_count] str r2, [r0, #bool_decoder_pos] ldrb r2, [r1, #3] ldrb r3, [r1, #2] ldrb r4, [r1, #1] ldrb r5, [r1] orr r1, r2, r3, lsl #8 orr r1, r1, r4, lsl #16 orr r1, r1, r5, lsl #24 str r1, [r0, #bool_decoder_value] ldmia sp!, {r4 - r5, pc} ENDP ; |vp8dx_start_decode_neon| ;void vp8dx_stop_decode_neon ( BOOL_DECODER *bc ); |vp8dx_stop_decode_neon| PROC mov pc, lr ENDP ; |vp8dx_stop_decode_neon| ; bigsplit RN r1 ; buffer_v RN r1 ; count_v RN r4 ; range_v RN r2 ; value_v RN r3 ; pos_v RN r5 ; split RN r6 ; bit RN lr ;int vp8dx_decode_bool_neon ( BOOL_DECODER *br, int probability ) |vp8dx_decode_bool_neon| PROC vp8dx_decode_bool_neon_internal ;LDRD and STRD doubleword data transfers must be eight-byte aligned. Use ALIGN 8 ;before memory allocation stmdb sp!, {r4 - r5, lr} ldr r2, [r0, #bool_decoder_range] ;load range (r2), value(r3) ldr r3, [r0, #bool_decoder_value] ;ldrd r2, r3, [r0, #bool_decoder_range] ;ldrd costs 2 cycles ; mov r4, r2, lsl #8 sub r4, r4, #256 mov r12, #1 smlawb r4, r4, r1, r12 ;split = 1 + (((range-1) * probability) >> 8) mov lr, r0 mov r0, #0 ;bit = 0 ; subs r5, r3, r4, lsl #24 subhs r2, r2, r4 ;range = br->range-split movlo r2, r4 ;range = split movhs r0, #1 ;bit = 1 movhs r3, r5 ;value = value-bigsplit cmp r2, #0x80 blt range_less_0x80 strd r2, r3, [lr, #bool_decoder_range] ;store result ldmia sp!, {r4 - r5, pc} range_less_0x80 ldrd r4, r5, [lr, #bool_decoder_count] ;load count, pos, buffer ldr r1, [lr, #bool_decoder_buffer] clz r12, r2 add r1, r1, r5 sub r12, r12, #24 subs r4, r4, r12 ;count -= shift mov r2, r2, lsl r12 ;range <<= shift mov r3, r3, lsl r12 ;value <<= shift addle r4, r4, #8 ;count += 8 ldrleb r12, [r1], #1 ;br->buffer[br->pos] rsble r1, r4, #8 ;-count addle r5, r5, #1 ;br->pos++ orrle r3, r3, r12, lsl r1 ;value |= (br->buffer[br->pos]) << (-count) strd r2, r3, [lr, #bool_decoder_range] ;store result strd r4, r5, [lr, #bool_decoder_count] ldmia sp!, {r4 - r5, pc} ENDP ; |vp8dx_decode_bool_neon| END
// (C) Copyright John Maddock 2005-2006. // Use, modification and distribution are subject to 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) #ifndef BOOST_MATH_LOG1P_INCLUDED #define BOOST_MATH_LOG1P_INCLUDED #ifdef _MSC_VER #pragma once #endif #include <cmath> #include <math.h> // platform's ::log1p #include <boost/limits.hpp> #include <boost/math/tools/config.hpp> #include <boost/math/tools/series.hpp> #include <boost/math/tools/rational.hpp> #include <boost/math/policies/error_handling.hpp> #include <boost/math/special_functions/math_fwd.hpp> #ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS # include <boost/static_assert.hpp> #else # include <boost/assert.hpp> #endif namespace boost{ namespace math{ namespace detail { // Functor log1p_series returns the next term in the Taylor series // pow(-1, k-1)*pow(x, k) / k // each time that operator() is invoked. // template <class T> struct log1p_series { typedef T result_type; log1p_series(T x) : k(0), m_mult(-x), m_prod(-1){} T operator()() { m_prod *= m_mult; return m_prod / ++k; } int count()const { return k; } private: int k; const T m_mult; T m_prod; log1p_series(const log1p_series&); log1p_series& operator=(const log1p_series&); }; // Algorithm log1p is part of C99, but is not yet provided by many compilers. // // This version uses a Taylor series expansion for 0.5 > x > epsilon, which may // require up to std::numeric_limits<T>::digits+1 terms to be calculated. // It would be much more efficient to use the equivalence: // log(1+x) == (log(1+x) * x) / ((1-x) - 1) // Unfortunately many optimizing compilers make such a mess of this, that // it performs no better than log(1+x): which is to say not very well at all. // template <class T, class Policy> T log1p_imp(T const & x, const Policy& pol, const mpl::int_<0>&) { // The function returns the natural logarithm of 1 + x. typedef typename tools::promote_args<T>::type result_type; BOOST_MATH_STD_USING using std::abs; static const char* function = "boost::math::log1p<%1%>(%1%)"; if(x < -1) return policies::raise_domain_error<T>( function, "log1p(x) requires x > -1, but got x = %1%.", x, pol); if(x == -1) return -policies::raise_overflow_error<T>( function, 0, pol); result_type a = abs(result_type(x)); if(a > result_type(0.5L)) return log(1 + result_type(x)); // Note that without numeric_limits specialisation support, // epsilon just returns zero, and our "optimisation" will always fail: if(a < tools::epsilon<result_type>()) return x; detail::log1p_series<result_type> s(x); boost::uintmax_t max_iter = policies::get_max_series_iterations<Policy>(); #if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582)) result_type result = tools::sum_series(s, policies::digits<result_type, Policy>(), max_iter); #else result_type zero = 0; result_type result = tools::sum_series(s, policies::digits<result_type, Policy>(), max_iter, zero); #endif policies::check_series_iterations(function, max_iter, pol); return result; } template <class T, class Policy> T log1p_imp(T const& x, const Policy& pol, const mpl::int_<53>&) { // The function returns the natural logarithm of 1 + x. BOOST_MATH_STD_USING static const char* function = "boost::math::log1p<%1%>(%1%)"; if(x < -1) return policies::raise_domain_error<T>( function, "log1p(x) requires x > -1, but got x = %1%.", x, pol); if(x == -1) return -policies::raise_overflow_error<T>( function, 0, pol); T a = fabs(x); if(a > 0.5f) return log(1 + x); // Note that without numeric_limits specialisation support, // epsilon just returns zero, and our "optimisation" will always fail: if(a < tools::epsilon<T>()) return x; // Maximum Deviation Found: 1.846e-017 // Expected Error Term: 1.843e-017 // Maximum Relative Change in Control Points: 8.138e-004 // Max Error found at double precision = 3.250766e-016 static const T P[] = { 0.15141069795941984e-16L, 0.35495104378055055e-15L, 0.33333333333332835L, 0.99249063543365859L, 1.1143969784156509L, 0.58052937949269651L, 0.13703234928513215L, 0.011294864812099712L }; static const T Q[] = { 1L, 3.7274719063011499L, 5.5387948649720334L, 4.159201143419005L, 1.6423855110312755L, 0.31706251443180914L, 0.022665554431410243L, -0.29252538135177773e-5L }; T result = 1 - x / 2 + tools::evaluate_polynomial(P, x) / tools::evaluate_polynomial(Q, x); result *= x; return result; } template <class T, class Policy> T log1p_imp(T const& x, const Policy& pol, const mpl::int_<64>&) { // The function returns the natural logarithm of 1 + x. BOOST_MATH_STD_USING static const char* function = "boost::math::log1p<%1%>(%1%)"; if(x < -1) return policies::raise_domain_error<T>( function, "log1p(x) requires x > -1, but got x = %1%.", x, pol); if(x == -1) return -policies::raise_overflow_error<T>( function, 0, pol); T a = fabs(x); if(a > 0.5f) return log(1 + x); // Note that without numeric_limits specialisation support, // epsilon just returns zero, and our "optimisation" will always fail: if(a < tools::epsilon<T>()) return x; // Maximum Deviation Found: 8.089e-20 // Expected Error Term: 8.088e-20 // Maximum Relative Change in Control Points: 9.648e-05 // Max Error found at long double precision = 2.242324e-19 static const T P[] = { -0.807533446680736736712e-19L, -0.490881544804798926426e-18L, 0.333333333333333373941L, 1.17141290782087994162L, 1.62790522814926264694L, 1.13156411870766876113L, 0.408087379932853785336L, 0.0706537026422828914622L, 0.00441709903782239229447L }; static const T Q[] = { 1L, 4.26423872346263928361L, 7.48189472704477708962L, 6.94757016732904280913L, 3.6493508622280767304L, 1.06884863623790638317L, 0.158292216998514145947L, 0.00885295524069924328658L, -0.560026216133415663808e-6L }; T result = 1 - x / 2 + tools::evaluate_polynomial(P, x) / tools::evaluate_polynomial(Q, x); result *= x; return result; } template <class T, class Policy> T log1p_imp(T const& x, const Policy& pol, const mpl::int_<24>&) { // The function returns the natural logarithm of 1 + x. BOOST_MATH_STD_USING static const char* function = "boost::math::log1p<%1%>(%1%)"; if(x < -1) return policies::raise_domain_error<T>( function, "log1p(x) requires x > -1, but got x = %1%.", x, pol); if(x == -1) return -policies::raise_overflow_error<T>( function, 0, pol); T a = fabs(x); if(a > 0.5f) return log(1 + x); // Note that without numeric_limits specialisation support, // epsilon just returns zero, and our "optimisation" will always fail: if(a < tools::epsilon<T>()) return x; // Maximum Deviation Found: 6.910e-08 // Expected Error Term: 6.910e-08 // Maximum Relative Change in Control Points: 2.509e-04 // Max Error found at double precision = 6.910422e-08 // Max Error found at float precision = 8.357242e-08 static const T P[] = { -0.671192866803148236519e-7L, 0.119670999140731844725e-6L, 0.333339469182083148598L, 0.237827183019664122066L }; static const T Q[] = { 1L, 1.46348272586988539733L, 0.497859871350117338894L, -0.00471666268910169651936L }; T result = 1 - x / 2 + tools::evaluate_polynomial(P, x) / tools::evaluate_polynomial(Q, x); result *= x; return result; } } // namespace detail template <class T, class Policy> inline typename tools::promote_args<T>::type log1p(T x, const Policy&) { typedef typename tools::promote_args<T>::type result_type; typedef typename policies::evaluation<result_type, Policy>::type value_type; typedef typename policies::precision<result_type, Policy>::type precision_type; typedef typename policies::normalise< Policy, policies::promote_float<false>, policies::promote_double<false>, policies::discrete_quantile<>, policies::assert_undefined<> >::type forwarding_policy; typedef typename mpl::if_< mpl::less_equal<precision_type, mpl::int_<0> >, mpl::int_<0>, typename mpl::if_< mpl::less_equal<precision_type, mpl::int_<53> >, mpl::int_<53>, // double typename mpl::if_< mpl::less_equal<precision_type, mpl::int_<64> >, mpl::int_<64>, // 80-bit long double mpl::int_<0> // too many bits, use generic version. >::type >::type >::type tag_type; return policies::checked_narrowing_cast<result_type, forwarding_policy>( detail::log1p_imp(static_cast<value_type>(x), forwarding_policy(), tag_type()), "boost::math::log1p<%1%>(%1%)"); } #if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) // These overloads work around a type deduction bug: inline float log1p(float z) { return log1p<float>(z); } inline double log1p(double z) { return log1p<double>(z); } #ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS inline long double log1p(long double z) { return log1p<long double>(z); } #endif #endif #ifdef log1p # ifndef BOOST_HAS_LOG1P # define BOOST_HAS_LOG1P # endif # undef log1p #endif #ifdef BOOST_HAS_LOG1P # if (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901)) \ || ((defined(linux) || defined(__linux) || defined(__linux__)) && !defined(__SUNPRO_CC)) \ || (defined(__hpux) && !defined(__hppa)) template <class Policy> inline float log1p(float x, const Policy& pol) { if(x < -1) return policies::raise_domain_error<float>( "log1p<%1%>(%1%)", "log1p(x) requires x > -1, but got x = %1%.", x, pol); if(x == -1) return -policies::raise_overflow_error<float>( "log1p<%1%>(%1%)", 0, pol); return ::log1pf(x); } template <class Policy> inline long double log1p(long double x, const Policy& pol) { if(x < -1) return policies::raise_domain_error<long double>( "log1p<%1%>(%1%)", "log1p(x) requires x > -1, but got x = %1%.", x, pol); if(x == -1) return -policies::raise_overflow_error<long double>( "log1p<%1%>(%1%)", 0, pol); return ::log1pl(x); } #else template <class Policy> inline float log1p(float x, const Policy& pol) { if(x < -1) return policies::raise_domain_error<float>( "log1p<%1%>(%1%)", "log1p(x) requires x > -1, but got x = %1%.", x, pol); if(x == -1) return -policies::raise_overflow_error<float>( "log1p<%1%>(%1%)", 0, pol); return ::log1p(x); } #endif template <class Policy> inline double log1p(double x, const Policy& pol) { if(x < -1) return policies::raise_domain_error<double>( "log1p<%1%>(%1%)", "log1p(x) requires x > -1, but got x = %1%.", x, pol); if(x == -1) return -policies::raise_overflow_error<double>( "log1p<%1%>(%1%)", 0, pol); return ::log1p(x); } #elif defined(_MSC_VER) && (BOOST_MSVC >= 1400) // // You should only enable this branch if you are absolutely sure // that your compilers optimizer won't mess this code up!! // Currently tested with VC8 and Intel 9.1. // template <class Policy> inline double log1p(double x, const Policy& pol) { if(x < -1) return policies::raise_domain_error<double>( "log1p<%1%>(%1%)", "log1p(x) requires x > -1, but got x = %1%.", x, pol); if(x == -1) return -policies::raise_overflow_error<double>( "log1p<%1%>(%1%)", 0, pol); double u = 1+x; if(u == 1.0) return x; else return log(u)*(x/(u-1.0)); } template <class Policy> inline float log1p(float x, const Policy& pol) { return static_cast<float>(boost::math::log1p(static_cast<double>(x), pol)); } template <class Policy> inline long double log1p(long double x, const Policy& pol) { if(x < -1) return policies::raise_domain_error<long double>( "log1p<%1%>(%1%)", "log1p(x) requires x > -1, but got x = %1%.", x, pol); if(x == -1) return -policies::raise_overflow_error<long double>( "log1p<%1%>(%1%)", 0, pol); long double u = 1+x; if(u == 1.0) return x; else return log(u)*(x/(u-1.0)); } #endif template <class T> inline typename tools::promote_args<T>::type log1p(T x) { return boost::math::log1p(x, policies::policy<>()); } // // Compute log(1+x)-x: // template <class T, class Policy> inline typename tools::promote_args<T>::type log1pmx(T x, const Policy& pol) { typedef typename tools::promote_args<T>::type result_type; BOOST_MATH_STD_USING static const char* function = "boost::math::log1pmx<%1%>(%1%)"; if(x < -1) return policies::raise_domain_error<T>( function, "log1pmx(x) requires x > -1, but got x = %1%.", x, pol); if(x == -1) return -policies::raise_overflow_error<T>( function, 0, pol); result_type a = abs(result_type(x)); if(a > result_type(0.95L)) return log(1 + result_type(x)) - result_type(x); // Note that without numeric_limits specialisation support, // epsilon just returns zero, and our "optimisation" will always fail: if(a < tools::epsilon<result_type>()) return -x * x / 2; boost::math::detail::log1p_series<T> s(x); s(); boost::uintmax_t max_iter = policies::get_max_series_iterations<Policy>(); #if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582)) T zero = 0; T result = boost::math::tools::sum_series(s, policies::digits<T, Policy>(), max_iter, zero); #else T result = boost::math::tools::sum_series(s, policies::digits<T, Policy>(), max_iter); #endif policies::check_series_iterations(function, max_iter, pol); return result; } template <class T> inline T log1pmx(T x) { return log1pmx(x, policies::policy<>()); } } // namespace math } // namespace boost #endif // BOOST_MATH_LOG1P_INCLUDED
; A070700: a(n) = n^7 mod 18. ; 0,1,2,9,4,5,0,7,8,9,10,11,0,13,14,9,16,17,0,1,2,9,4,5,0,7,8,9,10,11,0,13,14,9,16,17,0,1,2,9,4,5,0,7,8,9,10,11,0,13,14,9,16,17,0,1,2,9,4,5,0,7,8,9,10,11,0,13,14,9,16,17,0,1,2,9,4,5,0,7,8,9,10,11,0,13,14,9,16,17,0,1,2,9,4,5,0,7,8,9 pow $0,7 mod $0,18
; A032825: Numbers whose set of base-13 digits is {1,4}. ; Submitted by Jamie Morken(s4) ; 1,4,14,17,53,56,183,186,222,225,690,693,729,732,2380,2383,2419,2422,2887,2890,2926,2929,8971,8974,9010,9013,9478,9481,9517,9520,30941,30944,30980,30983,31448,31451,31487,31490,37532,37535,37571,37574,38039,38042,38078,38081,116624,116627,116663,116666,117131,117134,117170,117173,123215,123218,123254,123257,123722,123725,123761,123764,402234,402237,402273,402276,402741,402744,402780,402783,408825,408828,408864,408867,409332,409335,409371,409374,487917,487920,487956,487959,488424,488427,488463 add $0,1 mov $2,3 lpb $0 mov $3,$0 mul $0,2 sub $0,1 div $0,4 mod $3,2 mul $3,$2 add $1,$3 mul $2,13 lpe mul $1,9 sub $2,$1 mov $0,$2 div $0,9
// Copyright Carl Philipp Reh 2006 - 2019. // 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) #ifndef SGE_TEXTURE_MANAGER_HPP_INCLUDED #define SGE_TEXTURE_MANAGER_HPP_INCLUDED #include <sge/image/color/format.hpp> #include <sge/image2d/view/const_object_fwd.hpp> #include <sge/texture/fragmented_unique_ptr.hpp> #include <sge/texture/manager_fwd.hpp> #include <sge/texture/on_alloc_callback.hpp> #include <sge/texture/part_unique_ptr.hpp> #include <sge/texture/detail/symbol.hpp> #include <fcppt/nonmovable.hpp> #include <fcppt/config/external_begin.hpp> #include <map> #include <fcppt/config/external_end.hpp> namespace sge::texture { class manager { FCPPT_NONMOVABLE(manager); public: SGE_TEXTURE_DETAIL_SYMBOL explicit manager(sge::texture::on_alloc_callback &&); SGE_TEXTURE_DETAIL_SYMBOL ~manager(); [[nodiscard]] SGE_TEXTURE_DETAIL_SYMBOL sge::texture::part_unique_ptr add(sge::image2d::view::const_object const &); SGE_TEXTURE_DETAIL_SYMBOL void on_alloc(sge::texture::on_alloc_callback const &); SGE_TEXTURE_DETAIL_SYMBOL void free_empty_textures(); private: sge::texture::on_alloc_callback on_alloc_; using fragmented_map = std::multimap<sge::image::color::format, sge::texture::fragmented_unique_ptr>; sge::texture::manager::fragmented_map textures_; }; } #endif
; A152893: Periodic sequence [3, 3, 0, 0, 4] of period 5 ; 3,3,0,0,4,3,3,0,0,4,3,3,0,0,4,3,3,0,0,4,3,3,0,0,4,3,3,0,0,4,3,3,0,0,4,3,3,0,0,4,3,3,0,0,4,3,3,0,0,4 lpb $0 mod $0,5 lpe div $0,2 mov $1,2 pow $1,$0 mul $1,17 sub $1,4 mod $1,10 mov $0,$1
BPLIST "" invalid_type BPLIST "" BPLIST . ; fatal error DEVICE ZXSPECTRUM48 ; global device specified at end of pass 1
;------------------------------------------------------------------------------ ; ; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR> ; This program and the accompanying materials ; are licensed and made available under the terms and conditions of the BSD License ; which accompanies this distribution. The full text of the license may be found at ; http://opensource.org/licenses/bsd-license.php. ; ; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, ; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. ; ; Module Name: ; ; SetMem16.Asm ; ; Abstract: ; ; SetMem16 function ; ; Notes: ; ;------------------------------------------------------------------------------ .code ;------------------------------------------------------------------------------ ; VOID * ; EFIAPI ; InternalMemSetMem16 ( ; IN VOID *Buffer, ; IN UINTN Count, ; IN UINT16 Value ; ) ;------------------------------------------------------------------------------ InternalMemSetMem16 PROC USES rdi push rcx mov rdi, rcx mov rax, r8 xchg rcx, rdx rep stosw pop rax ret InternalMemSetMem16 ENDP END
; Copyright (c) 2021 TK Chia ; ; 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 developer(s) 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 ; HOLDER 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. %include "stage2/stage2.inc" %define KIBYTE 1024 %define PARA_SIZE 0x10 %define BMEM_MAX_ADDR 0x100000 section .text extern mem_alloc, _stext16, _etext16, _sdata16, _end16 extern gdt_desc_cs16, gdt_desc_ds16 extern rm16_call.cont1, rm16_call.rm_cs16 extern vecs16_part1, NUM_VECS16_PART1 extern vecs16_part2, NUM_VECS16_PART2 extern tb16 global rm16_init rm16_init: push esi push edi mov eax, _etext16 ; allocate base memory for the real- mov edx, PARA_SIZE ; -mode code mov ecx, BMEM_MAX_ADDR call mem_alloc or [gdt_desc_cs16+2], eax ; fix up the GDT entry for SEL_CS16 mov esi, text16_load ; copy out the 16-bit code lea edi, [eax+_stext16] mov ecx, (text16_load.end-text16_load)/4 rep movsd mov ecx, eax ; save real mode code seg. no.; also shr ecx, 4 ; patch seg. no. in copied code mov [rm16_cs], cx mov [eax+rm16_call.rm_cs16], cx push ecx ; (1) --- see below mov eax, _end16 ; allocate base memory for the real- mov edx, KIBYTE ; -mode data mov ecx, BMEM_MAX_ADDR call mem_alloc or [gdt_desc_ds16+2], eax ; fix up the GDT entry for SEL_DS16 mov edx, eax ; initialize the EBDA pointer shr edx, 4 mov [bda.ebda], dx mov esi, data16_load ; copy out the 16-bit initialized data lea edi, [eax+_sdata16] mov ecx, (data16_load.end-data16_load)/4 rep movsd lea esi, [eax+vecs16_part1] ; (2) --- see below lea ecx, [eax+_end16+3] ; blank out the uninitialized data sub ecx, edi shr ecx, 2 xor eax, eax rep stosd xchg edi, eax ; initialize real-mode intr. vectors mov cl, NUM_VECS16_PART1 ; before calling option ROMs pop eax ; (1) --- see above shl eax, 16 .vecs_1: lodsw ; (2) --- see above stosd loop .vecs_1 mov di, 0x70*4 mov cl, NUM_VECS16_PART2 .vecs_2: lodsw stosd loop .vecs_2 mov ax, bda.def_kb_buf-bda ; initialize IRQ 1 keyboard buffer mov [bda.kb_buf_start], ax mov [bda.kb_buf_head], ax mov [bda.kb_buf_tail], ax mov al, bda.def_kb_buf_end-bda mov [bda.kb_buf_end], ax mov ax, fs ; reload fs desc. cache (for SEL_DS16) mov fs, ax pop edi pop esi ret align 16 global rm16_call rm16_call: push ebx push esi push edi push ebp pushfd mov ebx, [esp+5*4+4] lea edi, [esp+5*4+4+4] cli call SEL_CS16:rm16_call.cont1 mov si, SEL_DS32 mov ds, si mov es, si mov ss, si mov gs, si movzx esi, word [bda.ebda] ; properly update SEL_DS16 descriptor shl esi, 4 ; in case EBDA has moved or esi, 0x92000000 mov [gdt_desc_ds16+2], esi mov si, SEL_DS16 mov fs, si popfd pop ebp pop edi pop esi pop ebx ret 8 align 4 data16_load: incbin "stage2/data16.bin" align 4, db 0 .end: text16_load: incbin "stage2/text16.bin" align 4 .end: section .bss resb 0x1000 starting_stack: common rm16_cs 2
; A168381: a(n) = 4*n + 2*(-1)^n. ; 2,10,10,18,18,26,26,34,34,42,42,50,50,58,58,66,66,74,74,82,82,90,90,98,98,106,106,114,114,122,122,130,130,138,138,146,146,154,154,162,162,170,170,178,178,186,186,194,194,202,202,210,210,218,218,226,226,234,234,242,242,250,250,258,258,266,266,274,274,282,282,290,290,298,298,306,306,314,314,322,322,330,330,338,338,346,346,354,354,362,362,370,370,378,378,386,386,394,394,402,402,410,410,418,418,426,426,434,434,442,442,450,450,458,458,466,466,474,474,482,482,490,490,498,498,506,506,514,514,522,522,530,530,538,538,546,546,554,554,562,562,570,570,578,578,586,586,594,594,602,602,610,610,618,618,626,626,634,634,642,642,650,650,658,658,666,666,674,674,682,682,690,690,698,698,706,706,714,714,722,722,730,730,738,738,746,746,754,754,762,762,770,770,778,778,786,786,794,794,802,802,810,810,818,818,826,826,834,834,842,842,850,850,858,858,866,866,874,874,882,882,890,890,898,898,906,906,914,914,922,922,930,930,938,938,946,946,954,954,962,962,970,970,978,978,986,986,994,994,1002 mov $1,1 add $1,$0 div $1,2 mul $1,8 add $1,2
; ; ZX Spectrum ZXMMC specific routines ; code by Alessandro Poppi ; ported to z88dk by Stefano Bodrato - Feb 2010 ; ; $Id: cs_low.asm,v 1.3 2016-06-10 21:28:03 dom Exp $ ; ;------------------------------------------------------------------------------------ ; CHIP_SELECT LOW subroutine. Destroys no registers. The card to be selected should ; specified in CARD_SELECT (D1 = SLOT1, D0 = SLOT0, active LOW) ; ; used in: 'MMC_SEND_COMMAND', 'MMC_INIT', 'MMC_SEND_BLOCKSIZE' ;------------------------------------------------------------------------------------ SECTION code_clib PUBLIC cs_low EXTERN __mmc_card_select INCLUDE "target/zx/def/zxmmc.def" cs_low: push af ld a,(__mmc_card_select) out (OUT_PORT),a pop af ret
#include "aykpch.h" #include "Scene.h" #include <glm/glm.hpp> namespace AYK { Scene::Scene() { // struct MeshComponent { // }; // struct TransformComponent { // glm::mat4 Transform; // // TransformComponent() = default; // TransformComponent(const TransformComponent&) = default; // TransformComponent(const glm::mat4& TMat) : Transform(TMat) {} // operator glm::mat4& () { return(Transform); } // operator const glm::mat4&() const { return(Transform); } // // }; // // entt::entity E = ERegistry.create(); // ERegistry.emplace<TransformComponent>(E, glm::mat4(1.0f)); // auto View = ERegistry.view<TransformComponent>(); // for (auto Entity : View) { // // TransformComponent Tr = View.get<TransformComponent>(Entity); // } // auto Group = ERegistry.group<TransformComponent>(entt::get<MeshComponent>); //for (auto Entity : Group) { // auto&[Tr, M] = Group.get<TransformComponent, MeshComponent>(Entity); //} } Scene::~Scene() { } }
; Copyright (c) 2009-2010, Michael Alyn Miller <malyn@strangeGizmo.com>. ; All rights reserved. ; ; Redistribution and use in source and binary forms, with or without ; modification, are permitted provided that the following conditions are met: ; ; 1. Redistributions of source code must retain the above copyright notice ; unmodified, this list of conditions, and the following disclaimer. ; 2. Redistributions in binary form must reproduce the above copyright notice, ; this list of conditions and the following disclaimer in the documentation ; and/or other materials provided with the distribution. ; 3. Neither the name of Michael Alyn Miller nor the names of the contributors ; to this software may be used to endorse or promote products derived from ; this software without specific prior written permission. ; ; THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY ; EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED ; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ; DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY ; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ; (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; ; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ; ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF ; THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ; ====================================================================== ; TOOLS EXT Words ; ====================================================================== ; ---------------------------------------------------------------------- ; ASSEMBLER [TOOLS EXT] 15.6.2.0740 ( -- ) ; ; Replace the first word list in the search order with the ASSEMBLER ; word list. LINKTO(LINK_TOOLSEXT,0,9,'R',"ELBMESSA") ASSEMBLER: JMP ENTER .WORD LIT,ASSEMBLERWL,LIT,SOESTART,STORE,EXIT ; ---------------------------------------------------------------------- ; BYE [TOOLS EXT] 15.6.2.0830 ( -- ) ; ; Return control to the host operating system, if any. LINKTO(ASSEMBLER,0,3,'E',"YB") BYE: LHLD BOPSTK ; Load the SP on entry into MFORTH SPHL ; ..and restore that SP. CALL STDCALL ; Call the .WORD 5797h ; ..main menu routine (never returns). ; ---------------------------------------------------------------------- ; CODE [TOOLS EXT] 15.6.2.0930 ( "<spaces>name" -- ) ; ; Skip leading space delimiters. Parse name delimited by a space. ; Create a definition for name, called a "code definition", with the ; execution semantics defined below. ; ; Subsequent characters in the parse area typically represent source ; code in a programming language, usually some form of assembly ; language. Those characters are processed in an implementation-defined ; manner, generating the corresponding machine code. The process ; continues, refilling the input buffer as needed, until an ; implementation-defined ending sequence is processed. ; ; name Execution: ( -- a-addr ) ; Execute the machine code sequence that was generated following ; CODE. ; ; --- ; : CODE ( "<spaces>name" -- ) ; CREATE CFASZ NEGATE ALLOT ALSO ASSEMBLER ; LINKTO(BYE,0,4,'E',"DOC") LAST_TOOLSEXT: CODE: JMP ENTER .WORD CREATE,LIT,-CFASZ,ALLOT,ALSO,ASSEMBLER .WORD EXIT
; A037641: Base 6 digits are, in order, the first n terms of the periodic sequence with initial period 2,3,1. ; Submitted by Jon Maiga ; 2,15,91,548,3291,19747,118484,710907,4265443,25592660,153555963,921335779,5528014676,33168088059,199008528355,1194051170132,7164307020795,42985842124771,257915052748628,1547490316491771 seq $0,33133 ; Base-6 digits are, in order, the first n terms of the periodic sequence with initial period 1,1,0. mov $2,$0 mul $2,14 div $2,12 add $2,$0 mov $0,$2
; A113071: Expansion of ((1+x)/(1-3*x))^2. ; 1,8,40,168,648,2376,8424,29160,99144,332424,1102248,3621672,11809800,38263752,123294312,395392104,1262703816,4017693960,12741829416,40291730856,127073920392,399817944648,1255242384360,3933092804328,12301375366728,38410416961416,119750123467944,372806988154920,1159090817718024,3599282012913864 mov $1,4 add $1,$0 sub $1,3 mov $3,$0 add $3,$0 lpb $0 sub $0,1 mov $2,$1 add $3,$1 add $3,$1 mov $1,$3 lpe add $1,$2
#include "plic.h" #include <CppUTest/CommandLineTestRunner.h> void initConstructOnFirstUse() { plic::debug("", "no real %% format specifier ", 0); } int main(int argc, char **argv) { initConstructOnFirstUse(); return CommandLineTestRunner::RunAllTests(argc, argv); }
; A213489: Number of (w,x,y) with all terms in {0,...,n} and |w-x| + |x-y| + |y-w| >= w + x + y. ; 1,7,19,37,64,103,154,217,295,391,505,637,790,967,1168,1393,1645,1927,2239,2581,2956,3367,3814,4297,4819,5383,5989,6637,7330,8071,8860,9697,10585,11527,12523,13573,14680,15847,17074,18361,19711,21127 lpb $0 mov $2,$0 cal $2,27379 ; Expansion of (1+x^2-x^3)/(1-x)^3. sub $0,1 add $1,$2 mod $2,2 add $1,$2 lpe div $1,2 mul $1,3 add $1,1
/* file: low_order_moments_batch_fpt.cpp */ /******************************************************************************* * Copyright 2014-2017 Intel Corporation * * 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. *******************************************************************************/ /* //++ // Implementation of LowOrderMoments algorithm and types methods. //-- */ #include "moments_batch.h" namespace daal { namespace algorithms { namespace low_order_moments { template DAAL_EXPORT services::Status Result::allocate<DAAL_FPTYPE>(const daal::algorithms::Input *input, const daal::algorithms::Parameter *par, const int method); template DAAL_EXPORT services::Status Result::allocate<DAAL_FPTYPE>(const daal::algorithms::PartialResult *input, daal::algorithms::Parameter *par, const int method); }// namespace low_order_moments }// namespace algorithms }// namespace daal
; SP1DrawUpdateStruct ; 12.2006 aralbrec, Sprite Pack v3.0 ; sinclair spectrum version INCLUDE "clib_target_cfg.asm" SECTION code_clib SECTION code_temp_sp1 PUBLIC SP1DrawUpdateStruct PUBLIC SP1RETSPRDRAW ; Draw the tile described by the indicated update struct ; to screen -- not meant to be called directly, just a ; code fragment called from other functions. ; ; enter : b = # occluding sprites in char + 1 ; hl = & struct sp1_update ; exit : bc = & next sp1_update in update list .haveocclspr ; there are occluding sprites in this char ; b = # occl sprites ; de = 16-bit tile code ; hl = & update.slist inc hl push hl dec hl push de jp skiplp .skipthisone ; don't need to draw this sprite ld hl,15 add hl,de ; stack = & update.slist + 1b, 16-bit tile code .skiplp ld d,(hl) inc hl ld e,(hl) ; de = & sp1_cs.attr_mask dec de ; de = & sp1_cs.type ld a,(de) rla ; is this an occluding sprite? jr nc, skipthisone ; if no skip it djnz skipthisone ; if haven't seen all occl sprites yet, skip this one too ; de = & sp1_cs.type ; a = sprite type rotated left one bit ; stack = & update.slist + 1b, 16-bit tile code and $20 ; type has been rot left one bit, check orig bit 4 if should clear pixel buff pop hl ; hl = 16-bit tile code jr z, noclearbuff ; clear pixel buffer ; de = & sp1_cs.type ; hl = 16-bit tile code ; stack = & update.slist + 1b ld a,h or a jr nz, havetiledef2 ; if MSB of tile code != 0 we have & tile definition already ld h,SP1V_TILEARRAY/256 ld a,(hl) inc h ld h,(hl) ld l,a ; hl = & tile definition .havetiledef2 push de ld de,SP1V_PIXELBUFFER ldi ; copy background tile graphics into pixel buffer ldi ldi ldi ldi ldi ldi ld a,(hl) ld (de),a pop de .noclearbuff ; de = & sp1_cs.type ; stack = & update.slist + 1b ex de,hl inc hl ; hl = & sp1_cs.attr_mask jp spritedraw .SP1DrawUpdateStruct ; b = # occluding sprites in char + 1 ; hl = & struct sp1_update inc hl ld a,(hl) ld (SP1V_ATTRBUFFER),a ; write background colour to buffer inc hl ; hl = & update.tile ld e,(hl) inc hl ld d,(hl) inc hl djnz haveocclspr ; deal with case of occluding sprites ex de,hl ; hl = 16-bit tile code, de = & update.slist ld a,h or a jr nz, havetiledef ; if MSB of tile code != 0 we have & tile definition already ld h,SP1V_TILEARRAY/256 ld a,(hl) inc h ld h,(hl) ld l,a ; hl = & tile definition ; de = & update.slist .havetiledef ld a,(de) or a jr z, drawtileonly ; if there are no sprites in this char, just draw background tile push de ; save & update.slist ld de,SP1V_PIXELBUFFER ldi ; copy background tile graphics into pixel buffer ldi ldi ldi ldi ldi ldi ld a,(hl) ld (de),a pop hl ; hl = & update.slist ld a,(hl) inc hl push hl ; save & update.slist + 1b .spritedrawlp ; hl = & sp1_cs.next_in_upd + 1b ; a = MSB of next sp1_cs.attr_mask ld l,(hl) ld h,a ; hl = & sp1_cs.attr_mask .spritedraw ; hl = & sp1_cs.attr_mask ; stack = & update.slist + 1b ld a,(SP1V_ATTRBUFFER) ; get current char colour and (hl) ; apply sprite's colour mask inc hl or (hl) ; apply sprite's colour inc hl ; hl = & sp1_cs.ss_draw ld (SP1V_ATTRBUFFER),a ; write back as current colour ld e,(hl) inc hl ld d,(hl) inc hl ex de,hl ; de = & sp1_cs.draw_code, hl = & sp1_ss.draw_code jp (hl) ; jump into sp1_ss's draw code .drawtileonly ; hl = & tile definition ; de = & update.slist ex de,hl inc hl inc hl ld b,(hl) inc hl ld c,(hl) ; bc = & next sp1_update in update list inc hl ld a,(hl) inc hl ld h,(hl) ld l,a ; hl = screen address for char ; de = tile definition ld a,(de) ; copy tile directly to screen ld (hl),a inc h inc de ld a,(de) ld (hl),a inc h inc de ld a,(de) ld (hl),a inc h inc de ld a,(de) ld (hl),a inc h inc de ld a,(de) ld (hl),a inc h inc de ld a,(de) ld (hl),a inc h inc de ld a,(de) ld (hl),a inc h inc de ld a,(de) ld (hl),a ; jp rejoin ; inlined instead -- did you know this ten-cycle ; instruction executed 100 times adds up to 1000 cycles! ld a,h ; compute attribute addr from pixel addr xor $85 rrca rrca rrca ld h,a ld a,(SP1V_ATTRBUFFER) ld (hl),a ; write colour to screen ; bc = & next sp1_update in update list ret .SP1RETSPRDRAW ; return here after sprite char drawn pop hl ; hl = & sp1_cs.next_in_upd (pushed by sprite draw code) ld a,(hl) inc hl or a jr nz, spritedrawlp ; if there are more sprites in this char go draw them pop hl ; hl = & update.slist + 1b .donesprites inc hl ld b,(hl) inc hl ld c,(hl) ; bc = & next sp1_update in update list inc hl ld a,(hl) inc hl ld h,(hl) ld l,a ; hl = screen address for this char cell ld de,(SP1V_PIXELBUFFER+0) ; copy final graphic in pixel buffer to screen ld (hl),e inc h ld (hl),d inc h ld de,(SP1V_PIXELBUFFER+2) ld (hl),e inc h ld (hl),d inc h ld de,(SP1V_PIXELBUFFER+4) ld (hl),e inc h ld (hl),d inc h ld de,(SP1V_PIXELBUFFER+6) ld (hl),e inc h ld (hl),d .rejoin ld a,h ; compute attribute addr from pixel addr xor $85 rrca rrca rrca ld h,a ld a,(SP1V_ATTRBUFFER) ld (hl),a ; write colour to screen ; bc = & next sp1_update in update list ret
.global s_prepare_buffers s_prepare_buffers: push %r14 push %r8 push %r9 push %rax push %rbp push %rcx push %rdx lea addresses_normal_ht+0x1e6, %rax clflush (%rax) nop nop nop add $50773, %r9 movb $0x61, (%rax) nop nop nop nop cmp %rcx, %rcx lea addresses_A_ht+0x6d47, %rcx nop nop cmp %rbp, %rbp mov $0x6162636465666768, %r14 movq %r14, %xmm3 and $0xffffffffffffffc0, %rcx movaps %xmm3, (%rcx) nop nop cmp $16243, %r9 lea addresses_WT_ht+0x7fe2, %r9 nop and %rdx, %rdx movl $0x61626364, (%r9) nop nop nop inc %rdx lea addresses_WT_ht+0x138e2, %r8 nop inc %rbp movb (%r8), %r9b nop sub $53133, %rbp lea addresses_WC_ht+0x19022, %r9 nop nop nop nop nop cmp %rdx, %rdx mov (%r9), %eax nop nop dec %rbp lea addresses_UC_ht+0xa0e2, %rdx nop nop nop nop sub %r9, %r9 mov (%rdx), %r14 nop xor %r8, %r8 lea addresses_UC_ht+0x1b0e2, %r8 add %rdx, %rdx movw $0x6162, (%r8) xor %rdx, %rdx lea addresses_WT_ht+0x110e2, %rax nop nop nop and $54261, %r8 mov $0x6162636465666768, %rbp movq %rbp, (%rax) dec %r9 lea addresses_A_ht+0xf8e2, %r8 nop nop nop nop nop xor $37841, %rax and $0xffffffffffffffc0, %r8 vmovntdqa (%r8), %ymm1 vextracti128 $0, %ymm1, %xmm1 vpextrq $0, %xmm1, %r14 nop nop nop inc %rcx pop %rdx pop %rcx pop %rbp pop %rax pop %r9 pop %r8 pop %r14 ret .global s_faulty_load s_faulty_load: push %r10 push %r14 push %r8 push %rbp push %rbx push %rdi push %rdx // Store lea addresses_D+0x58e2, %r8 nop nop nop nop and %rdx, %rdx movl $0x51525354, (%r8) nop nop xor %rdx, %rdx // Store lea addresses_WC+0x1fce2, %r14 clflush (%r14) nop nop nop nop cmp %r10, %r10 movl $0x51525354, (%r14) nop nop nop nop nop cmp $50334, %rbx // Store lea addresses_D+0x58e2, %rbp nop nop nop nop xor $55549, %rbx movb $0x51, (%rbp) nop inc %rbp // Store lea addresses_WC+0x2c62, %rbx nop nop and $25989, %r14 movb $0x51, (%rbx) nop nop nop nop nop cmp $23194, %r14 // Faulty Load lea addresses_D+0x58e2, %rbp nop nop and $48013, %rdx mov (%rbp), %rdi lea oracles, %rbp and $0xff, %rdi shlq $12, %rdi mov (%rbp,%rdi,1), %rdi pop %rdx pop %rdi pop %rbx pop %rbp pop %r8 pop %r14 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 0, 'same': False, 'type': 'addresses_D'}, 'OP': 'LOAD'} {'dst': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 0, 'same': True, 'type': 'addresses_D'}, 'OP': 'STOR'} {'dst': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 7, 'same': False, 'type': 'addresses_WC'}, 'OP': 'STOR'} {'dst': {'NT': True, 'AVXalign': False, 'size': 1, 'congruent': 0, 'same': True, 'type': 'addresses_D'}, 'OP': 'STOR'} {'dst': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 7, 'same': False, 'type': 'addresses_WC'}, 'OP': 'STOR'} [Faulty Load] {'src': {'NT': True, 'AVXalign': False, 'size': 8, 'congruent': 0, 'same': True, 'type': 'addresses_D'}, 'OP': 'LOAD'} <gen_prepare_buffer> {'dst': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 2, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'STOR'} {'dst': {'NT': False, 'AVXalign': True, 'size': 16, 'congruent': 0, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'STOR'} {'dst': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 8, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'STOR'} {'src': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 11, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'LOAD'} {'src': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 6, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'LOAD'} {'src': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 10, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'LOAD'} {'dst': {'NT': True, 'AVXalign': False, 'size': 2, 'congruent': 11, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'STOR'} {'dst': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 11, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'STOR'} {'src': {'NT': True, 'AVXalign': False, 'size': 32, 'congruent': 11, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'LOAD'} {'51': 21829} 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 */
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ #include <unordered_set> #include <iostream> #include "./imperative_utils.h" #include "../executor/exec_pass.h" #include "./cached_op_threadsafe.h" #include "../profiler/profiler.h" #include "../operator/operator_common.h" #include "../operator/subgraph/common.h" namespace mxnet { DMLC_REGISTER_PARAMETER(CachedOpThreadSafeConfig); constexpr uint32_t kEidNotExist = std::numeric_limits<uint32_t>::max(); struct CachedOpThreadSafe::GraphInfo { nnvm::Graph fwd_graph; }; struct CachedOpThreadSafe::DynamicRuntime { GraphInfo info; std::vector<OpStatePtr> op_states; }; OpStatePtr CachedOpThreadSafe::GetCachedOpState( const Context& ctx) { for (const auto& i : cached_op_states_[ctx]) { // only create one state per device when not using static memory if (!config_.static_alloc || i.unique()) { return i; } } nnvm::Graph full_graph; auto state_ptr = OpStatePtr::Create<CachedOpState>(ctx, fwd_graph_, full_graph, false); cached_op_states_[ctx].push_back(state_ptr); return state_ptr; } CachedOpThreadSafe::CachedOpThreadSafe(const nnvm::Symbol& sym, const std::vector<std::pair<std::string, std::string> >& flags) : CachedOp(sym, flags) { using namespace nnvm; using namespace imperative; static const std::vector<const Op *> zero_ops{Op::Get("zeros_like"), Op::Get("_zeros")}; config_.Init(flags); if (config_.static_shape) { CHECK(config_.static_alloc) << "static_alloc must be True when static_shape is True"; } // construct forward graph CreateForwardGraph(sym.Copy(), &fwd_graph_); SetForwardRefCounts(&fwd_graph_); SetInputIndices(fwd_graph_, config_.param_indices, &config_.data_indices); } /* * \brief Thread safe version of DynamicForward, with thread local buffer * used to store intermediate nodes in the graph */ OpStatePtr CachedOpThreadSafe::DynamicForward(const Context& default_ctx, const std::vector<NDArray*>& inputs, const std::vector<NDArray*>& outputs) { using namespace nnvm; using namespace imperative; auto state_ptr = GetCachedOpState(default_ctx); auto op_state = OpStatePtr::Create<DynamicRuntime>(); auto &runtime = op_state.get_state<DynamicRuntime>(); { auto &state = state_ptr.get_state<CachedOpState>(); // Need to lock the mutex on the state, this allows // for multi context push of ops to dependency engine. // SetForwardGraph runs infer passes on graphs as well // as the planmemory pass. std::lock_guard<std::mutex> lock(state.mutex); // the below call runs the NNVM graph passes: type inference, // shape inference, storage type inference and if the graph // doesn't have dynamic shapes it also plans and allocates memory // for intermediate and final outputs in the graph SetForwardGraph(&state.info, false, inputs); runtime.info.fwd_graph = state.info.fwd_graph; } nnvm::Graph &g = runtime.info.fwd_graph; const auto &idx = g.indexed_graph(); size_t max_nodes = runtime.info.fwd_graph.indexed_graph().num_nodes(); runtime.op_states.resize(max_nodes); auto &states = runtime.op_states; // Allocate entries // This buff is thread local and used to store intermediate // nodes in the graph buff.resize(idx.num_node_entries()); states.resize(idx.num_nodes()); std::vector<NDArray *> arrays; arrays.reserve(buff.size()); for (auto &buffered_array : buff) { arrays.push_back(&buffered_array); } std::vector<OpReqType> array_reqs(arrays.size(), kWriteTo); const auto &dispatch_modes = g.GetAttr<DispatchModeVector>("dispatch_mode"); std::vector<uint32_t> ref_count = g.GetAttr<std::vector<uint32_t>>( "forward_ref_count"); for (size_t i = 0; i < idx.num_node_entries(); ++i) { if (ref_count[i] == 0) array_reqs[i] = kNullOp; } const MemoryPlanVector& mem_plan = g.GetAttr<MemoryPlanVector>("forward_mem_plan"); // Collect input output pointers to ndarray into the arrays data structure CollectInputOutputNDRefs(g, inputs, outputs, &arrays); // The SetForwardGraph call in DynamicForward runs the memory planning phase // and allocates storage for intermediate and final outputs of the graph // We need to still create NDArrays (pointer data structure), based on this // allocated memory from memory planning phase. The CreateGraphNDs below does // that. CreateGraphNDs(g, default_ctx, mem_plan, &array_reqs, &arrays); // Invokes operators in the graph in a topologically sorted manner RunGraph(false, idx, arrays, 0, idx.num_nodes(), std::move(array_reqs), std::move(ref_count), &states, dispatch_modes, false); return op_state; } OpStatePtr CachedOpThreadSafe::Forward(const std::shared_ptr<CachedOp>& op_ptr, const std::vector<NDArray*>& inputs, const std::vector<NDArray*>& outputs) { // Acquiring lock on the mutex in forward // Without this there are issues with static_forward, // specifically with static_shape=True and dynamic_forward. // Adding the lock here for safety, // The perf hit would be acceptable because this involves just pushing // ops to engine and not actual execution // We are putting this lock here because without this there is a hang // in the accept4 call in CUDA lib. // TODO(anirudh2290): Investigate this issue more as it also prevents parallel // push of ops for different contexts std::lock_guard<std::mutex> lock(mutex_); CHECK_EQ(inputs.size(), num_inputs()); Context default_ctx = inputs[0]->ctx(); const auto& idx = fwd_graph_.indexed_graph(); for (size_t i = 0; i < inputs.size(); ++i) { CHECK_EQ(inputs[i]->ctx(), default_ctx) << "CachedOp requires all inputs to live on the same context. But " << idx[idx.input_nodes()[0]].source->attrs.name << " is on " << default_ctx << " while " << idx[idx.input_nodes()[i]].source->attrs.name << " is on " << inputs[i]->ctx(); } int prev_bulk_size = Engine::Get()->set_bulk_size(config_.forward_bulk_size); OpStatePtr op_state; try { if (CheckDynamicShapeExists(default_ctx, inputs, true)) { LOG(FATAL) << "Dynamic shapes aren't supported with thread-safe cached op"; } if (config_.static_alloc) { op_state = StaticForward(default_ctx, inputs, outputs); } else { op_state = DynamicForward(default_ctx, inputs, outputs); } } catch (const dmlc::Error& e) { Engine::Get()->set_bulk_size(prev_bulk_size); throw e; } Engine::Get()->set_bulk_size(prev_bulk_size); return op_state; } struct CachedOpThreadSafeActualState { std::shared_ptr<CachedOp> op; OpStatePtr forward_state; explicit CachedOpThreadSafeActualState(std::shared_ptr<CachedOp> op) { this->op = op; } }; OpStatePtr CreateCachedOpThreadSafeState(const NodeAttrs& attrs, Context ctx, const mxnet::ShapeVector& in_shapes, const std::vector<int>& in_types) { const CachedOpThreadSafePtr& op = nnvm::get<CachedOpThreadSafePtr>(attrs.parsed); return OpStatePtr::Create<CachedOpThreadSafeActualState>(op); } void CachedOpThreadSafeForward(const OpStatePtr& state_ptr, const OpContext& ctx, const std::vector<NDArray>& inputs, const std::vector<OpReqType>& req, const std::vector<NDArray>& outputs) { CachedOpThreadSafeActualState &s = state_ptr.get_state<CachedOpThreadSafeActualState>(); std::vector<NDArray> in_bufs = inputs; std::vector<NDArray> out_bufs = outputs; std::vector<NDArray *> in_ptrs(in_bufs.size()); std::vector<NDArray *> out_ptrs(out_bufs.size()); for (size_t i = 0; i < in_ptrs.size(); i++) in_ptrs[i] = &in_bufs[i]; for (size_t i = 0; i < out_ptrs.size(); i++) out_ptrs[i] = &out_bufs[i]; // Set is_recording correct for the imperative executor. CHECK(!ctx.need_grad) << "Only inference use case supported with thread safe cached op"; CHECK(!ctx.is_train) << "Only inference use case supported with thread safe cached op"; s.forward_state = s.op->Forward(nullptr, in_ptrs, out_ptrs); // The arrays in out_ptrs may be changed by CachedOp. // If it is, we need to copy data back. for (size_t i = 0; i < out_bufs.size(); i++) if (!out_bufs[i].IsSame(outputs[i])) CopyFromTo(out_bufs[i], outputs[i]); } void CachedOpThreadSafeParamParser(nnvm::NodeAttrs* attrs) { CachedOpThreadSafeConfig param; try { param.Init(attrs->dict); } catch (const dmlc::ParamError& e) { std::ostringstream os; os << e.what(); os << ", in operator " << attrs->op->name << "(" << "name=\"" << attrs->name << "\""; for (const auto& k : attrs->dict) { os << ", " << k.first << "=\"" << k.second << "\""; } os << ")"; throw dmlc::ParamError(os.str()); } } CachedOpThreadSafe::~CachedOpThreadSafe() {} NNVM_REGISTER_OP(_CachedOpThreadSafe) .set_num_inputs([](const NodeAttrs& attrs) { const CachedOpThreadSafePtr& op = nnvm::get<CachedOpThreadSafePtr>(attrs.parsed); return op->num_inputs(); }) .set_num_outputs([](const NodeAttrs& attrs) { const CachedOpThreadSafePtr& op = nnvm::get<CachedOpThreadSafePtr>(attrs.parsed); return op->num_outputs(); }) .set_attr_parser(CachedOpThreadSafeParamParser) .set_attr<nnvm::FListInputNames>("FListInputNames", [](const nnvm::NodeAttrs& attrs) { const CachedOpThreadSafePtr& op = nnvm::get<CachedOpThreadSafePtr>(attrs.parsed); return op->ListForwardInputNames(); }) .set_attr<nnvm::FListOutputNames>("FListOutputNames", [](const nnvm::NodeAttrs& attrs) { const CachedOpThreadSafePtr& op = nnvm::get<CachedOpThreadSafePtr>(attrs.parsed); return op->ListForwardOutputNames(); }) .set_attr<FCreateOpState>("FCreateOpState", CreateCachedOpThreadSafeState) .set_attr<mxnet::FInferShape>("FInferShape", [](const nnvm::NodeAttrs& attrs, mxnet::ShapeVector *in_shapes, mxnet::ShapeVector *out_shapes) { const CachedOpThreadSafePtr& op = nnvm::get<CachedOpThreadSafePtr>(attrs.parsed); return op::DefaultSubgraphOpShapeHelper(op->GetForwardSym(), in_shapes, out_shapes); }) .set_attr<nnvm::FInferType>("FInferType", [](const nnvm::NodeAttrs& attrs, std::vector<int> *in_types, std::vector<int> *out_types) { const CachedOpThreadSafePtr& op = nnvm::get<CachedOpThreadSafePtr>(attrs.parsed); return op::DefaultSubgraphOpTypeHelper(op->GetForwardSym(), in_types, out_types); }) .set_attr<FInferStorageType>("FInferStorageType", [](const nnvm::NodeAttrs& attrs, const int dev_mask, DispatchMode* dispatch_mode, std::vector<int>* in_stypes, std::vector<int>* out_stypes) { const CachedOpThreadSafePtr& op = nnvm::get<CachedOpThreadSafePtr>(attrs.parsed); return op::DefaultSubgraphOpStorageTypeHelper(op->GetForwardSym(), dev_mask, dispatch_mode, in_stypes, out_stypes); }) .set_attr<FStatefulComputeEx>("FStatefulComputeEx<cpu>", CachedOpThreadSafeForward) .set_attr<FStatefulComputeEx>("FStatefulComputeEx<gpu>", CachedOpThreadSafeForward) .set_attr<nnvm::FMutateInputs>("FMutateInputs", [](const nnvm::NodeAttrs& attrs) { const CachedOpThreadSafePtr& op = nnvm::get<CachedOpThreadSafePtr>(attrs.parsed); return op::DefaultSubgraphOpMutableInputsHelper(op->GetForwardSym()); }) .set_attr<FResourceRequest>("FResourceRequest", [](const nnvm::NodeAttrs& attrs) { const CachedOpThreadSafePtr& op = nnvm::get<CachedOpThreadSafePtr>(attrs.parsed); return op::DefaultSubgraphOpResourceRequestHelper(op->GetForwardSym()); }) .set_attr<FExecType>("FExecType", op::DefaultSubgraphOpExecType) .add_argument("data", "NDArray-or-Symbol[]", "input data list"); } // namespace mxnet
; A333321: a(n) is the number of subsets of {1..n} that contain exactly 1 odd and 4 even numbers. ; 0,0,0,0,0,0,0,0,4,5,25,30,90,105,245,280,560,630,1134,1260,2100,2310,3630,3960,5940,6435,9295,10010,14014,15015,20475,21840,29120,30940,40460,42840,55080,58140,73644,77520,96900,101745,125685,131670,160930,168245,203665,212520,255024,265650,316250,328900,388700,403650,473850,491400,573300,593775,688779,712530,822150,849555,975415,1006880,1150720,1186680,1350360,1391280,1576784,1623160,1832600,1884960,2120580,2179485,2443665,2509710,2804970,2878785,3207789,3290040,3655600,3746990,4152070,4253340 mov $1,$0 div $0,2 bin $0,4 add $1,1 div $1,2 mul $0,$1
/* ** ClanLib SDK ** Copyright (c) 1997-2020 The ClanLib Team ** ** This software is provided 'as-is', without any express or implied ** warranty. In no event will the authors be held liable for any damages ** arising from the use of this software. ** ** Permission is granted to anyone to use this software for any purpose, ** including commercial applications, and to alter it and redistribute it ** freely, subject to the following restrictions: ** ** 1. The origin of this software must not be misrepresented; you must not ** claim that you wrote the original software. If you use this software ** in a product, an acknowledgment in the product documentation would be ** appreciated but is not required. ** 2. Altered source versions must be plainly marked as such, and must not be ** misrepresented as being the original software. ** 3. This notice may not be removed or altered from any source distribution. ** ** Note: Some of the libraries ClanLib may link to may have additional ** requirements or restrictions. ** ** File Author(s): ** ** Magnus Norddahl ** Mark Page */ #include "Display/precomp.h" #include "render_batch_path.h" #include "sprite_impl.h" #include "API/Display/Render/blend_state_description.h" #include "API/Display/2D/canvas.h" #include "API/Core/Math/quad.h" #include "path_impl.h" #include "render_batch_buffer.h" namespace clan { RenderBatchPath::RenderBatchPath(GraphicContext &gc, RenderBatchBuffer *batch_buffer) : batch_buffer(batch_buffer), fill_renderer(gc, batch_buffer), stroke_renderer(gc) { } inline Pointf RenderBatchPath::to_position(const clan::Pointf &point) const { return Pointf( modelview_matrix.matrix[0 * 4 + 0] * point.x + modelview_matrix.matrix[1 * 4 + 0] * point.y + modelview_matrix.matrix[3 * 4 + 0], modelview_matrix.matrix[0 * 4 + 1] * point.x + modelview_matrix.matrix[1 * 4 + 1] * point.y + modelview_matrix.matrix[3 * 4 + 1]); } void RenderBatchPath::fill(Canvas &canvas, const Path &path, const Brush &brush) { canvas.set_batcher(this); fill_renderer.set_size(canvas, canvas.get_gc().get_width(), canvas.get_gc().get_height()); fill_renderer.clear(); render(path, &fill_renderer); fill_renderer.fill(canvas, path.get_impl()->fill_mode, brush, modelview_matrix); } void RenderBatchPath::stroke(Canvas &canvas, const Path &path, const Pen &pen) { canvas.set_batcher(this); stroke_renderer.set_pen(canvas, pen); render(path, &stroke_renderer); } void RenderBatchPath::flush(GraphicContext &gc) { fill_renderer.flush(gc); } void RenderBatchPath::matrix_changed(const Mat4f &new_modelview, const Mat4f &new_projection, TextureImageYAxis image_yaxis, float pixel_ratio) { // We ignore the projection fill_renderer.set_yaxis(image_yaxis); modelview_matrix = Mat4f::scale(pixel_ratio, pixel_ratio, 1.0f) * new_modelview; } void RenderBatchPath::render(const Path &path, PathRenderer *path_renderer) { for (const auto &subpath : path.get_impl()->subpaths) { clan::Pointf start_point = to_position(subpath.points[0]); path_renderer->begin(start_point.x, start_point.y); size_t i = 1; for (PathCommand command : subpath.commands) { if (command == PathCommand::line) { clan::Pointf next_point = to_position(subpath.points[i]); i++; path_renderer->line(next_point.x, next_point.y); } else if (command == PathCommand::quadradic) { clan::Pointf control = to_position(subpath.points[i]); clan::Pointf next_point = to_position(subpath.points[i + 1]); i += 2; path_renderer->quadratic_bezier(control.x, control.y, next_point.x, next_point.y); } else if (command == PathCommand::cubic) { clan::Pointf control1 = to_position(subpath.points[i]); clan::Pointf control2 = to_position(subpath.points[i + 1]); clan::Pointf next_point = to_position(subpath.points[i + 2]); i += 3; path_renderer->cubic_bezier(control1.x, control1.y, control2.x, control2.y, next_point.x, next_point.y); } } path_renderer->end(subpath.closed); } } }
;************************************************************************** ; arch/z80/src/z80/z80_head.asm ; ; Licensed to the Apache Software Foundation (ASF) under one or more ; contributor license agreements. See the NOTICE file distributed with ; this work for additional information regarding copyright ownership. The ; ASF licenses this file to you under the Apache License, Version 2.0 (the ; "License"); you may not use this file except in compliance with the ; License. You may obtain a copy of the License at ; ; http://www.apache.org/licenses/LICENSE-2.0 ; ; Unless required by applicable law or agreed to in writing, software ; distributed under the License is distributed on an "AS IS" BASIS, WITHOUT ; WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the ; License for the specific language governing permissions and limitations ; under the License. ; ;************************************************************************** .title NuttX for the Z80 .module z80_head ;************************************************************************** ; Constants ;************************************************************************** ; Register save area layout XCPT_I == 0 ; Offset 0: Saved I w/interrupt state in carry XCPT_BC == 2 ; Offset 1: Saved BC register XCPT_DE == 4 ; Offset 2: Saved DE register XCPT_IX == 6 ; Offset 3: Saved IX register XCPT_IY == 8 ; Offset 4: Saved IY register XCPT_SP == 10 ; Offset 5: Offset to SP at time of interrupt XCPT_HL == 12 ; Offset 6: Saved HL register XCPT_AF == 14 ; Offset 7: Saved AF register XCPT_PC == 16 ; Offset 8: Offset to PC at time of interrupt ; Default stack base (needs to be fixed) .include "asm_mem.h" ;************************************************************************** ; Global symbols used ;************************************************************************** .globl _nx_start ; OS entry point .globl _z80_doirq ; Interrupt decoding logic ;************************************************************************** ; Reset entry point ;************************************************************************** .area _HEADER (ABS) .org 0x0000 di ; Disable interrupts im 1 ; Set interrupt mode 1 jr _up_reset ; And boot the system ;************************************************************************** ; Other reset handlers ; ; Interrupt mode 1 behavior: ; ; 1. M1 cycle: 7 ticks ; Acknowledge interrupt and decrements SP ; 2. M2 cycle: 3 ticks ; Writes the MS byte of the PC onto the stack and decrements SP ; 3. M3 cycle: 3 ticks ; Writes the LS byte of the PC onto the stack and sets the PC to 0x0038. ; ;************************************************************************** .org 0x0008 ; RST 1 ; Save AF on the stack, set the interrupt number and jump to the ; common reset handling logic. ; Offset 8: Return PC is already on the stack push af ; Offset 7: AF (retaining flags) ld a, #1 ; 1 = Z80_RST1 jr _up_rstcommon ; Remaining RST handling is common .org 0x0010 ; RST 2 ; Save AF on the stack, set the interrupt number and jump to the ; common reset handling logic. ; Offset 8: Return PC is already on the stack push af ; Offset 7: AF (retaining flags) ld a, #2 ; 2 = Z80_RST2 jr _up_rstcommon ; Remaining RST handling is common .org 0x0018 ; RST 3 ; Save AF on the stack, set the interrupt number and jump to the ; common reset handling logic. ; Offset 8: Return PC is already on the stack push af ; Offset 7: AF (retaining flags) ld a, #3 ; 1 = Z80_RST3 jr _up_rstcommon ; Remaining RST handling is common .org 0x0020 ; RST 4 ; Save AF on the stack, set the interrupt number and jump to the ; common reset handling logic. ; Offset 8: Return PC is already on the stack push af ; Offset 7: AF (retaining flags) ld a, #4 ; 1 = Z80_RST4 jr _up_rstcommon ; Remaining RST handling is common .org 0x0028 ; RST 5 ; Save AF on the stack, set the interrupt number and jump to the ; common reset handling logic. ; Offset 8: Return PC is already on the stack push af ; Offset 7: AF (retaining flags) ld a, #5 ; 1 = Z80_RST5 jr _up_rstcommon ; Remaining RST handling is common .org 0x0030 ; RST 6 ; Save AF on the stack, set the interrupt number and jump to the ; common reset handling logic. ; Offset 8: Return PC is already on the stack push af ; Offset 7: AF (retaining flags) ld a, #6 ; 1 = Z80_RST6 jr _up_rstcommon ; Remaining RST handling is common .org 0x0038 ; Int mode 1 / RST 7 ; Save AF on the stack, set the interrupt number and jump to the ; common reset handling logic. ; Offset 8: Return PC is already on the stack push af ; Offset 7: AF (retaining flags) ld a, #7 ; 7 = Z80_RST7 jr _up_rstcommon ; Remaining RST handling is common ;************************************************************************** ; NMI interrupt handler ;************************************************************************** .org 0x0066 retn ;************************************************************************** ; System start logic ;************************************************************************** _up_reset: ; Set up the stack pointer at the location determined the Makefile ; and stored in asm_mem.h ld SP, #CONFIG_STACK_END ; Set stack pointer ; Performed initialization unique to the SDCC toolchain call gsinit ; Initialize the data section ; Then start NuttX call _nx_start ; jump to the OS entry point ; NuttX will never return, but just in case... _up_halt:: halt ; We should never get here jp _up_halt ;************************************************************************** ; Common Interrupt handler ;************************************************************************** _up_rstcommon:: ; Create a register frame. SP points to top of frame + 4, pushes ; decrement the stack pointer. Already have ; ; Offset 8: Return PC is already on the stack ; Offset 7: AF (retaining flags) ; ; IRQ number is in A push hl ; Offset 6: HL ld hl, #(3*2) ; HL is the value of the stack pointer before add hl, sp ; the interrupt occurred push hl ; Offset 5: Stack pointer push iy ; Offset 4: IY push ix ; Offset 3: IX push de ; Offset 2: DE push bc ; Offset 1: BC ld b, a ; Save the reset number in B ld a, i ; Parity bit holds interrupt state push af ; Offset 0: I with interrupt state in parity di ; Call the interrupt decode logic. SP points to the beginning of the reg structure ld hl, #0 ; Argument #2 is the beginning of the reg structure add hl, sp ; push hl ; Place argument #2 at the top of stack push bc ; Argument #1 is the Reset number inc sp ; (make byte sized) call _z80_doirq ; Decode the IRQ ; On return, HL points to the beginning of the reg structure to restore ; Note that (1) the arguments pushed on the stack are not popped, and (2) the ; original stack pointer is lost. In the normal case (no context switch), ; HL will contain the value of the SP before the arguments were pushed. ld sp, hl ; Use the new stack pointer ; Restore registers. HL points to the beginning of the reg structure to restore ex af, af' ; Select alternate AF pop af ; Offset 0: AF' = I with interrupt state in carry ex af, af' ; Restore original AF pop bc ; Offset 1: BC pop de ; Offset 2: DE pop ix ; Offset 3: IX pop iy ; Offset 4: IY exx ; Use alternate BC/DE/HL ld hl, #-2 ; Offset of SP to account for ret addr on stack pop de ; Offset 5: HL' = Stack pointer after return add hl, de ; HL = Stack pointer value before return exx ; Restore original BC/DE/HL pop hl ; Offset 6: HL pop af ; Offset 7: AF ; Restore the stack pointer exx ; Use alternate BC/DE/HL ld sp, hl ; Set SP = saved stack pointer value before return exx ; Restore original BC/DE/HL ; Restore interrupt state ex af, af' ; Recover interrupt state jp po, nointenable ; Odd parity, IFF2=0, means disabled ex af, af' ; Restore AF (before enabling interrupts) ei ; yes reti nointenable:: ex af, af' ; Restore AF reti ;************************************************************************** ; Ordering of segments for the linker (SDCC only) ;************************************************************************** .area _HOME .area _CODE .area _INITIALIZER .area _GSINIT .area _GSFINAL .area _DATA .area _INITIALIZED .area _BSEG .area _BSS .area _HEAP ;************************************************************************** ; Global data initialization logic (SDCC only) ;************************************************************************** .area _GSINIT gsinit:: ld bc, #l__INITIALIZER ld a, b or a, c jr Z, gsinit_next ld de, #s__INITIALIZED ld hl, #s__INITIALIZER ldir gsinit_next: .area _GSFINAL ret ;************************************************************************** ; The start of the heap (SDCC only). Note that is actually resides in ; the _CODE area (which may be FLASH or ROM) ;************************************************************************** .area _CODE _g_heapbase:: .dw #s__HEAP
; A022316: a(n) = a(n-1) + a(n-2) + 1, with a(0) = 0 and a(1) = 11. ; 0,11,12,24,37,62,100,163,264,428,693,1122,1816,2939,4756,7696,12453,20150,32604,52755,85360,138116,223477,361594,585072,946667,1531740,2478408,4010149,6488558,10498708,16987267,27485976,44473244,71959221,116432466,188391688,304824155,493215844,798040000,1291255845,2089295846,3380551692,5469847539,8850399232,14320246772,23170646005,37490892778,60661538784,98152431563,158813970348,256966401912,415780372261,672746774174,1088527146436,1761273920611,2849801067048,4611074987660,7460876054709,12071951042370,19532827097080,31604778139451,51137605236532,82742383375984,133879988612517,216622371988502,350502360601020,567124732589523,917627093190544,1484751825780068,2402378918970613,3887130744750682,6289509663721296,10176640408471979,16466150072193276,26642790480665256,43108940552858533,69751731033523790,112860671586382324,182612402619906115,295473074206288440,478085476826194556,773558551032482997,1251644027858677554,2025202578891160552,3276846606749838107,5302049185640998660,8578895792390836768,13880944978031835429,22459840770422672198,36340785748454507628,58800626518877179827,95141412267331687456,153942038786208867284,249083451053540554741,403025489839749422026,652108940893289976768,1055134430733039398795,1707243371626329375564,2762377802359368774360 seq $0,22102 ; Fibonacci sequence beginning 1, 12. sub $0,1
; A120893: a(n) = 3*a(n-1) + 3*a(n-2) - a(n-3); a(0)=1, a(1)=1, a(2)=5. ; 1,1,5,17,65,241,901,3361,12545,46817,174725,652081,2433601,9082321,33895685,126500417,472105985,1761923521,6575588101,24540428881,91586127425,341804080817,1275630195845,4760716702561,17767236614401,66308229755041,247465682405765,923554499868017,3446752317066305 mov $3,$0 add $3,1 mov $15,$0 lpb $3 mov $0,$15 sub $3,1 sub $0,$3 mov $11,$0 mov $13,2 lpb $13 mov $0,$11 sub $13,1 add $0,$13 sub $0,1 mov $7,$0 mov $9,2 lpb $9 mov $0,$7 sub $9,1 add $0,$9 sub $0,1 mov $4,1 mov $6,1 lpb $0 sub $0,1 add $4,$6 add $6,$4 add $6,$4 lpe mov $4,$6 div $4,3 add $4,1 mov $2,$4 mul $2,5 mov $5,$2 mov $10,$9 lpb $10 mov $8,$5 sub $10,1 lpe lpe lpb $7 mov $7,0 sub $8,$5 lpe mov $5,$8 mov $14,$13 lpb $14 mov $12,$5 sub $14,1 lpe lpe lpb $11 mov $11,0 sub $12,$5 lpe mov $5,$12 div $5,5 add $1,$5 lpe
#include "problemes.h" #include "arithmetique.h" #include <fstream> #include <boost/algorithm/string.hpp> typedef unsigned long long nombre; typedef std::vector<nombre> vecteur; typedef std::vector<vecteur> matrice; ENREGISTRER_PROBLEME(81, "Path sum: two ways") { // In the 5 by 5 matrix below, the minimal path sum from the top left to the bottom right, by // only moving to the right and down, is indicated in bold red and is equal to 2427. // // 131 673 234 103 18 // 201 96 342 965 150 // 630 803 746 422 111 // 537 699 497 121 956 // 805 732 524 37 331 // // Find the minimal path sum, in matrix.txt (right click and "Save Link/Target As..."), a 31K // text file containing a 80 by 80 matrix, from the top left to the bottom right by only moving // right and down. matrice graphe; std::ifstream ifs("data/p081_matrix.txt"); std::string ligne; while (ifs >> ligne) { std::vector<std::string> v; boost::split(v, ligne, boost::is_any_of(",")); vecteur l; for (const auto &s: v) { l.push_back(std::stoull(s)); } graphe.push_back(std::move(l)); } const nombre taille = graphe.size(); matrice chemin(taille, vecteur(taille, 0)); for (size_t i = 0; i < taille; ++i) for (size_t j = 0; j < taille; ++j) { if (i == 0 && j == 0) chemin[i][j] = graphe[i][j]; else if (i == 0) chemin[i][j] = graphe[i][j] + chemin[i][j - 1]; else if (j == 0) chemin[i][j] = graphe[i][j] + chemin[i - 1][j]; else chemin[i][j] = graphe[i][j] + std::min(chemin[i][j - 1], chemin[i - 1][j]); } return std::to_string(chemin.back().back()); }
#include "stdafx.h" #include "Solution.h" #include "Armor.h" #include "Decoration.h" #include "Skill.h" using namespace System; ref struct CalculationData { Query^ query; Solution^ solution; AbilityMap need; Map_t< Skill^, int > relevant; List_t< List_t< Decoration^ >^ > rel_decoration_map; List_t< Ability^ > at_risk; }; bool Query::HRMatches( const unsigned item_hr, const unsigned item_lv ) { return item_hr <= hr || item_lv <= level; } bool Detrimental( Decoration^ dec, CalculationData^ data, const int multiplier ) { if( dec->abilities.Count < 2 || !dec->abilities[ 1 ]->ability->relevant ) return false; const int have = data->solution->abilities[ dec->abilities[ 1 ]->ability ]; const int need = data->need[ dec->abilities[ 1 ]->ability ]; return have + dec->abilities[ 1 ]->amount * multiplier < need; } void AddAbilities( AbilityMap% total, List_t< AbilityPair^ >% abilities, const int multiplier ) { for each( AbilityPair^ ap in abilities ) { if( ap->ability == SpecificAbility::torso_inc ) continue; if( total.ContainsKey( ap->ability ) ) total[ ap->ability ] += ap->amount * multiplier; else total.Add( ap->ability, ap->amount * multiplier ); } } bool AddDecoration( Solution^ solution, Decoration^ deco, const int multiplier, List_t< Decoration^ >% deco_list ) { solution->decorations.Add( deco ); deco_list.Add( deco ); AddAbilities( solution->abilities, deco->abilities, multiplier ); solution->total_slots_spare -= deco->slots_required; return solution->abilities[ deco->abilities[ 0 ]->ability ] > -10; } Decoration^ GetBestAvailableDecoration( CalculationData^ data, Ability^ ability, const unsigned slots_spare ) { return ability->relevant ? Decoration::GetBestDecoration( ability, slots_spare, data->rel_decoration_map ) : Decoration::GetBestDecoration( ability, slots_spare, data->query->hr, data->query->level ); } bool Solution::FixBadSkill( Skill^ skill ) { while( torso_slots_spare > 0 ) { Decoration^ dec = GetBestAvailableDecoration( data, skill->ability, torso_slots_spare ); if( !dec || Detrimental( dec, data, torso_multiplier ) ) return false; torso_slots_spare -= dec->slots_required; if( AddDecoration( data->solution, dec, torso_multiplier, body_decorations ) ) return true; } int max_slots = 3; while( max_slots > 0 && !slots_spare[ max_slots ] ) max_slots--; if( max_slots == 0 ) return false; const int have = abilities[ skill->ability ]; const unsigned points_required = -9 - have; Decoration^ dec; for( int slot_size = 1; slot_size <= max_slots; ++slot_size ) { if( dec = GetBestAvailableDecoration( data, skill->ability, slot_size ) ) { if( dec->abilities[ 0 ]->amount >= (int)points_required ) break; } } if( !dec ) return false; while( max_slots > 0 ) { if( Detrimental( dec, data, 1 ) ) return false; if( slots_spare[ dec->slots_required ] == 0 ) { if( slots_spare[ dec->slots_required + 1 ] == 0 ) { slots_spare[ 3 ]--; slots_spare[ 2 ]++; } else { slots_spare[ dec->slots_required + 1 ]--; slots_spare[ 1 ]++; } } else slots_spare[ dec->slots_required ]--; if( AddDecoration( data->solution, dec, 1, non_body_decorations ) ) return true; if( slots_spare[ max_slots ] > 0 ) continue; while( max_slots > 0 && !slots_spare[ max_slots ] ) dec = GetBestAvailableDecoration( data, skill->ability, --max_slots ); } return false; } bool Solution::FixBadSkills( Query^ query ) { for each( Skill^ skill in bad_skills ) { if( !FixBadSkill( skill ) ) return false; } CalculateExtraSkills( query ); return bad_skills.Count == 0; } bool Solution::CheckBadSkills( Query^ query ) { return bad_skills.Count == 0 || ( total_slots_spare > 0 && FixBadSkills( query ) ) || ReorderGems( query ); } Decoration^ Solution::Count1SocketGems( Ability^ ability, int& num ) { num = 0; Map_t< Decoration^, unsigned > deco_count; Decoration^ best = nullptr; for each( Decoration^ dec in decorations ) { if( dec->slots_required == 1 && dec->abilities.Count == 2 && dec->abilities[ 1 ]->ability == ability ) { if( deco_count.ContainsKey( dec ) ) { const int n = ++deco_count[ dec ]; if( n > num ) { num = n; best = dec; } } else { deco_count.Add( dec, 1 ); if( num == 0 ) { num = 1; best = dec; } } } } return best; } int Solution::GetReplacable( Ability^ ability, unsigned slots ) { for( int i = 0; i < decorations.Count; ++i ) if( decorations[ i ]->slots_required == slots && decorations[ i ]->abilities.Count > 1 && decorations[ i ]->abilities[ 1 ]->ability != ability ) return i; return -1; } bool Solution::ReorderGems( Query^ query ) { //return false; for each( Skill^ skill in bad_skills ) { if( abilities[ skill->ability ] < -9 ) { int num_1_socketed; Decoration^ one_slot = Count1SocketGems( skill->ability, num_1_socketed ); if( num_1_socketed == 0 ) return false; Decoration^ bigger_slotted = GetBestAvailableDecoration( data, one_slot->abilities[ 0 ]->ability, 3 ); const int num_required = bigger_slotted->abilities[ 0 ]->amount; if( num_1_socketed < num_required ) return false; const int other = GetReplacable( skill->ability, bigger_slotted->slots_required ); Assert( other == -1 || decorations[ other ]->abilities.Count == 2, L"Failed to replace gems" ); if( other != -1 && num_1_socketed >= decorations[ other ]->abilities[ 0 ]->amount && abilities[ decorations[ other ]->abilities[ 1 ]->ability ] > -8 ) { Decoration^ other_one_slot = Decoration::static_decoration_ability_map[ decorations[ other ]->abilities[ 0 ]->ability ][ 0 ]; Replace( other, bigger_slotted ); int num_replaced = 0; int num_to_replace = decorations[ other ]->abilities[ 0 ]->amount > num_required ? decorations[ other ]->abilities[ 0 ]->amount : num_required; for( int i = 0; i < decorations.Count; ++i ) { if( decorations[ i ] == one_slot && num_replaced++ < num_to_replace ) Replace( i, other_one_slot ); } if( other_one_slot->abilities.Count > 1 ) { const int other_have = abilities.ContainsKey( other_one_slot->abilities[ 1 ]->ability ) ? abilities[ other_one_slot->abilities[ 1 ]->ability ] : 0; const int other_need = data->need.ContainsKey( other_one_slot->abilities[ 1 ]->ability ) ? data->need[ other_one_slot->abilities[ 1 ]->ability ] : 0; if( other_have < other_need ) return false; } if( abilities[ skill->ability ] < -9 ) return false; } else return false; } } CalculateExtraSkills( query ); reordered_to_fix = true; return true; } void Solution::Replace( const unsigned index, Decoration^ decoration ) { for each( AbilityPair^ apair in decorations[ index ]->abilities ) { abilities[ apair->ability ] -= apair->amount; } decorations[ index ] = decoration; for each( AbilityPair^ apair in decoration->abilities ) { if( abilities.ContainsKey( apair->ability ) ) abilities[ apair->ability ] += apair->amount; else abilities.Add( apair->ability, apair->amount ); } } void AddInitialArmor( Armor^ armor, Solution^ solution, const int multiplier ) { if( armor ) { solution->slots_spare[ armor->num_slots ] += ( armor != solution->armors[ 1 ] ) * !!armor->num_slots; solution->defence += armor->defence; solution->max_defence += armor->max_defence; solution->ice_res += armor->ice_res; solution->fire_res += armor->fire_res; solution->water_res += armor->water_res; solution->dragon_res += armor->dragon_res; solution->thunder_res += armor->thunder_res; if( armor->rarity != 99 ) solution->rarity += armor->rarity; solution->difficulty += armor->difficulty; AddAbilities( solution->abilities, armor->abilities, multiplier ); solution->torso_multiplier += armor->torso_inc; solution->total_slots_spare += armor->num_slots; } } void GetInitialData( CalculationData^ data ) { for each( Skill^ skill in data->query->skills ) { if( !skill->is_taunt ) { data->need.Add( skill->ability, skill->points_required ); data->relevant.Add( skill, 0 ); } data->solution->abilities.Add( skill->ability, 0 ); } if( data->solution->charm ) { for each( AbilityPair^ ap in data->solution->charm->abilities ) { if( !data->need.ContainsKey( ap->ability ) ) data->need.Add( ap->ability, 0 ); } } data->solution->total_slots_spare = data->query->weapon_slots_allowed; data->solution->torso_multiplier = 1; data->solution->slots_spare = gcnew array< unsigned >( 4 ); data->solution->slots_spare[ data->query->weapon_slots_allowed ] += !!data->query->weapon_slots_allowed; if( data->solution->armors[ 1 ] ) data->solution->torso_slots_spare = data->solution->armors[ 1 ]->num_slots; else data->solution->torso_slots_spare = 0; data->solution->defence = data->solution->max_defence = data->solution->fire_res = data->solution->ice_res = data->solution->water_res = data->solution->thunder_res = data->solution->dragon_res = data->solution->rarity = data->solution->difficulty = 0; AddInitialArmor( data->solution->armors[ 0 ], data->solution, 1 ); AddInitialArmor( data->solution->armors[ 2 ], data->solution, 1 ); AddInitialArmor( data->solution->armors[ 3 ], data->solution, 1 ); AddInitialArmor( data->solution->armors[ 4 ], data->solution, 1 ); AddInitialArmor( data->solution->armors[ 1 ], data->solution, data->solution->torso_multiplier ); data->solution->CalculateFamilyScore(); if( data->solution->charm ) { data->solution->slots_spare[ data->solution->charm->num_slots ] += !!data->solution->charm->num_slots; data->solution->total_slots_spare += data->solution->charm->num_slots; AddAbilities( data->solution->abilities, data->solution->charm->abilities, 1 ); } for each( Decoration^ deco in data->query->rel_decorations ) { if( deco->abilities.Count > 1 && deco->abilities[1]->amount < 0 && deco->abilities[1]->ability->relevant /*&& data->solution->abilities[ deco->abilities[1]->ability ] >= data->need[ deco->abilities[1]->ability ]*/ ) data->at_risk.Add( deco->abilities[1]->ability ); } } ref class DecorationComparer : Collections::Generic::IComparer< Decoration^ > { CalculationData^ data; public: DecorationComparer( CalculationData^ data ) : data( data ) {} virtual int Compare( Decoration^ d1, Decoration^ d2 ) sealed { Ability^ a1 = d1->abilities[ 0 ]->ability; Ability^ a2 = d2->abilities[ 0 ]->ability; int need1 = data->need[ a1 ] - data->solution->abilities[ a1 ]; int need2 = data->need[ a2 ] - data->solution->abilities[ a2 ]; if( d1->abilities.Count > 1 && d1->abilities[1]->ability->relevant ) need1 += 100; if( d2->abilities.Count > 1 && d2->abilities[1]->ability->relevant ) need2 += 100; //sort decoration by most-needed first return need2 - need1; } }; template< bool allow_bad, bool allow_overkill, bool allow_detrimental > void AddDecorations1( CalculationData^ data, unsigned% num_slots, const int multiplier, List_t< Decoration^ >% deco_list ) { List_t< Decoration^ >^ rel_decorations = data->rel_decoration_map[ 1 ]; if( num_slots == 0 || rel_decorations->Count == 0 ) return; rel_decorations = gcnew List_t< Decoration^ >( data->rel_decoration_map[ 1 ] ); DecorationComparer comp( data ); rel_decorations->Sort( %comp ); bool loop = true; int i = 0; while( loop ) { Decoration^ decoration = rel_decorations[ i ]; if( allow_detrimental || !Detrimental( decoration, data, multiplier ) ) { AbilityPair^ apair = decoration->abilities[ 0 ]; Assert( apair->amount > 0, L"Decoration's first skill is negative?" ); if( allow_bad || decoration->abilities.Count < 2 || !data->solution->abilities.ContainsKey( decoration->abilities[ 1 ]->ability ) || data->solution->abilities[ decoration->abilities[ 1 ]->ability ] + decoration->abilities[ 1 ]->amount * multiplier > -10 ) { const int current_amount = data->solution->abilities[ apair->ability ]; const int decoration_amount = apair->amount * multiplier; const int needed_amount = data->need[ apair->ability ]; if( decoration_amount > 0 && current_amount < needed_amount && ( allow_overkill || current_amount + decoration_amount <= needed_amount + apair->amount - 1 ) ) { loop = true; AddDecoration( data->solution, decoration, multiplier, deco_list ); if( --num_slots == 0 ) return; --i; } } } if( ++i == rel_decorations->Count ) { loop = false; i = 0; } } } ref struct PossibleDecoration { Decoration^ decoration; int points_given; }; generic< typename T > T GetLast( List_t< T >% l ) { return l[ l.Count - 1 ]; } //pair( good, bad ) cliext::pair< int, int > GetScore( Decoration^ decoration, CalculationData^ data, const unsigned actual_good ) { static int point_score3[ 6 ] = { 0, 1, 2, 3, 5, 4 }; int good = decoration->slots_required == 3 ? point_score3[ actual_good ] : actual_good; if( !decoration->abilities[0]->ability->has_1slot_decorations ) good += 100; if( decoration->abilities.Count > 1 && decoration->abilities[1]->ability->relevant ) good += 10; const int bad = decoration->abilities.Count == 1 ? 0 : ( data->solution->abilities.ContainsKey( GetLast( decoration->abilities )->ability ) ? data->solution->abilities[ GetLast( decoration->abilities )->ability ] : 0 ); return cliext::make_pair( good , bad ); } PossibleDecoration^ GetBestDecoration( List_t< PossibleDecoration^ >% decorations, CalculationData^ data ) { unsigned best = 0; cliext::pair< int, int > score = GetScore( decorations[ best ]->decoration, data, decorations[ best ]->points_given ); for( int i = 1; i < decorations.Count; ++i ) { cliext::pair< int, int > curr_score = GetScore( decorations[ i ]->decoration, data, decorations[ i ]->points_given ); if( curr_score.first >= score.first || curr_score.first == score.first && curr_score.second > score.second ) { score = curr_score; best = i; } } return decorations[ best ]; } bool IsCharmAbility( Charm^ charm, Ability^ ab ) { return charm && charm->abilities.Count > 0 && charm->abilities[ 0 ]->ability == ab; } template< bool allow_bad, bool allow_detrimental > void AddDecorations23( CalculationData^ data, const unsigned size, unsigned& num_slots, const int multiplier, List_t< Decoration^ >% deco_list ) { List_t< Decoration^ >^ rel_decorations = data->rel_decoration_map[ size ]; if( num_slots == 0 || rel_decorations->Count == 0 ) return; bool loop = true; int i = 0; List_t< PossibleDecoration^ > possible_decorations; while( loop ) { Decoration^ deco = rel_decorations[ i ]; if( allow_detrimental || !Detrimental( deco, data, multiplier ) ) { AbilityPair^ apair = deco->abilities[ 0 ]; Assert( apair->amount > 0, L"Decoration's first skill is negative!?" ); if( allow_bad || deco->abilities.Count < 2 || !data->solution->abilities.ContainsKey( deco->abilities[ 1 ]->ability ) || data->solution->abilities[ deco->abilities[ 1 ]->ability ] + deco->abilities[ 1 ]->amount * multiplier > -10 ) { const int current_amount = data->solution->abilities[ apair->ability ]; const int decoration_amount = apair->amount * multiplier; const int needed_amount = data->need[ apair->ability ]; if( decoration_amount > 0 && current_amount < needed_amount && current_amount + decoration_amount <= needed_amount + !apair->ability->has_1slot_decorations + Utility::Contains( %data->at_risk, deco->abilities[ 0 ]->ability ) ) { loop = true; PossibleDecoration^ possible = gcnew PossibleDecoration; possible->decoration = deco; if( IsCharmAbility( data->solution->charm, apair->ability ) ) possible->points_given = decoration_amount; else possible->points_given = Min( decoration_amount, needed_amount - current_amount ); possible_decorations.Add( possible ); } } } if( ++i == rel_decorations->Count ) { loop = false; i = 0; } } if( possible_decorations.Count > 0 ) { PossibleDecoration^ best = GetBestDecoration( possible_decorations, data ); const bool good_deco = allow_bad || !Detrimental( best->decoration, data, multiplier ); Assert( good_deco, L"Best decoration isn't good?" ); AddDecoration( data->solution, best->decoration, multiplier, deco_list ); if( --num_slots > 0 ) AddDecorations23< allow_bad, allow_detrimental >( data, size, num_slots, multiplier, deco_list ); } } template< bool allow_bad, bool allow_detrimental > void CalculateDecorations( CalculationData^ data ) { unsigned body_slots[ 4 ] = { 0, 0, 0, 0 }; unsigned temp_slots[ 4 ] = { 0, 0, 0, 0 }; //get initial slot configuration and sort decorations by size for( int i = 1; i < 4; ++i ) { temp_slots[ i ] = data->solution->slots_spare[ i ]; } body_slots[ data->solution->torso_slots_spare ] += !!data->solution->torso_slots_spare; //try adding torso decorations first AddDecorations23< allow_bad, allow_detrimental >( data, 3, body_slots[ 3 ], data->solution->torso_multiplier, data->solution->body_decorations ); body_slots[ 1 ] += body_slots[ 3 ]; body_slots[ 2 ] += body_slots[ 3 ]; body_slots[ 3 ] = 0; if( data->solution->torso_multiplier >= 3 ) { AddDecorations23< allow_bad, allow_detrimental >( data, 2, body_slots[ 2 ], data->solution->torso_multiplier, data->solution->body_decorations ); body_slots[ 1 ] += 2 * body_slots[ 2 ]; body_slots[ 2 ] = 0; AddDecorations1< allow_bad, false, allow_detrimental >( data, body_slots[ 1 ], data->solution->torso_multiplier, data->solution->body_decorations ); } AddDecorations23< allow_bad, allow_detrimental >( data, 3, temp_slots[ 3 ], 1, data->solution->non_body_decorations ); data->solution->slots_spare[ 3 ] -= data->solution->slots_spare[ 3 ] - temp_slots[ 3 ]; temp_slots[ 1 ] += temp_slots[ 3 ]; temp_slots[ 2 ] += temp_slots[ 3 ]; temp_slots[ 3 ] = 0; if( data->solution->torso_multiplier < 4 ) { AddDecorations23< allow_bad, allow_detrimental >( data, 2, body_slots[ 2 ], data->solution->torso_multiplier, data->solution->body_decorations ); body_slots[ 1 ] += 2 * body_slots[ 2 ]; body_slots[ 2 ] = 0; if( data->solution->torso_multiplier == 3 ) AddDecorations1< allow_bad, false, allow_detrimental >( data, body_slots[ 1 ], data->solution->torso_multiplier, data->solution->body_decorations ); } { const unsigned temp = temp_slots[ 2 ]; AddDecorations23< allow_bad, allow_detrimental >( data, 2, temp_slots[ 2 ], 1, data->solution->non_body_decorations ); const unsigned num_2slot_decorations = temp - temp_slots[ 2 ]; if( num_2slot_decorations > data->solution->slots_spare[ 2 ] ) { const unsigned to_convert = num_2slot_decorations - data->solution->slots_spare[ 2 ]; data->solution->slots_spare[ 3 ] -= to_convert; data->solution->slots_spare[ 2 ] = 0; data->solution->slots_spare[ 1 ] += to_convert; } else data->solution->slots_spare[ 2 ] -= num_2slot_decorations; } temp_slots[ 1 ] += 2 * temp_slots[ 2 ]; temp_slots[ 2 ] = 0; if( data->solution->torso_multiplier < 3 ) AddDecorations1< allow_bad, false, allow_detrimental >( data, body_slots[ 1 ], data->solution->torso_multiplier, data->solution->body_decorations ); { const unsigned temp = temp_slots[ 1 ]; AddDecorations1< allow_bad, true, allow_detrimental >( data, temp_slots[ 1 ], 1, data->solution->non_body_decorations ); unsigned num_1slot_decorations = temp - temp_slots[ 1 ]; if( num_1slot_decorations > data->solution->slots_spare[ 1 ] ) { unsigned extra = num_1slot_decorations - data->solution->slots_spare[ 1 ]; if( extra > data->solution->slots_spare[ 2 ] * 2 ) { const unsigned extra3 = extra - data->solution->slots_spare[ 2 ] * 2; const unsigned num_3_convert = extra3 / 3 + !!( extra3 % 3 ); data->solution->slots_spare[ 3 ] -= num_3_convert; if( num_3_convert * 3 > extra ) { const unsigned super_extra = num_3_convert * 3 - extra; data->solution->slots_spare[ 2 ] += super_extra / 2; data->solution->slots_spare[ 1 ] += super_extra % 2; num_1slot_decorations -= extra; extra = 0; } else { extra -= num_3_convert * 3; num_1slot_decorations -= num_3_convert * 3; } } const unsigned num_2_slots = extra / 2 + extra % 2; data->solution->slots_spare[ 2 ] -= num_2_slots; data->solution->slots_spare[ 1 ] -= num_1slot_decorations - num_2_slots * 2; } else data->solution->slots_spare[ 1 ] -= num_1slot_decorations; if( body_slots[ 1 ] ) AddDecorations1< allow_bad, true, allow_detrimental >( data, body_slots[ 1 ], data->solution->torso_multiplier ,data->solution->body_decorations ); } data->solution->torso_slots_spare = body_slots[ 1 ]; } unsigned Num1SlotDecorations( Solution^ sol, Ability^ ab ) { unsigned num = 0; for each( Decoration^ deco in sol->non_body_decorations ) { if( deco->slots_required == 1 && deco->abilities[ 0 ]->ability == ab ) num++; } if( sol->torso_multiplier == 1 ) { for each( Decoration^ deco in sol->body_decorations ) { if( deco->slots_required == 1 && deco->abilities[ 0 ]->ability == ab ) num++; } } return num; } int PotentialSpareSlots( CalculationData^ data, const unsigned slot_size ) { int count = 0; for each( Armor^ arm in data->solution->armors ) { if( arm ) count += arm->num_slots == slot_size; } count += data->query->weapon_slots_allowed == slot_size; count += data->solution->charm->num_slots == slot_size; for each( Decoration^ deco in data->solution->decorations ) { count -= deco->slots_required == slot_size; } return count; } bool RoomFor3Slot( CalculationData^ data ) { const int free3 = PotentialSpareSlots( data, 3 ); Assert( free3 >= 0, L"Not enough room for 3-slot gem(1)" ); return free3 > 0 && free3 + PotentialSpareSlots( data, 2 ) > 0; } bool RoomFor2Slot( CalculationData^ data ) { const int free3 = PotentialSpareSlots( data, 3 ); Assert( free3 >= 0, L"Not enough room for 3-slot gem(2)" ); return free3 + PotentialSpareSlots( data, 2 ) > 0; } void SwapOut( Solution^ sol, Decoration^ deco ) { unsigned count = 0; for( int i = 0; count < deco->slots_required; ++i ) { Assert( i < sol->decorations.Count, L"Overrunning decoration count" ); if( sol->decorations[ i ]->slots_required == 1 && sol->decorations[ i ]->abilities[ 0 ]->ability == deco->abilities[ 0 ]->ability ) { for each( AbilityPair^ ap in sol->decorations[ i ]->abilities ) { sol->abilities[ ap->ability ] -= ap->amount; } sol->decorations.RemoveAt( i-- ); count++; } } for each( AbilityPair^ ap in deco->abilities ) { sol->abilities[ ap->ability ] += ap->amount; } sol->decorations.Add( deco ); } void Solution::ReduceSlots() { if( total_slots_spare > 0 ) { unsigned i = charm->num_slots; while( i <= 3 && !slots_spare[ i ] ) ++i; if( i <= 3 ) { //if( i > charm->num_slots ) slots_spare[ i - charm->num_slots ]++; slots_spare[ i ]--; total_slots_spare -= charm->num_slots; charm->num_slots = 0; } } } void Solution::ReduceSkills() { if( total_slots_spare > 0 ) { for each( AbilityPair^ ap in charm->abilities ) { data->need[ ap->ability ] += ap->amount; } CalculateDecorations< false, false >( data ); for each( AbilityPair^ ap in charm->abilities ) { data->need[ ap->ability ] -= ap->amount; } } } void Solution::RearrangeDecorations() { for each( AbilityPair^ ap in charm->abilities ) { unsigned num1 = Num1SlotDecorations( this, ap->ability ); Decoration^ best3 = Decoration::GetBestDecoration( ap->ability, 3, data->rel_decoration_map ); Decoration^ best2 = Decoration::GetBestDecoration( ap->ability, 2, data->rel_decoration_map ); bool replaced = false; do { replaced = false; if( num1 >= 3 ) { if( best3 && best3->slots_required == 3 && RoomFor3Slot( data ) ) { replaced = true; SwapOut( this, best3 ); num1 -= 3; } else if( best2 && best2->slots_required == 2 && RoomFor2Slot( data ) ) { replaced = true; SwapOut( this, best2 ); num1 -= 2; } } else if( num1 == 2 ) { if( best2 && best2->slots_required == 2 && RoomFor2Slot( data ) ) { replaced = true; SwapOut( this, best2 ); num1 -= 2; } } } while ( replaced ); } } void Solution::ReduceCharm() { for each( AbilityPair^ ap in charm->abilities ) { const int need = data->need[ ap->ability ]; if( need > 0 ) { const int have = abilities[ ap->ability ]; const int extra = have - need; Assert( extra >= 0, L"Reducing charm has caused solution to fail!" ); const int take_off = extra >= ap->amount ? ap->amount : extra; ap->amount -= take_off; abilities[ ap->ability ] -= take_off; } } for( int i = 0; i < charm->abilities.Count; ++i ) { if( charm->abilities[ i ]->amount == 0 ) { charm->abilities.RemoveAt( i-- ); } } if( charm->num_slots == 0 && charm->abilities.Count == 0 ) charm = nullptr; } void Solution::AddExtraSkills() { if( total_slots_spare == 0 ) return; //first try to upgrade skills for each( Collections::Generic::KeyValuePair< Ability^, int >^ ap in abilities ) { if( ap->Key != SpecificAbility::torso_inc ) { int val = ap->Value, bad = 0; Skill^ current_skill = ap->Key->GetSkill( val ); if( current_skill && current_skill->best ) continue; array< Decoration^ >^ decs = { nullptr, Decoration::GetBestDecoration( ap->Key, 1, data->query->hr, data->query->level ), Decoration::GetBestDecoration( ap->Key, 2, data->query->hr, data->query->level ), Decoration::GetBestDecoration( ap->Key, 3, data->query->hr, data->query->level ) }; List_t< Decoration^ > body_deco; for( unsigned torso_spare = torso_slots_spare; torso_spare > 0; ) { Decoration^ d = decs[torso_spare]; if( !d || Detrimental( d, data, torso_multiplier ) ) break; if( d->abilities.Count > 1 && d->abilities[1]->ability->has_bad ) { if( bad + d->abilities[1]->amount * torso_multiplier <= -10 ) break; bad += d->abilities[1]->amount * torso_multiplier; } body_deco.Add( d ); val += d->abilities[0]->amount * torso_multiplier; torso_spare -= d->slots_required; } List_t< Decoration^ > non_body_deco; unsigned spare[4] = { 0, slots_spare[1], slots_spare[2], slots_spare[3] }; for( unsigned size = 4; size --> 1; ) { for( unsigned i = 0; i < slots_spare[size]; ++i ) { spare[size]--; unsigned s = size; while( s > 0 ) { Decoration^ d = decs[s]; if( !d || Detrimental( d, data, 1 ) ) break; if( d->abilities.Count > 1 && d->abilities[1]->ability->has_bad ) { if( bad + d->abilities[1]->amount <= -10 ) break; bad += d->abilities[1]->amount; } non_body_deco.Add( d ); val += d->abilities[0]->amount; s -= d->slots_required; } spare[s]++; } if( size == 3 && spare[3] ) { spare[1] += spare[3]; spare[2] += spare[3]; spare[3] = 0; } if( size == 2 && spare[2] ) { spare[1] += spare[2] * 2; spare[2] = 0; } } Skill^ skill = ap->Key->GetSkill( val ); if( !skill || skill == current_skill ) continue; potential_extra_skills.Add( skill ); } } } bool Solution::ImpossibleNoDecorations( Query^ query ) { for each( Skill^ skill in query->skills ) { if( skill->is_taunt ) continue; const int have = abilities[ skill->ability ], need = data->need[ skill->ability ]; if( have < need ) { if( !skill->ability->has_decorations ) return true; bool found = false; for each( Decoration^ deco in query->rel_decorations ) { if( deco->abilities.Count > 0 && deco->abilities[0]->ability == skill->ability ) { found = true; break; } } if( !found ) return true; } } return false; } bool CalculateTaunt( CalculationData^ data ) { const int have = data->solution->abilities[ SpecificAbility::sense ]; if( have <= -10 ) return true; if( data->query->taunt_decorations.Count == 0 ) return false; const int effective_total = data->solution->torso_slots_spare * data->solution->torso_multiplier + ( data->solution->total_slots_spare - data->solution->torso_slots_spare ); int need = have + 10; if( need > effective_total ) return false; Decoration^ best = nullptr; int best_dist = 999; for each( Decoration^ d in data->query->taunt_decorations ) { Assert( d->abilities.Count == 2, L"Bad taunt decoration!?" ); const int have = data->solution->abilities.ContainsKey( d->abilities[0]->ability ) ? data->solution->abilities[ d->abilities[0]->ability ] : 0; const int dist = ( have >= 10 ) ? 15 - have : 10 - have; if( dist <= 0 ) { if( !best ) best = d; } else { if( dist < best_dist ) { best_dist = dist; best = d; } } } while( data->solution->torso_slots_spare > 0 && need > 0 ) { AddDecoration( data->solution, best, data->solution->torso_multiplier, data->solution->body_decorations ); need -= data->solution->torso_multiplier; data->solution->torso_slots_spare--; } while( data->solution->total_slots_spare > 0 && need > 0 ) { AddDecoration( data->solution, best, 1, data->solution->non_body_decorations ); need--; if( data->solution->slots_spare[1] == 0 ) { if( data->solution->slots_spare[2] == 0 ) { data->solution->slots_spare[3]--; data->solution->slots_spare[2]++; } else { data->solution->slots_spare[2]--; data->solution->slots_spare[1]++; } } else data->solution->slots_spare[1]--; } return true; } bool Solution::MatchesQuery( Query^ query ) { data = gcnew CalculationData; data->query = query; data->solution = this; for( int i = 0; i < 4; ++i ) data->rel_decoration_map.Add( gcnew List_t< Decoration^ > ); for each( Decoration^ deco in query->rel_decorations ) { data->rel_decoration_map[ deco->slots_required ]->Add( deco ); } GetInitialData( data ); if( ImpossibleNoDecorations( query ) ) return false; CalculateDecorations< true, true >( data ); for each( Skill^ skill in query->skills ) { if( !skill->is_taunt ) { const int have = abilities[ skill->ability ], need = data->need[ skill->ability ]; if( have < need ) return false; } } if( query->want_taunt && !CalculateTaunt( data ) ) return false; CalculateExtraSkills( query ); reordered_to_fix = false; if( !query->allow_bad && !CheckBadSkills( query ) ) return false; //reduce charms if( charm ) { if( charm->custom ) { if( !reordered_to_fix ) RearrangeDecorations(); } else { ReduceSlots(); ReduceSkills(); RearrangeDecorations(); ReduceCharm(); CalculateExtraSkills( query ); Assert( query->allow_bad || bad_skills.Count == 0, L"A bad skill crept in?" ); #ifdef _DEBUG for each( Skill^ skill in query->skills ) { if( skill->is_taunt ) { const int have = abilities[ skill->ability ]; if( have > -10 ) return false; } else { const int have = abilities[ skill->ability ], need = data->need[ skill->ability ]; if( have < need ) { System::Windows::Forms::MessageBox::Show( L"Not enough skill points!!!" ); } } } #endif } } if( query->add_extra ) AddExtraSkills(); CalculateExtraSkillScore( query->hr, query->level ); CalculateSkillModifiers(); slots_spare[ torso_slots_spare ]++; Assert( total_slots_spare < 1000, L"Total slots spare is negative" ); for each( Decoration^ deco in decorations ) { difficulty += deco->difficulty; } return true; } void Solution::CalculateExtraSkills( Query^ query ) { extra_skills.Clear(); bad_skills.Clear(); for each( Collections::Generic::KeyValuePair< Ability^, int >^ ap in abilities ) { Ability^ ab = ap->Key; if( query->want_taunt && ab == SpecificAbility::sense ) continue; Skill^ sk = ab->GetSkill( ap->Value ); if( sk && !sk->autodisabled && !data->relevant.ContainsKey( sk ) ) { if( ap->Value < 0 && !data->query->allow_bad ) bad_skills.Add( sk ); else if( ab != SpecificAbility::torso_inc ) extra_skills.Add( sk ); } } } void Solution::CalculateData( const unsigned hr, const unsigned level ) { abilities.Clear(); fire_res = ice_res = thunder_res = water_res = dragon_res = defence = rarity = difficulty = max_defence = 0; torso_multiplier = 1; for each( Armor^ armor in armors ) { if( armor ) { fire_res += armor->fire_res; ice_res += armor->ice_res; thunder_res += armor->thunder_res; water_res += armor->water_res; dragon_res += armor->dragon_res; defence += armor->defence; if( armor->rarity != 99 ) rarity += armor->rarity; difficulty += armor->difficulty; max_defence += armor->max_defence; if( armor->torso_inc ) torso_multiplier++; else Utility::AddAbilitiesToMap( armor->abilities, abilities ); } } if( armors[ 1 ] && torso_multiplier > 1 ) Utility::AddAbilitiesToMap( armors[ 1 ]->abilities, abilities, torso_multiplier - 1 ); if( charm ) Utility::AddAbilitiesToMap( charm->abilities, abilities ); for each( Decoration^ dec in non_body_decorations ) Utility::AddAbilitiesToMap( dec->abilities, abilities ); for each( Decoration^ dec in body_decorations ) Utility::AddAbilitiesToMap( dec->abilities, abilities, torso_multiplier ); CalculateFamilyScore(); CalculateExtraSkillScore( hr, level ); CalculateSkillModifiers(); } void Solution::CalculateSkillModifiers() { #define CHECK_RES(X) else if( e.Current.Key == SpecificAbility::X ) \ { \ if( e.Current.Value >= 15 ) \ X += 20; \ else if( e.Current.Value >= 10 ) \ X += 15; \ else if( e.Current.Value <= -10 ) \ X -= 20; \ } AbilityMap::Enumerator e = abilities.GetEnumerator(); while( e.MoveNext() ) { if( e.Current.Key == SpecificAbility::defence ) { if( e.Current.Value >= 25 ) defence = int( defence * 1.08 ) + 30; //DUXL else if( e.Current.Value >= 20 ) defence = int( defence * 1.06 ) + 25; //DUL else if( e.Current.Value >= 15 ) defence = int( defence * 1.03 ) + 20; //DUM else if( e.Current.Value >= 10 ) defence = defence + 15; //DUS else if( e.Current.Value <= -20 ) defence = int( defence * 0.9 ) - 10; //DDL else if( e.Current.Value <= -15 ) defence = int( defence * 0.95 ) - 10; //DDM else if( e.Current.Value <= -10 ) defence = defence - 10; //DDS if( defence < 1 ) defence = 1; } CHECK_RES( fire_res ) CHECK_RES( water_res ) CHECK_RES( thunder_res ) CHECK_RES( ice_res ) CHECK_RES( dragon_res ) } } unsigned GetFamilyScore( List_t< Armor^ >% armors, const unsigned family ) { array< unsigned >^ rare_count = gcnew array< unsigned >( 11 ); for each( Armor^ armor in armors ) { if( armor && armor->family == family && (int)armor->rarity < rare_count->Length ) rare_count[ armor->rarity ]++; } unsigned res = 0; for( int i = 0; i < rare_count->Length; ++i ) if( rare_count[ i ] > res ) res = rare_count[ i ]; return res; } void Solution::CalculateFamilyScore() { family_score = gcnew array< unsigned >( 3 ); array< unsigned >^ count = gcnew array< unsigned >( Family::count ); for each( Armor^ armor in armors ) { if( armor ) count[ armor->family ]++; } array< unsigned >^ count2 = gcnew array< unsigned >( 6 ); for( int i = 0; i < count2->Length; ++i ) count2[ i ] = Family::count; for( int i = 0; i < count->Length; ++i ) if( count[ i ] > 0 ) count2[ count[ i ] ] = i; array< unsigned >::Sort( count ); switch( count[ Family::count - 1 ] ) { case 2: family_score[ 1 ] = GetFamilyScore( armors, count2[ 2 ] ); { array< unsigned >^ other_armor_families = { -1, -1, -1 }; int i = 0; for each( Armor^ armor in armors ) { if( armor && armor->family != count2[ 2 ] ) other_armor_families[ i++ ] = armor->family; } if( other_armor_families[ 0 ] == other_armor_families[ 1 ] ) { family_score[ 0 ] = 2; family_score[ 2 ] = GetFamilyScore( armors, other_armor_families[ 0 ] ); } else if( other_armor_families[ 0 ] == other_armor_families[ 2 ] ) { family_score[ 0 ] = 2; family_score[ 2 ] = GetFamilyScore( armors, other_armor_families[ 0 ] ); } else if( other_armor_families[ 1 ] == other_armor_families[ 2 ] ) { family_score[ 0 ] = 2; family_score[ 2 ] = GetFamilyScore( armors, other_armor_families[ 1 ] ); } else family_score[ 0 ] = 1; } break; case 3: family_score[ 1 ] = GetFamilyScore( armors, count2[ 3 ] ); if( count2[ 2 ] != Family::count ) { family_score[ 0 ] = 4; family_score[ 2 ] = GetFamilyScore( armors, count2[ 2 ] ); } else { family_score[ 0 ] = 3; } break; case 4: family_score[ 0 ] = 5; family_score[ 1 ] = GetFamilyScore( armors, count2[ 4 ] ); break; case 5: family_score[ 0 ] = 6; family_score[ 1 ] = GetFamilyScore( armors, count2[ 5 ] ); break; } } int CalculateBonusExtraSkillPoints( Ability^ ability, int spare_slots, const int mult, const unsigned hr, const unsigned elder_star ) { int total = 0; while( spare_slots > 0 ) { Decoration^ deco = Decoration::GetBestDecoration( ability, spare_slots, hr, elder_star ); if( deco == nullptr ) break; total += deco->abilities [ 0 ]->amount * mult; spare_slots -= deco->slots_required; } return total; } void Solution::CalculateExtraSkillScore( const unsigned hr, const unsigned level ) { ///////////////// 3 4 5 6 7 8 9 10+ int weights[] = { 1, 5, 20, 50, 100, 1000, 10000, 100000 }; extra_skill_score = 0; AbilityMap::Enumerator e = abilities.GetEnumerator(); while( e.MoveNext() ) { if( e.Current.Value < 10 && e.Current.Value > 3 ) { Skill^ s = e.Current.Key->GetWorstGoodSkill(); if( !s || s->autodisabled ) continue; const int effective_skill_points = e.Current.Value + CalculateBonusExtraSkillPoints( e.Current.Key, torso_slots_spare, torso_multiplier, hr, level ) + CalculateBonusExtraSkillPoints( e.Current.Key, slots_spare[ 3 ] * 3, 1, hr, level ) + CalculateBonusExtraSkillPoints( e.Current.Key, slots_spare[ 2 ] * 2, 1, hr, level ) + CalculateBonusExtraSkillPoints( e.Current.Key, slots_spare[ 1 ], 1, hr, level ); extra_skill_score += weights[ Math::Min( effective_skill_points - 3, 10 ) ]; } } extra_skill_score += potential_extra_skills.Count * weights[10 - 3]; }
COMMENT @---------------------------------------------------------------------- Copyright (c) GeoWorks 1988 -- All Rights Reserved GEOWORKS CONFIDENTIAL PROJECT: GEOS MODULE: UserInterface/User FILE: userFlowInput.asm ROUTINES: Name Description ---- ----------- MTD MSG_VIS_VUP_ALTER_INPUT_FLOW TEMPORARY handler for VUP method, starting to look like VisContent code... INT CallGrabRoutine TEMPORARY handler for VUP method, starting to look like VisContent code... INT UpdateGeodeCPUPriorities TEMPORARY handler for VUP method, starting to look like VisContent code... INT RaisePriorities Raise priorites for passed geode, saving away its old priorities INT RestorePriorities Restore passed CPU priorites to passed geode INT AdjustPtrMode Adjusts mouse ptr mode to perform some automatic behavior: If the active mouse grab has just been changed, then the ptr behavior is set to IGNORE_PTR_EVENTS. If the active mouse grab has just been released, then the ptr behavior is set back to the state that it was in the last time the implied grab changed it. MTD MSG_VIS_VUP_GET_MOUSE_STATUS MTD MSG_VIS_VUP_BUMP_MOUSE GLB NukePressHoldTimer Calls TimerStop() with the inkPressHoldTimer... MTD MSG_META_MOUSE_PTR Disperses PTR to the current mouse grab INT AdjustMousePosForBump Process mouse x,y position passed from IM INT CheckOnInputHoldUpLow Implement UI-hold up scheme. INT CombineMouseEvent Implement UI-hold up scheme. INT SendMouseToActiveOrImpliedGrab Send mouse data to active/implied grab INT ECEnsureEventsNotOutOfOrder Make sure the hold-up queue is empty MTD MSG_META_OBJ_FLUSH_INPUT_QUEUE Process this MetaClass method which the flow object normally doesn't have to handle by redirecting it to the HoldUpInputQueue if hold-up mode is in progress. Currently used to process MSG_META_OBJ_FLUSH_INPUT_QUEUE, to make sure that it doesn't pass up MSG_META_WIN_CHANGE's in the queue, which would result in nasty deaths. MTD MSG_META_WIN_CHANGE Handles notification from window system that pointer has moved & may possibly be in a new window MTD MSG_META_RAW_UNIV_ENTER Handle reciept of the various enter/leave messages generated by the window system, & relay them on to the proper geode. MTD MSG_META_IMPLIED_WIN_CHANGE Handles notification from window system that the implied window, or window that the mouse is in, has changed. This method is generally called directly, as in NOT via the UI queue, from the window system, just before a MSG_META_VIS_ENTER is delivered. This is so that method handlers for MSG_META_VIS_ENTER can request changes in ptr handling for a window that has just become the implied grab. MTD MSG_FLOW_GRAB_MOUSE Creates an active grab for the geode which the mouse is currently over. Generally caused as the result of the user pressing a mouse button down over a window. MTD MSG_FLOW_RELEASE_MOUSE Releases active grab, so that mouse is free to interact with whatever geode it is over. Generally a result of all buttons going up on the mouse. MTD MSG_FLOW_RELEASE_MOUSE_IF_GRABBED release active mouse grab, if passed optr has it grabbed MTD MSG_FLOW_SET_MODAL_GEODE TEMPORARY notification from system object (until flow & system object are merged), to keep flow object up to date on whether there is a system-modal window active INT FlowUpdateWinGeodeActive Update window system with which geode is active, if any. MTD MSG_FLOW_TEST_WIN_INTERACTIBILITY Check to see wether mouse should be allowed to interact with window passed, on an implied basis. The mouse is generally allowed to interact with a window, except under certain circumstances: * There is a FI_modalGeode, & it is not the geode that owns the passed window * There is an FI_activeMouseGrab, & it is not the geode that owns the passed window MTD MSG_FLOW_GET_MODAL_GEODE Fetch modal geode, if any INT FlowUpdateImpliedMouseGrab Sets FI_impliedMouseGrab based on current implied win info, & whether or not the mouse is allowed to interact with that window on an implied basis. INT FlowSetImpliedMouseGrabFromWin Sets FI_impliedMouseGrab based on current implied win info, & whether or not the mouse is allowed to interact with that window on an implied basis. INT GetOwningInputObj Given Window, return Geode & InputObj to handle input directed towards it. By definition, the owner of the window is the one which will handle input for it. The optr of the InputObj is stored in that geode's private data. MTD MSG_META_ENSURE_MOUSE_NOT_ACTIVELY_TRESPASSING *ds:si - instance data es - segment of FlowClass ax - MSG_META_ENSURE_MOUSE_NOT_ACTIVELY_TRESPASSING MTD MSG_META_NOTIFY_WITH_DATA_BLOCK This routine passes on MSG_META_NOTIFIES. INT FNCheckDuplicateHardIconEvent Callback routine to replace or drop duplicated hard icon events. MTD MSG_FLOW_INK_PRESS_AND_HOLD_TIMEOUT This is the method invoked when the ink press and hold timeout timer expires. MTD MSG_FLOW_INK_REPLY This method handler is invoked when an geode has determined whether or not a previous press is ink or not. MTD MSG_META_MOUSE_BUTTON Disperses BUTTON to the current mouse grab INT CheckForFlowGrabMouse Figure out if the mouse has been newly pressed. If so, generate MSG_FLOW_GRAB_MOUSE to instruct system-wide input controller (currently us) to set up an active grab for the geode the mouse is over. INT CheckForFlowReleaseMouse Figure out if the mouse has been fully released. If so, generate MSG_FLOW_GEODE_RELEASE to instruct system-wide input controller to release geode grab set up earlier INT DefaultBehaviorOnMousePress Perform default, system-wide behavior for mouse click in a window. Default behavior is: * "Click to raise": By default, we'd like applications that are clicked in to be raised to the top. Almost always, that is... apps having windows that float on top of the field/screen may not wished to be raised themselves if those windows are clicked in (e.g. Keycaps). Because of this, we stipulate that only windows having LayerID = owning geode of window, which sit directly on a window owned by a different geode, if clicked in, will be cause for the Layer they reside in to be raised to the top (This is the case for Primary, command, & app modal windows). Note that the layer is raised as a whole, & no raising of individual windows within the layer is performed -- this should be handled locally within the app. * Focus/Target Also by default, we'd like to give any application clicked on the Focus & Target, if they'll have it. Here we're slightly more lenient than above, removing the stipulation that the parent window must be owned by a different geode in order to perform the default behavior. This means that ANY window within the app (including things like views), if having LayerID = owning geode of window, if clicked in, will result in the geode's InputObj being given the focus/target within their parent FT node object. * More CPU power for top geode, accomplished by modifying priority of its thread(s). * Multiple windows under an Application with different LayerID's In some situations there are applications in which all the windows under the application are not in the same layer. In this case, there is different default behavior. The LayerID of a window is either its owning Geode (almost all of the time) or (by convention) the block handle of the block that the window object is in. When a window is clicked in that does not have the LayerID equal to its owning Geode we bring this layer to the top and give the object the focus and target, then bring the owning geode LayerID to the top *without* changing the focus and target. INT FindBoundary Starting at passed window, walk up tree to find field or screen INT UpdateFunctionsActive Update the flow variable used to record the active button functions. MTD MSG_VIS_VUP_TERMINATE_ACTIVE_MOUSE_FUNCTION Terminates any active mouse function, forcing it to become a lowly "OTHER" function in progress. Used by the specific UI to "Kill" the START_SELECT in progress when the system menu is double-clicked on & held. The problems was that PTR events following were marked as being a SELECT operation, & the window UNDER the window which was closed starts reacting to the SELECT operation. NOTE: This function may only be called from the UI thread (i.e. must be kept synchronous w/UI) INT UpdateBPHighWithFunctionsActive A code snippet to save bytes INT TranslateButton Convert PC/GEOS button methods to generic methods. MTD MSG_META_MOUSE_DRAG Disperses DRAG event to the current mouse grab MTD MSG_META_KBD_CHAR Disperses MSG_META_KBD_CHAR to the current focus INT UpdateConstrainState Updates status of UIFA_CONSTRAIN INT UpdateMoveCopy Updates status of move-copy, if necessary. MTD MSG_META_PRESSURE Disperses MSG_META_PRESSURE to the current focus MTD MSG_META_DIRECTION Disperses MSG_META_DIRECTION to the current focus MTD MSG_META_MOUSE_BUMP_NOTIFICATION MSG_META_MOUSE_BUMP_NOTIFICATION for FlowClass INT FlowGetActiveOrImpliedMouseGrab Returns current mouse grab OD & window MTD MSG_VIS_CONTENT_DISABLE_HOLD_UP Change input state to force allowance of input data to flow MTD MSG_VIS_CONTENT_ENABLE_HOLD_UP Change input state to allow hold-up mode INT FlowFlushHoldUpInputQueue Flush the hold-up input queue by moving all events in it to the front of the UI queue, in order. MTD MSG_FLOW_REGISTER_NO_INK_WIN Add/remove a window to the no-ink list MTD MSG_FLOW_SET_SCREEN Change display screens REVISION HISTORY: Name Date Description ---- ---- ----------- Doug 3/89 Initial version Doug 12/89 Cleaned up FlowClass organization, doc. DESCRIPTION: This file contains routines to handle input processing for the User Interface. The following mechanisms are handled here: GRABS: Mouse grab Implied mouse grab Active mouse grab Passive mouse grabs Kbd grab Direction grab Pressure grab Window grab EXCLUSIVES: App exclusive INPUT CONTROL: FlowBumpMouse $Id: userFlowInput.asm,v 1.1 97/04/07 11:46:03 newdeal Exp $ ------------------------------------------------------------------------------@ include Internal/prodFeatures.def FlowCommon segment resource COMMENT @---------------------------------------------------------------------- METHOD: FlowVupGrabWithinView DESCRIPTION: TEMPORARY handler for VUP method, starting to look like VisContent code... PASS: *ds:si - instance data es - segment of VisContentClass ax - MSG_VIS_VUP_ALTER_INPUT_FLOW dx - size VupAlterInputFlowData ss:bp - ptr to VupAlterInputFlowData structure one stack VupAlterInputFlowData struct VAIFD_flags VisInputFlowGrabFlags VAIFD_grabType VisInputFlowGrabType VAIFD_object optr VAIFD_gWin hptr.Window VAIFD_translation PointDWord VupAlterInputFlowData ends RETURN: nothing DESTROYED: ax, cx, dx, bp PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Doug 11/89 Initial version Doug 5/91 Revised to handle 32-bit stuff ------------------------------------------------------------------------------@ FlowVupGrabWithinView method dynamic FlowClass, MSG_VIS_VUP_ALTER_INPUT_FLOW mov bx, word ptr ss:[bp].VAIFD_flags mov cx, ss:[bp].VAIFD_object.handle mov dx, ss:[bp].VAIFD_object.chunk mov bp, ss:[bp].VAIFD_gWin test bl, mask VIFGF_MOUSE jz notMouse EC < ERROR UI_FLOW_OBJECT_NO_LONGER_SUPPORTS_PASSIVE_GRABS > NEC< jmp short done > notMouse: test bl, mask VIFGF_KBD jz notKbd cmp bh, VIFGT_ACTIVE jne passiveKbd push ds:[di].FI_activeKbdGrab.KG_OD.handle mov di, offset FI_activeKbdGrab mov ax, MSG_META_GAINED_KBD_EXCL call CallGrabRoutine pop bx ; get handle of old grab owner in bx ; Give more CPU power to geode having keyboard exclusive, take ; it away from losing geode. Love that perceived performance ; factor, yes we do! ; call UpdateGeodeCPUPriorities jmp short done passiveKbd: EC < ERROR UI_FLOW_OBJECT_NO_LONGER_SUPPORTS_PASSIVE_GRABS > NEC< jmp short done > notKbd: done: ret FlowVupGrabWithinView endm CallGrabRoutine proc near ; ax = "GAINED" message test bl, mask VIFGF_GRAB jz release test bl, mask VIFGF_FORCE jz requestGrab ;forceGrab: clr bx call FlowForceGrab ret requestGrab: clr bx call FlowRequestGrab ret release: clr bx call FlowReleaseGrab ret CallGrabRoutine endp UpdateGeodeCPUPriorities proc near class FlowClass tst bx jz haveOldOwner call MemOwner ; get owning geode of "old" grab haveOldOwner: mov ax, bx ; keep around in ax mov di, ds:[si] ; get ptr to instance data mov bx, ds:[di].FI_activeKbdGrab.KG_OD.handle tst bx jz haveNewOwner call MemOwner ; get owning geode of "new" grab haveNewOwner: cmp ax, bx je done ; if same, nothing for us to do push ax ; save "old" geode on stack for a moment ; along with its old priorities... push {word} ds:[di].FI_prevUIPriority push {word} ds:[di].FI_prevPriority mov ds:[di].FI_prevPriority, 0 ; just to prevent oddities... mov ds:[di].FI_prevUIPriority, 0 call RaisePriorities ; Raise priorities of "new" geode pop ax ; get saved prio of old focus geode pop cx ; & saved ui prio pop bx ; get old geode call RestorePriorities ; Restore priorities of "old" geode done: ret UpdateGeodeCPUPriorities endp COMMENT @---------------------------------------------------------------------- FUNCTION: RaisePriorities DESCRIPTION: Raise priorites for passed geode, saving away its old priorities CALLED BY: INTERNAL UpdateGeodeCPUPriorities PASS: bx - geode ds:di - pointer to FlowInstance to store old prios in. RETURN: nothing DESTROYED: ax PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Doug 6/1/92 Initial version ------------------------------------------------------------------------------@ RaisePriorities proc near class FlowClass tst bx jz done mov dl, PRIORITY_UI ; Priority for singled threaded ; applications, or UI thread in ; two-threaded apps. ; Start w/UI thread, if there is one. ; push bx push ds call MemLock mov ds, ax mov ax, ds:[PH_uiThread] call MemUnlock pop ds mov bx, ax tst bx jz doneWithUI ; Get previous priority of that thread, save it away, so we can ; restore it later. ; mov ax, TGIT_PRIORITY_AND_USAGE call ThreadGetInfo mov ds:[di].FI_prevUIPriority, al ; save it away ; Raise priority, if necessary ; cmp al, dl jbe doneWithUI ; the lower, the more CPU cycles given mov al, dl mov ah, mask TMF_BASE_PRIO call ThreadModify mov dl, PRIORITY_FOCUS ; 2nd thread, if there is one, only ; gets to run at PRIORITY_FOCUS. doneWithUI: pop bx push bx call ProcInfo ; get first thread tst bx jz doneWithFirst ; Get previous priority of that thread, save it away, so we can ; restore it later. ; mov ax, TGIT_PRIORITY_AND_USAGE call ThreadGetInfo mov ds:[di].FI_prevPriority, al ; save it away ; Raise priority, if necessary ; cmp al, dl jbe doneWithFirst ; the lower, the more CPU cycles given mov al, dl mov ah, mask TMF_BASE_PRIO call ThreadModify doneWithFirst: pop bx done: ret RaisePriorities endp COMMENT @---------------------------------------------------------------------- FUNCTION: RestorePriorities DESCRIPTION: Restore passed CPU priorites to passed geode CALLED BY: INTERNAL UpdateGeodeCPUPriorities PASS: bx - geode al - priority for first thread cl - priority for ui thread RETURN: nothing DESTROYED: ax PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Doug 6/1/92 Initial version ------------------------------------------------------------------------------@ RestorePriorities proc near tst bx ; if no geode, done jz done push bx tst al jz doneWithFirst call ProcInfo ; get first thread tst bx jz doneWithFirst mov ah, mask TMF_BASE_PRIO call ThreadModify doneWithFirst: pop bx push bx tst cl jz doneWithUI push ds call MemLock mov ds, ax mov ax, ds:[PH_uiThread] call MemUnlock pop ds mov bx, ax tst bx jz doneWithUI mov al, cl ; get prio to restore mov ah, mask TMF_BASE_PRIO call ThreadModify doneWithUI: pop bx done: ret RestorePriorities endp COMMENT @---------------------------------------------------------------------- FUNCTION: AdjustPtrMode - adjust mouse ptr mode. DESCRIPTION: Adjusts mouse ptr mode to perform some automatic behavior: If the active mouse grab has just been changed, then the ptr behavior is set to IGNORE_PTR_EVENTS. If the active mouse grab has just been released, then the ptr behavior is set back to the state that it was in the last time the implied grab changed it. PASS: *ds:si - flow object carry - set if OD changed RETURN: carry - unchanged DESTROYED: Nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Doug 11/89 Initial version ------------------------------------------------------------------------------@ if (0) ; DISABLED for now -- doug 5/91 AdjustPtrMode proc near uses ax, bx, cx, dx, si class FlowClass .enter pushf mov si, ds:[si] ; If there is an active grab, tst ds:[si].FI_activeMouseGrab.GG_OD.handle jnz ignorePtrEvents ; then ignore all ptr events until ; told otherwise. ; Else figure out which way to set mouse ; ptr events handling mode. test ds:[si].FI_flowFlags, \ mask FF_IGNORE_PTR_EVENTS_WHEN_USING_IMPLIED_GRAB jnz ignorePtrEvents ;sendPtrEvents: clr si ; Request ALL ptr events jmp setPtrMode ignorePtrEvents: ; Request ptr event on crossing of rect mov si, mask FPM_ON_ENTER_LEAVE setPtrMode: ; Call IM routine to change pointer mode mov ax, EOREGREC ; Pass NULL rectangle mov bx, ax mov cx, ax mov dx, ax call ImSetPtrMode ; call IM routine to change pointer mode popf .leave ret AdjustPtrMode endp endif COMMENT @---------------------------------------------------------------------- METHOD: FlowVupGetMouseStatus DESCRIPTION: CALLED BY: OLPaneRawLeave (In Motif's CView/cviewPaneWindow.asm file) AnyMouseButtonDown? (In Motif's CWin/cwinClassCommon.asm file) PASS: *ds:si - instance data es - segment of VisContentClass ax - MSG_VIS_VUP_GET_MOUSE_STATUS RETURN: bp low - ButtonInfo mask BI_PRESS - set if press mask BI_DOUBLE_PRESS - set if double-press mask BI_B3_DOWN - state of button 3 mask BI_B2_DOWN - state of button 2 mask BI_B1_DOWN - state of button 1 mask BI_B0_DOWN - state of button 0 bp high - UIFunctionsActive DESTROYED: ax, bx, cx, dx, si, di, ds, es PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Doug 5/91 Initial version ------------------------------------------------------------------------------@ FlowVupGetMouseStatus method dynamic FlowClass, MSG_VIS_VUP_GET_MOUSE_STATUS ; Fetch current ButtonInfo & UIFunctionsActive ; mov al, ds:[di].FI_activeMouseButtonInfo mov ah, ds:[di].FI_activeMouseUIFunctionsActive mov bp, ax Destroy ax, cx, dx ret FlowVupGetMouseStatus endm COMMENT @---------------------------------------------------------------------- FUNCTION: FlowVupBumpMouse CALLED BY: VisTextPtr DESCRIPTION: PASS: *ds:si - instance data es - segment of VisContentClass ax - MSG_VIS_VUP_BUMP_MOUSE cx - X amount to bump mouse dx - Y amount to bump mouse RETURN: nothing DESTROYED: ax, bx, cx, dx, si, di, ds, es REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Doug 8/89 Initial version Doug 5/91 Changed to VUP method ------------------------------------------------------------------------------@ FlowVupBumpMouse method dynamic FlowClass, MSG_VIS_VUP_BUMP_MOUSE ; Bump all events coming through UI ; by this amount, until we receive ; a MSG_META_MOUSE_BUMP_NOTIFICATION add ds:[di].FI_mouseBump.XYO_x, cx add ds:[di].FI_mouseBump.XYO_y, dx ; Method to send ourselves mov ax, MSG_META_MOUSE_BUMP_NOTIFICATION call ImBumpMouse ; call IM routine to bump mouse, send method. ret FlowVupBumpMouse endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% NukePressHoldTimer %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Calls TimerStop() with the inkPressHoldTimer... CALLED BY: GLOBAL PASS: ds:di, *ds:si - FlowObject ax - if MSG_META_MOUSE_BUTTON, we want to set the "have override flag" RETURN: nada DESTROYED: nada PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- atw 12/17/91 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ NukePressHoldTimer proc near uses bp, bx class FlowClass .enter ; Stop the press and hold timer push ax clr bx xchg bx, ds:[di].FI_inkPressHoldTimerHan clr ax xchg ax, ds:[di].FI_inkPressHoldTimerID call TimerStop pop ax test ds:[di].FI_flowFlags, mask FF_AWAITING_PRESS_AND_HOLD_TIMER jz notWaitingForTimer ; We were waiting for the press and hold timer to expire ; If the user moved the mouse, draw ink instead. ; If the user released the mouse w/o moving it, then it should be a mouse ; event. ; push ax, cx, dx mov cx, IRV_DESIRES_INK ;if not _JEDI ;they've decided they want to use the two-stroke punctunation shift, so ;a click should always position the cursor - brianc 3/16/95 ; ; we don't do this for JEDI -- we want a mouse release before the ; timer expires to be ink so we can enter a punctuation shift/period ; in text objects. Text object cursor positioning is done by holding ; the pen down for a short time (PRESS_AND_HOLD_TIME) ; cmp ax, MSG_META_MOUSE_BUTTON jne 10$ mov cx, IRV_NO_INK ;If this was a quick press/release, ; then we don't want any ink - just ; send the mouse events. 10$: ;endif clr bp mov ax, MSG_FLOW_INK_REPLY mov di, mask MF_INSERT_AT_FRONT or mask MF_FORCE_QUEUE mov bx, ds:[LMBH_handle] call ObjMessage pop ax, cx, dx mov di, ds:[si] exit: .leave ret notWaitingForTimer: cmp ax, MSG_META_MOUSE_BUTTON jne exit ; If this is a click/release, then set the "ink override" flag. ornf ds:[di].FI_flowFlags, mask FF_HAS_INK_OVERRIDE jmp exit NukePressHoldTimer endp COMMENT @---------------------------------------------------------------------- METHOD: FlowPtr -- MSG_META_MOUSE_PTR for FlowClass DESCRIPTION: Disperses PTR to the current mouse grab CALLED BY: Input Manager (see Library/IM/imMain.asm) PASS: *ds:si - instance data es - segment of FlowClass ax - MSG_META_MOUSE_PTR cx - x position, mouse source window coordinates dx - y position, mouse source window coordinates bp - high byte shiftState, low byte buttonInfo RETURN: carry - ? ax - ? cx - ? dx - ? bp - ? DESTROYED: bx, si, di, ds, es REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Doug 3/89 Initial version Jim 12/89 Added support for screen saver function ------------------------------------------------------------------------------@ FlowPtr method dynamic FlowClass, MSG_META_MOUSE_PTR ; If eating events and waiting for ink, just exit... test ds:[di].FI_flowFlags, mask FF_PROCESSING_INK jnz done tst ds:[di].FI_inkPressHoldTimerHan jnz checkToNukePressHoldTimer afterPressHoldTimer: ; If holding up UI input, send event to HoldUpInputQueue, to be ; processed later ; call CheckOnInputHoldUpLow jc done ; If held up, all done. call AdjustMousePosForBump ; Adjust x, y pos for previous bump ; Convert to MSG_META_PTR ; ; bp = [shiftState | buttonInfo] from Input Manager. ; set high byte = UIFunctionsActive (such as UIFA_SELECT, etc.) ; call UpdateBPHighWithFunctionsActive ; Send mouse to active/implied grab mov ax, MSG_META_PTR call SendMouseToActiveOrImpliedGrab done: ret checkToNukePressHoldTimer: ; Should we nuke the ink press/hold timer? mov bx, cx sub bx, ds:[di].FI_inkStartPoint.P_x jns 10$ neg bx 10$: cmp bx, MAX_X_MOVEMENT_FOR_PRESS_AND_HOLD ja nukeTimer mov bx, dx sub bx, ds:[di].FI_inkStartPoint.P_y jns 20$ neg bx 20$: cmp bx, MAX_Y_MOVEMENT_FOR_PRESS_AND_HOLD jbe afterPressHoldTimer nukeTimer: call NukePressHoldTimer jmp afterPressHoldTimer FlowPtr endm COMMENT @---------------------------------------------------------------------- METHOD: FlowGadgetRepeatPress -- MSG_GADGET_REPEAT_PRESS for FlowClass DESCRIPTION: Sends this method on to the active grab. This originates from a gadget, and is sent through the input manager and flow object to keep it somewhat synchronous with other mouse events. Note: commented out for now. If we ever want to send gadget repeat events through the IM and flow objects again, we will comment this back in. PASS: *ds:si - instance data es - segment of MetaClass ax - MSG_GADGET_REPEAT_PRESS RETURN: nothing DESTROYED: bx, si, di, ds, es PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Chris 10/22/90 Initial version ------------------------------------------------------------------------------@ if 0 FlowGadgetRepeatPress method FlowClass, MSG_GADGET_REPEAT_PRESS mov bx, ds:[si] ; get ptr to instance data ; Assume that we'll use active grab mov di, bx add di, offset FI_activeMouseGrab ; Make sure active grab exists cmp ds:[bx].FI_activeMouseGrab.GG_OD.handle, 0 je exit ; if it doesn't, give up ; Save OD to receive data mov bx, ds:[di].GG_OD.handle mov si, ds:[di].GG_OD.chunk mov di, mask MF_FORCE_QUEUE or mask MF_FIXUP_DS call ObjMessage exit: ret ; FlowGadgetRepeatPress endm endif COMMENT @---------------------------------------------------------------------- FUNCTION: AdjustMousePosForBump DESCRIPTION: Process mouse x,y position passed from IM CALLED BY: INTERNAL PASS: *ds:si - flow object cx, dx - x, y position of mouse RETURN: ds:bx - flow object cx, dx - corrected position DESTROYED: ax PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Doug 6/90 Initial version ------------------------------------------------------------------------------@ AdjustMousePosForBump proc near class FlowClass mov bx, ds:[si] ; Bump the mouse by any amount ; required add cx, ds:[bx].FI_mouseBump.XYO_x add dx, ds:[bx].FI_mouseBump.XYO_y EC < call ECCheckVisCoords > ret AdjustMousePosForBump endp COMMENT @---------------------------------------------------------------------- FUNCTION: CheckOnInputHoldUpLow DESCRIPTION: Implement UI-hold up scheme. CALLED BY: INTERNAL PASS: *ds:si - flow object RETURN: ds:bx - flow object carry - set if input held up in uiHoldUpInputQueue DESTROYED: di PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Doug 3/91 Broken out from CheckOnInputHoldUp ------------------------------------------------------------------------------@ CheckOnInputHoldUpLow proc near class FlowClass mov bx, ds:[si] ; Test for HOLD UP mode test ds:[bx].FI_holdUpInputFlags, mask HUIF_HOLD_UP_MODE_DISABLED jnz passInput tst ds:[bx].FI_holdUpInputCount jnz holdUpInput passInput: EC < call ECEnsureEventsNotOutOfOrder > clc ret holdUpInput: push bx push di cmp ax, MSG_META_MOUSE_PTR jne nonPtrMethod ; SEND EVENT FOR PTR ; push cs ; push custom vector on stack mov di, offset CombineMouseEvent push di mov di, mask MF_FORCE_QUEUE or \ mask MF_CHECK_DUPLICATE or \ mask MF_CUSTOM or mask MF_CHECK_LAST_ONLY jmp short doObjMessage nonPtrMethod: mov di, mask MF_FORCE_QUEUE doObjMessage: mov bx, ds:[bx].FI_holdUpInputQueue ; fetch queue to send events to call ObjMessage pop di pop bx stc ; Indicate input held up (eaten by queue) ret CheckOnInputHoldUpLow endp ; ; Custom combination routine for ptr events, called by ObjMessage in ; OutputMonitor above. ; CombineMouseEvent proc far mov ax, ds:[bx].HE_method ; get event type of entry cmp ax, MSG_META_MOUSE_PTR ; see if we should update je Update cmp ax, MSG_META_MOUSE_BUTTON ; see if button event ; (can't compress past button ; event) je CantUpdate Ignore: mov di, PROC_SE_CONTINUE ; if other type event, ignore ret Update: cmp ds:[bx].HE_bp, bp ; different button flags? jne Ignore ; yes!, can't combine mov ds:[bx].HE_cx, cx ; update event mov ds:[bx].HE_dx, dx ; update event mov di, PROC_SE_EXIT ; show we're done ret CantUpdate: mov di, PROC_SE_STORE_AT_BACK ; just put at the back. ret CombineMouseEvent endp COMMENT @---------------------------------------------------------------------- FUNCTION: SendMouseToActiveOrImpliedGrab DESCRIPTION: Send mouse data to active/implied grab CALLED BY: INTERNAL PASS: *ds:si - instance data ax - method cx - x position, screen coordinates dx - y position, screen coordinates bp - flags to send RETURN: *ds:si - instance data of object ax - unchanged cx, dx, bp - unchanged DESTROYED: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Doug 4/89 Initial version ------------------------------------------------------------------------------@ SendMouseToActiveOrImpliedGrab proc near uses ax, bx, cx, dx, si, di, bp class FlowClass .enter mov bx, ds:[si] ; get ptr to instance data ; Assume that we'll use active grab mov di, bx add di, offset FI_activeMouseGrab ; Make sure active grab exists tst ds:[bx].FI_activeMouseGrab.GG_OD.handle jne thisObj ; if it does, use it. ; if it doesn't, use implied mouse grab instead mov di, bx add di, offset FI_impliedMouseGrab thisObj: ; get OD to send method to mov bx, ds:[di].GG_OD.handle mov si, ds:[di].GG_OD.chunk ; Save OD to receive data ; Always set UIFA_IN when sending mouse input to a a geode ; though this is not entirely meaningful, it is better than it ; having a random value in it. ; ornf bp, (mask UIFA_IN) shl 8 tst bx jz unwantedMouseEvent cmp ax, MSG_META_PTR jne nonPtrEvent push cs ;push custom vector on stack mov di, offset CombineMouseEvent push di mov di, mask MF_FORCE_QUEUE or mask MF_CHECK_DUPLICATE or \ mask MF_CUSTOM or mask MF_CHECK_LAST_ONLY or \ mask MF_FIXUP_DS call ObjMessage .leave ret nonPtrEvent: mov di, mask MF_FORCE_QUEUE or mask MF_FIXUP_DS call ObjMessage done: .leave ret unwantedMouseEvent: test bp, mask BI_PRESS ; See if press or not jz afterLostInputCheck ; Let user know that he is annoying ; us ;) mov ax, SST_NO_INPUT call UserStandardSound afterLostInputCheck: jmp short done SendMouseToActiveOrImpliedGrab endp COMMENT @---------------------------------------------------------------------- FUNCTION: ECEnsureEventsNotOutOfOrder DESCRIPTION: Make sure the hold-up queue is empty CALLED BY: INTERNAL PASS: *ds:si - instance data RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Doug 5/91 Initial header ------------------------------------------------------------------------------@ if ERROR_CHECK ECEnsureEventsNotOutOfOrder proc near uses ax, bx class FlowClass .enter ; Make sure nothing is backed up ; mov bx, ds:[si] mov bx, ds:[bx].FI_holdUpInputQueue call GeodeInfoQueue ; see if we've got any events in queue tst ax ERROR_NZ UI_NEW_INPUT_EVENT_PROCESSED_BEFORE_HOLD_UP_QUEUE_FLUSHED .leave ret ECEnsureEventsNotOutOfOrder endp endif COMMENT @---------------------------------------------------------------------- METHOD: FlowObjFlushInputQueue DESCRIPTION: Process this MetaClass method which the flow object normally doesn't have to handle by redirecting it to the HoldUpInputQueue if hold-up mode is in progress. Currently used to process MSG_META_OBJ_FLUSH_INPUT_QUEUE, to make sure that it doesn't pass up MSG_META_WIN_CHANGE's in the queue, which would result in nasty deaths. PASS: *ds:si - instance data es - segment of FlowClass ax - MSG_META_OBJ_FLUSH_INPUT_QUEUE cx - Event dx - Block handle bp - ObjFlushInputQueueNextStop RETURN: nothing DESTROYED: bx, si, di, ds, es PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Doug 4/90 Initial version Doug 5/92 New thread model ------------------------------------------------------------------------------@ FlowObjFlushInputQueue method dynamic FlowClass, \ MSG_META_OBJ_FLUSH_INPUT_QUEUE ; If holding up UI input, send event to HoldUpInputQueue, to be ; processed later ; call CheckOnInputHoldUpLow jc done ; If held up, all done. ; Pass on to superclass (MetaClass) to handle ; mov di, offset FlowClass GOTO ObjCallSuperNoLock done: ret FlowObjFlushInputQueue endm COMMENT @---------------------------------------------------------------------- METHOD: FlowWinChange -- MSG_META_WIN_CHANGE for FlowClass DESCRIPTION: Handles notification from window system that pointer has moved & may possibly be in a new window CALLED BY: IM, UI & other threads: WinSendWinChange WinForceWinChange WinEnsureChangeNotification OutputNonPtr (IM final output stage) WinChangePtrNotification WinClose WinPerformVis (window recalc) WinPerformObscure (window recalc) WinMovePtr OutputMonitor (IM final output stage) WinCheckPtr WinRedoMovePtr WinChangeAck PASS: *ds:si - instance data es - segment of FlowClass ax - MSG_META_WIN_CHANGE cx, dx, bp - Private data to return to WinChangeAck. Currently: cx, dx - screen location to traverse to bp - window handle of tree to traverse to RETURN: nothing DESTROYED: bx, si, di, ds, es REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Doug 3/89 Initial version ------------------------------------------------------------------------------@ if TEST_FLOW winChangeStart word 0 winChangeEnd word 0 endif FlowWinChange method dynamic FlowClass, MSG_META_WIN_CHANGE if TEST_FLOW if _FXIP PrintError <Cannot use TEST_FLOW on full XIP systems> endif push ax, bx call TimerGetCount mov cs:[winChangeStart], ax pop ax, bx endif ; If holding up UI input, send event to HoldUpInputQueue, to be ; processed later ; call CheckOnInputHoldUpLow jc done ; If held up, all done. ; Acknowledge change, send out any enter/leaves ; that have build up. call WinChangeAck ; Returns Implied Grab Window & its input OD ; NOTE: can move object blocks if TEST_FLOW if _FXIP PrintError <Cannot use TEST_FLOW on full XIP systems> endif push ax, bx call TimerGetCount mov cs:[winChangeEnd], ax pop ax, bx endif done: ret FlowWinChange endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% FlowEnterLeave %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DESCRIPTION: Handle reciept of the various enter/leave messages generated by the window system, & relay them on to the proper geode. PASS: *ds:si - instance data ds:di - ptr to start of master instance data es - segment of class ax - MSG_META_RAW_UNIV_ENTER, MSG_META_RAW_UNIV_LEAVE cx:dx - InputOD of window bp - handle of window RETURN: nothing ALLOWED TO DESTROY: bx, si, di, ds, es PSEUDO CODE/STRATEGY/KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- doug 3/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ FlowEnterLeave method dynamic FlowClass, MSG_META_RAW_UNIV_ENTER, MSG_META_RAW_UNIV_LEAVE push cx, dx, bp call GetOwningInputObj ; Get Geode InputObj for Window mov bx, cx mov si, dx pop cx, dx, bp mov di, mask MF_FORCE_QUEUE call ObjMessage ; send message on... ret FlowEnterLeave endm COMMENT @---------------------------------------------------------------------- METHOD: FlowImpliedWinChange -- MSG_META_IMPLIED_WIN_CHANGE for FlowClass DESCRIPTION: Handles notification from window system that the implied window, or window that the mouse is in, has changed. This method is generally called directly, as in NOT via the UI queue, from the window system, just before a MSG_META_VIS_ENTER is delivered. This is so that method handlers for MSG_META_VIS_ENTER can request changes in ptr handling for a window that has just become the implied grab. CALLED BY: WinFlushSendQueue WinCommonEnd WinCommonTraverse WinChangeAck PASS: *ds:si - instance data es - segment of FlowClass ax - MSG_META_IMPLIED_WIN_CHANGE cx:dx - Input OD of implied window, or 0 no window actually has the implied grab. bp - window that ptr is in RETURN: nothing DESTROYED: bx, si, di, ds, es PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Doug 9/89 Initial version Doug 6/91 Changes for 2.0: Figures out & stores implied a a geode instead of window, sends window info on to geode's input objects, generally the GenApplication object. ------------------------------------------------------------------------------@ FlowImpliedWinChange method dynamic FlowClass, MSG_META_IMPLIED_WIN_CHANGE ; Call standard routine to store these ; values in the Implied window grab struct. ; Is ptr in same window as before? cmp bp, ds:[di].FI_impliedWin.MG_gWin je afterChange ; If so, skip taking note of change ; OR in flag to indicate that window ; has changed. ornf ds:[di].FI_flowFlags, \ mask FF_WIN_CHANGE_SINCE_LAST_MSG_META_BUTTON call ImForcePtrMethod ; Make IM generate a PTR METHOD, ; in case the windows actually changed ; out from underneath the mouse, ; just so that the new implied window ; will get a MSG_META_PTR. afterChange: ; Store new implied window mov ds:[di].FI_impliedWin.MG_OD.handle, cx mov ds:[di].FI_impliedWin.MG_OD.chunk, dx mov ds:[di].FI_impliedWin.MG_gWin, bp call FlowUpdateImpliedMouseGrab ; Update implied geode call ImForcePtrMethod ; Make IM generate a PTR METHOD, ; in case the windows actually changed ; out from underneath the mouse, ; just so that the new implied window ; will get a MSG_META_MOUSE_PTR. ret FlowImpliedWinChange endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% FlowGrabMouse %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DESCRIPTION: Creates an active grab for the geode which the mouse is currently over. Generally caused as the result of the user pressing a mouse button down over a window. PASS: *ds:si - instance data ds:di - ptr to start of master instance data es - segment of class ax - MSG_FLOW_GRAB_MOUSE RETURN: nothing ALLOWED TO DESTROY: bx, si, di, ds, es PSEUDO CODE/STRATEGY/KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- doug 2/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ FlowGrabMouseHandler method dynamic FlowClass, MSG_FLOW_GRAB_MOUSE ; Get geode that mouse is over ; mov cx, ds:[di].FI_impliedMouseGrab.GG_OD.handle mov dx, ds:[di].FI_impliedMouseGrab.GG_OD.chunk mov bp, ds:[di].FI_impliedMouseGrab.GG_geode ; Make that the active geode for mouse activity ; mov ds:[di].FI_activeMouseGrab.GG_OD.handle, cx mov ds:[di].FI_activeMouseGrab.GG_OD.chunk, dx mov ds:[di].FI_activeMouseGrab.GG_geode, bp call FlowUpdateWinGeodeActive ; Update window sys active geode call FlowUpdateImpliedMouseGrab ; Update implied geode ret FlowGrabMouseHandler endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% FlowReleaseMouse FlowAllowGlobalTransfer %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DESCRIPTION: Releases active grab, so that mouse is free to interact with whatever geode it is over. Generally a result of all buttons going up on the mouse. PASS: *ds:si - instance data ds:di - ptr to start of master instance data es - segment of class ax - MSG_FLOW_RELEASE_MOUSE or MSG_FLOW_ALLOW_GLOBAL_TRANSFER RETURN: nothing ALLOWED TO DESTROY: bx, si, di, ds, es PSEUDO CODE/STRATEGY/KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- doug 2/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ FlowReleaseMouseHandler method dynamic FlowClass, MSG_FLOW_RELEASE_MOUSE, MSG_FLOW_ALLOW_GLOBAL_TRANSFER ; Do nothing if somehow already released. ; tst ds:[di].FI_activeMouseGrab.GG_OD.handle jz done mov ds:[di].FI_activeMouseGrab.GG_OD.handle, 0 mov ds:[di].FI_activeMouseGrab.GG_OD.chunk, 0 mov ds:[di].FI_activeMouseGrab.GG_geode, 0 call FlowUpdateWinGeodeActive ; Update window sys active geode call FlowUpdateImpliedMouseGrab ; Update implied geode done: ret FlowReleaseMouseHandler endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% FlowReleaseMouseIfGrabbed %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: release active mouse grab, if passed optr has it grabbed CALLED BY: MSG_FLOW_RELEASE_MOUSE_IF_GRABBED PASS: *ds:si = FlowClass object ds:di = FlowClass instance data es = segment of FlowClass ax = MSG_FLOW_RELEASE_MOUSE_IF_GRABBED ^lcx:dx = optr to check RETURN: nothing ALLOWED TO DESTROY: ax, cx, dx, bp bx, si, di, ds, es SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 12/10/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ FlowReleaseMouseIfGrabbed method dynamic FlowClass, MSG_FLOW_RELEASE_MOUSE_IF_GRABBED cmp cx, ds:[di].FI_activeMouseGrab.GG_OD.handle jne done cmp dx, ds:[di].FI_activeMouseGrab.GG_OD.chunk jne done mov ax, MSG_FLOW_RELEASE_MOUSE call ObjCallInstanceNoLock done: ret FlowReleaseMouseIfGrabbed endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% FlowSetModalGeode %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DESCRIPTION: TEMPORARY notification from system object (until flow & system object are merged), to keep flow object up to date on whether there is a system-modal window active PASS: *ds:si - instance data ds:di - ptr to start of master instance data es - segment of class ax - MSG_FLOW_SET_MODAL_GEODE cx:dx - optr of input object of system modal geode (Normally its GenApplication object) bp - system modal geode RETURN: <return info> ALLOWED TO DESTROY: bx, si, di, ds, es PSEUDO CODE/STRATEGY/KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- doug 2/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ FlowSetModalGeode method dynamic FlowClass, MSG_FLOW_SET_MODAL_GEODE ; Just exit out if no change. ; cmp cx, ds:[di].FI_modalGeode.GG_OD.handle jne set cmp dx, ds:[di].FI_modalGeode.GG_OD.chunk jne set cmp bp, ds:[di].FI_modalGeode.GG_geode je done set: mov ds:[di].FI_modalGeode.GG_OD.handle, cx mov ds:[di].FI_modalGeode.GG_OD.chunk, dx mov ds:[di].FI_modalGeode.GG_geode, bp call FlowUpdateWinGeodeActive ; Update window sys active Layer call FlowUpdateImpliedMouseGrab ; Update implied geode done: ret FlowSetModalGeode endm COMMENT @---------------------------------------------------------------------- FUNCTION: FlowUpdateWinGeodeActive DESCRIPTION: Update window system with which geode is active, if any. CALLED BY: INTERNAL PASS: *ds:si - Flow object RETURN: nothing DESTROYED: ax, cx, dx, bp, di PSEUDO CODE/STRATEGY: if FI_modalGeode { Make FI_modalGeode geode active; } else { if FI_activeMouseGrab make its geode active { } else Make no geode active. } } KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Doug 2/92 Initial version ------------------------------------------------------------------------------@ FlowUpdateWinGeodeActive proc near class FlowClass mov di, ds:[si] mov bx, ds:[di].FI_modalGeode.GG_geode tst ds:[di].FI_modalGeode.GG_OD.handle jnz setThisGeodeActive mov bx, ds:[di].FI_activeMouseGrab.GG_geode tst ds:[di].FI_activeMouseGrab.GG_OD.handle jnz setThisGeodeActive clr bx ; set NO geode active setThisGeodeActive: call WinSysSetActiveGeode ret FlowUpdateWinGeodeActive endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% FlowTestWinInteractibility %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DESCRIPTION: Check to see wether mouse should be allowed to interact with window passed, on an implied basis. The mouse is generally allowed to interact with a window, except under certain circumstances: * There is a FI_modalGeode, & it is not the geode that owns the passed window * There is an FI_activeMouseGrab, & it is not the geode that owns the passed window PASS: *ds:si - instance data ds:di - ptr to start of master instance data es - segment of class ax - MSG_FLOW_TEST_WIN_INTERACTIBILITY cx:dx - InputOD of Window bp - handle of Window RETURN: carry - clear if mouse allowed to interact, set if not ALLOWED TO DESTROY: bx, si, di, ds, es PSEUDO CODE/STRATEGY/KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- doug 2/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ FlowTestWinInteractibility method dynamic FlowClass, \ MSG_FLOW_TEST_WIN_INTERACTIBILITY call GetOwningInputObj ; Get Geode InputObj for Window mov di, ds:[si] ; Don't allow interaction of there is a system modal window up ; & the owning geode is different than the owner of the ; passed window. ; tst ds:[di].FI_modalGeode.GG_OD.handle jz afterSysModal cmp cx, ds:[di].FI_modalGeode.GG_OD.handle jne doNotAllowInteraction cmp dx, ds:[di].FI_modalGeode.GG_OD.chunk jne doNotAllowInteraction afterSysModal: ; Don't allow interaction of there is an active geode grab, ; & the geode is different than the owner of the passed window. ; tst ds:[di].FI_activeMouseGrab.GG_OD.handle jz afterActiveGeode cmp cx, ds:[di].FI_activeMouseGrab.GG_OD.handle jne doNotAllowInteraction cmp dx, ds:[di].FI_activeMouseGrab.GG_OD.chunk jne doNotAllowInteraction afterActiveGeode: ;ok: clc ret doNotAllowInteraction: stc ret FlowTestWinInteractibility endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% FlowGetModalGeode %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DESCRIPTION: Fetch modal geode, if any PASS: *ds:si - instance data ds:di - ptr to start of master instance data es - segment of class ax - MSG_FLOW_GET_MODAL_GEODE RETURN: ^lcx:dx - input obj of modal geode, or 0 if none bp - process of modal geode, or 0 if none ALLOWED TO DESTROY: bx, si, di, ds, es PSEUDO CODE/STRATEGY/KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- doug 3/26/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ FlowGetModalGeode method dynamic FlowClass, \ MSG_FLOW_GET_MODAL_GEODE mov di, ds:[si] mov cx, ds:[di].FI_modalGeode.GG_OD.handle mov dx, ds:[di].FI_modalGeode.GG_OD.chunk mov bp, ds:[di].FI_modalGeode.GG_geode ret FlowGetModalGeode endm COMMENT @---------------------------------------------------------------------- FUNCTION: FlowUpdateImpliedMouseGrab DESCRIPTION: Sets FI_impliedMouseGrab based on current implied win info, & whether or not the mouse is allowed to interact with that window on an implied basis. CALLED BY: INTERNAL PASS: *ds:si - Flow object RETURN: nothing DESTROYED: ax, cx, dx, bp, di PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Doug 2/92 Initial version ------------------------------------------------------------------------------@ FlowUpdateImpliedMouseGrab proc near class FlowClass .enter ; Get window mouse is over ; mov di, ds:[si] mov cx, ds:[di].FI_impliedWin.MG_OD.handle mov dx, ds:[di].FI_impliedWin.MG_OD.chunk mov bp, ds:[di].FI_impliedWin.MG_gWin ; Ask ourselves (while allowing developers to subclass & give us a ; different answer), whether the mouse should be allowed in this ; window or not. ; push cx, dx, bp mov ax, MSG_FLOW_TEST_WIN_INTERACTIBILITY call ObjCallInstanceNoLock pop cx, dx, bp jnc haveDecision clr cx, dx, bp ; if not allowed in, clear out implied win optr haveDecision: call FlowSetImpliedMouseGrabFromWin .leave ret FlowUpdateImpliedMouseGrab endp FlowSetImpliedMouseGrabFromWin proc near uses ax, bx, si, di class FlowClass .enter ; cx:dx = optr of object owning window, ; bp = handle of window push cx, dx, bp ; save implied mouse grab call GetOwningInputObj ; Get Geode InputObj for Window ; object that mouse is over in cx:dx mov bx, cx ; Make that bx:si mov si, dx push bx, si ; Save new geode's InputOD ; Store new IMPLIED APPLICATION, get old ; xchg ds:[di].FI_impliedMouseGrab.GG_OD.handle, bx xchg ds:[di].FI_impliedMouseGrab.GG_OD.chunk, si mov ds:[di].FI_impliedMouseGrab.GG_geode, bp ; See if IMPLIED APPLICATION has changed ; cmp ds:[di].FI_impliedMouseGrab.GG_OD.handle, bx jne impliedMouseGrabChanged cmp ds:[di].FI_impliedMouseGrab.GG_OD.chunk, si je afterChangeTest impliedMouseGrabChanged: ; Tell old IMPLIED APPLICATION that the mouse is off in a black hole ; somewhere (another geode, in reality) ; clr cx, dx, bp mov ax, MSG_META_IMPLIED_WIN_CHANGE mov di, mask MF_FORCE_QUEUE or mask MF_FIXUP_DS call ObjMessage afterChangeTest: pop bx, si ; get new geode's InputOD pop cx, dx, bp ; get implied mouse grab ; Send IMPLIED_WIN_CHANGE on to geode owning object mouse is over ; mov ax, MSG_META_IMPLIED_WIN_CHANGE mov di, mask MF_FORCE_QUEUE or mask MF_FIXUP_DS call ObjMessage .leave ret FlowSetImpliedMouseGrabFromWin endp COMMENT @---------------------------------------------------------------------- FUNCTION: GetOwningInputObj DESCRIPTION: Given Window, return Geode & InputObj to handle input directed towards it. By definition, the owner of the window is the one which will handle input for it. The optr of the InputObj is stored in that geode's private data. CALLED BY: INTERNAL PASS: ^hbp - Window RETURN: ^hbp - Geode ^lcx:dx - InputObj of Geode DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Doug 3/92 Initial version ------------------------------------------------------------------------------@ GetOwningInputObj proc near uses bx, si .enter if (0) tst cx jz noObject thisBlock: mov bx, cx call MemOwner call WinGeodeGetInputObj jmp short done noObject: mov cx, bp tst cx jnz thisBlock done: tst bp ; get geode owning window jz haveGeode mov bx, bp call MemOwner mov bp, bx haveGeode: else clr cx, dx tst bp jz done mov bx, bp call MemOwner mov bp, bx call WinGeodeGetInputObj done: endif .leave ret GetOwningInputObj endp COMMENT @---------------------------------------------------------------------- METHOD: FlowEnsureMouseNotActivelyTrespassing DESCRIPTION: PASS: *ds:si - instance data es - segment of FlowClass ax - MSG_META_ENSURE_MOUSE_NOT_ACTIVELY_TRESPASSING RETURN: nothing DESTROYED: bx, si, di, ds, es PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Doug 6/90 Initial version ------------------------------------------------------------------------------@ FlowEnsureMouseNotActivelyTrespassing method dynamic FlowClass, \ MSG_META_ENSURE_MOUSE_NOT_ACTIVELY_TRESPASSING ; Get active/implied geode ; call FlowGetActiveOrImpliedMouseGrab mov bx, cx ; ^bx:si = app object mov si, dx ; Have it send the method on to all items on its application's window ; list. ; push bx, si clr bx, si ; message for all list entries mov ax, MSG_META_ENSURE_MOUSE_NOT_ACTIVELY_TRESPASSING mov di, mask MF_RECORD call ObjMessage ; di = event pop bx, si mov dx, size GCNListMessageParams sub sp, dx mov bp, sp mov ss:[bp].GCNLMP_ID.GCNLT_manuf, MANUFACTURER_ID_GEOWORKS mov ss:[bp].GCNLMP_ID.GCNLT_type, GAGCNLT_WINDOWS mov ss:[bp].GCNLMP_block, 0 mov ss:[bp].GCNLMP_event, di mov ss:[bp].GCNLMP_flags, 0 mov ax, MSG_META_GCN_LIST_SEND mov di, mask MF_FORCE_QUEUE or mask MF_FIXUP_DS or mask MF_STACK call ObjMessage add sp, size GCNListMessageParams ret FlowEnsureMouseNotActivelyTrespassing endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% FlowNotify %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: This routine passes on MSG_META_NOTIFIES. CALLED BY: GLOBAL PASS: nada RETURN: nada DESTROYED: nada PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- atw 11/22/91 Initial version IP 04/16/94 changed for new hwr spec lester 12/ 5/96 modified to handle GWNT_INK_DIGITIZER_COORDS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ FlowNotify method dynamic FlowClass, MSG_META_NOTIFY_WITH_DATA_BLOCK, MSG_META_NOTIFY cmp dx, GWNT_INK je checkManufacturerID if INK_DIGITIZER_COORDS cmp dx, GWNT_INK_DIGITIZER_COORDS je checkManufacturerID endif cmp dx, GWNT_INK_GESTURE jne sendToActiveApp checkManufacturerID: cmp cx, MANUFACTURER_ID_GEOWORKS jne sendToActiveApp EC < test ds:[di].FI_flowFlags, mask FF_PROCESSING_INK > EC < ERROR_Z UI_FLOW_RECEIVED_UNEXPECTED_INK > ; ; if the message is a gesture, do not want to clear the processing ink ; flag yet. This is because there could still be more gesture messages ; to come, or there could still be ink that was not recognized as a ; gesture to process. After all the ink has been processed the ink ; input management will send a GWNT_INK to clear the processing ink flag. ; cmp dx, GWNT_INK_GESTURE je notInkData if INK_DIGITIZER_COORDS ; We don't want to clear the processing ink flag on the ; GWNT_INK_DIGITIZER_COORDS notification; we want to wait ; until we get the GWNT_INK notification. cmp dx, GWNT_INK_DIGITIZER_COORDS je doNotClearProccessingInk endif andnf ds:[di].FI_flowFlags, not mask FF_PROCESSING_INK if INK_DIGITIZER_COORDS doNotClearProccessingInk: endif tst bp ;If there was no ink, due to a memory error jz exit ; or because the window was null, just eat ; this notification. ; ; if the data is ink, set the destination object ; mov bx, bp call MemLock mov es, ax if INK_DIGITIZER_COORDS mov si, offset IDCH_destination cmp dx, GWNT_INK_DIGITIZER_COORDS je gotOffset mov si, offset IH_destination gotOffset: movdw es:[si], ds:[di].FI_inkDestination.IG_OD, ax else movdw es:[IH_destination], ds:[di].FI_inkDestination.IG_OD, ax endif call MemUnlock notInkData: ; Send the data to the geode. movdw bxsi, ds:[di].FI_inkDestination.IG_OD mov ax, MSG_META_NOTIFY_WITH_DATA_BLOCK mov di, mask MF_FORCE_QUEUE GOTO ObjMessage sendToActiveApp: mov di, ds:[si] ; Send this off to the "current app" - the app with the kbd grab. ; If nobody has a kbd grab, send it to the active or mouse grab. ; If there nobody has any grabs, send it to the UI app itself, to allow ; for default handling of things like the hard icon bar. .assert offset KG_OD eq offset GG_OD mov bx, offset FI_activeKbdGrab tst ds:[di].FI_activeKbdGrab.KG_OD.handle jnz sendToGrab mov bx, offset FI_activeMouseGrab tst ds:[di].FI_activeMouseGrab.GG_OD.handle jnz sendToGrab tst ds:[di].FI_impliedMouseGrab.GG_OD.handle jz sendToUI mov bx, offset FI_impliedMouseGrab sendToGrab: mov si, ds:[di][bx].GG_OD.chunk mov bx, ds:[di][bx].GG_OD.handle sendIt: mov di, mask MF_FIXUP_DS ; ; Check duplicate if it's a hard icon event. Drop it if we're low on ; handles. ; CheckHack <MANUFACTURER_ID_GEOWORKS eq 0> tst cx ; see if MANUFACTURER_ID_GEOWORKS jne hasFlags cmp dx, GWNT_STARTUP_INDEXED_APP je checkDup cmp dx, GWNT_HARD_ICON_BAR_FUNCTION jne hasFlags checkDup: CheckHack <segment FNCheckDuplicateHardIconEvent eq @CurSeg> push cs ; ObjMessage is in a fixed segment ... mov di, offset FNCheckDuplicateHardIconEvent push di mov di, mask MF_FIXUP_DS or mask MF_FORCE_QUEUE \ or mask MF_CHECK_DUPLICATE or mask MF_CUSTOM \ or mask MF_CAN_DISCARD_IF_DESPERATE hasFlags: call ObjMessage exit: ret sendToUI: mov si, offset UIApp mov bx, handle UIApp jmp short sendIt FlowNotify endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% FNCheckDuplicateHardIconEvent %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Callback routine to replace or drop duplicated hard icon events. CALLED BY: (INTERNAL) FlowNotify, UserMetaNotify (via ObjMessage) PASS: ax, cx, dx, bp = event being sent ds:bx = HandleEvent in queue RETURN: di = flags (PROC_SE_EXIT, PROC_SE_STORE_AT_BACK, PROC_SE_CONTINUE) DESTROYED: nothing SIDE EFFECTS: PSEUDO CODE/STRATEGY: - For GWNT_HARD_ICON_BAR_FUNCTION, drop new event if there exists one in the queue with the same index. - For GWNT_STARTUP_INDEXED_APP, replace the index in any existing event with the index of the new event, then drop the new one. REVISION HISTORY: Name Date Description ---- ---- ----------- AY 5/ 3/95 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ FNCheckDuplicateHardIconEvent proc far if ERROR_CHECK ; ; This routine is supposed to be used for only MSG_META_NOTIFY( ; MANUFACTURER_ID_GEOWORKS, GWNT_HARD_ICON_BAR_FUNCTION / ; GWNT_STARTUP_INDEXED_APP) ; Assert e, ax, MSG_META_NOTIFY Assert e, cx, MANUFACTURER_ID_GEOWORKS cmp dx, GWNT_HARD_ICON_BAR_FUNCTION je EC_ok Assert e, dx, GWNT_STARTUP_INDEXED_APP EC_ok: endif ; ERROR_CHECK CheckHack <PROC_SE_CONTINUE eq 0> clr di ; di = PROC_SE_CONTINUE cmp ax, ds:[bx].HE_method jne checkDone cmp cx, ds:[bx].HE_cx jne checkDone cmp dx, ds:[bx].HE_dx jne checkDone cmp dx, GWNT_HARD_ICON_BAR_FUNCTION jne checkStartApp ; ; Events are GWNT_HARD_ICON_BAR_FUNCTION. If indices match, drop new ; event. Else continue. ; cmp bp, ds:[bx].HE_bp je drop ret ; <--- RETURNS HERE checkStartApp: ; ; Events are GWNT_STARTUP_INDEXED_APP. Replace index in queued event ; with new index. ; mov ds:[bx].HE_bp, bp drop: mov di, PROC_SE_EXIT checkDone: ret FNCheckDuplicateHardIconEvent endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% FlowInkPressAndHoldTimeout %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: This is the method invoked when the ink press and hold timeout timer expires. CALLED BY: GLOBAL PASS: bp - timer id RETURN: nada DESTROYED: ax, cx, dx, bp PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- atw 12/17/91 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ FlowInkPressAndHoldTimeout method dynamic FlowClass, MSG_FLOW_INK_PRESS_AND_HOLD_TIMEOUT .enter ; If BP != inkPressHoldTimerID, then we have already stopped this timer, ; so ignore this event. cmp bp, ds:[di].FI_inkPressHoldTimerID jne exit mov ax, SST_KEY_CLICK call UserStandardSound clr ds:[di].FI_inkPressHoldTimerID clr ds:[di].FI_inkPressHoldTimerHan test ds:[di].FI_flowFlags, mask FF_AWAITING_PRESS_AND_HOLD_TIMER jne sendMsg ornf ds:[di].FI_flowFlags, mask FF_HAS_INK_OVERRIDE exit: .leave ret sendMsg: mov ax, MSG_FLOW_INK_REPLY mov cx, IRV_NO_INK call ObjCallInstanceNoLock jmp exit FlowInkPressAndHoldTimeout endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% FlowInkReply %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: This method handler is invoked when an geode has determined whether or not a previous press is ink or not. CALLED BY: GLOBAL PASS: cx - InkReturnValue bp - 0 or handle of block with InkDestinationInfo RETURN: nada DESTROYED: nada PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- atw 12/ 2/91 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ FlowInkReply method dynamic FlowClass, MSG_FLOW_INK_REPLY cmp cx, IRV_NO_INK ; je noInk ; tst bp jz noDestInfo mov bx, bp call MemLock mov es, ax movdw ds:[di].FI_inkDestination.IG_OD, es:[IDI_destObj], ax mov bp, es:[IDI_gstate] push es:[IDI_brushSize] mov_tr ax, cx movdw cxdx, es:[IDI_gestureCallback] call MemFree pop bx ;BX <- brush width/height jmp 10$ noDestInfo: mov_tr ax, cx mov bp, ds:[di].FI_inkDestination.IG_gState mov bx, ds:[di].FI_inkBrushSize movdw cxdx, ds:[di].FI_inkGestureCallback 10$: EC < cmp ax, IRV_INK_WITH_STANDARD_OVERRIDE > EC < je 11$ > EC < cmp ax, IRV_DESIRES_INK > EC < ERROR_NZ UI_INVALID_INK_RETURN_VALUE > EC < 11$: > cmp ax, IRV_DESIRES_INK mov ax, TRUE je doReply test ds:[di].FI_flowFlags, mask FF_HAS_INK_OVERRIDE jne noInk ;If the press/hold timer has expired, this ; isn't ink. ; We don't have an ink override yet - there are 2 possible reasons: ; ; 1) The timer hasn't expired yet ; 2) The user has moved the mouse or has somehow indicated that ; he wants ink. mov ax, TRUE ;If it is case #2 above, branch to force ink tst ds:[di].FI_inkPressHoldTimerHan jz doReply ; Otherwise, the user hasn't done anything to force us to have ink ; or not, but the timer hasn't expired yet, so just set the bit saying ; that we are waiting for the timer. mov ds:[di].FI_inkDestination.IG_gState, bp mov ds:[di].FI_inkBrushSize, bx movdw ds:[di].FI_inkGestureCallback, cxdx ornf ds:[di].FI_flowFlags, mask FF_AWAITING_PRESS_AND_HOLD_TIMER ret noInk: clr ax tst ds:[di].FI_inkDestination.IG_gState jz doReply push di mov di, ds:[di].FI_inkDestination.IG_gState call GrDestroyState pop di doReply: ; Nuke the press-hold timer if necessary tst ds:[di].FI_inkPressHoldTimerHan jz 20$ call NukePressHoldTimer 20$: call ImInkReply ;Notify the IM about the status of this last ; ink press. ; If it was ink, set the flag telling the flow object to eat all the ; incoming events until a MSG_META_NOTIFY_WITH_DATA_BLOCK w/GWNT_INK is ; received. ; ; If it wasn't ink then set the flag telling the flow object to let the ; next START_SELECT pass through unmolested. tst ax mov al, mask FF_LAST_PRESS_WAS_NOT_INK jz notInk mov al, mask FF_PROCESSING_INK notInk: or ds:[di].FI_flowFlags, al andnf ds:[di].FI_flowFlags, not (mask FF_HAS_INK_OVERRIDE or \ mask FF_AWAITING_PRESS_AND_HOLD_TIMER) GOTO FlowResumeInput FlowInkReply endp COMMENT @---------------------------------------------------------------------- METHOD: FlowButton -- MSG_META_MOUSE_BUTTON for FlowClass DESCRIPTION: Disperses BUTTON to the current mouse grab CALLED BY: Input Manager (see Library/IM/imMain.asm) PASS: *ds:si - instance data es - segment of FlowClass ax - MSG_META_MOUSE_BUTTON cx - x position, mouse source window coordinates dx - y position, mouse source window coordinates bp - high byte shiftState, low byte buttonInfo RETURN: nothing DESTROYED: bx, si, di, ds, es PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Doug 3/89 Initial version Jim 12/89 Added support for screen saver function AY 5/17/94 Added list of no-ink windows ------------------------------------------------------------------------------@ if TEST_FLOW pressStart word 0 releaseStart word 0 pressEnd word 0 releaseEnd word 0 testBP word 0 endif FlowButton method dynamic FlowClass, MSG_META_MOUSE_BUTTON if TEST_FLOW if _FXIP PrintError <Cannot use TEST_FLOW on full XIP systems> endif push ax, bx call TimerGetCount mov cs:[testBP], bp test bp, mask BI_PRESS jz testRelease mov cs:[pressStart], ax jmp testCommon testRelease: mov cs:[releaseStart], ax testCommon: pop ax, bx endif ; If we are eating mouse events until a MSG_META_NOTIFY_WITH_DATA_BLOCK ; w/GWNT_INK is received then exit (eat this event). test ds:[di].FI_flowFlags, mask FF_PROCESSING_INK jnz done tst ds:[di].FI_inkPressHoldTimerHan jnz checkToNukePressHoldTimer afterPressHoldTimer: ; If holding up UI input, send event to HoldUpInputQueue, to be ; processed later ; call CheckOnInputHoldUpLow jc done ; If held up, all done. call SysGetPenMode ; checks for ink. tst ax jnz doInkCheck afterInkCheck: ; Generate MSG_FLOW_GRAB_MOUSE, if mouse newly pressed. ; Leave registers alone, thank you. ; call CheckForFlowGrabMouse mov ax, MSG_META_MOUSE_BUTTON test bp, mask BI_PRESS ; See if press or not jz afterFirstPressCheck ;Check to see if this is the first button press in a new window ; test ds:[bx].FI_flowFlags, \ mask FF_WIN_CHANGE_SINCE_LAST_MSG_META_BUTTON pushf andnf ds:[bx].FI_flowFlags, \ not mask FF_WIN_CHANGE_SINCE_LAST_MSG_META_BUTTON popf jz afterFirstPressCheck ; clear the double-press flag if first ; press in new window andnf bp, not mask BI_DOUBLE_PRESS afterFirstPressCheck: ;update some Flow object variables ; activeMouseButtonInfo ; activeMouseUIFunctionsActive ; activeMouseFunction ; segmov es, dgroup, bx ; SH call UpdateFunctionsActive ; returns bp = [UIFunctionsActive ; | buttonInfo ] call AdjustMousePosForBump ; Adjust x, y pos for previous bump mov bx, ds:[si] ;If we are in pen mode, branch to do mov ax, ds:[bx].FI_activeMouseMethod ;get method call SendMouseToActiveOrImpliedGrab ; Generate MSG_FLOW_GEODE_RELEASE, if mouse newly released. ; Leave registers alone, thank you. ; call CheckForFlowReleaseMouse done: if TEST_FLOW if _FXIP PrintError <Cannot use TEST_FLOW on full XIP systems> endif push ax, bx call TimerGetCount test cs:[testBP], mask BI_PRESS jz testRelease2 mov cs:[pressEnd], ax jmp testCommon2 testRelease2: mov cs:[releaseEnd], ax testCommon2: pop ax, bx endif ret checkToNukePressHoldTimer: ; Should we nuke the ink press/hold timer? test bp, mask BI_B0_DOWN ;If the mouse is still down, no... jnz afterPressHoldTimer call NukePressHoldTimer jmp afterPressHoldTimer doInkCheck: ; DO INK-SPECIFIC CHECKING ; If the event is a START_SELECT, and we are in pen mode, then check to ; see if the press is on an "actionable" gadget. If the gadget is not ; actionable, then begin ignoring mouse events and processing ink. test bp, mask BI_B1_DOWN or mask BI_B2_DOWN or mask BI_B3_DOWN jne afterInkCheck test bp, mask BI_B0_DOWN jz afterInkCheck test ds:[bx].FI_flowFlags, mask FF_LAST_PRESS_WAS_NOT_INK jz 90$ andnf ds:[bx].FI_flowFlags, not mask FF_LAST_PRESS_WAS_NOT_INK jmp afterInkCheck 90$: test ds:[bx].FI_holdUpInputFlags, mask HUIF_HOLD_UP_MODE_DISABLED LONG jnz notInk ; ; This is a possible ink item, so: ; ; 1) Send a MSG_QUERY_IF_HANDLES_INK to the active geode (if none, then ; there is no ink). ; ; 2) Begin holding up input, and pass this MSG_META_START_SELECT off to ; the holdup queue. ; ; ; Save the OD of the geode the QUERY_IF_PRESS_IS_INK is being ; sent to, so we know where to send the ink to. push si mov si, ds:[si] mov bx, ds:[si].FI_activeMouseGrab.GG_OD.handle mov ax, ds:[si].FI_activeMouseGrab.GG_OD.chunk tst bx jnz 10$ ; No active mouse grab. See if implied window is in the no-ink list mov bx, cx ; save x pos in bx segmov es, ds, di lea di, ds:[si].FI_noInkWin ; es:di = window handle list mov ax, ds:[si].FI_impliedWin.MG_gWin ; ax = window under pen mov cx, ds:[si].FI_numNoInkWin tst di ; clear ZF, since di always != 0 repne scasw mov cx, bx ; cx = x pos je notInkPopSI ; if found, window doesn't accept ink mov bx, ds:[si].FI_impliedMouseGrab.GG_OD.handle mov ax, ds:[si].FI_impliedMouseGrab.GG_OD.chunk 10$: movdw ds:[si].FI_inkDestination.IG_OD, bxax ; Clear out ink gstate/brush size clr ds:[si].FI_inkDestination.IG_gState clr ds:[si].FI_inkBrushSize clrdw ds:[si].FI_inkGestureCallback tst bx ;If noone has a grab, then ; the press is not ink. notInkPopSI: pop si jz notInk ; Startup "press and hold" timer push cx, dx mov al, TIMER_EVENT_ONE_SHOT mov bx, ds:[LMBH_handle] mov cx, PRESS_AND_HOLD_TIME mov dx, MSG_FLOW_INK_PRESS_AND_HOLD_TIMEOUT call TimerStart pop cx, dx mov di, ds:[si] mov ds:[di].FI_inkPressHoldTimerHan, bx mov ds:[di].FI_inkPressHoldTimerID, ax mov ds:[di].FI_inkStartPoint.P_x, cx mov ds:[di].FI_inkStartPoint.P_y, dx mov ax, MSG_META_QUERY_IF_PRESS_IS_INK call SendMouseToActiveOrImpliedGrab call FlowHoldUpInput ;Hold up all input until the geode ; says if it has ink or not mov ax, MSG_META_MOUSE_BUTTON ;Add event to input queue call CheckOnInputHoldUpLow EC < ERROR_NC UI_FLOW_INK_HOLD_UP_INPUT_FAILED > jmp done notInk: clr ax ;Tell the IM that this wasn't ink, call ImInkReply ; as we can't hold up input... mov ax, MSG_META_MOUSE_BUTTON mov bx, ds:[si] jmp afterInkCheck FlowButton endm COMMENT @---------------------------------------------------------------------- FUNCTION: CheckForFlowGrabMouse DESCRIPTION: Figure out if the mouse has been newly pressed. If so, generate MSG_FLOW_GRAB_MOUSE to instruct system-wide input controller (currently us) to set up an active grab for the geode the mouse is over. CALLED BY: INTERNAL FlowButton PASS: *ds:si - flow object bp low - ButtonFlags RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Doug 11/91 Initial version ------------------------------------------------------------------------------@ CheckForFlowGrabMouse proc near uses ax, cx, dx, bp, di class FlowClass .enter mov di, ds:[si] ; See if mouse has transitioned from no buttons down to any button(s) ; down, or visa-versa ; mov ax, bp and al, mask BI_B3_DOWN or mask BI_B2_DOWN or mask BI_B1_DOWN or \ mask BI_B0_DOWN jz done test ds:[di].FI_flowFlags, mask FF_MOUSE_DOWN jnz done ; exit if already down ornf ds:[di].FI_flowFlags, mask FF_MOUSE_DOWN ; transition DOWN ; Perform default, system-wide behavior for mouse click in a window ; call DefaultBehaviorOnMousePress done: .leave ret CheckForFlowGrabMouse endp COMMENT @---------------------------------------------------------------------- FUNCTION: CheckForFlowReleaseMouse DESCRIPTION: Figure out if the mouse has been fully released. If so, generate MSG_FLOW_GEODE_RELEASE to instruct system-wide input controller to release geode grab set up earlier CALLED BY: INTERNAL FlowButton PASS: *ds:si - flow object bp low - ButtonFlags RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Doug 11/91 Initial version ------------------------------------------------------------------------------@ CheckForFlowReleaseMouse proc near uses ax, di class FlowClass .enter mov di, ds:[si] ; See if mouse has transitioned from no buttons down to any button(s) ; down, or visa-versa ; mov ax, bp and al, mask BI_B3_DOWN or mask BI_B2_DOWN or mask BI_B1_DOWN or \ mask BI_B0_DOWN jnz done test ds:[di].FI_flowFlags, mask FF_MOUSE_DOWN jz done ; exit if already up andnf ds:[di].FI_flowFlags, not mask FF_MOUSE_DOWN ; transition UP push cx, dx, bp mov ax, MSG_FLOW_RELEASE_MOUSE call ObjCallInstanceNoLock pop cx, dx, bp done: .leave ret CheckForFlowReleaseMouse endp COMMENT @---------------------------------------------------------------------- FUNCTION: DefaultBehaviorOnMousePress DESCRIPTION: Perform default, system-wide behavior for mouse click in a window. Default behavior is: * "Click to raise": By default, we'd like applications that are clicked in to be raised to the top. Almost always, that is... apps having windows that float on top of the field/screen may not wished to be raised themselves if those windows are clicked in (e.g. Keycaps). Because of this, we stipulate that only windows having LayerID = owning geode of window, which sit directly on a window owned by a different geode, if clicked in, will be cause for the Layer they reside in to be raised to the top (This is the case for Primary, command, & app modal windows). Note that the layer is raised as a whole, & no raising of individual windows within the layer is performed -- this should be handled locally within the app. * Focus/Target Also by default, we'd like to give any application clicked on the Focus & Target, if they'll have it. Here we're slightly more lenient than above, removing the stipulation that the parent window must be owned by a different geode in order to perform the default behavior. This means that ANY window within the app (including things like views), if having LayerID = owning geode of window, if clicked in, will result in the geode's InputObj being given the focus/target within their parent FT node object. * More CPU power for top geode, accomplished by modifying priority of its thread(s). * Multiple windows under an Application with different LayerID's In some situations there are applications in which all the windows under the application are not in the same layer. In this case, there is different default behavior. The LayerID of a window is either its owning Geode (almost all of the time) or (by convention) the block handle of the block that the window object is in. When a window is clicked in that does not have the LayerID equal to its owning Geode we bring this layer to the top and give the object the focus and target, then bring the owning geode LayerID to the top *without* changing the focus and target. CALLED BY: INTERNAL CheckForFlowGrabMouse PASS: *ds:si - flow object RETURN: nothing DESTROYED: ax, bx, cx, dx, di, bp PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Doug 3/92 Initial version dlitwin 8/11/92 New behavior for multiple LayerID's ------------------------------------------------------------------------------@ DefaultBehaviorOnMousePress proc near uses bx, si class FlowClass .enter ; Grab mouse for geode ; mov ax, MSG_FLOW_GRAB_MOUSE call ObjCallInstanceNoLock ; If currently in a modal state, that's it. mov di, ds:[si] tst ds:[di].FI_modalGeode.GG_OD.handle jnz done ; If the window that's been clicked on is a member of the common ; Geode LayerID (LayerID = geode handle), then raise the layer to ; the top, & give the geode the focus & target. clr dx ; in case no window clicked on mov di, ds:[si] ; save geode on stack push ds:[di].FI_impliedMouseGrab.GG_geode mov di, ds:[di].FI_impliedWin.MG_gWin ; get Window clicked in tst di jz afterAutoRaiseParams call FindBoundary ; Get parent window in di, ; WinPriorityData of window in al, ; LayerID of window in dx mov bp, di afterAutoRaiseParams: pop cx tst dx jz goForIt ; ; We check if the layerID is greater than or equal to LAYER_PRIO_STD ; because the the higher the layer Priority, the lower the number. ; This means that any layers below Standard get raised in their own ; layer when clicked on, and any layers above Standard most likely ; won't (see check below) ; and al, mask WPD_LAYER cmp al, LAYER_PRIO_STD shl (offset WPD_LAYER) jge goForIt ; ; If a layer has higher priority than Standard and is not the owning ; geode's layer the default behavior is to NOT raise it. This is to ; support windows in layers like LAYER_PRIO_ON_TOP not getting the ; focus and target even though they are clicked on (specifically used ; in KeyCaps). ; cmp cx, dx ; LayerID = the owning geode? jne done ; if not skip bring to top goForIt: push cx, dx, bp ; save owning Geode, LayerID, parent window mov ax, MSG_GEN_SYSTEM_BRING_GEODE_TO_TOP call UserCallSystem pop cx, dx, bp ; restore owning Geode, LayerID, parent window ; ; If a geode other than the UI is clicked on, we must ensure that the ; UIApplication is not hogging the focus exclusive within in the ; system object. (The UIApplication's FT parent node is the system ; object.) ; cmp cx, handle 0 ; UI? je afterUI push cx, dx, bp, si mov ax, MSG_META_RELEASE_FOCUS_EXCL mov bx, handle UIApp mov si, offset UIApp mov di, mask MF_CALL or mask MF_FIXUP_DS call ObjMessage mov ax, MSG_META_ENSURE_ACTIVE_FT call UserCallSystem pop cx, dx, bp, si afterUI: ; ; The LayerID of a window is either its owning Geode (almost all ; of the time) or (by convention) the block handle of the block ; that the window object is in. In the first case we just continue ; by skipping to the exit of the routine. We can check if the ; LayerID is the owning Geode like above. In the second case the ; default behavior is that when a window is clicked in that does not ; have the LayerID equal to its owning Geode we bring this layer to ; the top and give the object the focus and target and then bring the ; owning geode to the top without changing the focus and target. ; cmp cx, dx je done ; if LayerID = Owning Geode mov ax, MSG_GEN_SYSTEM_BRING_GEODE_TO_TOP mov dx, cx ; Owning Geode is LayerID clr cx ; no Focus/Target change call UserCallSystem done: .leave ret DefaultBehaviorOnMousePress endp COMMENT @---------------------------------------------------------------------- FUNCTION: FindBoundary DESCRIPTION: Starting at passed window, walk up tree to find field or screen CALLED BY: INTERNAL DerfaultBehaviorOnMousePress PASS: *ds:si - object di - window RETURN: di - First field, screen or other window up tree from window passed which is owned by a different geode. (or 0 if same owner as the top window in tree) dx - LayerID of last window before above window up tree al - WinPriorityData of last window before above window up tree DESTROYED: ah PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Doug 3/92 Initial version ------------------------------------------------------------------------------@ FindBoundary proc near uses bx, cx, si .enter mov bx, di call MemOwner ; get owner of window passed mov dx, bx ; keep around in dx for comparison searchLoop: mov si, WIT_PARENT_WIN call WinGetInfo ; get ax = parent window mov cx, di ; save child window in cx mov di, ax ; put new window in di tst di ; if NULL, can't go any farther. jz haveParentWinIfAny mov bx, di call MemOwner cmp bx, dx je searchLoop ; keep looking if same owner haveParentWinIfAny: push di mov di, cx ; get LayerID of child window mov si, WIT_LAYER_ID call WinGetInfo mov dx, ax ; return in dx mov si, WIT_PRIORITY ; get WinPriorityData call WinGetInfo ; return in al pop di .leave ret FindBoundary endp COMMENT @---------------------------------------------------------------------- FUNCTION: UpdateFunctionsActive DESCRIPTION: Update the flow variable used to record the active button functions. CALLED BY: FlowButton (ONLY) PASS: *ds:si - Instance data ax, cx, dx, bp - MSG_META_MOUSE_BUTTON data es = dgroup RETURN: bp high = UIFunctionsActive (UIFA_SELECT, etc) bp low - buttonInfo (from Input Manager) DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 9/89 Initial version Eric 12/89 Updated header and comments ------------------------------------------------------------------------------@ UpdateFunctionsActive proc near class FlowClass push ax, bx, di ;bp EC < push ax, bx > EC < mov bx, es > EC < mov ax, segment dgroup > EC < cmp ax, bx > EC < ERROR_NZ 0 > EC < pop ax, bx > ; translate to generic method call TranslateButton ; translate to generic method ; ax = generic mouse method ; di = Init preferences for ; function type chosen ; Set bp high to use old UIFunctionsActive ; call UpdateBPHighWithFunctionsActive ; NOW, update active function & UIFunctionsActive info push di ;compute function number using method # clr bx ;clear result flags mov di, ax sub di, MSG_META_START_SELECT shr di, 1 ;shift out start/stop bit mov bh, cs:[activeFunctionMasks][di];get "mask UIFA_SELECT" etc pop di jc endMethod ;skip if is END method... ;startMethod: ; is a START method -- set flag in UI global Flow Object variable:far ornf bp, bx cmp ax, MSG_META_START_OTHER ; Is this button not attached ; to a function, or pressed ; while another function ; active? je done ; if so, store new method ; & flags, but LEAVE original ; "Function" in progress. ; HERE IF REAL, NEW UI FUNCTION STARTING ; ; Clear out preferences ; associated w/function andnf bp, not (mask UIFA_PREF_A or mask UIFA_PREF_B or \ mask UIFA_PREF_C) shl 8 ornf bp, di ; OR in new preferences mov bx, bp ; Store away button # which andnf bl, mask BI_BUTTON ; started the function mov di, ds:[si] mov ds:[di].FI_activeMouseButton, bl ; Store current active function mov ds:[di].FI_activeMouseFunction,ax jmp short done endMethod: mov di, ds:[si] ; stopping a method -- reset "UIFA_SELECT", etc. flag. ; Clear out preference bits not bx andnf bp, bx cmp ax, MSG_META_END_OTHER ; Is this a button not ; attached to a function, or ; release while another button ; active? je done ; if so, store new method ; & flags, but LEAVE original ; "Function" in progress. ; HERE IF REAL, UI FUNCTION ENDING ; mov ds:[di].FI_activeMouseButton, -1; NO button causing active ; function mov ds:[di].FI_activeMouseFunction, 0 ; NO mouse function in action done: mov di, ds:[si] mov bx, bp mov ds:[di].FI_activeMouseButtonInfo, bl mov ds:[di].FI_activeMouseUIFunctionsActive, bh mov ds:[di].FI_activeMouseMethod,ax ; save current method EC < tst ax ; Must be a method... > EC < ERROR_Z UI_ERROR_CURRENT_MOUSE_MSG_SHOULD_NOT_BE_NULL > ;save [UIFunctionsActive | buttonInfo] pop ax, bx, di ret UpdateFunctionsActive endp ;index this table with: ; ( method - MSG_META_START_SELECT ) / 2 ;to translate a method to one of these masks activeFunctionMasks label byte byte mask UIFA_SELECT byte mask UIFA_MOVE_COPY byte mask UIFA_FEATURES byte 0 ; "OTHER" bit COMMENT @---------------------------------------------------------------------- FUNCTION: FlowTerminateActiveMouseFunction DESCRIPTION: Terminates any active mouse function, forcing it to become a lowly "OTHER" function in progress. Used by the specific UI to "Kill" the START_SELECT in progress when the system menu is double-clicked on & held. The problems was that PTR events following were marked as being a SELECT operation, & the window UNDER the window which was closed starts reacting to the SELECT operation. NOTE: This function may only be called from the UI thread (i.e. must be kept synchronous w/UI) CALLED BY: GLOBAL OLMenuButtonStartSelect (In Motif, via VisCallParent) PASS: nothing RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Doug 10/90 Initial version ------------------------------------------------------------------------------@ FlowTerminateActiveMouseFunction method dynamic FlowClass, MSG_VIS_VUP_TERMINATE_ACTIVE_MOUSE_FUNCTION ; See if there really is an ; active function in progress mov ax, ds:[di].FI_activeMouseFunction cmp ax, MSG_META_START_SELECT je haveActiveFunction cmp ax, MSG_META_START_MOVE_COPY je haveActiveFunction cmp ax, MSG_META_START_FEATURES jne done haveActiveFunction: mov ds:[di].FI_activeMouseButton, -1; NO button causing active ; function mov ds:[di].FI_activeMouseFunction, 0 ; Clear the active function flags (both places it is stored) ; and ds:[di].FI_activeMouseUIFunctionsActive, \ not ( mask UIFA_SELECT or \ mask UIFA_MOVE_COPY or \ mask UIFA_FEATURES ) done: ret FlowTerminateActiveMouseFunction endm COMMENT @---------------------------------------------------------------------- FUNCTION: UpdateBPHighWithFunctionsActive DESCRIPTION: A code snippet to save bytes CALLED BY: INTERNAL PASS: *ds:si - Instance data RETURN: bp high - activeMouseUIFunctionsActive DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Doug 6/90 Initial version ------------------------------------------------------------------------------@ UpdateBPHighWithFunctionsActive proc near uses ax class FlowClass .enter ; Set bp high to be old UIFunctionsActive ; mov ax, bp ;send bp high = UIFunctionsActive mov bp, ds:[si] mov ah, ds:[bp].FI_activeMouseUIFunctionsActive mov bp, ax .leave ret UpdateBPHighWithFunctionsActive endp COMMENT @---------------------------------------------------------------------- FUNCTION: TranslateButton DESCRIPTION: Convert PC/GEOS button methods to generic methods. CALLED BY: UpdateFunctionsActive (ONLY -10/26/89) PASS: *ds:si - Instance data ax - MSG_META_MOUSE_BUTTON, MSG_META_PRE_PASSIVE_BUTTON, MSG_META_POST_PASSIVE_BUTTON cx - x Position dx - y Position bp - [ shiftState | buttonInfo ] (from Input Manager) es - dgroup RETURN: ax - new method to send (see below) cx, dx - position (unchanged) bp - unchanged di - Initial "Preferences" if starting a new function type DESTROYED: nothing PSEUDO CODE/STRATEGY: if MSG_META_MOUSE_BUTTON, convert to: MSG_META_START_SELECT MSG_META_END_SELECT ...etc... MSG_META_START_FEATURE MSG_META_END_FEATURE else if MSG_META_PRE_PASSIVE_BUTTON, convert to: MSG_META_PRE_PASSIVE_START_SELECT MSG_META_PRE_PASSIVE_END_SELECT ...etc... MSG_META_PRE_PASSIVE_FEATURE MSG_META_PRE_PASSIVE_FEATURE else if MSG_META_POST_PASSIVE_BUTTON, convert to: MSG_META_POST_PASSIVE_START_SELECT MSG_META_POST_PASSIVE_END_SELECT ...etc... MSG_META_POST_PASSIVE_FEATURE MSG_META_POST_PASSIVE_FEATURE else ERROR KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 8/89 Initial version Eric 12/89 Updated header and comments ------------------------------------------------------------------------------@ TranslateButton proc near class FlowClass push bx, cx, es EC < push ax, bx > EC < mov bx, es > EC < mov ax, segment dgroup > EC < cmp ax, bx > EC < ERROR_NZ 0 > EC < pop ax, bx > EC < cmp ax, MSG_META_MOUSE_BUTTON > EC < je TB_e10 > EC < cmp ax, MSG_META_PRE_PASSIVE_BUTTON > EC < je TB_e10 > EC < cmp ax, MSG_META_POST_PASSIVE_BUTTON > EC < ERROR_NZ UI_BAD_MSG_PASSED_TO_TRANSLATE_BUTTON > EC <TB_e10: > clr cx ; assume button cmp ax,MSG_META_MOUSE_BUTTON jz TB_foundType mov cx,MSG_META_PRE_PASSIVE_START_SELECT - MSG_META_START_SELECT cmp ax,MSG_META_PRE_PASSIVE_BUTTON jz TB_foundType mov cx,MSG_META_POST_PASSIVE_START_SELECT - MSG_META_START_SELECT TB_foundType: mov di, bp ; di = button number andnf di, mask BI_BUTTON test bp, mask BI_PRESS ; handling press, or release? jz release ; branch if release... ;press: ; PROCESS PRESS mov ax, MSG_META_START_OTHER ; In case function already ; active, have ax= OTHER method mov bx, ds:[si] cmp ds:[bx].FI_activeMouseFunction, 0 ; If any functions already ; active, then force to be ; an OTHER. jne done push di ;save button number push cx ;push conversion amount mov bx, es:[uiInputMapHandle] call MemLock mov es, ax ;es = table mov di, es:[IMH_buttonMapTable] ;es:di = table mov cx, es:[IMH_buttonMapCount] mov ax, bp ;ax = shift state and button stuff andnf al, mask BI_BUTTON ;only use button number ;loop looking for a modifier (al = button #) TB_loop: scasw jz TB_match ;if found then branch add di, size ButtonMapEntry-2 ; else skip rest of entry loop TB_loop ; no match found, return MSG_META_START_OTHER mov ax, MSG_META_START_OTHER jmp short TB_pressCommon ; found a match, return it TB_match: ; di points to ButtonMapEntry+2 mov ax,es:[di].BME_genericMethod-2 ;ax = method to send clr bl mov bh, es:[di].BME_preferences-2 ;Initial preferences TB_pressCommon: pop cx ;recover conversion amount pop di ;di = button number push bx mov bx, segment idata mov es, bx mov bx, es:[uiInputMapHandle] call MemUnlock pop bx jmp done release: mov bx, ds:[si] ;PROCESS RELEASE by using saved method (di = button #) ; mov ax, di cmp al, ds:[bx].FI_activeMouseButton; Release of button ; which is running ; active function? jne releaseOther ; If not, force use of ; "OTHER" method mov ax, ds:[bx].FI_activeMouseFunction ;ax = current function tst ax jne haveReleaseFunction releaseOther: mov ax, MSG_META_START_OTHER ; if no mouse function, ; use OTHER haveReleaseFunction: inc ax ;ax = END method done: add ax, cx ; ax = real method mov di, bx ; return "Preferences" ; in di pop bx, cx, es ret TranslateButton endp COMMENT @---------------------------------------------------------------------- METHOD: FlowDrag -- MSG_DRAG for FlowClass DESCRIPTION: Disperses DRAG event to the current mouse grab CALLED BY: Input Manager (see Library/IM/imMain.asm) PASS: *ds:si - instance data es - segment of FlowClass ax - MSG_DRAG cx - x position, mouse source window coordinates dx - y position, mouse source window coordinates bp - high byte shiftState, low byte buttonInfo RETURN: nothing DESTROYED: bx, si, di, ds, es PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Doug 11/89 Initial version ------------------------------------------------------------------------------@ FlowDrag method dynamic FlowClass, MSG_META_MOUSE_DRAG ; If eating events and waiting for ink, just exit... test ds:[di].FI_flowFlags, mask FF_PROCESSING_INK jnz done ; If holding up UI input, send event to HoldUpInputQueue, to be ; processed later ; call CheckOnInputHoldUpLow jc done ; If held up, all done. call AdjustMousePosForBump ; Adjust x, y pos for previous bump ; NOW, convert MSG_DRAG to generic method mov bx, ds:[si] mov ax, bp ; al = button number andnf al, mask BI_BUTTON cmp al, ds:[bx].FI_activeMouseButton jne OtherButton mov ax,ds:[bx].FI_activeMouseFunction ; ax = current function ; convert to DRAG method tst ax jnz UseThisFunction OtherButton: mov ax, MSG_META_START_OTHER ; Misc grab-bag method, ; for button events ; which aren't UI ; functions UseThisFunction: sub ax, MSG_META_START_SELECT ; Get offset from ; first 'START' method shr ax, 1 ; divide by 2 for ; START/END pairs add ax, MSG_META_DRAG_SELECT ; Get single drag ; version of method ; Send button event to active/implied grab, ; replay if requested ; Set bp high to be old UIFunctionsActive ; call UpdateBPHighWithFunctionsActive call SendMouseToActiveOrImpliedGrab done: ret FlowDrag endm COMMENT @---------------------------------------------------------------------- METHOD: FlowKbd -- MSG_META_KBD_CHAR for FlowClass DESCRIPTION: Disperses MSG_META_KBD_CHAR to the current focus PASS: *ds:si - instance data es - segment of FlowClass ax - MSG_META_KBD_CHAR cx - charValue dx - low byte charFlags, high byte shiftState bp - low byte toggleState, high byte scanCode RETURN: nothing DESTROYED: bx, si, di, ds, es PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Doug 3/89 Initial version Jim 12/89 Added support for screen saver function ------------------------------------------------------------------------------@ FlowKbd method dynamic FlowClass, MSG_META_KBD_CHAR ; If eating events and waiting for ink, just exit... test ds:[di].FI_flowFlags, mask FF_PROCESSING_INK jnz done ; If holding up UI input, send event to HoldUpInputQueue, to be ; processed later ; call CheckOnInputHoldUpLow jc done ; If held up, all done. call UpdateConstrainState ; update UIFunctionsActive call UpdateMoveCopy ; If doing move-copy, possibly change ; UI functions... push ax push cx push dx push bp push si ; SEND TO ACTIVE GRAB mov di, ds:[si] add di, offset FI_activeKbdGrab ; fetch grab data mov si, ds:[di].KG_OD.chunk mov bx, ds:[di].KG_OD.handle tst bx jz unwantedKbdEvent mov di, mask MF_FORCE_QUEUE or mask MF_FIXUP_DS or \ mask MF_CAN_DISCARD_IF_DESPERATE or \ mask MF_CHECK_DUPLICATE test dl, mask CF_REPEAT_PRESS jnz sendIt mov di, mask MF_FORCE_QUEUE or mask MF_FIXUP_DS sendIt: ; Send it! mov ax, MSG_META_KBD_CHAR ; method to send as call ObjMessage afterSend: pop si pop bp pop dx pop cx pop ax done: ret unwantedKbdEvent: ; No destination! ; See if first press or not test dl, mask CF_FIRST_PRESS jz afterSend ; if not, no beep ; Let user know that he is annoying us ;) mov ax, SST_NO_INPUT call UserStandardSound jmp short afterSend FlowKbd endm COMMENT @---------------------------------------------------------------------- ROUTINE: UpdateConstrainState SYNOPSIS: Updates status of UIFA_CONSTRAIN CALLED BY: FlowKbd PASS: *ds:si - Instance data cx - charValue dx - low byte CharFlags, high byte ShiftState bp - low byte toggleState, high byte scanCode RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 2/12/91 Initial version ------------------------------------------------------------------------------@ UpdateConstrainState proc near uses ax, di class FlowClass .enter SBCS < cmp ch, VC_ISCTRL ;not ctrl char, exit > SBCS < jne exit > SBCS < cmp cl, VC_LSHIFT ;left shift? > DBCS < cmp cx, C_SYS_LEFT_SHIFT > je handleConstrain ;yes, handle SBCS < cmp cl, VC_RSHIFT ;right shift? > DBCS < cmp cx, C_SYS_RIGHT_SHIFT > jne exit ;exit if some other character handleConstrain: mov di, ds:[si] mov al, ds:[di].FI_activeMouseUIFunctionsActive ; al = old functions test dl, mask CF_FIRST_PRESS jnz handlePress ;it's a press, branch test dl, mask CF_RELEASE ;check if release jz exit ;not press or release, exit andnf ds:[di].FI_activeMouseUIFunctionsActive, not mask UIFA_CONSTRAIN jmp short done handlePress: ornf ds:[di].FI_activeMouseUIFunctionsActive, mask UIFA_CONSTRAIN done: cmp al, ds:[di].FI_activeMouseUIFunctionsActive ;any changes? je exit ;nope ; ; constrain function changed, force out a PTR method so the ; grab will know this even though the mouse doesn't move ; call ImForcePtrMethod exit: .leave ret UpdateConstrainState endp COMMENT @---------------------------------------------------------------------- ROUTINE: UpdateMoveCopy SYNOPSIS: Updates status of move-copy, if necessary. CALLED BY: FlowKbd PASS: *ds:si - Instance data cx - charValue dx - low byte CharFlags, high byte ShiftState bp - low byte toggleState, high byte scanCode RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Chris 6/15/90 Initial version brianc 3/14/91 Updated for 2.0 quick-transfer ------------------------------------------------------------------------------@ UpdateMoveCopy proc near uses ax, bx, cx, di class FlowClass .enter push ds mov ax, segment quickTransferFlags ;get quick transfer flags mov ds, ax mov bx, ds:[quickTransferFlags] pop ds test bx, mask CQTF_IN_PROGRESS ;no transfer in progress, exit jz exit mov di, ds:[si] mov ah, ds:[di].FI_activeMouseUIFunctionsActive test ah, mask UIFA_MOVE_COPY ;see if doing move-copy jz exit ;not doing move copy, get out SBCS < cmp ch, VC_ISCTRL ;not ctrl char, exit > DBCS < cmp ch, CS_CONTROL_HB > jne exit mov al, mask UIFA_COPY ;assume copy SBCS < cmp cl, VC_LCTRL ;left ctrl? > DBCS < cmp cl, C_SYS_LEFT_CTRL and 0x00ff ;left ctrl? > je checkUpDown ;yes, handle SBCS < cmp cl, VC_RCTRL ;right ctrl? > DBCS < cmp cl, C_SYS_RIGHT_CTRL and 0x00ff ;right ctrl? > je checkUpDown ;yes, handle test bx, mask CQTF_COPY_ONLY ;is transfer item copy-only? jnz exit ;yes, force-move has no effect mov al, mask UIFA_MOVE ;assume move SBCS < cmp cl, VC_LALT ;left alt press? > DBCS < cmp cl, C_SYS_LEFT_ALT and 0x00ff ;left alt press? > je checkUpDown ;handle if so SBCS < cmp cl, VC_RALT ;right alt? > DBCS < cmp cl, C_SYS_RIGHT_ALT and 0x00ff ;right alt? > jne exit ;exit if some other character ; ; CTRL/ALT press/release ; al = UIFA_COPY if CTRL ; al = UIFA_MOVE if ALT ; checkUpDown: clr bl ; clear no bits test dl, mask CF_FIRST_PRESS jnz handleIt ;it's a press, branch test dl, mask CF_RELEASE ;check if release jz exit ;not press or release, exit mov bl, al ;it's a release, clear clr al ; either UIFA_MOVE or UIFA_COPY ; (and set none) handleIt: ; ; Change activeMouseUIFunctionsActive appropriately and ; update the cursor. ; al = bits to set ; bl = bits to clear ; push ax ;save ah value ;(activeMouseUIFunctionsActive) xor al, bl ;keeping same setup? pop ax ;restore ah value ;(activeMouseUIFunctionsActive) jz exit ;yes, exit not bl ; clear bl bits in ah andnf ah, bl ornf ah, al ; set al bits in ah ; store new preferences mov ds:[di].FI_activeMouseUIFunctionsActive, ah ; ; move/copy state changed, force out a PTR method so the ; grab will know this even though the mouse doesn't move ; call ImForcePtrMethod exit: .leave ret UpdateMoveCopy endp COMMENT @---------------------------------------------------------------------- METHOD: FlowPressure -- MSG_META_PRESSURE for FlowClass DESCRIPTION: Disperses MSG_META_PRESSURE to the current focus PASS: *ds:si - instance data es - segment of FlowClass ax - MSG_META_PRESSURE cx, dx, bp - event data to pass on RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Doug 3/89 Initial version Jim 12/89 Added support for screen saver function ------------------------------------------------------------------------------@ if EXTRA_INPUT_TYPES FlowPressure method dynamic FlowClass, MSG_META_PRESSURE ; If holding up UI input, send event to HoldUpInputQueue, to be ; processed later ; call CheckOnInputHoldUpLow jc done ; If held up, all done. mov bx, ds:[si] mov si, ds:[bx].FI_activePressureGrab.GG_OD.chunk mov bx, ds:[bx].FI_activePressureGrab.GG_OD.handle tst bx ; if no grab, just quit jz done ; send to grab mov di, mask MF_FORCE_QUEUE or mask MF_FIXUP_DS or \ mask MF_CAN_DISCARD_IF_DESPERATE GOTO ObjMessage done: ret FlowPressure endm endif ; EXTRA_INPUT_TYPES COMMENT @---------------------------------------------------------------------- METHOD: FlowDirection -- MSG_META_DIRECTION for FlowClass DESCRIPTION: Disperses MSG_META_DIRECTION to the current focus PASS: *ds:si - instance data es - segment of FlowClass ax - MSG_META_DIRECTION cx, dx, bp - event data to pass on RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Doug 3/89 Initial version Jim 12/89 Added support for screen saver function ------------------------------------------------------------------------------@ if EXTRA_INPUT_TYPES FlowDirection method dynamic FlowClass, MSG_META_DIRECTION ; If holding up UI input, send event to HoldUpInputQueue, to be ; processed later ; call CheckOnInputHoldUpLow jc done ; If held up, all done. mov bx, ds:[si] mov si, ds:[bx].FI_activeDirectionGrab.GG_OD.chunk mov bx, ds:[bx].FI_activeDirectionGrab.GG_OD.handle tst bx ; if no grab, just quit jz done ; send to grab mov di, mask MF_FORCE_QUEUE or mask MF_FIXUP_DS or \ mask MF_CAN_DISCARD_IF_DESPERATE GOTO ObjMessage done: ret FlowDirection endm endif ; EXTRA_INPUT_TYPES COMMENT @---------------------------------------------------------------------- FUNCTION: FlowMouseBumpNotify DESCRIPTION: MSG_META_MOUSE_BUMP_NOTIFICATION for FlowClass CALLED BY: INTERNAL PASS: *ds:si - instance data es - segment of FlowClass ax - MSG_META_MOUSE_BUMP_NOTIFICATION cx - x mouse bump performed by IM dx - y mouse bump performed by IM RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Doug 8/89 Initial version ------------------------------------------------------------------------------@ FlowMouseBumpNotify method dynamic FlowClass, \ MSG_META_MOUSE_BUMP_NOTIFICATION ; If holding up UI input, send event to HoldUpInputQueue, to be ; processed later ; call CheckOnInputHoldUpLow jc done ; If held up, all done. ; Adjust total mouseBump downwards, as we ; don't have to adjust for this anymore mov bx, ds:[si] ; get ptr to flow object sub ds:[bx].FI_mouseBump.XYO_x, cx sub ds:[bx].FI_mouseBump.XYO_y, dx done: ret FlowMouseBumpNotify endm COMMENT @---------------------------------------------------------------------- FUNCTION: FlowGetActiveOrImpliedMouseGrab DESCRIPTION: Returns current mouse grab OD & window CALLED BY: INTERNAL PASS: *ds:si - instance data RETURN: cx:dx - OD of object have active or implied geode DESTROYED: bx, si, di, ds, es PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Doug 6/90 Initial version ------------------------------------------------------------------------------@ FlowGetActiveOrImpliedMouseGrab proc near class FlowClass mov bx, ds:[si] ; get ptr to instance data ; Assume that we'll use active grab mov di, bx add di, offset FI_activeMouseGrab ; Make sure active grab exists cmp ds:[bx].FI_activeMouseGrab.GG_OD.handle, 0 jne useThisGrab ; if it does, use it. ; if it doesn't, use implied mouse grab instead mov di, bx add di, offset FI_impliedMouseGrab useThisGrab: ; Return object OD & window handle mov cx, ds:[di].GG_OD.handle mov dx, ds:[di].GG_OD.chunk ret FlowGetActiveOrImpliedMouseGrab endp COMMENT @---------------------------------------------------------------------- METHOD: FlowDisableHoldUpInput DESCRIPTION: Change input state to force allowance of input data to flow PASS: *ds:si - instance data ds:di - ptr to VisContentInstance es - segment of VisContentClass ax - MSG_VIS_CONTENT_DISABLE_HOLD_UP RETURN: nothing DESTROYED: ax, cx, dx, bp PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Doug 6/90 Initial version Doug 5/91 Now a method ------------------------------------------------------------------------------@ FlowDisableHoldUpInput method dynamic FlowClass, \ MSG_VIS_CONTENT_DISABLE_HOLD_UP ; Disable hold-up for awhile ornf ds:[di].FI_holdUpInputFlags, mask HUIF_HOLD_UP_MODE_DISABLED call FlowFlushHoldUpInputQueue ; Let 'er rip ret FlowDisableHoldUpInput endm COMMENT @---------------------------------------------------------------------- METHOD: FlowEnableHoldUpInput DESCRIPTION: Change input state to allow hold-up mode PASS: *ds:si - instance data ds:di - ptr to VisContentInstance es - segment of VisContentClass ax - MSG_VIS_CONTENT_ENABLE_HOLD_UP RETURN: nothing DESTROYED: ax, cx, dx, bp PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Doug 6/90 Initial version Doug 5/91 Now a method ------------------------------------------------------------------------------@ FlowEnableHoldUpInput method dynamic FlowClass, \ MSG_VIS_CONTENT_ENABLE_HOLD_UP ; ; Disable hold-up for awhile ; andnf ds:[di].FI_holdUpInputFlags, \ not mask HUIF_HOLD_UP_MODE_DISABLED ret FlowEnableHoldUpInput endm COMMENT @---------------------------------------------------------------------- METHOD: FlowHoldUpInput DESCRIPTION: Start holding up all UI input events, in a separate queue, until FlowResumeInput is called (A count is kept, so multiple patients can use) PASS: If called via MSG_VIS_CONTENT_HOLD_UP_INPUT_FLOW: *ds:si - instance data ds:di - ptr to FlowInstance es - segment of FlowClass ax - MSG_VIS_CONTENT_HOLD_UP_INPUT_FLOW If called directly: *ds:si = FlowClass object RETURN: nothing DESTROYED: ax, cx, dx, bp PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Doug 6/90 Initial version Doug 5/91 Now a method ------------------------------------------------------------------------------@ FlowHoldUpInput method FlowClass, MSG_VIS_CONTENT_HOLD_UP_INPUT_FLOW mov di, ds:[si] inc ds:[di].FI_holdUpInputCount ; inc hold up count -- all ret ; input will start to be ; redirected to the hold-up ; queue FlowHoldUpInput endm COMMENT @---------------------------------------------------------------------- METHOD: FlowResumeInput DESCRIPTION: Allow UI input to flow again. PASS: If called via MSG_VIS_CONTENT_RESUME_INPUT_FLOW: *ds:si - instance data ds:di - ptr to VisContentInstance es - segment of VisContentClass ax - MSG_VIS_CONTENT_RESUME_INPUT_FLOW If called directly: *ds:si = FlowClass object RETURN: Nothing DESTROYED: ax, cx, dx, bp PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Doug 6/90 Initial version Doug 5/91 Now a method ------------------------------------------------------------------------------@ FlowResumeInput method FlowClass, MSG_VIS_CONTENT_RESUME_INPUT_FLOW mov di, ds:[si] dec ds:[di].FI_holdUpInputCount ; dec hold up count -- if ; back to 0, flush out ; hold up queue & allow ; input to proceed. EC < ERROR_S UI_ERROR_NEGATIVE_HOLD_UP_INPUT_COUNT > jnz done call FlowFlushHoldUpInputQueue done: ret FlowResumeInput endm COMMENT @---------------------------------------------------------------------- FUNCTION: FlowFlushHoldUpInputQueue DESCRIPTION: Flush the hold-up input queue by moving all events in it to the front of the UI queue, in order. CALLED BY: INTERNAL NOTE: This routine MUST be called by the UI thread. PASS: *ds:si - FlowInstance RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Doug 6/90 Initial version ------------------------------------------------------------------------------@ FlowFlushHoldUpInputQueue proc near uses ax, bx, cx, dx, si, di class FlowClass .enter mov bx, ds:[si] ; If hold-up mode is disabled (i.e. there is a system-modal dialog ; box up & in progress), then let the queue flow regardless of any ; hold-up modes in progress, so that the user can interact with ; the system-modal dialog box. ; test ds:[bx].FI_holdUpInputFlags, mask HUIF_HOLD_UP_MODE_DISABLED jnz letErRip ; If holding up UI input, we're done -- hold up must have been turned ; back on while we weren't looking. ; tst ds:[bx].FI_holdUpInputCount jnz done letErRip: ; Direct events back to this object mov cx, ds:[LMBH_handle] mov dx, si ; Save queue handle on stack push ds:[bx].FI_holdUpInputQueue clr bx ; Get queue handle for this thread ; (UI thread) call GeodeInfoQueue mov si, bx ; Put queue handle in si, as destination ; queue for following routine ; Setup hold up input queue as source pop bx ; Move all of these events to the ; front of the UI queue mov di, mask MF_INSERT_AT_FRONT call GeodeFlushQueue done: .leave ret FlowFlushHoldUpInputQueue endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% FlowRegisterNoInkWin %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Add/remove a window to the no-ink list CALLED BY: MSG_FLOW_REGISTER_NO_INK_WIN PASS: *ds:si = FlowClass object ds:di = FlowClass instance data ds:bx = FlowClass object (same as *ds:si) es = segment of FlowClass ax = message # dx = non-zero if add window, zero if remove window bp = handle of window RETURN: nothing DESTROYED: ax, cx, dx, bp SIDE EFFECTS: PSEUDO CODE/STRATEGY: If the list is full, any add request will be ignored. This means that ui object that adds it's window to the no-ink list may still receive MSG_META_QUERY_IF_PRESS_IS_INK, and should reply accordingly. If the window passed in an add request already exists in the list, the request is ignored. If the window handle passed in a remove request is not found in the list, it's ignored. REVISION HISTORY: Name Date Description ---- ---- ----------- AY 5/16/94 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ FlowRegisterNoInkWin method dynamic FlowClass, MSG_FLOW_REGISTER_NO_INK_WIN if ERROR_CHECK ; make sure all entries in the list are still valid push bp mov bp, ds:[di].FI_numNoInkWin shl bp checkNext: tst bp jz checkDone dec bp dec bp mov bx, ds:[di].FI_noInkWin[bp] call ECCheckWindowHandle jmp checkNext checkDone: pop bp endif Assert window bp mov bx, ds:[di].FI_numNoInkWin Assert be, bx, MAX_NO_INK_WIN ; set up for scanning handle list for passed window mov_tr ax, bp ; ax = window hptr mov si, di ; ds:si = instance data segmov es, ds add di, offset FI_noInkWin ; es:di = start of list tst cx mov cx, bx ; cx = count jz removeWin ; It's an add request. ZF already cleared repne scasw je done ; neglect if hptr already exist in list cmp bx, MAX_NO_INK_WIN je done ; neglect if list is full ; add handle to end of list stosw inc ds:[si].FI_numNoInkWin ret removeWin: ; It's a remove request tst di ; clear ZF (since di != 0) repne scasw jne done ; neglect if not found ; move handle at end of list to this empty slot dec bx mov ds:[si].FI_numNoInkWin, bx shl bx mov ax, ds:[si].FI_noInkWin[bx] ; ax = last entry in list mov ds:[di - size hptr], ax ; move last entry to empty slot done: ret FlowRegisterNoInkWin endm FlowCommon ends ;--------------------- Init segment resource COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% FlowSetScreen %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Change display screens CALLED BY: MSG_FLOW_SET_SCREEN (UserScreenSetCur) PASS: cx:dx = strategy routine of new video driver bp = handle of field object to become the default visual parent for geodes *ds:si = instance data es = segment of FlowClass ax = MSG_FLOW_SET_SCREEN RETURN: nothing DESTROYED: si, di, bx, es, ds, ax, cx, dx PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 9/23/89 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ FlowSetScreen method dynamic FlowClass, MSG_FLOW_SET_SCREEN mov bx, ds:[si] ; ; Store the strategy routine in our instance data first. ; mov ds:[bx].FI_curVideoStrategy.segment, cx mov ds:[bx].FI_curVideoStrategy.offset, dx ; ; Set the proper image in the new driver. ; push bp ; preserve handle of field object clr cx mov dx, PIV_UPDATE ; Re-use current ptr image call ImSetPtrImage pop bp ; ; Give the driver the final kick to get the pointer up on ; screen. ; push bx, bp, ds ; Preserve from video driver ; depredations... mov di, DR_VID_SHOWPTR call ds:[bx].FI_curVideoStrategy pop bx, bp, ds ; ; Contact the System object to set the default visual parent. ; NOTE: ASSUMES UI SINGLE-THREADED ; tst bp ; any field yet? jz done mov bx, ss:uiSystemObj.handle mov si, ss:uiSystemObj.chunk mov dx, bp ; Pass field object in CX:DX mov cx, handle SystemFieldUI mov ax, MSG_GEN_SYSTEM_SET_DEFAULT_FIELD mov di, mask MF_CALL call ObjMessage done: ret FlowSetScreen endm Init ends
#include <algorithm> #include <kj/std/iostream.h> #include <limits> #include <map> #include <set> #include <stdlib.h> #include <string> #include <string.h> #include <zlib.h> #include "vtr_assert.h" #include "vtr_digest.h" #include "vtr_log.h" #include "vtr_util.h" #include "arch_check.h" #include "arch_error.h" #include "arch_util.h" #include "arch_types.h" #include "read_fpga_interchange_arch.h" /* * FPGA Interchange Device frontend * * This file contains functions to read and parse a Cap'n'proto FPGA interchange device description * and populate the various VTR architecture's internal data structures. * * The Device data is, by default, GZipped, hence the requirement of the ZLIB library to allow * for in-memory decompression of the input file. */ using namespace DeviceResources; using namespace LogicalNetlist; using namespace capnp; /** * @brief The FPGA interchange timing model includes three different corners (min, typ and max) for each of the two * speed_models (slow and fast). * * Timing data can be found on PIPs, nodes, site pins and bel pins. * This function retrieves the timing value based on the wanted speed model and the wanted corner. * * More information on the FPGA Interchange timing model can be found here: * - https://github.com/chipsalliance/fpga-interchange-schema/blob/main/interchange/DeviceResources.capnp */ static float get_corner_value(Device::CornerModel::Reader model, const char* speed_model, const char* value) { bool slow_model = std::string(speed_model) == std::string("slow"); bool fast_model = std::string(speed_model) == std::string("fast"); bool min_corner = std::string(value) == std::string("min"); bool typ_corner = std::string(value) == std::string("typ"); bool max_corner = std::string(value) == std::string("max"); if (!slow_model && !fast_model) { archfpga_throw("", __LINE__, "Wrong speed model `%s`. Expected `slow` or `fast`\n", speed_model); } if (!min_corner && !typ_corner && !max_corner) { archfpga_throw("", __LINE__, "Wrong corner model `%s`. Expected `min`, `typ` or `max`\n", value); } bool has_fast = model.getFast().hasFast(); bool has_slow = model.getSlow().hasSlow(); if (slow_model && has_slow) { auto half = model.getSlow().getSlow(); if (min_corner && half.getMin().isMin()) { return half.getMin().getMin(); } else if (typ_corner && half.getTyp().isTyp()) { return half.getTyp().getTyp(); } else if (max_corner && half.getMax().isMax()) { return half.getMax().getMax(); } else { if (half.getMin().isMin()) { return half.getMin().getMin(); } else if (half.getTyp().isTyp()) { return half.getTyp().getTyp(); } else if (half.getMax().isMax()) { return half.getMax().getMax(); } else { archfpga_throw("", __LINE__, "Invalid speed model %s. No value found!\n", speed_model); } } } else if (fast_model && has_fast) { auto half = model.getFast().getFast(); if (min_corner && half.getMin().isMin()) { return half.getMin().getMin(); } else if (typ_corner && half.getTyp().isTyp()) { return half.getTyp().getTyp(); } else if (max_corner && half.getMax().isMax()) { return half.getMax().getMax(); } else { if (half.getMin().isMin()) { return half.getMin().getMin(); } else if (half.getTyp().isTyp()) { return half.getTyp().getTyp(); } else if (half.getMax().isMax()) { return half.getMax().getMax(); } else { archfpga_throw("", __LINE__, "Invalid speed model %s. No value found!\n", speed_model); } } } return 0.; } struct ArchReader { public: ArchReader(t_arch* arch, Device::Reader& arch_reader, const char* arch_file, std::vector<t_physical_tile_type>& phys_types, std::vector<t_logical_block_type>& logical_types) : arch_(arch) , arch_file_(arch_file) , ar_(arch_reader) , ptypes_(phys_types) , ltypes_(logical_types) { set_arch_file_name(arch_file); } void read_arch() { process_luts(); process_models(); process_device(); process_layout(); process_switches(); process_segments(); } private: t_arch* arch_; const char* arch_file_; Device::Reader& ar_; std::vector<t_physical_tile_type>& ptypes_; std::vector<t_logical_block_type>& ltypes_; t_default_fc_spec default_fc_; // Model processing void process_models() { // Populate the common library, namely .inputs, .outputs, .names, .latches CreateModelLibrary(arch_); t_model* temp = nullptr; std::map<std::string, int> model_name_map; std::pair<std::map<std::string, int>::iterator, bool> ret_map_name; int model_index = NUM_MODELS_IN_LIBRARY; arch_->models = nullptr; auto strList = ar_.getStrList(); auto primLib = ar_.getPrimLibs(); for (auto primitive : primLib.getCellDecls()) { if (std::string(strList[primitive.getLib()]) == std::string("primitives")) { try { temp = new t_model; temp->index = model_index++; temp->never_prune = true; temp->name = vtr::strdup(std::string(strList[primitive.getName()]).c_str()); ret_map_name = model_name_map.insert(std::pair<std::string, int>(temp->name, 0)); if (!ret_map_name.second) { archfpga_throw(arch_file_, __LINE__, "Duplicate model name: '%s'.\n", temp->name); } process_model_ports(temp, primitive); check_model_clocks(temp, arch_file_, __LINE__); check_model_combinational_sinks(temp, arch_file_, __LINE__); warn_model_missing_timing(temp, arch_file_, __LINE__); } catch (ArchFpgaError& e) { free_arch_model(temp); throw; } temp->next = arch_->models; arch_->models = temp; } } return; } void process_model_ports(t_model* model, Netlist::CellDeclaration::Reader primitive) { auto strList = ar_.getStrList(); auto primLib = ar_.getPrimLibs(); auto portList = primLib.getPortList(); std::set<std::pair<std::string, enum PORTS>> port_names; for (auto port_idx : primitive.getPorts()) { auto port = portList[port_idx]; enum PORTS dir = ERR_PORT; switch (port.getDir()) { case LogicalNetlist::Netlist::Direction::INPUT: dir = IN_PORT; break; case LogicalNetlist::Netlist::Direction::OUTPUT: dir = OUT_PORT; break; case LogicalNetlist::Netlist::Direction::INOUT: dir = INOUT_PORT; break; default: break; } t_model_ports* model_port = new t_model_ports; model_port->dir = dir; model_port->name = vtr::strdup(std::string(strList[port.getName()]).c_str()); // TODO: add parsing of clock port types when the interchange schema allows for it: // https://github.com/chipsalliance/fpga-interchange-schema/issues/66 //Sanity checks if (model_port->is_clock == true && model_port->is_non_clock_global == true) { archfpga_throw(arch_file_, __LINE__, "Model port '%s' cannot be both a clock and a non-clock signal simultaneously", model_port->name); } if (model_port->name == nullptr) { archfpga_throw(arch_file_, __LINE__, "Model port is missing a name"); } if (port_names.count(std::pair<std::string, enum PORTS>(model_port->name, dir)) && dir != INOUT_PORT) { archfpga_throw(arch_file_, __LINE__, "Duplicate model port named '%s'", model_port->name); } if (dir == OUT_PORT && !model_port->combinational_sink_ports.empty()) { archfpga_throw(arch_file_, __LINE__, "Model output ports can not have combinational sink ports"); } model_port->min_size = 1; model_port->size = 1; if (port.isBus()) { int s = port.getBus().getBusStart(); int e = port.getBus().getBusEnd(); model_port->size = std::abs(e - s) + 1; } port_names.insert(std::pair<std::string, enum PORTS>(model_port->name, dir)); //Add the port if (dir == IN_PORT) { model_port->next = model->inputs; model->inputs = model_port; } else if (dir == OUT_PORT) { model_port->next = model->outputs; model->outputs = model_port; } } } void process_luts() { // Add LUT Cell definitions // This is helpful to understand which cells are LUTs auto lut_def = ar_.getLutDefinitions(); for (auto lut_cell : lut_def.getLutCells()) { t_lut_cell cell; cell.name = lut_cell.getCell().cStr(); for (auto input : lut_cell.getInputPins()) cell.inputs.push_back(input.cStr()); auto equation = lut_cell.getEquation(); if (equation.isInitParam()) cell.init_param = equation.getInitParam().cStr(); arch_->lut_cells.push_back(cell); } } // Layout Processing void process_layout() { auto strList = ar_.getStrList(); auto tileList = ar_.getTileList(); auto tileTypeList = ar_.getTileTypeList(); t_grid_def grid_def; grid_def.width = grid_def.height = 0; for (auto tile : tileList) { grid_def.width = std::max(grid_def.width, tile.getCol() + 1); grid_def.height = std::max(grid_def.height, tile.getRow() + 1); } grid_def.grid_type = GridDefType::FIXED; std::string name = std::string(ar_.getName()); if (name == "auto") { // At the moment, the interchange specifies fixed-layout only architectures, // and allowing for auto-sizing could potentially be implemented later on // to allow for experimentation on new architectures. // For the time being the layout is restricted to be only fixed. archfpga_throw(arch_file_, __LINE__, "The name auto is reserved for auto-size layouts; please choose another name"); } grid_def.name = name; for (auto tile : tileList) { t_metadata_dict data; std::string tile_prefix(strList[tile.getName()].cStr()); auto tileType = tileTypeList[tile.getType()]; std::string tile_type(strList[tileType.getName()].cStr()); size_t pos = tile_prefix.find(tile_type); if (pos != std::string::npos && pos == 0) tile_prefix.erase(pos, tile_type.length() + 1); data.add(arch_->strings.intern_string(vtr::string_view("fasm_prefix")), arch_->strings.intern_string(vtr::string_view(tile_prefix.c_str()))); t_grid_loc_def single(tile_type, 1); single.x.start_expr = tile.getCol(); single.y.start_expr = tile.getRow(); single.x.end_expr = single.x.start_expr + " + w - 1"; single.y.end_expr = single.y.start_expr + " + h - 1"; single.owned_meta = std::make_unique<t_metadata_dict>(data); single.meta = single.owned_meta.get(); grid_def.loc_defs.emplace_back(std::move(single)); } arch_->grid_layouts.emplace_back(std::move(grid_def)); } void process_device() { /* * The generic architecture data is not currently available in the interchange format * therefore, for a very initial implementation, the values are taken from the ones * used primarly in the Xilinx series7 devices, generated using SymbiFlow. * * As the interchange format develops further, with possibly more details, this function can * become dynamic, allowing for different parameters for the different architectures. * * FIXME: This will require to be dynamically assigned, and a suitable representation added * to the FPGA interchange device schema. */ arch_->R_minW_nmos = 6065.520020; arch_->R_minW_pmos = 18138.500000; arch_->grid_logic_tile_area = 14813.392; arch_->Chans.chan_x_dist.type = UNIFORM; arch_->Chans.chan_x_dist.peak = 1; arch_->Chans.chan_x_dist.width = 0; arch_->Chans.chan_x_dist.xpeak = 0; arch_->Chans.chan_x_dist.dc = 0; arch_->Chans.chan_y_dist.type = UNIFORM; arch_->Chans.chan_y_dist.peak = 1; arch_->Chans.chan_y_dist.width = 0; arch_->Chans.chan_y_dist.xpeak = 0; arch_->Chans.chan_y_dist.dc = 0; arch_->ipin_cblock_switch_name = std::string("generic"); arch_->SBType = WILTON; arch_->Fs = 3; default_fc_.specified = true; default_fc_.in_value_type = e_fc_value_type::FRACTIONAL; default_fc_.in_value = 1.0; default_fc_.out_value_type = e_fc_value_type::FRACTIONAL; default_fc_.out_value = 1.0; } void process_switches() { std::set<std::pair<bool, uint32_t>> pip_timing_models; for (auto tile_type : ar_.getTileTypeList()) { for (auto pip : tile_type.getPips()) { pip_timing_models.insert(std::pair<bool, uint32_t>(pip.getBuffered21(), pip.getTiming())); if (!pip.getDirectional()) pip_timing_models.insert(std::pair<bool, uint32_t>(pip.getBuffered20(), pip.getTiming())); } } auto timing_data = ar_.getPipTimings(); std::vector<std::pair<bool, uint32_t>> pip_timing_models_list; pip_timing_models_list.reserve(pip_timing_models.size()); for (auto entry : pip_timing_models) { pip_timing_models_list.push_back(entry); } auto num_switches = pip_timing_models.size() + 2; std::string switch_name; arch_->num_switches = num_switches; auto* switches = arch_->Switches; if (num_switches > 0) { switches = new t_arch_switch_inf[num_switches]; } float R, Cin, Cint, Cout, Tdel; for (int i = 0; i < (int)num_switches; ++i) { t_arch_switch_inf& as = switches[i]; R = Cin = Cint = Cout = Tdel = 0.0; SwitchType type; if (i == 0) { switch_name = "short"; type = SwitchType::SHORT; R = 0.0; } else if (i == 1) { switch_name = "generic"; type = SwitchType::MUX; R = 0.0; } else { auto entry = pip_timing_models_list[i - 2]; auto model = timing_data[entry.second]; std::stringstream name; std::string mux_type_string = entry.first ? "mux_" : "passGate_"; name << mux_type_string; // FIXME: allow to dynamically choose different speed models and corners R = get_corner_value(model.getOutputResistance(), "slow", "min"); name << "R" << std::scientific << R; Cin = get_corner_value(model.getInputCapacitance(), "slow", "min"); name << "Cin" << std::scientific << Cin; Cout = get_corner_value(model.getOutputCapacitance(), "slow", "min"); name << "Cout" << std::scientific << Cout; if (entry.first) { Cint = get_corner_value(model.getInternalCapacitance(), "slow", "min"); name << "Cinternal" << std::scientific << Cint; } Tdel = get_corner_value(model.getInternalDelay(), "slow", "min"); name << "Tdel" << std::scientific << Tdel; switch_name = name.str(); type = entry.first ? SwitchType::MUX : SwitchType::PASS_GATE; } /* Should never happen */ if (switch_name == std::string(VPR_DELAYLESS_SWITCH_NAME)) { archfpga_throw(arch_file_, __LINE__, "Switch name '%s' is a reserved name for VPR internal usage!", switch_name.c_str()); } as.name = vtr::strdup(switch_name.c_str()); as.set_type(type); as.mux_trans_size = as.type() == SwitchType::MUX ? 1 : 0; as.R = R; as.Cin = Cin; as.Cout = Cout; as.Cinternal = Cint; as.set_Tdel(t_arch_switch_inf::UNDEFINED_FANIN, Tdel); if (as.type() == SwitchType::SHORT || as.type() == SwitchType::PASS_GATE) { as.buf_size_type = BufferSize::ABSOLUTE; as.buf_size = 0; as.power_buffer_type = POWER_BUFFER_TYPE_ABSOLUTE_SIZE; as.power_buffer_size = 0.; } else { as.buf_size_type = BufferSize::AUTO; as.buf_size = 0.; as.power_buffer_type = POWER_BUFFER_TYPE_AUTO; } } } void process_segments() { auto strList = ar_.getStrList(); // Segment names will be taken from wires connected to pips // They are good representation for nodes std::set<uint32_t> wire_names; for (auto tile_type : ar_.getTileTypeList()) { auto wires = tile_type.getWires(); for (auto pip : tile_type.getPips()) { wire_names.insert(wires[pip.getWire0()]); wire_names.insert(wires[pip.getWire1()]); } } int num_seg = wire_names.size(); arch_->Segments.resize(num_seg); uint32_t index = 0; for (auto i : wire_names) { // Use default values as we will populate rr_graph with correct values // This segments are just declaration of future use arch_->Segments[index].name = std::string(strList[i]); arch_->Segments[index].length = 1; arch_->Segments[index].frequency = 1; arch_->Segments[index].Rmetal = 0; arch_->Segments[index].Cmetal = 0; arch_->Segments[index].parallel_axis = BOTH_AXIS; // TODO: Only bi-directional segments are created, but it the interchange format // has directionality information on PIPs, which may be used to infer the // segments' directonality. arch_->Segments[index].directionality = BI_DIRECTIONAL; arch_->Segments[index].arch_wire_switch = 1; arch_->Segments[index].arch_opin_switch = 1; arch_->Segments[index].cb.resize(1); arch_->Segments[index].cb[0] = true; arch_->Segments[index].sb.resize(2); arch_->Segments[index].sb[0] = true; arch_->Segments[index].sb[1] = true; ++index; } } }; void FPGAInterchangeReadArch(const char* FPGAInterchangeDeviceFile, const bool /*timing_enabled*/, t_arch* arch, std::vector<t_physical_tile_type>& PhysicalTileTypes, std::vector<t_logical_block_type>& LogicalBlockTypes) { // Decompress GZipped capnproto device file gzFile file = gzopen(FPGAInterchangeDeviceFile, "r"); VTR_ASSERT(file != Z_NULL); std::vector<uint8_t> output_data; output_data.resize(4096); std::stringstream sstream(std::ios_base::in | std::ios_base::out | std::ios_base::binary); while (true) { int ret = gzread(file, output_data.data(), output_data.size()); VTR_ASSERT(ret >= 0); if (ret > 0) { sstream.write((const char*)output_data.data(), ret); VTR_ASSERT(sstream); } else { VTR_ASSERT(ret == 0); int error; gzerror(file, &error); VTR_ASSERT(error == Z_OK); break; } } VTR_ASSERT(gzclose(file) == Z_OK); sstream.seekg(0); kj::std::StdInputStream istream(sstream); // Reader options capnp::ReaderOptions reader_options; reader_options.nestingLimit = std::numeric_limits<int>::max(); reader_options.traversalLimitInWords = std::numeric_limits<uint64_t>::max(); capnp::InputStreamMessageReader message_reader(istream, reader_options); auto device_reader = message_reader.getRoot<DeviceResources::Device>(); arch->architecture_id = vtr::strdup(vtr::secure_digest_file(FPGAInterchangeDeviceFile).c_str()); ArchReader reader(arch, device_reader, FPGAInterchangeDeviceFile, PhysicalTileTypes, LogicalBlockTypes); reader.read_arch(); }
_cat: file format elf32-i386 Disassembly of section .text: 00000000 <cat>: char buf[512]; void cat(int fd) { 0: 55 push %ebp 1: 89 e5 mov %esp,%ebp 3: 56 push %esi 4: 53 push %ebx 5: 8b 75 08 mov 0x8(%ebp),%esi int n; while((n = read(fd, buf, sizeof(buf))) > 0) { 8: 83 ec 04 sub $0x4,%esp b: 68 00 02 00 00 push $0x200 10: 68 e0 09 00 00 push $0x9e0 15: 56 push %esi 16: e8 84 02 00 00 call 29f <read> 1b: 89 c3 mov %eax,%ebx 1d: 83 c4 10 add $0x10,%esp 20: 85 c0 test %eax,%eax 22: 7e 2b jle 4f <cat+0x4f> if (write(1, buf, n) != n) { 24: 83 ec 04 sub $0x4,%esp 27: 53 push %ebx 28: 68 e0 09 00 00 push $0x9e0 2d: 6a 01 push $0x1 2f: e8 73 02 00 00 call 2a7 <write> 34: 83 c4 10 add $0x10,%esp 37: 39 d8 cmp %ebx,%eax 39: 74 cd je 8 <cat+0x8> printf(1, "cat: write error\n"); 3b: 83 ec 08 sub $0x8,%esp 3e: 68 ac 06 00 00 push $0x6ac 43: 6a 01 push $0x1 45: e8 a7 03 00 00 call 3f1 <printf> exit(); 4a: e8 38 02 00 00 call 287 <exit> } } if(n < 0){ 4f: 85 c0 test %eax,%eax 51: 78 07 js 5a <cat+0x5a> printf(1, "cat: read error\n"); exit(); } } 53: 8d 65 f8 lea -0x8(%ebp),%esp 56: 5b pop %ebx 57: 5e pop %esi 58: 5d pop %ebp 59: c3 ret printf(1, "cat: read error\n"); 5a: 83 ec 08 sub $0x8,%esp 5d: 68 be 06 00 00 push $0x6be 62: 6a 01 push $0x1 64: e8 88 03 00 00 call 3f1 <printf> exit(); 69: e8 19 02 00 00 call 287 <exit> 0000006e <main>: int main(int argc, char *argv[]) { 6e: 8d 4c 24 04 lea 0x4(%esp),%ecx 72: 83 e4 f0 and $0xfffffff0,%esp 75: ff 71 fc pushl -0x4(%ecx) 78: 55 push %ebp 79: 89 e5 mov %esp,%ebp 7b: 57 push %edi 7c: 56 push %esi 7d: 53 push %ebx 7e: 51 push %ecx 7f: 83 ec 18 sub $0x18,%esp 82: 8b 01 mov (%ecx),%eax 84: 89 45 e4 mov %eax,-0x1c(%ebp) 87: 8b 51 04 mov 0x4(%ecx),%edx 8a: 89 55 e0 mov %edx,-0x20(%ebp) int fd, i; if(argc <= 1){ 8d: 83 f8 01 cmp $0x1,%eax 90: 7e 3e jle d0 <main+0x62> cat(0); exit(); } for(i = 1; i < argc; i++){ 92: bb 01 00 00 00 mov $0x1,%ebx 97: 3b 5d e4 cmp -0x1c(%ebp),%ebx 9a: 7d 59 jge f5 <main+0x87> if((fd = open(argv[i], 0)) < 0){ 9c: 8b 45 e0 mov -0x20(%ebp),%eax 9f: 8d 3c 98 lea (%eax,%ebx,4),%edi a2: 83 ec 08 sub $0x8,%esp a5: 6a 00 push $0x0 a7: ff 37 pushl (%edi) a9: e8 19 02 00 00 call 2c7 <open> ae: 89 c6 mov %eax,%esi b0: 83 c4 10 add $0x10,%esp b3: 85 c0 test %eax,%eax b5: 78 28 js df <main+0x71> printf(1, "cat: cannot open %s\n", argv[i]); exit(); } cat(fd); b7: 83 ec 0c sub $0xc,%esp ba: 50 push %eax bb: e8 40 ff ff ff call 0 <cat> close(fd); c0: 89 34 24 mov %esi,(%esp) c3: e8 e7 01 00 00 call 2af <close> for(i = 1; i < argc; i++){ c8: 83 c3 01 add $0x1,%ebx cb: 83 c4 10 add $0x10,%esp ce: eb c7 jmp 97 <main+0x29> cat(0); d0: 83 ec 0c sub $0xc,%esp d3: 6a 00 push $0x0 d5: e8 26 ff ff ff call 0 <cat> exit(); da: e8 a8 01 00 00 call 287 <exit> printf(1, "cat: cannot open %s\n", argv[i]); df: 83 ec 04 sub $0x4,%esp e2: ff 37 pushl (%edi) e4: 68 cf 06 00 00 push $0x6cf e9: 6a 01 push $0x1 eb: e8 01 03 00 00 call 3f1 <printf> exit(); f0: e8 92 01 00 00 call 287 <exit> } exit(); f5: e8 8d 01 00 00 call 287 <exit> 000000fa <strcpy>: #include "user.h" #include "x86.h" char* strcpy(char *s, const char *t) { fa: 55 push %ebp fb: 89 e5 mov %esp,%ebp fd: 53 push %ebx fe: 8b 45 08 mov 0x8(%ebp),%eax 101: 8b 4d 0c mov 0xc(%ebp),%ecx char *os; os = s; while((*s++ = *t++) != 0) 104: 89 c2 mov %eax,%edx 106: 0f b6 19 movzbl (%ecx),%ebx 109: 88 1a mov %bl,(%edx) 10b: 8d 52 01 lea 0x1(%edx),%edx 10e: 8d 49 01 lea 0x1(%ecx),%ecx 111: 84 db test %bl,%bl 113: 75 f1 jne 106 <strcpy+0xc> ; return os; } 115: 5b pop %ebx 116: 5d pop %ebp 117: c3 ret 00000118 <strcmp>: int strcmp(const char *p, const char *q) { 118: 55 push %ebp 119: 89 e5 mov %esp,%ebp 11b: 8b 4d 08 mov 0x8(%ebp),%ecx 11e: 8b 55 0c mov 0xc(%ebp),%edx while(*p && *p == *q) 121: eb 06 jmp 129 <strcmp+0x11> p++, q++; 123: 83 c1 01 add $0x1,%ecx 126: 83 c2 01 add $0x1,%edx while(*p && *p == *q) 129: 0f b6 01 movzbl (%ecx),%eax 12c: 84 c0 test %al,%al 12e: 74 04 je 134 <strcmp+0x1c> 130: 3a 02 cmp (%edx),%al 132: 74 ef je 123 <strcmp+0xb> return (uchar)*p - (uchar)*q; 134: 0f b6 c0 movzbl %al,%eax 137: 0f b6 12 movzbl (%edx),%edx 13a: 29 d0 sub %edx,%eax } 13c: 5d pop %ebp 13d: c3 ret 0000013e <strlen>: uint strlen(const char *s) { 13e: 55 push %ebp 13f: 89 e5 mov %esp,%ebp 141: 8b 4d 08 mov 0x8(%ebp),%ecx int n; for(n = 0; s[n]; n++) 144: ba 00 00 00 00 mov $0x0,%edx 149: eb 03 jmp 14e <strlen+0x10> 14b: 83 c2 01 add $0x1,%edx 14e: 89 d0 mov %edx,%eax 150: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1) 154: 75 f5 jne 14b <strlen+0xd> ; return n; } 156: 5d pop %ebp 157: c3 ret 00000158 <memset>: void* memset(void *dst, int c, uint n) { 158: 55 push %ebp 159: 89 e5 mov %esp,%ebp 15b: 57 push %edi 15c: 8b 55 08 mov 0x8(%ebp),%edx } static inline void stosb(void *addr, int data, int cnt) { asm volatile("cld; rep stosb" : 15f: 89 d7 mov %edx,%edi 161: 8b 4d 10 mov 0x10(%ebp),%ecx 164: 8b 45 0c mov 0xc(%ebp),%eax 167: fc cld 168: f3 aa rep stos %al,%es:(%edi) stosb(dst, c, n); return dst; } 16a: 89 d0 mov %edx,%eax 16c: 5f pop %edi 16d: 5d pop %ebp 16e: c3 ret 0000016f <strchr>: char* strchr(const char *s, char c) { 16f: 55 push %ebp 170: 89 e5 mov %esp,%ebp 172: 8b 45 08 mov 0x8(%ebp),%eax 175: 0f b6 4d 0c movzbl 0xc(%ebp),%ecx for(; *s; s++) 179: 0f b6 10 movzbl (%eax),%edx 17c: 84 d2 test %dl,%dl 17e: 74 09 je 189 <strchr+0x1a> if(*s == c) 180: 38 ca cmp %cl,%dl 182: 74 0a je 18e <strchr+0x1f> for(; *s; s++) 184: 83 c0 01 add $0x1,%eax 187: eb f0 jmp 179 <strchr+0xa> return (char*)s; return 0; 189: b8 00 00 00 00 mov $0x0,%eax } 18e: 5d pop %ebp 18f: c3 ret 00000190 <gets>: char* gets(char *buf, int max) { 190: 55 push %ebp 191: 89 e5 mov %esp,%ebp 193: 57 push %edi 194: 56 push %esi 195: 53 push %ebx 196: 83 ec 1c sub $0x1c,%esp 199: 8b 7d 08 mov 0x8(%ebp),%edi int i, cc; char c; for(i=0; i+1 < max; ){ 19c: bb 00 00 00 00 mov $0x0,%ebx 1a1: 8d 73 01 lea 0x1(%ebx),%esi 1a4: 3b 75 0c cmp 0xc(%ebp),%esi 1a7: 7d 2e jge 1d7 <gets+0x47> cc = read(0, &c, 1); 1a9: 83 ec 04 sub $0x4,%esp 1ac: 6a 01 push $0x1 1ae: 8d 45 e7 lea -0x19(%ebp),%eax 1b1: 50 push %eax 1b2: 6a 00 push $0x0 1b4: e8 e6 00 00 00 call 29f <read> if(cc < 1) 1b9: 83 c4 10 add $0x10,%esp 1bc: 85 c0 test %eax,%eax 1be: 7e 17 jle 1d7 <gets+0x47> break; buf[i++] = c; 1c0: 0f b6 45 e7 movzbl -0x19(%ebp),%eax 1c4: 88 04 1f mov %al,(%edi,%ebx,1) if(c == '\n' || c == '\r') 1c7: 3c 0a cmp $0xa,%al 1c9: 0f 94 c2 sete %dl 1cc: 3c 0d cmp $0xd,%al 1ce: 0f 94 c0 sete %al buf[i++] = c; 1d1: 89 f3 mov %esi,%ebx if(c == '\n' || c == '\r') 1d3: 08 c2 or %al,%dl 1d5: 74 ca je 1a1 <gets+0x11> break; } buf[i] = '\0'; 1d7: c6 04 1f 00 movb $0x0,(%edi,%ebx,1) return buf; } 1db: 89 f8 mov %edi,%eax 1dd: 8d 65 f4 lea -0xc(%ebp),%esp 1e0: 5b pop %ebx 1e1: 5e pop %esi 1e2: 5f pop %edi 1e3: 5d pop %ebp 1e4: c3 ret 000001e5 <stat>: int stat(const char *n, struct stat *st) { 1e5: 55 push %ebp 1e6: 89 e5 mov %esp,%ebp 1e8: 56 push %esi 1e9: 53 push %ebx int fd; int r; fd = open(n, O_RDONLY); 1ea: 83 ec 08 sub $0x8,%esp 1ed: 6a 00 push $0x0 1ef: ff 75 08 pushl 0x8(%ebp) 1f2: e8 d0 00 00 00 call 2c7 <open> if(fd < 0) 1f7: 83 c4 10 add $0x10,%esp 1fa: 85 c0 test %eax,%eax 1fc: 78 24 js 222 <stat+0x3d> 1fe: 89 c3 mov %eax,%ebx return -1; r = fstat(fd, st); 200: 83 ec 08 sub $0x8,%esp 203: ff 75 0c pushl 0xc(%ebp) 206: 50 push %eax 207: e8 d3 00 00 00 call 2df <fstat> 20c: 89 c6 mov %eax,%esi close(fd); 20e: 89 1c 24 mov %ebx,(%esp) 211: e8 99 00 00 00 call 2af <close> return r; 216: 83 c4 10 add $0x10,%esp } 219: 89 f0 mov %esi,%eax 21b: 8d 65 f8 lea -0x8(%ebp),%esp 21e: 5b pop %ebx 21f: 5e pop %esi 220: 5d pop %ebp 221: c3 ret return -1; 222: be ff ff ff ff mov $0xffffffff,%esi 227: eb f0 jmp 219 <stat+0x34> 00000229 <atoi>: int atoi(const char *s) { 229: 55 push %ebp 22a: 89 e5 mov %esp,%ebp 22c: 53 push %ebx 22d: 8b 4d 08 mov 0x8(%ebp),%ecx int n; n = 0; 230: b8 00 00 00 00 mov $0x0,%eax while('0' <= *s && *s <= '9') 235: eb 10 jmp 247 <atoi+0x1e> n = n*10 + *s++ - '0'; 237: 8d 1c 80 lea (%eax,%eax,4),%ebx 23a: 8d 04 1b lea (%ebx,%ebx,1),%eax 23d: 83 c1 01 add $0x1,%ecx 240: 0f be d2 movsbl %dl,%edx 243: 8d 44 02 d0 lea -0x30(%edx,%eax,1),%eax while('0' <= *s && *s <= '9') 247: 0f b6 11 movzbl (%ecx),%edx 24a: 8d 5a d0 lea -0x30(%edx),%ebx 24d: 80 fb 09 cmp $0x9,%bl 250: 76 e5 jbe 237 <atoi+0xe> return n; } 252: 5b pop %ebx 253: 5d pop %ebp 254: c3 ret 00000255 <memmove>: void* memmove(void *vdst, const void *vsrc, int n) { 255: 55 push %ebp 256: 89 e5 mov %esp,%ebp 258: 56 push %esi 259: 53 push %ebx 25a: 8b 45 08 mov 0x8(%ebp),%eax 25d: 8b 5d 0c mov 0xc(%ebp),%ebx 260: 8b 55 10 mov 0x10(%ebp),%edx char *dst; const char *src; dst = vdst; 263: 89 c1 mov %eax,%ecx src = vsrc; while(n-- > 0) 265: eb 0d jmp 274 <memmove+0x1f> *dst++ = *src++; 267: 0f b6 13 movzbl (%ebx),%edx 26a: 88 11 mov %dl,(%ecx) 26c: 8d 5b 01 lea 0x1(%ebx),%ebx 26f: 8d 49 01 lea 0x1(%ecx),%ecx while(n-- > 0) 272: 89 f2 mov %esi,%edx 274: 8d 72 ff lea -0x1(%edx),%esi 277: 85 d2 test %edx,%edx 279: 7f ec jg 267 <memmove+0x12> return vdst; } 27b: 5b pop %ebx 27c: 5e pop %esi 27d: 5d pop %ebp 27e: c3 ret 0000027f <fork>: name: \ movl $SYS_ ## name, %eax; \ int $T_SYSCALL; \ ret SYSCALL(fork) 27f: b8 01 00 00 00 mov $0x1,%eax 284: cd 40 int $0x40 286: c3 ret 00000287 <exit>: SYSCALL(exit) 287: b8 02 00 00 00 mov $0x2,%eax 28c: cd 40 int $0x40 28e: c3 ret 0000028f <wait>: SYSCALL(wait) 28f: b8 03 00 00 00 mov $0x3,%eax 294: cd 40 int $0x40 296: c3 ret 00000297 <pipe>: SYSCALL(pipe) 297: b8 04 00 00 00 mov $0x4,%eax 29c: cd 40 int $0x40 29e: c3 ret 0000029f <read>: SYSCALL(read) 29f: b8 05 00 00 00 mov $0x5,%eax 2a4: cd 40 int $0x40 2a6: c3 ret 000002a7 <write>: SYSCALL(write) 2a7: b8 10 00 00 00 mov $0x10,%eax 2ac: cd 40 int $0x40 2ae: c3 ret 000002af <close>: SYSCALL(close) 2af: b8 15 00 00 00 mov $0x15,%eax 2b4: cd 40 int $0x40 2b6: c3 ret 000002b7 <kill>: SYSCALL(kill) 2b7: b8 06 00 00 00 mov $0x6,%eax 2bc: cd 40 int $0x40 2be: c3 ret 000002bf <exec>: SYSCALL(exec) 2bf: b8 07 00 00 00 mov $0x7,%eax 2c4: cd 40 int $0x40 2c6: c3 ret 000002c7 <open>: SYSCALL(open) 2c7: b8 0f 00 00 00 mov $0xf,%eax 2cc: cd 40 int $0x40 2ce: c3 ret 000002cf <mknod>: SYSCALL(mknod) 2cf: b8 11 00 00 00 mov $0x11,%eax 2d4: cd 40 int $0x40 2d6: c3 ret 000002d7 <unlink>: SYSCALL(unlink) 2d7: b8 12 00 00 00 mov $0x12,%eax 2dc: cd 40 int $0x40 2de: c3 ret 000002df <fstat>: SYSCALL(fstat) 2df: b8 08 00 00 00 mov $0x8,%eax 2e4: cd 40 int $0x40 2e6: c3 ret 000002e7 <link>: SYSCALL(link) 2e7: b8 13 00 00 00 mov $0x13,%eax 2ec: cd 40 int $0x40 2ee: c3 ret 000002ef <mkdir>: SYSCALL(mkdir) 2ef: b8 14 00 00 00 mov $0x14,%eax 2f4: cd 40 int $0x40 2f6: c3 ret 000002f7 <chdir>: SYSCALL(chdir) 2f7: b8 09 00 00 00 mov $0x9,%eax 2fc: cd 40 int $0x40 2fe: c3 ret 000002ff <dup>: SYSCALL(dup) 2ff: b8 0a 00 00 00 mov $0xa,%eax 304: cd 40 int $0x40 306: c3 ret 00000307 <getpid>: SYSCALL(getpid) 307: b8 0b 00 00 00 mov $0xb,%eax 30c: cd 40 int $0x40 30e: c3 ret 0000030f <sbrk>: SYSCALL(sbrk) 30f: b8 0c 00 00 00 mov $0xc,%eax 314: cd 40 int $0x40 316: c3 ret 00000317 <sleep>: SYSCALL(sleep) 317: b8 0d 00 00 00 mov $0xd,%eax 31c: cd 40 int $0x40 31e: c3 ret 0000031f <uptime>: SYSCALL(uptime) 31f: b8 0e 00 00 00 mov $0xe,%eax 324: cd 40 int $0x40 326: c3 ret 00000327 <yield>: SYSCALL(yield) 327: b8 16 00 00 00 mov $0x16,%eax 32c: cd 40 int $0x40 32e: c3 ret 0000032f <shutdown>: SYSCALL(shutdown) 32f: b8 17 00 00 00 mov $0x17,%eax 334: cd 40 int $0x40 336: c3 ret 00000337 <writecount>: SYSCALL(writecount) 337: b8 18 00 00 00 mov $0x18,%eax 33c: cd 40 int $0x40 33e: c3 ret 0000033f <setwritecount>: SYSCALL(setwritecount) 33f: b8 19 00 00 00 mov $0x19,%eax 344: cd 40 int $0x40 346: c3 ret 00000347 <settickets>: SYSCALL(settickets) 347: b8 1a 00 00 00 mov $0x1a,%eax 34c: cd 40 int $0x40 34e: c3 ret 0000034f <getprocessesinfo>: 34f: b8 1b 00 00 00 mov $0x1b,%eax 354: cd 40 int $0x40 356: c3 ret 00000357 <putc>: #include "stat.h" #include "user.h" static void putc(int fd, char c) { 357: 55 push %ebp 358: 89 e5 mov %esp,%ebp 35a: 83 ec 1c sub $0x1c,%esp 35d: 88 55 f4 mov %dl,-0xc(%ebp) write(fd, &c, 1); 360: 6a 01 push $0x1 362: 8d 55 f4 lea -0xc(%ebp),%edx 365: 52 push %edx 366: 50 push %eax 367: e8 3b ff ff ff call 2a7 <write> } 36c: 83 c4 10 add $0x10,%esp 36f: c9 leave 370: c3 ret 00000371 <printint>: static void printint(int fd, int xx, int base, int sgn) { 371: 55 push %ebp 372: 89 e5 mov %esp,%ebp 374: 57 push %edi 375: 56 push %esi 376: 53 push %ebx 377: 83 ec 2c sub $0x2c,%esp 37a: 89 c7 mov %eax,%edi char buf[16]; int i, neg; uint x; neg = 0; if(sgn && xx < 0){ 37c: 83 7d 08 00 cmpl $0x0,0x8(%ebp) 380: 0f 95 c3 setne %bl 383: 89 d0 mov %edx,%eax 385: c1 e8 1f shr $0x1f,%eax 388: 84 c3 test %al,%bl 38a: 74 10 je 39c <printint+0x2b> neg = 1; x = -xx; 38c: f7 da neg %edx neg = 1; 38e: c7 45 d4 01 00 00 00 movl $0x1,-0x2c(%ebp) } else { x = xx; } i = 0; 395: be 00 00 00 00 mov $0x0,%esi 39a: eb 0b jmp 3a7 <printint+0x36> neg = 0; 39c: c7 45 d4 00 00 00 00 movl $0x0,-0x2c(%ebp) 3a3: eb f0 jmp 395 <printint+0x24> do{ buf[i++] = digits[x % base]; 3a5: 89 c6 mov %eax,%esi 3a7: 89 d0 mov %edx,%eax 3a9: ba 00 00 00 00 mov $0x0,%edx 3ae: f7 f1 div %ecx 3b0: 89 c3 mov %eax,%ebx 3b2: 8d 46 01 lea 0x1(%esi),%eax 3b5: 0f b6 92 ec 06 00 00 movzbl 0x6ec(%edx),%edx 3bc: 88 54 35 d8 mov %dl,-0x28(%ebp,%esi,1) }while((x /= base) != 0); 3c0: 89 da mov %ebx,%edx 3c2: 85 db test %ebx,%ebx 3c4: 75 df jne 3a5 <printint+0x34> 3c6: 89 c3 mov %eax,%ebx if(neg) 3c8: 83 7d d4 00 cmpl $0x0,-0x2c(%ebp) 3cc: 74 16 je 3e4 <printint+0x73> buf[i++] = '-'; 3ce: c6 44 05 d8 2d movb $0x2d,-0x28(%ebp,%eax,1) 3d3: 8d 5e 02 lea 0x2(%esi),%ebx 3d6: eb 0c jmp 3e4 <printint+0x73> while(--i >= 0) putc(fd, buf[i]); 3d8: 0f be 54 1d d8 movsbl -0x28(%ebp,%ebx,1),%edx 3dd: 89 f8 mov %edi,%eax 3df: e8 73 ff ff ff call 357 <putc> while(--i >= 0) 3e4: 83 eb 01 sub $0x1,%ebx 3e7: 79 ef jns 3d8 <printint+0x67> } 3e9: 83 c4 2c add $0x2c,%esp 3ec: 5b pop %ebx 3ed: 5e pop %esi 3ee: 5f pop %edi 3ef: 5d pop %ebp 3f0: c3 ret 000003f1 <printf>: // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, const char *fmt, ...) { 3f1: 55 push %ebp 3f2: 89 e5 mov %esp,%ebp 3f4: 57 push %edi 3f5: 56 push %esi 3f6: 53 push %ebx 3f7: 83 ec 1c sub $0x1c,%esp char *s; int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; 3fa: 8d 45 10 lea 0x10(%ebp),%eax 3fd: 89 45 e4 mov %eax,-0x1c(%ebp) state = 0; 400: be 00 00 00 00 mov $0x0,%esi for(i = 0; fmt[i]; i++){ 405: bb 00 00 00 00 mov $0x0,%ebx 40a: eb 14 jmp 420 <printf+0x2f> c = fmt[i] & 0xff; if(state == 0){ if(c == '%'){ state = '%'; } else { putc(fd, c); 40c: 89 fa mov %edi,%edx 40e: 8b 45 08 mov 0x8(%ebp),%eax 411: e8 41 ff ff ff call 357 <putc> 416: eb 05 jmp 41d <printf+0x2c> } } else if(state == '%'){ 418: 83 fe 25 cmp $0x25,%esi 41b: 74 25 je 442 <printf+0x51> for(i = 0; fmt[i]; i++){ 41d: 83 c3 01 add $0x1,%ebx 420: 8b 45 0c mov 0xc(%ebp),%eax 423: 0f b6 04 18 movzbl (%eax,%ebx,1),%eax 427: 84 c0 test %al,%al 429: 0f 84 23 01 00 00 je 552 <printf+0x161> c = fmt[i] & 0xff; 42f: 0f be f8 movsbl %al,%edi 432: 0f b6 c0 movzbl %al,%eax if(state == 0){ 435: 85 f6 test %esi,%esi 437: 75 df jne 418 <printf+0x27> if(c == '%'){ 439: 83 f8 25 cmp $0x25,%eax 43c: 75 ce jne 40c <printf+0x1b> state = '%'; 43e: 89 c6 mov %eax,%esi 440: eb db jmp 41d <printf+0x2c> if(c == 'd'){ 442: 83 f8 64 cmp $0x64,%eax 445: 74 49 je 490 <printf+0x9f> printint(fd, *ap, 10, 1); ap++; } else if(c == 'x' || c == 'p'){ 447: 83 f8 78 cmp $0x78,%eax 44a: 0f 94 c1 sete %cl 44d: 83 f8 70 cmp $0x70,%eax 450: 0f 94 c2 sete %dl 453: 08 d1 or %dl,%cl 455: 75 63 jne 4ba <printf+0xc9> printint(fd, *ap, 16, 0); ap++; } else if(c == 's'){ 457: 83 f8 73 cmp $0x73,%eax 45a: 0f 84 84 00 00 00 je 4e4 <printf+0xf3> s = "(null)"; while(*s != 0){ putc(fd, *s); s++; } } else if(c == 'c'){ 460: 83 f8 63 cmp $0x63,%eax 463: 0f 84 b7 00 00 00 je 520 <printf+0x12f> putc(fd, *ap); ap++; } else if(c == '%'){ 469: 83 f8 25 cmp $0x25,%eax 46c: 0f 84 cc 00 00 00 je 53e <printf+0x14d> putc(fd, c); } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); 472: ba 25 00 00 00 mov $0x25,%edx 477: 8b 45 08 mov 0x8(%ebp),%eax 47a: e8 d8 fe ff ff call 357 <putc> putc(fd, c); 47f: 89 fa mov %edi,%edx 481: 8b 45 08 mov 0x8(%ebp),%eax 484: e8 ce fe ff ff call 357 <putc> } state = 0; 489: be 00 00 00 00 mov $0x0,%esi 48e: eb 8d jmp 41d <printf+0x2c> printint(fd, *ap, 10, 1); 490: 8b 7d e4 mov -0x1c(%ebp),%edi 493: 8b 17 mov (%edi),%edx 495: 83 ec 0c sub $0xc,%esp 498: 6a 01 push $0x1 49a: b9 0a 00 00 00 mov $0xa,%ecx 49f: 8b 45 08 mov 0x8(%ebp),%eax 4a2: e8 ca fe ff ff call 371 <printint> ap++; 4a7: 83 c7 04 add $0x4,%edi 4aa: 89 7d e4 mov %edi,-0x1c(%ebp) 4ad: 83 c4 10 add $0x10,%esp state = 0; 4b0: be 00 00 00 00 mov $0x0,%esi 4b5: e9 63 ff ff ff jmp 41d <printf+0x2c> printint(fd, *ap, 16, 0); 4ba: 8b 7d e4 mov -0x1c(%ebp),%edi 4bd: 8b 17 mov (%edi),%edx 4bf: 83 ec 0c sub $0xc,%esp 4c2: 6a 00 push $0x0 4c4: b9 10 00 00 00 mov $0x10,%ecx 4c9: 8b 45 08 mov 0x8(%ebp),%eax 4cc: e8 a0 fe ff ff call 371 <printint> ap++; 4d1: 83 c7 04 add $0x4,%edi 4d4: 89 7d e4 mov %edi,-0x1c(%ebp) 4d7: 83 c4 10 add $0x10,%esp state = 0; 4da: be 00 00 00 00 mov $0x0,%esi 4df: e9 39 ff ff ff jmp 41d <printf+0x2c> s = (char*)*ap; 4e4: 8b 45 e4 mov -0x1c(%ebp),%eax 4e7: 8b 30 mov (%eax),%esi ap++; 4e9: 83 c0 04 add $0x4,%eax 4ec: 89 45 e4 mov %eax,-0x1c(%ebp) if(s == 0) 4ef: 85 f6 test %esi,%esi 4f1: 75 28 jne 51b <printf+0x12a> s = "(null)"; 4f3: be e4 06 00 00 mov $0x6e4,%esi 4f8: 8b 7d 08 mov 0x8(%ebp),%edi 4fb: eb 0d jmp 50a <printf+0x119> putc(fd, *s); 4fd: 0f be d2 movsbl %dl,%edx 500: 89 f8 mov %edi,%eax 502: e8 50 fe ff ff call 357 <putc> s++; 507: 83 c6 01 add $0x1,%esi while(*s != 0){ 50a: 0f b6 16 movzbl (%esi),%edx 50d: 84 d2 test %dl,%dl 50f: 75 ec jne 4fd <printf+0x10c> state = 0; 511: be 00 00 00 00 mov $0x0,%esi 516: e9 02 ff ff ff jmp 41d <printf+0x2c> 51b: 8b 7d 08 mov 0x8(%ebp),%edi 51e: eb ea jmp 50a <printf+0x119> putc(fd, *ap); 520: 8b 7d e4 mov -0x1c(%ebp),%edi 523: 0f be 17 movsbl (%edi),%edx 526: 8b 45 08 mov 0x8(%ebp),%eax 529: e8 29 fe ff ff call 357 <putc> ap++; 52e: 83 c7 04 add $0x4,%edi 531: 89 7d e4 mov %edi,-0x1c(%ebp) state = 0; 534: be 00 00 00 00 mov $0x0,%esi 539: e9 df fe ff ff jmp 41d <printf+0x2c> putc(fd, c); 53e: 89 fa mov %edi,%edx 540: 8b 45 08 mov 0x8(%ebp),%eax 543: e8 0f fe ff ff call 357 <putc> state = 0; 548: be 00 00 00 00 mov $0x0,%esi 54d: e9 cb fe ff ff jmp 41d <printf+0x2c> } } } 552: 8d 65 f4 lea -0xc(%ebp),%esp 555: 5b pop %ebx 556: 5e pop %esi 557: 5f pop %edi 558: 5d pop %ebp 559: c3 ret 0000055a <free>: static Header base; static Header *freep; void free(void *ap) { 55a: 55 push %ebp 55b: 89 e5 mov %esp,%ebp 55d: 57 push %edi 55e: 56 push %esi 55f: 53 push %ebx 560: 8b 5d 08 mov 0x8(%ebp),%ebx Header *bp, *p; bp = (Header*)ap - 1; 563: 8d 4b f8 lea -0x8(%ebx),%ecx for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 566: a1 c0 09 00 00 mov 0x9c0,%eax 56b: eb 02 jmp 56f <free+0x15> 56d: 89 d0 mov %edx,%eax 56f: 39 c8 cmp %ecx,%eax 571: 73 04 jae 577 <free+0x1d> 573: 39 08 cmp %ecx,(%eax) 575: 77 12 ja 589 <free+0x2f> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 577: 8b 10 mov (%eax),%edx 579: 39 c2 cmp %eax,%edx 57b: 77 f0 ja 56d <free+0x13> 57d: 39 c8 cmp %ecx,%eax 57f: 72 08 jb 589 <free+0x2f> 581: 39 ca cmp %ecx,%edx 583: 77 04 ja 589 <free+0x2f> 585: 89 d0 mov %edx,%eax 587: eb e6 jmp 56f <free+0x15> break; if(bp + bp->s.size == p->s.ptr){ 589: 8b 73 fc mov -0x4(%ebx),%esi 58c: 8d 3c f1 lea (%ecx,%esi,8),%edi 58f: 8b 10 mov (%eax),%edx 591: 39 d7 cmp %edx,%edi 593: 74 19 je 5ae <free+0x54> bp->s.size += p->s.ptr->s.size; bp->s.ptr = p->s.ptr->s.ptr; } else bp->s.ptr = p->s.ptr; 595: 89 53 f8 mov %edx,-0x8(%ebx) if(p + p->s.size == bp){ 598: 8b 50 04 mov 0x4(%eax),%edx 59b: 8d 34 d0 lea (%eax,%edx,8),%esi 59e: 39 ce cmp %ecx,%esi 5a0: 74 1b je 5bd <free+0x63> p->s.size += bp->s.size; p->s.ptr = bp->s.ptr; } else p->s.ptr = bp; 5a2: 89 08 mov %ecx,(%eax) freep = p; 5a4: a3 c0 09 00 00 mov %eax,0x9c0 } 5a9: 5b pop %ebx 5aa: 5e pop %esi 5ab: 5f pop %edi 5ac: 5d pop %ebp 5ad: c3 ret bp->s.size += p->s.ptr->s.size; 5ae: 03 72 04 add 0x4(%edx),%esi 5b1: 89 73 fc mov %esi,-0x4(%ebx) bp->s.ptr = p->s.ptr->s.ptr; 5b4: 8b 10 mov (%eax),%edx 5b6: 8b 12 mov (%edx),%edx 5b8: 89 53 f8 mov %edx,-0x8(%ebx) 5bb: eb db jmp 598 <free+0x3e> p->s.size += bp->s.size; 5bd: 03 53 fc add -0x4(%ebx),%edx 5c0: 89 50 04 mov %edx,0x4(%eax) p->s.ptr = bp->s.ptr; 5c3: 8b 53 f8 mov -0x8(%ebx),%edx 5c6: 89 10 mov %edx,(%eax) 5c8: eb da jmp 5a4 <free+0x4a> 000005ca <morecore>: static Header* morecore(uint nu) { 5ca: 55 push %ebp 5cb: 89 e5 mov %esp,%ebp 5cd: 53 push %ebx 5ce: 83 ec 04 sub $0x4,%esp 5d1: 89 c3 mov %eax,%ebx char *p; Header *hp; if(nu < 4096) 5d3: 3d ff 0f 00 00 cmp $0xfff,%eax 5d8: 77 05 ja 5df <morecore+0x15> nu = 4096; 5da: bb 00 10 00 00 mov $0x1000,%ebx p = sbrk(nu * sizeof(Header)); 5df: 8d 04 dd 00 00 00 00 lea 0x0(,%ebx,8),%eax 5e6: 83 ec 0c sub $0xc,%esp 5e9: 50 push %eax 5ea: e8 20 fd ff ff call 30f <sbrk> if(p == (char*)-1) 5ef: 83 c4 10 add $0x10,%esp 5f2: 83 f8 ff cmp $0xffffffff,%eax 5f5: 74 1c je 613 <morecore+0x49> return 0; hp = (Header*)p; hp->s.size = nu; 5f7: 89 58 04 mov %ebx,0x4(%eax) free((void*)(hp + 1)); 5fa: 83 c0 08 add $0x8,%eax 5fd: 83 ec 0c sub $0xc,%esp 600: 50 push %eax 601: e8 54 ff ff ff call 55a <free> return freep; 606: a1 c0 09 00 00 mov 0x9c0,%eax 60b: 83 c4 10 add $0x10,%esp } 60e: 8b 5d fc mov -0x4(%ebp),%ebx 611: c9 leave 612: c3 ret return 0; 613: b8 00 00 00 00 mov $0x0,%eax 618: eb f4 jmp 60e <morecore+0x44> 0000061a <malloc>: void* malloc(uint nbytes) { 61a: 55 push %ebp 61b: 89 e5 mov %esp,%ebp 61d: 53 push %ebx 61e: 83 ec 04 sub $0x4,%esp Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; 621: 8b 45 08 mov 0x8(%ebp),%eax 624: 8d 58 07 lea 0x7(%eax),%ebx 627: c1 eb 03 shr $0x3,%ebx 62a: 83 c3 01 add $0x1,%ebx if((prevp = freep) == 0){ 62d: 8b 0d c0 09 00 00 mov 0x9c0,%ecx 633: 85 c9 test %ecx,%ecx 635: 74 04 je 63b <malloc+0x21> base.s.ptr = freep = prevp = &base; base.s.size = 0; } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ 637: 8b 01 mov (%ecx),%eax 639: eb 4d jmp 688 <malloc+0x6e> base.s.ptr = freep = prevp = &base; 63b: c7 05 c0 09 00 00 c4 movl $0x9c4,0x9c0 642: 09 00 00 645: c7 05 c4 09 00 00 c4 movl $0x9c4,0x9c4 64c: 09 00 00 base.s.size = 0; 64f: c7 05 c8 09 00 00 00 movl $0x0,0x9c8 656: 00 00 00 base.s.ptr = freep = prevp = &base; 659: b9 c4 09 00 00 mov $0x9c4,%ecx 65e: eb d7 jmp 637 <malloc+0x1d> if(p->s.size >= nunits){ if(p->s.size == nunits) 660: 39 da cmp %ebx,%edx 662: 74 1a je 67e <malloc+0x64> prevp->s.ptr = p->s.ptr; else { p->s.size -= nunits; 664: 29 da sub %ebx,%edx 666: 89 50 04 mov %edx,0x4(%eax) p += p->s.size; 669: 8d 04 d0 lea (%eax,%edx,8),%eax p->s.size = nunits; 66c: 89 58 04 mov %ebx,0x4(%eax) } freep = prevp; 66f: 89 0d c0 09 00 00 mov %ecx,0x9c0 return (void*)(p + 1); 675: 83 c0 08 add $0x8,%eax } if(p == freep) if((p = morecore(nunits)) == 0) return 0; } } 678: 83 c4 04 add $0x4,%esp 67b: 5b pop %ebx 67c: 5d pop %ebp 67d: c3 ret prevp->s.ptr = p->s.ptr; 67e: 8b 10 mov (%eax),%edx 680: 89 11 mov %edx,(%ecx) 682: eb eb jmp 66f <malloc+0x55> for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ 684: 89 c1 mov %eax,%ecx 686: 8b 00 mov (%eax),%eax if(p->s.size >= nunits){ 688: 8b 50 04 mov 0x4(%eax),%edx 68b: 39 da cmp %ebx,%edx 68d: 73 d1 jae 660 <malloc+0x46> if(p == freep) 68f: 39 05 c0 09 00 00 cmp %eax,0x9c0 695: 75 ed jne 684 <malloc+0x6a> if((p = morecore(nunits)) == 0) 697: 89 d8 mov %ebx,%eax 699: e8 2c ff ff ff call 5ca <morecore> 69e: 85 c0 test %eax,%eax 6a0: 75 e2 jne 684 <malloc+0x6a> return 0; 6a2: b8 00 00 00 00 mov $0x0,%eax 6a7: eb cf jmp 678 <malloc+0x5e>
; A172254: 1 followed by period 4: repeat [-1, 3, -2, -1]. ; Submitted by Jamie Morken(s2) ; 1,-1,3,-2,-1,-1,3,-2,-1,-1,3,-2,-1,-1,3,-2,-1,-1,3,-2,-1,-1,3,-2,-1,-1,3,-2,-1,-1,3,-2,-1,-1,3,-2,-1,-1,3,-2,-1,-1,3,-2,-1,-1,3,-2,-1,-1,3,-2,-1,-1,3,-2,-1,-1,3,-2,-1,-1,3,-2,-1,-1,3,-2,-1,-1,3,-2,-1,-1,3,-2,-1 sub $0,1 mod $0,4 mod $0,3 add $0,2 dif $0,-2
// @copyright 2019 Ashwin Varghese Kuruttukulam, #include "ToyDetection.hpp" ToyDetection::ToyDetection(ros::NodeHandle* nodehandle):nh_(*nodehandle){ initializeSubscribers(); initializePublishers(); } void ToyDetection::initializeSubscribers(){ } void ToyDetection::initializePublishers(){ ros::Publisher tagPosePub = nh_.advertise<geometry_msgs::PoseStamped>("knd/tag_pose", 1); } void ToyDetection::detectArUco(){ ToyDetection::listener.lookupTransform("/aruco_frame", "/base_footprint",ros::Time(0),ToyDetection::transform); ToyDetection::poseStamped; poseStamped.header.frame_id="/base_footprint"; ToyDetection::poseStamped.header.stamp = ros::Time::now() ToyDetection::poseStamped.pose.position.x = transform.getOrigin().x(); ToyDetection::poseStamped.pose.position.y = transform.getOrigin().y(); ToyDetection::poseStamped.pose.position.z = transform.getOrigin().z(); ToyDetection::poseStamped.pose.orientation.x = transform.getRotation().x(); ToyDetection::poseStamped.pose.orientation.y = transform.getRotation().y(); ToyDetection::poseStamped.pose.orientation.z = transform.getRotation().z(); ToyDetection::poseStamped.pose.orientation.w = transform.getRotation().w(); tagPosePub.publish(ToyDetection::poseStamped); } int main(int argc, char** argv){ ros::init(argc, argv, "toy_detection"); //node name ros::NodeHandle nh; // create a node handle; need to pass this to the class constructor ROS_INFO_STREAM("Started ToyDetection node"); ToyDetection toy_detection(&nh); ros::spin(); return 0; }
COMMENT }%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Copyright (c) GeoWorks 1988 -- All Rights Reserved PROJECT: PC GEOS MODULE: Video driver FILE: egaManager.asm AUTHOR: Jim DeFrisco REVISION HISTORY: Name Date Description ---- ---- ----------- Jim 4/88 initial version DESCRIPTION: This file contains the source for the EGA screen driver. There are a number of actual files included in this one that actually contain the actual source code. They are located in the EGA directory. The complete specification for screen drivers can be found on the system in the pcgeos spec directory (/staff/pcgeos/Spec). $Id: egaManager.asm,v 1.1 97/04/18 11:42:08 newdeal Exp $ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%} ;-------------------------------------- ; Include files ;-------------------------------------- _VideoDriver = 1 VIDEO_STACK_SIZE equ 512 ; set size of VidStack include vidcomGeode.def ; common video driver includes ;--------------------------------------------------------------------- ; Constants and Macros ;--------------------------------------------------------------------- include egaConstant.def include vgacomConstant.def include vidcomConstant.def include vgacomMacro.def include vidcomMacro.def ;------------------------------------------------------------------------------ ; Variables ;------------------------------------------------------------------------------ idata segment include egaDevInfo.asm ; device info block include vidcomTables.asm ; common tables include egaTables.asm ; important tabular information idata ends udata segment include vidcomVariable.def include vgacomVariable.def ; local buffer space udata ends ;------------------------------------------------------------------------------ ; Variables ;------------------------------------------------------------------------------ VideoDevices segment lmem LMEM_TYPE_GENERAL include egaStringTab.asm ; device names VideoDevices ends ;------------------------------------------------------------------------------ ; Code ;------------------------------------------------------------------------------ idata segment include vidcomEntry.asm ; entry point,jump tab include vidcomOutput.asm ; common output routines include vidcomChars.asm ; common character output routines include vgacomGenChar.asm ; routines for larger characters include vidcomFont.asm ; routines for rotating, building chars include vidcomUnder.asm ; save under routines include vidcomUtils.asm ; utility routines include vidcomRegion.asm ; region drawing routines include vidcomXOR.asm ; xor region support include vidcomInfo.asm ; device setting/naming include vidcomEscape.asm ; implements some escape functions include vidcomDither.asm ; dither support include vidcomPalette.asm ; support for VidGetPixel include vgacomOutput.asm ; output routines include vgacomUtils.asm ; misc utility routines include vgacomChars.asm ; character drawing routines include vgacomPointer.asm ; pointer support include vgacomPalette.asm ; standard palette buffer include egaEscTab.asm ; escape code jump table include egaPalette.asm ; color palette table idata ends include vidcomPolygon.asm ; polygon drawing include vidcomLine.asm ; line drawing routine include vidcomPutLine.asm ; rotated bitmap support routine include vidcomRaster.asm ; raster primitive support include vidcomExclBounds.asm ; bounds accumulation include vgacomRaster.asm ; raster primitive support include vgacomTables.asm ; some common tables include egaAdmin.asm ; misc admin routines end
/* Copyright (C) 2020 Quaternion Risk Management Ltd All rights reserved. This file is part of ORE, a free-software/open-source library for transparent pricing and risk analysis - http://opensourcerisk.org ORE is free software: you can redistribute it and/or modify it under the terms of the Modified BSD License. You should have received a copy of the license along with this program. The license is also available online at <http://opensourcerisk.org> This program is distributed on the basis that it will form a useful contribution to risk analytics and model standardisation, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the license for more details. */ /*! \file largejointcalendar.hpp \brief Joint calendar */ #ifndef quantext_large_joint_calendar_h #define quantext_large_joint_calendar_h #include <ql/time/calendar.hpp> #include <ql/time/calendars/jointcalendar.hpp> namespace QuantExt { //! Large Joint calendar /*! Similar to QuantLib's "JointCalendar" but allows a larger number of underlying calendars. \ingroup calendars \test the correctness of the returned results is tested by reproducing the calculations. */ class LargeJointCalendar : public QuantLib::Calendar { private: class Impl : public Calendar::Impl { public: Impl(const std::vector<QuantLib::Calendar>& calendar, QuantLib::JointCalendarRule rule); std::string name() const; bool isWeekend(QuantLib::Weekday) const; bool isBusinessDay(const QuantLib::Date&) const; private: QuantLib::JointCalendarRule rule_; std::vector<QuantLib::Calendar> calendars_; }; public: explicit LargeJointCalendar(const std::vector<QuantLib::Calendar>&, QuantLib::JointCalendarRule = QuantLib::JoinHolidays); }; } // namespace QuantExt #endif
############################################################################### # Copyright 2018 Intel Corporation # All Rights Reserved. # # If this software was obtained under the Intel Simplified Software License, # the following terms apply: # # The source code, information and material ("Material") contained herein is # owned by Intel Corporation or its suppliers or licensors, and title to such # Material remains with Intel Corporation or its suppliers or licensors. The # Material contains proprietary information of Intel or its suppliers and # licensors. The Material is protected by worldwide copyright laws and treaty # provisions. No part of the Material may be used, copied, reproduced, # modified, published, uploaded, posted, transmitted, distributed or disclosed # in any way without Intel's prior express written permission. No license under # any patent, copyright or other intellectual property rights in the Material # is granted to or conferred upon you, either expressly, by implication, # inducement, estoppel or otherwise. Any license under such intellectual # property rights must be express and approved by Intel in writing. # # Unless otherwise agreed by Intel in writing, you may not remove or alter this # notice or any other notice embedded in Materials by Intel or Intel's # suppliers or licensors in any way. # # # If this software was obtained under the Apache License, Version 2.0 (the # "License"), the following terms apply: # # 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. ############################################################################### .section .note.GNU-stack,"",%progbits .text .p2align 5, 0x90 .globl l9_EncryptOFB_RIJ128_AES_NI .type l9_EncryptOFB_RIJ128_AES_NI, @function l9_EncryptOFB_RIJ128_AES_NI: push %r12 push %r15 sub $(168), %rsp mov (192)(%rsp), %rax movdqu (%rax), %xmm0 movdqa %xmm0, (%rsp) movslq %r8d, %r8 movslq %r9d, %r9 mov %rcx, %r15 lea (,%rdx,4), %rax lea (-144)(%r15,%rax,4), %rax lea (,%r9,4), %r10 .p2align 5, 0x90 .Lblks_loopgas_1: cmp %r10, %r8 cmovl %r8, %r10 xor %rcx, %rcx .L__0009gas_1: movb (%rdi,%rcx), %r11b movb %r11b, (96)(%rsp,%rcx) add $(1), %rcx cmp %r10, %rcx jl .L__0009gas_1 mov %r10, %r12 xor %r11, %r11 .p2align 5, 0x90 .Lsingle_blkgas_1: pxor (%r15), %xmm0 cmp $(12), %rdx jl .Lkey_128_sgas_1 jz .Lkey_192_sgas_1 .Lkey_256_sgas_1: aesenc (-64)(%rax), %xmm0 aesenc (-48)(%rax), %xmm0 .Lkey_192_sgas_1: aesenc (-32)(%rax), %xmm0 aesenc (-16)(%rax), %xmm0 .Lkey_128_sgas_1: aesenc (%rax), %xmm0 aesenc (16)(%rax), %xmm0 aesenc (32)(%rax), %xmm0 aesenc (48)(%rax), %xmm0 aesenc (64)(%rax), %xmm0 aesenc (80)(%rax), %xmm0 aesenc (96)(%rax), %xmm0 aesenc (112)(%rax), %xmm0 aesenc (128)(%rax), %xmm0 aesenclast (144)(%rax), %xmm0 movdqa %xmm0, (16)(%rsp) movdqu (96)(%rsp,%r11), %xmm1 pxor %xmm0, %xmm1 movdqu %xmm1, (32)(%rsp,%r11) movdqu (%rsp,%r9), %xmm0 movdqa %xmm0, (%rsp) add %r9, %r11 sub %r9, %r12 jg .Lsingle_blkgas_1 xor %rcx, %rcx .L__000Agas_1: movb (32)(%rsp,%rcx), %r11b movb %r11b, (%rsi,%rcx) add $(1), %rcx cmp %r10, %rcx jl .L__000Agas_1 add %r10, %rdi add %r10, %rsi sub %r10, %r8 jg .Lblks_loopgas_1 mov (192)(%rsp), %rax movdqa (%rsp), %xmm0 movdqu %xmm0, (%rax) add $(168), %rsp vzeroupper pop %r15 pop %r12 ret .Lfe1: .size l9_EncryptOFB_RIJ128_AES_NI, .Lfe1-(l9_EncryptOFB_RIJ128_AES_NI) .p2align 5, 0x90 .globl l9_EncryptOFB128_RIJ128_AES_NI .type l9_EncryptOFB128_RIJ128_AES_NI, @function l9_EncryptOFB128_RIJ128_AES_NI: movdqu (%r9), %xmm0 movslq %r8d, %r8 lea (,%rdx,4), %rax lea (-144)(%rcx,%rax,4), %rax .Lblks_loopgas_2: pxor (%rcx), %xmm0 movdqu (%rdi), %xmm1 cmp $(12), %rdx jl .Lkey_128_sgas_2 jz .Lkey_192_sgas_2 .Lkey_256_sgas_2: aesenc (-64)(%rax), %xmm0 aesenc (-48)(%rax), %xmm0 .Lkey_192_sgas_2: aesenc (-32)(%rax), %xmm0 aesenc (-16)(%rax), %xmm0 .Lkey_128_sgas_2: aesenc (%rax), %xmm0 aesenc (16)(%rax), %xmm0 aesenc (32)(%rax), %xmm0 aesenc (48)(%rax), %xmm0 aesenc (64)(%rax), %xmm0 aesenc (80)(%rax), %xmm0 aesenc (96)(%rax), %xmm0 aesenc (112)(%rax), %xmm0 aesenc (128)(%rax), %xmm0 aesenclast (144)(%rax), %xmm0 pxor %xmm0, %xmm1 movdqu %xmm1, (%rsi) add $(16), %rdi add $(16), %rsi sub $(16), %r8 jg .Lblks_loopgas_2 movdqu %xmm0, (%r9) vzeroupper ret .Lfe2: .size l9_EncryptOFB128_RIJ128_AES_NI, .Lfe2-(l9_EncryptOFB128_RIJ128_AES_NI)
; A267533: Triangle read by rows giving successive states of cellular automaton generated by "Rule 143" initiated with a single ON (black) cell. ; 1,1,1,0,1,1,0,0,1,1,1,0,0,1,1,1,1,1,0,0,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 mov $1,2 cal $0,53186 ; Square excess of n: difference between n and largest square <= n. sub $0,2 mov $2,1 bin $2,$0 sub $1,$2 sub $1,1
; A157636: Triangle read by rows: T(n, k) = 1 if k=0 or k=n, otherwise = n*k*(n-k)/2. ; Submitted by Christian Krause ; 1,1,1,1,1,1,1,3,3,1,1,6,8,6,1,1,10,15,15,10,1,1,15,24,27,24,15,1,1,21,35,42,42,35,21,1,1,28,48,60,64,60,48,28,1,1,36,63,81,90,90,81,63,36,1,1,45,80,105,120,125,120,105,80,45,1,1,55,99,132,154,165,165,154,132,99,55,1,1,66,120,162,192,210,216,210,192,162,120,66,1,1,78,143,195,234,260,273,273,260 seq $0,157635 ; Triangle read by rows: T(n,m) = 1 if n*m*(n-m) = 0, and n*m*(n-m) otherwise. dif $0,2
.global s_prepare_buffers s_prepare_buffers: push %r11 push %r15 push %r9 push %rbx push %rdi push %rsi lea addresses_WT_ht+0x11043, %r11 nop nop nop nop nop dec %r9 mov (%r11), %rdi nop xor $39922, %r15 lea addresses_normal_ht+0x1eeed, %r9 nop nop cmp %rbx, %rbx mov $0x6162636465666768, %r15 movq %r15, %xmm7 vmovups %ymm7, (%r9) nop nop nop xor %rdi, %rdi lea addresses_WC_ht+0x1c9ed, %rsi nop nop add %r15, %r15 mov $0x6162636465666768, %r9 movq %r9, %xmm2 vmovups %ymm2, (%rsi) nop cmp %rsi, %rsi pop %rsi pop %rdi pop %rbx pop %r9 pop %r15 pop %r11 ret .global s_faulty_load s_faulty_load: push %r14 push %r8 push %r9 push %rbp push %rbx push %rcx push %rdi push %rsi // Load lea addresses_normal+0xf6ed, %rsi nop nop nop and $21836, %rbp mov (%rsi), %bx cmp $51129, %r8 // REPMOV lea addresses_A+0x1feed, %rsi lea addresses_A+0x1feed, %rdi nop nop sub $36693, %r9 mov $39, %rcx rep movsw // Exception!!! nop nop nop nop nop mov (0), %r8 nop add %rbx, %rbx // Store lea addresses_US+0xa96d, %rbp nop nop nop add $42285, %rdi mov $0x5152535455565758, %rbx movq %rbx, (%rbp) and %rbp, %rbp // Faulty Load lea addresses_A+0x1feed, %r8 nop nop xor %rbp, %rbp movb (%r8), %r14b lea oracles, %rbp and $0xff, %r14 shlq $12, %r14 mov (%rbp,%r14,1), %r14 pop %rsi pop %rdi pop %rcx pop %rbx pop %rbp pop %r9 pop %r8 pop %r14 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_A', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}} {'OP': 'LOAD', 'src': {'type': 'addresses_normal', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 7, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_A', 'congruent': 0, 'same': True}, 'dst': {'type': 'addresses_A', 'congruent': 0, 'same': True}} {'OP': 'STOR', 'dst': {'type': 'addresses_US', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 6, 'same': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_A', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}} <gen_prepare_buffer> {'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 11, 'same': True}} {'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 8, 'same': False}} {'35': 27} 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 */
lui $1,25507 ori $1,$1,60629 lui $2,54447 ori $2,$2,30405 lui $3,9801 ori $3,$3,35127 lui $4,20902 ori $4,$4,17453 lui $5,55959 ori $5,$5,49056 lui $6,4729 ori $6,$6,5615 mthi $1 mtlo $2 sec0: nop nop nop nor $2,$6,$2 sec1: nop nop and $6,$5,$3 nor $1,$6,$2 sec2: nop nop addiu $6,$1,4346 nor $5,$6,$2 sec3: nop nop mflo $6 nor $4,$6,$2 sec4: nop nop lbu $6,16($0) nor $2,$6,$2 sec5: nop addu $6,$3,$1 nop nor $3,$6,$2 sec6: nop subu $6,$3,$4 or $6,$0,$2 nor $5,$6,$2 sec7: nop subu $6,$5,$4 slti $6,$2,25267 nor $0,$6,$2 sec8: nop and $6,$3,$2 mflo $6 nor $3,$6,$2 sec9: nop slt $6,$3,$1 lbu $6,12($0) nor $2,$6,$2 sec10: nop sltiu $6,$5,-32044 nop nor $3,$6,$2 sec11: nop xori $6,$2,5349 nor $6,$2,$3 nor $3,$6,$2 sec12: nop slti $6,$2,-18508 lui $6,65339 nor $6,$6,$2 sec13: nop xori $6,$3,16154 mflo $6 nor $1,$6,$2 sec14: nop xori $6,$1,36280 lw $6,16($0) nor $3,$6,$2 sec15: nop mfhi $6 nop nor $4,$6,$2 sec16: nop mfhi $6 nor $6,$5,$2 nor $4,$6,$2 sec17: nop mfhi $6 sltiu $6,$4,1209 nor $1,$6,$2 sec18: nop mfhi $6 mfhi $6 nor $3,$6,$2 sec19: nop mfhi $6 lbu $6,16($0) nor $2,$6,$2 sec20: nop lbu $6,1($0) nop nor $3,$6,$2 sec21: nop lhu $6,10($0) slt $6,$4,$1 nor $0,$6,$2 sec22: nop lbu $6,11($0) slti $6,$4,-31404 nor $1,$6,$2 sec23: nop lh $6,12($0) mflo $6 nor $2,$6,$2 sec24: nop lbu $6,5($0) lbu $6,9($0) nor $0,$6,$2 sec25: xor $6,$2,$0 nop nop nor $1,$6,$2 sec26: xor $6,$5,$4 nop or $6,$6,$1 nor $1,$6,$2 sec27: or $6,$3,$4 nop andi $6,$3,61700 nor $5,$6,$2 sec28: slt $6,$5,$3 nop mflo $6 nor $2,$6,$2 sec29: subu $6,$1,$5 nop lhu $6,2($0) nor $3,$6,$2 sec30: subu $6,$0,$2 and $6,$5,$0 nop nor $3,$6,$2 sec31: sltu $6,$2,$4 sltu $6,$5,$2 or $6,$5,$2 nor $3,$6,$2 sec32: subu $6,$3,$3 or $6,$3,$2 lui $6,54166 nor $1,$6,$2 sec33: sltu $6,$1,$6 slt $6,$5,$3 mfhi $6 nor $3,$6,$2 sec34: or $6,$2,$4 subu $6,$3,$4 lbu $6,15($0) nor $3,$6,$2 sec35: sltu $6,$4,$0 andi $6,$6,47586 nop nor $2,$6,$2 sec36: sltu $6,$3,$1 andi $6,$1,30358 subu $6,$2,$4 nor $4,$6,$2 sec37: xor $6,$5,$0 slti $6,$4,27289 andi $6,$3,9730 nor $3,$6,$2 sec38: and $6,$2,$1 addiu $6,$1,14069 mflo $6 nor $5,$6,$2 sec39: addu $6,$2,$5 lui $6,23414 lw $6,0($0) nor $2,$6,$2 sec40: nor $6,$2,$3 mfhi $6 nop nor $4,$6,$2 sec41: sltu $6,$4,$5 mfhi $6 sltu $6,$4,$3 nor $4,$6,$2 sec42: slt $6,$5,$5 mfhi $6 ori $6,$5,8709 nor $3,$6,$2 sec43: or $6,$1,$4 mflo $6 mflo $6 nor $3,$6,$2 sec44: or $6,$6,$1 mfhi $6 lh $6,4($0) nor $3,$6,$2 sec45: xor $6,$5,$5 lbu $6,9($0) nop nor $4,$6,$2 sec46: xor $6,$0,$1 lw $6,8($0) xor $6,$3,$3 nor $3,$6,$2 sec47: xor $6,$2,$1 lw $6,8($0) sltiu $6,$2,17910 nor $5,$6,$2 sec48: xor $6,$1,$4 lb $6,4($0) mflo $6 nor $3,$6,$2 sec49: or $6,$2,$1 lhu $6,2($0) lh $6,0($0) nor $2,$6,$2 sec50: addiu $6,$1,-3063 nop nop nor $5,$6,$2 sec51: xori $6,$4,13961 nop subu $6,$4,$4 nor $0,$6,$2 sec52: addiu $6,$3,-6577 nop xori $6,$6,55499 nor $3,$6,$2 sec53: sltiu $6,$2,15481 nop mfhi $6 nor $3,$6,$2 sec54: addiu $6,$2,-5923 nop lhu $6,14($0) nor $3,$6,$2 sec55: addiu $6,$4,9741 subu $6,$2,$5 nop nor $2,$6,$2 sec56: andi $6,$3,37437 sltu $6,$2,$2 xor $6,$4,$3 nor $3,$6,$2 sec57: sltiu $6,$3,31940 and $6,$4,$2 addiu $6,$2,10915 nor $3,$6,$2 sec58: xori $6,$2,30676 sltu $6,$6,$4 mflo $6 nor $3,$6,$2 sec59: andi $6,$6,45098 or $6,$1,$3 lhu $6,4($0) nor $5,$6,$2 sec60: xori $6,$2,53931 slti $6,$5,18643 nop nor $2,$6,$2 sec61: andi $6,$3,37906 ori $6,$2,21574 or $6,$2,$2 nor $1,$6,$2 sec62: ori $6,$3,36699 addiu $6,$4,10537 slti $6,$4,4292 nor $0,$6,$2 sec63: andi $6,$4,38859 addiu $6,$5,-4359 mflo $6 nor $4,$6,$2 sec64: andi $6,$3,59461 andi $6,$3,23804 lw $6,12($0) nor $4,$6,$2 sec65: ori $6,$1,38249 mfhi $6 nop nor $4,$6,$2 sec66: andi $6,$4,59399 mflo $6 xor $6,$4,$2 nor $4,$6,$2 sec67: addiu $6,$5,-13289 mflo $6 sltiu $6,$3,-13811 nor $0,$6,$2 sec68: andi $6,$2,47213 mfhi $6 mfhi $6 nor $5,$6,$2 sec69: andi $6,$4,11909 mfhi $6 lbu $6,14($0) nor $6,$6,$2 sec70: andi $6,$2,24960 lw $6,4($0) nop nor $1,$6,$2 sec71: lui $6,14855 lh $6,2($0) addu $6,$5,$3 nor $1,$6,$2 sec72: xori $6,$3,63494 lh $6,0($0) ori $6,$4,45756 nor $3,$6,$2 sec73: andi $6,$4,32462 lh $6,16($0) mflo $6 nor $1,$6,$2 sec74: ori $6,$1,57300 lbu $6,7($0) lh $6,10($0) nor $2,$6,$2 sec75: mflo $6 nop nop nor $3,$6,$2 sec76: mfhi $6 nop and $6,$2,$2 nor $4,$6,$2 sec77: mfhi $6 nop slti $6,$1,-24940 nor $3,$6,$2 sec78: mflo $6 nop mflo $6 nor $5,$6,$2 sec79: mflo $6 nop lb $6,3($0) nor $1,$6,$2 sec80: mflo $6 nor $6,$1,$1 nop nor $2,$6,$2 sec81: mflo $6 or $6,$6,$5 slt $6,$0,$2 nor $4,$6,$2 sec82: mfhi $6 or $6,$6,$5 ori $6,$4,46791 nor $3,$6,$2 sec83: mflo $6 sltu $6,$4,$5 mflo $6 nor $1,$6,$2 sec84: mflo $6 sltu $6,$4,$1 lhu $6,10($0) nor $4,$6,$2 sec85: mflo $6 slti $6,$3,-32074 nop nor $1,$6,$2 sec86: mflo $6 ori $6,$4,24245 or $6,$4,$1 nor $2,$6,$2 sec87: mfhi $6 slti $6,$1,12894 addiu $6,$3,29529 nor $2,$6,$2 sec88: mflo $6 xori $6,$1,22508 mfhi $6 nor $4,$6,$2 sec89: mflo $6 lui $6,53984 lhu $6,14($0) nor $1,$6,$2 sec90: mflo $6 mfhi $6 nop nor $0,$6,$2 sec91: mflo $6 mfhi $6 or $6,$3,$3 nor $6,$6,$2 sec92: mfhi $6 mfhi $6 addiu $6,$1,-19713 nor $1,$6,$2 sec93: mflo $6 mfhi $6 mfhi $6 nor $1,$6,$2 sec94: mflo $6 mflo $6 lhu $6,6($0) nor $5,$6,$2 sec95: mfhi $6 lw $6,4($0) nop nor $0,$6,$2 sec96: mflo $6 lbu $6,14($0) xor $6,$3,$5 nor $1,$6,$2 sec97: mflo $6 lb $6,15($0) sltiu $6,$3,-8620 nor $2,$6,$2 sec98: mfhi $6 lh $6,6($0) mflo $6 nor $1,$6,$2 sec99: mfhi $6 lb $6,5($0) lb $6,8($0) nor $4,$6,$2 sec100: lw $6,0($0) nop nop nor $0,$6,$2 sec101: lh $6,4($0) nop xor $6,$2,$3 nor $2,$6,$2 sec102: lbu $6,9($0) nop sltiu $6,$2,-14054 nor $3,$6,$2 sec103: lbu $6,2($0) nop mflo $6 nor $3,$6,$2 sec104: lb $6,10($0) nop lhu $6,4($0) nor $6,$6,$2 sec105: lw $6,0($0) xor $6,$4,$5 nop nor $1,$6,$2 sec106: lbu $6,15($0) slt $6,$3,$2 sltu $6,$0,$4 nor $3,$6,$2 sec107: lh $6,16($0) sltu $6,$4,$3 addiu $6,$3,-17874 nor $3,$6,$2 sec108: lw $6,4($0) sltu $6,$3,$6 mfhi $6 nor $1,$6,$2 sec109: lh $6,12($0) or $6,$6,$3 lhu $6,6($0) nor $6,$6,$2 sec110: lh $6,4($0) slti $6,$5,-18402 nop nor $1,$6,$2 sec111: lhu $6,14($0) ori $6,$0,19046 or $6,$3,$3 nor $5,$6,$2 sec112: lh $6,0($0) addiu $6,$4,11837 xori $6,$2,24359 nor $2,$6,$2 sec113: lh $6,6($0) xori $6,$2,41686 mflo $6 nor $3,$6,$2 sec114: lb $6,5($0) xori $6,$3,51780 lw $6,16($0) nor $3,$6,$2 sec115: lh $6,10($0) mfhi $6 nop nor $3,$6,$2 sec116: lh $6,10($0) mflo $6 subu $6,$1,$2 nor $4,$6,$2 sec117: lw $6,0($0) mfhi $6 ori $6,$3,50497 nor $0,$6,$2 sec118: lh $6,12($0) mflo $6 mflo $6 nor $3,$6,$2 sec119: lhu $6,8($0) mfhi $6 lbu $6,9($0) nor $0,$6,$2 sec120: lbu $6,6($0) lb $6,16($0) nop nor $5,$6,$2 sec121: lb $6,12($0) lh $6,2($0) slt $6,$1,$3 nor $5,$6,$2 sec122: lb $6,11($0) lbu $6,15($0) xori $6,$1,20433 nor $2,$6,$2 sec123: lw $6,0($0) lbu $6,0($0) mfhi $6 nor $2,$6,$2 sec124: lw $6,12($0) lhu $6,12($0) lh $6,14($0) nor $5,$6,$2
// Copyright 2020 The Crashpad Authors. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #include "snapshot/ios/thread_snapshot_ios.h" #include "base/mac/mach_logging.h" #include "snapshot/mac/cpu_context_mac.h" namespace { #if defined(ARCH_CPU_X86_64) const thread_state_flavor_t kThreadStateFlavor = x86_THREAD_STATE64; const thread_state_flavor_t kFloatStateFlavor = x86_FLOAT_STATE64; const thread_state_flavor_t kDebugStateFlavor = x86_DEBUG_STATE64; #elif defined(ARCH_CPU_ARM64) const thread_state_flavor_t kThreadStateFlavor = ARM_THREAD_STATE64; const thread_state_flavor_t kFloatStateFlavor = ARM_NEON_STATE64; const thread_state_flavor_t kDebugStateFlavor = ARM_DEBUG_STATE64; #endif kern_return_t MachVMRegionRecurseDeepest(task_t task, vm_address_t* address, vm_size_t* size, natural_t* depth, vm_prot_t* protection, unsigned int* user_tag) { vm_region_submap_short_info_64 submap_info; mach_msg_type_number_t count = VM_REGION_SUBMAP_SHORT_INFO_COUNT_64; while (true) { kern_return_t kr = vm_region_recurse_64( task, address, size, depth, reinterpret_cast<vm_region_recurse_info_t>(&submap_info), &count); if (kr != KERN_SUCCESS) { return kr; } if (!submap_info.is_submap) { *protection = submap_info.protection; *user_tag = submap_info.user_tag; return KERN_SUCCESS; } ++*depth; } } //! \brief Adjusts the region for the red zone, if the ABI requires one. //! //! This method performs red zone calculation for CalculateStackRegion(). Its //! parameters are local variables used within that method, and may be //! modified as needed. //! //! Where a red zone is required, the region of memory captured for a thread’s //! stack will be extended to include the red zone below the stack pointer, //! provided that such memory is mapped, readable, and has the correct user //! tag value. If these conditions cannot be met fully, as much of the red //! zone will be captured as is possible while meeting these conditions. //! //! \param[in,out] start_address The base address of the region to begin //! capturing stack memory from. On entry, \a start_address is the stack //! pointer. On return, \a start_address may be decreased to encompass a //! red zone. //! \param[in,out] region_base The base address of the region that contains //! stack memory. This is distinct from \a start_address in that \a //! region_base will be page-aligned. On entry, \a region_base is the //! base address of a region that contains \a start_address. On return, //! if \a start_address is decremented and is outside of the region //! originally described by \a region_base, \a region_base will also be //! decremented appropriately. //! \param[in,out] region_size The size of the region that contains stack //! memory. This region begins at \a region_base. On return, if \a //! region_base is decremented, \a region_size will be incremented //! appropriately. //! \param[in] user_tag The Mach VM system’s user tag for the region described //! by the initial values of \a region_base and \a region_size. The red //! zone will only be allowed to extend out of the region described by //! these initial values if the user tag is appropriate for stack memory //! and the expanded region has the same user tag value. void LocateRedZone(vm_address_t* const start_address, vm_address_t* const region_base, vm_address_t* const region_size, const unsigned int user_tag) { // x86_64 has a red zone. See AMD64 ABI 0.99.8, // https://raw.githubusercontent.com/wiki/hjl-tools/x86-psABI/x86-64-psABI-r252.pdf#page=19, // section 3.2.2, “The Stack Frame”. // So does ARM64, // https://developer.apple.com/library/archive/documentation/Xcode/Conceptual/iPhoneOSABIReference/Articles/ARM64FunctionCallingConventions.html // section "Red Zone". constexpr vm_size_t kRedZoneSize = 128; vm_address_t red_zone_base = *start_address >= kRedZoneSize ? *start_address - kRedZoneSize : 0; bool red_zone_ok = false; if (red_zone_base >= *region_base) { // The red zone is within the region already discovered. red_zone_ok = true; } else if (red_zone_base < *region_base && user_tag == VM_MEMORY_STACK) { // Probe to see if there’s a region immediately below the one already // discovered. vm_address_t red_zone_region_base = red_zone_base; vm_size_t red_zone_region_size; natural_t red_zone_depth = 0; vm_prot_t red_zone_protection; unsigned int red_zone_user_tag; kern_return_t kr = MachVMRegionRecurseDeepest(mach_task_self(), &red_zone_region_base, &red_zone_region_size, &red_zone_depth, &red_zone_protection, &red_zone_user_tag); if (kr != KERN_SUCCESS) { MACH_LOG(INFO, kr) << "vm_region_recurse"; *start_address = *region_base; } else if (red_zone_region_base + red_zone_region_size == *region_base && (red_zone_protection & VM_PROT_READ) != 0 && red_zone_user_tag == user_tag) { // The region containing the red zone is immediately below the region // already found, it’s readable (not the guard region), and it has the // same user tag as the region already found, so merge them. red_zone_ok = true; *region_base -= red_zone_region_size; *region_size += red_zone_region_size; } } if (red_zone_ok) { // Begin capturing from the base of the red zone (but not the entire // region that encompasses the red zone). *start_address = red_zone_base; } else { // The red zone would go lower into another region in memory, but no // region was found. Memory can only be captured to an address as low as // the base address of the region already found. *start_address = *region_base; } } //! \brief Calculates the base address and size of the region used as a //! thread’s stack. //! //! The region returned by this method may be formed by merging multiple //! adjacent regions in a process’ memory map if appropriate. The base address //! of the returned region may be lower than the \a stack_pointer passed in //! when the ABI mandates a red zone below the stack pointer. //! //! \param[in] stack_pointer The stack pointer, referring to the top (lowest //! address) of a thread’s stack. //! \param[out] stack_region_size The size of the memory region used as the //! thread’s stack. //! //! \return The base address (lowest address) of the memory region used as the //! thread’s stack. vm_address_t CalculateStackRegion(vm_address_t stack_pointer, vm_size_t* stack_region_size) { // For pthreads, it may be possible to compute the stack region based on the // internal _pthread::stackaddr and _pthread::stacksize. The _pthread struct // for a thread can be located at TSD slot 0, or the known offsets of // stackaddr and stacksize from the TSD area could be used. vm_address_t region_base = stack_pointer; vm_size_t region_size; natural_t depth = 0; vm_prot_t protection; unsigned int user_tag; kern_return_t kr = MachVMRegionRecurseDeepest(mach_task_self(), &region_base, &region_size, &depth, &protection, &user_tag); if (kr != KERN_SUCCESS) { MACH_LOG(INFO, kr) << "mach_vm_region_recurse"; *stack_region_size = 0; return 0; } if (region_base > stack_pointer) { // There’s nothing mapped at the stack pointer’s address. Something may have // trashed the stack pointer. Note that this shouldn’t happen for a normal // stack guard region violation because the guard region is mapped but has // VM_PROT_NONE protection. *stack_region_size = 0; return 0; } vm_address_t start_address = stack_pointer; if ((protection & VM_PROT_READ) == 0) { // If the region isn’t readable, the stack pointer probably points to the // guard region. Don’t include it as part of the stack, and don’t include // anything at any lower memory address. The code below may still possibly // find the real stack region at a memory address higher than this region. start_address = region_base + region_size; } else { // If the ABI requires a red zone, adjust the region to include it if // possible. LocateRedZone(&start_address, &region_base, &region_size, user_tag); // Regardless of whether the ABI requires a red zone, capture up to // kExtraCaptureSize additional bytes of stack, but only if present in the // region that was already found. constexpr vm_size_t kExtraCaptureSize = 128; start_address = std::max(start_address >= kExtraCaptureSize ? start_address - kExtraCaptureSize : start_address, region_base); // Align start_address to a 16-byte boundary, which can help readers by // ensuring that data is aligned properly. This could page-align instead, // but that might be wasteful. constexpr vm_size_t kDesiredAlignment = 16; start_address &= ~(kDesiredAlignment - 1); DCHECK_GE(start_address, region_base); } region_size -= (start_address - region_base); region_base = start_address; vm_size_t total_region_size = region_size; // The stack region may have gotten split up into multiple abutting regions. // Try to coalesce them. This frequently happens for the main thread’s stack // when setrlimit(RLIMIT_STACK, …) is called. It may also happen if a region // is split up due to an mprotect() or vm_protect() call. // // Stack regions created by the kernel and the pthreads library will be marked // with the VM_MEMORY_STACK user tag. Scanning for multiple adjacent regions // with the same tag should find an entire stack region. Checking that the // protection on individual regions is not VM_PROT_NONE should guarantee that // this algorithm doesn’t collect map entries belonging to another thread’s // stack: well-behaved stacks (such as those created by the kernel and the // pthreads library) have VM_PROT_NONE guard regions at their low-address // ends. // // Other stack regions may not be so well-behaved and thus if user_tag is not // VM_MEMORY_STACK, the single region that was found is used as-is without // trying to merge it with other adjacent regions. if (user_tag == VM_MEMORY_STACK) { vm_address_t try_address = region_base; vm_address_t original_try_address; while (try_address += region_size, original_try_address = try_address, (kr = MachVMRegionRecurseDeepest(mach_task_self(), &try_address, &region_size, &depth, &protection, &user_tag) == KERN_SUCCESS) && try_address == original_try_address && (protection & VM_PROT_READ) != 0 && user_tag == VM_MEMORY_STACK) { total_region_size += region_size; } if (kr != KERN_SUCCESS && kr != KERN_INVALID_ADDRESS) { // Tolerate KERN_INVALID_ADDRESS because it will be returned when there // are no more regions in the map at or above the specified |try_address|. MACH_LOG(INFO, kr) << "vm_region_recurse"; } } *stack_region_size = total_region_size; return region_base; } } // namespace namespace crashpad { namespace internal { ThreadSnapshotIOS::ThreadSnapshotIOS() : ThreadSnapshot(), context_(), stack_(), thread_id_(0), thread_specific_data_address_(0), suspend_count_(0), priority_(0), initialized_() {} ThreadSnapshotIOS::~ThreadSnapshotIOS() {} // static thread_act_array_t ThreadSnapshotIOS::GetThreads( mach_msg_type_number_t* count) { thread_act_array_t threads; kern_return_t kr = task_threads(mach_task_self(), &threads, count); if (kr != KERN_SUCCESS) { MACH_LOG(WARNING, kr) << "task_threads"; } return threads; } bool ThreadSnapshotIOS::Initialize(thread_t thread) { INITIALIZATION_STATE_SET_INITIALIZING(initialized_); // TODO(justincohen): Move the following thread_get_state, thread_get_info, // thread_policy_get and CalculateStackRegion to the serialize-on-read // section. thread_basic_info basic_info; thread_precedence_policy precedence; vm_size_t stack_region_size; vm_address_t stack_region_address; #if defined(ARCH_CPU_X86_64) x86_thread_state64_t thread_state; x86_float_state64_t float_state; x86_debug_state64_t debug_state; mach_msg_type_number_t thread_state_count = x86_THREAD_STATE64_COUNT; mach_msg_type_number_t float_state_count = x86_FLOAT_STATE64_COUNT; mach_msg_type_number_t debug_state_count = x86_DEBUG_STATE64_COUNT; #elif defined(ARCH_CPU_ARM64) arm_thread_state64_t thread_state; arm_neon_state64_t float_state; arm_debug_state64_t debug_state; mach_msg_type_number_t thread_state_count = ARM_THREAD_STATE64_COUNT; mach_msg_type_number_t float_state_count = ARM_NEON_STATE64_COUNT; mach_msg_type_number_t debug_state_count = ARM_DEBUG_STATE64_COUNT; #endif kern_return_t kr = thread_get_state(thread, kThreadStateFlavor, reinterpret_cast<thread_state_t>(&thread_state), &thread_state_count); if (kr != KERN_SUCCESS) { MACH_LOG(ERROR, kr) << "thread_get_state(" << kThreadStateFlavor << ")"; } kr = thread_get_state(thread, kFloatStateFlavor, reinterpret_cast<thread_state_t>(&float_state), &float_state_count); if (kr != KERN_SUCCESS) { MACH_LOG(ERROR, kr) << "thread_get_state(" << kFloatStateFlavor << ")"; } kr = thread_get_state(thread, kDebugStateFlavor, reinterpret_cast<thread_state_t>(&debug_state), &debug_state_count); if (kr != KERN_SUCCESS) { MACH_LOG(ERROR, kr) << "thread_get_state(" << kDebugStateFlavor << ")"; } mach_msg_type_number_t count = THREAD_BASIC_INFO_COUNT; kr = thread_info(thread, THREAD_BASIC_INFO, reinterpret_cast<thread_info_t>(&basic_info), &count); if (kr != KERN_SUCCESS) { MACH_LOG(WARNING, kr) << "thread_info(THREAD_BASIC_INFO)"; } thread_identifier_info identifier_info; count = THREAD_IDENTIFIER_INFO_COUNT; kr = thread_info(thread, THREAD_IDENTIFIER_INFO, reinterpret_cast<thread_info_t>(&identifier_info), &count); if (kr != KERN_SUCCESS) { MACH_LOG(WARNING, kr) << "thread_info(THREAD_IDENTIFIER_INFO)"; } count = THREAD_PRECEDENCE_POLICY_COUNT; boolean_t get_default = FALSE; kr = thread_policy_get(thread, THREAD_PRECEDENCE_POLICY, reinterpret_cast<thread_policy_t>(&precedence), &count, &get_default); if (kr != KERN_SUCCESS) { MACH_LOG(ERROR, kr) << "thread_policy_get"; } #if defined(ARCH_CPU_X86_64) vm_address_t stack_pointer = thread_state.__rsp; #elif defined(ARCH_CPU_ARM64) vm_address_t stack_pointer = arm_thread_state64_get_sp(thread_state); #endif stack_region_address = CalculateStackRegion(stack_pointer, &stack_region_size); // TODO(justincohen): Assume the following will fill in snapshot data from // a deserialized object. thread_id_ = identifier_info.thread_id; suspend_count_ = basic_info.suspend_count; priority_ = precedence.importance; // thread_identifier_info::thread_handle contains the base of the // thread-specific data area, which on x86 and x86_64 is the thread’s base // address of the %gs segment. 10.9.2 xnu-2422.90.20/osfmk/kern/thread.c // thread_info_internal() gets the value from // machine_thread::cthread_self, which is the same value used to set the // %gs base in xnu-2422.90.20/osfmk/i386/pcb_native.c // act_machine_switch_pcb(). // // On ARM64 10.15.0 xnu-6153.11.26/osfmk/kern/thread.c, it sets // thread_identifier_info_t::thread_handle to // thread->machine.cthread_self, which is set to tsd_base in // osfmk/arm64/pcb.c. thread_specific_data_address_ = identifier_info.thread_handle; stack_.Initialize(stack_region_address, stack_region_size); #if defined(ARCH_CPU_X86_64) context_.architecture = kCPUArchitectureX86_64; context_.x86_64 = &context_x86_64_; InitializeCPUContextX86_64(&context_x86_64_, THREAD_STATE_NONE, nullptr, 0, &thread_state, &float_state, &debug_state); #elif defined(ARCH_CPU_ARM64) context_.architecture = kCPUArchitectureARM64; context_.arm64 = &context_arm64_; InitializeCPUContextARM64(&context_arm64_, THREAD_STATE_NONE, nullptr, 0, &thread_state, &float_state, &debug_state); #else #error Port to your CPU architecture #endif INITIALIZATION_STATE_SET_VALID(initialized_); return true; } const CPUContext* ThreadSnapshotIOS::Context() const { INITIALIZATION_STATE_DCHECK_VALID(initialized_); return &context_; } const MemorySnapshot* ThreadSnapshotIOS::Stack() const { INITIALIZATION_STATE_DCHECK_VALID(initialized_); return &stack_; } uint64_t ThreadSnapshotIOS::ThreadID() const { INITIALIZATION_STATE_DCHECK_VALID(initialized_); return thread_id_; } int ThreadSnapshotIOS::SuspendCount() const { INITIALIZATION_STATE_DCHECK_VALID(initialized_); return suspend_count_; } int ThreadSnapshotIOS::Priority() const { INITIALIZATION_STATE_DCHECK_VALID(initialized_); return priority_; } uint64_t ThreadSnapshotIOS::ThreadSpecificDataAddress() const { INITIALIZATION_STATE_DCHECK_VALID(initialized_); return thread_specific_data_address_; } std::vector<const MemorySnapshot*> ThreadSnapshotIOS::ExtraMemory() const { return std::vector<const MemorySnapshot*>(); } } // namespace internal } // namespace crashpad
;------------------------------------------------------------------------------ ; ; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR> ; SPDX-License-Identifier: BSD-2-Clause-Patent ; ; Module Name: ; ; SetMem32.Asm ; ; Abstract: ; ; SetMem32 function ; ; Notes: ; ;------------------------------------------------------------------------------ SECTION .text ;------------------------------------------------------------------------------ ; VOID * ; InternalMemSetMem32 ( ; IN VOID *Buffer, ; IN UINTN Count, ; IN UINT32 Value ; ) ;------------------------------------------------------------------------------ global ASM_PFX(InternalMemSetMem32) ASM_PFX(InternalMemSetMem32): push edi mov eax, [esp + 16] mov edi, [esp + 8] mov ecx, [esp + 12] rep stosd mov eax, [esp + 8] pop edi ret
#include <gtest/gtest.h> //Run with "catkin_make run_tests_plane_calibration" int main(int argc, char **argv) { testing::InitGoogleTest(&argc, argv); srand((int)time(0)); return RUN_ALL_TESTS(); }
; A091036: Sixth column (k=7) of array A090438 ((4,2)-Stirling2) divided by 48=4!*2. ; Submitted by Christian Krause ; 1,840,498960,285405120,173145772800,115598414131200,86165279456256000,72034173625430016000,67538393730337001472000,70856069211827240140800000,82901600977837870964736000000 mov $1,$0 add $0,1 add $1,1 seq $1,91035 ; Fifth column (k=6) of array A090438 ((4,2)-Stirling2). mul $1,$0 mov $0,$1 div $0,840
; STM8EF for STM8S (Value line and Access Line devices) ; ; This is derived work based on ; http://www.forth.org/svfig/kk/07-2010.html ; ; Please refer to LICENSE.md for more information. ; ;-------------------------------------------------------- ; Original author, and copyright: ; STM8EF, Version 2.1, 13jul10cht ; Copyright (c) 2000 ; Dr. C. H. Ting ; 156 14th Avenue ; San Mateo, CA 94402 ; (650) 571-7639 ; ; Original main description: ; FORTH Virtual Machine: ; Subroutine threaded model ; SP Return stack pointer ; X Data stack pointer ; A,Y Scratch pad registers ; ;-------------------------------------------------------- ; The latest version of this code is available at ; https://github.com/TG9541/stm8ef ; ; ; Docs for the SDCC integrated assembler are scarce, thus ; SDCC was used to write the skeleton for this file. ; However, the code in this file isn't SDCC code. ;-------------------------------------------------------- ; File Created by SDCC : free open source ANSI-C Compiler ; Version 3.6.0 #9615 (Linux) ;-------------------------------------------------------- .module forth .optsdcc -mstm8 ;-------------------------------------------------------- ; Public variables in this module ;-------------------------------------------------------- .globl _TRAP_Handler .globl _forth ;-------------------------------------------------------- ; ram data ;-------------------------------------------------------- .area DATA ;-------------------------------------------------------- ; ram data ;-------------------------------------------------------- .area INITIALIZED ;-------------------------------------------------------- ; absolute external ram data ;-------------------------------------------------------- .area DABS (ABS) ;-------------------------------------------------------- ; global & static initialisations ;-------------------------------------------------------- .area HOME .area GSINIT .area GSFINAL .area GSINIT ;-------------------------------------------------------- ; Home ;-------------------------------------------------------- .area HOME .area HOME ;-------------------------------------------------------- ; code ;-------------------------------------------------------- .area CODE ;************************************ ;****** 1) General Constants ****** ;************************************ TRUEE = 0xFFFF ; true flag COMPO = 0x40 ; "COMPO" lexicon compile only bit IMEDD = 0x80 ; "IMEDD" lexicon immediate bit MASKK = 0x1F7F ; "MASKK" lexicon bit mask TIBLENGTH = 80 ; size of TIB (starting at TIBOFFS) PADOFFS = 80 ; "PADOFFS" offset text buffer above dictionary CELLL = 2 ; size of a cell BASEE = 10 ; default radix BKSPP = 8 ; backspace LF = 10 ; line feed PACE = 11 ; pace character for host handshake (ASCII VT) CRR = 13 ; carriage return ERR = 27 ; error escape BLNK = 32 ; blank char TIC = 39 ; tick EXIT_OPC = 0x81 ; RET opcode DOLIT_OPC = 0x83 ; TRAP opcode as DOLIT CALLR_OPC = 0xAD ; CALLR opcode for relative addressing BRAN_OPC = 0xCC ; JP opcode CALL_OPC = 0xCD ; CALL opcode ; Chip type (set of peripheral addresses and features) STM8S_LOD = 103 ; STM8S Low Density STM8S_MED = 105 ; STM8S Medium Density STM8S_HID = 207 ; STM8S High Density STM8L_LOD = 051 ; STM8L Low Density, RM0031 family STM8L_101 = 101 ; STM8L Low Density, RM0013 family STM8L_MHD = 152 ; STM8L Medium and High Density ; STM8 family flags STM8S = 0 ; FAMILY: STM8S device STM8L = 1 ; FAMILY: STM8L device ; legacy chip type (deprecated - preferably use the chip type constants) STM8L101F3 = STM8L_101 ; L core, 8K flash incl EEPROM, 1.5K RAM, UART1 STM8L051F3 = STM8L_LOD ; L core, 8K flash, 1K RAM, 256 EEPROM, UART1 STM8L152C6 = STM8L_MHD ; L core, 32K flash, 2K RAM, 1K EEPROM, UART1 STM8L152R8 = STM8L_MHD ; L core, 64K flash, 4K RAM, 2K EEPROM, UART1 STM8S003F3 = STM8S_LOD ; 8K flash, 1K RAM, 128 EEPROM, UART1 STM8S103F3 = STM8S_LOD ; like STM8S003F3, 640 EEPROM STM8S105K4 = STM8S_MED ; 16K/32K flash, 2K RAM, 1K EEPROM, UART2 STM8S207RB = STM8S_HID ; 32K+96K flash, 6K RAM, 2K EEPROM, UART1 or UART2 DEFOSCFREQ = 16000 ; default oscillator frequency in kHz (HSI) ;******************************************** ;****** 2) Device hardware addresses ****** ;******************************************** ;****** STM8 memory addresses ****** RAMBASE = 0x0000 ; STM8 RAM start ; STM8 device specific include (provided by file in board folder) ; sets "TARGET" and memory layout .include "target.inc" ; STM8 Flash Block Size (depends on "TARGET") .ifeq (TARGET - STM8S_LOD) * (TARGET - STM8L_101) * (TARGET - STM8L_LOD) PAGESIZE = 0x40 ; "PAGESIZE" STM8 Low Density: 64 byte page size .else PAGESIZE = 0x80 ; "PAGESIZE" STM8 M/H Density: 128 byte page size .endif ; STM8 family register addresses (depends on "TARGET") .ifeq (TARGET - STM8S_LOD) * (TARGET - STM8S_MED) * (TARGET - STM8S_HID) FAMILY = STM8S .include "stm8device.inc" .endif .ifeq (TARGET - STM8L_101) * (TARGET - STM8L_LOD) * (TARGET - STM8L_MHD) FAMILY = STM8L .include "stm8ldevice.inc" .endif ;********************************** ;****** 3) Global defaults ****** ;********************************** ; Note: add defaults for new features here ; and configure them in globconf.inc .include "defconf.inc" ;******************************************** ;****** 4) Device dependent features ****** ;******************************************** ; Define memory location for device dependent features here .include "globconf.inc" .include "linkopts.inc" ; console configuration: check if TX simulation has priority over UART .ifge HAS_TXSIM - HAS_TXUART .ifeq PNTX-PNRX CONSOLE_HALF_DUPLEX = 1 ; single wire RX/TX simulation is half duplex .else CONSOLE_HALF_DUPLEX = 0 ; RX/TX simulation supports full duplex .endif .else CONSOLE_HALF_DUPLEX = HALF_DUPLEX ; use hardware UART settings .endif OSCFREQ = DEFOSCFREQ ; "OSCFREQ" oscillator frequency in kHz CRAMLEN = FORTHRAM ; "CRAMLEN" RAM starting from 0 not used by Forth ;************************************** ;****** 5) Board Driver Memory ****** ;************************************** ; Memory for board related code, e.g. interrupt routines RAMPOOL = FORTHRAM ; RAM for variables (growing up) .macro RamByte varname varname = RAMPOOL RAMPOOL = RAMPOOL + 1 .endm .macro RamWord varname varname = RAMPOOL RAMPOOL = RAMPOOL + 2 .endm .macro RamBlck varname, size varname = RAMPOOL RAMPOOL = RAMPOOL + size .endm ;************************************************** ;****** 6) General User & System Variables ****** ;************************************************** ; ****** Indirect variables for code in NVM ***** .ifne HAS_CPNVM ISPPSIZE = 16 ; Size of data stack for interrupt tasks .else ISPPSIZE = 0 ; no interrupt tasks without NVM .endif UPP = UPPLOC ; "C_UPP" constant offset user area PADBG = UPPLOC ; PAD in background task growing down from here CTOP = CTOPLOC ; dictionary start, growing up ; note: PAD is inbetween CTOP and SPP SPP = ISPP-ISPPSIZE ; "SPP" data stack, growing down (with SPP-1 first) ISPP = SPPLOC-BSPPSIZE ; "ISPP" Interrupt data stack, growing down BSPP = SPPLOC ; "BSPP" Background data stack, growing down TIBB = SPPLOC ; "TIB" Term. Input Buf. TIBLENGTH between SPPLOC and RPP RPP = RPPLOC ; "RPP" constant addr. return stack, growing down ; Core variables (same order as 'BOOT initializer block) USRRAMINIT = USREMIT USREMIT = UPP+0 ; "'EMIT" execution vector of EMIT USRQKEY = UPP+2 ; "'?KEY" execution vector of QKEY USRBASE = UPP+4 ; "BASE" radix base for numeric I/O ; USR_6 = UPP+6 ; free USRPROMPT = UPP+8 ; "'PROMPT" point to prompt word (default .OK) USRCP = UPP+10 ; "CP" point to top of dictionary USRLAST = UPP+12 ; "LAST" currently last name in dictionary NVMCP = UPP+14 ; point to top of dictionary in Non Volatile Memory ; Null initialized core variables (growing down) USRCTOP = UPP+16 ; "CTOP" point to the start of RAM dictionary USRVAR = UPP+18 ; "VAR" point to next free USR RAM location NVMCONTEXT = UPP+20 ; point to top of dictionary in Non Volatile Memory USRCONTEXT = UPP+22 ; "CONTEXT" start vocabulary search USREVAL = UPP+24 ; "'EVAL" execution vector of EVAL USRNTIB = UPP+26 ; "#TIB" count in terminal input buffer USR_IN = UPP+28 ; ">IN" hold parsing pointer USRBUFFER = UPP+30 ; "BUFFER" address, defaults to TIBB ; More core variables in zero page (instead of assigning fixed addresses) RamWord USRHLD ; "HLD" hold a pointer of output string RamWord YTEMP ; extra working register for core words RamWord USRIDLE ; "'IDLE" idle routine in KEY ;*********************** ;****** 7) Code ****** ;*********************** ; ============================================== ; Forth header macros ; Macro support in SDCC's assembler "SDAS" has some quirks: ; * strings with "," and ";" aren't allowed in parameters ; * after include files, the first macro call may fail ; unless it's preceded by unconditional code ; ============================================== LINK = 0 ; .macro HEADER Label wName .ifeq UNLINK_'Label .dw LINK LINK = . .db (102$ - 101$) 101$: .ascii wName 102$: .endif ;'Label: .endm .macro HEADFLG Label wName wFlag .ifeq UNLINK_'Label .dw LINK LINK = . .db ((102$ - 101$) + wFlag) 101$: .ascii wName 102$: .endif ;'Label: .endm ; ============================================== ; Low level code ; ============================================== ; TRAP handler for DOLIT ; Push the inline literal following the TRAP instruction _TRAP_Handler: .ifeq USE_CALLDOLIT DECW X DECW X LDW (3,SP),X ; XH,XL EXGW X,Y LDW X,(8,SP) ; PC MSB/LSB LDW X,(X) LDW (Y),X LDW (5,SP),X ; YH,YL LDW X,(8,SP) INCW X INCW X LDW (8,SP),X IRET ; Macros for inline literals using the TRAP approach .macro DoLitC c TRAP .dw c .endm .macro DoLitW w TRAP .dw w .endm .else ; Macros for inline literals using CALL DOLIT / CALL DOLITC .macro DoLitC c call DOLITC .db c .endm .macro DoLitW w call DOLIT .dw w .endm .endif ; Macros for compiling inline literals using CALL COMPILIT .macro ComLit w call COMPILIT .dw w .endm .macro ComLitR w callr COMPILIT .dw w .endm ; ============================================== ; Includes for board support code ; Board I/O initialization and E/E mapping code ; Hardware dependent words, e.g. BKEY, OUT! .include "boardcore.inc" ; ADC routines depending on STM8 family .include "stm8_adc.inc" ; Generic board I/O: 7S-LED rendering, board key mapping .include "board_io.inc" ; Simulate serial interface code .include "sser.inc" ; Background Task: context switch with wakeup unit or timer .include "bgtask.inc" ; ============================================== ; Configuation table with shadow data for RESET ; 'BOOT ( -- a ) ; The application startup vector and NVM USR setting array HEADER TBOOT "'BOOT" TBOOT: CALL DOVAR UBOOT = . .dw HI ; start-up code (can be changed with 'BOOT !) ; COLD initialization data (can be changed with <offset> 'BOOT + !) UZERO = . .ifge (HAS_TXUART-HAS_TXSIM) .dw TXSTOR ; TX! as EMIT vector .dw QRX ; ?KEY as ?KEY vector .else .dw TXPSTOR ; TXP! as EMIT vector if (HAS_TXSIM > HAS_TXUART) .dw QRXP ; ?RXP as ?KEY vector .endif .dw BASEE ; BASE .dw 0 ; (vacant) .dw DOTOK ; 'PROMPT COLDCTOP = . .dw CTOP ; CP in RAM COLDCONTEXT = . .dw LASTN ; USRLAST .ifne HAS_CPNVM COLDNVMCP = . .dw END_SDCC_FLASH ; CP in NVM ULAST = . ; Shadow initialization data for RESET (can be changed with PERSIST) UDEFAULTS = . .dw HI ; 'BOOT .ifge (HAS_TXUART-HAS_TXSIM) .dw TXSTOR ; TX! as EMIT vector .dw QRX ; ?KEY as ?KEY vector .else .dw TXPSTOR ; TXP! as EMIT vector .dw QRXP ; ?RXP as ?KEY vector .endif .dw BASEE ; BASE .dw 0 ; (vacant) .dw DOTOK ; 'PROMPT .dw CTOP ; CP in RAM .dw LASTN ; CONTEXT pointer .dw END_SDCC_FLASH ; CP in NVM .else ULAST = . .endif ; Main entry points and COLD start data ; COLD ( -- ) ; The hilevel cold start sequence. HEADER COLD "COLD" _forth: ; SDCC entry ; Note: no return to main.c possible unless RAMEND equals SP, ; and RPP init skipped COLD: SIM ; disable interrupts MOV CLK_CKDIVR,#0 ; Clock divider register LDW X,#(RAMEND-FORTHRAM) 1$: CLR (FORTHRAM,X) DECW X JRPL 1$ LDW X,#RPP ; return stack, growing down LDW SP,X ; initialize return stack ; see "boardcore.inc") CALL BOARDINIT ; "PC_BOARDINIT" Board initialization BGTASK_Init ; macro for init of BG task timer, refer to bgtask.inc .ifne HAS_RXUART+HAS_TXUART ; Init RS232 communication port ; STM8S[01]003F3 init UART LDW X,#CUARTBRR ; "UARTBRR" def. $6803 / 9600 baud LDW UART_BRR1,X .ifne HAS_RXUART*HAS_TXUART MOV UART_CR2,#0x0C ; Use UART1 full duplex .ifne HALF_DUPLEX .ifeq (FAMILY - STM8S) .ifeq (HALF_DUPLEX - 1) ; STM8S UART1, UART4: pull-up for PD5 single-wire UART BRES PD_DDR,#5 ; PD5 GPIO input high BSET PD_CR1,#5 ; PD5 GPIO pull-up .endif .ifeq (HALF_DUPLEX - 2) ; STM8S903 type Low Density devices can re-map UART-TX to PA3 LD A,OPT2 AND A,#0x03 CP A,#0x03 JREQ $1 ; pull-up for PD5 single-wire UART BRES PD_DDR,#5 ; PD5 GPIO input high BSET PD_CR1,#5 ; PD5 GPIO pull-up JRA $2 $1: ; pull-up for PA3 single-wire UART BRES PA_DDR,#3 ; PA3 GPIO input high BSET PA_CR1,#3 ; PA3 GPIO pull-up $2: .endif .endif MOV UART_CR5,#0x08 ; UART1 Half-Duplex .endif .else .ifne HAS_TXUART MOV UART_CR2,#0x08 ; UART1 enable tx .endif .ifne HAS_RXUART MOV UART_CR2,#0x04 ; UART1 enable rx .endif .endif .endif SSER_Init ; macro for init of simulated serial, refer to sser.inc Board_IO_Init ; macro board_io initialization (7S-LED) CALL PRESE ; initialize data stack, TIB DoLitW UZERO DoLitC USRRAMINIT DoLitC (ULAST-UZERO) CALL CMOVE ; initialize user area CALL WIPE ; initialize dictionary ; Hardware initialization complete RIM ; enable interrupts CALL [TBOOT+3] ; application boot JP QUIT ; start interpretation ; ============================================== ; Device dependent I/O .ifne HAS_RXUART ; ?RX ( -- c T | F ) ( TOS STM8: -- Y,Z,N ) ; Return serial interface input char from and true, or false. HEADER QRX "?RX" QRX: CLR A ; A: flag false BTJF UART_SR,#5,1$ LD A,UART_DR ; get char in A 1$: JP ATOKEY ; push char or flag false .endif .ifne HAS_TXUART ; TX! ( c -- ) ; Send character c to the serial interface. HEADER TXSTOR "TX!" TXSTOR: INCW X LD A,(X) INCW X .ifne HALF_DUPLEX ; HALF_DUPLEX with normal UART (e.g. wired-or Rx and Tx) 1$: BTJF UART_SR,#7,1$ ; loop until tdre BRES UART_CR2,#2 ; disable rx LD UART_DR,A ; send A 2$: BTJF UART_SR,#6,2$ ; loop until tc BSET UART_CR2,#2 ; enable rx .else ; not HALF_DUPLEX 1$: BTJF UART_SR,#7,1$ ; loop until tdre LD UART_DR,A ; send A .endif RET .endif ; ============================================== ; Device independent I/O ; ?KEY ( -- c T | F ) ( TOS STM8: -- Y,Z,N ) ; Return input char and true, or false. HEADER QKEY "?KEY" QKEY: JP [USRQKEY] ; EMIT ( c -- ) ; Send character c to output device. HEADER EMIT "EMIT" EMIT: JP [USREMIT] ; ============================================== ; The kernel .ifne USE_CALLDOLIT ; DOLITC ( - C ) ; Push an inline literal character (8 bit). DOLITC: LDW Y,(1,SP) LD A,(Y) CALL ASTOR JP CSKIPRET ; doLit ( -- w ) ; Push an inline literal. HEADFLG DOLIT "doLit" COMPO DOLIT: DECW X ;SUBW X,#2 DECW X LDW Y,(1,SP) LDW Y,(Y) LDW (X),Y JRA WSKIPRET .endif .ifne HAS_DOLOOP ; (+loop) ( +n -- ) ; Add n to index R@ and test for lower than limit (R-CELL)@. HEADFLG DOPLOOP "(+loop)" COMPO DOPLOOP: LDW Y,(5,SP) LDW YTEMP,Y LDW Y,X LDW Y,(Y) LD A,YH INCW X INCW X ADDW Y,(3,SP) CPW Y,YTEMP PUSH CC TNZ A JRMI 1$ POP CC JRSGE LEAVE JRA 2$ 1$: POP CC JRSLT LEAVE 2$: LDW (3,SP),Y JRA BRAN ; LEAVE ( -- ) ; Leave a DO .. LOOP/+LOOP loop. HEADFLG LEAVE "LEAVE" COMPO LEAVE: ADDW SP,#6 POPW Y ; DO leaves the address of +loop on the R-stack JP (2,Y) .endif ; donext ( -- ) ; Code for single index loop. HEADFLG DONXT "donxt" COMPO DONXT: LDW Y,(3,SP) DECW Y JRPL NEX1 POPW Y POP A POP A JP (2,Y) NEX1: LDW (3,SP),Y JRA BRAN ; QDQBRAN ( n - n ) ; QDUP QBRANCH phrase QDQBRAN: CALL QDUP JRA QBRAN ; ?branch ( f -- ) ; Branch if flag is zero. HEADFLG QBRAN "?branch" COMPO QBRAN: CALL YFLAGS ; Pull TOS to Y, flags JREQ BRAN WSKIPRET: POPW Y JP (2,Y) ; branch ( -- ) ; Branch to an inline address. HEADFLG BRAN "branch" COMPO ; NOALIAS BRAN: POPW Y LDW Y,(Y) JP (Y) ; EXECUTE ( ca -- ) ; Execute word at ca. HEADER EXECU "EXECUTE" EXECU: CALL YFLAGS ; Pull TOS to Y, flags JP (Y) .ifeq REMOVE_EXIT ; EXIT ( -- ) ; Terminate a colon definition. HEADER EXIT "EXIT" EXIT: POPW Y RET .endif .ifeq BOOTSTRAP ; 2! ( d a -- ) ( TOS STM8: -- Y,Z,N ) ; Store double integer to address a. HEADER DSTOR "2!" DSTOR: CALL SWAPP CALL OVER CALLR STORE CALL CELLP JRA STORE .endif .ifeq BOOTSTRAP ; 2@ ( a -- d ) ; Fetch double integer from address a. HEADER DAT "2@" DAT: CALL DUPP CALL CELLP CALLR AT CALL SWAPP JRA AT .endif .ifne WORDS_EXTRAMEM ; 2C! ( n a -- ) ; Store word C-wise to 16 bit HW registers "MSB first" HEADER DCSTOR "2C!" DCSTOR: CALL YFLAGS ; a LD A,(X) LD (Y),A ; write MSB(n) to a INCW X LD A,(X) LD (1,Y),A ; write LSB(n) to a+1 INCW X RET ; 2C@ ( a -- n ) ; Fetch word C-wise from 16 bit HW config. registers "MSB first" HEADER DCAT "2C@" DCAT: LDW Y,X LDW X,(X) LD A,(X) LD (Y),A LD A,(1,X) EXGW X,Y LD (1,X),A RET ; B! ( t a u -- ) ; Set/reset bit #u (0..7) in the byte at address a to bool t ; Note: creates/executes BSER/BRES + RET code on Data Stack HEADER BRSS "B!" BRSS: LD A,#0x72 ; Opcode BSET/BRES LD (X),A LD A,(1,X) ; 2nd byte of BSET/BRES SLA A ; n *= 2 -> A OR A,#0x10 LDW Y,X LDW Y,(4,Y) ; bool b (0..15) -> Z JRNE 1$ ; b!=0: BSET INC A ; b==0: BRES 1$: LD (1,X),A LD A,#EXIT_OPC ; Opcode RET LD (4,X),A LDW Y,X ADDW X,#6 JP (Y) .endif ; @ ( a -- w ) ( TOS STM8: -- Y,Z,N ) ; Push memory location to stack. HEADER AT "@" AT: LDW Y,X LDW X,(X) LDW X,(X) EXGW X,Y LDW (X),Y RET ; ! ( w a -- ) ( TOS STM8: -- Y,Z,N ) ; Pop data stack to memory. HEADER STORE "!" STORE: .ifeq SPEEDOVERSIZE PUSHW X ; (16 bytes) LDW Y,X LDW X,(X) ; a PUSHW X LDW X,Y LDW X,(2,X) ; w EXGW X,Y POPW X LDW (X),Y POPW X ADDW X,#4 RET .else CALL YFLAGS ; a (10 bytes) PUSHW X LDW X,(X) ; w LDW (Y),X POPW X JRA DROP .endif ; C@ ( a -- c ) ( TOS STM8: -- A,Z,N ) ; Push byte in memory to stack. ; STM8: Z,N HEADER CAT "C@" CAT: LDW Y,X ; Y=a LDW Y,(Y) YCAT: LD A,(Y) CLR (X) LD (1,X),A RET ; C! ( c a -- ) ; Pop data stack to byte memory. HEADER CSTOR "C!" CSTOR: CALL YFLAGS INCW X LD A,(X) LD (Y),A INCW X RET ; R> ( -- w ) ( TOS STM8: -- Y,Z,N ) ; Pop return stack to data stack. HEADFLG RFROM "R>" COMPO RFROM: POPW Y ; save return addr LDW YTEMP,Y POPW Y DECW X DECW X LDW (X),Y JP [YTEMP] .ifne HAS_CPNVM ; doVarPtr ( -- a ) ( TOS STM8: -- Y,Z,N ) HEADFLG DOVARPTR "doVarPtr" COMPO DOVARPTR: POPW Y ; get return addr (pfa) JP YAT .endif ; doVAR ( -- a ) ( TOS STM8: -- Y,Z,N ) ; Code for VARIABLE and CREATE. HEADFLG DOVAR "doVar" COMPO DOVAR: POPW Y ; get return addr (pfa) ; fall through ; Y> ( -- n ) ( TOS STM8: - Y,Z,N ) ; push Y to stack ; GENALIAS YSTOR "Y>" YSTOR: DECW X ; SUBW X,#2 DECW X LDW (X),Y ; push on stack RET ; go to RET of EXEC ; R@ ( -- w ) ( TOS STM8: -- Y,Z,N ) ; Copy top of return stack to stack (or the FOR - NEXT index value). HEADER RAT "R@" RAT: LDW Y,(3,SP) JRA YSTOR ; >R ( w -- ) ( TOS STM8: -- Y,Z,N ) ; Push data stack to return stack. HEADFLG TOR ">R" COMPO TOR: EXGW X,Y LDW X,(1,SP) PUSHW X LDW X,Y LDW X,(X) EXGW X,Y LDW (3,SP),Y JRA DROP ; NIP ( n1 n2 -- n2 ) ; Drop 2nd item on the stack HEADER NIP "NIP" NIP: CALLR SWAPP JRA DROP ; DROP ( w -- ) ( TOS STM8: -- Y,Z,N ) ; Discard top stack item. HEADER DROP "DROP" DROP: INCW X ; ADDW X,#2 INCW X LDW Y,X LDW Y,(Y) RET ; 2DROP ( w w -- ) ( TOS STM8: -- Y,Z,N ) ; Discard two items on stack. HEADER DDROP "2DROP" DDROP: ADDW X,#4 RET ; DUP ( w -- w w ) ( TOS STM8: -- Y,Z,N ) ; Duplicate top stack item. HEADER DUPP "DUP" DUPP: LDW Y,X JP YAT ; SWAP ( w1 w2 -- w2 w1 ) ( TOS STM8: -- Y,Z,N ) ; Exchange top two stack items. HEADER SWAPP "SWAP" SWAPP: LDW Y,X LDW X,(2,X) PUSHW X LDW X,Y LDW X,(X) EXGW X,Y LDW (2,X),Y POPW Y LDW (X),Y RET ; OVER ( w1 w2 -- w1 w2 w1 ) ( TOS STM8: -- Y,Z,N ) ; Copy second stack item to top. HEADER OVER "OVER" OVER: LDW Y,X LDW Y,(2,Y) JRA YSTOR .ifne WORDS_EXTRACORE ; I ( -- n ) ( TOS STM8: -- Y,Z,N ) ; Get inner FOR-NEXT or DO-LOOP index value HEADER IGET "I" IGET: .ifne HAS_ALIAS JP RAT ; CF JP: NAME> resolves I as ' R@" .else JRA RAT .endif .endif .ifeq BOOTSTRAP ; UM+ ( u u -- udsum ) ; Add two unsigned single ; and return a double sum. HEADER UPLUS "UM+" UPLUS: CALLR PLUS CLR A RLC A JP ASTOR .endif ; + ( w w -- sum ) ( TOS STM8: -- Y,Z,N ) ; Add top two items. HEADER PLUS "+" PLUS: LD A,(1,X) ;D=w ADD A,(3,X) LD (3,X),A LD A,(X) ADC A,(2,X) LDADROP: LD (2,X),A JRA DROP ; XOR ( w w -- w ) ( TOS STM8: -- Y,Z,N ) ; Bitwise exclusive OR. HEADER XORR "XOR" XORR: LD A,(1,X) ; D=w XOR A,(3,X) LD (3,X),A LD A,(X) XOR A,(2,X) JRA LDADROP ; AND ( w w -- w ) ( TOS STM8: -- Y,Z,N ) ; Bitwise AND. HEADER ANDD "AND" ANDD: LD A,(1,X) ; D=w AND A,(3,X) LD (3,X),A LD A,(X) AND A,(2,X) JRA LDADROP .ifeq BOOTSTRAP ; OR ( w w -- w ) ( TOS STM8: -- immediate Y,Z,N ) ; Bitwise inclusive OR. HEADER ORR "OR" ORR: LD A,(1,X) ; D=w OR A,(3,X) LD (3,X),A LD A,(X) OR A,(2,X) JRA LDADROP .endif ; 0< ( n -- t ) ( TOS STM8: -- A,Z ) ; Return true if n is negative. HEADER ZLESS "0<" ZLESS: CLR A TNZ (X) JRPL ZL1 CPL A ; true ZL1: LD (X),A LD (1,X),A RET ; - ( n1 n2 -- n1-n2 ) ( TOS STM8: -- Y,Z,N ) ; Subtraction. HEADER SUBB "-" SUBB: .ifeq SPEEDOVERSIZE CALL NEGAT ; (15 cy) JRA PLUS ; 25 cy (15+10) .else LDW Y,X LDW Y,(Y) LDW YTEMP,Y INCW X INCW X LDW Y,X LDW Y,(Y) SUBW Y,YTEMP LDW (X),Y RET ; 18 cy .endif ; CONTEXT ( -- a ) ( TOS STM8: -- Y,Z,N ) ; Start vocabulary search. HEADER CNTXT "CONTEXT" .ifeq HAS_CPNVM CNTXT: .endif CNTXT_ALIAS: LD A,#(USRCONTEXT) JRA ASTOR .ifne HAS_CPNVM CNTXT: TNZ USRCP JRPL CNTXT_ALIAS ; link NVM to NVM LD A,#(NVMCONTEXT) JRA ASTOR .endif ; CP ( -- a ) ( TOS STM8: -- Y,Z,N ) ; Point to top of dictionary. HEADER CPP "cp" ; NOALIAS CPP: LD A,#(USRCP) JRA ASTOR ; System and user variables ; BASE ( -- a ) ( TOS STM8: -- Y,Z,N ) ; Radix base for numeric I/O. HEADER BASE "BASE" BASE: LD A,#(USRBASE) JRA ASTOR .ifeq UNLINK_INN ; >IN ( -- a ) ( TOS STM8: -- Y,Z,N ) ; Hold parsing pointer. HEADER INN ">IN" INN: LD A,#(USR_IN) JRA ASTOR .endif .ifeq UNLINK_NTIB ; #TIB ( -- a ) ( TOS STM8: -- Y,Z,N ) ; Count in terminal input buffer. HEADER NTIB "#TIB" NTIB: LD A,#(USRNTIB) JRA ASTOR .endif .ifeq UNLINK_TEVAL ; 'eval ( -- a ) ( TOS STM8: -- Y,Z,N ) ; Execution vector of EVAL. HEADER TEVAL "'eval" TEVAL: LD A,#(USREVAL) JRA ASTOR .endif .ifeq UNLINK_HLD ; HLD ( -- a ) ( TOS STM8: -- Y,Z,N ) ; Hold a pointer of output string. HEADER HLD "hld" HLD: LD A,#(USRHLD) JRA ASTOR .endif ; 'EMIT ( -- a ) ( TOS STM8: -- A,Z,N ) ; Core variable holding the xt of EMIT for the console .ifeq BAREBONES HEADER TEMIT "'EMIT" TEMIT: LD A,#(USREMIT) JRA ASTOR .endif ; '?KEY ( -- a ) ( TOS STM8: -- A,Z,N ) ; Core variable holding the xt of ?KEY for the console .ifeq BAREBONES HEADER TQKEY "'?KEY" TQKEY: LD A,#(USRQKEY) JRA ASTOR .endif ; LAST ( -- a ) ( TOS STM8: -- Y,Z,N ) ; Point to last name in dictionary HEADER LAST "last" LAST: LD A,#(USRLAST) ; A> ( -- n ) ( TOS STM8: - Y,Z,N ) ; push A to stack ; GENALIAS ASTOR "A>" ASTOR: CLRW Y LD YL,A AYSTOR: DECW X ; SUBW X,#2 DECW X LDW (X),Y ; push on stack RET ; ATOKEY core ( - c T | f ) ( TOS STM8: - Y,Z,N ) ; Return input char and true, or false. ATOKEY: TNZ A JREQ 1$ CALLR 1$ ; push char JRA MONE ; flag true 1$: JRA ASTOR ; push char or flag false ; TIB ( -- a ) ( TOS STM8: -- Y,Z,N ) ; Return address of terminal input buffer. .ifeq UNLINK_TIB HEADER TIB "TIB" TIB: DoLitW TIBB RET .endif ; Constants ; BL ( -- 32 ) ( TOS STM8: -- Y,Z,N ) ; Return blank character. HEADER BLANK "BL" BLANK: LD A,#(BLNK) JRA ASTOR ; 0 ( -- 0) ( TOS STM8: -- Y,Z,N ) ; Return 0. HEADER ZERO "0" ZERO: CLR A JRA ASTOR ; 1 ( -- 1) ( TOS STM8: -- Y,Z,N ) ; Return 1. HEADER ONE "1" ONE: LD A,#1 JRA ASTOR ; -1 ( -- -1) ( TOS STM8: -- Y,Z,N ) ; Return -1 HEADER MONE "-1" MONE: LDW Y,#0xFFFF JRA AYSTOR ; 'PROMPT ( -- a) ( TOS STM8: -- Y,Z,N ) ; Return address of PROMPT vector .ifeq UNLINK_TPROMPT HEADER TPROMPT "'PROMPT" TPROMPT: LD A,#(USRPROMPT) JRA ASTOR .endif .ifne HAS_FILEHAND ; ( -- ) EMIT pace character for handshake in FILE mode PACEE: DoLitC PACE ; pace character for host handshake JP [USREMIT] ; HAND ( -- ) ; set PROMPT vector to interactive mode HEADER HANDD "HAND" HANDD: LDW Y,#(DOTOK) YPROMPT: LDW USRPROMPT,Y RET ; FILE ( -- ) ; set PROMPT vector to file transfer mode HEADER FILEE "FILE" FILEE: LDW Y,#(PACEE) JRA YPROMPT .endif ; Common functions ; ?DUP ( w -- w w | 0 ) ( TOS STM8: -- Y,Z,N ) ; Dup tos if its not zero. HEADER QDUP "?DUP" QDUP: LDW Y,X LDW Y,(Y) JREQ QDUP1 DECW X DECW X LDW (X),Y QDUP1: RET ; ROT ( w1 w2 w3 -- w2 w3 w1 ) ( TOS STM8: -- Y,Z,N ) ; Rot 3rd item to top. HEADER ROT "ROT" ROT: .ifeq SPEEDOVERSIZE CALL TOR CALLR 1$ CALL RFROM 1$: JP SWAPP .else LDW Y,X LDW X,(4,X) PUSHW X LDW X,Y LDW X,(2,X) PUSHW X LDW X,Y LDW X,(X) EXGW X,Y LDW (2,X),Y POPW Y LDW (4,X),Y POPW Y LDW (X),Y RET .endif ; 2DUP ( w1 w2 -- w1 w2 w1 w2 ) ; Duplicate top two items. HEADER DDUP "2DUP" DDUP: CALLR 1$ 1$: JP OVER .ifeq UNLINKCORE ; DNEGATE ( d -- -d ) ( TOS STM8: -- Y,Z,N ) ; Two's complement of top double. HEADER DNEGA "DNEGATE" DNEGA: LDW Y,X LDW Y,(2,Y) NEGW Y PUSH CC LDW (2,X),Y LDW Y,X LDW Y,(Y) CPLW Y POP CC JRC DN1 INCW Y DN1: LDW (X),Y RET .endif ; .ifeq BOOTSTRAP ; = ( w w -- t ) ( TOS STM8: -- Y,Z,N ) ; Return true if top two are equal. HEADER EQUAL "=" EQUAL: .ifeq SPEEDOVERSIZE CALL XORR JP ZEQUAL ; 31 cy= (18+13) .else LD A,#0x0FF ; true LDW Y,X ; D = n2 LDW Y,(Y) LDW YTEMP,Y INCW X INCW X LDW Y,X LDW Y,(Y) CPW Y,YTEMP ;if n2 <> n1 JREQ EQ1 CLR A EQ1: LD (X),A LD (1,X),A LDW Y,X LDW Y,(Y) RET ; 24 cy .endif ; .endif ; U< ( u u -- t ) ( TOS STM8: -- Y,Z,N ) ; Unsigned compare of top two items. HEADER ULESS "U<" ULESS: CLR A CALLR YTEMPCMP JRUGE 1$ CPL A 1$: LD YL,A LD YH,A LDW (X),Y RET .ifeq BOOTSTRAP ; < ( n1 n2 -- t ) ; Signed compare of top two items. HEADER LESS "<" LESS: .ifeq SPEEDOVERSIZE CALL SUBB ; (29cy) JP ZLESS ; 41 cy (12+29) .else CLR A LDW Y,X LDW Y,(Y) LDW YTEMP,Y INCW X INCW X LDW Y,X LDW Y,(Y) CPW Y,YTEMP JRSGE 1$ CPL A 1$: LD (X),A LD (1,X),A LDW Y,X LDW Y,(Y) RET ; 26 cy .endif .endif ; YTEMPCMP ( n n - n ) ( TOS STM8: - Y,Z,N ) ; Load (TOS) to YTEMP and (TOS-1) to Y, DROP, CMP to STM8 flags YTEMPCMP: LDW Y,X INCW X INCW X EXGW X,Y LDW X,(X) LDW YTEMP,X LDW X,Y LDW X,(X) CPW X,YTEMP EXGW X,Y RET .ifeq BOOTSTRAP ; MAX ( n n -- n ) ( TOS STM8: -- Y,Z,N ) ; Return greater of two top items. HEADER MAX "MAX" MAX: CALLR YTEMPCMP JRSGT MMEXIT YTEMPTOS: LDW Y,YTEMP LDW (X),Y MMEXIT: RET .endif .ifeq BOOTSTRAP ; MIN ( n n -- n ) ( TOS STM8: -- Y,Z,N ) ; Return smaller of top two items. HEADER MIN "MIN" MIN: CALLR YTEMPCMP JRSLT MMEXIT JRA YTEMPTOS .endif .ifeq UNLINK_WITHI ; WITHIN ( u ul uh -- t ) ( TOS STM8: -- Y,Z,N ) ; Return true if u is within ; range of ul and uh. ( ul <= u < uh ) HEADER WITHI "WITHIN" WITHI: CALL OVER CALL SUBB CALL TOR CALL SUBB CALL RFROM JRA ULESS .endif ; Divide ; UM/MOD ( udl udh un -- ur uq ) ; Unsigned divide of a double by a ; single. Return mod and quotient. HEADER UMMOD "UM/MOD" UMMOD: LDW Y,X ; stack pointer to Y LDW X,(X) ; un LDW YTEMP,X ; save un LDW X,Y INCW X ; drop un INCW X PUSHW X ; save stack pointer LDW X,(X) ; X=udh LDW Y,(4,Y) ; Y=udl (offset before drop) CPW X,YTEMP JRULT MMSM1 ; X is still on the R-stack POPW X ; restore stack pointer CLRW Y LDW (2,X),Y ; remainder 0 DECW Y LDW (X),Y ; quotient max. 16 bit value RET MMSM1: LD A,#16 ; loop count SLLW Y ; udl shift udl into udh MMSM3: RLCW X ; rotate udl bit into uhdh (= remainder) JRC MMSMa ; if carry out of rotate CPW X,YTEMP ; compare udh to un JRULT MMSM4 ; can't subtract MMSMa: SUBW X,YTEMP ; can subtract RCF MMSM4: CCF ; quotient bit RLCW Y ; rotate into quotient, rotate out udl DEC A ; repeat JRNE MMSM3 ; if A == 0 MMSMb: LDW YTEMP,X ; done, save remainder POPW X ; restore stack pointer LDW (X),Y ; save quotient LDW Y,YTEMP ; remainder onto stack LDW (2,X),Y RET .ifeq UNLINKCORE ; M/MOD ( d n -- r q ) ; Signed floored divide of double by ; single. Return mod and quotient. HEADER MSMOD "M/MOD" MSMOD: LD A,(X) ; DUPP ZLESS PUSH A ; DUPP TOR JRPL MMOD1 ; QBRAN CALL NEGAT CALL TOR CALL DNEGA CALL RFROM MMOD1: CALL TOR JRPL MMOD2 ; DUPP ZLESS QBRAN CALL RAT CALL PLUS MMOD2: CALL RFROM CALLR UMMOD POP A ; RFROM TNZ A JRPL MMOD3 ; QBRAN CALL SWAPP CALL NEGAT CALL SWAPP MMOD3: RET ; /MOD ( n n -- r q ) ; Signed divide. Return mod and quotient. HEADER SLMOD "/MOD" SLMOD: CALL OVER CALL ZLESS CALL SWAPP JRA MSMOD ; MOD ( n n -- r ) ( TOS STM8: -- Y,Z,N ) ; Signed divide. Return mod only. HEADER MMOD "MOD" MMOD: CALLR SLMOD JP DROP ; / ( n n -- q ) ( TOS STM8: -- Y,Z,N ) ; Signed divide. Return quotient only. HEADER SLASH "/" SLASH: CALLR SLMOD JP NIP .endif ; Multiply ; UM* ( u u -- ud ) ; Unsigned multiply. Return double product. HEADER UMSTA "UM*" UMSTA: ; stack have 4 bytes u1=a,b u2=c,d LD A,(2,X) ; b LD YL,A LD A,(X) ; d MUL Y,A PUSHW Y ; PROD1 temp storage LD A,(3,X) ; a LD YL,A LD A,(X) ; d MUL Y,A PUSHW Y ; PROD2 temp storage LD A,(2,X) ; b LD YL,A LD A,(1,X) ; c MUL Y,A PUSHW Y ; PROD3,CARRY temp storage LD A,(3,X) ; a LD YL,A LD A,(1,X) ; c MUL Y,A ; least signifiant product CLR A RRWA Y LD (3,X),A ; store least significant byte ADDW Y,(1,SP) ; PROD3 CLR A RLC A ; save carry LD (1,SP),A ; CARRY ADDW Y,(3,SP) ; PROD2 LD A,(1,SP) ; CARRY ADC A,#0 ; add 2nd carry LD (1,SP),A ; CARRY CLR A RRWA Y LD (2,X),A ; 2nd product byte ADDW Y,(5,SP) ; PROD1 RRWA Y LD (1,X),A ; 3rd product byte RRWA Y ; 4th product byte now in A ADC A,(1,SP) ; CARRY LD (X),A ADDW SP,#6 ; drop temp storage RET ; * ( n n -- n ) ( TOS STM8: -- Y,Z,N ) ; Signed multiply. Return single product. HEADER STAR "*" STAR: CALLR UMSTA JP DROP .ifeq UNLINKCORE ; M* ( n n -- d ) ; Signed multiply. Return double product. HEADER MSTAR "M*" MSTAR: LD A,(2,X) ; DDUP XOR A,(X) ; XORR PUSH A ; TOR CALL ABSS CALL SWAPP CALL ABSS CALLR UMSTA POP A ; RFROM TNZ A JRPL MSTA1 ; QBRAN CALL DNEGA MSTA1: RET ; */MOD ( n1 n2 n3 -- r q ) ; Multiply n1 and n2, then divide ; by n3. Return mod and quotient. HEADER SSMOD "*/MOD" SSMOD: CALL TOR CALLR MSTAR CALL RFROM JP MSMOD ; */ ( n1 n2 n3 -- q ) ( TOS STM8: -- Y,Z,N ) ; Multiply n1 by n2, then divide ; by n3. Return quotient only. HEADER STASL "*/" STASL: CALLR SSMOD JP NIP .endif ; Miscellaneous .ifeq BAREBONES ; EXG ( n -- n ) ( TOS STM8: -- Y,Z,N ) ; Exchange high with low byte of n. HEADER EXG "EXG" EXG: CALLR DOXCODE SWAPW X RET .endif .ifeq BOOTSTRAP ; 2/ ( n -- n ) ( TOS STM8: -- Y,Z,N ) ; Divide tos by 2. HEADER TWOSL "2/" TWOSL: CALLR DOXCODE SRAW X RET ; 2* ( n -- n ) ( TOS STM8: -- Y,Z,N ) ; Multiply tos by 2. HEADER CELLS "2*" CELLS: CALLR DOXCODE SLAW X RET .endif ; 2- ( a -- a ) ( TOS STM8: -- Y,Z,N ) ; Subtract 2 from tos. HEADER CELLM "2-" CELLM: CALLR DOXCODE DECW X DECW X RET ; 2+ ( a -- a ) ( TOS STM8: -- Y,Z,N ) ; Add 2 to tos. HEADER CELLP "2+" CELLP: CALLR DOXCODE INCW X INCW X RET ; 1- ( n -- n ) ( TOS STM8: -- Y,Z,N ) ; Subtract 1 from tos. HEADER ONEM "1-" ONEM: CALLR DOXCODE DECW X RET ; 1+ ( n -- n ) ( TOS STM8: -- Y,Z,N ) ; Add 1 to tos. HEADER ONEP "1+" ONEP: CALLR DOXCODE INCW X RET ; DOXCODE ( n -- n ) ( TOS STM8: - Y,Z,N ) ; precede assembly code for a primitive word ; Caution: no other Forth word can be called from assembly! ; In the assembly code: X=(TOS), YTEMP=TOS. (TOS)=X after RET ; GENALIAS DOXCODE "DOXCODE" DOXCODE: POPW Y LDW YTEMP,X LDW X,(X) CALL (Y) EXGW X,Y LDW X,YTEMP LDW (X),Y RET ; NOT ( w -- w ) ( TOS STM8: -- Y,Z,N ) ; One's complement of TOS. HEADER INVER "NOT" INVER: CALLR DOXCODE CPLW X RET ; NEGATE ( n -- -n ) ( TOS STM8: -- Y,Z,N ) ; Two's complement of TOS. HEADER NEGAT "NEGATE" NEGAT: CALLR DOXCODE NEGW X RET ; ABS ( n -- n ) ( TOS STM8: -- Y,Z,N ) ; Return absolute value of n. HEADER ABSS "ABS" ABSS: CALLR DOXCODE JRPL 1$ ; positive? NEGW X ; else negate 1$: RET ; 0= ( n -- t ) ( TOS STM8: -- Y,Z,N )) ; Return true if n is equal to 0 HEADER ZEQUAL "0=" ZEQUAL: CALLR DOXCODE JREQ 1$ CLRW X RET 1$: CPLW X ; else -1 RET ; PICK ( ... +n -- ... w ) ( TOS STM8: -- Y,Z,N ) ; Copy nth stack item to tos. HEADER PICK "PICK" PICK: CALLR DOXCODE INCW X SLAW X ADDW X,YTEMP LDW X,(X) RET .ifeq BOOTSTRAP ; >CHAR ( c -- c ) ( TOS STM8: -- A,Z,N ) ; Filter non-printing characters. HEADER TCHAR ">CHAR" TCHAR: LD A,(1,X) CP A,#0x7F JRUGE 1$ CP A,#(' ') JRUGE 2$ 1$: LD A,#('_') 2$: LD (1,X),A RET .endif ; DEPTH ( -- n ) ( TOS STM8: -- Y,Z,N ) ; Return depth of data stack. HEADER DEPTH "DEPTH" DEPTH: LDW Y,X NEGW X ADDW X,PRSPP+1 ; use SPP constant from PC_SPP in PRESET SRAW X ;DECW X ; fixed: off-by-one to compensate error in "rp!" XSTOR: EXGW X,Y JP YSTOR ; Memory access ; +! ( n a -- ) ( TOS STM8: -- Y,Z,N ) ; Add n to contents at address a. HEADER PSTOR "+!" PSTOR: LDW Y,X LDW X,(X) LDW YTEMP,X LDW X,Y LDW X,(2,X) PUSHW X LDW X,[YTEMP] ADDW X,(1,SP) LDW [YTEMP],X POPW X EXGW X,Y JP DDROP ; COUNT ( b -- b +n ) ( TOS STM8: -- A,Z,N ) ; Return count byte of a string ; and add 1 to byte address. HEADER COUNT "COUNT" COUNT: CALL DUPP CALL ONEP CALL SWAPP JP CAT .ifne HAS_CPNVM RAMHERE: TNZ USRCP JRPL HERE ; NVM: CP points to NVM, NVMCP points to RAM LD A,#(NVMCP) ; 'eval in Interpreter mode: HERE returns pointer to RAM JP AAT .else RAMHERE = HERE .endif ; HERE ( -- a ) ( TOS STM8: -- Y,Z,N ) ; Return top of code dictionary. HEADER HERE "HERE" HERE: CALL CPP JP AT ; PAD ( -- a ) ( TOS STM8: invalid ) ; Return address of text buffer ; above code dictionary. HEADER PAD "PAD" PAD: .ifne HAS_BACKGROUND ; get PAD area address (offset or dedicated) for PAD area PUSH CC ; Test interrupt level flags in CC POP A AND A,#0x20 JRNE 1$ LD A,#(PADBG) ; dedicated memory for PAD in background task JP ASTOR 1$: .endif CALLR RAMHERE ; regular PAD with offset to HERE ADDW Y,#PADOFFS ; PADOFFS PLUS LDW (X),Y RET .ifeq UNLINK_ATEXE ; @EXECUTE ( a -- ) ( TOS STM8: undefined ) ; Execute vector stored in address a. HEADER ATEXE "@EXECUTE" ATEXE: CALL YFLAGS LDW Y,(Y) JREQ 1$ JP (Y) 1$: RET .endif ; CMOVE ( b1 b2 u -- ) ; Copy u bytes from b1 to b2. HEADER CMOVE "CMOVE" CMOVE: CALL TOR JRA CMOV2 CMOV1: CALL TOR CALL DUPPCAT CALL RAT CALL CSTOR CALL ONEP CALL RFROM CALL ONEP CMOV2: CALL DONXT .dw CMOV1 JP DDROP ; FILL ( b u c -- ) ; Fill u bytes of character c ; to area beginning at b. HEADER FILL "FILL" FILL: CALL SWAPP CALL TOR CALL SWAPP JRA FILL2 FILL1: CALL DDUP CALL CSTOR CALL ONEP FILL2: CALL DONXT .dw FILL1 JP DDROP .ifeq BAREBONES ; ERASE ( b u -- ) ; Erase u bytes beginning at b. HEADER ERASE "ERASE" ERASE: CALL ZERO JRA FILL .endif ; PACK$ ( b u a -- a ) ; Build a counted string with ; u characters from b. Null fill. HEADER PACKS "PACK$" PACKS: CALL DUPP CALL TOR ; strings only on cell boundary CALL DDUP CALL CSTOR CALL ONEP ; save count CALL SWAPP CALLR CMOVE CALL RFROM RET .ifeq REMOVE_DIGIT ; Numeric output, single precision ; DIGIT ( u -- c ) ( TOS STM8: -- Y,Z,N ) ; Convert digit u to a character. HEADER DIGIT "DIGIT" DIGIT: LD A,(1,X) CP A,#10 JRMI 1$ ADD A,#7 1$: ADD A,#48 LD (1,X),A RET .endif .ifeq REMOVE_EXTRC ; EXTRACT ( n base -- n c ) ( TOS STM8: -- Y,Z,N ) ; Extract least significant digit from n. HEADER EXTRC "EXTRACT" EXTRC: CALL ZERO CALL SWAPP CALL UMMOD CALL SWAPP JRA DIGIT .endif ; #> ( w -- b u ) ; Prepare output string. HEADER EDIGS "#>" EDIGS: LDW Y,USRHLD ; DROP HLD LDW (X),Y CALL PAD CALL OVER JP SUBB ; # ( u -- u ) ( TOS STM8: -- Y,Z,N ) ; Extract one digit from u and ; append digit to output string. HEADER DIG "#" DIG: LD A,USRBASE+1 LDW Y,X LDW X,(X) DIV X,A LDW (Y),X CP A,#10 JRMI 1$ ADD A,#7 1$: ADD A,#48 HOLDA: LDW X,USRHLD ; HLD @ DECW X ; 1 - LDW USRHLD,X ; DUP HLD ! LD (X),A ; C! EXGW X,Y RET ; #S ( u -- 0 ) ; Convert u until all digits ; are added to output string. HEADER DIGS "#S" DIGS: CALLR DIG LD A,(X) OR A,(1,X) JRNE DIGS RET ; HOLD ( c -- ) ( TOS STM8: -- Y,Z,N ) ; Insert a character into output string. HEADER HOLD "HOLD" HOLD: CALL AFLAGS EXGW X,Y JP HOLDA ; SIGN ( n -- ) ; Add a minus sign to ; numeric output string. HEADER SIGN "SIGN" SIGN: TNZ (X) JRPL SDROP LD A,#('-') LD (1,X),A JRA HOLD SDROP: INCW X INCW X RET ; <# ( -- ) ( TOS STM8: -- Y,Z,N ) ; Initiate numeric output process. HEADER BDIGS "<#" BDIGS: CALL PAD DoLitC USRHLD JP STORE ; str ( w -- b u ) ; Convert a signed integer ; to a numeric string. HEADER STR "str" STR: CALL DUPP CALL TOR CALL ABSS CALLR BDIGS CALLR DIGS CALL RFROM CALLR SIGN JRA EDIGS ; HEX ( -- ) ; Use radix 16 as base for ; numeric conversions. HEADER HEX "HEX" HEX: LD A,#16 JRA BASESET ; DECIMAL ( -- ) ; Use radix 10 as base ; for numeric conversions. HEADER DECIM "DECIMAL" DECIM: LD A,#10 BASESET: LD USRBASE+1,A CLR USRBASE RET ; BASE@ ( -- u ) ; Get BASE value BASEAT: LD A,USRBASE+1 JP ASTOR ; Numeric input, single precision ; NUMBER? ( a -- n T | a F ) ; Convert a number string to ; integer. Push a flag on tos. HEADER NUMBQ "NUMBER?" NUMBQ: LDW Y,USRBASE PUSHW Y ; note: (1,SP) used as sign flag CALL ZERO CALL OVER CALL COUNT NUMQ0: CALL OVER CALL CAT CALL AFLAGS CP A,#('$') JRNE 1$ CALLR HEX JRA NUMQSKIP 1$: .ifne EXTNUMPREFIX CP A,#('%') JRNE 2$ MOV USRBASE+1,#2 JRA NUMQSKIP 2$: CP A,#('&') JRNE 3$ CALLR DECIM JRA NUMQSKIP 3$: .endif CP A,#('-') JRNE NUMQ1 POP A PUSH #0x80 ; flag ?sign NUMQSKIP: CALL SWAPP CALL ONEP CALL SWAPP CALL ONEM JRNE NUMQ0 ; check for more modifiers NUMQ1: CALL QDQBRAN .dw NUMQ6 CALL ONEM CALL TOR ; FOR NUMQ2: CALL DUPP CALL TOR CALL CAT CALLR BASEAT CALLR DIGTQ CALL QBRAN ; WHILE ( no digit -> LEAVE ) .dw NUMLEAVE CALL SWAPP CALLR BASEAT CALL STAR CALL PLUS CALL RFROM CALL ONEP CALL DONXT ; NEXT .dw NUMQ2 CALLR NUMDROP ; drop b LD A,(1,SP) ; test sign flag JRPL NUMPLUS CALL NEGAT NUMPLUS: CALL SWAPP JRA NUMQ5 NUMLEAVE: ; LEAVE ( clean-up FOR .. NEXT ) ADDW SP,#4 ; RFROM,RFROM,DDROP CALLR NUMDROP ; DDROP 0 CLR (X) CLR (1,X) ; fall through NUMQ5: ; THEN CALL DUPP ; fall through NUMQ6: POP A ; discard sign flag POP A ; restore BASE LD USRBASE+1,A NUMDROP: INCW X INCW X RET ; DIGIT? ( c base -- u t ) ; Convert a character to its numeric ; value. A flag indicates success. HEADER DIGTQ "DIGIT?" DIGTQ: CALL TOR LD A,YL SUB A,#'0' CP A,#10 JRMI DGTQ1 SUB A,#7 .ifne CASEINSENSITIVE AND A,#0xDF .endif CP A,#10 JRPL DGTQ1 CPL A ; make sure A > base DGTQ1: LD (1,X),A CALL DUPP CALL RFROM JP ULESS ; Basic I/O ; KEY ( -- c ) ; Wait for and return an ; input character. HEADER KEY "KEY" KEY: KEY1: CALL [USRQKEY] CALL YFLAGS JRNE RETIDLE LD A,USRIDLE OR A,USRIDLE+1 JREQ KEY2 CALL [USRIDLE] ; IDLE must be fast (unless ?RX is buffered) and stack neutral KEY2: JRA KEY1 RETIDLE: RET .ifeq REMOVE_NUFQ ; NUF? ( -- t ) ; Return false if no input, ; else pause and if CR return true. HEADER NUFQ "NUF?" NUFQ: .ifne CONSOLE_HALF_DUPLEX ; slow EMIT down to free the line for RX .ifne HAS_BACKGROUND LD A,TICKCNT+1 ADD A,#3 1$: CP A,TICKCNT+1 JRNE 1$ .else CLRW Y 1$: DECW Y JRNE 1$ .endif .endif CALL [USRQKEY] LD A,(1,X) JREQ NUFQ1 CALL DDROP CALLR KEY DoLitC CRR JP EQUAL NUFQ1: RET .endif ; SPACE ( -- ) ; Send blank character to ; output device. HEADER SPACE "SPACE" SPACE: CALL BLANK JP [USREMIT] .ifeq UNLINKCORE ; SPACES ( +n -- ) ; Send n spaces to output device. .ifeq BAREBONES HEADER SPACS "SPACES" SPACS: CALL ZERO CALL MAX .else SPACS: .endif CALL TOR JRA CHAR2 CHAR1: CALLR SPACE CHAR2: CALL DONXT .dw CHAR1 RET .endif ; do$ ( -- a ) ; Return address of a compiled string. HEADFLG DOSTR "do$" COMPO DOSTR: CALL RFROM CALL RAT CALL RFROM CALL COUNT CALL PLUS CALL TOR CALL SWAPP CALL TOR RET ; $"| ( -- a ) ; Run time routine compiled by $". ; Return address of a compiled string. HEADFLG STRQP '$"|' COMPO STRQP: CALLR DOSTR RET ; ."| ( -- ) ; Run time routine of ." . ; Output a compiled string. HEADFLG DOTQP '."|' COMPO DOTQP: CALLR DOSTR COUNTTYPES: CALL COUNT JRA TYPES .ifeq BAREBONES ; .R ( n +n -- ) ; Display an integer in a field ; of n columns, right justified. HEADER DOTR ".R" DOTR: CALL TOR CALL STR JRA RFROMTYPES .endif ; U.R ( u +n -- ) ; Display an unsigned integer ; in n column, right justified. HEADER UDOTR "U.R" UDOTR: CALL TOR CALLR BDEDIGS RFROMTYPES: CALL RFROM CALL OVER CALL SUBB CALLR SPACS JRA TYPES ; TYPE ( b u -- ) ; Output u characters from b. HEADER TYPES "TYPE" TYPES: CALL TOR JRA TYPE2 TYPE1: CALL DUPPCAT CALL [USREMIT] CALL ONEP TYPE2: CALL DONXT .dw TYPE1 JP DROP .ifeq BOOTSTRAP ; U. ( u -- ) ; Display an unsigned integer ; in free format. HEADER UDOT "U." UDOT: CALLR BDEDIGS CALL SPACE JRA TYPES ; UDOT helper routine BDEDIGS: CALL BDIGS CALL DIGS JP EDIGS .endif .ifeq BOOTSTRAP ; . ( w -- ) ; Display an integer in free ; format, preceeded by a space. HEADER DOT "." DOT: LD A,USRBASE+1 XOR A,#10 JREQ 1$ JRA UDOT 1$: CALL STR CALL SPACE JRA TYPES .endif .ifeq BOOTSTRAP ; ? ( a -- ) ; Display contents in memory cell. HEADER QUEST "?" QUEST: CALL AT JRA DOT .endif ; Parsing ; >Y ( n -- ) ( TOS STM8: - Y,Z,N ) ; Consume TOS to CPU Y and Flags ; GENALIAS YFLAGS ">Y" YFLAGS: LDW Y,X INCW X INCW X LDW Y,(Y) RET ; >A ( c -- ) ( TOS STM8: - A,Z,N ) ; Consume TOS to CPU A and Flags ; GENALIAS AFLAGS ">A" AFLAGS: INCW X LD A,(X) INCW X TNZ A RET ; SPARSE ( b u c -- b u delta ; <string> ) ; Scan string delimited by c. ; Return found string and its offset. HEADER PARS "SPARSE" PARS: CALLR AFLAGS ; TEMP CSTOR PUSH A CALL OVER CALL TOR JRNE 1$ CALL OVER CALL RFROM JRA PARSEND 1$: CALL ONEM ld A,(3,SP) ; TEMP CAT CP A,#' ' ; BLANK EQUAL JRNE PARS3 CALL TOR PARS1: LD A,#' ' LDW Y,X LDW Y,(Y) CP A,(Y) JRMI PARS2 CALL ONEP CALL DONXT .dw PARS1 ADDW SP,#2 ; RFROM DROP CALL ZERO POP A ; discard TEMP DUPPARS: JP DUPP PARS2: CALL RFROM PARS3: CALL OVER CALL SWAPP CALL TOR PARS4: LD A,(5,SP) ; TEMP CAT CALL ASTOR CALL OVER CALL CAT CALLR SUBPARS ; scan for delimiter LD A,(5,SP) ; TEMP CAT CP A,#' ' ; BLANK EQUAL JRNE PARS5 CALL ZLESS PARS5: CALL QBRAN .dw PARS6 CALL ONEP CALL DONXT .dw PARS4 CALLR DUPPARS CALL TOR JRA PARS7 PARS6: ADDW SP,#2 ; RFROM DROP CALLR DUPPARS CALL ONEP CALL TOR PARS7: CALL OVER CALLR SUBPARS CALL RFROM CALL RFROM PARSEND: POP A ; discard TEMP SUBPARS: JP SUBB ; PARSE ( c -- b u ; <string> ) ; Scan input stream and return ; counted string delimited by c. HEADER PARSE "PARSE" PARSE: LD A,#(USRBUFFER) CALL AAT ADDW Y,USR_IN ; current input buffer pointer LDW (X),Y LD A,USRNTIB+1 SUB A,USR_IN+1 ; remaining count CALL ASTOR CALL ROT CALL PARS DoLitC USR_IN JP PSTOR .ifeq BAREBONES ; .( ( -- ) ; Output following string up to next ) . HEADFLG DOTPR ".(" IMEDD DOTPR: DoLitC 41 ; ")" CALLR PARSE JP TYPES .endif .ifeq BOOTSTRAP ; ( ( -- ) ; Ignore following string up to next ). ; A comment. HEADFLG PAREN "(" IMEDD PAREN: DoLitC 41 ; ")" CALLR PARSE JP DDROP .endif ; \ ( -- ) ; Ignore following text till ; end of line. HEADFLG BKSLA "\" IMEDD BKSLA: MOV USR_IN+1,USRNTIB+1 RET ; TOKEN ( -- a ; <string> ) ; Parse a word from input stream ; and copy it to code dictionary or to RAM. HEADER TOKEN "TOKEN" TOKEN: CALL BLANK JRA WORDD ; WORD ( c -- a ; <string> ) ; Parse a word from input stream ; and copy it to code dictionary or to RAM. HEADER WORDD "WORD" WORDD: CALLR PARSE CALL RAMHERE CPPACKS: CALL CELLP JP PACKS ; TOKEN_$,n ( <word> -- <dict header> ) ; copy token to the code dictionary ; and build a new dictionary name ; note: for defining words (e.g. :, CREATE) ; GENALIAS TOKSNAME "TOKEN_$,n" TOKSNAME: CALL BLANK CALLR PARSE CALL HERE CALLR CPPACKS JP SNAME ; Dictionary search ; NAME> ( na -- ca ) ; Return a code address given ; a name address. HEADER NAMET "NAME>" NAMET: CALL COUNT DoLitC 31 CALL ANDD .ifeq HAS_ALIAS JP PLUS .else CALL PLUS ; ALIAS: return the target address of a JP LD A,(Y) ; DUP C@ CP A,#BRAN_OPC ; BRAN_OPC = JRNE 1$ ; IF INCW Y ; 1+ LDW Y,(Y) ; @ LDW (X),Y 1$: RET ; THEN .endif ; R@ indexed char lookup for SAME? SAMEQCAT: CALL OVER ADDW Y,(3,SP) ; R-OVER> PLUS .ifne CASEINSENSITIVE CALL YCAT JRA CUPPER .else JP YCAT .endif ; SAME? ( a a u -- a a f \ -0+ ) ; Compare u cells in two ; strings. Return 0 if identical. HEADER SAMEQ "SAME?" SAMEQ: CALL ONEM CALL TOR JRA SAME2 SAME1: CALLR SAMEQCAT CALLR SAMEQCAT CALL XORR CALL QDQBRAN .dw SAME2 POPW Y ; RFROM DROP RET SAME2: CALL DONXT .dw SAME1 JP ZERO .ifne CASEINSENSITIVE ; CUPPER ( c -- c ) ; convert char to upper case HEADER CUPPER "CUPPER" CUPPER: LD A,(1,X) CP A,#('a') JRULT 1$ CP A,#('z') JRUGT 1$ AND A,#0xDF LD (1,X),A 1$: RET .endif ; NAME? ( a -- ca na | a F ) ; Search vocabularies for a string. HEADER NAMEQ "NAME?" NAMEQ: .ifne HAS_ALIAS CALL CNTXT_ALIAS ; "PC_NAME?" patch point for CURRENT .else CALL CNTXT .endif JRA FIND ; find ( a va -- ca na | a F ) ; Search vocabulary for string. ; Return ca and na if succeeded. HEADER FIND "find" FIND: CALLR SWAPPF ; SWAPP LDW Y,(Y) ; DUPP CAT TEMP CSTOR DUPP AT LD A,YH PUSH A ; (push TEMP) PUSHW Y ; TOR CALL CELLP CALLR SWAPPF FIND1: CALL AT JREQ FIND6 CALL YAT ; DUPP AT DoLitW MASKK CALL ANDD .ifne CASEINSENSITIVE CALLR CUPPER .endif CALL RAT .ifne CASEINSENSITIVE CALLR CUPPER .endif CALL XORR CALL QBRAN .dw FIND2 CALL CELLP CALL MONE ; 0xFFFF JRA FIND3 FIND2: CALL CELLP LD A,(3,SP) ; TEMP CAT CALL ASTOR CALL SAMEQ FIND3: JRA FIND4 FIND6: ADDW SP,#3 ; (pop TEMP) RFROM DROP CALLR SWAPPF CALL CELLM JRA SWAPPF FIND4: CALL QBRAN .dw FIND5 CALL CELLM CALL CELLM JRA FIND1 FIND5: ADDW SP,#3 ; (pop TEMP) RFROM DROP CALL NIP CALL CELLM CALL DUPP CALL NAMET SWAPPF: JP SWAPP ; Terminal response ; ^H ( bot eot cur -- bot eot cur ) ; Backup cursor by one character. HEADER BKSP "^h" BKSP: LD A,(4,X) ; backspace if CUR != BOT CP A,(X) JRNE BACK0 LD A,(5,X) CP A,(1,X) JREQ BACK1 BACK0: .ifeq CONSOLE_HALF_DUPLEX CALLR BACKSP .endif CALL ONEM CALL SPACE BACKSP: DoLitC BKSPP JP [USREMIT] BACK1: RET ; TAP ( bot eot cur c -- bot eot cur ) ; Accept and echo key stroke ; and bump cursor. HEADER TAP "TAP" TAP: .ifeq CONSOLE_HALF_DUPLEX CALL DUPP CALL [USREMIT] .endif CALL OVER CALL CSTOR JP ONEP ; kTAP ( bot eot cur c -- bot eot cur ) ; Process a key stroke, ; CR or backspace. HEADER KTAP "kTAP" KTAP: INCW X ; c -> A LD A,(X) INCW X CP A,#(CRR) JREQ KTAP2 CP A,#(BKSPP) JREQ BKSP CALL BLANK JRA TAP KTAP2: CALL NIP JP DUPP ; ACCEPT ( b u -- b u ) ; Accept one line of characters to input ; buffer. Return with actual count. HEADER ACCEP "ACCEPT" ACCEP: CALL OVER CALL PLUS CALL OVER ACCP1: LDW Y,X ; cur -> Y LDW Y,(Y) CPW Y,(2,X) ; eot = JREQ ACCP4 ; ?branch ACCP4 CALL KEY LD A,(1,X) ; DUPP JRMI ACCP2 ; BL 127 WITHIN CP A,#(BLNK) JRMI ACCP2 ; ?branch ACC2 CALLR TAP JRA ACCP1 ACCP2: CALLR KTAP JRA ACCP1 ACCP4: CALL DROP CALL OVER JP SUBB ; QUERY ( -- ) ; Accept one line from input stream to ; terminal input buffer. HEADER QUERY "QUERY" QUERY: LD A,#(USRBUFFER) CALL AAT ; TIB DoLitC TIBLENGTH CALLR ACCEP LDW USRNTIB,Y ; NTIB ! CLR USR_IN+1 ; ZERO >IN ! JP DDROP ; ABORT ( -- ) ; Reset data stack and ; jump to QUIT. HEADER ABORT "ABORT" ABORT: CALLR PRESE JP QUIT ; aborq ( f -- ) ; Run time routine of ABORT". ; Abort with a message. HEADFLG ABORQ "aborq" COMPO ABORQ: CALL QBRAN .dw ABOR2 ; text flag ABORTS: CALL DOSTR ABOR1: CALL SPACE CALL COUNTTYPES CALL DOTQP .ifne HAS_OLDOK .db 2, 63, 10 ; ?<CR> .else .db 3, 63, 7, 10 ; ?<BEL><CR> .endif JRA ABORT ; pass error string ABOR2: CALL DOSTR JP DROP ; PRESET ( -- ) ; Reset data stack pointer and ; terminal input buffer. HEADER PRESE "PRESET" PRESE: CLRW X LDW USRNTIB,X LDW X,#TIBB ; "PC_TIB" addr. const. Terminal Input Buffer LDW USRBUFFER,X PRSPP: LDW X,#SPP ; "PC_SPP" addr. const. top of data stack RET ; The text interpreter ; $INTERPRET ( a -- ) ; Interpret a word. If failed, ; try to convert it to an integer. HEADER INTER "$INTERPRET" INTER: CALL NAMEQ CALL YFLAGS ; NA is 0 if undefined JREQ INTE1 LD A,(Y) ; get lexicon bits at NA SLL A ; bit6 is #COMPO JRPL INTE0 CALLR ABORTS ; unconditional abort w/ text .db 13 .ascii " compile only" INTE0: JP EXECU INTE1: CALL NUMBQ ; convert a number CALL QBRAN .dw ABOR1 RET ; COMPILE? ( -- ) ( TOS STM8: - Y,Z,N ) ; 0 if 'EVAL points to $INTERPRETER ; GENALIAS COMPIQ "COMPILE?" COMPIQ: LDW Y,USREVAL SUBW Y,#INTER RET ; STATE? ( -- f ) ; 0 if 'EVAL points to $INTERPRETER ; GENALIAS STATEQ "STATE?" STATEQ: CALLR COMPIQ JP YSTOR ; [ ( -- ) ; Start text interpreter. HEADFLG LBRAC "[" IMEDD LBRAC: LDW Y,#INTER LDW USREVAL,Y RET ; CR ( -- ) ; Output a carriage return ; and a line feed. HEADER CR "CR" CR: .ifeq TERM_LINUX DoLitC CRR CALL [USREMIT] .endif DoLitC LF JP [USREMIT] ; .OK ( -- ) ; Display 'ok' while interpreting. HEADER DOTOK ".OK" DOTOK: CALLR COMPIQ JREQ DOTO1 .ifne HAS_OLDOK JRA CR .else CALL DOTQP ; e4thcom handshake (which also works with ' ok') .db 4 .ascii " OK" .db LF RET .endif .ifeq BAREBONES ; hi ( -- ) ; Display sign-on message. HEADER HI "hi" HI: CALL DOTQP ; initialize I/O .db 18, 10 .ifne PRE_REL .ascii "STM8EF2.2." .db (RELVER1+'0') .db (RELVER0+'0') ; version .ascii ".pre" .db (PRE_REL+'0') .else .ascii "STM8eForth 2.2." .db (RELVER1+'0') .db (RELVER0+'0') ; version .endif ; fall through .else HI: .endif DOTO1: CALL DOTQP .db 4 .ascii " ok" .db 10 RET ; ?STACK ( -- ) ; Abort if stack underflows. HEADER QSTAC "?STACK" QSTAC: CALL DEPTH CALL ZLESS ; check only for underflow CALL ABORQ .db 10 .ascii " underflow" RET ; QUIT ( -- ) ; Reset return stack pointer ; and start text interpreter. HEADER QUIT "QUIT" QUIT: LDW Y,#RPP ; initialize return stack LDW SP,Y ; fall through ; OUTER ( -- n ) ( TOS STM8: - Y,Z,N ) ; Outer interpreter (use EXIT with 2x R-address drop) ; GENALIAS OUTER "OUTER" OUTER: CALLR LBRAC ; start interpretation QUIT2: CALL QUERY ; get input CALLR EVAL JRA QUIT2 ; continue till error ; EVAL ( -- ) ; Interpret input stream. HEADER EVAL "EVAL" EVAL: EVAL1: CALL TOKEN LD A,(Y) JREQ EVAL2 CALL [USREVAL] CALLR QSTAC ; evaluate input, check stack JRA EVAL1 EVAL2: INCW X INCW X JP [USRPROMPT] ; DOTOK or PACE ; The compiler ; ' ( -- ca ) ; Search vocabularies for ; next word in input stream. HEADER TICK "'" TICK: CALL TOKEN CALL NAMEQ CALL YFLAGS ; pop NA JREQ 1$ ; ?defined RET 1$: JP ABOR1 .ifeq REMOVE_BCOMP ; [COMPILE] ( -- ; <string> ) ; Compile next immediate ; word into code dictionary. HEADFLG BCOMP "[COMPILE]" IMEDD BCOMP: CALLR TICK JRA JSRC .endif ; POSTPONE ( -- ) ; postpone the compilation behavior of the next word in the parse area ; this should be sufficent to replace COMPILE and [COMPILE] HEADFLG POSTP "POSTPONE" IMEDD POSTP: .ifne REMOVE_COMPI ; COMPILE ( -- ) ; Ersatz using POSTPONE ; GENALIAS COMPI "COMPILE" IMEDD COMPI: .endif .ifne REMOVE_BCOMP ; [COMPILE] ( -- ) ; Ersatz using POSTPONE ; GENALIAS BCOMP "[COMPILE]" IMEDD BCOMP: .endif CALLR TICK ; Y contains NA (aborts if NA is undefined) TNZ (Y) ; test lexicon bit7 #IMEDD JRMI 1$ ; IMMED flag set -> compile CA/XT as immediate word CALLR LITER ; else: create XT literal DoLitW JSRC ; XT of CALL, 1$: JRA JSRC ; compile XT ; CCOMMALIT ( - ) ; Compile inline literall byte into code dictionary. CCOMMALIT: LDW Y,(1,SP) LD A,(Y) CALLR ACOMMA CSKIPRET: POPW Y JP (1,Y) ; , ( w -- ) ; Compile an integer into ; code dictionary. HEADER COMMA ^/","/ COMMA: LD A,(X) ; MSB CALLR ACOMMA JRA CCOMMA ; LSB ; C, ( c -- ) ; Compile a byte into code dictionary. HEADER CCOMMA ^/"C,"/ CCOMMA: CALL AFLAGS ; fall through ; A, ( A -- ) ; Compile a byte in A into code dictionary. ; GENALIAS ACOMMA "A," ACOMMA: EXGW X,Y LDW X,USRCP LD (X),A INCW X LDW USRCP,X EXGW X,Y RET ; CALL, ( ca -- ) ; Compile a subroutine call. HEADER JSRC ^/"CALL,"/ JSRC: LDW Y,X LDW Y,(Y) .ifne HAS_CPNVM JRMI 1$ ; is the CALL target in ROM? TNZ USRCP JRPL 1$ ; RAM target called from RAM? CALL ABORQ ; RAM called from ROM - that's likely an error .db 7 ; hint: use "C, ," if calling RAM from ROM is really intended .ascii " target" 1$: .endif EXGW X,Y DECW X DECW X SUBW X,USRCP ; XL = <rel> = <target-2-here> LD A,XH EXGW X,Y INC A JRNE 2$ ; YH must be 0xFF LD A,YL TNZ A JRPL 2$ ; YL must be negative LD A,#CALLR_OPC LD YH,A ; replace YH with opcode CALLR LDW (X),Y JRA 3$ 2$: LD A,#CALL_OPC ; opcode CALL CALLR ACOMMA 3$: JRA COMMA ; store absolute address or "CALLR reladdr" ; LITERAL ( w -- ) ; Compile tos to dictionary ; as an integer literal. HEADFLG LITER "LITERAL" IMEDD LITER: .ifne USE_CALLDOLIT ComLit DOLIT .else CALLR CCOMMALIT .db DOLIT_OPC .endif JRA COMMA .ifeq REMOVE_COMPI ; COMPILE ( -- ) ; Compile next jsr in ; colon list to code dictionary. HEADFLG COMPI "COMPILE" COMPO COMPI: EXGW X,Y POPW X LD A,(X) INCW X CP A,#CALL_OPC JRNE COMPIO1 LDW YTEMP,X ; COMPILE CALL address INCW X INCW X PUSHW X LDW X,[YTEMP] JRA COMPIO2 COMPIO1: LD A,(X) ; COMPILE CALLR offset INCW X PUSHW X ; return address CLRW X ; offset i8_t to i16_t TNZ A JRPL 1$ DECW X 1$: LD XL,A ADDW X,(1,SP) ; add offset in X to address of next instruction COMPIO2: CALL XSTOR ; EXGW X,Y and YSTOR JRA JSRC ; compile subroutine .endif ; $," ( -- ) ; Compile a literal string ; up to next " . HEADER STRCQ ^/'$,"'/ STRCQ: DoLitC 34 ; " CALL PARSE CALL HERE CALL PACKS ; string to code dictionary CNTPCPPSTORE: CALL COUNT CALL PLUS ; calculate aligned end of string CALL CPP JP STORE ; Structures .ifeq BOOTSTRAP ; FOR ( -- a ) ; Start a FOR-NEXT loop ; structure in a colon definition. HEADFLG FOR "FOR" IMEDD FOR: ComLitR TOR JP HERE ; NEXT ( a -- ) ; Terminate a FOR-NEXT loop. HEADFLG NEXT "NEXT" IMEDD NEXT: ComLitR DONXT JP COMMA .endif .ifne HAS_DOLOOP ; DO ( n1 n2 -- ) ; Start a DO LOOP loop from n1 to n2 ; structure in a colon definition. HEADFLG DOO "DO" IMEDD DOO: CALL CCOMMALIT .db DOLIT_OPC ; LOOP address cell for usage by LEAVE at runtime CALL ZEROCOMMA ; changes here require an offset adjustment in PLOOP ComLitR TOR ComLitR SWAPP ComLitR TOR JRA FOR ; LOOP ( a -- ) ; Terminate a DO-LOOP loop. HEADFLG LOOP "LOOP" IMEDD LOOP: ComLitR ONE JRA PLOOP ; +LOOP ( a +n -- ) ; Terminate a DO - +LOOP loop. HEADFLG PLOOP "+LOOP" IMEDD PLOOP: ComLitR DOPLOOP CALL HERE CALL OVER ; use mark from DO/FOR, apply negative offset DoLitC 14 CALL SUBB CALL STORE ; patch DO runtime code for LEAVE JP COMMA .endif .ifeq BOOTSTRAP ; BEGIN ( -- a ) ; Start an infinite or ; indefinite loop structure. HEADFLG BEGIN "BEGIN" IMEDD BEGIN: JP HERE ; UNTIL ( a -- ) ; Terminate a BEGIN-UNTIL ; indefinite loop structure. HEADFLG UNTIL "UNTIL" IMEDD UNTIL: ComLitR QBRAN JP COMMA ; COMPILIT ( -- ) ; Compile call to inline literall target address into code dictionary. ; GENALIAS COMPILIT "COMPILIT" COMPILIT: LDW Y,(1,SP) ; address of target literal CALL YAT CALL JSRC POPW Y JP (2,Y) ; AGAIN ( a -- ) ; Terminate a BEGIN-AGAIN ; infinite loop structure. HEADFLG AGAIN "AGAIN" IMEDD AGAIN: CALL CCOMMALIT .db BRAN_OPC JP COMMA ; IF ( -- A ) ; Begin a conditional branch. HEADFLG IFF "IF" IMEDD IFF: ComLitR QBRAN JRA HERE0COMMA ; THEN ( A -- ) ; Terminate a conditional branch structure. HEADFLG THENN "THEN" IMEDD THENN: CALL HERE CALLR SWAPLOC JP STORE ; ELSE ( A -- A ) ; Start the false clause in an IF-ELSE-THEN structure. HEADFLG ELSE "ELSE" IMEDD ELSE: CALLR AHEAD CALLR SWAPLOC JRA THENN ; AHEAD ( -- A ) ; Compile a forward branch instruction. HEADFLG AHEAD "AHEAD" IMEDD AHEAD: CALL CCOMMALIT .db BRAN_OPC HERE0COMMA: CALL HERE .endif ZEROCOMMA: CALL ZERO JP COMMA .ifeq BOOTSTRAP ; WHILE ( a -- A a ) ; Conditional branch out of a BEGIN-WHILE-REPEAT loop. HEADFLG WHILE "WHILE" IMEDD WHILE: CALLR IFF SWAPLOC: JP SWAPP ; REPEAT ( A a -- ) ; Terminate a BEGIN-WHILE-REPEAT indefinite loop. HEADFLG REPEA "REPEAT" IMEDD REPEA: CALLR AGAIN JRA THENN ; AFT ( a -- a A ) ; Jump to THEN in a FOR-AFT-THEN-NEXT loop the first time through. HEADFLG AFT "AFT" IMEDD AFT: CALL DROP CALLR AHEAD CALL HERE JRA SWAPLOC .endif .ifeq BOOTSTRAP ; ABORT" ( -- ; <string> ) ; Conditional abort with an error message. HEADFLG ABRTQ 'ABORT"' IMEDD ABRTQ: ComLit ABORQ JRA STRCQLOC .endif ; $" ( -- ; <string> ) ; Compile an inline string literal. .ifne WORDS_LINKCHAR HEADFLG STRQ '$"' IMEDD .endif STRQ: ComLit STRQP STRCQLOC: JP STRCQ .ifeq BOOTSTRAP ; ." ( -- ; <string> ) ; Compile an inline string literal to be typed out at run time. HEADFLG DOTQ '."' IMEDD DOTQ: ComLit DOTQP JRA STRCQLOC .endif ; Name compiler ; ?UNIQUE ( a -- a ) ; Display a warning message ; if word already exists. HEADER UNIQU "?UNIQUE" UNIQU: CALL DUPP CALL NAMEQ ; "PC_?UNIQUE" patch point for CURRENT CALL QBRAN ; name exists? .dw UNIQ1 CALL DOTQP ; redef are OK .db 7 .ascii " reDef " CALL OVER CALL COUNTTYPES ; just in case UNIQ1: JP DROP ; $,n ( na -- ) ; Build a new dictionary name ; using string at na. HEADER SNAME ^/"$,n"/ SNAME: CALL DUPPCAT ; ?null input CALL QBRAN .dw PNAM1 CALLR UNIQU ; ?redefinition CALL DUPP CALL CNTPCPPSTORE CALL DUPP CALL LAST CALL STORE ; save na for vocabulary link CALL CELLM ; link address CALL CNTXT CALL AT CALL SWAPP JP STORE ; save code pointer PNAM1: CALL STRQP .db 5 .ascii " name" ; null input JP ABOR1 ; FORTH compiler ; $COMPILE ( a -- ) ; Compile next word to ; dictionary as a token or literal. HEADER SCOMP "$COMPILE" SCOMP: CALL NAMEQ CALL YFLAGS ; pop NA JREQ SCOM2 ; is NA undefined? TNZ (Y) ; get lexicon bits (and word string length) JRPL SCOM1 ; test bit7 #IMEDD JP EXECU ; execute CA as immediate word SCOM1: JP JSRC ; else compile XT SCOM2: CALL NUMBQ ; NA undefined: try to convert to number CALL QBRAN .dw ABOR1 JP LITER ; compile literal ; OVERT ( -- ) ; Link a new word into vocabulary. HEADER OVERT "OVERT" OVERT: .ifne HAS_CPNVM LDW Y,USRLAST JRMI 1$ ; check if USRLAST points to NVM LDW USRCONTEXT,Y RET 1$: LDW NVMCONTEXT,Y ; update NVMCONTEXT LDW [USRCTOP],Y ; update link from RAM dictionary RET .else LDW Y,USRLAST LDW USRCONTEXT,Y RET .endif ; ; ( -- ) ; Terminate a colon definition. HEADFLG SEMIS ^/";"/ (IMEDD+COMPO) SEMIS: CALL CCOMMALIT .db EXIT_OPC CALL LBRAC JRA OVERT ; : ( -- ; <string> ) ; Start a new colon definition ; using next word as its name. HEADER COLON ":" COLON: CALLR RBRAC ; do "]" first to set HERE to compile state JP TOKSNAME ; copy token to dictionary ; ] ( -- ) ; Start compiling words in ; input stream. HEADER RBRAC "]" RBRAC: LDW Y,#SCOMP LDW USREVAL,Y RET ; Defining words .ifne HAS_DOES ; DOES> ( -- ) ; Define action of defining words HEADFLG DOESS "DOES>" IMEDD DOESS: ComLit DODOES ; executed by defining word - terminates definition. ComLit THISVAR ; first instruction "this" in "DOES>Body RET ; dodoes ( -- ) ; link action to words created by defining words ; CREATE which must be the first word in a defining word ; GENALIAS DODOES "dodoes" DODOES: ; patch dovar compiled by CREATE CALL RFROM ; RET addr is the target in DOES>Body LD A,#(USRLAST) ; link field of defined word CALLR AAT ; last @ "push n from a at (A) in zero page" CALL NAMET ; get xt of defined CALL ONEP ; skip CALL instruction JP STORE ; make it CALL DOES>Body ; thisvar ( -- a ) ; get the next address of caller, return to the caller's caller ; GENALIAS THISVAR "thisvar" THISVAR: LDW Y,(3,SP) DECW X ; YSTOR DECW X LDW (X),Y POPW Y POP A ; RDROP POP A JP (Y) .endif ; A@ ( A:shortAddr -- n ) ; push contents of A:shortAddr on stack ; GENALIAS AAT "A@" AAT: CLRW Y LD YL,A ; fall through ; Y@ ( Y:Addr -- n ) ; push contents of Y:Addr on stack ; GENALIAS YAT "Y@" YAT: LDW Y,(Y) JP YSTOR ; ENTRY ( -- ; <string> ) ; Compile a new dictionary entry with empty code field ; GENALIAS ENTRY "ENTRY" ENTRY: CALL TOKSNAME ; copy token to dictionary JP OVERT ; CREATE ( -- ; <string> ) ; Compile a new array ; without allocating space. HEADER CREAT "CREATE" CREAT: CALLR ENTRY ComLit DOVAR RET .ifeq UNLINK_CONST ; CONSTANT ( "name" n -- ) ; Create a named constant with state dependant action HEADER CONST "CONSTANT" CONST: CALLR ENTRY ComLit DOCON ; compile action code CALL COMMA ; compile constant ; CALL LBRAC ; CALL OVERT JRA IMMED ; make immediate ; docon ( -- ) ; state dependent action code of constant HEADER DOCON "docon" DOCON: POPW Y CALLR YAT ; R> AT push constant in interpreter mode CALL COMPIQ JREQ 1$ CALL LITER ; compile constant in compiler mode 1$: RET .endif .ifne HAS_VARIABLE ; VARIABLE ( -- ; <string> ) ; Compile a new variable ; initialized to 0. HEADER VARIA "VARIABLE" VARIA: CALL ZERO .ifne HAS_CPNVM TNZ USRCP JRPL 1$ ; NVM: allocate space in RAM CALLR ENTRY ComLit DOVARPTR LDW Y,USRVAR LDW (X),Y ; overwrite ZERO with RAM address for COMMA DoLitC 2 ; Allocate space for variable in RAM CALLR ALLOT JRA 2$ .endif 1$: CALLR CREAT 2$: JP COMMA .endif .ifne HAS_VARIABLE ; ALLOT ( n -- ) ; Allocate n bytes to code DICTIONARY. HEADER ALLOT "ALLOT" ALLOT: CALL CPP .ifne HAS_CPNVM TNZ USRCP JRPL 1$ ; NVM: allocate space in RAM LD A,#(USRVAR) LD (1,X),A 1$: .endif JP PSTOR .endif ; Tools ; IMMEDIATE ( -- ) ; Make last compiled word ; an immediate word. HEADER IMMED "IMMEDIATE" IMMED: LD A,[USRLAST] OR A,#IMEDD LD [USRLAST],A RET DUPPCAT: CALL DUPP JP CAT .ifeq BOOTSTRAP ; _TYPE ( b u -- ) ; Display a string. Filter ; non-printing characters. HEADER UTYPE "_TYPE" UTYPE: CALL TOR ; start count down loop JRA UTYP2 ; skip first pass UTYP1: CALLR DUPPCAT CALL TCHAR CALL [USREMIT] ; display only printable CALL ONEP ; increment address UTYP2: CALL DONXT .dw UTYP1 ; loop till done JP DROP .endif .ifeq REMOVE_DUMP ; dm+ ( a u -- a ) ; Dump u bytes from , ; leaving a+u on stack. HEADER DUMPP "dm+" DUMPP: CALL OVER DoLitC 4 CALL UDOTR ; display address CALL SPACE CALL TOR ; start count down loop JRA PDUM2 ; skip first pass PDUM1: CALLR DUPPCAT DoLitC 3 CALL UDOTR ; display numeric data CALL ONEP ; increment address PDUM2: CALL DONXT .dw PDUM1 ; loop till done RET .endif .ifeq REMOVE_DUMP ; DUMP ( a u -- ) ; Dump u bytes from a, ; in a formatted manner. HEADER DUMP "DUMP" DUMP: PUSH USRBASE+1 ; BASE AT TOR save radix CALL HEX ; leaves 16 in A CALL YFLAGS DIV Y,A ; / change count to lines PUSHW Y ; start count down loop DUMP1: CALL CR DoLitC 16 CALL DDUP CALLR DUMPP ; display numeric CALL ROT CALL ROT CALL SPACE CALL SPACE CALLR UTYPE ; display printable characters CALL DONXT .dw DUMP1 ; loop till done DUMP3: POP A LD USRBASE+1,A ; restore radix JP DROP .endif .ifeq REMOVE_DOTS ; .S ( ... -- ... ) ; Display contents of stack. HEADER DOTS ".S" DOTS: CALL CR CALL DEPTH ; stack depth CALL TOR ; start count down loop JRA DOTS2 ; skip first pass DOTS1: CALL RAT CALL PICK CALL DOT ; index stack, display contents DOTS2: CALL DONXT .dw DOTS1 ; loop till done CALL DOTQP .db 5 .ascii " <sp " RET .endif .ifeq BOOTSTRAP ; .ID ( na -- ) ; Display name at address. HEADER DOTID ".ID" DOTID: CALL QDQBRAN ; if zero no name .dw DOTI1 CALL COUNT DoLitC 0x01F CALL ANDD ; mask lexicon bits JP UTYPE DOTI1: CALL DOTQP .db 9 .ascii " (noName)" RET .endif .ifeq REMOVE_TNAME ; >NAME ( ca -- na | F ) ; Convert code address ; to a name address. HEADER TNAME ">NAME" TNAME: CALL CNTXT ; vocabulary link TNAM2: CALL AT ; ?last word in a vocabulary JREQ TNAM4 ; DUPP QBRAN TNAM4 CALL DDUP CALL NAMET CALL XORR ; compare CALL QBRAN .dw TNAM3 CALL CELLM ; continue with next word JRA TNAM2 TNAM3: JP NIP TNAM4: INCW X ; DDROP INCW X CLR (X) ; ZERO CLR (1,X) RET .endif .ifeq UNLINKCORE ; WORDS ( -- ) ; Display names in vocabulary. HEADER WORDS "WORDS" WORDS: CALL CR CALL CNTXT_ALIAS ; only in context WORS1: CALL AT ; @ sets Z and N JREQ 1$ ; ?at end of list CALL DUPP CALL SPACE ; "PC_WORDS" patch point for CURRENT CALL DOTID ; display a name CALL CELLM JRA WORS1 1$: JP DROP .endif ;=============================================================== .ifne WORDS_EXTRASTACK ; SP! ( a -- ) ; Set data stack pointer. HEADER SPSTO "sp!" SPSTO: LDW X,(X) ;X = a RET ; SP@ ( -- a ) ( TOS STM8: -- Y,Z,N ) ; Push current stack pointer. HEADER SPAT "sp@" SPAT: LDW Y,X JP YSTOR ; RP@ ( -- a ) ( TOS STM8: -- Y,Z,N ) ; Push current RP to data stack. HEADER RPAT "rp@" RPAT: LDW Y,SP ; save return addr JP YSTOR ; RP! ( a -- ) ; Set return stack pointer. HEADFLG RPSTO "rp!" COMPO RPSTO: POPW Y LDW YTEMP,Y CALL YFLAGS ; fixed error: TOS not consumed LDW SP,Y JP [YTEMP] .endif ;=============================================================== .ifne WORDS_EXTRAEEPR ; ULOCK ( -- ) ; Unlock EEPROM (STM8S) HEADER ULOCK "ULOCK" ULOCK: MOV FLASH_DUKR,#0xAE MOV FLASH_DUKR,#0x56 1$: BTJF FLASH_IAPSR,#3,1$ ; PM0051 4.1 requires polling bit3=1 before writing RET ; LOCK ( -- ) ; Lock EEPROM (STM8S) HEADER LOCK "LOCK" LOCK: BRES FLASH_IAPSR,#3 RET .endif .ifne HAS_CPNVM ; ULOCKF ( -- ) ; Unlock Flash (STM8S) HEADER UNLOCK_FLASH "ULOCKF" UNLOCK_FLASH: MOV FLASH_PUKR,#0x56 MOV FLASH_PUKR,#0xAE 1$: BTJF FLASH_IAPSR,#1,1$ ; PM0051 4.1 requires polling bit1=1 before writing RET ; LOCKF ( -- ) ; Lock Flash (STM8S) HEADER LOCK_FLASH "LOCKF" LOCK_FLASH: BRES FLASH_IAPSR,#1 RET ; Helper routine: swap USRCP and NVMCP SWAPCP: LDW X,USRCP MOV USRCP,NVMCP MOV USRCP+1,NVMCP+1 LDW NVMCP,X EXGW X,Y RET ; NVM ( -- ) ; Compile to NVM (enter mode NVM) HEADER NVMM "NVM" NVMM: TNZ USRCP JRMI 1$ ; state entry action? ; in NVM mode only link words in NVM EXGW X,Y LDW X,NVMCONTEXT LDW USRLAST,X CALLR SWAPCP CALLR UNLOCK_FLASH 1$: RET ; RAM ( -- ) ; Compile to RAM (enter mode RAM) HEADER RAMM "RAM" RAMM: TNZ USRCP JRPL 1$ EXGW X,Y LDW X,USRVAR LDW COLDCTOP,X LDW X,USRCP LDW COLDNVMCP,X LDW X,NVMCONTEXT LDW COLDCONTEXT,X LDW X,USRCONTEXT LDW USRLAST,X CALLR SWAPCP ; Switch back to mode RAM CALLR LOCK_FLASH 1$: RET ; RESET ( -- ) ; Reset Flash dictionary and 'BOOT to defaults and restart HEADER RESETT "RESET" RESETT: CALLR UNLOCK_FLASH DoLitW UDEFAULTS DoLitW UBOOT DoLitC (ULAST-UBOOT) CALL CMOVE ; initialize user area CALLR LOCK_FLASH JP COLD ; SAVEC ( -- ) ; Minimal context switch for low level interrupt code ; This should be the first word called in the interrupt handler HEADER SAVEC "SAVEC" SAVEC: POPW Y LDW X,YTEMP PUSHW X LDW X,#ISPP ; "PC_ISPP" const. top of int. data stack JP (Y) ; IRET ( -- ) ; Restore context and return from low level interrupt code ; This should be the last word called in the interrupt handler HEADER RESTC "IRET" RESTC: POPW X ; discard CALL return address POPW X LDW YTEMP,X ; restore context IRET ; resturn from interrupt .endif ; WIPE ( -- ) ( TOS STM8: - ) ; Return to RAM mode, claim VARIABLE RAM, init dictionary in RAM HEADER WIPE "WIPE" WIPE: .ifeq HAS_CPNVM JP OVERT ; initialize CONTEXT from USRLAST .else CALLR RAMM PUSHW X LDW X,COLDCTOP ; reserve some space for user variable LDW USRVAR,X ADDW X,#RAM_VARIABLE LDW USRCTOP,X ; store new CTOP LDW Y,COLDCONTEXT LDW NVMCONTEXT,Y LDW (X),Y ; create dummy word in RAM ... INCW X INCW X CLR (X) ; ... with NULL string LDW USRLAST,X ; prepare OVERT INCW X LDW USRCP,X ; done POPW X JP OVERT ; initialize CONTEXT from USRLAST .endif ;=============================================================== LASTN = LINK ;last name defined END_SDCC_FLASH = . .area CODE .area INITIALIZER .area CABS (ABS)
DanaPhoneCalleeScript: gettrainername STRING_BUFFER_3, LASS, DANA1 checkflag ENGINE_DANA iftrue .WantsBattle farscall PhoneScript_AnswerPhone_Female checkflag ENGINE_DANA_THURSDAY_NIGHT iftrue .NotThursday checkflag ENGINE_DANA_HAS_THUNDERSTONE iftrue .HasThunderstone readvar VAR_WEEKDAY ifnotequal THURSDAY, .NotThursday checktime NITE iftrue DanaThursdayNight .NotThursday: farsjump UnknownScript_0xa0978 .WantsBattle: getlandmarkname STRING_BUFFER_5, ROUTE_101 farsjump UnknownScript_0xa0a78 .HasThunderstone: getlandmarkname STRING_BUFFER_5, ROUTE_101 farsjump UnknownScript_0xa0acd DanaPhoneCallerScript: gettrainername STRING_BUFFER_3, LASS, DANA1 farscall PhoneScript_GreetPhone_Female checkflag ENGINE_DANA iftrue .Generic checkflag ENGINE_DANA_THURSDAY_NIGHT iftrue .Generic checkflag ENGINE_DANA_HAS_THUNDERSTONE iftrue .Generic farscall PhoneScript_Random3 ifequal 0, DanaWantsBattle checkevent EVENT_DANA_GAVE_THUNDERSTONE iftrue .Thunderstone farscall PhoneScript_Random2 ifequal 0, DanaHasThunderstone .Thunderstone: farscall PhoneScript_Random11 ifequal 0, DanaHasThunderstone .Generic: farscall PhoneScript_Random3 ifequal 0, DanaFoundRare farsjump Phone_GenericCall_Female DanaThursdayNight: setflag ENGINE_DANA_THURSDAY_NIGHT DanaWantsBattle: getlandmarkname STRING_BUFFER_5, ROUTE_101 setflag ENGINE_DANA farsjump PhoneScript_WantsToBattle_Female DanaFoundRare: farsjump Phone_CheckIfUnseenRare_Female DanaHasThunderstone: setflag ENGINE_DANA_HAS_THUNDERSTONE getlandmarkname STRING_BUFFER_5, ROUTE_101 farsjump PhoneScript_FoundItem_Female
// Muvium Leros AOT Compiler // Java Source: Hello // first instruction is not executed nop // // second instruction is executed twice // ****************************************************** // MEMORY MODEL // ****************************************************** // Static Fields R5 to R24 // FRAME ROOT // Local Refs R25 to R29 // Local Lits R30 to R49 // Operand Stack R50 to R65 // FRAME METHODCALL // Local Refs R66 to R70 // Local Lits R71 to R90 // Operand Stack R91 to R106 // ****************************************************** // run() branch run Start: run: Label15080: // PushIntegerLiteral load 72 // Load Constant store r51 // Store to Local // wr( address, value ) //(peephole)load r51 // Native.wr address=3 out 3 // peep_iconst_istore_n load 0 // Load Constant store r30 // Store to Local Label15104: // ILOAD //(peephole)load r30 // Load local literal slot store r51 // Push onto Stack // PushIntegerLiteral load 0 // Load Int 16bit Constant LSB loadh 125 // Load Int 16bit Constant MSB store r53 // Push Literal Int onto Stack // if_icmpge //(peephole)load r53 // load previus topmost sub r51 // sub topmost nop // wait branch delay1 nop // wait branch delay2 brn Label15128 // if greater than // peep_iconst_istore_n load 0 // Load Constant store r32 // Store to Local Label15138: // ILOAD //(peephole)load r32 // Load local literal slot store r51 // Push onto Stack // PushIntegerLiteral load 200 // Load Int 16bit Constant LSB loadh 0 // Load Int 16bit Constant MSB store r53 // Push Literal Int onto Stack // if_icmpge //(peephole)load r53 // load previus topmost sub r51 // sub topmost nop // wait branch delay1 nop // wait branch delay2 brn Label15162 // if greater than // IINC load 1 // Inc local by add r32 // Add to local store r32 // Store Back to Local branch Label15138 // GOTO Label15162: // IINC load 1 // Inc local by add r30 // Add to local store r30 // Store Back to Local branch Label15104 // GOTO Label15128: // PushIntegerLiteral load 87 // Load Constant store r51 // Store to Local // wr( address, value ) //(peephole)load r51 // Native.wr address=3 out 3 // peep_iconst_istore_n load 0 // Load Constant store r30 // Store to Local Label15206: // ILOAD //(peephole)load r30 // Load local literal slot store r51 // Push onto Stack // PushIntegerLiteral load 0 // Load Int 16bit Constant LSB loadh 125 // Load Int 16bit Constant MSB store r53 // Push Literal Int onto Stack // if_icmpge //(peephole)load r53 // load previus topmost sub r51 // sub topmost nop // wait branch delay1 nop // wait branch delay2 brn Label15224 // if greater than // peep_iconst_istore_n load 0 // Load Constant store r32 // Store to Local Label15230: // ILOAD //(peephole)load r32 // Load local literal slot store r51 // Push onto Stack // PushIntegerLiteral load 200 // Load Int 16bit Constant LSB loadh 0 // Load Int 16bit Constant MSB store r53 // Push Literal Int onto Stack // if_icmpge //(peephole)load r53 // load previus topmost sub r51 // sub topmost nop // wait branch delay1 nop // wait branch delay2 brn Label15248 // if greater than // IINC load 1 // Inc local by add r32 // Add to local store r32 // Store Back to Local branch Label15230 // GOTO Label15248: // IINC load 1 // Inc local by add r30 // Add to local store r30 // Store Back to Local branch Label15206 // GOTO Label15224: branch Label15080 // GOTO
#include <catboost/cuda/cuda_util/segmented_sort.h> using namespace NKernelHost; namespace NCudaLib { REGISTER_KERNEL_TEMPLATE_2(0xAB0001, TSegmentedRadixSortKernel, ui32, ui32); }
@0 D=A @R0 A=M M=D @R0 M=M+1 @R0 M=M-1 @R1 D=M @0 D=D+A @R13 M=D @R0 A=M D=M @R13 A=M M=D ($LOOP_START) @R2 D=M @0 D=D+A A=D D=M @R0 A=M M=D @R0 M=M+1 @R1 D=M @0 D=D+A A=D D=M @R0 A=M M=D @R0 M=M+1 @R0 M=M-1 A=M D=M @R0 M=M-1 A=M M=D+M @R0 M=M+1 @R0 M=M-1 @R1 D=M @0 D=D+A @R13 M=D @R0 A=M D=M @R13 A=M M=D @R2 D=M @0 D=D+A A=D D=M @R0 A=M M=D @R0 M=M+1 @1 D=A @R0 A=M M=D @R0 M=M+1 @R0 M=M-1 A=M D=M @R0 M=M-1 A=M M=M-D @R0 M=M+1 @R0 M=M-1 @R2 D=M @0 D=D+A @R13 M=D @R0 A=M D=M @R13 A=M M=D @R2 D=M @0 D=D+A A=D D=M @R0 A=M M=D @R0 M=M+1 @R0 AM=M-1 D=M @$LOOP_START D;JNE @R1 D=M @0 D=D+A A=D D=M @R0 A=M M=D @R0 M=M+1
BITS 64 ;TEST_FILE_META_BEGIN ;TEST_TYPE=TEST_F ;TEST_IGNOREFLAGS= ;TEST_FILE_META_END ; Sbb32RI ;TEST_BEGIN_RECORDING sbb eax, 0x44 sbb ecx, 0x43 ;TEST_END_RECORDING
dnl x86 mpn_gcd_1 optimised for processors with fast BSF. dnl Based on the K7 gcd_1.asm, by Kevin Ryde. Rehacked by Torbjorn Granlund. dnl Copyright 2000-2002, 2005, 2009, 2011, 2012 Free Software Foundation, Inc. dnl This file is part of the GNU MP Library. dnl dnl The GNU MP Library is free software; you can redistribute it and/or modify dnl it under the terms of either: dnl dnl * the GNU Lesser General Public License as published by the Free dnl Software Foundation; either version 3 of the License, or (at your dnl option) any later version. dnl dnl or dnl dnl * the GNU General Public License as published by the Free Software dnl Foundation; either version 2 of the License, or (at your option) any dnl later version. dnl dnl or both in parallel, as here. dnl dnl The GNU MP Library is distributed in the hope that it will be useful, but dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License dnl for more details. dnl dnl You should have received copies of the GNU General Public License and the dnl GNU Lesser General Public License along with the GNU MP Library. If not, dnl see https://www.gnu.org/licenses/. include(`../config.m4') C cycles/bit (approx) C AMD K7 7.80 C AMD K8,K9 7.79 C AMD K10 4.08 C AMD bd1 ? C AMD bobcat 7.82 C Intel P4-2 14.9 C Intel P4-3/4 14.0 C Intel P6/13 5.09 C Intel core2 4.22 C Intel NHM 5.00 C Intel SBR 5.00 C Intel atom 17.1 C VIA nano ? C Numbers measured with: speed -CD -s16-32 -t16 mpn_gcd_1 C Threshold of when to call bmod when U is one limb. Should be about C (time_in_cycles(bmod_1,1) + call_overhead) / (cycles/bit). define(`BMOD_THRES_LOG2', 6) define(`up', `%edi') define(`n', `%esi') define(`v0', `%edx') ASM_START() TEXT ALIGN(16) PROLOGUE(mpn_gcd_1) push %edi push %esi mov 12(%esp), up mov 16(%esp), n mov 20(%esp), v0 mov (up), %eax C U low limb or v0, %eax bsf %eax, %eax C min(ctz(u0),ctz(v0)) bsf v0, %ecx shr %cl, v0 push %eax C preserve common twos over call push v0 C preserve v0 argument over call cmp $1, n jnz L(reduce_nby1) C Both U and V are single limbs, reduce with bmod if u0 >> v0. mov (up), %ecx mov %ecx, %eax shr $BMOD_THRES_LOG2, %ecx cmp %ecx, v0 ja L(reduced) jmp L(bmod) L(reduce_nby1): cmp $BMOD_1_TO_MOD_1_THRESHOLD, n jl L(bmod) ifdef(`PIC_WITH_EBX',` push %ebx call L(movl_eip_to_ebx) add $_GLOBAL_OFFSET_TABLE_, %ebx ') push v0 C param 3 push n C param 2 push up C param 1 CALL( mpn_mod_1) jmp L(called) L(bmod): ifdef(`PIC_WITH_EBX',`dnl push %ebx call L(movl_eip_to_ebx) add $_GLOBAL_OFFSET_TABLE_, %ebx ') push v0 C param 3 push n C param 2 push up C param 1 CALL( mpn_modexact_1_odd) L(called): add $12, %esp C deallocate params ifdef(`PIC_WITH_EBX',`dnl pop %ebx ') L(reduced): pop %edx bsf %eax, %ecx C test %eax, %eax C FIXME: does this lower latency? jnz L(mid) jmp L(end) ALIGN(16) C K10 BD C2 NHM SBR L(top): cmovc( %esi, %eax) C if x-y < 0 0,3 0,3 0,6 0,5 0,5 cmovc( %edi, %edx) C use x,y-x 0,3 0,3 2,8 1,7 1,7 L(mid): shr %cl, %eax C 1,7 1,6 2,8 2,8 2,8 mov %edx, %esi C 1 1 4 3 3 sub %eax, %esi C 2 2 5 4 4 bsf %esi, %ecx C 3 3 6 5 5 mov %eax, %edi C 2 2 3 3 4 sub %edx, %eax C 2 2 4 3 4 jnz L(top) C L(end): pop %ecx mov %edx, %eax shl %cl, %eax pop %esi pop %edi ret ifdef(`PIC_WITH_EBX',`dnl L(movl_eip_to_ebx): mov (%esp), %ebx ret ') EPILOGUE()
;/*! ; @file ; ; @ingroup fapi ; ; @brief DosCLIAccess DOS wrapper ; ; (c) osFree Project 2018, <http://www.osFree.org> ; for licence see licence.txt in root directory, or project website ; ; This is Family API implementation for DOS, used with BIND tools ; to link required API ; ; @author Yuri Prokushev (yuri.prokushev@gmail.com) ; ; ; ;*/ .8086 ; Helpers INCLUDE HELPERS.INC _TEXT SEGMENT BYTE PUBLIC 'CODE' USE16 @PROLOG DOSCLIACCESS @START DOSCLIACCESS XOR AX, AX EXIT: @EPILOG DOSCLIACCESS _TEXT ENDS END
;Rutinas de operaciones basicas con numeros de 16,24 y 32 bits. VAR1 .EQU 090h VAR2 .equ 094h Inicio: LD HL,VAR1 ;Cargamos la direcion del primer numero en HL ;LD DE,VAR2 ;Cargamos la direcion del segundo numero en DE CALL CPL16 ;Hacemos la resta (VAR1)=(DE)-(HL) HALT JP FIN ;///////////////////////////////////////////////////////////// ;Rutinas para complementar numeros de 16,24 y 32 bits ;La direccion del dato a complementar se debe guardar en HL ; ; ; ;Ejemplo ; LD HL,VAR1 ;Cargamos el apuntador a la variable en HL ; CALL CPL16 ;Complementamos el contenido de la variable ; ;(VAR1)= !(VAR1) CPL16: LD B,2 JP CPL_ CPL24: LD B,3 JP CPL_ CPL32: LD B,4 JP CPL_ CPL_ LD A,(HL) CPL LD (HL),A INC HL DJNZ CPL_ RET ;///////////////////////////////////////////////////////////// ;///////////////////////////////////////////////////////////// ;Rutinas para incrementar numeros de 16,24 y 32 bits ;La direccion del dato a incrementar se debe guardar en HL ; ; ; ;Ejemplo ; LD HL,VAR1 ;Cargamos el apuntador a la variable en HL ; CALL INC16 ;Incrementamos el contenido de la variable ; ; (VAR1)= (VAR1)+1 INC16: LD B,2 JP INC_ INC24: LD B,3 JP INC_ INC32: LD B,4 JP INC_ INC_ LD A,0FFh INC A CINC_: LD A,(HL) ADC A,0 LD (HL),A INC HL DJNZ CINC_ RET ;///////////////////////////////////////////////////////////// ;///////////////////////////////////////////////////////////// ;Rutinas para sumar numeros de 16,24 y 32 bits ;Las direcciones de los datos a sumar se deben guardar ;en HL y DE, y el resultado se guarda en al direccion de la ;variable asignada a HL ; ;Ejemplo ; LD DE,VAR1 ;Cargamos el apuntador a la variable 1 en DE ; LD HL,VAR2 ;Cargamos el apuntador a la variable 2 en HL ; CALL SUMA32 ; (VAR2)=(HL)+(DE) SUMA16: LD B,2 JP SUMA_ SUMA24: LD B,3 JP SUMA_ SUMA32: LD B,4 JP SUMA_ SUMA_: OR A CSUMA_: LD A,(DE) ADC A,(HL) LD (HL),A INC DE INC HL DJNZ CSUMA_ RET ;///////////////////////////////////////////////////////////// ;///////////////////////////////////////////////////////////// ;Rutinas para restar numeros de 16,24 y 32 bits ;Las direcciones de los datos a restar se deben guardar ;en HL y DE, y el resultado se guarda en al direccion de la ;variable asignada a HL. Se realiza [(HL)=(DE)-(HL)] ; ;Ejemplo ; LD DE,VAR1 ;Cargamos el apuntador a la variable 1 en DE ; LD HL,VAR2 ;Cargamos el apuntador a la variable 1 en DE ; CALL RESTA32 ;Hacemos la resta (VAR2)=(DE)-(HL) RESTA16: LD B,2 JP RESTA_ RESTA24: LD B,3 JP RESTA_ RESTA32: LD B,4 JP RESTA_ RESTA_: OR A CRES_: LD A,(DE) SBC A,(HL) LD (HL),A INC DE INC HL DJNZ CRES_ RET ;///////////////////////////////////////////////////////////// FIN: HALT
; A212329: Expansion of x*(5+x)/(1-7*x+7*x^2-x^3). ; 0,5,36,217,1272,7421,43260,252145,1469616,8565557,49923732,290976841,1695937320,9884647085,57611945196,335787024097,1957110199392,11406874172261,66484134834180,387497934832825,2258503474162776,13163522910143837,76722633986700252,447172281010057681,2606311052073645840,15190694031431817365,88537853136517258356,516036424787671732777,3007680695589513138312,17530047748749407097101,102172605796906929444300,595505587032692169568705,3470860916399246087967936,20229659911362784358238917,117907098551777460061465572,687212931399301976010554521,4005370489844034396001861560,23345010007664904400000614845,136064689556145392004001827516,793043127329207447624010350257,4622194074419099293740060274032,26940121319185388314816351293941,157018533840693230595158047489620,915171081724973995256131933643785,5334007956509150740941633554373096,31088876657329930450393669392594797,181199251987470431961420382801195692 mov $1,3 mov $2,2 lpb $0 sub $0,1 add $2,$1 add $1,$2 add $1,$2 add $2,$1 lpe sub $1,3 div $1,2 mov $0,$1
// Copyright 2016 PDFium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com #include "fpdfsdk/cfx_systemhandler.h" #include <memory> #include "core/fpdfapi/fpdf_parser/cpdf_document.h" #include "core/fxge/cfx_fontmapper.h" #include "core/fxge/cfx_fontmgr.h" #include "core/fxge/cfx_gemodule.h" #include "fpdfsdk/cpdfsdk_annot.h" #include "fpdfsdk/cpdfsdk_document.h" #include "fpdfsdk/cpdfsdk_environment.h" #include "fpdfsdk/cpdfsdk_pageview.h" #include "fpdfsdk/cpdfsdk_widget.h" #include "fpdfsdk/formfiller/cffl_formfiller.h" namespace { int CharSet2CP(int charset) { if (charset == FXFONT_SHIFTJIS_CHARSET) return 932; if (charset == FXFONT_GB2312_CHARSET) return 936; if (charset == FXFONT_HANGUL_CHARSET) return 949; if (charset == FXFONT_CHINESEBIG5_CHARSET) return 950; return 0; } } // namespace void CFX_SystemHandler::InvalidateRect(CPDFSDK_Widget* widget, FX_RECT rect) { CPDFSDK_PageView* pPageView = widget->GetPageView(); UnderlyingPageType* pPage = widget->GetUnderlyingPage(); if (!pPage || !pPageView) return; CFX_Matrix page2device; pPageView->GetCurrentMatrix(page2device); CFX_Matrix device2page; device2page.SetReverse(page2device); FX_FLOAT left; FX_FLOAT top; FX_FLOAT right; FX_FLOAT bottom; device2page.Transform(static_cast<FX_FLOAT>(rect.left), static_cast<FX_FLOAT>(rect.top), left, top); device2page.Transform(static_cast<FX_FLOAT>(rect.right), static_cast<FX_FLOAT>(rect.bottom), right, bottom); CFX_FloatRect rcPDF(left, bottom, right, top); rcPDF.Normalize(); m_pEnv->Invalidate(pPage, rcPDF.left, rcPDF.top, rcPDF.right, rcPDF.bottom); } void CFX_SystemHandler::OutputSelectedRect(CFFL_FormFiller* pFormFiller, CFX_FloatRect& rect) { if (!pFormFiller) return; CFX_FloatPoint leftbottom = CFX_FloatPoint(rect.left, rect.bottom); CFX_FloatPoint righttop = CFX_FloatPoint(rect.right, rect.top); CFX_FloatPoint ptA = pFormFiller->PWLtoFFL(leftbottom); CFX_FloatPoint ptB = pFormFiller->PWLtoFFL(righttop); CPDFSDK_Annot* pAnnot = pFormFiller->GetSDKAnnot(); UnderlyingPageType* pPage = pAnnot->GetUnderlyingPage(); ASSERT(pPage); m_pEnv->OutputSelectedRect(pPage, ptA.x, ptB.y, ptB.x, ptA.y); } bool CFX_SystemHandler::IsSelectionImplemented() const { if (!m_pEnv) return false; FPDF_FORMFILLINFO* pInfo = m_pEnv->GetFormFillInfo(); return pInfo && pInfo->FFI_OutputSelectedRect; } void CFX_SystemHandler::SetCursor(int32_t nCursorType) { m_pEnv->SetCursor(nCursorType); } bool CFX_SystemHandler::FindNativeTrueTypeFont(CFX_ByteString sFontFaceName) { CFX_FontMgr* pFontMgr = CFX_GEModule::Get()->GetFontMgr(); if (!pFontMgr) return false; CFX_FontMapper* pFontMapper = pFontMgr->GetBuiltinMapper(); if (!pFontMapper) return false; if (pFontMapper->m_InstalledTTFonts.empty()) pFontMapper->LoadInstalledFonts(); for (const auto& font : pFontMapper->m_InstalledTTFonts) { if (font.Compare(sFontFaceName.AsStringC())) return true; } return false; } CPDF_Font* CFX_SystemHandler::AddNativeTrueTypeFontToPDF( CPDF_Document* pDoc, CFX_ByteString sFontFaceName, uint8_t nCharset) { if (!pDoc) return nullptr; std::unique_ptr<CFX_Font> pFXFont(new CFX_Font); pFXFont->LoadSubst(sFontFaceName, TRUE, 0, 0, 0, CharSet2CP(nCharset), false); return pDoc->AddFont(pFXFont.get(), nCharset, FALSE); } int32_t CFX_SystemHandler::SetTimer(int32_t uElapse, TimerCallback lpTimerFunc) { return m_pEnv->SetTimer(uElapse, lpTimerFunc); } void CFX_SystemHandler::KillTimer(int32_t nID) { m_pEnv->KillTimer(nID); } bool CFX_SystemHandler::IsSHIFTKeyDown(uint32_t nFlag) const { return !!m_pEnv->IsSHIFTKeyDown(nFlag); } bool CFX_SystemHandler::IsCTRLKeyDown(uint32_t nFlag) const { return !!m_pEnv->IsCTRLKeyDown(nFlag); } bool CFX_SystemHandler::IsALTKeyDown(uint32_t nFlag) const { return !!m_pEnv->IsALTKeyDown(nFlag); }
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Copyright (c) GeoWorks 1992 -- All Rights Reserved PROJECT: PC GEOS MODULE: Icon Editor FILE: documentToken.asm AUTHOR: Steve Yegge, Mar 17, 1993 ROUTINES: Name Description ---- ----------- DBViewerImportTokenDatabase Top-level routine for importing tokens ImportSelectedTokens Imports all graphical tokens into database MakeIconFromToken Adds an icon given a position in the token.db MakeFormatFromToken Creates a format from a specific moniker GetVisMonikerHeader Returns VisMonikerListEntryType for moniker GetTokenMonikerByPosition Gets a gstring moniker from a token VisMonikerToHugeBitmap Puts a VisMoniker in the BMO, basically. GetTokenCharsByPosition Gets token chars from offset into token.db UpdateProgressDialog Updates the percent-complete progress dialog IconUpdateTokenViewer Re-scans the token.db for the dynamic list IconSelectAllTokens User selects all tokens at once using trigger IconSelectTokenFromList Sets "TokenDBNumSelected" genValue IconTokenListGetItemMoniker Returns a moniker for the dynamic list IconGetAppToken Shows the moniker for the selected app. UpdateDialogMoniker Utility routine for setting the moniker. DBViewerChangeAppToken Top-level routine for installing a token GetTokenCharsFromFileSelector Returns token characters for current selection FillInMonikerList Makes a moniker list from an icon MakeMonikerFromFormat Creates a vis-moniker from an icon format StoreMonikerInList Stores passed moniker in passed moniker-list REVISION HISTORY: Name Date Description ---- ---- ----------- stevey 3/17/93 Initial revision DESCRIPTION: Routines for viewing & importing tokens from token_da.000 $Id: documentToken.asm,v 1.1 97/04/04 16:05:55 newdeal Exp $ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ idata segment rootString char "\\",0 idata ends TokenCode segment resource COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DBViewerImportTokenDatabase %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Gets selected graphical tokens and sticks them in the current icon database. CALLED BY: MSG_DB_VIEWER_IMPORT_TOKEN_DATABASE PASS: *ds:si = DBViewerObject ds:di = DBViewerInstance RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: - initiate the stop-import dialog - make a copy of the current bitmap in BMO - call a routine to import the tokens using the BMO - send the stop-import dialog into hell - recover the old bitmap in BMO REVISION HISTORY: Name Date Description ---- ---- ----------- stevey 11/25/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DBViewerImportTokenDatabase method dynamic DBViewerClass, MSG_DB_VIEWER_IMPORT_TOKEN_DATABASE uses ax, cx, dx, bp .enter mov es:[continueImporting], 1 ; TRUE ; ; Initiate the stop-import dialog. ; push si, di GetResourceHandleNS ImportProgressDialog, bx mov si, offset ImportProgressDialog mov di, mask MF_CALL or mask MF_FIXUP_DS mov ax, MSG_GEN_INTERACTION_INITIATE call ObjMessage pop si, di ; restore DBViewer ; ; Get the current bitmap and save it. ; mov cx, ds:[di].DBVI_bitmapVMFileHandle push si ; save DBViewer mov bx, ds:[LMBH_handle] mov si, offset BMO mov di, mask MF_CALL or mask MF_FIXUP_DS mov ax, MSG_VIS_BITMAP_CREATE_TRANSFER_FORMAT call ObjMessage pop si ; restore DBViewer mov_tr dx, ax ; ^vcx:dx = transfer format ; ; Find out which tokens are selected and import them. ; mov di, ds:[si] add di, ds:[di].Gen_offset push ds:[LMBH_handle], si ; save DBViewer call ImportSelectedTokens ; ; Restore the original bitmap to BMO (it's still in ^vcx:dx). ; pop bx, si ; restore DBViewer call MemDerefDS push si mov si, offset BMO mov di, mask MF_CALL or mask MF_FIXUP_DS mov ax, MSG_VIS_BITMAP_REPLACE_WITH_TRANSFER_FORMAT call ObjMessage pop si mov di, ds:[si] add di, ds:[di].Gen_offset ; ; Free the copy of the old bitmap. ; mov_tr ax, dx ; transfer format clr bp mov bx, ds:[di].DBVI_bitmapVMFileHandle call VMFreeVMChain ; ; Rescan the database to add the new child. ; mov ax, MSG_DB_VIEWER_RESCAN_DATABASE call ObjCallInstanceNoLock ; ; Free any leftover memory handles in the database. ; mov di, ds:[si] add di, ds:[di].DBViewer_offset mov bp, ds:[di].GDI_fileHandle call IdDiscardIconList ; ; Get rid of the stop-import dialog ; GetResourceHandleNS ImportProgressDialog, bx mov si, offset ImportProgressDialog mov di, mask MF_CALL mov cx, IC_DISMISS mov ax, MSG_GEN_GUP_INTERACTION_COMMAND call ObjMessage ; ; Clear the stop-import dialog's percent-progress indicator. ; GetResourceHandleNS ImportProgressValue, bx mov si, offset ImportProgressValue mov di, mask MF_CALL mov ax, MSG_GEN_VALUE_SET_VALUE clr bp clr dx ; integer value call ObjMessage sub sp, size ReplaceVisMonikerFrame mov bp, sp mov dx, size ReplaceVisMonikerFrame mov ss:[bp].RVMF_dataType, VMDT_NULL mov ss:[bp].RVMF_updateMode, VUM_NOW GetResourceHandleNS ImportProgressGlyph, bx mov si, offset ImportProgressGlyph mov di, mask MF_STACK mov ax, MSG_GEN_REPLACE_VIS_MONIKER call ObjMessage add sp, size ReplaceVisMonikerFrame .leave ret DBViewerImportTokenDatabase endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ImportSelectedTokens %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Queries the token-db viewer for selections, and imports them into the active database. CALLED BY: DBViewerImportTokenDatabase PASS: *ds:si = DBViewer object ds:di = DBViewerInstance RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: - get a list of the selections in the TokenDBViewer - loop through the selections, checking to see if the user wants to continue the import process, and if so, converting them to icons and adding them to the current icon database. Also update the progress (stop-import) dialog for each token imported. REVISION HISTORY: Name Date Description ---- ---- ----------- stevey 2/25/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ImportSelectedTokens proc near class DBViewerClass uses ax,bx,cx,dx,si,di,bp,ds .enter ; ; Find out how many selections there are in the viewer. ; push si GetResourceHandleNS TokenDBViewer, bx mov si, offset TokenDBViewer mov di, mask MF_CALL or mask MF_FIXUP_DS mov ax, MSG_GEN_ITEM_GROUP_GET_NUM_SELECTIONS call ObjMessage ; returns in ax pop si ; restore DBViewer tst ax LONG jz done ; don't bother...no selection ; ; Allocate a buffer for the (word-sized) selections. ; mov bp, ax ; bp <- #selections shl ax ; 2 bytes per selection mov cx, ALLOC_DYNAMIC_LOCK call MemAlloc ; bx = handle jc done ; out of memory push bx ; save selection-block mov cx, ax ; segment address clr dx ; cx:dx = buffer ; ; Ask the TokenDBViewer to return its selections in the buffer. ; push si ; save DBViewer GetResourceHandleNS TokenDBViewer, bx mov si, offset TokenDBViewer mov di, mask MF_CALL or mask MF_FIXUP_DS mov ax, MSG_GEN_ITEM_GROUP_GET_MULTIPLE_SELECTIONS call ObjMessage pop si ; restore DBViewer mov di, ds:[si] add di, ds:[di].Gen_offset mov bp, ax ; number of selections mov es, cx ; es:0 = selection list clr cx ; counter tokenLoop: ; ; Now for each selection get the moniker(s) and make an icon. ; We're not using the loop instruction, because we want ; the tokens to be added in the same order as they appear ; in the token database viewer. (So we count up from zero). ; mov ax, es ; save selection segment GetResourceSegmentNS dgroup, es tst es:[continueImporting] ; user bailed? jz doneLoop mov es, ax ; restore selection segment mov bx, cx ; counter shl bx ; word-sized identifiers mov bx, {word} es:[bx] ; bx <- position (selection) call UpdateProgressDialog ; show current moniker call MakeIconFromToken inc cx cmp cx, bp jb tokenLoop doneLoop: ; ; Just for fun we'll put "100" in the progress dialog, so ; the user knows we really finished. ; mov dx, 100 clr cx GetResourceHandleNS ImportProgressValue, bx mov si, offset ImportProgressValue mov di, mask MF_CALL or mask MF_FIXUP_DS mov ax, MSG_GEN_VALUE_SET_VALUE clr bp ; not indeterminate call ObjMessage pop bx ; restore selection-block call MemFree done: .leave ret ImportSelectedTokens endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% MakeIconFromToken %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Adds an icon to the database from a VisMoniker. CALLED BY: DBViewerImportTokenDatabase PASS: *ds:si = DBViewer object bx = token's position in the token database RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: - create a "blank" icon in the current database - attempt to get 3 monikers from the token - for each moniker that gets returned, make a format for it REVISION HISTORY: Name Date Description ---- ---- ----------- stevey 11/25/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ MakeIconFromToken proc near class DBViewerClass uses ax,bx,cx,dx,si,di,bp,es .enter push bx ; store token's position ; ; Make a blank icon and add to icon database. ; mov di, ds:[si] add di, ds:[di].Gen_offset mov bp, ds:[di].GDI_fileHandle clr cx ; no formats for now. call IdAddIcon ; ax = icon number ; ; Set the name in anIconHeader from the token chars. ; mov_tr dx, ax ; dx = icon number call GetTokenCharsByPosition ; ax, bx = chars (4) sub sp, size GeodeToken mov bp, sp ; ss:bp = name buffer mov {word}ss:[bp], ax mov {word}ss:[bp+2], bx clr {byte}ss:[bp+4] mov_tr ax, dx ; ax = icon number mov bx, ss mov dx, bp mov cx, size GeodeToken mov bp, ds:[di].GDI_fileHandle call IdSetIconName add sp, size GeodeToken ; ; Now set the preview colors in the icon (query the selectors). ; call GetPreviewSettings call IdSetPreviewObject call IdSetPreviewColors ; ; Attempt to get 4 monikers from the token. Make formats from ; them (if they exist). ; clr dx ; dl = format counter mov di, ax ; di = icon number pop bx ; restore position call SeeIfWeShouldDoSVGA ; if yes, clears carry jc noSVGA mov cl, SVGA_DISPLAY_TYPE mov ax, BMF_4BIT call MakeFormatFromToken jc noSVGA inc dx noSVGA: mov cl, VGA_DISPLAY_TYPE ; cl = DisplayType mov ax, BMF_4BIT ; ax = BMFormat call MakeFormatFromToken jc noVGA inc dx ; format counter noVGA: mov cl, MCGA_DISPLAY_TYPE mov ax, BMF_MONO ; BMFormat call MakeFormatFromToken jc noMCGA inc dx ; format counter noMCGA: mov cl, CGA_DISPLAY_TYPE mov ax, BMF_MONO ; BMFormat call MakeFormatFromToken jc noCGA inc dl ; format counter noCGA: mov ax, di ; icon number mov bx, dx ; format count call IdSetFormatCount ; done in MakeFormatFromToken ; ; Discard all the memory blocks associated with the new icon. ; (Happily bp is still the file handle, and ax is the icon). ; call IdDiscardIcon ; ; Update the database viewer ; mov ax, MSG_DB_VIEWER_ADD_CHILD call ObjCallInstanceNoLock mov di, ds:[si] add di, ds:[di].DBViewer_offset .leave ret MakeIconFromToken endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SeeIfWeShouldDoSVGA %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Return carry clear if we're importing SVGA monikers. CALLED BY: MakeIconFromToken PASS: nothing RETURN: carry set if no carry clear if yes DESTROYED: nothing PSEUDO CODE/STRATEGY: This routine (and the associated UI in the import-token dialog) is a bit of a hack. At the time of this writing, about half of the super-VGA monikers for GEOS apps are just blanks. When you import them you get a 64x40 blank moniker, which looks terrible. However, we don't really want to make it impossible for the user to get to the SVGA moniker if it exists, so I've put in this option. At some point in the distant future, all GEOS apps will have valid SVGA monikers, GeoManager will display them in SVGA video modes, and I then I will be able to take this option out. REVISION HISTORY: Name Date Description ---- ---- ----------- stevey 5/28/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ SeeIfWeShouldDoSVGA proc near uses ax,bx,cx,dx,si,di,bp .enter ; ; Just get the UI setting, and set the carry accordingly. ; GetResourceHandleNS ImportSVGAMonikersBGroup, bx mov si, offset ImportSVGAMonikersBGroup mov di, mask MF_CALL mov ax, MSG_GEN_BOOLEAN_GROUP_GET_SELECTED_BOOLEANS call ObjMessage test ax, mask ITO_IMPORT_SVGA jz nope clc ; yep jmp short done nope: stc ; nope done: .leave ret SeeIfWeShouldDoSVGA endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% MakeFormatFromToken %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Attempts to create a format in an icon, from a token. CALLED BY: MakeIconFromToken PASS: *ds:si = DBViewer object cl = DisplayType bx = position of token in token.db (gstring tokens only) di = icon number dx = format number ax = BMFormat to set in BMO RETURN: carry set if the moniker didn't exist for the DisplayType DESTROYED: nothing PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- stevey 12/4/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ MakeFormatFromToken proc near class DBViewerClass uses ax,bx,cx,dx,si,di,bp displayType local word push cx bmFormat local word push ax icon local word push di format local word push dx monikerBlock local word monikerChunk local word .enter mov ax, (VMS_ICON shl offset VMSF_STYLE) or \ mask VMSF_GSTRING call GetTokenMonikerByPosition ; ^lcx:dx = moniker LONG jc done ; ; We have the right moniker. Tell the BMO to be color or ; monochrome or whatever. ; mov monikerBlock, cx mov monikerChunk, dx push bp, si ; save locals mov cx, bmFormat mov bx, ds:[LMBH_handle] mov si, offset BMO ; ^lbx:si = vis-bitmap mov di, mask MF_CALL or mask MF_FIXUP_DS mov dx, STANDARD_ICON_DPI ; x resolution mov bp, dx ; y resolution mov ax, MSG_VIS_BITMAP_SET_FORMAT_AND_RESOLUTION call ObjMessage pop bp, si ; restore locals ; ; Convert the moniker to a bitmap and set it in database. ; mov cx, monikerBlock mov dx, monikerChunk ; ^lcx:dx = moniker call VisMonikerToHugeBitmap ; ^vcx:dx = huge bitmap mov ax, icon mov bx, format push bp ; locals mov di, ds:[si] add di, ds:[di].Gen_offset mov bp, ds:[di].GDI_fileHandle push cx ; save bitmap block mov cx, 1 ; create 1 blank format call IdCreateFormats pop cx ; restore bitmap block call IdSetFormat ; save bitmap in format pop bp ; locals ; ; Compute the VisMonikerListEntryType value for the format ; and store it in IF_type. If we don't do this, all our ; effort for importing the moniker from the token database ; is wasted, because the specific UI then can't pick the ; right moniker. ; mov cx, monikerBlock mov dx, monikerChunk mov ax, displayType call GetVisMonikerHeader ; cx = VisMonikerListEntryType push bp ; locals mov ax, icon mov bx, format mov bp, ds:[di].GDI_fileHandle mov dx, 1 ; pass VisMonikerListEntryType call IdSetFormatParameters pop bp ; locals mov bx, monikerBlock call MemFree clc ; return no error done: .leave ret MakeFormatFromToken endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GetVisMonikerHeader %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Returns the VisMonikerListEntryType (for IF_type). CALLED BY: MakeFormatFromToken PASS: ^lcx:dx = VisMoniker al = DisplayType RETURN: cx = VisMonikerListEntryType DESTROYED: nothing PSEUDO CODE/STRATEGY: A VisMonikerListEntryType record is 2 bytes. The low byte is exactly the same as a VisMonikerType record, which is the first byte of a VisMoniker. So we grab that and stick it in the low byte of our VisMonikerListEntryType. The high byte of the VisMonikerListEntryType has 2 fields: VMLET_GS_SIZE (DisplaySize) and VMLET_STYLE (VMStyle). The DisplaySize we can nab from the passed DisplayType. The style field we can assume is VMS_ICON, because the token database doesn't store tool icons, and we're not interested in other kinds. REVISION HISTORY: Name Date Description ---- ---- ----------- stevey 4/11/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ GetVisMonikerHeader proc near uses ax,bx,dx,si,di,bp,ds .enter ; ; First lock the moniker block and get the VisMonikerType. ; mov bp, ax ; save passed DisplayType mov bx, cx call MemLock mov ds, ax mov si, dx ; *ds:si = VisMoniker mov di, ds:[si] ; ds:di = VisMoniker mov cl, ds:[di].VM_type ; initialize low byte call MemUnlock ; ; Set the VMLET_STYLE field. ; mov ch, VMS_ICON ; ; Now get the DisplaySize from the passed DisplayType. ; mov ax, bp ; al = DisplayType andnf al, mask DT_DISP_SIZE ; isolate DisplaySize shr al shr al ornf ch, al ; set the bits .leave ret GetVisMonikerHeader endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GetTokenMonikerByPosition %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Returns moniker for a token based on position in token.db CALLED BY: INTERNAL PASS: bx = position (0-indexed) in token database ax = VisMonikerSearchFlags cl = DisplayType RETURN: ^lcx:dx = moniker carry set if no match, clear otherwise DESTROYED: nothing KNOWN BUGS/SIDE EFFECTS/IDEAS: You have to free the moniker block returned by this routine when you're finished with it or you'll have a nice core leak. PSEUDO CODE/STRATEGY: - get a list of the tokens - index into the list - load the correct token - free the list block REVISION HISTORY: Name Date Description ---- ---- ----------- stevey 11/29/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ GetTokenMonikerByPosition proc near uses ax,bx,si,di,bp,ds position local word push bx searchFlags local word push ax displayType local byte listBlock local hptr monikerBlock local hptr .enter mov displayType, cl ; ; Get a list of the tokens in the token.db file. GString only. ; mov ax, mask TRF_ONLY_GSTRING clr bx call TokenListTokens mov listBlock, bx call MemLock mov ds, ax ; ds:0 = token list mov ax, size GeodeToken mov bx, position mul bx ; ax = index into list mov si, ax ; ds:[si] = desired token mov ax, LMEM_TYPE_GENERAL clr cx ; block header size call MemAllocLMem ; returns bx = block handle mov monikerBlock, bx ; ; Set up parameters to TokenLoadMoniker ; mov di, searchFlags push di ; VisMonikerSearchFlags mov cx, bx ; cx = lmem block handle clr di ; create a chunk for moniker mov ax, {word} ds:[si].GT_chars ; get Token mov bx, {word} ds:[si].GT_chars+2 mov si, ds:[si].GT_manufID push di ; pass unused buffer size mov dh, displayType call TokenLoadMoniker ; di = chunk handle jc noToken ; ; Free the list-block and return the new moniker ; mov bx, listBlock call MemFree mov cx, monikerBlock mov dx, di ; ^lcx:dx = moniker clc jmp short done noToken: stc done: .leave ret GetTokenMonikerByPosition endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% VisMonikerToHugeBitmap %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Takes a vismoniker and returns a huge bitmap. Uses BMO. CALLED BY: MakeIconFromToken PASS: ^lcx:dx = VisMoniker ds = segment of DBViewer RETURN: ^vcx:dx = huge bitmap DESTROYED: nothing KNOWN BUGS/SIDE EFFECTS/IDEAS: This routine nukes whatever bitmap was in the BMO, so be sure to save it if you needed it. PSEUDO CODE/STRATEGY: - save the bitmap currently in the BMO - load the gstring from the moniker - create a bitmap in the BMO using the gstring - get the main bitmap from the BMO (we return this) - put the original bitmap back in the BMO REVISION HISTORY: Name Date Description ---- ---- ----------- stevey 11/28/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ VisMonikerToHugeBitmap proc near uses ax,bx,si,di,bp,es .enter segmov es, ds, bx ; es = DBViewer segment movdw bxsi, cxdx ; ; Load the gstring from the VisMoniker ; push bx ; save block handle call MemLock mov ds, ax mov bx, ax ; bx = segment address mov si, ds:[si] ; bx:si = VisMoniker add si, size VisMoniker + size VisMonikerGString ; bx:si=gstring mov cl, GST_PTR call GrLoadGString ; returns si = gstring handle push si ; save handle to free... mov bp, si ; bp = gstring ; ; Create a bitmap in the BMO using the gstring. Free up ; any old data structures first. ; segmov ds, es, bx mov bx, ds:[LMBH_handle] mov si, offset BMO mov di, mask MF_CALL or mask MF_FIXUP_DS mov ax, MSG_VIS_BITMAP_BECOME_DORMANT call ObjMessage mov di, mask MF_CALL or mask MF_FIXUP_DS clr cx ; get bounds from gstring mov ax, MSG_VIS_BITMAP_CREATE_BITMAP call ObjMessage ; ; Get the bitmap and return it. ; mov di, mask MF_CALL or mask MF_FIXUP_DS mov ax, MSG_VIS_BITMAP_GET_MAIN_BITMAP call ObjMessage ; returns ^vcx:dx ; ; Free up the gstring we created, and unlock the vismoniker block. ; pop si ; restore gstring handle clr di ; no gstate mov_tr ax, dx ; ^vcx:ax = bitmap mov dl, GSKT_LEAVE_DATA call GrDestroyGString pop bx ; restore block handle call MemUnlock mov_tr dx, ax ; ^vcx:dx = bitmap .leave ret VisMonikerToHugeBitmap endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% UpdateProgressDialog %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Updates the ImportProgressDialog to show progress. CALLED BY: DBViewerImportTokenDatabase PASS: cx = token that we're on bx = position in the token database bp = total number of tokens to import RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: - multiply the numerator (cx) by 100 - divide - take integer result and stick it in ImportProgressValue - get the moniker from the database - use it to update the ImportProgressGlyph REVISION HISTORY: Name Date Description ---- ---- ----------- stevey 12/ 2/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ UpdateProgressDialog proc near uses ax,bx,cx,dx,si,di,bp .enter push bx ; save position ; ; Figure out what percentage we're on, rounded to nearest percent ; jcxz divideZero ; 0 percent mov ax, 100 mul cx clr dx ; high word of dividend div bp ; ax = percent (integer) mov dx, ax ; dx = percent jmp short doneMult divideZero: mov dx, cx doneMult: GetResourceHandleNS ImportProgressValue, bx mov si, offset ImportProgressValue mov di, mask MF_CALL or mask MF_FIXUP_DS mov ax, MSG_GEN_VALUE_SET_VALUE clr bp ; not indeterminate call ObjMessage ; ; Now update the display glyph ; GetResourceHandleNS IconApp, bx mov si, offset IconApp mov di, mask MF_CALL or mask MF_FIXUP_DS mov ax, MSG_GEN_APPLICATION_GET_DISPLAY_SCHEME call ObjMessage mov cl, ah ; DisplayType pop bx ; bx = item number mov ax, (VMS_ICON shl offset VMSF_STYLE) or \ mask VMSF_GSTRING call GetTokenMonikerByPosition ; ^lcx:dx = moniker push cx GetResourceHandleNS ImportProgressGlyph, bx mov si, offset ImportProgressGlyph mov di, mask MF_CALL or mask MF_FIXUP_DS mov ax, MSG_GEN_REPLACE_VIS_MONIKER_OPTR mov bp, VUM_NOW call ObjMessage ; ; Free the block returned by GetTokenMonikerByPosition ; pop bx call MemFree .leave ret UpdateProgressDialog endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GetTokenCharsByPosition %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Returns the GT_chars for the token, given a position. CALLED BY: INTERNAL PASS: bx = position RETURN: ax = {word} GT_chars bx = {word} GT_chars+2 DESTROYED: nothing PSEUDO CODE/STRATEGY: - make a list of the gstring tokens - use the passed position as an index into the list - get the token chars and return them REVISION HISTORY: Name Date Description ---- ---- ----------- stevey 11/30/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ GetTokenCharsByPosition proc near uses cx,dx,si,ds .enter mov dx, bx ; save position mov ax, mask TRF_ONLY_GSTRING clr bx call TokenListTokens ; bx = list-block handle call MemLock mov cx, bx ; save handle mov ds, ax ; ds:0 = token list mov ax, size GeodeToken mov bx, dx ; restore position mul bx ; ax = index into list mov si, ax ; ds:[si] = desired token mov ax, {word} ds:[si].GT_chars ; get Token mov bx, {word} ds:[si].GT_chars+2 xchg bx, cx ; bx <- handle of list block call MemFree xchg bx, cx ; bx <- chars .leave ret GetTokenCharsByPosition endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% IconApplicationUpdateTokenViewer %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Makes a list of the tokens in the token.db CALLED BY: MSG_ICON_APPLICATION_UPDATE_TOKEN_VIEWER PASS: nothing RETURN: nothing DESTROYED: ax, cx, dx, bp PSEUDO CODE/STRATEGY: - delete all children in viewer - count tokens in token.db file - add that many children to viewer - clear TokenDBNumSelected - initialize TokenDBNumTokens REVISION HISTORY: Name Date Description ---- ---- ----------- stevey 11/29/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ IconApplicationUpdateTokenViewer method IconApplicationClass, MSG_ICON_APPLICATION_UPDATE_TOKEN_VIEWER .enter ; ; First get rid of all the items currently in the list ; GetResourceHandleNS TokenDBViewer, bx mov si, offset TokenDBViewer mov di, mask MF_CALL mov ax, MSG_GEN_DYNAMIC_LIST_GET_NUM_ITEMS call ObjMessage ; returns in cx jcxz doneRemove mov dx, cx ; number of items to remove GetResourceHandleNS TokenDBViewer, bx mov si, offset TokenDBViewer mov di, mask MF_CALL mov cx, GDLP_FIRST mov ax, MSG_GEN_DYNAMIC_LIST_REMOVE_ITEMS call ObjMessage doneRemove: ; ; Count number of tokens in token.db and add that many children ; mov ax, mask TRF_ONLY_GSTRING clr bx call TokenListTokens ; ax = # tokens in list call MemFree ; get rid of the actual list push ax ; save number mov dx, ax ; dx = number of items to add GetResourceHandleNS TokenDBViewer, bx mov si, offset TokenDBViewer clr di mov cx, GDLP_LAST mov ax, MSG_GEN_DYNAMIC_LIST_ADD_ITEMS call ObjMessage ; ; Initialize the GenValues in the viewer box. ; pop dx GetResourceHandleNS TokenDBNumTokens, bx mov si, offset TokenDBNumTokens clr di mov ax, MSG_GEN_VALUE_SET_VALUE clr bp ; not indeterminate clr cx ; fractional value call ObjMessage GetResourceHandleNS TokenDBNumSelected, bx mov si, offset TokenDBNumSelected clr di mov ax, MSG_GEN_VALUE_SET_VALUE clrdw cxdx ; integer.fraction clr bp ; not indeterminate call ObjMessage .leave ret IconApplicationUpdateTokenViewer endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% IconSelectAllTokens %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Selects all the icons in the token.db viewer CALLED BY: MSG_ICON_SELECT_ALL_TOKENS PASS: nothing RETURN: nothing DESTROYED: ax, cx, dx, bp PSEUDO CODE/STRATEGY: - count the tokens - make a block containing identifers (0-numChildren) - pass the block to the item group, selecting them all - update TokenDBNumSelected REVISION HISTORY: Name Date Description ---- ---- ----------- stevey 11/30/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ IconSelectAllTokens method dynamic IconProcessClass, MSG_ICON_SELECT_ALL_TOKENS ; ; Get a buffer with all the identifiers in the list. ; It should be sequential integers, so just query the ; list for the number of children ; GetResourceHandleNS TokenDBViewer, bx mov si, offset TokenDBViewer mov di, mask MF_CALL mov ax, MSG_GEN_DYNAMIC_LIST_GET_NUM_ITEMS ; returns in cx call ObjMessage mov_tr ax, cx ; ax = number of selections mov bp, ax ; bp = num selections shl ax ; ax = bytes to allocate mov cx, ALLOC_DYNAMIC_LOCK call MemAlloc jc done ; out of memory push bx ; save block handle ; ; set the identifiers in the block (0 at position 0, 1 at ; position 1, etc). ; mov ds, ax ; segment address clr cx ; counter blockLoop: mov si, cx ; index shl si ; word-sized identifiers mov ds:[si], cx ; position = value inc cx cmp cx, bp jb blockLoop ; ; Now set the selections ; mov cx, ds clr dx ; cx:dx = buffer push bp ; save num selections GetResourceHandleNS TokenDBViewer, bx mov si, offset TokenDBViewer mov di, mask MF_CALL mov ax, MSG_GEN_ITEM_GROUP_SET_MULTIPLE_SELECTIONS call ObjMessage pop dx ; dx = num selections GetResourceHandleNS TokenDBNumSelected, bx mov si, offset TokenDBNumSelected mov di, mask MF_CALL mov ax, MSG_GEN_VALUE_SET_VALUE clrdw cxbp call ObjMessage pop bx ; restore block handle call MemFree ; free the selection block done: ret IconSelectAllTokens endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% IconSelectTokenFromList %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Updates the "selected" genValue in the token.db dialog. CALLED BY: MSG_ICON_SELECT_TOKEN_FROM_LIST PASS: cx = selection RETURN: nothing DESTROYED: ax, cx, dx, bp PSEUDO CODE/STRATEGY: - count the selections, and put them in the "selected" box REVISION HISTORY: Name Date Description ---- ---- ----------- stevey 11/30/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ IconSelectTokenFromList method dynamic IconProcessClass, MSG_ICON_SELECT_TOKEN_FROM_LIST ; ; See if the item was selected or unselected ; GetResourceHandleNS TokenDBViewer, bx mov si, offset TokenDBViewer mov di, mask MF_CALL mov ax, MSG_GEN_ITEM_GROUP_GET_NUM_SELECTIONS call ObjMessage mov dx, ax ; num selections GetResourceHandleNS TokenDBNumSelected, bx mov si, offset TokenDBNumSelected mov di, mask MF_CALL mov ax, MSG_GEN_VALUE_SET_VALUE clrdw cxbp call ObjMessage ret IconSelectTokenFromList endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% IconTokenListGetItemMoniker %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: TokenDBViewer wants another token's moniker. CALLED BY: MSG_ICON_TOKEN_LIST_GET_ITEM_MONIKER PASS: bp = item number RETURN: nothing DESTROYED: ax, cx, dx, bp PSEUDO CODE/STRATEGY: - get the display scheme - pull out the best moniker available from the token.db for the passed item/position. REVISION HISTORY: Name Date Description ---- ---- ----------- stevey 11/29/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ IconTokenListGetItemMoniker method dynamic IconProcessClass, MSG_ICON_TOKEN_LIST_GET_ITEM_MONIKER ; ; Get the current DisplayType ; push bp ; save item number GetResourceHandleNS IconApp, bx mov si, offset IconApp mov di, mask MF_CALL mov ax, MSG_GEN_APPLICATION_GET_DISPLAY_SCHEME call ObjMessage mov cl, ah ; DisplayType pop bx ; bx = item number mov ax, (VMS_ICON shl offset VMSF_STYLE) or \ mask VMSF_GSTRING call GetTokenMonikerByPosition ; ^lcx:dx = moniker jc done ; no token push cx ; save moniker block mov bp, bx ; bp = item number GetResourceHandleNS TokenDBViewer, bx mov si, offset TokenDBViewer mov ax, MSG_GEN_DYNAMIC_LIST_REPLACE_ITEM_MONIKER_OPTR mov di, mask MF_CALL call ObjMessage pop bx ; restore moniker block call MemFree ; free the moniker done: ret IconTokenListGetItemMoniker endm TokenCode ends ChangeIconCode segment resource COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% IconGetAppToken %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Shows user the current moniker for selected application. CALLED BY: MSG_ICON_GET_APP_TOKEN PASS: ds = dgroup bp = GenFileSelectorEntryFlags RETURN: nothing DESTROYED: ax, cx, dx, bp PSEUDO CODE/STRATEGY: This routine is called when the user selects a file in the GenFileSelector. We look up the token for that geode in the token database, and if it has one, we get the appropriate moniker and display it in the dialog. REVISION HISTORY: Name Date Description ---- ---- ----------- stevey 4/11/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ IconGetAppToken method dynamic IconProcessClass, MSG_ICON_GET_APP_TOKEN .enter andnf bp, mask GFSEF_TYPE ; isolate type enum cmp bp, GFSET_FILE LONG jne done ; don't deal with dirs call GetTokenCharsFromFileSelector call UpdateDialogMoniker done: .leave ret IconGetAppToken endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% UpdateDialogMoniker %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Updates the moniker in the dialog. CALLED BY: UTILITY PASS: ax:cx:si = token RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- stevey 4/20/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ UpdateDialogMoniker proc near uses ax,bx,cx,dx,si,di,bp .enter ; ; Get the moniker out of the database. ; push ax, cx, si GetResourceHandleNS IconApp, bx mov si, offset IconApp mov di, mask MF_CALL mov ax, MSG_GEN_APPLICATION_GET_DISPLAY_SCHEME call ObjMessage ; ah = DisplayType mov dh, ah mov ax, LMEM_TYPE_GENERAL clr cx ; block header size call MemAllocLMem ; returns bx = block handle mov cx, bx ; cx = handle pop ax, bx, si ; six bytes of token push cx ; save block handle mov di, (VMS_ICON shl offset VMSF_STYLE) or \ mask VMSF_GSTRING push di ; VisMonikerSearchFlags clr di ; create chunk in cx block push di ; pass unused buffer size call TokenLoadMoniker ; di <- chunk handle pop cx ; ^lcx:di = moniker ; ; Replace the CurrentTokenGlyph's moniker ; tst di jz noMoniker ; oops mov dx, di ; ^lcx:dx = moniker push cx ; save moniker block GetResourceHandleNS CurrentTokenGlyph, bx mov si, offset CurrentTokenGlyph mov di, mask MF_CALL mov bp, VUM_NOW mov ax, MSG_GEN_REPLACE_VIS_MONIKER_OPTR call ObjMessage ; ; Now nuke the moniker block. ; pop bx call MemFree jmp short done noMoniker: sub sp, size ReplaceVisMonikerFrame mov bp, sp mov dx, size ReplaceVisMonikerFrame mov ss:[bp].RVMF_dataType, VMDT_NULL mov ss:[bp].RVMF_updateMode, VUM_NOW GetResourceHandleNS CurrentTokenGlyph, bx mov si, offset CurrentTokenGlyph mov di, mask MF_STACK mov ax, MSG_GEN_REPLACE_VIS_MONIKER call ObjMessage add sp, size ReplaceVisMonikerFrame done: .leave ret UpdateDialogMoniker endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DBViewerChangeAppToken %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Replaces the app's token.db entry with the current icon. CALLED BY: MSG_DB_VIEWER_CHANGE_APP_TOKEN PASS: *ds:si = DBViewer object ds:di = DBViewerInstance es = dgroup RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: - create a moniker list from the current icon - get the token chars for the selected Geode - call TokenDefineToken with the moniker list REVISION HISTORY: Name Date Description ---- ---- ----------- stevey 4/11/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DBViewerChangeAppToken method dynamic DBViewerClass, MSG_DB_VIEWER_CHANGE_APP_TOKEN uses ax, cx, dx, bp .enter cmp ds:[di].DBVI_currentIcon, NO_CURRENT_ICON LONG je done ; ; If the icon's dirty, see if they want to save it. ; call CheckIconDirtyAndDealWithIt LONG jc done call IconMarkBusy ; ; Find out how many formats there are in the icon. ; push ds:[LMBH_handle] mov ax, ds:[di].DBVI_currentIcon mov bp, ds:[di].GDI_fileHandle call IdGetFormatCount ; bx = count push bx ; save format count ; ; Allocate a chunk with that many VisMonikerListEntry structures. ; mov ax, LMEM_TYPE_GENERAL clr cx call MemAllocLMem ; bx = block call MemLock mov ds, ax ; ds = block mov cx, size VisMonikerListEntry pop ax ; ax = format count mul cx ; ax = block size mov_tr cx, ax clr al ; flags call LMemAlloc ; ^lbx:ax = moniker list call MemUnlock ; ; For each format, make a moniker out of it and store the ; VisMonikerListEntryType and actual moniker in the list entry. ; pop cx ; DBViewer block handle xchg bx, cx call MemDerefDS ; *ds:si = DBViewer mov bx, cx ; bx = moniker list block call FillInMonikerList mov_tr dx, ax ; ^lbx:dx = moniker list push bx ; save block handle ; ; Set the moniker list as the entry (in token database) for geode. ; call GetUserTokenChars jcxz noChars push ax, bx, si ; save token chars xchg bx, cx ; ax:bx:si = token chars ; ^lcx:dx = moniker list clr bp ; TokenFlags call TokenDefineToken pop ax, bx, si ; restore token chars call UpdateDialogMoniker ; ; Notify user of the change. ; mov si, offset ChangedAppIconText call DisplayNotification noChars: ; ; Nuke the handle of the moniker list. ; pop bx call MemFree call IconMarkNotBusy done: .leave ret DBViewerChangeAppToken endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GetUserTokenChars %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Returns token characters specified by dialog ui. CALLED BY: DBViewerChangeAppToken, IconResetAppToken PASS: nothing RETURN: ax:cx:si = GeodeToken DESTROYED: nothing PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- stevey 5/ 3/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ GetUserTokenChars proc near uses bx, dx, di, bp .enter ; ; See whether the user wants to use the file selector or the ; token-chars text & genvalue. ; GetResourceHandleNS ChangeIconSourceSelector, bx mov si, offset ChangeIconSourceSelector mov di, mask MF_CALL or mask MF_FIXUP_DS mov ax, MSG_GEN_ITEM_GROUP_GET_SELECTION call ObjMessage ; ; Call the appropriate handler. ; EC < cmp ax, ChangeIconSourceType > EC < ERROR_AE INVALID_CHANGE_ICON_SOURCE_TYPE > mov_tr bx, ax mov bx, cs:[sourceTable][bx] call bx .leave ret sourceTable word \ offset GetTokenCharsFromFileSelector, offset GetTokenCharsFromTokenGroup GetUserTokenChars endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GetTokenCharsFromFileSelector %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Returns the token chars for the selected geode. CALLED BY: INTERNAL PASS: nothing RETURN: ax:cx:si = token chars DESTROYED: nothing PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- stevey 4/11/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ GetTokenCharsFromFileSelector proc near uses bx,dx,di,bp,ds .enter ; ; Get the selection from the file selector. ; sub sp, (size PathName + size FileLongName) mov cx, ss mov dx, sp ; cx:dx = buffer for name sub sp, (size GeodeToken) GetResourceHandleNS ChangeIconFileSelector, bx mov si, offset ChangeIconFileSelector mov di, mask MF_CALL mov ax, MSG_GEN_FILE_SELECTOR_GET_FULL_SELECTION_PATH call ObjMessage ; cx:dx = path ; ; Get the extended attributes (FEA_TOKEN) from the file. ; push dx ; save path call FilePushDir mov bx, ax GetResourceSegmentNS dgroup, ds mov dx, offset ds:rootString ; ds:dx = "\\",0 call FileSetCurrentPath pop dx ; restore path mov ax, FEA_TOKEN segmov es, ss, di mov di, sp ; es:di = buffer for token mov cx, size GeodeToken call FileGetPathExtAttributes call FilePopDir ; ; Move the token chars into ax:cx:si ; mov bp, sp ; ss:bp = GeodeToken mov ax, {word}ss:[bp].GT_chars mov cx, {word}ss:[bp].GT_chars+2 mov si, {word}ss:[bp].GT_manufID add sp, (size GeodeToken + size PathName \ + size FileLongName) .leave ret GetTokenCharsFromFileSelector endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GetTokenCharsFromTokenGroup %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Returns token characters from text object & GenValue CALLED BY: utility PASS: nothing RETURN: ax:cx:si = GeodeToken DESTROYED: nothing PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- stevey 5/ 3/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ GetTokenCharsFromTokenGroup proc near uses bx,dx,di,bp .enter ; ; Get the characters. ; sub sp, size GeodeToken mov dx, ss mov bp, sp ; dx.bp = buffer GetResourceHandleNS TokenCharsText, bx mov si, offset TokenCharsText mov di, mask MF_CALL mov ax, MSG_VIS_TEXT_GET_ALL_PTR call ObjMessage ; cx = string length ; ; Get the manufacturer ID. ; GetResourceHandleNS ManufIDValue, bx mov si, offset ManufIDValue mov di, mask MF_CALL mov ax, MSG_GEN_VALUE_GET_VALUE call ObjMessage ; dx = integer value ; ; Put the token in ax:cx:si ; mov bp, sp ; ss:bp = token chars mov ax, {word}ss:[bp].GT_chars mov cx, {word}ss:[bp].GT_chars+2 mov si, dx ; manufacturer ID add sp, size GeodeToken .leave ret GetTokenCharsFromTokenGroup endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% FillInMonikerList %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Creates monikers from each of the icon's formats. CALLED BY: DBViewerChangeAppToken PASS: *ds:si = DBViewer object ^lbx:ax = chunk for moniker list (already created) RETURN: ^lbx:ax = list (initialized) DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: Don't add the format if it's larger than 64K. REVISION HISTORY: Name Date Description ---- ---- ----------- stevey 4/11/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ FillInMonikerList proc near class DBViewerClass uses ax,bx,cx,dx,si,di,bp monikerBlock local hptr push bx monikerChunk local word push ax .enter push bp ; locals mov di, ds:[si] add di, ds:[di].Gen_offset mov bp, ds:[di].GDI_fileHandle mov ax, ds:[di].DBVI_currentIcon call IdGetFormatCount ; bx = count pop bp ; locals mov cx, bx ; cx = #formats clc ; no formats = no error jcxz done mov bx, monikerBlock clr si ; offset into list ; ; Loop through the formats, creating chunks for them in the ; passed block, saving the moniker optrs. ; formatLoop: ; ; Get the next format, make it a moniker and store it in list. ; dec cx ; 0-indexed formats mov ax, cx call MakeMonikerFromFormat ; ^lbx:dx = moniker jc done ; ax = IF_type push cx ; save counter mov_tr cx, ax ; cx = IF_type mov ax, monikerChunk ; ax = monikerlist call StoreMonikerInList pop cx ; restore counter add si, size VisMonikerListEntry ; point to next inc cx ; decremented at top loop formatLoop clc ; no error done: .leave ret FillInMonikerList endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% MakeMonikerFromFormat %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Creates a vis-moniker given a format number and a block. CALLED BY: FillInMonikerList PASS: ds:di = DBViewerInstance ax = format number bx = block to create moniker in RETURN: ^lbx:dx = moniker ax = IF_type carry set on error DESTROYED: nothing PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- stevey 4/11/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ MakeMonikerFromFormat proc near class DBViewerClass uses bx,cx,si,di,bp .enter push bx ; passed block mov bx, ax mov ax, ds:[di].DBVI_currentIcon mov bp, ds:[di].GDI_fileHandle call IdGetFormat ; ^vcx:dx = format push cx, dx ; save bitmap call IdGetFormatParameters ; cx = IF_type mov di, cx pop cx, dx ; restore bitmap pop bx ; passed block call JohnCreateMonikerFromBitmap ; ^lcx:dx = moniker jc done mov_tr ax, di ; return IF_type clc done: .leave ret MakeMonikerFromFormat endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% StoreMonikerInList %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Stores passed moniker in passed list (must be in same block). CALLED BY: FillInMonikerList PASS: ^lbx:ax = moniker list ^lbx:dx = moniker cx = VisMonikerListEntryType for the moniker si = offset of VisMonikerListEntry in ax chunk RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: Well, there's only one trick--we have to set the VMLET_MONIKER_LIST bit in the VisMonikerListEntryType passed in cx. REVISION HISTORY: Name Date Description ---- ---- ----------- stevey 4/11/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ StoreMonikerInList proc near uses ax,cx,dx,di,bp,es .enter mov di, ax ; ^lbx:di = moniker list ornf cl, mask VMLET_MONIKER_LIST call MemLock mov es, ax mov bp, es:[di] ; es:bp = moniker list mov es:[bp][si].VMLE_moniker.handle, bx mov es:[bp][si].VMLE_moniker.chunk, dx mov es:[bp][si].VMLE_type, cx call MemUnlock .leave ret StoreMonikerInList endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% IconTextUserModified %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: User types in a token character. CALLED BY: MSG_META_TEXT_USER_MODIFIED PASS: *ds:si = IconProcessClass object ds:di = IconProcessClass instance data RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- stevey 5/ 3/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ IconTextUserModified method dynamic IconProcessClass, MSG_META_TEXT_USER_MODIFIED uses ax, cx, dx, bp .enter ; ; Mark the text as not-user modified so we'll get this ; message when they type another character. ; GetResourceHandleNS TokenCharsText, bx mov si, offset TokenCharsText mov di, mask MF_FORCE_QUEUE mov ax, MSG_VIS_TEXT_SET_NOT_USER_MODIFIED call ObjMessage ; ; Call the common routine for updating stuff. ; call GetTokenCharsFromTokenGroup call UpdateDialogMoniker .leave ret IconTextUserModified endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% TokenValueSetValue %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: User changed the manufacturer ID in the change-icon dialog. CALLED BY: MSG_GEN_VALUE_SET_VALUE PASS: *ds:si = TokenValueClass object ds:di = TokenValueClass instance data ax = the message dx = the integer value RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- stevey 5/ 3/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ TokenValueSetValue method dynamic TokenValueClass, MSG_GEN_VALUE_SET_VALUE uses ax, cx, dx, bp .enter ; ; Let the superclass do its little thing. ; mov di, offset TokenValueClass call ObjCallSuperNoLock ; ; Call the common routine. ; call GetTokenCharsFromTokenGroup ; ax:cx:si = token call UpdateDialogMoniker .leave ret TokenValueSetValue endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DBViewerInitExportTokenDialog %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Sets the moniker of the change-icon glyph. CALLED BY: MSG_DB_VIEWER_INIT_CHANGE_ICON_DIALOG PASS: *ds:si = DBViewerClass object ds:di = DBViewerClass instance data RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: Don't do this if the icon is > 64K. REVISION HISTORY: Name Date Description ---- ---- ----------- stevey 5/ 4/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DBViewerInitExportTokenDialog method dynamic DBViewerClass, MSG_DB_VIEWER_INIT_CHANGE_ICON_DIALOG uses ax, cx, dx, bp .enter ; ; See if there's an icon being edited. ; cmp ds:[di].DBVI_currentIcon, NO_CURRENT_ICON je noMoniker ; ; Create a moniker using the first format in the list. ; push bp mov bp, ds:[di].GDI_fileHandle mov ax, ds:[di].DBVI_currentIcon clr bx ; first format call IdGetFormat ; ^vcx:dx = bitmap pop bp ; ; Create the moniker. ; clr bx ; create new block call JohnCreateMonikerFromBitmap ; ^lcx:dx = moniker jc noMoniker ; don't display ; ; Now replace the moniker. ; push cx, bp ; save block handle GetResourceHandleNS ChangeTokenGlyph, bx mov si, offset ChangeTokenGlyph mov di, mask MF_CALL mov ax, MSG_GEN_REPLACE_VIS_MONIKER_OPTR mov bp, VUM_NOW call ObjMessage pop bx, bp ; restore block handle call MemFree jmp done noMoniker: ; ; Just clear out the glyph. ; push bp ; locals sub sp, size ReplaceVisMonikerFrame mov bp, sp mov dx, size ReplaceVisMonikerFrame mov ss:[bp].RVMF_dataType, VMDT_NULL mov ss:[bp].RVMF_updateMode, VUM_NOW GetResourceHandleNS ChangeTokenGlyph, bx mov si, offset ChangeTokenGlyph mov di, mask MF_STACK mov ax, MSG_GEN_REPLACE_VIS_MONIKER call ObjMessage add sp, size ReplaceVisMonikerFrame pop bp ; locals done: .leave ret DBViewerInitExportTokenDialog endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ImportValueGetValueText %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Append a "%" onto the value. CALLED BY: MSG_GEN_VALUE_GET_VALUE_TEXT PASS: *ds:si = ImportValueClass object ds:di = ImportValueClass instance data cx:dx = pointer to buffer to put text, must be at least GEN_VALUE_MAX_TEXT_LEN bytes long. bp = GenValueType RETURN: cx:dx = buffer, filled in with the textual representation DESTROYED: nothing PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- stevey 5/25/93 Initial version stevey 2/ 2/94 used jwu's code for spacing %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ImportValueGetValueText method dynamic ImportValueClass, MSG_GEN_VALUE_GET_VALUE_TEXT uses ax, cx, dx, bp .enter ; ; Call the superclass. ; mov di, offset ImportValueClass call ObjCallSuperNoLock ; ; Add some spaces in the beginning of the string to pad it ; so that the text will look centered. ; sub sp, GEN_VALUE_MAX_TEXT_LEN segmov es, ss, ax mov di, sp ; es:di <- our buffer push es, di ; save our buffer ; ; Figure out how much padding we need and put them in the buffer. ; Returns with ES:DI pointing to the end of the spaces in the buffer. ; call ImportValuePadText ; ; Append the value text string to the spaces. ; mov ds, cx mov si, dx ; ds:si = value text str push cx, dx ; save passed buffer LocalCopyString dec di ; remove null term. ; ; Tack a "%" onto the string. ; mov ax, C_PERCENT LocalPutChar esdi, ax mov ax, C_NULL LocalPutChar esdi, ax ; ; Now finally, put the whole string back into the passed buffer. ; pop es, di ; es:di <- passed buffer pop ds, si ; ds:si <- our buffer LocalCopyString add sp, GEN_VALUE_MAX_TEXT_LEN .leave ret ImportValueGetValueText endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ImportValuePadText %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Figures out how many spaces to pad the value text string with to center it. CALLED BY: ImportValueGetValueText PASS: *ds:si = ImportValueClass object es:di = buffer to put spaces in (GEN_VALUE_MAX_TEXT_LEN) RETURN: es:di = position in buffer immediately after last space DESTROYED: ax, si PSEUDO CODE/STRATEGY: This is a hack to cause the text of a GenValue to be centered. REVISION HISTORY: Name Date Description ---- ---- ----------- jwu 2/ 3/94 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ IMPORT_VALUE_CHARS equ 3 IMPORT_VALUE_PADDING_ESTIMATE equ 22 ImportValuePadText proc near uses cx, dx .enter ; ; Figure out the amount of space needed to the left of center for ; the GenValue. ; mov ax, MSG_VIS_GET_SIZE call ObjCallInstanceNoLock ; cx <- width ; ; A hack for when this gets called before the object has been built: ; just estimate how many spaces it will take. ; jcxz estimate shr cx, 1 ; divide by 2 ; ; Find out the width of a space character. ; push di ; save buffer pointer mov ax, MSG_VIS_VUP_CREATE_GSTATE call ObjCallInstanceNoLock ; ^hbp <- gstate mov di, bp ; di <- gstate handle mov ax, C_SPACE call GrCharWidth ; dx <- width call GrDestroyState ; ; Divide the amount of space to the left of center by the width ; of a space character to determine the number of spaces needed. ; mov_tr ax, cx ; ax <- space to left div dl ; al = # chars needed clr ah ; ; Insert the computed # of spaces into the buffer, taking into ; account the characters in the value text string. ; pop di ; restore buffer pointer mov_tr cx, ax ; cx <- # chars needed jcxz done sub cx, IMPORT_VALUE_CHARS ; cx <- # spaces to use padLoop: mov ax, C_SPACE LocalPutChar esdi, ax loop padLoop done: .leave ret estimate: mov cx, IMPORT_VALUE_PADDING_ESTIMATE jmp short padLoop ImportValuePadText endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% IconResetAppToken %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Removes the token from the database. CALLED BY: MSG_ICON_RESET_APP_TOKEN PASS: nothing RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- stevey 6/ 2/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ IconResetAppToken method dynamic IconProcessClass, MSG_ICON_RESET_APP_TOKEN uses ax, cx .enter ; ; Get the token chars and remove the token. ; call GetUserTokenChars ; ax:cx:si = token mov bx, cx call TokenRemoveToken ; ; Clear the current-icon glyph. ; sub sp, size ReplaceVisMonikerFrame mov bp, sp mov dx, size ReplaceVisMonikerFrame mov ss:[bp].RVMF_dataType, VMDT_NULL mov ss:[bp].RVMF_updateMode, VUM_NOW GetResourceHandleNS CurrentTokenGlyph, bx mov si, offset CurrentTokenGlyph mov di, mask MF_STACK mov ax, MSG_GEN_REPLACE_VIS_MONIKER call ObjMessage add sp, size ReplaceVisMonikerFrame ; ; Notify user of the change. ; mov si, offset RemovedTokenText call DisplayNotification .leave ret IconResetAppToken endm ChangeIconCode ends
; A105946: C(n+5,n)*C(n+3,3). ; Submitted by Jon Maiga ; 1,24,210,1120,4410,14112,38808,95040,212355,440440,858858,1589952,2815540,4798080,7907040,12651264,19718181,30020760,44753170,65456160,94093230,133138720,185679000,255528000,347358375,466849656,620854794,817586560,1066825320 mov $2,$0 add $2,3 bin $2,$0 add $0,5 bin $0,5 mul $0,$2
#include "Platform.inc" #include "TestDoubles.inc" radix decimal udata global powerManagementFlags global fastClockCount powerManagementFlags res 1 fastClockCount res 1 PowerManagementDummies code end
.global s_prepare_buffers s_prepare_buffers: push %r11 push %r15 push %r8 push %r9 push %rbx push %rcx push %rdi push %rdx push %rsi lea addresses_WT_ht+0x1e4ac, %rbx nop and %r8, %r8 movups (%rbx), %xmm6 vpextrq $0, %xmm6, %r11 nop nop nop nop sub $11906, %rdx lea addresses_WT_ht+0x8ac, %rcx nop nop nop nop nop dec %r15 movl $0x61626364, (%rcx) nop nop nop nop and $39128, %r8 lea addresses_A_ht+0x19c24, %rcx nop nop dec %rdx movl $0x61626364, (%rcx) nop nop nop cmp %r8, %r8 lea addresses_A_ht+0x7b2c, %rsi lea addresses_normal_ht+0x314c, %rdi clflush (%rdi) nop add $7898, %r11 mov $17, %rcx rep movsb dec %rdx lea addresses_WC_ht+0x4b8c, %rdx nop nop nop nop cmp %r8, %r8 movb (%rdx), %r9b add $11205, %r11 lea addresses_WC_ht+0x1da8c, %r9 nop cmp %rdi, %rdi movb $0x61, (%r9) nop nop nop and $32096, %r15 lea addresses_normal_ht+0x1be2c, %rbx nop nop nop nop cmp %rcx, %rcx movw $0x6162, (%rbx) cmp %rdx, %rdx pop %rsi pop %rdx pop %rdi pop %rcx pop %rbx pop %r9 pop %r8 pop %r15 pop %r11 ret .global s_faulty_load s_faulty_load: push %r10 push %r14 push %r9 push %rbx push %rcx push %rdi push %rdx push %rsi // Store mov $0xd4c, %rdx nop nop inc %r14 mov $0x5152535455565758, %r9 movq %r9, (%rdx) nop nop and %r10, %r10 // REPMOV lea addresses_WT+0x1342c, %rsi lea addresses_D+0x502c, %rdi nop nop nop nop sub %r9, %r9 mov $17, %rcx rep movsb nop nop nop and %rsi, %rsi // Store lea addresses_normal+0x1e78a, %rcx nop nop nop nop sub $47581, %r14 mov $0x5152535455565758, %r10 movq %r10, (%rcx) nop nop xor %rdx, %rdx // Faulty Load lea addresses_normal+0x1582c, %r14 clflush (%r14) nop nop nop nop nop add %r10, %r10 mov (%r14), %cx lea oracles, %rdi and $0xff, %rcx shlq $12, %rcx mov (%rdi,%rcx,1), %rcx pop %rsi pop %rdx pop %rdi pop %rcx pop %rbx pop %r9 pop %r14 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_normal', 'size': 2, 'AVXalign': False}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 5, 'NT': False, 'type': 'addresses_P', 'size': 8, 'AVXalign': False}} {'src': {'type': 'addresses_WT', 'congruent': 8, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_D', 'congruent': 11, 'same': False}} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 1, 'NT': False, 'type': 'addresses_normal', 'size': 8, 'AVXalign': False}} [Faulty Load] {'src': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_normal', 'size': 2, 'AVXalign': False}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'same': False, 'congruent': 7, 'NT': False, 'type': 'addresses_WT_ht', 'size': 16, 'AVXalign': False}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 7, 'NT': False, 'type': 'addresses_WT_ht', 'size': 4, 'AVXalign': False}} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 2, 'NT': False, 'type': 'addresses_A_ht', 'size': 4, 'AVXalign': True}} {'src': {'type': 'addresses_A_ht', 'congruent': 7, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_normal_ht', 'congruent': 2, 'same': True}} {'src': {'same': False, 'congruent': 3, 'NT': False, 'type': 'addresses_WC_ht', 'size': 1, 'AVXalign': False}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 2, 'NT': False, 'type': 'addresses_WC_ht', 'size': 1, 'AVXalign': False}} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 9, 'NT': False, 'type': 'addresses_normal_ht', 'size': 2, 'AVXalign': False}} {'34': 12000} 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 */